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 middle-end/24427] missing optimization opportunity with binary operators



------- Comment #5 from ramana dot radhakrishnan at codito dot com  2006-06-26 19:13 -------
This should be reopened. A related testcase shows a regression from 3.4.6 to
4.1.1 for m68k-elf shows a regression . combine used to take care of this in
3.4.6   . A backport of the patch is ready with me. 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)"


-- 

ramana dot radhakrishnan at codito dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ramana dot radhakrishnan at
                   |                            |codito dot com


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


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