diff options
author | Juzhe-Zhong <juzhe.zhong@rivai.ai> | 2024-01-15 09:22:40 +0800 |
---|---|---|
committer | Lehua Ding <lehua.ding@rivai.ai> | 2024-01-15 19:45:44 +0800 |
commit | 405096f908e1ceb0d6a1b5420ded20ad85ddae9e (patch) | |
tree | 1e7b41256324b4f345529d0f8e7b4c5cfacbfb32 /libgfortran/io/io.h | |
parent | afac1bd33657a5054f5e6ea6746c25bbb70b82f2 (diff) | |
download | gcc-405096f908e1ceb0d6a1b5420ded20ad85ddae9e.zip gcc-405096f908e1ceb0d6a1b5420ded20ad85ddae9e.tar.gz gcc-405096f908e1ceb0d6a1b5420ded20ad85ddae9e.tar.bz2 |
RISC-V: Adjust loop len by costing 1 when NITER < VF
Rebase in v3: Rebase to the trunk and commit it as it's approved by Robin.
Update in v2: Add dynmaic lmul test.
This patch fixes the regression between GCC 13.2.0 and trunk GCC (GCC-14)
GCC 13.2.0:
lui a5,%hi(a)
li a4,19
sb a4,%lo(a)(a5)
li a0,0
ret
Trunk GCC:
vsetvli a5,zero,e8,mf2,ta,ma
li a4,-32768
vid.v v1
vsetvli zero,zero,e16,m1,ta,ma
addiw a4,a4,104
vmv.v.i v3,15
lui a1,%hi(a)
li a0,19
vsetvli zero,zero,e8,mf2,ta,ma
vadd.vi v1,v1,1
sb a0,%lo(a)(a1)
vsetvli zero,zero,e16,m1,ta,ma
vzext.vf2 v2,v1
vmv.v.x v1,a4
vminu.vv v2,v2,v3
vsrl.vv v1,v1,v2
vslidedown.vi v1,v1,17
vmv.x.s a0,v1
snez a0,a0
ret
The root cause we are vectorizing the codes inefficiently since we doesn't cost len when NITERS < VF.
Leverage loop control of mask targets or rs6000 fixes the regression.
Tested no regression. Ok for trunk ?
PR target/113281
gcc/ChangeLog:
* config/riscv/riscv-vector-costs.cc (costs::adjust_vect_cost_per_loop): New function.
(costs::finish_cost): Adjust cost for LOOP LEN with NITERS < VF.
* config/riscv/riscv-vector-costs.h: New function.
gcc/testsuite/ChangeLog:
* gcc.dg/vect/costmodel/riscv/rvv/pr113281-3.c: New test.
* gcc.dg/vect/costmodel/riscv/rvv/pr113281-4.c: New test.
* gcc.dg/vect/costmodel/riscv/rvv/pr113281-5.c: New test.
Diffstat (limited to 'libgfortran/io/io.h')
0 files changed, 0 insertions, 0 deletions