This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug target/29401] [4.0/4.1/4.2 Regression] missed-optimization (in unneeded code elimination)



------- Comment #3 from rguenth at gcc dot gnu dot org  2006-10-09 14:58 -------
Confirmed.  Ok for x86_64:

f:
.LFB2:
        movslq  %edi,%rdi
        movslq  %esi,%rsi
        imulq   %rdi, %rsi
        sarq    $15, %rsi
        movl    %esi, %eax
        ret

We are expanding (int) ((long long int) b * (long long int) a >> 15).

We split

(insn:HI 11 31 12 2 (parallel [
            (set (reg:DI 0 ax [62])
                (mult:DI (sign_extend:DI (reg/v:SI 0 ax [orig:60 b ] [60]))
                    (sign_extend:DI (mem/c/i:SI (plus:SI (reg/f:SI 7 sp)
                                (const_int 4 [0x4])) [2 a+0 S4 A32]))))
            (clobber (reg:CC 17 flags))
        ]) 265 {*mulsidi3_insn} (insn_list:REG_DEP_TRUE 7 (nil))
    (expr_list:REG_UNUSED (reg:CC 17 flags)
        (nil)))

(insn:HI 12 11 17 2 (parallel [
            (set (reg:DI 0 ax [62])
                (ashiftrt:DI (reg:DI 0 ax [62])
                    (const_int 15 [0xf])))
            (clobber (reg:CC 17 flags))
        ]) 437 {*ashrdi3_1} (insn_list:REG_DEP_TRUE 11 (nil))
    (expr_list:REG_UNUSED (reg:CC 17 flags)
        (expr_list:REG_UNUSED (reg:SI 1 dx)
            (nil))))

into

(insn:TI 11 31 37 2 (parallel [
            (set (reg:DI 0 ax [62])
                (mult:DI (sign_extend:DI (reg/v:SI 0 ax [orig:60 b ] [60]))
                    (sign_extend:DI (mem/c/i:SI (plus:SI (reg/f:SI 7 sp)
                                (const_int 4 [0x4])) [2 a+0 S4 A32]))))
            (clobber (reg:CC 17 flags))
        ]) 265 {*mulsidi3_insn} (nil)
    (expr_list:REG_UNUSED (reg:CC 17 flags)
        (nil)))

(insn:TI 37 11 38 2 (parallel [
            (set (reg:SI 0 ax [62])
                (ior:SI (ashiftrt:SI (reg:SI 0 ax [62])
                        (const_int 15 [0xf]))
                    (ashift:SI (reg:SI 1 dx [+4 ])
                        (minus:QI (const_int 32 [0x20])
                            (const_int 15 [0xf])))))
            (clobber (reg:CC 17 flags))
        ]) 438 {x86_shrd_1} (nil)
    (expr_list:REG_UNUSED (reg:CC 17 flags)
        (nil)))

(insn:TI 38 37 26 2 (parallel [
            (set (reg:SI 1 dx [+4 ])
                (ashiftrt:SI (reg:SI 1 dx [+4 ])
                    (const_int 15 [0xf])))
            (clobber (reg:CC 17 flags))
        ]) 443 {*ashrsi3_1} (nil)
    (expr_list:REG_UNUSED (reg:CC 17 flags)
        (expr_list:REG_UNUSED (reg:SI 1 dx [+4 ])
            (nil))))

note the problematic partially dead DI ax:dx which flow does not handle,
so the redundant instruction does not get deleted.  A peephole might be
able to fix this until new dataflow maybe handles this case(?).


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rguenth at gcc dot gnu dot
                   |                            |org, hubicka at gcc dot gnu
                   |                            |dot org
           Severity|enhancement                 |normal
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   GCC host triplet|i486                        |
 GCC target triplet|                            |i?86-*-*
      Known to fail|4.0.3 4.1.1                 |4.0.3 4.1.1 4.2.0
   Last reconfirmed|0000-00-00 00:00:00         |2006-10-09 14:58:01
               date|                            |
            Summary|[regression] missed-        |[4.0/4.1/4.2 Regression]
                   |optimization (in unneeded   |missed-optimization (in
                   |code elimination)           |unneeded code elimination)
   Target Milestone|---                         |4.0.4


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29401


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]