diff options
author | Pan Li <pan2.li@intel.com> | 2023-09-05 18:28:03 +0800 |
---|---|---|
committer | Pan Li <pan2.li@intel.com> | 2023-09-05 20:09:21 +0800 |
commit | a7b048c0f42198a0f8d4244f1bd25211cf48383f (patch) | |
tree | 3e44814b3be2d2e5b0d1a792a28d399ea437c63f /gcc/c | |
parent | 72b639760a891c406725854bfb08132c83f0761a (diff) | |
download | gcc-a7b048c0f42198a0f8d4244f1bd25211cf48383f.zip gcc-a7b048c0f42198a0f8d4244f1bd25211cf48383f.tar.gz gcc-a7b048c0f42198a0f8d4244f1bd25211cf48383f.tar.bz2 |
RISC-V: Support FP SGNJ autovec for VLS mode
This patch would like to allow the VLS mode autovec for the
floating-point binary operation MAX/MIN.
Given below code example:
void test(float * restrict out, float * restrict in1, float * restrict in2)
{
for (int i = 0; i < 128; i++)
out[i] = __builtin_copysignf (in1[i], in2[i]);
}
Before this patch:
test:
csrr a4,vlenb
slli a4,a4,1
li a5,128
bleu a5,a4,.L2
mv a5,a4
.L2:
vsetvli zero,a5,e32,m8,ta,ma
vle32.v v8,0(a1)
vle32.v v16,0(a2)
vsetvli a4,zero,e32,m8,ta,ma
vfsgnj.vv v8,v8,v16
vsetvli zero,a5,e32,m8,ta,ma
vse32.v v8,0(a0)
ret
After this patch:
test:
li a5,128
vsetvli zero,a5,e32,m1,ta,ma
vle32.v v1,0(a1)
vle32.v v2,0(a2)
vfsgnj.vv v1,v1,v2
vse32.v v1,0(a0)
ret
Signed-off-by: Pan Li <pan2.li@intel.com>
gcc/ChangeLog:
* config/riscv/autovec-vls.md (copysign<mode>3): New pattern.
* config/riscv/vector.md: Extend iterator for VLS.
gcc/testsuite/ChangeLog:
* gcc.target/riscv/rvv/autovec/vls/def.h: New macro.
* gcc.target/riscv/rvv/autovec/vls/floating-point-sgnj-1.c: New test.
* gcc.target/riscv/rvv/autovec/vls/floating-point-sgnj-2.c: New test.
Diffstat (limited to 'gcc/c')
0 files changed, 0 insertions, 0 deletions