diff options
author | Christophe Lyon <christophe.lyon@arm.com> | 2023-02-27 14:13:26 +0000 |
---|---|---|
committer | Christophe Lyon <christophe.lyon@arm.com> | 2023-05-12 12:40:37 +0200 |
commit | 992b3be29a04d1b982037734214c63f44e9352c1 (patch) | |
tree | ec3927f483d864064e18860992172f580b1a2d57 | |
parent | e77a5adee2d1f44622c9f51d22cd9696fad1db7e (diff) | |
download | gcc-992b3be29a04d1b982037734214c63f44e9352c1.zip gcc-992b3be29a04d1b982037734214c63f44e9352c1.tar.gz gcc-992b3be29a04d1b982037734214c63f44e9352c1.tar.bz2 |
arm: [MVE intrinsics] add binary_lshift_unsigned shape
This patch adds the binary_lshift_unsigned shape description.
2022-12-12 Christophe Lyon <christophe.lyon@arm.com>
gcc/
* config/arm/arm-mve-builtins-shapes.cc
(binary_lshift_unsigned): New.
* config/arm/arm-mve-builtins-shapes.h
(binary_lshift_unsigned): New.
-rw-r--r-- | gcc/config/arm/arm-mve-builtins-shapes.cc | 58 | ||||
-rw-r--r-- | gcc/config/arm/arm-mve-builtins-shapes.h | 1 |
2 files changed, 59 insertions, 0 deletions
diff --git a/gcc/config/arm/arm-mve-builtins-shapes.cc b/gcc/config/arm/arm-mve-builtins-shapes.cc index 47a0395..44e41f6 100644 --- a/gcc/config/arm/arm-mve-builtins-shapes.cc +++ b/gcc/config/arm/arm-mve-builtins-shapes.cc @@ -526,6 +526,64 @@ struct binary_rshift_def : public overloaded_base<0> SHAPE (binary_rshift) +/* <uT0>_t vfoo[_n_t0](<T0>_t, int) + + Shape for vector saturating shift left operations that take a + vector of signed elements as first argument and an integer, and + produce a vector of unsigned elements. + + Check that 'imm' is in the [0..#bits-1] range. + + Example: vqshluq. + uint16x8_t [__arm_]vqshluq[_n_s16](int16x8_t a, const int imm) + uint16x8_t [__arm_]vqshluq_m[_n_s16](uint16x8_t inactive, int16x8_t a, const int imm, mve_pred16_t p) */ +struct binary_lshift_unsigned_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_n, preserve_user_namespace); + build_all (b, "vu0,vs0,ss32", group, MODE_n, 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; + + if (r.pred == PRED_m) + { + /* With PRED_m, check that the 'inactive' first argument has + the expeected unsigned type. */ + type_suffix_index return_type + = find_type_suffix (TYPE_unsigned, type_suffixes[type].element_bits); + + if (!r.require_matching_vector_type (0, return_type)) + return error_mark_node; + } + + for (; i < nargs; ++i) + if (!r.require_integer_immediate (i)) + return error_mark_node; + + return r.resolve_to (r.mode_suffix_id, type); + } + + bool + check (function_checker &c) const override + { + unsigned int bits = c.type_suffix (0).element_bits; + return c.require_immediate_range (1, 0, bits - 1); + } + +}; +SHAPE (binary_lshift_unsigned) + /* <uT0>_t vfoo[_t0](<uT0>_t, <T0>_t) i.e. binary operations that take a vector of unsigned elements as first argument and a diff --git a/gcc/config/arm/arm-mve-builtins-shapes.h b/gcc/config/arm/arm-mve-builtins-shapes.h index 07b12b4..6ae1443 100644 --- a/gcc/config/arm/arm-mve-builtins-shapes.h +++ b/gcc/config/arm/arm-mve-builtins-shapes.h @@ -41,6 +41,7 @@ namespace arm_mve extern const function_shape *const binary_acc_int64; extern const function_shape *const binary_acca_int32; extern const function_shape *const binary_acca_int64; + extern const function_shape *const binary_lshift_unsigned; extern const function_shape *const binary_maxamina; extern const function_shape *const binary_maxavminav; extern const function_shape *const binary_maxvminv; |