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

--- Comment #15 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <ja...@gcc.gnu.org>:

https://gcc.gnu.org/g:26e4783c707a96ebb42c6ec4537578e635974573

commit r15-7752-g26e4783c707a96ebb42c6ec4537578e635974573
Author: Jakub Jelinek <ja...@redhat.com>
Date:   Fri Feb 28 12:42:27 2025 +0100

    ifcvt: Fix ICE with (fix:SI (fix:DF (reg:DF))) [PR117712]

    As documented in the manual, FIX/UNSIGNED_FIX from floating point
    mode to integral mode has unspecified rounding and FIX from floating point
    mode to the same floating point mode is expressing rounding toward zero.
    So, some targets (arc, arm, csky, m68k, mmix, nds32, pdp11, sparc and
    visium) use
    (fix:SI (fix:SF (match_operand:SF 1 "..._operand")))
    etc. to express the rounding toward zero during conversion to integer.
    For some reason other targets don't use that.

    Anyway, the 2 FIXes (or inner FIX with outer UNSIGNED_FIX) cause problems
    since the r15-2890 which removed some strict checks in ifcvt.cc on what
    SET_SRC can be actually conditionalized (I must say I'm still worried
    about the change, don't know why one can't get e.g. inline asm or
    something with UNSPEC or some complex backend specific RTLs that
    force_operand can't handle), force_operand just ICEs on it, it can only
    handle (through expand_fix) conversions from floating point to integral.

    The following patch fixes this by detecting this case and just pretend
    the inner FIX isn't there, i.e. call expand_fix with the inner FIX's
    operand instead, which works and on targets like arm it will just
    create the nested FIXes again.

    2025-02-28  Jakub Jelinek  <ja...@redhat.com>

            PR rtl-optimization/117712
            * expr.cc (force_operand): Handle {,UNSIGNED_}FIX with
            FIX operand using expand_fix on the inner FIX operand.

            * gcc.dg/pr117712.c: New test.

Reply via email to