A performance regression from 3.4.6 to 4.1.1 for m68k-elf.
combine used to take care of this in 3.4.6   . 

A backport of the patch for Bug #24427 works .  If its allowed, I'll put it up
. 

This is the test case . 

#include <stdio.h>
int i;
int main (void)
{

          if ( ((i & ~1) | 1) != ( i | 1))
                      printf ("abc");
}

3.4.6 generated 

       .file   "fail.c"
        .text
        .align  2
        .globl  foo
        .type   foo, @function
foo:
        link.w %a6,#0
        unlk %a6
        rts
        .size   foo, .-foo
        .comm   i,4,2
        .ident  "GCC: (GNU) 3.4.6"



4.1.2 pre-release generates      

.file   "fail.c"
        .section        .rodata.str1.1,"aMS",@progbits,1
.LC0:
        .string "abc"
        .text
        .align  2
        .globl  main
        .type   main, @function
main:
        link.w %fp,#0
        move.l %d2,-(%sp)
        move.l i,%d1
        moveq #-2,%d0
        and.l %d1,%d0
        moveq #1,%d2
        or.l %d2,%d0
        or.l %d2,%d1
        cmp.l %d0,%d1
        jbeq .L5
        pea .LC0
        jbsr printf
        addq.l #4,%sp
.L5:
        move.l -4(%fp),%d2
        unlk %fp
        rts
        .size   main, .-main
        .comm   i,4,2
        .ident  "GCC: (GNU) 4.1.2 20060623 (prerelease)"


-- 
           Summary: 4.1.1 misses constant folding .
           Product: gcc
           Version: 4.1.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: regression
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: ramana dot radhakrishnan at codito dot com
  GCC host triplet: i686-linux
GCC target triplet: m68k-elf


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

Reply via email to