Sfoglia il codice sorgente

Alignment of x86 code for SuperscalarHash made optional

tevador 7 anni fa
parent
commit
ebddaf671c
1 ha cambiato i file con 11 aggiunte e 0 eliminazioni
  1. 11 0
      src/jit_compiler_x86.cpp

+ 11 - 0
src/jit_compiler_x86.cpp

@@ -275,6 +275,7 @@ namespace randomx {
 				emit(REX_MOV_RR64);
 				emit(REX_MOV_RR64);
 				emitByte(0xd8 + prog.getAddressRegister());
 				emitByte(0xd8 + prog.getAddressRegister());
 				emit(codeShhPrefetch, codeSshPrefetchSize);
 				emit(codeShhPrefetch, codeSshPrefetchSize);
+#ifdef RANDOMX_ALIGN
 				int align = (codePos % 16);
 				int align = (codePos % 16);
 				while (align != 0) {
 				while (align != 0) {
 					int nopSize = 16 - align;
 					int nopSize = 16 - align;
@@ -282,6 +283,7 @@ namespace randomx {
 					emit(NOPX[nopSize - 1], nopSize);
 					emit(NOPX[nopSize - 1], nopSize);
 					align = (codePos % 16);
 					align = (codePos % 16);
 				}
 				}
+#endif
 			}
 			}
 		}
 		}
 		emitByte(RET);
 		emitByte(RET);
@@ -378,25 +380,33 @@ namespace randomx {
 			emit(REX_81);
 			emit(REX_81);
 			emitByte(0xc0 + instr.dst);
 			emitByte(0xc0 + instr.dst);
 			emit32(instr.getImm32());
 			emit32(instr.getImm32());
+#ifdef RANDOMX_ALIGN
 			emit(NOP1);
 			emit(NOP1);
+#endif
 			break;
 			break;
 		case randomx::SuperscalarInstructionType::IXOR_C8:
 		case randomx::SuperscalarInstructionType::IXOR_C8:
 			emit(REX_XOR_RI);
 			emit(REX_XOR_RI);
 			emitByte(0xf0 + instr.dst);
 			emitByte(0xf0 + instr.dst);
 			emit32(instr.getImm32());
 			emit32(instr.getImm32());
+#ifdef RANDOMX_ALIGN
 			emit(NOP1);
 			emit(NOP1);
+#endif
 			break;
 			break;
 		case randomx::SuperscalarInstructionType::IADD_C9:
 		case randomx::SuperscalarInstructionType::IADD_C9:
 			emit(REX_81);
 			emit(REX_81);
 			emitByte(0xc0 + instr.dst);
 			emitByte(0xc0 + instr.dst);
 			emit32(instr.getImm32());
 			emit32(instr.getImm32());
+#ifdef RANDOMX_ALIGN
 			emit(NOP2);
 			emit(NOP2);
+#endif
 			break;
 			break;
 		case randomx::SuperscalarInstructionType::IXOR_C9:
 		case randomx::SuperscalarInstructionType::IXOR_C9:
 			emit(REX_XOR_RI);
 			emit(REX_XOR_RI);
 			emitByte(0xf0 + instr.dst);
 			emitByte(0xf0 + instr.dst);
 			emit32(instr.getImm32());
 			emit32(instr.getImm32());
+#ifdef RANDOMX_ALIGN
 			emit(NOP2);
 			emit(NOP2);
+#endif
 			break;
 			break;
 		case randomx::SuperscalarInstructionType::IMULH_R:
 		case randomx::SuperscalarInstructionType::IMULH_R:
 			emit(REX_MOV_RR64);
 			emit(REX_MOV_RR64);
@@ -853,6 +863,7 @@ namespace randomx {
 		emitByte(0xc1);
 		emitByte(0xc1);
 		emit(REX_ADD_RM);
 		emit(REX_ADD_RM);
 		emitByte(0xc1 + 8 * instr.dst);
 		emitByte(0xc1 + 8 * instr.dst);
+
 	}
 	}
 
 
 	void JitCompilerX86::h_ISTORE(Instruction& instr, int i) {
 	void JitCompilerX86::h_ISTORE(Instruction& instr, int i) {