Subject: Re: gcc/egcs problem with shifts on i386
To: Sean Doran <smd@sean.ebone.net>
From: Christian Groessler <cpg@aladdin.de>
List: current-users
Date: 08/17/1999 15:10:46
On 8/17/99 11:36:02 AM Sean Doran  wrote:
>
>The assembly code egcs emits from cc -S (with or without -O/-O2/-O3) seems
>sane - it boils down to:
>
>.L8:
>        movl %esi,%ebx
>        sall %cl,%ebx
>        jmp .L7
>        .align 4
>.L9:
>        movl %esi,%ebx
>        sarl %cl,%ebx
>
>So the 386 is doing something "interesting".
>
>./shift r 0x7fffffff 34
>shr 0x7fffffff, 0x22 -> 0x1fffffff

For shift counts in x86 only the lower 5 bits are valid, so its the same as
./shift r 0x7fffffff 2

regards,
chris