From 1badc92456e2c7f2e42fdddefbf237b458789e04 Mon Sep 17 00:00:00 2001 From: Merry Date: Sun, 7 Aug 2022 13:05:51 +0100 Subject: [PATCH] emit_arm64_cryptography: Fix sha256h2 --- .../backend/arm64/emit_arm64_cryptography.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/dynarmic/backend/arm64/emit_arm64_cryptography.cpp b/src/dynarmic/backend/arm64/emit_arm64_cryptography.cpp index 9202cc25..b0a3cb48 100644 --- a/src/dynarmic/backend/arm64/emit_arm64_cryptography.cpp +++ b/src/dynarmic/backend/arm64/emit_arm64_cryptography.cpp @@ -123,15 +123,21 @@ void EmitIR(oaknut::CodeGenerator& code, E template<> void EmitIR(oaknut::CodeGenerator& code, EmitContext& ctx, IR::Inst* inst) { auto args = ctx.reg_alloc.GetArgumentInfo(inst); - auto Qx = ctx.reg_alloc.ReadWriteQ(args[0], inst); - auto Qy = ctx.reg_alloc.ReadQ(args[1]); - auto Qz = ctx.reg_alloc.ReadQ(args[2]); const bool part1 = args[3].GetImmediateU1(); - RegAlloc::Realize(Qx, Qy, Qz); if (part1) { + auto Qx = ctx.reg_alloc.ReadWriteQ(args[0], inst); + auto Qy = ctx.reg_alloc.ReadQ(args[1]); + auto Qz = ctx.reg_alloc.ReadQ(args[2]); + RegAlloc::Realize(Qx, Qy, Qz); + code.SHA256H(Qx, Qy, Qz->S4()); } else { + auto Qx = ctx.reg_alloc.ReadQ(args[0]); + auto Qy = ctx.reg_alloc.ReadWriteQ(args[1], inst); + auto Qz = ctx.reg_alloc.ReadQ(args[2]); + RegAlloc::Realize(Qx, Qy, Qz); + code.SHA256H2(Qy, Qx, Qz->S4()); // Yes x and y are swapped } }