https://gcc.gnu.org/g:3216e947d8c964f2a19d19530f16bf0ca6aae807
commit r17-6463-g3216e947d8c964f2a19d19530f16bf0ca6aae807 Author: Karl Meakin <[email protected]> Date: Fri Oct 23 20:09:04 2026 +0000 AArch64: Port NEON widen/narrow intrinsics to pragma-based framework Port the integer to integer conversions, in particular: * Narrowing (vmovn) * Widening (vmovl) * Saturating narrowing (vqmovn and vqmovun) gcc/ChangeLog: * config/aarch64/aarch64-builtin-pairs.def (UNOP_LONG_LH_PAIRS): Delete macro. * config/aarch64/aarch64-builtins.cc (LO_HI_PAIRINGS): Delete `UNOP_LONG_LH_PAIRS` invocation. * config/aarch64/aarch64-neon-builtins-base.cc (build_combine): New function. (struct gimple_combine): Call `build_combine`. (struct gimple_widen, struct gimple_narrow, struct gimple_narrow_saturate): New structs. (build_vec_extract_half): Infer return type from argument type for convenience. (gimple_get_half::gimple): Don't pass return type to `build_vec_extract_half`. * config/aarch64/aarch64-neon-builtins-base.def (vmovn, vmovn_high, vmovl, vmovl_high, vqmovnh, vqmovns, vqmovnd, vqmovn, vqmovn_high, vqmovunh, vqmovuns, vqmovund, vqmovun, vqmovun_high): Declare new functions. * config/aarch64/aarch64-simd-builtins.def (sxtl. uxtl, xtn, sqmovun, sqxtun2, sqmovn, uqmovn, sqxtn2): Delete builtin function declarations. * config/aarch64/aarch64-simd.md (aarch64_xtn2<mode>): Delete now-unused expander. (<sat_trunc_op>trunc<mode><Vnarrowq>2): New expander for integer saturating truncation. (aarch64_sqmovun<mode>): Restrict to GPI modes. (aarch64_sqmovunhi): New insn. (aarch64_sqmovun<mode>): Delete insn. (aarch64_<su>qxtn2<mode>, aarch64_sqxtun2<mode>, aarch64_<su>xtl<mode>, aarch64_xtn<mode>): Delete now-unused expanders. * config/aarch64/arm_neon.h (vmovl_high_s8, vmovl_high_s16, vmovl_high_s32, vmovl_high_u8, vmovl_high_u16, vmovl_high_u32, vmovl_s8, vmovl_s16, vmovl_s32, vmovl_u8, vmovl_u16, vmovl_u32, vmovn_high_s16, vmovn_high_s32, vmovn_high_s64, vmovn_high_u16, vmovn_high_u32, vmovn_high_u64, vmovn_s16, vmovn_s32, vmovn_s64, vmovn_u16, vmovn_u32, vmovn_u64, vqmovn_high_s16, vqmovn_high_s32, vqmovn_high_s64, vqmovn_high_u16, vqmovn_high_u32, vqmovn_high_u64, vqmovun_high_s16, vqmovun_high_s32, vqmovun_high_s64, vqmovn_s16, vqmovn_s32, vqmovn_s64, vqmovn_u16, vqmovn_u32, vqmovn_u64, vqmovnh_s16, vqmovns_s32, vqmovnd_s64, vqmovnh_u16, vqmovns_u32, vqmovnd_u64, vqmovun_s16, vqmovun_s32, vqmovun_s64, vqmovunh_s16, vqmovuns_s32, vqmovund_s64): Delete function definitions. * config/aarch64/iterators.md (Vnarrowq): Add entries for HI/SI/DI. gcc/testsuite/ChangeLog: * gcc.target/aarch64/neon/vmovl.c: New test. * gcc.target/aarch64/neon/vmovn.c: New test. * gcc.target/aarch64/neon/vqmovn.c: New test. * gcc.target/aarch64/neon/vqmovun.c: New test. * gcc.target/aarch64/pr113573.c: Replace call to `__builtin_aarch64_uxtlv8hi_uu` with call to `vmovl_u8`. * gcc.target/aarch64/simd/fold_to_highpart_6.c: Update expected assembly. Diff: --- gcc/config/aarch64/aarch64-builtin-pairs.def | 8 - gcc/config/aarch64/aarch64-builtins.cc | 1 - gcc/config/aarch64/aarch64-neon-builtins-base.cc | 133 ++++++-- gcc/config/aarch64/aarch64-neon-builtins-base.def | 24 ++ gcc/config/aarch64/aarch64-simd-builtins.def | 29 -- gcc/config/aarch64/aarch64-simd.md | 98 ++---- gcc/config/aarch64/arm_neon.h | 361 --------------------- gcc/config/aarch64/iterators.md | 2 + gcc/testsuite/gcc.target/aarch64/neon/vmovl.c | 88 +++++ gcc/testsuite/gcc.target/aarch64/neon/vmovn.c | 88 +++++ gcc/testsuite/gcc.target/aarch64/neon/vqmovn.c | 142 ++++++++ gcc/testsuite/gcc.target/aarch64/neon/vqmovun.c | 73 +++++ gcc/testsuite/gcc.target/aarch64/pr113573.c | 2 +- .../gcc.target/aarch64/simd/fold_to_highpart_6.c | 6 +- 14 files changed, 548 insertions(+), 507 deletions(-) diff --git a/gcc/config/aarch64/aarch64-builtin-pairs.def b/gcc/config/aarch64/aarch64-builtin-pairs.def index f86b2a9acb08..c549e01e99ce 100644 --- a/gcc/config/aarch64/aarch64-builtin-pairs.def +++ b/gcc/config/aarch64/aarch64-builtin-pairs.def @@ -35,14 +35,6 @@ LO_HI_PAIR_V_WI (T, s##LO, s##HI) \ LO_HI_PAIR_V_WI (T##U, u##LO, u##HI) -#define UNOP_LONG_LH_PAIRS \ - LO_HI_PAIR (UNOP_sxtlv8hi, UNOP_vec_unpacks_hi_v16qi) \ - LO_HI_PAIR (UNOP_sxtlv4si, UNOP_vec_unpacks_hi_v8hi) \ - LO_HI_PAIR (UNOP_sxtlv2di, UNOP_vec_unpacks_hi_v4si) \ - LO_HI_PAIR (UNOPU_uxtlv8hi, UNOPU_vec_unpacku_hi_v16qi) \ - LO_HI_PAIR (UNOPU_uxtlv4si, UNOPU_vec_unpacku_hi_v8hi) \ - LO_HI_PAIR (UNOPU_uxtlv2di, UNOPU_vec_unpacku_hi_v4si) - #define BINOP_LONG_LH_PAIRS \ LO_HI_PAIR_V_US_WI (BINOP, addl, addl2) \ LO_HI_PAIR_V_US_WI (BINOP, subl, subl2) \ diff --git a/gcc/config/aarch64/aarch64-builtins.cc b/gcc/config/aarch64/aarch64-builtins.cc index c505a820a374..864e3e981cad 100644 --- a/gcc/config/aarch64/aarch64-builtins.cc +++ b/gcc/config/aarch64/aarch64-builtins.cc @@ -481,7 +481,6 @@ static aarch64_simd_builtin_datum aarch64_simd_builtin_data[] = { #include "aarch64-builtin-pairs.def" #define LO_HI_PAIRINGS \ - UNOP_LONG_LH_PAIRS \ BINOP_LONG_LH_PAIRS \ BINOP_LONG_N_LH_PAIRS \ BINOP_WIDE_LH_PAIRS \ diff --git a/gcc/config/aarch64/aarch64-neon-builtins-base.cc b/gcc/config/aarch64/aarch64-neon-builtins-base.cc index 547d4ce626da..44dfa845f0fe 100644 --- a/gcc/config/aarch64/aarch64-neon-builtins-base.cc +++ b/gcc/config/aarch64/aarch64-neon-builtins-base.cc @@ -118,13 +118,17 @@ build_lane_set (tree vec, tree index, tree elem) return fold_build3 (BIT_INSERT_EXPR, vec_type, vec, elem, offset); } -/* Build an extract of type TYPE (which must be a 64-bit vector type) for half - of the 128-bit vector VEC. HIGH_P selects the upper half. */ +/* Build an extract of half of the 128-bit vector VEC. HIGH_P selects the upper + half. */ tree -build_vec_extract_half (tree type, tree vec, bool high_p) +build_vec_extract_half (tree vec, bool high_p) { - gcc_assert (known_eq (GET_MODE_BITSIZE (TYPE_MODE (type)), 64)); - return fold_build3 (BIT_FIELD_REF, type, vec, bitsize_int (64), + auto vec_type = TREE_TYPE (vec); + gcc_assert (known_eq (GET_MODE_BITSIZE (TYPE_MODE (vec_type)), 128)); + auto ret_type + = build_vector_type (TREE_TYPE (vec_type), + TYPE_VECTOR_SUBPARTS (vec_type).to_constant () / 2); + return fold_build3 (BIT_FIELD_REF, ret_type, vec, bitsize_int (64), bitsize_int (high_p ^ BYTES_BIG_ENDIAN ? 64 : 0)); } @@ -579,27 +583,34 @@ struct gimple_create : public gimple_function_base } }; +/* Concatenate LOW_HALF and HIGH_HALF into a single vector. */ +static tree +build_combine (gimple_folder &f, tree low_half, tree high_half) +{ + auto arg_type = TREE_TYPE (low_half); + auto elem_type = TREE_TYPE (arg_type); + auto ret_type + = build_vector_type (elem_type, TYPE_VECTOR_SUBPARTS (arg_type) * 2); + + if (one_element_vector_type_p (arg_type)) + { + low_half = f.force_val (fold_build1 (VIEW_CONVERT_EXPR, elem_type, low_half)); + high_half = f.force_val (fold_build1 (VIEW_CONVERT_EXPR, elem_type, high_half)); + } + + if (BYTES_BIG_ENDIAN) + std::swap (low_half, high_half); + + return build_constructor_va (ret_type, 2, NULL_TREE, low_half, NULL_TREE, high_half); +} + struct gimple_combine : public gimple_function_base { gimple *fold (gimple_folder &f) const override { auto arg1 = gimple_call_arg (f.call, 0); auto arg2 = gimple_call_arg (f.call, 1); - auto arg_type = TREE_TYPE (arg1); - auto elem_type = TREE_TYPE (arg_type); - - if (known_eq (TYPE_VECTOR_SUBPARTS (arg_type), 1U)) - { - arg1 = f.force_val (fold_build1 (VIEW_CONVERT_EXPR, elem_type, arg1)); - arg2 = f.force_val (fold_build1 (VIEW_CONVERT_EXPR, elem_type, arg2)); - } - - if (BYTES_BIG_ENDIAN) - std::swap (arg1, arg2); - - return gimple_build_assign (f.lhs (), - build_constructor_va (f.ret_type, 2, NULL_TREE, - arg1, NULL_TREE, arg2)); + return gimple_build_assign (f.lhs (), build_combine (f, arg1, arg2)); } }; @@ -619,7 +630,7 @@ struct gimple_get_half : public gimple_function_base gimple *fold (gimple_folder &f) const override { auto src = gimple_call_arg (f.call, 0); - auto half = build_vec_extract_half (f.ret_type, src, high_half_p); + auto half = build_vec_extract_half (src, high_half_p); return gimple_build_assign (f.lhs (), half); } }; @@ -662,6 +673,71 @@ struct gimple_dup : public gimple_function_base } }; +template <bool high_p> +struct gimple_widen : public gimple_function_base +{ + gimple *fold (gimple_folder &f) const override + { + auto arg = gimple_call_arg (f.call, 0); + auto ret_type = TREE_TYPE (f.lhs ()); + + if (high_p) + arg = f.force_val (build_vec_extract_half (arg, true)); + + return gimple_build_assign (f.lhs (), + fold_build1 (CONVERT_EXPR, ret_type, arg)); + } +}; + +template <bool high_p> +struct gimple_narrow: public gimple_function_base +{ + gimple *fold (gimple_folder &f) const override + { + auto src = gimple_call_arg (f.call, 0); + auto arg = gimple_call_arg (f.call, high_p); + + auto ret_type = TREE_TYPE (f.lhs ()); + auto src_type = TREE_TYPE (src); + auto arg_type = TREE_TYPE (arg); + auto trunc_type = high_p ? src_type : ret_type; + + if (TYPE_SIGN (arg_type) != TYPE_SIGN (ret_type)) + arg = f.force_val ( + fold_build2 (MAX_EXPR, arg_type, arg, build_zero_cst (arg_type))); + + auto truncated = f.force_val (fold_build1 (CONVERT_EXPR, trunc_type, arg)); + auto ret = high_p ? build_combine (f, src, truncated) : truncated; + return gimple_build_assign (f.lhs (), ret); + } +}; + +template <bool high_p> +struct gimple_narrow_saturate : public gimple_function_base +{ + gimple *fold (gimple_folder &f) const override + { + auto src = gimple_call_arg (f.call, 0); + auto arg = gimple_call_arg (f.call, high_p); + + auto ret_type = TREE_TYPE (f.lhs ()); + auto src_type = TREE_TYPE (src); + auto arg_type = TREE_TYPE (arg); + auto trunc_type = high_p ? src_type : ret_type; + + if (TYPE_SIGN (arg_type) != TYPE_SIGN (ret_type)) + arg = f.force_val ( + fold_build2 (MAX_EXPR, arg_type, arg, build_zero_cst (arg_type))); + + auto_vec<tree> ifn_args{}; + ifn_args.safe_push (arg); + auto truncated + = f.force_val (build_ifn_call (f, IFN_SAT_TRUNC, trunc_type, ifn_args)); + auto ret = high_p ? build_combine (f, src, truncated) : truncated; + return gimple_build_assign (f.lhs (), ret); + } +}; + struct gimple_dup_lane : public gimple_function_base { gimple *fold (gimple_folder &f) const override @@ -2008,10 +2084,8 @@ public: == TYPE_PRECISION (TREE_TYPE (TREE_TYPE (a))) * 2); if (high_p) { - tree half_type = build_vector_type (TREE_TYPE (TREE_TYPE (a)), - TYPE_VECTOR_SUBPARTS (wide_type)); - a = f.force_val (build_vec_extract_half (half_type, a, true)); - b = f.force_val (build_vec_extract_half (half_type, b, true)); + a = f.force_val (build_vec_extract_half (a, true)); + b = f.force_val (build_vec_extract_half (b, true)); } a = f.force_val (fold_build1 (CONVERT_EXPR, wide_type, a)); b = f.force_val (fold_build1 (CONVERT_EXPR, wide_type, b)); @@ -2082,6 +2156,15 @@ NEON_FUNCTION (vdupq_n, gimple_dup,) NEON_FUNCTION (vmov_n, gimple_dup,) NEON_FUNCTION (vmovq_n, gimple_dup,) +// Widening and narrowing integer conversions +NEON_FUNCTION (vmovl, gimple_widen<false>,) +NEON_FUNCTION (vmovl_high, gimple_widen<true>,) +NEON_FUNCTION (vmovn, gimple_narrow<false>,) +NEON_FUNCTION (vmovn_high, gimple_narrow<true>,) +NEON_FUNCTION (vqmovn, vqmovnh, vqmovns, vqmovnd, + vqmovun, vqmovunh, vqmovuns, vqmovund, gimple_narrow_saturate<false>,) +NEON_FUNCTION (vqmovn_high, vqmovun_high, gimple_narrow_saturate<true>,) + // Lane get/set NEON_FUNCTION (vget_lane, vgetq_lane, gimple_get_lane,) NEON_FUNCTION (vget_low, gimple_get_half<false>,) diff --git a/gcc/config/aarch64/aarch64-neon-builtins-base.def b/gcc/config/aarch64/aarch64-neon-builtins-base.def index 6e5b4d44d125..2be6815219a5 100644 --- a/gcc/config/aarch64/aarch64-neon-builtins-base.def +++ b/gcc/config/aarch64/aarch64-neon-builtins-base.def @@ -59,6 +59,30 @@ DEF_NEON_FUNCTION (vcopyq_lane, neon_copy_lane, ("Q0,Q0,ss32,D0,ss32", lane<1>, lane<3>)) DEF_NEON_FUNCTION (vcopyq_laneq, neon_copy_lane, ("Q0,Q0,ss32,Q0,ss32", lane<1>, lane<3>)) + +// Width-changing integer conversions +#define REQUIRED_EXTENSIONS nonstreaming_only (AARCH64_FL_SIMD) +// Widening +DEF_NEON_FUNCTION (vmovl, bhs_integer, ("Qd0,D0")) +DEF_NEON_FUNCTION (vmovl_high, bhs_integer, ("Qd0,Q0")) + +// Narrowing +DEF_NEON_FUNCTION (vmovn, hsd_integer, ("Dh0,Q0")) +DEF_NEON_FUNCTION (vmovn_high, hsd_integer, ("Qh0,Dh0,Q0")) + +// Narrowing (saturating) +DEF_NEON_FUNCTION (vqmovnh, h_integer, ("sh0,s0")) +DEF_NEON_FUNCTION (vqmovns, s_integer, ("sh0,s0")) +DEF_NEON_FUNCTION (vqmovnd, d_integer, ("sh0,s0")) +DEF_NEON_FUNCTION (vqmovn, hsd_integer, ("Dh0,Q0")) +DEF_NEON_FUNCTION (vqmovn_high, hsd_integer, ("Qh0,Dh0,Q0")) + +// Narrowing (saturating, unsigned) +DEF_NEON_FUNCTION (vqmovunh, h_signed, ("shu0,s0")) +DEF_NEON_FUNCTION (vqmovuns, s_signed, ("shu0,s0")) +DEF_NEON_FUNCTION (vqmovund, d_signed, ("shu0,s0")) +DEF_NEON_FUNCTION (vqmovun, hsd_signed, ("Dhu0,Q0")) +DEF_NEON_FUNCTION (vqmovun_high, hsd_signed, ("Qhu0,Dhu0,Q0")) #undef REQUIRED_EXTENSIONS // Lanewise arithmetic diff --git a/gcc/config/aarch64/aarch64-simd-builtins.def b/gcc/config/aarch64/aarch64-simd-builtins.def index c2a07fe3e2a8..89cf62701d8d 100644 --- a/gcc/config/aarch64/aarch64-simd-builtins.def +++ b/gcc/config/aarch64/aarch64-simd-builtins.def @@ -132,14 +132,6 @@ BUILTIN_VQN (TERNOP, rsubhn2, 0, DEFAULT) BUILTIN_VQN (TERNOPU, rsubhn2, 0, DEFAULT) - /* Implemented by aarch64_<us>xtl<mode>. */ - BUILTIN_VQN (UNOP, sxtl, 0, DEFAULT) - BUILTIN_VQN (UNOPU, uxtl, 0, DEFAULT) - - /* Implemented by aarch64_xtn<mode>. */ - BUILTIN_VQN (UNOP, xtn, 0, DEFAULT) - BUILTIN_VQN (UNOPU, xtn, 0, DEFAULT) - /* Implemented by aarch64_<su>mlsl_n<mode>. */ BUILTIN_VD_HSI (TERNOP, smlsl_n, 0, DEFAULT) BUILTIN_VD_HSI (TERNOPU, umlsl_n, 0, DEFAULT) @@ -164,23 +156,6 @@ BUILTIN_VQ_HSI (TERNOP, smlal_hi_n, 0, DEFAULT) BUILTIN_VQ_HSI (TERNOPU, umlal_hi_n, 0, DEFAULT) - /* Implemented by aarch64_sqmovun<mode>. */ - BUILTIN_VQN (UNOPUS, sqmovun, 0, DEFAULT) - BUILTIN_SD_HSDI (UNOPUS, sqmovun, 0, DEFAULT) - - /* Implemented by aarch64_sqxtun2<mode>. */ - BUILTIN_VQN (BINOP_UUS, sqxtun2, 0, DEFAULT) - - /* Implemented by aarch64_<su>qmovn<mode>. */ - BUILTIN_VQN (UNOP, sqmovn, 0, DEFAULT) - BUILTIN_SD_HSDI (UNOP, sqmovn, 0, DEFAULT) - BUILTIN_VQN (UNOP, uqmovn, 0, DEFAULT) - BUILTIN_SD_HSDI (UNOP, uqmovn, 0, DEFAULT) - - /* Implemented by aarch64_<su>qxtn2<mode>. */ - BUILTIN_VQN (BINOP, sqxtn2, 0, DEFAULT) - BUILTIN_VQN (BINOPU, uqxtn2, 0, DEFAULT) - /* Implemented by aarch64_s<optab><mode>. */ BUILTIN_VSDQ_I (UNOP, sqabs, 0, DEFAULT) BUILTIN_VSDQ_I (UNOP, sqneg, 0, DEFAULT) @@ -298,10 +273,6 @@ BUILTIN_VQ_HSF (QUADOP_LANE_PAIR, fcmlaq_lane180, 0, FP) BUILTIN_VQ_HSF (QUADOP_LANE_PAIR, fcmlaq_lane270, 0, FP) - /* Implemented by aarch64_xtn2<mode>. */ - BUILTIN_VQN (BINOP, xtn2, 0, DEFAULT) - BUILTIN_VQN (BINOPU, xtn2, 0, DEFAULT) - /* Implemented by vec_unpack<su>_hi_<mode>. */ BUILTIN_VQW (UNOP, vec_unpacks_hi_, 10, DEFAULT) BUILTIN_VQW (UNOPU, vec_unpacku_hi_, 10, DEFAULT) diff --git a/gcc/config/aarch64/aarch64-simd.md b/gcc/config/aarch64/aarch64-simd.md index d75cac588333..f65519270876 100644 --- a/gcc/config/aarch64/aarch64-simd.md +++ b/gcc/config/aarch64/aarch64-simd.md @@ -2154,22 +2154,6 @@ [(set_attr "type" "neon_move_narrow_q")] ) -(define_expand "aarch64_xtn2<mode>" - [(match_operand:<VNARROWQ2> 0 "register_operand") - (match_operand:<VNARROWQ> 1 "register_operand") - (truncate:<VNARROWQ> (match_operand:VQN 2 "register_operand"))] - "TARGET_SIMD" - { - if (BYTES_BIG_ENDIAN) - emit_insn (gen_aarch64_xtn2<mode>_insn_be (operands[0], operands[1], - operands[2])); - else - emit_insn (gen_aarch64_xtn2<mode>_insn_le (operands[0], operands[1], - operands[2])); - DONE; - } -) - (define_insn "*aarch64_narrow_trunc<mode>" [(set (match_operand:<VNARROWQ2> 0 "register_operand" "=w") (vec_concat:<VNARROWQ2> @@ -6156,6 +6140,12 @@ "TARGET_SIMD" ) +(define_expand "<sat_trunc_op>trunc<mode><Vnarrowq>2" + [(set (match_operand:<VNARROWQ> 0 "register_operand") + (SAT_TRUNC:<VNARROWQ> (match_operand:SD_HSDI 1 "register_operand")))] + "TARGET_SIMD" +) + ;; sqmovn and uqmovn (define_insn "aarch64_<su>qmovn<mode><vczle><vczbe>" @@ -6198,35 +6188,29 @@ [(set_attr "type" "neon_sat_shift_imm_narrow_q")] ) -(define_expand "aarch64_<su>qxtn2<mode>" - [(match_operand:<VNARROWQ2> 0 "register_operand") - (match_operand:<VNARROWQ> 1 "register_operand") - (SAT_TRUNC:<VNARROWQ> - (match_operand:VQN 2 "register_operand"))] - "TARGET_SIMD" - { - if (BYTES_BIG_ENDIAN) - emit_insn (gen_aarch64_<su>qxtn2<mode>_be (operands[0], operands[1], - operands[2])); - else - emit_insn (gen_aarch64_<su>qxtn2<mode>_le (operands[0], operands[1], - operands[2])); - DONE; - } -) - ;; sqmovun (define_insn "aarch64_sqmovun<mode>" [(set (match_operand:<VNARROWQ> 0 "register_operand" "=w") (us_truncate:<VNARROWQ> - (smax:SD_HSDI - (match_operand:SD_HSDI 1 "register_operand" "w") + (smax:GPI + (match_operand:GPI 1 "register_operand" "w") (const_int 0))))] "TARGET_SIMD" "sqxtun\\t%<vn2>0<Vmntype>, %<v>1<Vmtype>" [(set_attr "type" "neon_sat_shift_imm_narrow_q")] ) +(define_insn "aarch64_sqmovunhi" + [(set (match_operand:QI 0 "register_operand" "=w") + (us_truncate:QI + (subreg:HI + (smax:SI + (sign_extend:SI (match_operand:HI 1 "register_operand" "w")) + (const_int 0)) 0)))] + "TARGET_SIMD" + "sqxtun\t%b0, %h1" + [(set_attr "type" "neon_sat_shift_imm_narrow_q")] +) (define_insn "*aarch64_sqmovun<mode>_insn<vczle><vczbe>" [(set (match_operand:<VNARROWQ> 0 "register_operand" "=w") @@ -6238,17 +6222,6 @@ [(set_attr "type" "neon_sat_shift_imm_narrow_q")] ) -(define_expand "aarch64_sqmovun<mode>" - [(set (match_operand:<VNARROWQ> 0 "register_operand" "=w") - (us_truncate:<VNARROWQ> - (smax:VQN (match_operand:VQN 1 "register_operand" "w") - (match_dup 2))))] - "TARGET_SIMD" - { - operands[2] = CONST0_RTX (<MODE>mode); - } -) - (define_insn "aarch64_sqxtun2<mode>_le" [(set (match_operand:<VNARROWQ2> 0 "register_operand" "=w") (vec_concat:<VNARROWQ2> @@ -6275,23 +6248,6 @@ [(set_attr "type" "neon_sat_shift_imm_narrow_q")] ) -(define_expand "aarch64_sqxtun2<mode>" - [(match_operand:<VNARROWQ2> 0 "register_operand") - (match_operand:<VNARROWQ> 1 "register_operand") - (match_operand:VQN 2 "register_operand")] - "TARGET_SIMD" - { - rtx zeros = CONST0_RTX (<MODE>mode); - if (BYTES_BIG_ENDIAN) - emit_insn (gen_aarch64_sqxtun2<mode>_be (operands[0], operands[1], - operands[2], zeros)); - else - emit_insn (gen_aarch64_sqxtun2<mode>_le (operands[0], operands[1], - operands[2], zeros)); - DONE; - } -) - ;; <su>q<absneg> (define_insn "aarch64_s<optab><mode><vczle><vczbe>" @@ -10276,13 +10232,6 @@ [(set_attr "type" "neon_shift_imm_long")] ) -(define_expand "aarch64_<su>xtl<mode>" - [(set (match_operand:VQN 0 "register_operand" "=w") - (ANY_EXTEND:VQN (match_operand:<VNARROWQ> 1 "register_operand" "w")))] - "TARGET_SIMD" - "" -) - ;; Truncate a 128-bit integer vector to a 64-bit vector. (define_insn "trunc<mode><Vnarrowq>2<vczle><vczbe>" [(set (match_operand:<VNARROWQ> 0 "register_operand" "=w") @@ -10292,15 +10241,6 @@ [(set_attr "type" "neon_move_narrow_q")] ) -;; Expander for the intrinsics that only takes one mode unlike the two-mode -;; trunc optab. -(define_expand "aarch64_xtn<mode>" - [(set (match_operand:<VNARROWQ> 0 "register_operand") - (truncate:<VNARROWQ> (match_operand:VQN 1 "register_operand")))] - "TARGET_SIMD" - {} -) - (define_insn "aarch64_bfdot<mode>" [(set (match_operand:VDQSF 0 "register_operand" "=w") (plus:VDQSF diff --git a/gcc/config/aarch64/arm_neon.h b/gcc/config/aarch64/arm_neon.h index 45c71fa77248..e185f214ace9 100644 --- a/gcc/config/aarch64/arm_neon.h +++ b/gcc/config/aarch64/arm_neon.h @@ -1637,174 +1637,6 @@ vmlsl_n_u32 (uint64x2_t __a, uint32x2_t __b, uint32_t __c) return __builtin_aarch64_umlsl_nv2si_uuuu (__a, __b, __c); } -__extension__ extern __inline int16x8_t -__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) -vmovl_high_s8 (int8x16_t __a) -{ - return __builtin_aarch64_vec_unpacks_hi_v16qi (__a); -} - -__extension__ extern __inline int32x4_t -__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) -vmovl_high_s16 (int16x8_t __a) -{ - return __builtin_aarch64_vec_unpacks_hi_v8hi (__a); -} - -__extension__ extern __inline int64x2_t -__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) -vmovl_high_s32 (int32x4_t __a) -{ - return __builtin_aarch64_vec_unpacks_hi_v4si (__a); -} - -__extension__ extern __inline uint16x8_t -__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) -vmovl_high_u8 (uint8x16_t __a) -{ - return __builtin_aarch64_vec_unpacku_hi_v16qi_uu (__a); -} - -__extension__ extern __inline uint32x4_t -__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) -vmovl_high_u16 (uint16x8_t __a) -{ - return __builtin_aarch64_vec_unpacku_hi_v8hi_uu (__a); -} - -__extension__ extern __inline uint64x2_t -__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) -vmovl_high_u32 (uint32x4_t __a) -{ - return __builtin_aarch64_vec_unpacku_hi_v4si_uu (__a); -} - -__extension__ extern __inline int16x8_t -__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) -vmovl_s8 (int8x8_t __a) -{ - return __builtin_aarch64_sxtlv8hi (__a); -} - -__extension__ extern __inline int32x4_t -__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) -vmovl_s16 (int16x4_t __a) -{ - return __builtin_aarch64_sxtlv4si (__a); -} - -__extension__ extern __inline int64x2_t -__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) -vmovl_s32 (int32x2_t __a) -{ - return __builtin_aarch64_sxtlv2di (__a); -} - -__extension__ extern __inline uint16x8_t -__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) -vmovl_u8 (uint8x8_t __a) -{ - return __builtin_aarch64_uxtlv8hi_uu (__a); -} - -__extension__ extern __inline uint32x4_t -__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) -vmovl_u16 (uint16x4_t __a) -{ - return __builtin_aarch64_uxtlv4si_uu (__a); -} - -__extension__ extern __inline uint64x2_t -__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) -vmovl_u32 (uint32x2_t __a) -{ - return __builtin_aarch64_uxtlv2di_uu (__a); -} - -__extension__ extern __inline int8x16_t -__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) -vmovn_high_s16 (int8x8_t __a, int16x8_t __b) -{ - return __builtin_aarch64_xtn2v8hi (__a, __b); -} - -__extension__ extern __inline int16x8_t -__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) -vmovn_high_s32 (int16x4_t __a, int32x4_t __b) -{ - return __builtin_aarch64_xtn2v4si (__a, __b); -} - -__extension__ extern __inline int32x4_t -__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) -vmovn_high_s64 (int32x2_t __a, int64x2_t __b) -{ - return __builtin_aarch64_xtn2v2di (__a, __b); -} - -__extension__ extern __inline uint8x16_t -__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) -vmovn_high_u16 (uint8x8_t __a, uint16x8_t __b) -{ - return __builtin_aarch64_xtn2v8hi_uuu (__a, __b); -} - -__extension__ extern __inline uint16x8_t -__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) -vmovn_high_u32 (uint16x4_t __a, uint32x4_t __b) -{ - return __builtin_aarch64_xtn2v4si_uuu (__a, __b); -} - -__extension__ extern __inline uint32x4_t -__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) -vmovn_high_u64 (uint32x2_t __a, uint64x2_t __b) -{ - return __builtin_aarch64_xtn2v2di_uuu (__a, __b); -} - -__extension__ extern __inline int8x8_t -__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) -vmovn_s16 (int16x8_t __a) -{ - return __builtin_aarch64_xtnv8hi (__a); -} - -__extension__ extern __inline int16x4_t -__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) -vmovn_s32 (int32x4_t __a) -{ - return __builtin_aarch64_xtnv4si (__a); -} - -__extension__ extern __inline int32x2_t -__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) -vmovn_s64 (int64x2_t __a) -{ - return __builtin_aarch64_xtnv2di (__a); -} - -__extension__ extern __inline uint8x8_t -__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) -vmovn_u16 (uint16x8_t __a) -{ - return __builtin_aarch64_xtnv8hi_uu (__a); -} - -__extension__ extern __inline uint16x4_t -__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) -vmovn_u32 (uint32x4_t __a) -{ - return __builtin_aarch64_xtnv4si_uu (__a); -} - -__extension__ extern __inline uint32x2_t -__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) -vmovn_u64 (uint64x2_t __a) -{ - return __builtin_aarch64_xtnv2di_uu (__a); -} - __extension__ extern __inline int32x4_t __attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) vmull_high_lane_s16 (int16x8_t __a, int16x4_t __v, const int __lane) @@ -2239,69 +2071,6 @@ vqdmulhq_n_s32 (int32x4_t __a, int32_t __b) return __builtin_aarch64_sqdmulh_nv4si (__a, __b); } -__extension__ extern __inline int8x16_t -__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) -vqmovn_high_s16 (int8x8_t __a, int16x8_t __b) -{ - return __builtin_aarch64_sqxtn2v8hi (__a, __b); -} - -__extension__ extern __inline int16x8_t -__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) -vqmovn_high_s32 (int16x4_t __a, int32x4_t __b) -{ - return __builtin_aarch64_sqxtn2v4si (__a, __b); -} - -__extension__ extern __inline int32x4_t -__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) -vqmovn_high_s64 (int32x2_t __a, int64x2_t __b) -{ - return __builtin_aarch64_sqxtn2v2di (__a, __b); -} - -__extension__ extern __inline uint8x16_t -__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) -vqmovn_high_u16 (uint8x8_t __a, uint16x8_t __b) -{ - return __builtin_aarch64_uqxtn2v8hi_uuu (__a, __b); -} - -__extension__ extern __inline uint16x8_t -__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) -vqmovn_high_u32 (uint16x4_t __a, uint32x4_t __b) -{ - return __builtin_aarch64_uqxtn2v4si_uuu (__a, __b); -} - -__extension__ extern __inline uint32x4_t -__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) -vqmovn_high_u64 (uint32x2_t __a, uint64x2_t __b) -{ - return __builtin_aarch64_uqxtn2v2di_uuu (__a, __b); -} - -__extension__ extern __inline uint8x16_t -__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) -vqmovun_high_s16 (uint8x8_t __a, int16x8_t __b) -{ - return __builtin_aarch64_sqxtun2v8hi_uus (__a, __b); -} - -__extension__ extern __inline uint16x8_t -__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) -vqmovun_high_s32 (uint16x4_t __a, int32x4_t __b) -{ - return __builtin_aarch64_sqxtun2v4si_uus (__a, __b); -} - -__extension__ extern __inline uint32x4_t -__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) -vqmovun_high_s64 (uint32x2_t __a, int64x2_t __b) -{ - return __builtin_aarch64_sqxtun2v2di_uus (__a, __b); -} - __extension__ extern __inline int16x4_t __attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) vqrdmulh_n_s16 (int16x4_t __a, int16_t __b) @@ -4720,136 +4489,6 @@ vqdmulls_laneq_s32 (int32_t __a, int32x4_t __b, const int __c) return __builtin_aarch64_sqdmull_laneqsi (__a, __b, __c); } -/* vqmovn */ - -__extension__ extern __inline int8x8_t -__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) -vqmovn_s16 (int16x8_t __a) -{ - return (int8x8_t) __builtin_aarch64_sqmovnv8hi (__a); -} - -__extension__ extern __inline int16x4_t -__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) -vqmovn_s32 (int32x4_t __a) -{ - return (int16x4_t) __builtin_aarch64_sqmovnv4si (__a); -} - -__extension__ extern __inline int32x2_t -__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) -vqmovn_s64 (int64x2_t __a) -{ - return (int32x2_t) __builtin_aarch64_sqmovnv2di (__a); -} - -__extension__ extern __inline uint8x8_t -__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) -vqmovn_u16 (uint16x8_t __a) -{ - return (uint8x8_t) __builtin_aarch64_uqmovnv8hi ((int16x8_t) __a); -} - -__extension__ extern __inline uint16x4_t -__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) -vqmovn_u32 (uint32x4_t __a) -{ - return (uint16x4_t) __builtin_aarch64_uqmovnv4si ((int32x4_t) __a); -} - -__extension__ extern __inline uint32x2_t -__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) -vqmovn_u64 (uint64x2_t __a) -{ - return (uint32x2_t) __builtin_aarch64_uqmovnv2di ((int64x2_t) __a); -} - -__extension__ extern __inline int8_t -__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) -vqmovnh_s16 (int16_t __a) -{ - return (int8_t) __builtin_aarch64_sqmovnhi (__a); -} - -__extension__ extern __inline int16_t -__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) -vqmovns_s32 (int32_t __a) -{ - return (int16_t) __builtin_aarch64_sqmovnsi (__a); -} - -__extension__ extern __inline int32_t -__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) -vqmovnd_s64 (int64_t __a) -{ - return (int32_t) __builtin_aarch64_sqmovndi (__a); -} - -__extension__ extern __inline uint8_t -__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) -vqmovnh_u16 (uint16_t __a) -{ - return (uint8_t) __builtin_aarch64_uqmovnhi (__a); -} - -__extension__ extern __inline uint16_t -__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) -vqmovns_u32 (uint32_t __a) -{ - return (uint16_t) __builtin_aarch64_uqmovnsi (__a); -} - -__extension__ extern __inline uint32_t -__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) -vqmovnd_u64 (uint64_t __a) -{ - return (uint32_t) __builtin_aarch64_uqmovndi (__a); -} - -/* vqmovun */ - -__extension__ extern __inline uint8x8_t -__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) -vqmovun_s16 (int16x8_t __a) -{ - return __builtin_aarch64_sqmovunv8hi_us (__a); -} - -__extension__ extern __inline uint16x4_t -__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) -vqmovun_s32 (int32x4_t __a) -{ - return __builtin_aarch64_sqmovunv4si_us (__a); -} - -__extension__ extern __inline uint32x2_t -__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) -vqmovun_s64 (int64x2_t __a) -{ - return __builtin_aarch64_sqmovunv2di_us (__a); -} - -__extension__ extern __inline uint8_t -__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) -vqmovunh_s16 (int16_t __a) -{ - return __builtin_aarch64_sqmovunhi_us (__a); -} - -__extension__ extern __inline uint16_t -__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) -vqmovuns_s32 (int32_t __a) -{ - return __builtin_aarch64_sqmovunsi_us (__a); -} - -__extension__ extern __inline uint32_t -__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) -vqmovund_s64 (int64_t __a) -{ - return __builtin_aarch64_sqmovundi_us (__a); -} - /* vqneg */ __extension__ extern __inline int64x2_t diff --git a/gcc/config/aarch64/iterators.md b/gcc/config/aarch64/iterators.md index 69687125a92a..37b5df50a339 100644 --- a/gcc/config/aarch64/iterators.md +++ b/gcc/config/aarch64/iterators.md @@ -2264,6 +2264,8 @@ (VNx2SI "VNx2HI") (VNx2DI "VNx2SI")]) (define_mode_attr Vnarrowq [(V8HI "v8qi") (V4SI "v4hi") (V2DI "v2si") + (DI "si") (SI "hi") + (HI "qi") (VNx8HI "vnx8qi") (VNx4HI "vnx4qi") (VNx2HI "vnx2qi") (VNx4SI "vnx4hi") (VNx2SI "vnx2hi") (VNx2DI "vnx2si")]) diff --git a/gcc/testsuite/gcc.target/aarch64/neon/vmovl.c b/gcc/testsuite/gcc.target/aarch64/neon/vmovl.c new file mode 100644 index 000000000000..8f54a8fa4882 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/neon/vmovl.c @@ -0,0 +1,88 @@ +/* { dg-do compile } */ +/* { dg-final { check-function-bodies "**" "" } } */ + +#include "arm_neon_test.h" + +/* +** test_vmovl_s8: +** sxtl v0\.8h, v0\.8b +** ret +*/ +TEST_UNARY (vmovl_s8, int16x8_t, int8x8_t) + +/* +** test_vmovl_s16: +** sxtl v0\.4s, v0\.4h +** ret +*/ +TEST_UNARY (vmovl_s16, int32x4_t, int16x4_t) + +/* +** test_vmovl_s32: +** sxtl v0\.2d, v0\.2s +** ret +*/ +TEST_UNARY (vmovl_s32, int64x2_t, int32x2_t) + +/* +** test_vmovl_u8: +** uxtl v0\.8h, v0\.8b +** ret +*/ +TEST_UNARY (vmovl_u8, uint16x8_t, uint8x8_t) + +/* +** test_vmovl_u16: +** uxtl v0\.4s, v0\.4h +** ret +*/ +TEST_UNARY (vmovl_u16, uint32x4_t, uint16x4_t) + +/* +** test_vmovl_u32: +** uxtl v0\.2d, v0\.2s +** ret +*/ +TEST_UNARY (vmovl_u32, uint64x2_t, uint32x2_t) + +/* +** test_vmovl_high_s8: +** sxtl2 v0\.8h, v0\.16b +** ret +*/ +TEST_UNARY (vmovl_high_s8, int16x8_t, int8x16_t) + +/* +** test_vmovl_high_s16: +** sxtl2 v0\.4s, v0\.8h +** ret +*/ +TEST_UNARY (vmovl_high_s16, int32x4_t, int16x8_t) + +/* +** test_vmovl_high_s32: +** sxtl2 v0\.2d, v0\.4s +** ret +*/ +TEST_UNARY (vmovl_high_s32, int64x2_t, int32x4_t) + +/* +** test_vmovl_high_u8: +** uxtl2 v0\.8h, v0\.16b +** ret +*/ +TEST_UNARY (vmovl_high_u8, uint16x8_t, uint8x16_t) + +/* +** test_vmovl_high_u16: +** uxtl2 v0\.4s, v0\.8h +** ret +*/ +TEST_UNARY (vmovl_high_u16, uint32x4_t, uint16x8_t) + +/* +** test_vmovl_high_u32: +** uxtl2 v0\.2d, v0\.4s +** ret +*/ +TEST_UNARY (vmovl_high_u32, uint64x2_t, uint32x4_t) diff --git a/gcc/testsuite/gcc.target/aarch64/neon/vmovn.c b/gcc/testsuite/gcc.target/aarch64/neon/vmovn.c new file mode 100644 index 000000000000..d955e81a4423 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/neon/vmovn.c @@ -0,0 +1,88 @@ +/* { dg-do compile } */ +/* { dg-final { check-function-bodies "**" "" } } */ + +#include "arm_neon_test.h" + +/* +** test_vmovn_s16: +** xtn v0\.8b, v0\.8h +** ret +*/ +TEST_UNARY (vmovn_s16, int8x8_t, int16x8_t) + +/* +** test_vmovn_s32: +** xtn v0\.4h, v0\.4s +** ret +*/ +TEST_UNARY (vmovn_s32, int16x4_t, int32x4_t) + +/* +** test_vmovn_s64: +** xtn v0\.2s, v0\.2d +** ret +*/ +TEST_UNARY (vmovn_s64, int32x2_t, int64x2_t) + +/* +** test_vmovn_u16: +** xtn v0\.8b, v0\.8h +** ret +*/ +TEST_UNARY (vmovn_u16, uint8x8_t, uint16x8_t) + +/* +** test_vmovn_u32: +** xtn v0\.4h, v0\.4s +** ret +*/ +TEST_UNARY (vmovn_u32, uint16x4_t, uint32x4_t) + +/* +** test_vmovn_u64: +** xtn v0\.2s, v0\.2d +** ret +*/ +TEST_UNARY (vmovn_u64, uint32x2_t, uint64x2_t) + +/* +** test_vmovn_high_s16: +** xtn2 v0\.16b, v1\.8h +** ret +*/ +TEST_BINARY (vmovn_high_s16, int8x16_t, int8x8_t, int16x8_t) + +/* +** test_vmovn_high_s32: +** xtn2 v0\.8h, v1\.4s +** ret +*/ +TEST_BINARY (vmovn_high_s32, int16x8_t, int16x4_t, int32x4_t) + +/* +** test_vmovn_high_s64: +** xtn2 v0\.4s, v1\.2d +** ret +*/ +TEST_BINARY (vmovn_high_s64, int32x4_t, int32x2_t, int64x2_t) + +/* +** test_vmovn_high_u16: +** xtn2 v0\.16b, v1\.8h +** ret +*/ +TEST_BINARY (vmovn_high_u16, uint8x16_t, uint8x8_t, uint16x8_t) + +/* +** test_vmovn_high_u32: +** xtn2 v0\.8h, v1\.4s +** ret +*/ +TEST_BINARY (vmovn_high_u32, uint16x8_t, uint16x4_t, uint32x4_t) + +/* +** test_vmovn_high_u64: +** xtn2 v0\.4s, v1\.2d +** ret +*/ +TEST_BINARY (vmovn_high_u64, uint32x4_t, uint32x2_t, uint64x2_t) diff --git a/gcc/testsuite/gcc.target/aarch64/neon/vqmovn.c b/gcc/testsuite/gcc.target/aarch64/neon/vqmovn.c new file mode 100644 index 000000000000..9f6f7abc7997 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/neon/vqmovn.c @@ -0,0 +1,142 @@ +/* { dg-do compile } */ +/* { dg-final { check-function-bodies "**" "" } } */ + +#include "arm_neon_test.h" + +/* +** test_vqmovn_s16: +** sqxtn v0\.8b, v0\.8h +** ret +*/ +TEST_UNARY (vqmovn_s16, int8x8_t, int16x8_t) + +/* +** test_vqmovn_s32: +** sqxtn v0\.4h, v0\.4s +** ret +*/ +TEST_UNARY (vqmovn_s32, int16x4_t, int32x4_t) + +/* +** test_vqmovn_s64: +** sqxtn v0\.2s, v0\.2d +** ret +*/ +TEST_UNARY (vqmovn_s64, int32x2_t, int64x2_t) + +/* +** test_vqmovn_u16: +** uqxtn v0\.8b, v0\.8h +** ret +*/ +TEST_UNARY (vqmovn_u16, uint8x8_t, uint16x8_t) + +/* +** test_vqmovn_u32: +** uqxtn v0\.4h, v0\.4s +** ret +*/ +TEST_UNARY (vqmovn_u32, uint16x4_t, uint32x4_t) + +/* +** test_vqmovn_u64: +** uqxtn v0\.2s, v0\.2d +** ret +*/ +TEST_UNARY (vqmovn_u64, uint32x2_t, uint64x2_t) + +/* +** test_vqmovnh_s16: +** dup v31\.4h, w0 +** sqxtn b31, h31 +** umov w0, v31\.b\[0\] +** ret +*/ +TEST_UNARY (vqmovnh_s16, int8_t, int16_t) + +/* +** test_vqmovns_s32: +** fmov s31, w0 +** sqxtn h31, s31 +** umov w0, v31\.h\[0\] +** ret +*/ +TEST_UNARY (vqmovns_s32, int16_t, int32_t) + +/* +** test_vqmovnd_s64: +** fmov d31, x0 +** sqxtn s31, d31 +** fmov w0, s31 +** ret +*/ +TEST_UNARY (vqmovnd_s64, int32_t, int64_t) + +/* +** test_vqmovnh_u16: +** dup v31\.4h, w0 +** uqxtn b31, h31 +** umov w0, v31\.b\[0\] +** ret +*/ +TEST_UNARY (vqmovnh_u16, uint8_t, uint16_t) + +/* +** test_vqmovns_u32: +** fmov s31, w0 +** uqxtn h31, s31 +** umov w0, v31\.h\[0\] +** ret +*/ +TEST_UNARY (vqmovns_u32, uint16_t, uint32_t) + +/* +** test_vqmovnd_u64: +** fmov d31, x0 +** uqxtn s31, d31 +** fmov w0, s31 +** ret +*/ +TEST_UNARY (vqmovnd_u64, uint32_t, uint64_t) + +/* +** test_vqmovn_high_s16: +** sqxtn2 v0\.16b, v1\.8h +** ret +*/ +TEST_BINARY (vqmovn_high_s16, int8x16_t, int8x8_t, int16x8_t) + +/* +** test_vqmovn_high_s32: +** sqxtn2 v0\.8h, v1\.4s +** ret +*/ +TEST_BINARY (vqmovn_high_s32, int16x8_t, int16x4_t, int32x4_t) + +/* +** test_vqmovn_high_s64: +** sqxtn2 v0\.4s, v1\.2d +** ret +*/ +TEST_BINARY (vqmovn_high_s64, int32x4_t, int32x2_t, int64x2_t) + +/* +** test_vqmovn_high_u16: +** uqxtn2 v0\.16b, v1\.8h +** ret +*/ +TEST_BINARY (vqmovn_high_u16, uint8x16_t, uint8x8_t, uint16x8_t) + +/* +** test_vqmovn_high_u32: +** uqxtn2 v0\.8h, v1\.4s +** ret +*/ +TEST_BINARY (vqmovn_high_u32, uint16x8_t, uint16x4_t, uint32x4_t) + +/* +** test_vqmovn_high_u64: +** uqxtn2 v0\.4s, v1\.2d +** ret +*/ +TEST_BINARY (vqmovn_high_u64, uint32x4_t, uint32x2_t, uint64x2_t) diff --git a/gcc/testsuite/gcc.target/aarch64/neon/vqmovun.c b/gcc/testsuite/gcc.target/aarch64/neon/vqmovun.c new file mode 100644 index 000000000000..89d9b378fe5f --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/neon/vqmovun.c @@ -0,0 +1,73 @@ +/* { dg-do compile } */ +/* { dg-final { check-function-bodies "**" "" } } */ + +#include "arm_neon_test.h" + +/* +** test_vqmovun_s16: +** sqxtun v0\.8b, v0\.8h +** ret +*/ +TEST_UNARY (vqmovun_s16, uint8x8_t, int16x8_t) + +/* +** test_vqmovun_s32: +** sqxtun v0\.4h, v0\.4s +** ret +*/ +TEST_UNARY (vqmovun_s32, uint16x4_t, int32x4_t) + +/* +** test_vqmovun_s64: +** sqxtun v0\.2s, v0\.2d +** ret +*/ +TEST_UNARY (vqmovun_s64, uint32x2_t, int64x2_t) + +/* +** test_vqmovunh_s16: +** dup v31\.4h, w0 +** sqxtun b31, h31 +** umov w0, v31\.b\[0\] +** ret +*/ +TEST_UNARY (vqmovunh_s16, uint8_t, int16_t) + +/* +** test_vqmovuns_s32: +** fmov s31, w0 +** sqxtun h31, s31 +** umov w0, v31\.h\[0\] +** ret +*/ +TEST_UNARY (vqmovuns_s32, uint16_t, int32_t) + +/* +** test_vqmovund_s64: +** fmov d31, x0 +** sqxtun s31, d31 +** fmov w0, s31 +** ret +*/ +TEST_UNARY (vqmovund_s64, uint32_t, int64_t) + +/* +** test_vqmovun_high_s16: +** sqxtun2 v0\.16b, v1\.8h +** ret +*/ +TEST_BINARY (vqmovun_high_s16, uint8x16_t, uint8x8_t, int16x8_t) + +/* +** test_vqmovun_high_s32: +** sqxtun2 v0\.8h, v1\.4s +** ret +*/ +TEST_BINARY (vqmovun_high_s32, uint16x8_t, uint16x4_t, int32x4_t) + +/* +** test_vqmovun_high_s64: +** sqxtun2 v0\.4s, v1\.2d +** ret +*/ +TEST_BINARY (vqmovun_high_s64, uint32x4_t, uint32x2_t, int64x2_t) diff --git a/gcc/testsuite/gcc.target/aarch64/pr113573.c b/gcc/testsuite/gcc.target/aarch64/pr113573.c index 068b10844753..6d335512a8ee 100644 --- a/gcc/testsuite/gcc.target/aarch64/pr113573.c +++ b/gcc/testsuite/gcc.target/aarch64/pr113573.c @@ -15,7 +15,7 @@ uint16x8_t foo1 (...); uint16x8_t foo2 (uint8x8_t __a) { - return __builtin_aarch64_uxtlv8hi_uu (__a); + return vmovl_u8 (__a); } __inline int __attribute__ ((__gnu_inline__)) foo3 (...); diff --git a/gcc/testsuite/gcc.target/aarch64/simd/fold_to_highpart_6.c b/gcc/testsuite/gcc.target/aarch64/simd/fold_to_highpart_6.c index b6030fc58256..85909ab4d3fa 100644 --- a/gcc/testsuite/gcc.target/aarch64/simd/fold_to_highpart_6.c +++ b/gcc/testsuite/gcc.target/aarch64/simd/fold_to_highpart_6.c @@ -13,9 +13,9 @@ int8x16_t z; /* ** test_addressable: -** adrp x([0-9]+), \.LANCHOR0 -** ldr q([0-9]+), \[x\1, #?:lo12:\.LANCHOR0\] -** sxtl2 v0\.8h, v\2\.16b +** adrp x([0-9]+), \.LANCHOR0\+8 +** ldr d([0-9]+), \[x\1, #?:lo12:\.LANCHOR0\+8\] +** sxtl v0\.8h, v\2\.8b ** ret */ int16x8_t
