summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authorSintendo <bram.speeckaert@gmail.com>2015-07-05 11:18:59 +0200
committerSintendo <bram.speeckaert@gmail.com>2015-07-05 11:18:59 +0200
commitce1052505684afbfe7cbdd564fd81ca0aeda863b (patch)
tree2ac757f1d2d17553760c95d2a9479429ecb451ac /Source/Core
parent1af8b62d9f64c5779f1fa7927d856e4bf1913fb0 (diff)
Eliminate branch in GenFres
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/Core/PowerPC/Jit64Common/Jit64AsmCommon.cpp12
1 files changed, 5 insertions, 7 deletions
diff --git a/Source/Core/Core/PowerPC/Jit64Common/Jit64AsmCommon.cpp b/Source/Core/Core/PowerPC/Jit64Common/Jit64AsmCommon.cpp
index 64adf9b4de..b0f38ca1ec 100644
--- a/Source/Core/Core/PowerPC/Jit64Common/Jit64AsmCommon.cpp
+++ b/Source/Core/Core/PowerPC/Jit64Common/Jit64AsmCommon.cpp
@@ -119,13 +119,12 @@ void CommonAsmRoutines::GenFres()
MOV(32, R(RSCRATCH2), R(RSCRATCH_EXTRA));
AND(32, R(RSCRATCH_EXTRA), Imm32(0x7FF)); // exp
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.
- FixupBranch complex1 = J_CC(CC_L);
- CMP(32, R(RSCRATCH_EXTRA), Imm32(1149));
- FixupBranch complex2 = J_CC(CC_GE);
+ FixupBranch complex = J_CC(CC_AE); // if (exp < 895 || exp >= 1149)
- SUB(32, R(RSCRATCH_EXTRA), Imm32(0x7FD));
+ SUB(32, R(RSCRATCH_EXTRA), Imm32(0x7FD - 895));
NEG(32, R(RSCRATCH_EXTRA));
OR(32, R(RSCRATCH_EXTRA), R(RSCRATCH2));
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));
SetJumpTarget(skip_set_fx1);
- SetJumpTarget(complex1);
- SetJumpTarget(complex2);
+ SetJumpTarget(complex);
ABI_PushRegistersAndAdjustStack(QUANTIZED_REGS_TO_SAVE, 8);
ABI_CallFunction((void *)&MathUtil::ApproximateReciprocal);
ABI_PopRegistersAndAdjustStack(QUANTIZED_REGS_TO_SAVE, 8);