diff options
| author | Mike Pall <mike> | 2023-09-09 20:59:18 +0200 |
|---|---|---|
| committer | Mike Pall <mike> | 2023-09-09 20:59:18 +0200 |
| commit | 4611e25c0fbe911486cccae4556eb086c0254c5f (patch) | |
| tree | 14a3eee2a03e4e9d4e58760b5f41e7cc22a23fd0 | |
| parent | 90742d91c27d185b70d1b4a6343fb6b7c26002db (diff) | |
| download | luajit-4611e25c0fbe911486cccae4556eb086c0254c5f.tar.gz luajit-4611e25c0fbe911486cccae4556eb086c0254c5f.tar.bz2 luajit-4611e25c0fbe911486cccae4556eb086c0254c5f.zip | |
ARM64: Fuse rotates into logical operands.
Thanks to Peter Cawley. #1076
| -rw-r--r-- | src/lj_asm_arm64.h | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/lj_asm_arm64.h b/src/lj_asm_arm64.h index 04834f57..4dd6b711 100644 --- a/src/lj_asm_arm64.h +++ b/src/lj_asm_arm64.h | |||
| @@ -244,6 +244,10 @@ static uint32_t asm_fuseopm(ASMState *as, A64Ins ai, IRRef ref, RegSet allow) | |||
| 244 | Reg m = ra_alloc1(as, ir->op1, allow); | 244 | Reg m = ra_alloc1(as, ir->op1, allow); |
| 245 | return A64F_M(m) | A64F_SH(sh, shift); | 245 | return A64F_M(m) | A64F_SH(sh, shift); |
| 246 | } | 246 | } |
| 247 | } else if (ir->o == IR_BROR && logical && irref_isk(ir->op2)) { | ||
| 248 | Reg m = ra_alloc1(as, ir->op1, allow); | ||
| 249 | int shift = (IR(ir->op2)->i & (irt_is64(ir->t) ? 63 : 31)); | ||
| 250 | return A64F_M(m) | A64F_SH(A64SH_ROR, shift); | ||
| 247 | } else if (ir->o == IR_CONV && !logical && | 251 | } else if (ir->o == IR_CONV && !logical && |
| 248 | ir->op2 == ((IRT_I64<<IRCONV_DSH)|IRT_INT|IRCONV_SEXT)) { | 252 | ir->op2 == ((IRT_I64<<IRCONV_DSH)|IRT_INT|IRCONV_SEXT)) { |
| 249 | Reg m = ra_alloc1(as, ir->op1, allow); | 253 | Reg m = ra_alloc1(as, ir->op1, allow); |
| @@ -1337,12 +1341,12 @@ static int asm_swapops(ASMState *as, IRRef lref, IRRef rref) | |||
| 1337 | if (irref_isk(lref)) | 1341 | if (irref_isk(lref)) |
| 1338 | return 1; /* But swap constants to the right. */ | 1342 | return 1; /* But swap constants to the right. */ |
| 1339 | ir = IR(rref); | 1343 | ir = IR(rref); |
| 1340 | if ((ir->o >= IR_BSHL && ir->o <= IR_BSAR) || | 1344 | if ((ir->o >= IR_BSHL && ir->o <= IR_BROR) || |
| 1341 | (ir->o == IR_ADD && ir->op1 == ir->op2) || | 1345 | (ir->o == IR_ADD && ir->op1 == ir->op2) || |
| 1342 | (ir->o == IR_CONV && ir->op2 == ((IRT_I64<<IRCONV_DSH)|IRT_INT|IRCONV_SEXT))) | 1346 | (ir->o == IR_CONV && ir->op2 == ((IRT_I64<<IRCONV_DSH)|IRT_INT|IRCONV_SEXT))) |
| 1343 | return 0; /* Don't swap fusable operands to the left. */ | 1347 | return 0; /* Don't swap fusable operands to the left. */ |
| 1344 | ir = IR(lref); | 1348 | ir = IR(lref); |
| 1345 | if ((ir->o >= IR_BSHL && ir->o <= IR_BSAR) || | 1349 | if ((ir->o >= IR_BSHL && ir->o <= IR_BROR) || |
| 1346 | (ir->o == IR_ADD && ir->op1 == ir->op2) || | 1350 | (ir->o == IR_ADD && ir->op1 == ir->op2) || |
| 1347 | (ir->o == IR_CONV && ir->op2 == ((IRT_I64<<IRCONV_DSH)|IRT_INT|IRCONV_SEXT))) | 1351 | (ir->o == IR_CONV && ir->op2 == ((IRT_I64<<IRCONV_DSH)|IRT_INT|IRCONV_SEXT))) |
| 1348 | return 1; /* But swap fusable operands to the right. */ | 1352 | return 1; /* But swap fusable operands to the right. */ |
