Hi gcc-patches mailing list,
Alex Coplan via Sourceware Forge <[email protected]> 
has requested that the following forgejo pull request
be published on the mailing list.

Created on: 2026-05-12 12:59:38+00:00
Latest update: 2026-05-13 09:22:27+00:00
Changes: 1 changed files, 3 additions, 3 deletions
Head revision: acoplan/gcc ref fix-get-mode-mask-docs commit 
4ddfac6089ebf3d906212e3cccbfbd6e3dd3ba34
Base revision: gcc/gcc-TEST ref trunk commit 
7199cf12773b1429c19cdd5b69950b2f09470e64 r17-457-g7199cf12773b14
Merge base: 7199cf12773b1429c19cdd5b69950b2f09470e64
Full diff url: https://forge.sourceware.org/gcc/gcc-TEST/pulls/157.diff
Discussion:  https://forge.sourceware.org/gcc/gcc-TEST/pulls/157
Requested Reviewers: rearnsha

This updates the description of GET_MODE_MASK in the GCC internals
manual.  Currently it says that the macro can only be used for modes
whose bitsize is less than or equal to HOST_BITS_PER_INT.  That may have
once been correct, but these days it seems to work for modes up to
HOST_BITS_PER_WIDE_INT in size.  The code in genmodes.cc:emit_mode_mask
seems to support this.  It has:

  print_maybe_const_decl ("%sunsigned HOST_WIDE_INT", "mode_mask_array",
                          "NUM_MACHINE_MODES", adj_nunits);
  puts ("\
  ((m) >= HOST_BITS_PER_WIDE_INT)             \\\n\
   ? HOST_WIDE_INT_M1U                        \\\n\
   : (HOST_WIDE_INT_1U << (m)) - 1\n");

I did wonder whether the second sentence should be rephrased.  The macro
_can_ be used for modes whose bitsize is greater than
HOST_BITS_PER_WIDE_INT, it's just that it doesn't tell you very much
(just that the mode is at least as big as a HOST_WIDE_INT).  I've left
it as is for now, but would be happy to change it if reviewers think
it's worth doing.

Tested with make html and eyeballing the built docs.

gcc/ChangeLog:

        * doc/rtl.texi (Machine Modes): Update description of
        GET_MODE_MASK to use HOST_BITS_PER_WIDE_INT instead of
        HOST_BITS_PER_INT as the upper limit of the input mode's bitsize.


Changed files:
- M: gcc/doc/rtl.texi


Alex Coplan (1):
  doc: Fix description of GET_MODE_MASK

 gcc/doc/rtl.texi | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

-- 
2.54.0

Reply via email to