aboutsummaryrefslogtreecommitdiff
path: root/src/lj_emit_arm64.h
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/lj_emit_arm64.h18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/lj_emit_arm64.h b/src/lj_emit_arm64.h
index 6da4c7d4..1001b1d8 100644
--- a/src/lj_emit_arm64.h
+++ b/src/lj_emit_arm64.h
@@ -241,7 +241,7 @@ static void emit_loadk(ASMState *as, Reg rd, uint64_t u64, int is64)
241#define mcpofs(as, k) \ 241#define mcpofs(as, k) \
242 ((intptr_t)((uintptr_t)(k) - (uintptr_t)(as->mcp - 1))) 242 ((intptr_t)((uintptr_t)(k) - (uintptr_t)(as->mcp - 1)))
243#define checkmcpofs(as, k) \ 243#define checkmcpofs(as, k) \
244 ((((mcpofs(as, k)>>2) + 0x00040000) >> 19) == 0) 244 (A64F_S_OK(mcpofs(as, k)>>2, 19))
245 245
246static Reg ra_allock(ASMState *as, intptr_t k, RegSet allow); 246static Reg ra_allock(ASMState *as, intptr_t k, RegSet allow);
247 247
@@ -312,7 +312,7 @@ static void emit_cond_branch(ASMState *as, A64CC cond, MCode *target)
312{ 312{
313 MCode *p = --as->mcp; 313 MCode *p = --as->mcp;
314 ptrdiff_t delta = target - p; 314 ptrdiff_t delta = target - p;
315 lua_assert(((delta + 0x40000) >> 19) == 0); 315 lua_assert(A64F_S_OK(delta, 19));
316 *p = A64I_BCC | A64F_S19(delta) | cond; 316 *p = A64I_BCC | A64F_S19(delta) | cond;
317} 317}
318 318
@@ -320,24 +320,24 @@ static void emit_branch(ASMState *as, A64Ins ai, MCode *target)
320{ 320{
321 MCode *p = --as->mcp; 321 MCode *p = --as->mcp;
322 ptrdiff_t delta = target - p; 322 ptrdiff_t delta = target - p;
323 lua_assert(((delta + 0x02000000) >> 26) == 0); 323 lua_assert(A64F_S_OK(delta, 26));
324 *p = ai | ((uint32_t)delta & 0x03ffffffu); 324 *p = ai | A64F_S26(delta);
325} 325}
326 326
327static void emit_tnb(ASMState *as, A64Ins ai, Reg r, uint32_t bit, MCode *target) 327static void emit_tnb(ASMState *as, A64Ins ai, Reg r, uint32_t bit, MCode *target)
328{ 328{
329 MCode *p = --as->mcp; 329 MCode *p = --as->mcp;
330 ptrdiff_t delta = target - p; 330 ptrdiff_t delta = target - p;
331 lua_assert(bit < 63 && ((delta + 0x2000) >> 14) == 0); 331 lua_assert(bit < 63 && A64F_S_OK(delta, 14));
332 if (bit > 31) ai |= A64I_X; 332 if (bit > 31) ai |= A64I_X;
333 *p = ai | A64F_BIT(bit & 31) | A64F_S14((uint32_t)delta & 0x3fffu) | r; 333 *p = ai | A64F_BIT(bit & 31) | A64F_S14(delta) | r;
334} 334}
335 335
336static void emit_cnb(ASMState *as, A64Ins ai, Reg r, MCode *target) 336static void emit_cnb(ASMState *as, A64Ins ai, Reg r, MCode *target)
337{ 337{
338 MCode *p = --as->mcp; 338 MCode *p = --as->mcp;
339 ptrdiff_t delta = target - p; 339 ptrdiff_t delta = target - p;
340 lua_assert(((delta + 0x40000) >> 19) == 0); 340 lua_assert(A64F_S_OK(delta, 19));
341 *p = ai | A64F_S19(delta) | r; 341 *p = ai | A64F_S19(delta) | r;
342} 342}
343 343
@@ -347,8 +347,8 @@ static void emit_call(ASMState *as, void *target)
347{ 347{
348 MCode *p = --as->mcp; 348 MCode *p = --as->mcp;
349 ptrdiff_t delta = (char *)target - (char *)p; 349 ptrdiff_t delta = (char *)target - (char *)p;
350 if ((((delta>>2) + 0x02000000) >> 26) == 0) { 350 if (A64F_S_OK(delta>>2, 26)) {
351 *p = A64I_BL | ((uint32_t)(delta>>2) & 0x03ffffffu); 351 *p = A64I_BL | A64F_S26(delta>>2);
352 } else { /* Target out of range: need indirect call. But don't use R0-R7. */ 352 } else { /* Target out of range: need indirect call. But don't use R0-R7. */
353 Reg r = ra_allock(as, i64ptr(target), 353 Reg r = ra_allock(as, i64ptr(target),
354 RSET_RANGE(RID_X8, RID_MAX_GPR)-RSET_FIXED); 354 RSET_RANGE(RID_X8, RID_MAX_GPR)-RSET_FIXED);