mirror of
https://github.com/xmrig/xmrig.git
synced 2024-12-23 12:09:22 +00:00
commit
f9e653ea9f
3 changed files with 35 additions and 1 deletions
|
@ -1118,6 +1118,29 @@ namespace randomx {
|
|||
codePos = pos;
|
||||
}
|
||||
|
||||
void JitCompilerX86::h_CFROUND_BMI2(const Instruction& instr) {
|
||||
uint8_t* const p = code;
|
||||
int pos = codePos;
|
||||
|
||||
const uint64_t src = instr.src;
|
||||
|
||||
const uint64_t rotate = (static_cast<int>(instr.getImm32() & 63) - 2) & 63;
|
||||
*(uint64_t*)(p + pos) = 0xC0F0FBC3C4ULL | (src << 32) | (rotate << 40);
|
||||
|
||||
if (vm_flags & RANDOMX_FLAG_AMD) {
|
||||
*(uint64_t*)(p + pos + 6) = 0x742024443B0CE083ULL;
|
||||
*(uint8_t*)(p + pos + 14) = 8;
|
||||
*(uint64_t*)(p + pos + 15) = 0x202444890414AE0FULL;
|
||||
pos += 23;
|
||||
}
|
||||
else {
|
||||
*(uint64_t*)(p + pos + 6) = 0x0414AE0F0CE083ULL;
|
||||
pos += 13;
|
||||
}
|
||||
|
||||
codePos = pos;
|
||||
}
|
||||
|
||||
void JitCompilerX86::h_CBRANCH(const Instruction& instr) {
|
||||
uint8_t* const p = code;
|
||||
int pos = codePos;
|
||||
|
|
|
@ -147,6 +147,7 @@ namespace randomx {
|
|||
void h_FSQRT_R(const Instruction&);
|
||||
void h_CBRANCH(const Instruction&);
|
||||
void h_CFROUND(const Instruction&);
|
||||
void h_CFROUND_BMI2(const Instruction&);
|
||||
void h_ISTORE(const Instruction&);
|
||||
void h_NOP(const Instruction&);
|
||||
};
|
||||
|
|
|
@ -279,7 +279,17 @@ void RandomX_ConfigurationBase::Apply()
|
|||
INST_HANDLE(FDIV_M, FMUL_R);
|
||||
INST_HANDLE(FSQRT_R, FDIV_M);
|
||||
INST_HANDLE(CBRANCH, FSQRT_R);
|
||||
|
||||
#if defined(_M_X64) || defined(__x86_64__)
|
||||
if (xmrig::Cpu::info()->hasBMI2()) {
|
||||
INST_HANDLE2(CFROUND, CFROUND_BMI2, CBRANCH);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
INST_HANDLE(CFROUND, CBRANCH);
|
||||
}
|
||||
|
||||
INST_HANDLE(ISTORE, CFROUND);
|
||||
INST_HANDLE(NOP, ISTORE);
|
||||
#undef INST_HANDLE
|
||||
|
|
Loading…
Reference in a new issue