Commit 9fe2286
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 3b90124 commit 9fe2286
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 | |
|---|---|---|---|
| |||
4326 | 4326 | | |
4327 | 4327 | | |
4328 | 4328 | | |
4329 | | - | |
| 4329 | + | |
| 4330 | + | |
4330 | 4331 | | |
4331 | 4332 | | |
4332 | 4333 | | |
| |||
10571 | 10572 | | |
10572 | 10573 | | |
10573 | 10574 | | |
| 10575 | + | |
| 10576 | + | |
| 10577 | + | |
| 10578 | + | |
| 10579 | + | |
| 10580 | + | |
| 10581 | + | |
10574 | 10582 | | |
10575 | 10583 | | |
10576 | 10584 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
518 | 518 | | |
519 | 519 | | |
520 | 520 | | |
521 | | - | |
| 521 | + | |
522 | 522 | | |
523 | 523 | | |
524 | 524 | | |
| |||
4588 | 4588 | | |
4589 | 4589 | | |
4590 | 4590 | | |
| 4591 | + | |
| 4592 | + | |
| 4593 | + | |
| 4594 | + | |
| 4595 | + | |
| 4596 | + | |
| 4597 | + | |
| 4598 | + | |
| 4599 | + | |
| 4600 | + | |
| 4601 | + | |
| 4602 | + | |
| 4603 | + | |
| 4604 | + | |
| 4605 | + | |
| 4606 | + | |
| 4607 | + | |
4591 | 4608 | | |
4592 | 4609 | | |
4593 | 4610 | | |
| |||
| 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