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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[15 Regression]             |[15 Regression]
                   |gcc.target/aarch64/ashltidi |gcc.target/aarch64/ashltidi
                   |si.c fails                  |si.c fails since r15-268
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
This changed with r15-268-g9dbff9c05520a74e6cd337578f27b56c941f64f3

 Trying 6 -> 12:
     6: r105:DI=sign_extend(r113:SI)
       REG_DEAD r113:SI
    12: r110:DI=r105:DI>>0xb
 Failed to match this instruction:
 (parallel [
         (set (reg:DI 110 [ _3+8 ])
             (sign_extract:DI (subreg:DI (reg:SI 113) 0)
                 (const_int 21 [0x15])
                 (const_int 11 [0xb])))
         (set (reg:DI 105 [ data ])
             (sign_extend:DI (reg:SI 113)))
     ])
 Failed to match this instruction:
 (parallel [
         (set (reg:DI 110 [ _3+8 ])
             (sign_extract:DI (subreg:DI (reg:SI 113) 0)
                 (const_int 21 [0x15])
                 (const_int 11 [0xb])))
         (set (reg:DI 105 [ data ])
             (sign_extend:DI (reg:SI 113)))
     ])
 Successfully matched this instruction:
 (set (reg:DI 105 [ data ])
     (sign_extend:DI (reg:SI 113)))
 Successfully matched this instruction:
 (set (reg:DI 110 [ _3+8 ])
     (sign_extract:DI (subreg:DI (reg:SI 113) 0)
         (const_int 21 [0x15])
         (const_int 11 [0xb])))
 allowing combination of insns 6 and 12
 original costs 4 + 4 = 8
 replacement costs 4 + 4 = 8
-modifying insn i2     6: r105:DI=sign_extend(r113:SI)
-deferring rescan insn with uid = 6.
-modifying insn i3    12: r110:DI=sign_extract(r113:SI#0,0x15,0xb)
-      REG_DEAD r113:SI
-deferring rescan insn with uid = 12.
+i2 didn't change, not doing this

between the 2 versions.

r105 (i.e. the sign extend result) is used not just in the >> 11 shift, but
also in the
<< 53 shift.  And if we "combine" aka simplify the right shift of sign_extend
into the same
sign_extend and sign_extract of the sign_extend argument, the sign_extend
becomes single use
and it can be combined into the left shift; and given that << 53 shifts more
than 31 bits,
all the upper bits from sign_extend are irrelevant.

So, either this should be done in some other pass as well, or perhaps there
could be
define_insn_and_split with the sign_extract and sign_extend which splits
immediately after
combine?

Reply via email to