diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/lj_asm_arm64.h | 3 | ||||
| -rw-r--r-- | src/lj_asm_mips.h | 3 | ||||
| -rw-r--r-- | src/lj_asm_x86.h | 5 |
3 files changed, 7 insertions, 4 deletions
diff --git a/src/lj_asm_arm64.h b/src/lj_asm_arm64.h index dfc5490fa..d068b153a 100644 --- a/src/lj_asm_arm64.h +++ b/src/lj_asm_arm64.h | |||
| @@ -1549,7 +1549,8 @@ static void asm_bitshift(ASMState *as, IRIns *ir, A64Ins ai, A64Shift sh) | |||
| 1549 | int32_t shmask = irt_is64(ir->t) ? 63 : 31; | 1549 | int32_t shmask = irt_is64(ir->t) ? 63 : 31; |
| 1550 | if (irref_isk(ir->op2)) { /* Constant shifts. */ | 1550 | if (irref_isk(ir->op2)) { /* Constant shifts. */ |
| 1551 | Reg left, dest = ra_dest(as, ir, RSET_GPR); | 1551 | Reg left, dest = ra_dest(as, ir, RSET_GPR); |
| 1552 | int32_t shift = (IR(ir->op2)->i & shmask); | 1552 | IRIns *irr = IR(ir->op2); |
| 1553 | int32_t shift = ((irr->o == IR_KINT ? irr->i : (int32_t)ir_kint64(irr)->u64) & shmask); | ||
| 1553 | IRIns *irl = IR(ir->op1); | 1554 | IRIns *irl = IR(ir->op1); |
| 1554 | if (shmask == 63) ai += A64I_UBFMx - A64I_UBFMw; | 1555 | if (shmask == 63) ai += A64I_UBFMx - A64I_UBFMw; |
| 1555 | 1556 | ||
diff --git a/src/lj_asm_mips.h b/src/lj_asm_mips.h index a54af233f..7565f442e 100644 --- a/src/lj_asm_mips.h +++ b/src/lj_asm_mips.h | |||
| @@ -2089,7 +2089,8 @@ static void asm_bitshift(ASMState *as, IRIns *ir, MIPSIns mi, MIPSIns mik) | |||
| 2089 | { | 2089 | { |
| 2090 | Reg dest = ra_dest(as, ir, RSET_GPR); | 2090 | Reg dest = ra_dest(as, ir, RSET_GPR); |
| 2091 | if (irref_isk(ir->op2)) { /* Constant shifts. */ | 2091 | if (irref_isk(ir->op2)) { /* Constant shifts. */ |
| 2092 | uint32_t shift = (uint32_t)IR(ir->op2)->i; | 2092 | IRIns *irr = IR(ir->op2); |
| 2093 | uint32_t shift = (uint32_t)(LJ_32 || irr->o == IR_KINT) ? (uint32_t)irr->i : (uint32_t)ir_kint64(irr)->u64; | ||
| 2093 | if (LJ_64 && irt_is64(ir->t)) mik |= (shift & 32) ? MIPSI_D32 : MIPSI_D; | 2094 | if (LJ_64 && irt_is64(ir->t)) mik |= (shift & 32) ? MIPSI_D32 : MIPSI_D; |
| 2094 | emit_dta(as, mik, dest, ra_hintalloc(as, ir->op1, dest, RSET_GPR), | 2095 | emit_dta(as, mik, dest, ra_hintalloc(as, ir->op1, dest, RSET_GPR), |
| 2095 | (shift & 31)); | 2096 | (shift & 31)); |
diff --git a/src/lj_asm_x86.h b/src/lj_asm_x86.h index 3d68baefd..943cf2b77 100644 --- a/src/lj_asm_x86.h +++ b/src/lj_asm_x86.h | |||
| @@ -2318,9 +2318,10 @@ static void asm_bitshift(ASMState *as, IRIns *ir, x86Shift xs, x86Op xv) | |||
| 2318 | IRIns *irr = IR(rref); | 2318 | IRIns *irr = IR(rref); |
| 2319 | Reg dest; | 2319 | Reg dest; |
| 2320 | if (irref_isk(rref)) { /* Constant shifts. */ | 2320 | if (irref_isk(rref)) { /* Constant shifts. */ |
| 2321 | int shift; | 2321 | int32_t shift; |
| 2322 | dest = ra_dest(as, ir, RSET_GPR); | 2322 | dest = ra_dest(as, ir, RSET_GPR); |
| 2323 | shift = irr->i & (irt_is64(ir->t) ? 63 : 31); | 2323 | shift = (LJ_32 || irr->o == IR_KINT) ? irr->i : (int32_t)ir_kint64(irr)->u64; |
| 2324 | shift &= (irt_is64(ir->t) ? 63 : 31); | ||
| 2324 | if (!xv && shift && (as->flags & JIT_F_BMI2)) { | 2325 | if (!xv && shift && (as->flags & JIT_F_BMI2)) { |
| 2325 | Reg left = asm_fuseloadm(as, ir->op1, RSET_GPR, irt_is64(ir->t)); | 2326 | Reg left = asm_fuseloadm(as, ir->op1, RSET_GPR, irt_is64(ir->t)); |
| 2326 | if (left != dest) { /* BMI2 rotate right by constant. */ | 2327 | if (left != dest) { /* BMI2 rotate right by constant. */ |
