From f16d1837f8f6cf5917acba1605e7598c20e8a65e Mon Sep 17 00:00:00 2001 From: SChernykh Date: Sun, 29 Nov 2020 14:05:50 +0100 Subject: [PATCH] Optimized JIT compiler More branch-free code --- src/crypto/randomx/jit_compiler_x86.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/crypto/randomx/jit_compiler_x86.cpp b/src/crypto/randomx/jit_compiler_x86.cpp index 182de1fa..9753701e 100644 --- a/src/crypto/randomx/jit_compiler_x86.cpp +++ b/src/crypto/randomx/jit_compiler_x86.cpp @@ -495,12 +495,10 @@ namespace randomx { emit32(instr.getImm32(), code, codePos); emitByte(0x25, code, codePos); - if (instr.getModCond() < StoreL3Condition) { - emit32(AddressMask[instr.getModMem()], code, codePos); - } - else { - emit32(ScratchpadL3Mask, code, codePos); - } + + const uint32_t mask1 = AddressMask[instr.getModMem()]; + const uint32_t mask2 = ScratchpadL3Mask; + emit32((instr.mod < (StoreL3Condition << 4)) ? mask1 : mask2, code, codePos); } FORCE_INLINE void JitCompilerX86::genAddressImm(const Instruction& instr, uint8_t* code, uint32_t& codePos) {