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/17387] Redundant instructions in loop optimization


------- Additional Comments From steven at gcc dot gnu dot org  2005-01-27 01:36 -------
My first suspicion was the `register' keyword, but that's not it: 
 
-------------------------------------------------- 
extern unsigned int S[]; 
extern unsigned int state[]; 
 
unsigned int 
foo () 
{ 
  unsigned int t; 
  int j; 
 
  t=0; 
  for (j=0; j<16; j+=4) 
   { 
     t = state[j + 0] ^= S[t]; 
     t = state[j + 1] ^= S[t]; 
   } 
  return t; 
} 
-------------------------------------------------- 
 
--> 
 
-------------------------------------------------- 
foo: 
.LFB2: 
        xorl    %eax, %eax 
        movl    $4, %ecx 
        movl    $state, %edx 
        .p2align 4,,7 
.L2: 
        mov     %eax, %eax 
        movl    S(,%rax,4), %eax 
        xorl    (%rdx), %eax 
        movl    %eax, (%rdx) 
        mov     %eax, %eax        <-- bah! 
        movl    S(,%rax,4), %eax 
        xorl    4(%rdx), %eax 
        movl    %eax, 4(%rdx) 
        addq    $16, %rdx 
        decl    %ecx 
        jne     .L2 
        rep ; ret 
.LFE2: 
-------------------------------------------------- 

-- 


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


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