Commit cb71c3f
committed
[RISCV] Fix Lsb > Msb case in (sra (sext_inreg X, _), C) for th.ext
According the spec
https://github.com/XUANTIE-RV/thead-extension-spec/releases/tag/2.3.0,
the operation of `th.ext rd, rs1, msb, lsb` is
reg[rd] := sign_extend(reg[rs1][msb:lsb])
The spec doesn't specify if lsb is greater than msb.
I don't think lsb can be greater than msb. So that If
the shift-right amount is greater than msb, we can set lsb equal to
msb to extract the bit rs1[msb] and sign-extend it.1 parent bb6fe51 commit cb71c3f
File tree
2 files changed
+4
-2
lines changed- llvm
- lib/Target/RISCV
- test/CodeGen/RISCV
2 files changed
+4
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
653 | 653 | | |
654 | 654 | | |
655 | 655 | | |
656 | | - | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
657 | 659 | | |
658 | 660 | | |
659 | 661 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
426 | 426 | | |
427 | 427 | | |
428 | 428 | | |
429 | | - | |
| 429 | + | |
430 | 430 | | |
431 | 431 | | |
432 | 432 | | |
| |||
0 commit comments