int sarl_n(int x, char n){
x <<= 2;
x >>= n;
return x;
}
When I get together with "gcc -m32 -S sarl_n.c", it emits this code:
.cfi_startproc
movl 4(%esp), %eax
movsbl 8(%esp), %ecx
sall $2, %eax
sarl %cl, %eax
ret
.cfi_endproc
Why does gcc use a "mini-register" %clinstead of a large one %ecx?
EDIT: I used the O2 option to get a shorter build code
source
share