Merge remote-tracking branch 'origin/GT-3534_ghidorahrex_x86_AF_flag_inconsistencies'

This commit is contained in:
ghidorahrex 2020-03-04 14:24:52 -05:00
commit f4ce8639e0

View File

@ -1229,12 +1229,11 @@ macro addCarryFlags ( op1, op2 ) {
local CFcopy = zext(CF);
CF = carry( op1, op2 );
OF = scarry( op1, op2 );
local AFmask = -1 >> 4;
AF = (((op1 & AFmask) + (op2 & AFmask) + CFcopy) & (AFmask + 1)) != 0;
local result = op1 + op2;
CF = CF || carry( result, CFcopy );
OF = OF ^^ scarry( result, CFcopy );
op1 = result + CFcopy;
# AF not implemented
}
@ -1242,12 +1241,11 @@ macro subCarryFlags ( op1, op2 ) {
local CFcopy = zext(CF);
CF = op1 < op2;
OF = sborrow( op1, op2 );
local AFmask = -1 >> 4;
AF = (((op1 & AFmask) - (op2 & AFmask) - CFcopy) & (AFmask + 1)) != 0;
local result = op1 - op2;
CF = CF || (result < CFcopy);
OF = OF ^^ sborrow( result, CFcopy );
op1 = result - CFcopy;
# AF not implemented
}
macro resultflags(result) {