Commit 93bfcbb
committed
[RISCV] Account for ADDI immediate range in select of two constants with zicond
When choosing to materialize a select of two constants using zicond,
we have a choice of which direction to compute the delta. The prior
cost was looking only at the cost of the values without accounting
for the fact it's actually the delta which is the highest cost and
that sometimes the addend can fold into an addi.
Note that the addi is also preferrable since it might be folded into
a dependent memory instruction if e.g. we're doing a load from a
select of two constant addresses.1 parent 8cf2d27 commit 93bfcbb
File tree
2 files changed
+21
-13
lines changed- llvm
- lib/Target/RISCV
- test/CodeGen/RISCV
2 files changed
+21
-13
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9280 | 9280 | | |
9281 | 9281 | | |
9282 | 9282 | | |
9283 | | - | |
9284 | | - | |
9285 | | - | |
9286 | | - | |
9287 | | - | |
| 9283 | + | |
| 9284 | + | |
| 9285 | + | |
| 9286 | + | |
| 9287 | + | |
| 9288 | + | |
| 9289 | + | |
| 9290 | + | |
| 9291 | + | |
| 9292 | + | |
| 9293 | + | |
| 9294 | + | |
| 9295 | + | |
| 9296 | + | |
| 9297 | + | |
9288 | 9298 | | |
9289 | 9299 | | |
9290 | 9300 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
506 | 506 | | |
507 | 507 | | |
508 | 508 | | |
509 | | - | |
510 | | - | |
511 | | - | |
512 | 509 | | |
513 | | - | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
514 | 513 | | |
515 | 514 | | |
516 | 515 | | |
| |||
536 | 535 | | |
537 | 536 | | |
538 | 537 | | |
539 | | - | |
540 | | - | |
541 | | - | |
542 | 538 | | |
543 | | - | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
544 | 542 | | |
545 | 543 | | |
546 | 544 | | |
| |||
0 commit comments