diff options
author | Pan Li <pan2.li@intel.com> | 2023-10-12 16:54:36 +0800 |
---|---|---|
committer | Pan Li <pan2.li@intel.com> | 2023-10-12 19:08:11 +0800 |
commit | 2cc4f58a7c12c9b7a82194279c201ebe389f6dba (patch) | |
tree | e2fbfdc1dd23f51aacb69e866c12b71f85d243b2 /libgcc/config/avr | |
parent | dfb40855a0819bc6b592bd07bd966332e911f325 (diff) | |
download | gcc-2cc4f58a7c12c9b7a82194279c201ebe389f6dba.zip gcc-2cc4f58a7c12c9b7a82194279c201ebe389f6dba.tar.gz gcc-2cc4f58a7c12c9b7a82194279c201ebe389f6dba.tar.bz2 |
RISC-V: Support FP lround/lroundf auto vectorization
This patch would like to support the FP lround/lroundf auto vectorization.
* long lround (double) for rv64
* long lroundf (float) for rv32
Due to the limitation that only the same size of data type are allowed
in the vectorier, the standard name lroundmn2 only act on DF => DI for
rv64, and SF => SI for rv32.
Given we have code like:
void
test_lround (long *out, double *in, unsigned count)
{
for (unsigned i = 0; i < count; i++)
out[i] = __builtin_lround (in[i]);
}
Before this patch:
.L3:
...
fld fa5,0(a1)
fcvt.l.d a5,fa5,rmm
sd a5,-8(a0)
...
bne a1,a4,.L3
After this patch:
frrm a6
...
fsrmi 4 // RMM
.L3:
...
vsetvli a3,zero,e64,m1,ta,ma
vfcvt.x.f.v v1,v1
vsetvli zero,a2,e64,m1,ta,ma
vse32.v v1,0(a0)
...
bne a2,zero,.L3
...
fsrm a6
The rest part like SF => DI/HF => DI/DF => SI/HF => SI will be covered
by TARGET_VECTORIZE_BUILTIN_VECTORIZED_FUNCTION.
gcc/ChangeLog:
* config/riscv/autovec.md (lround<mode><v_i_l_ll_convert>2): New
pattern for lround/lroundf.
* config/riscv/riscv-protos.h (enum insn_type): New enum value.
(expand_vec_lround): New func decl for expanding lround.
* config/riscv/riscv-v.cc (expand_vec_lround): New func impl
for expanding lround.
gcc/testsuite/ChangeLog:
* gcc.target/riscv/rvv/autovec/unop/math-lround-0.c: New test.
* gcc.target/riscv/rvv/autovec/unop/math-lround-1.c: New test.
* gcc.target/riscv/rvv/autovec/unop/math-lround-run-0.c: New test.
* gcc.target/riscv/rvv/autovec/unop/math-lround-run-1.c: New test.
* gcc.target/riscv/rvv/autovec/vls/math-lround-0.c: New test.
* gcc.target/riscv/rvv/autovec/vls/math-lround-1.c: New test.
Signed-off-by: Pan Li <pan2.li@intel.com>
Diffstat (limited to 'libgcc/config/avr')
0 files changed, 0 insertions, 0 deletions