aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-inline.h
diff options
context:
space:
mode:
authorPan Li <pan2.li@intel.com>2023-09-02 16:42:27 +0800
committerPan Li <pan2.li@intel.com>2023-09-03 08:17:51 +0800
commita7d052b3200c7928d903a0242b8cfd75d131e374 (patch)
tree1cfa14352a9c1b1cc3e685b652f48c38e2634dee /gcc/tree-inline.h
parent9f48aba019f2fa3c9a6a076d4f460839ad39839a (diff)
downloadgcc-a7d052b3200c7928d903a0242b8cfd75d131e374.zip
gcc-a7d052b3200c7928d903a0242b8cfd75d131e374.tar.gz
gcc-a7d052b3200c7928d903a0242b8cfd75d131e374.tar.bz2
RISC-V: Support FP MAX/MIN 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: test (float *out, float *in1, float *in2) { for (int i = 0; i < 128; i++) out[i] = in1[i] > in2[i] ? in1[i] : in2[i]; // Or out[i] = fmax (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 v16,0(a1) vle32.v v8,0(a2) vsetvli a3,zero,e32,m8,ta,ma vmfgt.vv v0,v16,v8 vmerge.vvm v8,v8,v16,v0 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) vfmax.vv v1,v1,v2 vse32.v v1,0(a0) ret This MAX/MIN autovec acts on function call like fmaxf/fmax in math.h too. And it depends on the option -ffast-math. Signed-off-by: Pan Li <pan2.li@intel.com> gcc/ChangeLog: * config/riscv/autovec-vls.md (<optab><mode>3): New pattern for fmax/fmin * config/riscv/vector.md: Add VLS modes to vfmax/vfmin. gcc/testsuite/ChangeLog: * gcc.target/riscv/rvv/autovec/vls/def.h: New macros. * gcc.target/riscv/rvv/autovec/vls/floating-point-max-1.c: New test. * gcc.target/riscv/rvv/autovec/vls/floating-point-max-2.c: New test. * gcc.target/riscv/rvv/autovec/vls/floating-point-max-3.c: New test. * gcc.target/riscv/rvv/autovec/vls/floating-point-max-4.c: New test. * gcc.target/riscv/rvv/autovec/vls/floating-point-max-5.c: New test. * gcc.target/riscv/rvv/autovec/vls/floating-point-min-1.c: New test. * gcc.target/riscv/rvv/autovec/vls/floating-point-min-2.c: New test. * gcc.target/riscv/rvv/autovec/vls/floating-point-min-3.c: New test. * gcc.target/riscv/rvv/autovec/vls/floating-point-min-4.c: New test. * gcc.target/riscv/rvv/autovec/vls/floating-point-min-5.c: New test.
Diffstat (limited to 'gcc/tree-inline.h')
0 files changed, 0 insertions, 0 deletions