Blame SOURCES/0020-ARM64-Fix-assembly-of-HREFK.patch

006bc1
From 06cd9fce7df440323647174f1ca4a01281ec8acd Mon Sep 17 00:00:00 2001
006bc1
From: Mike Pall <mike>
006bc1
Date: Wed, 8 Nov 2017 12:53:48 +0100
006bc1
Subject: [PATCH 20/72] ARM64: Fix assembly of HREFK.
006bc1
006bc1
Reported by Jason Teplitz.
006bc1
---
006bc1
 src/lj_asm_arm64.h | 11 +++++------
006bc1
 1 file changed, 5 insertions(+), 6 deletions(-)
006bc1
006bc1
diff --git a/src/lj_asm_arm64.h b/src/lj_asm_arm64.h
006bc1
index 8fd92e7..cbb186d 100644
006bc1
--- a/src/lj_asm_arm64.h
006bc1
+++ b/src/lj_asm_arm64.h
006bc1
@@ -869,14 +869,12 @@ static void asm_hrefk(ASMState *as, IRIns *ir)
006bc1
   int32_t ofs = (int32_t)(kslot->op2 * sizeof(Node));
006bc1
   int32_t kofs = ofs + (int32_t)offsetof(Node, key);
006bc1
   int bigofs = !emit_checkofs(A64I_LDRx, ofs);
006bc1
-  RegSet allow = RSET_GPR;
006bc1
   Reg dest = (ra_used(ir) || bigofs) ? ra_dest(as, ir, RSET_GPR) : RID_NONE;
006bc1
-  Reg node = ra_alloc1(as, ir->op1, allow);
006bc1
-  Reg key = ra_scratch(as, rset_clear(allow, node));
006bc1
-  Reg idx = node;
006bc1
+  Reg node = ra_alloc1(as, ir->op1, RSET_GPR);
006bc1
+  Reg key, idx = node;
006bc1
+  RegSet allow = rset_exclude(RSET_GPR, node);
006bc1
   uint64_t k;
006bc1
   lua_assert(ofs % sizeof(Node) == 0);
006bc1
-  rset_clear(allow, key);
006bc1
   if (bigofs) {
006bc1
     idx = dest;
006bc1
     rset_clear(allow, dest);
006bc1
@@ -892,7 +890,8 @@ static void asm_hrefk(ASMState *as, IRIns *ir)
006bc1
   } else {
006bc1
     k = ((uint64_t)irt_toitype(irkey->t) << 47) | (uint64_t)ir_kgc(irkey);
006bc1
   }
006bc1
-  emit_nm(as, A64I_CMPx, key, ra_allock(as, k, allow));
006bc1
+  key = ra_scratch(as, allow);
006bc1
+  emit_nm(as, A64I_CMPx, key, ra_allock(as, k, rset_exclude(allow, key)));
006bc1
   emit_lso(as, A64I_LDRx, key, idx, kofs);
006bc1
   if (bigofs)
006bc1
     emit_opk(as, A64I_ADDx, dest, node, ofs, RSET_GPR);
006bc1
-- 
006bc1
2.20.1
006bc1