From 02edbd264d8e69e284ac33fbae527c892e8a528f Mon Sep 17 00:00:00 2001 From: Wunkolo Date: Mon, 3 Jun 2024 07:55:09 -0700 Subject: [PATCH] [a64] Fix out-of-bounds `OPCODE_VECTOR_SHL`(all-same) case Out-of-bound shift-values are handled as 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 71d608f82..b19ea6b3e 100644 --- a/src/xenia/cpu/backend/a64/a64_seq_vector.cc +++ b/src/xenia/cpu/backend/a64/a64_seq_vector.cc @@ -539,7 +539,7 @@ struct VECTOR_SHL_V128 } if (all_same) { // Every count is the same, so we can use SHL - e.SHL(i.dest.reg().B16(), i.src1.reg().B16(), shamt.u8[0]); + e.SHL(i.dest.reg().B16(), i.src1.reg().B16(), shamt.u8[0] & 0x7); return; } e.ADD(e.GetNativeParam(1), SP, e.StashConstantV(1, i.src2.constant())); @@ -563,7 +563,7 @@ struct VECTOR_SHL_V128 } if (all_same) { // Every count is the same, so we can use SHL - e.SHL(i.dest.reg().H8(), i.src1.reg().H8(), shamt.u8[0]); + e.SHL(i.dest.reg().H8(), i.src1.reg().H8(), shamt.u8[0] & 0xF); return; } e.ADD(e.GetNativeParam(1), SP, e.StashConstantV(1, i.src2.constant())); @@ -587,7 +587,7 @@ struct VECTOR_SHL_V128 } if (all_same) { // Every count is the same, so we can use SHL - e.SHL(i.dest.reg().S4(), i.src1.reg().S4(), shamt.u8[0]); + e.SHL(i.dest.reg().S4(), i.src1.reg().S4(), shamt.u8[0] & 0x1F); return; } e.ADD(e.GetNativeParam(1), SP, e.StashConstantV(1, i.src2.constant()));