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 rtl-optimization/57231] Hoist zero-extend operations when possible


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

Steven Bosscher <steven at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2013-05-10
                 CC|                            |steven at gcc dot gnu.org
     Ever confirmed|0                           |1

--- Comment #1 from Steven Bosscher <steven at gcc dot gnu.org> ---
Also happens on powerpc-m32:

.L3:
 #   47: %8:SI=zero_extend([%7:SI+%9:SI])
        lbzx 8,7,9       # 47   *rs6000.md:666/1        [length = 4]
 #   51: %9:SI=%9:SI+0x1
        addi 9,9,1       # 51   *addsi3_internal1/2     [length = 4]
 #   49: %10:SI=%10:SI+%8:SI
        add 10,10,8      # 49   *addsi3_internal1/1     [length = 4]
 #   50: %10:SI=zero_extend(%10:HI)
        rlwinm 10,10,0,0xffff    # 50   *rs6000.md:928/2        [length = 4]
 #   80: {pc={(ctr:SI!=0x1)?L55:pc};
 #        ctr:SI=ctr:SI-0x1;
 #        clobber scratch
 #        clobber scratch;}
        bdnz .L3         # 80   *ctrsi_internal1/1      [length = 4]


BTW the add is in SImode and the zero_extend is from HImode to SImode:

%10:SI=%10:SI+%8:SI
%10:SI=zero_extend(%10:HI)

Isn't that effectively a truncation?  If so, then the zero_extend is not
redundant because without it the add may result in wrap-around and give
a different result.

Or perhaps I'm off my rocker today...


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