DRC: Give C backend x86/x64 shift=0 behavior for consistency [R. Belmont]

This commit is contained in:
R. Belmont 2012-09-07 02:20:41 +00:00
parent 896aa7d0a7
commit 102b5cca8c

View File

@ -982,6 +982,7 @@ int drcbe_c::execute(code_handle &entry)
case MAKE_OPCODE_SHORT(OP_CMP, 4, 1): // CMP src1,src2[,f]
temp32 = PARAM0 - PARAM1;
flags = FLAGS32_NZCV_SUB(temp32, PARAM0, PARAM1);
// printf("CMP: %08x - %08x = flags %x\n", PARAM0, PARAM1, flags);
break;
case MAKE_OPCODE_SHORT(OP_MULU, 4, 0): // MULU dst,edst,src1,src2[,f]
@ -1120,8 +1121,11 @@ int drcbe_c::execute(code_handle &entry)
case MAKE_OPCODE_SHORT(OP_SHL, 4, 1):
shift = PARAM2 & 31;
temp32 = PARAM1 << shift;
flags = FLAGS32_NZ(temp32);
if (shift != 0) flags |= ((PARAM1 << (shift - 1)) >> 31) & FLAG_C;
if (shift != 0)
{
flags = FLAGS32_NZ(temp32);
flags |= ((PARAM1 << (shift - 1)) >> 31) & FLAG_C;
}
PARAM0 = temp32;
break;
@ -1132,8 +1136,11 @@ int drcbe_c::execute(code_handle &entry)
case MAKE_OPCODE_SHORT(OP_SHR, 4, 1):
shift = PARAM2 & 31;
temp32 = PARAM1 >> shift;
flags = FLAGS32_NZ(temp32);
if (shift != 0) flags |= (PARAM1 >> (shift - 1)) & FLAG_C;
if (shift != 0)
{
flags = FLAGS32_NZ(temp32);
flags |= (PARAM1 >> (shift - 1)) & FLAG_C;
}
PARAM0 = temp32;
break;
@ -1144,8 +1151,11 @@ int drcbe_c::execute(code_handle &entry)
case MAKE_OPCODE_SHORT(OP_SAR, 4, 1):
shift = PARAM2 & 31;
temp32 = (INT32)PARAM1 >> shift;
flags = FLAGS32_NZ(temp32);
if (shift != 0) flags |= (PARAM1 >> (shift - 1)) & FLAG_C;
if (shift != 0)
{
flags = FLAGS32_NZ(temp32);
flags |= (PARAM1 >> (shift - 1)) & FLAG_C;
}
PARAM0 = temp32;
break;
@ -1157,8 +1167,11 @@ int drcbe_c::execute(code_handle &entry)
case MAKE_OPCODE_SHORT(OP_ROL, 4, 1):
shift = PARAM2 & 31;
temp32 = (PARAM1 << shift) | (PARAM1 >> ((32 - shift) & 31));
flags = FLAGS32_NZ(temp32);
if (shift != 0) flags |= ((PARAM1 << (shift - 1)) >> 31) & FLAG_C;
if (shift != 0)
{
flags = FLAGS32_NZ(temp32);
flags |= ((PARAM1 << (shift - 1)) >> 31) & FLAG_C;
}
PARAM0 = temp32;
break;