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 optimization/14052] New: Combiner weakness


For this code:

int f1(int x) { return x == 1 || x == 3; }
int f2(int x) { return x == 1 || x == 3 || x == 1; }

I get:

0000000000000000 <f1>:
   0:   a1 75 00 42     cmpeq   a0,0x3,t0
   4:   a0 35 00 42     cmpeq   a0,0x1,v0
   8:   00 04 01 44     or      v0,t0,v0
   c:   01 80 fa 6b     ret

0000000000000010 <f2>:
  10:   a0 35 00 42     cmpeq   a0,0x1,v0
  14:   a2 75 00 42     cmpeq   a0,0x3,t1
  18:   01 04 02 44     or      v0,t1,t0
  1c:   a0 03 e0 43     cmpult  zero,v0,v0
  20:   c0 34 20 44     cmovne  t0,0x1,v0
  24:   01 80 fa 6b     ret

combine should have realized that t0 has at most the low bit set and cmpult
therefore is always false.

-- 
           Summary: Combiner weakness
           Product: gcc
           Version: tree-ssa
            Status: UNCONFIRMED
          Keywords: pessimizes-code
          Severity: enhancement
          Priority: P2
         Component: optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: falk at debian dot org
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: alphaev68-unknown-linux-gnu
  GCC host triplet: alphaev68-unknown-linux-gnu
GCC target triplet: alphaev68-unknown-linux-gnu


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


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