Commit 5dc1c6e
arcv: implement bit-extract fusion
The bitfield zero_extract operation is normally expanded into an srai
followed by an andi. (With the ZBS extension enabled, the special case
of 1-bit zero-extract is implemented with the bexti insn.) However,
since the RHX core can execute a shift-left and a shift-right of the
same register in 1 cycle, we would prefer to emit those two instructions
instead, and schedule them together so that macro fusion can take place.
The required steps to achieve this are:
(1) Create an insn_and_split that handles the zero_extract RTX;
(2) Tell the combiner to use that split by lowering the cost of the
zero_extract RTX when the target is the RHX core;
(3) Designate the resulting slli + srli pair as fusable by the scheduler.
Attached is a small testcase demonstrating the split, and that the bexti
insn still takes priority over the shift pair.
Signed-off-by: Artemiy Volkov <artemiy@synopsys.com>1 parent 8bf79f3 commit 5dc1c6e
File tree
4 files changed
+46
-2
lines changed- gcc
- config/riscv
- testsuite/gcc.target/riscv
4 files changed
+46
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
50 | 55 | | |
51 | 56 | | |
52 | 57 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4337 | 4337 | | |
4338 | 4338 | | |
4339 | 4339 | | |
4340 | | - | |
| 4340 | + | |
| 4341 | + | |
4341 | 4342 | | |
4342 | 4343 | | |
4343 | 4344 | | |
| |||
11198 | 11199 | | |
11199 | 11200 | | |
11200 | 11201 | | |
| 11202 | + | |
| 11203 | + | |
| 11204 | + | |
| 11205 | + | |
| 11206 | + | |
| 11207 | + | |
| 11208 | + | |
11201 | 11209 | | |
11202 | 11210 | | |
11203 | 11211 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
518 | 518 | | |
519 | 519 | | |
520 | 520 | | |
521 | | - | |
| 521 | + | |
522 | 522 | | |
523 | 523 | | |
524 | 524 | | |
| |||
4564 | 4564 | | |
4565 | 4565 | | |
4566 | 4566 | | |
| 4567 | + | |
| 4568 | + | |
| 4569 | + | |
| 4570 | + | |
| 4571 | + | |
| 4572 | + | |
| 4573 | + | |
| 4574 | + | |
| 4575 | + | |
| 4576 | + | |
| 4577 | + | |
| 4578 | + | |
| 4579 | + | |
| 4580 | + | |
| 4581 | + | |
| 4582 | + | |
| 4583 | + | |
4567 | 4584 | | |
4568 | 4585 | | |
4569 | 4586 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
0 commit comments