Bug in Intel Core Duo CPU?
Wednesday, July 5, 2006
Check it out. The following test case prints “The result is 2” on a MacBook Pro (Intel Core Duo) but “The result is 1” on a Pentium 4:
#include
int main(char **argv, int argc)
{
int result;
__asm__("movl $0x10000000,%%eax; shl $3,%%eax; jno x; movl $1,%0; jmp end; x: movl $2,%0; end:"
:"=c"(result)::"%eax");
printf("The result is %d\n",result);
}
The SHL instruction is not setting the overflow flag on the Core Duo.
Update: Andy Hefner in #lisp says “overflow flag is undefined if the shift count is not equal to 1”. So its not a bug after all.