Re: Useless conditional branches

2010-03-02 Thread Richard Guenther
On Tue, Mar 2, 2010 at 10:55 AM, Andrew Haley wrote: > On 03/02/2010 08:55 AM, Alain Ketterlin wrote: >> >> It looks like gcc sometimes produces "useless" conditional branches. >> I've found code like this: >> >>   xor    %edx,%edx >>   ; code

Re: Useless conditional branches

2010-03-02 Thread Alain Ketterlin
Andrew Haley wrote: On 03/02/2010 08:55 AM, Alain Ketterlin wrote: It looks like gcc sometimes produces "useless" conditional branches. I've found code like this: xor%edx,%edx ; code with no effect on edx (see full code below) test %edx,%edx jne The branch o

Re: Useless conditional branches

2010-03-02 Thread Andrew Haley
On 03/02/2010 08:55 AM, Alain Ketterlin wrote: > > It looks like gcc sometimes produces "useless" conditional branches. > I've found code like this: > > xor%edx,%edx > ; code with no effect on edx (see full code below) > test %edx,%edx > jne

Re: Useless conditional branches

2010-03-02 Thread Piotr Wyderski
Alain Ketterlin wrote: > I've found code like this: > >  xor    %edx,%edx >  ; code with no effect on edx (see full code below) >  test   %edx,%edx >  jne     I have experienced similar sequences where your "code with no effect" was a lot of SSE instructions, so I can confirm that the problem exi

Useless conditional branches

2010-03-02 Thread Alain Ketterlin
It looks like gcc sometimes produces "useless" conditional branches. I've found code like this: xor%edx,%edx ; code with no effect on edx (see full code below) test %edx,%edx jne The branch on the last line is never taken. Why does gcc generate such code seq