Commit 4e2c6bd
committed
[AArch64][CostModel] Alter sdiv/srem cost where the divisor is constant
This patch draws its inspiration from the udiv/urem patch #122236
For sdiv, typical sequence of instructions as per the type and divisor property is as follows:
Scalar power-of-2: cmp + csel + asr
Neon power-of-2: usra + sshr
Scalar non-power-2: smulh/smull + asr/lsr + add/sub + asr + add
Vector non-power-2:
a) <2 x i64>: 2 * (smulh + asr + add) . This yeilds scalarized form.
b) <4 x i32>: smull2 + smull + uzp2 + add + sshr + usra
SVE versions should have more or less the same cost because sometimes they yeild native sdiv instructions, which should have less cost or the same sequence of neon instructions.
For srem, typical sequence of instructions as per the type and divisor property is as follows:
Scalar version: <set of sdiv instructions> + msub
Vector version: <set of sdiv instructions> + 2-msub/1-mls1 parent 226a9d7 commit 4e2c6bd
File tree
9 files changed
+783
-587
lines changed- llvm
- lib/Target/AArch64
- test
- Analysis/CostModel/AArch64
- Transforms
- LoopVectorize/AArch64
- SLPVectorizer/AArch64
9 files changed
+783
-587
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3491 | 3491 | | |
3492 | 3492 | | |
3493 | 3493 | | |
| 3494 | + | |
3494 | 3495 | | |
3495 | | - | |
3496 | | - | |
3497 | | - | |
3498 | | - | |
3499 | | - | |
3500 | | - | |
3501 | | - | |
3502 | | - | |
3503 | | - | |
3504 | | - | |
3505 | | - | |
3506 | | - | |
3507 | | - | |
3508 | | - | |
3509 | | - | |
3510 | | - | |
| 3496 | + | |
| 3497 | + | |
| 3498 | + | |
| 3499 | + | |
| 3500 | + | |
| 3501 | + | |
| 3502 | + | |
| 3503 | + | |
| 3504 | + | |
| 3505 | + | |
| 3506 | + | |
| 3507 | + | |
| 3508 | + | |
| 3509 | + | |
| 3510 | + | |
| 3511 | + | |
| 3512 | + | |
| 3513 | + | |
| 3514 | + | |
| 3515 | + | |
| 3516 | + | |
| 3517 | + | |
| 3518 | + | |
| 3519 | + | |
| 3520 | + | |
| 3521 | + | |
| 3522 | + | |
| 3523 | + | |
| 3524 | + | |
| 3525 | + | |
| 3526 | + | |
| 3527 | + | |
| 3528 | + | |
| 3529 | + | |
| 3530 | + | |
| 3531 | + | |
| 3532 | + | |
| 3533 | + | |
| 3534 | + | |
| 3535 | + | |
| 3536 | + | |
| 3537 | + | |
| 3538 | + | |
| 3539 | + | |
| 3540 | + | |
3511 | 3541 | | |
3512 | 3542 | | |
3513 | 3543 | | |
| |||
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
| 10 | + | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
| 19 | + | |
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
| 28 | + | |
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| |||
0 commit comments