[EMAIL PROTECTED]:~/ctest% cat see.c
int f37(int t, int seg) {
        if (seg) t = (t + t + 1 + 32) << (seg + 2);
        else     t = (t + t + 1     ) << 3;
        return t;
}

[EMAIL PROTECTED]:~/ctest% gcc -c -O3 -fno-see see.c && objdump -dr see.o >! 
no-see.s
&& gcc -c -O3 -fsee see.c && objdump -dr see.o >! see.s && diff -u10 no-see.s
see.s                                                                 
--- no-see.s    2006-05-07 10:49:20.000000000 +0200
+++ see.s       2006-05-07 10:49:20.000000000 +0200
@@ -2,17 +2,17 @@
 see.o:     file format elf64-alpha

 Disassembly of section .text:

 0000000000000000 <f37>:
    0:  01 04 10 42     addq    a0,a0,t0
    4:  02 00 51 20     lda     t1,2(a1)
    8:  50 16 21 40     s8addq  t0,0x8,a0
    c:  21 00 21 20     lda     t0,33(t0)
   10:  21 07 22 48     sll     t0,t1,t0
-  14:  00 00 f0 43     sextl   a0,v0
+  14:  00 04 f0 47     mov     a0,v0
   18:  01 00 20 e6     beq     a1,20 <f37+0x20>
-  1c:  00 00 e1 43     sextl   t0,v0
-  20:  01 80 fa 6b     ret
-  24:  00 00 fe 2f     unop    
+  1c:  00 04 e1 47     mov     t0,v0
+  20:  00 00 e0 43     sextl   v0,v0
+  24:  01 80 fa 6b     ret
   28:  1f 04 ff 47     nop     
   2c:  00 00 fe 2f     unop    

It looks like SEE correctly recognized that the sign extension after the shift
has to be done only once. However, it also introduces two spurious movs.


-- 
           Summary: -fsee introduces spurious movs
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: falk at debian 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=27467

Reply via email to