Commit d1eaced
RISC-V: Disallow transformation into VLMAX AVL for cond_len_xxx when length is in range [0, 31]
Notice we have this following situation:
vsetivli zero,4,e32,m1,ta,ma
vlseg4e32.v v4,(a5)
vlseg4e32.v v12,(a3)
vsetvli a5,zero,e32,m1,tu,ma ---> This is redundant since VLMAX AVL = 4 when it is fixed-vlmax
vfadd.vf v3,v13,fa0
vfadd.vf v1,v12,fa1
vfmul.vv v17,v3,v5
vfmul.vv v16,v1,v5
The rootcause is that we transform COND_LEN_xxx into VLMAX AVL when len == NUNITS blindly.
However, we don't need to transform all of them since when len is range of [0,31], we don't need to
consume scalar registers.
After this patch:
vsetivli zero,4,e32,m1,tu,ma
addi a4,a5,400
vlseg4e32.v v12,(a3)
vfadd.vf v3,v13,fa0
vfadd.vf v1,v12,fa1
vlseg4e32.v v4,(a4)
vfadd.vf v2,v14,fa1
vfmul.vv v17,v3,v5
vfmul.vv v16,v1,v5
Tested on both RV32 and RV64 no regression.
Ok for trunk ?
gcc/ChangeLog:
* config/riscv/riscv-v.cc (is_vlmax_len_p): New function.
(expand_load_store): Disallow transformation into VLMAX when len is in range of [0,31]
(expand_cond_len_op): Ditto.
(expand_gather_scatter): Ditto.
(expand_lanes_load_store): Ditto.
(expand_fold_extract_last): Ditto.
gcc/testsuite/ChangeLog:
* gcc.target/riscv/rvv/autovec/post-ra-avl.c: Adapt test.
* gcc.target/riscv/rvv/base/vf_avl-2.c: New test.1 parent 7de05ad commit d1eaced
File tree
3 files changed
+37
-7
lines changed- gcc
- config/riscv
- testsuite/gcc.target/riscv/rvv
- autovec
- base
3 files changed
+37
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
71 | 81 | | |
72 | 82 | | |
73 | 83 | | |
| |||
3776 | 3786 | | |
3777 | 3787 | | |
3778 | 3788 | | |
3779 | | - | |
| 3789 | + | |
3780 | 3790 | | |
3781 | 3791 | | |
3782 | 3792 | | |
| |||
3842 | 3852 | | |
3843 | 3853 | | |
3844 | 3854 | | |
3845 | | - | |
3846 | | - | |
| 3855 | + | |
3847 | 3856 | | |
3848 | 3857 | | |
3849 | 3858 | | |
| |||
4012 | 4021 | | |
4013 | 4022 | | |
4014 | 4023 | | |
4015 | | - | |
| 4024 | + | |
4016 | 4025 | | |
4017 | 4026 | | |
4018 | 4027 | | |
| |||
4199 | 4208 | | |
4200 | 4209 | | |
4201 | 4210 | | |
4202 | | - | |
| 4211 | + | |
4203 | 4212 | | |
4204 | 4213 | | |
4205 | 4214 | | |
| |||
4252 | 4261 | | |
4253 | 4262 | | |
4254 | 4263 | | |
4255 | | - | |
| 4264 | + | |
4256 | 4265 | | |
4257 | 4266 | | |
4258 | 4267 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
| 16 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
0 commit comments