Commit 469caa3
authored
[RISCV] Use vwadd.vx for splat vector with extension (#87249)
This patch allows `combineBinOp_VLToVWBinOp_VL` to handle patterns like
`(splat_vector (sext op))` or `(splat_vector (zext op))`. Then we can
use `vwadd.vx` and `vwadd.w` for such a case.
### Source code
```
define <vscale x 8 x i64> @vwadd_vx_splat_sext(<vscale x 8 x i32> %va, i32 %b) {
%sb = sext i32 %b to i64
%head = insertelement <vscale x 8 x i64> poison, i64 %sb, i32 0
%splat = shufflevector <vscale x 8 x i64> %head, <vscale x 8 x i64> poison, <vscale x 8 x i32> zeroinitializer
%vc = sext <vscale x 8 x i32> %va to <vscale x 8 x i64>
%ve = add <vscale x 8 x i64> %vc, %splat
ret <vscale x 8 x i64> %ve
}
```
### Before this patch
[Compiler Explorer](https://godbolt.org/z/sq191PsT4)
```
vwadd_vx_splat_sext:
sext.w a0, a0
vsetvli a1, zero, e64, m8, ta, ma
vmv.v.x v16, a0
vsetvli zero, zero, e32, m4, ta, ma
vwadd.wv v16, v16, v8
vmv8r.v v8, v16
ret
```
### After this patch
```
vwadd_vx_splat_sext
vsetvli a1, zero, e32, m4, ta, ma
vwadd.vx v16, v8, a0
vmv8r.v v8, v16
ret
```1 parent 313a33b commit 469caa3
File tree
5 files changed
+569
-235
lines changed- llvm
- lib/Target/RISCV
- test/CodeGen/RISCV/rvv
5 files changed
+569
-235
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13597 | 13597 | | |
13598 | 13598 | | |
13599 | 13599 | | |
13600 | | - | |
| 13600 | + | |
| 13601 | + | |
13601 | 13602 | | |
13602 | 13603 | | |
13603 | 13604 | | |
| |||
13641 | 13642 | | |
13642 | 13643 | | |
13643 | 13644 | | |
| 13645 | + | |
| 13646 | + | |
13644 | 13647 | | |
13645 | 13648 | | |
13646 | 13649 | | |
| |||
13776 | 13779 | | |
13777 | 13780 | | |
13778 | 13781 | | |
| 13782 | + | |
| 13783 | + | |
| 13784 | + | |
| 13785 | + | |
| 13786 | + | |
| 13787 | + | |
| 13788 | + | |
| 13789 | + | |
| 13790 | + | |
| 13791 | + | |
| 13792 | + | |
| 13793 | + | |
| 13794 | + | |
| 13795 | + | |
| 13796 | + | |
| 13797 | + | |
| 13798 | + | |
| 13799 | + | |
| 13800 | + | |
| 13801 | + | |
| 13802 | + | |
| 13803 | + | |
| 13804 | + | |
| 13805 | + | |
| 13806 | + | |
| 13807 | + | |
| 13808 | + | |
| 13809 | + | |
| 13810 | + | |
| 13811 | + | |
| 13812 | + | |
| 13813 | + | |
| 13814 | + | |
| 13815 | + | |
| 13816 | + | |
| 13817 | + | |
| 13818 | + | |
| 13819 | + | |
| 13820 | + | |
| 13821 | + | |
| 13822 | + | |
13779 | 13823 | | |
13780 | 13824 | | |
13781 | 13825 | | |
| |||
13814 | 13858 | | |
13815 | 13859 | | |
13816 | 13860 | | |
13817 | | - | |
13818 | | - | |
13819 | | - | |
13820 | | - | |
13821 | | - | |
13822 | | - | |
13823 | | - | |
13824 | | - | |
13825 | | - | |
13826 | | - | |
13827 | | - | |
13828 | | - | |
13829 | | - | |
13830 | | - | |
13831 | | - | |
13832 | | - | |
13833 | | - | |
13834 | | - | |
13835 | | - | |
13836 | | - | |
13837 | | - | |
13838 | | - | |
13839 | | - | |
13840 | | - | |
13841 | | - | |
13842 | | - | |
13843 | | - | |
13844 | | - | |
13845 | | - | |
13846 | | - | |
13847 | | - | |
13848 | | - | |
13849 | | - | |
13850 | | - | |
13851 | | - | |
| 13861 | + | |
| 13862 | + | |
| 13863 | + | |
13852 | 13864 | | |
13853 | | - | |
13854 | 13865 | | |
13855 | 13866 | | |
13856 | 13867 | | |
| |||
0 commit comments