■
Shift 演算の最適化弱いなあ GCC。
jun@debian /tmp $ cat tmp.c int f (int x) { return (x & ~1) >> 2; } jun@debian /tmp $ gcc -S -o - -O2 tmp.c .file "tmp.c" .text .p2align 4,,15 .globl f .type f, @function f: pushl %ebp movl %esp, %ebp movl 8(%ebp), %eax popl %ebp andl $-2, %eax sarl $2, %eax ret .size f, .-f .ident "GCC: (GNU) 4.0.3 (Debian 4.0.3-1)" .section .note.GNU-stack,"",@progbits