Optimized x86 initialization

This commit is contained in:
tevador 2018-12-16 15:10:03 +01:00
parent 4f276541d2
commit ddc29cb4d3
2 changed files with 10 additions and 13 deletions

View File

@ -29,10 +29,6 @@ namespace RandomX {
for (unsigned i = 0; i < sizeof(reg) / sizeof(Pcg32::result_type); ++i) { for (unsigned i = 0; i < sizeof(reg) / sizeof(Pcg32::result_type); ++i) {
*(((uint32_t*)&reg) + i) = gen(); *(((uint32_t*)&reg) + i) = gen();
} }
FPINIT();
for (int i = 0; i < 8; ++i) {
reg.f[i].f64 = (double)reg.f[i].i64;
}
for (unsigned i = 0; i < ProgramLength; ++i) { for (unsigned i = 0; i < ProgramLength; ++i) {
gen(); gen(); gen(); gen(); gen(); gen(); gen(); gen();
} }
@ -41,7 +37,6 @@ namespace RandomX {
} }
void CompiledVirtualMachine::execute() { void CompiledVirtualMachine::execute() {
FPINIT();
executeProgram(reg, mem, readDataset, scratchpad); executeProgram(reg, mem, readDataset, scratchpad);
#ifdef TRACE #ifdef TRACE
for (int32_t i = InstructionCount - 1; i >= 0; --i) { for (int32_t i = InstructionCount - 1; i >= 0; --i) {

View File

@ -96,14 +96,16 @@ executeProgram PROC
mov r13, qword ptr [rcx+40] mov r13, qword ptr [rcx+40]
mov r14, qword ptr [rcx+48] mov r14, qword ptr [rcx+48]
mov r15, qword ptr [rcx+56] mov r15, qword ptr [rcx+56]
movd xmm8, qword ptr [rcx+64] mov dword ptr [rsp - 8], 40896
movd xmm9, qword ptr [rcx+72] ldmxcsr dword ptr [rsp - 8]
movd xmm2, qword ptr [rcx+80] cvtsi2sd xmm8, qword ptr [rcx+64]
movd xmm3, qword ptr [rcx+88] cvtsi2sd xmm9, qword ptr [rcx+72]
movd xmm4, qword ptr [rcx+96] cvtsi2sd xmm2, qword ptr [rcx+80]
movd xmm5, qword ptr [rcx+104] cvtsi2sd xmm3, qword ptr [rcx+88]
movd xmm6, qword ptr [rcx+112] cvtsi2sd xmm4, qword ptr [rcx+96]
movd xmm7, qword ptr [rcx+120] cvtsi2sd xmm5, qword ptr [rcx+104]
cvtsi2sd xmm6, qword ptr [rcx+112]
cvtsi2sd xmm7, qword ptr [rcx+120]
; program body ; program body