]> git.ipfire.org Git - thirdparty/LuaJIT.git/commitdiff
ARM64: Fix LDP/STP fusing for unaligned accesses.
authorMike Pall <mike>
Mon, 28 Aug 2023 20:33:54 +0000 (22:33 +0200)
committerMike Pall <mike>
Mon, 28 Aug 2023 20:33:54 +0000 (22:33 +0200)
Thanks to Peter Cawley. #1056

src/lj_emit_arm64.h

index 52d010b8b346a533fa060e8ccbc49cee29ce8fe5..6926c71a846d448a9ce2cd77014449046e705f9c 100644 (file)
@@ -142,7 +142,7 @@ static void emit_lso(ASMState *as, A64Ins ai, Reg rd, Reg rn, int64_t ofs)
     } else {
       goto nopair;
     }
-    if (ofsm >= (int)((unsigned int)-64<<sc) && ofsm <= (63<<sc)) {
+    if (lj_ror((unsigned int)ofsm + (64u<<sc), sc) <= 127u) {
       *as->mcp = aip | A64F_N(rn) | (((ofsm >> sc) & 0x7f) << 15) |
        (ai ^ ((ai == A64I_LDRx || ai == A64I_STRx) ? 0x50000000 : 0x90000000));
       return;