This patch improves vectorization of certain floating point widening operations for the aarch64 target by adding vector floating point extend patterns for V2SF->V2DF and V4HF->V4SF conversions.
PR target/113880 PR target/113869 gcc/ChangeLog: * config/aarch64/aarch64-simd.md (extend<mode><Vwide>2): New expand. gcc/testsuite/ChangeLog: * gcc.target/aarch64/extend-vec.c: New test. Signed-off-by: Pengxuan Zheng <quic_pzh...@quicinc.com> --- gcc/config/aarch64/aarch64-simd.md | 7 +++++++ gcc/testsuite/gcc.target/aarch64/extend-vec.c | 21 +++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 gcc/testsuite/gcc.target/aarch64/extend-vec.c diff --git a/gcc/config/aarch64/aarch64-simd.md b/gcc/config/aarch64/aarch64-simd.md index 868f4486218..8febb411d06 100644 --- a/gcc/config/aarch64/aarch64-simd.md +++ b/gcc/config/aarch64/aarch64-simd.md @@ -3141,6 +3141,13 @@ (define_insn "aarch64_float_extend_lo_<Vwide>" [(set_attr "type" "neon_fp_cvt_widen_s")] ) +(define_expand "extend<mode><Vwide>2" + [(set (match_operand:<VWIDE> 0 "register_operand" "=w") + (float_extend:<VWIDE> + (match_operand:VDF 1 "register_operand" "w")))] + "TARGET_SIMD" +) + ;; Float narrowing operations. (define_insn "aarch64_float_trunc_rodd_df" diff --git a/gcc/testsuite/gcc.target/aarch64/extend-vec.c b/gcc/testsuite/gcc.target/aarch64/extend-vec.c new file mode 100644 index 00000000000..f62418888d5 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/extend-vec.c @@ -0,0 +1,21 @@ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ + +/* { dg-final { scan-assembler-times {fcvtl\tv[0-9]+.2d, v[0-9]+.2s} 1 } } */ +void +f (float *__restrict a, double *__restrict b) +{ + b[0] = a[0]; + b[1] = a[1]; +} + +/* { dg-final { scan-assembler-times {fcvtl\tv[0-9]+.4s, v[0-9]+.4h} 1 } } */ +void +f1 (_Float16 *__restrict a, float *__restrict b) +{ + + b[0] = a[0]; + b[1] = a[1]; + b[2] = a[2]; + b[3] = a[3]; +} -- 2.17.1