diff options
author | Pan Li <pan2.li@intel.com> | 2023-09-22 19:08:52 +0800 |
---|---|---|
committer | Pan Li <pan2.li@intel.com> | 2023-09-22 20:28:44 +0800 |
commit | 4c496020764057453415f1ae599950724ec0e871 (patch) | |
tree | d705aa93ecde13d593fe5f416373eede06f5940f /gcc/gcc.cc | |
parent | 190ba48952b1ec4b73bb31ed150b73b055408af1 (diff) | |
download | gcc-4c496020764057453415f1ae599950724ec0e871.zip gcc-4c496020764057453415f1ae599950724ec0e871.tar.gz gcc-4c496020764057453415f1ae599950724ec0e871.tar.bz2 |
RISC-V: Refine the code gen for ceil auto vectorization.
We vectorized below ceil code already.
void
test_ceil (float *out, float *in, int count)
{
for (unsigned i = 0; i < count; i++)
out[i] = __builtin_ceilf (in[i]);
}
Before this patch:
vfmv.v.x v4,fa0 // can be removed
vfabs.v v0,v1
vmv1r.v v2,v1 // can be removed
vmflt.vv v0,v0,v4 // can be refined to vmflt.vf
vfcvt.x.f.v v3,v1,v0.t
vfcvt.f.x.v v2,v3,v0.t
vfsgnj.vv v2,v2,v1
After this patch:
vfabs.v v1,v2
vmflt.vf v0,v1,fa5
vfcvt.x.f.v v3,v2,v0.t
vfcvt.f.x.v v1,v3,v0.t
vfsgnj.vv v1,v1,v2
We can generate better code include below items.
* Remove vfmv.v.f.
* Take vmflt.vf instead of vmflt.vv.
* Remove vmv1r.v.
gcc/ChangeLog:
* config/riscv/riscv-v.cc (expand_vec_float_cmp_mask): Refactor.
(emit_vec_float_cmp_mask): Rename.
(expand_vec_copysign): Ditto.
(emit_vec_copysign): Ditto.
(emit_vec_abs): New function impl.
(emit_vec_cvt_x_f): Ditto.
(emit_vec_cvt_f_x): Ditto.
(expand_vec_ceil): Ditto.
gcc/testsuite/ChangeLog:
* gcc.target/riscv/rvv/autovec/unop/math-ceil-0.c: Adjust body check.
* gcc.target/riscv/rvv/autovec/unop/math-ceil-1.c: Ditto.
* gcc.target/riscv/rvv/autovec/unop/math-ceil-2.c: Ditto.
* gcc.target/riscv/rvv/autovec/unop/math-ceil-3.c: Ditto.
Signed-off-by: Pan Li <pan2.li@intel.com>
Diffstat (limited to 'gcc/gcc.cc')
0 files changed, 0 insertions, 0 deletions