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

Hans-Peter Nilsson <hp at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2025-07-15
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1
                 CC|                            |hp at gcc dot gnu.org
           Assignee|unassigned at gcc dot gnu.org      |hp at gcc dot gnu.org

--- Comment #4 from Hans-Peter Nilsson <hp at gcc dot gnu.org> ---
Thanks for entering this PR.  (I missed it because I'm *way* behind on reading
the mailing lists; in the future feel absolutely free to CC me on any
MMIX-related PRs).  I've been looking into the breakage and a solution, and
this is what I was about to enter into a brand new bugzilla PR, but I think
it's good enough to just copy-paste:

With r15-7648-ge8ad697a75b087, build for MMIX libstdc++-v3 broke.  In
that commit, use of type-generic builtins with a __int128 argument was
introduced in libstdc++-v3, with the first breaking one appearing to
be __builtin_clzg.

(Those type-generic functions are virtual, they don't actually exist;
calls are transformed into type-specific functions.  There's no
__builtin_clzg in libgcc, and actually not even a 128-bit __clzTI2:
when applied to __int128, for targets without a 128-bit instruction
clz instruction, that call is transformed into an expression calling
__builtin_clzll (which in turn may be transformed).)

The function fold_builtin_bit_query is responsible for transforming
such type-generic calls into type-specific calls.  It makes use of
MAX_FIXED_MODE_SIZE, which for MMIX remains the default
GET_MODE_BITSIZE (DImode), which is just a complicated way to say 64.
That default is questionable, and the MMIX setting is debatable, but
also is the use of that macro in fold_builtin_bit_query.

This PR is about the breakage, which AFAIU can be solved using one of
three options, independently, but IMO in preferential order:

A. Fix fold_builtin_bit_query
B. Change the default of MAX_FIXED_MODE_SIZE
C. Change the MMIX-specific setting of MAX_FIXED_MODE_SIZE.

At this point, a patch has been suggested for C, but I'll go for A,
and eventually I hope to also do B.  I'll post a patch shortly for A.

Reply via email to