X86: Fix the sar carry flag.

This commit is contained in:
Gabe Black 2009-08-05 02:58:03 -07:00
parent 860f0f8350
commit c087b60af3

View file

@ -711,8 +711,12 @@ let {{
//worry about setting them. //worry about setting them.
ccFlagBits = ccFlagBits & ~(ext & (CFBit | ECFBit | OFBit)); ccFlagBits = ccFlagBits & ~(ext & (CFBit | ECFBit | OFBit));
//If some combination of the CF bits need to be set, set them. //If some combination of the CF bits need to be set, set them.
if ((ext & (CFBit | ECFBit)) && bits(SrcReg1, shiftAmt - 1)) uint8_t effectiveShift =
(shiftAmt <= dataSize * 8) ? shiftAmt : (dataSize * 8);
if ((ext & (CFBit | ECFBit)) &&
bits(SrcReg1, effectiveShift - 1)) {
ccFlagBits = ccFlagBits | (ext & (CFBit | ECFBit)); ccFlagBits = ccFlagBits | (ext & (CFBit | ECFBit));
}
//Use the regular mechanisms to calculate the other flags. //Use the regular mechanisms to calculate the other flags.
ccFlagBits = genFlags(ccFlagBits, ext & ~(CFBit | ECFBit | OFBit), ccFlagBits = genFlags(ccFlagBits, ext & ~(CFBit | ECFBit | OFBit),
DestReg, psrc1, op2); DestReg, psrc1, op2);