From f930d5d4dc1df3b9102afab9c7c08d14340e3e6f Mon Sep 17 00:00:00 2001 From: tevador Date: Mon, 18 Feb 2019 22:09:20 +0100 Subject: [PATCH] Fixed a bug in FSWAP_R --- src/InterpretedVirtualMachine.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/InterpretedVirtualMachine.cpp b/src/InterpretedVirtualMachine.cpp index 50347f1..4872213 100644 --- a/src/InterpretedVirtualMachine.cpp +++ b/src/InterpretedVirtualMachine.cpp @@ -109,6 +109,7 @@ namespace RandomX { FORCE_INLINE void InterpretedVirtualMachine::executeBytecode(int i, int_reg_t(&r)[8], __m128d (&f)[4], __m128d (&e)[4], __m128d (&a)[4]) { auto& ibc = byteCode[i]; + if(trace) printState(r, f, e, a); switch (ibc.type) { case InstructionType::IADD_R: { @@ -268,7 +269,7 @@ namespace RandomX { UNREACHABLE; } if (trace) { - //std::cout << program(i); + std::cout << program(i); if(ibc.type < 20 || ibc.type == 31 || ibc.type == 32) print(*ibc.idst); else //if(ibc.type >= 20 && ibc.type <= 30) @@ -673,7 +674,10 @@ namespace RandomX { CASE_REP(FSWAP_R) { auto dst = instr.dst % RegistersCount; ibc.type = InstructionType::FSWAP_R; - ibc.fdst = &f[dst]; + if (dst < 4) + ibc.fdst = &f[dst]; + else + ibc.fdst = &e[dst - 4]; } break; CASE_REP(FADD_R) {