This patch adds the binary_widen_poly shape description. 2023-08-14 Christophe Lyon <christophe.l...@linaro.org>
gcc/ * config/arm/arm-mve-builtins-shapes.cc (binary_widen_poly): New. * config/arm/arm-mve-builtins-shapes.h (binary_widen_poly): New. --- gcc/config/arm/arm-mve-builtins-shapes.cc | 49 +++++++++++++++++++++++ gcc/config/arm/arm-mve-builtins-shapes.h | 1 + 2 files changed, 50 insertions(+) diff --git a/gcc/config/arm/arm-mve-builtins-shapes.cc b/gcc/config/arm/arm-mve-builtins-shapes.cc index 761da4d8ece..23eb9d0e69b 100644 --- a/gcc/config/arm/arm-mve-builtins-shapes.cc +++ b/gcc/config/arm/arm-mve-builtins-shapes.cc @@ -1187,6 +1187,55 @@ struct binary_widen_def : public overloaded_base<0> }; SHAPE (binary_widen) +/* <T0:twice>_t vfoo[_t0](<T0>_t, <T0>_t) + + Example: vmullbq_poly. + uint32x4_t [__arm_]vmullbq_poly[_p16](uint16x8_t a, uint16x8_t b) + uint32x4_t [__arm_]vmullbq_poly_m[_p16](uint32x4_t inactive, uint16x8_t a, uint16x8_t b, mve_pred16_t p) + uint32x4_t [__arm_]vmullbq_poly_x[_p16](uint16x8_t a, uint16x8_t b, mve_pred16_t p) */ +struct binary_widen_poly_def : public overloaded_base<0> +{ + void + build (function_builder &b, const function_group_info &group, + bool preserve_user_namespace) const override + { + b.add_overloaded_functions (group, MODE_none, preserve_user_namespace); + build_all (b, "vU0,vp0,vp0", group, MODE_none, preserve_user_namespace); + } + + tree + resolve (function_resolver &r) const override + { + unsigned int i, nargs; + type_suffix_index type; + if (!r.check_gp_argument (2, i, nargs) + || (type = r.infer_vector_type (i - 1)) == NUM_TYPE_SUFFIXES) + return error_mark_node; + + /* infer_vector_type found the 'unsigned' version of the 'poly' + type we are looking for, so find the 'poly' type with the same + width. */ + type = find_type_suffix (TYPE_poly, type_suffixes[type].element_bits); + + type_suffix_index wide_suffix + = find_type_suffix (TYPE_unsigned, + type_suffixes[type].element_bits * 2); + + /* Require the 'poly' type, require_matching_vector_type would try + and fail with the 'unsigned' one. */ + if (!r.require_vector_type (i, type_suffixes[type].vector_type)) + return error_mark_node; + + /* Check the inactive argument has the wide type. */ + if ((r.pred == PRED_m) + && (r.infer_vector_type (0) != wide_suffix)) + return r.report_no_such_form (type); + + return r.resolve_to (r.mode_suffix_id, type); + } +}; +SHAPE (binary_widen_poly) + /* <T0:twice>_t vfoo[_n_t0](<T0>_t, const int) Check that 'imm' is in the [1..#bits] range. diff --git a/gcc/config/arm/arm-mve-builtins-shapes.h b/gcc/config/arm/arm-mve-builtins-shapes.h index fa6ec4fc002..a93245321c9 100644 --- a/gcc/config/arm/arm-mve-builtins-shapes.h +++ b/gcc/config/arm/arm-mve-builtins-shapes.h @@ -57,6 +57,7 @@ namespace arm_mve extern const function_shape *const binary_widen; extern const function_shape *const binary_widen_n; extern const function_shape *const binary_widen_opt_n; + extern const function_shape *const binary_widen_poly; extern const function_shape *const cmp; extern const function_shape *const create; extern const function_shape *const inherent; -- 2.34.1