https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116498

--- Comment #3 from Alan Fisher <alancf0 at gmail dot com> ---
> It seems odd that neither Pmode nor ptr_mode is in the set of integer modes 
> though.

This does seem odd... One would think PSI should sit between HI and SI as here:
https://gcc.gnu.org/onlinedocs/gccint/Machine-Modes.html . Again, as someone
who knows little about gcc internals maybe this is not that useful but...

Upon investigation this appears to be a result of how calc_wider_mode() in
genmodes.cc works. From what I can see,
  - Each mode is iterated through
  - The objects in each mode are sorted according to some set of criteria (see
below) -
    but the sorting is done only within the mode, not between modes
  - Following the sorting process of a mode in calc_wider_mode, the 'wider'
member of
    the mode structure is set to the next member in the sorted list
  - The algorithm for emitting the mode_wider array involves iterating over
each mode,
    printing out each object within, and its 'wider' member.
  - This means that all of the integer modes are sorted together within their
    category (2); the single partial integer mode is "sorted" within its
category (3);
    and the latter is emitted in the mode_wider text output below the former
  - The comparison used to sort the objects within modes involves the
'bytesize' and
    'precision' fields, the latter of which is used for partial integers to
indicate their
    bit length. A number of other fields are also used.

Most of this code / design seems to have been around untouched for a long time.
Perhaps someone else can comment on whether this is correct output for
genmodes.

All the best,
Alan

Reply via email to