X86: Fix the overflow bit for rotate right with carry.
This commit is contained in:
parent
c8b1a4583e
commit
77dc6b33ee
1 changed files with 4 additions and 2 deletions
|
@ -777,13 +777,15 @@ let {{
|
||||||
flag_code = '''
|
flag_code = '''
|
||||||
// If the shift amount is zero, no flags should be modified.
|
// If the shift amount is zero, no flags should be modified.
|
||||||
if (shiftAmt) {
|
if (shiftAmt) {
|
||||||
|
int origCFBit = (ccFlagBits & CFBit) ? 1 : 0;
|
||||||
//Zero out any flags we might modify. This way we only have to
|
//Zero out any flags we might modify. This way we only have to
|
||||||
//worry about setting them.
|
//worry about setting them.
|
||||||
ccFlagBits = ccFlagBits & ~(ext & (CFBit | ECFBit | OFBit));
|
ccFlagBits = ccFlagBits & ~(ext & (CFBit | ECFBit | OFBit));
|
||||||
//Figure out what the OF bit should be.
|
//Figure out what the OF bit should be.
|
||||||
if ((ext & OFBit) && ((ccFlagBits & CFBit) ^
|
if ((ext & OFBit) && (origCFBit ^
|
||||||
bits(SrcReg1, dataSize * 8 - 1)))
|
bits(SrcReg1, dataSize * 8 - 1))) {
|
||||||
ccFlagBits = ccFlagBits | OFBit;
|
ccFlagBits = ccFlagBits | 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))
|
if ((ext & (CFBit | ECFBit)) && bits(SrcReg1, shiftAmt - 1))
|
||||||
ccFlagBits = ccFlagBits | (ext & (CFBit | ECFBit));
|
ccFlagBits = ccFlagBits | (ext & (CFBit | ECFBit));
|
||||||
|
|
Loading…
Reference in a new issue