diff options
author | Mike Pall <mike> | 2020-01-20 22:15:45 +0100 |
---|---|---|
committer | Mike Pall <mike> | 2020-01-20 22:15:45 +0100 |
commit | 94d0b53004a5fa368defa4307a17edcdb87fe727 (patch) | |
tree | 2468fb7d60f39ccadcd696d333c83ef49f3dfc02 /src/lj_emit_mips.h | |
parent | dfa692b746c9de067857d5fc992a41730be3d99a (diff) | |
download | luajit-94d0b53004a5fa368defa4307a17edcdb87fe727.tar.gz luajit-94d0b53004a5fa368defa4307a17edcdb87fe727.tar.bz2 luajit-94d0b53004a5fa368defa4307a17edcdb87fe727.zip |
MIPS: Add MIPS64 R6 port.
Contributed by Hua Zhang, YunQiang Su from Wave Computing,
and Radovan Birdic from RT-RK.
Sponsored by Wave Computing.
Diffstat (limited to 'src/lj_emit_mips.h')
-rw-r--r-- | src/lj_emit_mips.h | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/lj_emit_mips.h b/src/lj_emit_mips.h index bb6593ae..313d030a 100644 --- a/src/lj_emit_mips.h +++ b/src/lj_emit_mips.h | |||
@@ -138,6 +138,7 @@ static void emit_loadu64(ASMState *as, Reg r, uint64_t u64) | |||
138 | } else if (emit_kdelta1(as, r, (intptr_t)u64)) { | 138 | } else if (emit_kdelta1(as, r, (intptr_t)u64)) { |
139 | return; | 139 | return; |
140 | } else { | 140 | } else { |
141 | /* TODO MIPSR6: Use DAHI & DATI. Caveat: sign-extension. */ | ||
141 | if ((u64 & 0xffff)) { | 142 | if ((u64 & 0xffff)) { |
142 | emit_tsi(as, MIPSI_ORI, r, r, u64 & 0xffff); | 143 | emit_tsi(as, MIPSI_ORI, r, r, u64 & 0xffff); |
143 | } | 144 | } |
@@ -236,10 +237,22 @@ static void emit_jmp(ASMState *as, MCode *target) | |||
236 | static void emit_call(ASMState *as, void *target, int needcfa) | 237 | static void emit_call(ASMState *as, void *target, int needcfa) |
237 | { | 238 | { |
238 | MCode *p = as->mcp; | 239 | MCode *p = as->mcp; |
239 | *--p = MIPSI_NOP; | 240 | #if LJ_TARGET_MIPSR6 |
241 | ptrdiff_t delta = (char *)target - (char *)p; | ||
242 | if ((((delta>>2) + 0x02000000) >> 26) == 0) { /* Try compact call first. */ | ||
243 | *--p = MIPSI_BALC | (((uintptr_t)delta >>2) & 0x03ffffffu); | ||
244 | as->mcp = p; | ||
245 | return; | ||
246 | } | ||
247 | #endif | ||
248 | *--p = MIPSI_NOP; /* Delay slot. */ | ||
240 | if ((((uintptr_t)target ^ (uintptr_t)p) >> 28) == 0) { | 249 | if ((((uintptr_t)target ^ (uintptr_t)p) >> 28) == 0) { |
250 | #if !LJ_TARGET_MIPSR6 | ||
241 | *--p = (((uintptr_t)target & 1) ? MIPSI_JALX : MIPSI_JAL) | | 251 | *--p = (((uintptr_t)target & 1) ? MIPSI_JALX : MIPSI_JAL) | |
242 | (((uintptr_t)target >>2) & 0x03ffffffu); | 252 | (((uintptr_t)target >>2) & 0x03ffffffu); |
253 | #else | ||
254 | *--p = MIPSI_JAL | (((uintptr_t)target >>2) & 0x03ffffffu); | ||
255 | #endif | ||
243 | } else { /* Target out of range: need indirect call. */ | 256 | } else { /* Target out of range: need indirect call. */ |
244 | *--p = MIPSI_JALR | MIPSF_S(RID_CFUNCADDR); | 257 | *--p = MIPSI_JALR | MIPSF_S(RID_CFUNCADDR); |
245 | needcfa = 1; | 258 | needcfa = 1; |