diff options
author | Lehua Ding <lehua.ding@rivai.ai> | 2023-11-07 15:33:20 +0800 |
---|---|---|
committer | Lehua Ding <lehua.ding@rivai.ai> | 2023-11-07 15:53:53 +0800 |
commit | 71b1efd910d47362558defc31b92fc4cc80c0ec6 (patch) | |
tree | 6bd42ac1e44e57ad1d14923704e339e557a6da10 /gcc/ada | |
parent | 86c913ec92c1b8e871e061ff35db58c2f81780f4 (diff) | |
download | gcc-71b1efd910d47362558defc31b92fc4cc80c0ec6.zip gcc-71b1efd910d47362558defc31b92fc4cc80c0ec6.tar.gz gcc-71b1efd910d47362558defc31b92fc4cc80c0ec6.tar.bz2 |
RISC-V: Fixed failed rvv combine testcases
This patch fixed the fellowing failed testcases on the trunk:
FAIL: gcc.target/riscv/rvv/autovec/cond/cond_widen_reduc-2.c scan-assembler-times \\tvfwredusum\\.vs\\tv[0-9]+,v[0-9]+,v[0-9]+,v0\\.t 2
...
FAIL: gcc.target/riscv/rvv/autovec/cond/cond_widen_reduc-2.c scan-assembler-times \\tvwredsumu\\.vs\\tv[0-9]+,v[0-9]+,v[0-9]+,v0\\.t 3
...
The reason for these failed testcases is the introduce of .VCOND_MASK_LEN
in midend for other bugfix and further leads to a new vcond_mask_len rtl
pattern after expand. So we need add new combine patterns handle this case.
Consider this code:
int16_t foo (int8_t *restrict a, int8_t *restrict pred)
{
int16_t sum = 0;
for (int i = 0; i < 16; i += 1)
if (pred[i])
sum += a[i];
return sum;
}
Before this patch:
foo:
vsetivli zero,16,e8,m1,ta,ma
vle8.v v0,0(a1)
vsetvli a5,zero,e8,m1,ta,ma
vmsne.vi v0,v0,0
vsetvli zero,zero,e16,m2,ta,ma
li a3,0
vmv.v.i v2,0
vsetivli zero,16,e16,m2,ta,ma
vle8.v v6,0(a0),v0.t
vmv.s.x v1,a3
vsetvli a5,zero,e16,m2,ta,ma
vsext.vf2 v4,v6
vsetivli zero,16,e16,m2,tu,ma
vmerge.vvm v2,v2,v4,v0
vsetvli a5,zero,e16,m2,ta,ma
vredsum.vs v2,v2,v1
vmv.x.s a0,v2
slliw a0,a0,16
sraiw a0,a0,16
ret
After this patch:
foo:
vsetivli zero,16,e16,m2,ta,ma
li a5,0
vle8.v v0,0(a1)
vmv.s.x v1,a5
vsetvli zero,zero,e8,m1,ta,ma
vmsne.vi v0,v0,0
vle8.v v2,0(a0),v0.t
vwredsum.vs v1,v2,v1,v0.t
vsetvli zero,zero,e16,m1,ta,ma
vmv.x.s a0,v1
slliw a0,a0,16
sraiw a0,a0,16
ret
Combine the vsext.vf2, vmerge.vvm, and vredsum.vs instructions while
reducing the corresponding vsetvl instructions.
gcc/ChangeLog:
* config/riscv/autovec-opt.md (*cond_len_<optab><v_double_trunc><mode>):
New combine pattern.
(*cond_len_<optab><v_quad_trunc><mode>): Ditto.
(*cond_len_<optab><v_oct_trunc><mode>): Ditto.
(*cond_len_extend<v_double_trunc><mode>): Ditto.
(*cond_len_widen_reduc_plus_scal_<mode>): Ditto.
gcc/testsuite/ChangeLog:
* gcc.target/riscv/rvv/autovec/cond/cond_widen_reduc-1.c:
* gcc.target/riscv/rvv/autovec/cond/cond_widen_reduc-2.c:
Diffstat (limited to 'gcc/ada')
0 files changed, 0 insertions, 0 deletions