From e2d141e5054d9d04e9633128cf91e2fa153b1c47 Mon Sep 17 00:00:00 2001 From: Wunkolo Date: Sun, 12 May 2024 09:48:38 -0700 Subject: [PATCH] [a64] Fix `OPCODE_VECTOR_SHA`(constant) Values should be modulo-element-size --- src/xenia/cpu/backend/a64/a64_seq_vector.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/xenia/cpu/backend/a64/a64_seq_vector.cc b/src/xenia/cpu/backend/a64/a64_seq_vector.cc index 5f5e519c7..e5cd4e1aa 100644 --- a/src/xenia/cpu/backend/a64/a64_seq_vector.cc +++ b/src/xenia/cpu/backend/a64/a64_seq_vector.cc @@ -819,7 +819,7 @@ struct VECTOR_SHA_V128 } if (all_same) { // Every count is the same, so we can use SSHR - e.SSHR(i.dest.reg().B16(), i.src1.reg().B16(), shamt.u8[0]); + e.SSHR(i.dest.reg().B16(), i.src1.reg().B16(), shamt.u8[0] & 0x7); return; } e.ADD(e.GetNativeParam(1), XSP, e.StashConstantV(1, i.src2.constant())); @@ -843,7 +843,7 @@ struct VECTOR_SHA_V128 } if (all_same) { // Every count is the same, so we can use SSHR - e.SSHR(i.dest.reg().H8(), i.src1.reg().H8(), shamt.u16[0]); + e.SSHR(i.dest.reg().H8(), i.src1.reg().H8(), shamt.u16[0] & 0xF); return; } e.ADD(e.GetNativeParam(1), XSP, e.StashConstantV(1, i.src2.constant())); @@ -867,7 +867,7 @@ struct VECTOR_SHA_V128 } if (all_same) { // Every count is the same, so we can use SSHR - e.SSHR(i.dest.reg().S4(), i.src1.reg().S4(), shamt.u32[0]); + e.SSHR(i.dest.reg().S4(), i.src1.reg().S4(), shamt.u32[0] & 0x1F); return; } e.ADD(e.GetNativeParam(1), XSP, e.StashConstantV(1, i.src2.constant()));