I’ve been writing an x86 emulator, and to debug it, I ran it on a p4 computer in parallel to a debugger on a target program (a upx packed binary). Well.. I got to shl $8, %eax where eax = 0x00ffffff.
The intel documentation says that the overflow flag is only changed for 1 bit shifts. Suprisingly, in the 8 bit shift, the overflow flag became set. In a 7 bit or 9 bit shift of the same value, the overflow flag remains clear (or perhaps unchanged).
I’ve been googling to see other reports of this undocumented behaviour, but either its not out there, or more likely my googling skills are poor. I couldn’t find a reference.
Anyone got more information on this?
[Update: I have had reports from one person which said the behavior varied between setting and clearing the flag depending on the cpu.]