Skip to content

Commit ebddaf6

Browse files
committed
Alignment of x86 code for SuperscalarHash made optional
1 parent cf72ed7 commit ebddaf6

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/jit_compiler_x86.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,13 +275,15 @@ namespace randomx {
275275
emit(REX_MOV_RR64);
276276
emitByte(0xd8 + prog.getAddressRegister());
277277
emit(codeShhPrefetch, codeSshPrefetchSize);
278+
#ifdef RANDOMX_ALIGN
278279
int align = (codePos % 16);
279280
while (align != 0) {
280281
int nopSize = 16 - align;
281282
if (nopSize > 8) nopSize = 8;
282283
emit(NOPX[nopSize - 1], nopSize);
283284
align = (codePos % 16);
284285
}
286+
#endif
285287
}
286288
}
287289
emitByte(RET);
@@ -378,25 +380,33 @@ namespace randomx {
378380
emit(REX_81);
379381
emitByte(0xc0 + instr.dst);
380382
emit32(instr.getImm32());
383+
#ifdef RANDOMX_ALIGN
381384
emit(NOP1);
385+
#endif
382386
break;
383387
case randomx::SuperscalarInstructionType::IXOR_C8:
384388
emit(REX_XOR_RI);
385389
emitByte(0xf0 + instr.dst);
386390
emit32(instr.getImm32());
391+
#ifdef RANDOMX_ALIGN
387392
emit(NOP1);
393+
#endif
388394
break;
389395
case randomx::SuperscalarInstructionType::IADD_C9:
390396
emit(REX_81);
391397
emitByte(0xc0 + instr.dst);
392398
emit32(instr.getImm32());
399+
#ifdef RANDOMX_ALIGN
393400
emit(NOP2);
401+
#endif
394402
break;
395403
case randomx::SuperscalarInstructionType::IXOR_C9:
396404
emit(REX_XOR_RI);
397405
emitByte(0xf0 + instr.dst);
398406
emit32(instr.getImm32());
407+
#ifdef RANDOMX_ALIGN
399408
emit(NOP2);
409+
#endif
400410
break;
401411
case randomx::SuperscalarInstructionType::IMULH_R:
402412
emit(REX_MOV_RR64);
@@ -853,6 +863,7 @@ namespace randomx {
853863
emitByte(0xc1);
854864
emit(REX_ADD_RM);
855865
emitByte(0xc1 + 8 * instr.dst);
866+
856867
}
857868

858869
void JitCompilerX86::h_ISTORE(Instruction& instr, int i) {

0 commit comments

Comments
 (0)