aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-vect-loop.cc
diff options
context:
space:
mode:
authorJuzhe-Zhong <juzhe.zhong@rivai.ai>2024-01-18 17:53:24 +0800
committerLehua Ding <lehua.ding@rivai.ai>2024-01-18 19:17:02 +0800
commit38d8facddfd891e15b287e5f19c5139272900346 (patch)
tree0180182af23c65f4959833396283cd3d003b18f5 /gcc/tree-vect-loop.cc
parent95d436369637e5a07e0ccf5cfc6e64947e3b477e (diff)
downloadgcc-38d8facddfd891e15b287e5f19c5139272900346.zip
gcc-38d8facddfd891e15b287e5f19c5139272900346.tar.gz
gcc-38d8facddfd891e15b287e5f19c5139272900346.tar.bz2
RISC-V: Support vi variant for vec_cmp
While running various benchmarks, I notice we miss vi variant support for integer comparison. That is, we can vectorize code into vadd.vi but we can't vectorize into vmseq.vi. Consider this following case: void foo (int n, int **__restrict a) { int b; int c; int d; for (b = 0; b < n; b++) for (long e = 8; e > 0; e--) a[b][e] = a[b][e] == 15; } Before this patch: vsetivli zero,4,e32,m1,ta,ma vmv.v.i v4,15 vmv.v.i v3,1 vmv.v.i v2,0 .L3: ld a5,0(a1) addi a4,a5,4 addi a5,a5,20 vle32.v v1,0(a5) vle32.v v0,0(a4) vmseq.vv v0,v0,v4 After this patch: ld a5,0(a1) addi a4,a5,4 addi a5,a5,20 vle32.v v1,0(a5) vle32.v v0,0(a4) vmseq.vi v0,v0,15 It's the missing feature caused by our some mistakes, support vi variant for vec_cmp like other patterns (add, sub, ..., etc). Tested with no regression, ok for trunk ? gcc/ChangeLog: * config/riscv/autovec.md: Support vi variant. gcc/testsuite/ChangeLog: * gcc.target/riscv/rvv/autovec/cmp/cmp_vi-1.c: New test. * gcc.target/riscv/rvv/autovec/cmp/cmp_vi-2.c: New test. * gcc.target/riscv/rvv/autovec/cmp/cmp_vi-3.c: New test. * gcc.target/riscv/rvv/autovec/cmp/cmp_vi-4.c: New test. * gcc.target/riscv/rvv/autovec/cmp/cmp_vi-5.c: New test. * gcc.target/riscv/rvv/autovec/cmp/cmp_vi-6.c: New test. * gcc.target/riscv/rvv/autovec/cmp/cmp_vi-7.c: New test. * gcc.target/riscv/rvv/autovec/cmp/cmp_vi-8.c: New test. * gcc.target/riscv/rvv/autovec/cmp/cmp_vi-9.c: New test. * gcc.target/riscv/rvv/autovec/cmp/macro.h: New test.
Diffstat (limited to 'gcc/tree-vect-loop.cc')
0 files changed, 0 insertions, 0 deletions