diff options
author | Mike Pall <mike> | 2023-09-09 14:20:39 +0200 |
---|---|---|
committer | Mike Pall <mike> | 2023-09-09 14:20:39 +0200 |
commit | dfc122e45ce0dd76a47794789b413aeaa4cc3773 (patch) | |
tree | 3a18de1056ea47f7b89ff10dda2aaeaef2e4c3e2 /src | |
parent | 4651ff2fbc30a8326bcfc8e9d719fbf30856f5e2 (diff) | |
download | luajit-dfc122e45ce0dd76a47794789b413aeaa4cc3773.tar.gz luajit-dfc122e45ce0dd76a47794789b413aeaa4cc3773.tar.bz2 luajit-dfc122e45ce0dd76a47794789b413aeaa4cc3773.zip |
ARM64: Tune emit_lsptr. Avoid wrong load for asm_prof.
Thanks to Peter Cawley. #1065
Diffstat (limited to 'src')
-rw-r--r-- | src/lj_emit_arm64.h | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/src/lj_emit_arm64.h b/src/lj_emit_arm64.h index 73df508c..86626177 100644 --- a/src/lj_emit_arm64.h +++ b/src/lj_emit_arm64.h | |||
@@ -242,19 +242,20 @@ static Reg ra_allock(ASMState *as, intptr_t k, RegSet allow); | |||
242 | /* Get/set from constant pointer. */ | 242 | /* Get/set from constant pointer. */ |
243 | static void emit_lsptr(ASMState *as, A64Ins ai, Reg r, void *p) | 243 | static void emit_lsptr(ASMState *as, A64Ins ai, Reg r, void *p) |
244 | { | 244 | { |
245 | /* First, check if ip + offset is in range. */ | 245 | Reg base = RID_GL; |
246 | if ((ai & 0x00400000) && checkmcpofs(as, p)) { | 246 | int64_t ofs = glofs(as, p); |
247 | if (emit_checkofs(ai, ofs)) { | ||
248 | /* GL + offset, might subsequently fuse to LDP/STP. */ | ||
249 | } else if (ai == A64I_LDRx && checkmcpofs(as, p)) { | ||
250 | /* IP + offset is cheaper than allock, but address must be in range. */ | ||
247 | emit_d(as, A64I_LDRLx | A64F_S19(mcpofs(as, p)>>2), r); | 251 | emit_d(as, A64I_LDRLx | A64F_S19(mcpofs(as, p)>>2), r); |
248 | } else { | 252 | return; |
249 | Reg base = RID_GL; /* Next, try GL + offset. */ | 253 | } else { /* Split up into base reg + offset. */ |
250 | int64_t ofs = glofs(as, p); | 254 | int64_t i64 = i64ptr(p); |
251 | if (!emit_checkofs(ai, ofs)) { /* Else split up into base reg + offset. */ | 255 | base = ra_allock(as, (i64 & ~0x7fffull), rset_exclude(RSET_GPR, r)); |
252 | int64_t i64 = i64ptr(p); | 256 | ofs = i64 & 0x7fffull; |
253 | base = ra_allock(as, (i64 & ~0x7fffull), rset_exclude(RSET_GPR, r)); | ||
254 | ofs = i64 & 0x7fffull; | ||
255 | } | ||
256 | emit_lso(as, ai, r, base, ofs); | ||
257 | } | 257 | } |
258 | emit_lso(as, ai, r, base, ofs); | ||
258 | } | 259 | } |
259 | 260 | ||
260 | /* Load 64 bit IR constant into register. */ | 261 | /* Load 64 bit IR constant into register. */ |