Commit 47d4804
committed
[RISCV] Commute True in foldVMergeToMask
In order to fold a vmerge into a pseudo, the pseudo's passthru needs to be the same as vmerge's false operand.
If they don't match we can try and commute the instruction if possible, e.g. here we can commute v9 and v8 to fold the vmerge:
vsetvli zero, a0, e32, m1, ta, ma
vfmadd.vv v9, v10, v8
vsetvli zero, zero, e32, m1, tu, ma
vmerge.vvm v8, v8, v9, v0
vsetvli zero, a0, e32, m1, tu, mu
vfmacc.vv v8, v9, v10, v0.t
Previously this wasn't possible because we did the peephole in SelectionDAG, but now that it's been migrated to MachineInstr in #144076 we can reuse the commuting infrastructure in TargetInstrInfo.
This fixes the extra vmv.v.v in the "mul" example here: #123069 (comment)
It should also allow us to remove the isel patterns described in #141885 later.1 parent d6b3d9f commit 47d4804
File tree
4 files changed
+177
-282
lines changed- llvm
- lib/Target/RISCV
- test/CodeGen/RISCV/rvv
4 files changed
+177
-282
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
745 | 745 | | |
746 | 746 | | |
747 | 747 | | |
| 748 | + | |
| 749 | + | |
748 | 750 | | |
749 | 751 | | |
750 | 752 | | |
751 | 753 | | |
752 | | - | |
753 | | - | |
| 754 | + | |
| 755 | + | |
| 756 | + | |
| 757 | + | |
| 758 | + | |
| 759 | + | |
| 760 | + | |
| 761 | + | |
| 762 | + | |
| 763 | + | |
| 764 | + | |
| 765 | + | |
754 | 766 | | |
755 | 767 | | |
756 | 768 | | |
| |||
796 | 808 | | |
797 | 809 | | |
798 | 810 | | |
| 811 | + | |
| 812 | + | |
| 813 | + | |
| 814 | + | |
| 815 | + | |
| 816 | + | |
| 817 | + | |
| 818 | + | |
799 | 819 | | |
800 | 820 | | |
801 | 821 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1219 | 1219 | | |
1220 | 1220 | | |
1221 | 1221 | | |
1222 | | - | |
1223 | | - | |
1224 | | - | |
1225 | | - | |
| 1222 | + | |
| 1223 | + | |
1226 | 1224 | | |
1227 | 1225 | | |
1228 | 1226 | | |
| |||
0 commit comments