Merge pull request #2700 from Sintendo/fresbranch

Jit64: Eliminate branch in GenFres
This commit is contained in:
flacs 2015-07-05 15:20:38 +02:00
commit f03f9cccc4
1 changed files with 5 additions and 7 deletions

View File

@ -119,13 +119,12 @@ void CommonAsmRoutines::GenFres()
MOV(32, R(RSCRATCH2), R(RSCRATCH_EXTRA)); MOV(32, R(RSCRATCH2), R(RSCRATCH_EXTRA));
AND(32, R(RSCRATCH_EXTRA), Imm32(0x7FF)); // exp AND(32, R(RSCRATCH_EXTRA), Imm32(0x7FF)); // exp
AND(32, R(RSCRATCH2), Imm32(0x800)); // sign AND(32, R(RSCRATCH2), Imm32(0x800)); // sign
CMP(32, R(RSCRATCH_EXTRA), Imm32(895)); SUB(32, R(RSCRATCH_EXTRA), Imm32(895));
CMP(32, R(RSCRATCH_EXTRA), Imm32(1149 - 895));
// Take the complex path for very large/small exponents. // Take the complex path for very large/small exponents.
FixupBranch complex1 = J_CC(CC_L); FixupBranch complex = J_CC(CC_AE); // if (exp < 895 || exp >= 1149)
CMP(32, R(RSCRATCH_EXTRA), Imm32(1149));
FixupBranch complex2 = J_CC(CC_GE);
SUB(32, R(RSCRATCH_EXTRA), Imm32(0x7FD)); SUB(32, R(RSCRATCH_EXTRA), Imm32(0x7FD - 895));
NEG(32, R(RSCRATCH_EXTRA)); NEG(32, R(RSCRATCH_EXTRA));
OR(32, R(RSCRATCH_EXTRA), R(RSCRATCH2)); OR(32, R(RSCRATCH_EXTRA), R(RSCRATCH2));
SHL(64, R(RSCRATCH_EXTRA), Imm8(52)); // vali = sign | exponent SHL(64, R(RSCRATCH_EXTRA), Imm8(52)); // vali = sign | exponent
@ -154,8 +153,7 @@ void CommonAsmRoutines::GenFres()
OR(32, PPCSTATE(fpscr), Imm32(FPSCR_FX | FPSCR_ZX)); OR(32, PPCSTATE(fpscr), Imm32(FPSCR_FX | FPSCR_ZX));
SetJumpTarget(skip_set_fx1); SetJumpTarget(skip_set_fx1);
SetJumpTarget(complex1); SetJumpTarget(complex);
SetJumpTarget(complex2);
ABI_PushRegistersAndAdjustStack(QUANTIZED_REGS_TO_SAVE, 8); ABI_PushRegistersAndAdjustStack(QUANTIZED_REGS_TO_SAVE, 8);
ABI_CallFunction((void *)&MathUtil::ApproximateReciprocal); ABI_CallFunction((void *)&MathUtil::ApproximateReciprocal);
ABI_PopRegistersAndAdjustStack(QUANTIZED_REGS_TO_SAVE, 8); ABI_PopRegistersAndAdjustStack(QUANTIZED_REGS_TO_SAVE, 8);