aboutsummaryrefslogtreecommitdiff
path: root/gcc/config/arm
diff options
context:
space:
mode:
authorChristophe Lyon <christophe.lyon@linaro.org>2024-10-10 10:48:42 +0000
committerChristophe Lyon <christophe.lyon@linaro.org>2024-12-13 14:23:29 +0000
commitbccbb696e51def52cd8dec7269341b22d79b70a7 (patch)
tree4568d17da161417986433d887dc3656b0b2a1524 /gcc/config/arm
parent8080760951b563cedf7b68fcc119f7992bdb39fe (diff)
downloadgcc-bccbb696e51def52cd8dec7269341b22d79b70a7.zip
gcc-bccbb696e51def52cd8dec7269341b22d79b70a7.tar.gz
gcc-bccbb696e51def52cd8dec7269341b22d79b70a7.tar.bz2
arm: [MVE intrinsics] add store_scatter_offset shape
This patch adds the store_scatter_offset shape and uses a new helper class (store_scatter), which will also be used by later patches. gcc/ChangeLog: * config/arm/arm-mve-builtins-shapes.cc (struct store_scatter): New. (struct store_scatter_offset_def): New. * config/arm/arm-mve-builtins-shapes.h (store_scatter_offset): New.
Diffstat (limited to 'gcc/config/arm')
-rw-r--r--gcc/config/arm/arm-mve-builtins-shapes.cc64
-rw-r--r--gcc/config/arm/arm-mve-builtins-shapes.h1
2 files changed, 65 insertions, 0 deletions
diff --git a/gcc/config/arm/arm-mve-builtins-shapes.cc b/gcc/config/arm/arm-mve-builtins-shapes.cc
index b5bd03a..9350805 100644
--- a/gcc/config/arm/arm-mve-builtins-shapes.cc
+++ b/gcc/config/arm/arm-mve-builtins-shapes.cc
@@ -1613,6 +1613,70 @@ struct store_def : public overloaded_base<0>
};
SHAPE (store)
+/* Base class for store_scatter_offset and store_scatter_shifted_offset, which
+ differ only in the units of the displacement. Also used by
+ store_scatter_base. */
+struct store_scatter : public overloaded_base<0>
+{
+ bool
+ explicit_mode_suffix_p (enum predication_index, enum mode_suffix_index) const override
+ {
+ return true;
+ }
+
+ bool
+ mode_after_pred () const override
+ {
+ return false;
+ }
+};
+
+/* void vfoo[_t0](<X>_t *, <Y>_t, <T0>_t)
+
+ where <X> might be tied to <t0> (for non-truncating stores) or might
+ depend on the function base name (for truncating stores),
+ <Y> has the same width as <T0> but is of unsigned type.
+
+ Example: vstrbq_scatter_offset
+ void [__arm_]vstrbq_scatter_offset[_s16](int8_t *base, uint16x8_t offset, int16x8_t value)
+ void [__arm_]vstrbq_scatter_offset_p[_s16](int8_t *base, uint16x8_t offset, int16x8_t value, mve_pred16_t p) */
+struct store_scatter_offset_def : public store_scatter
+{
+ void
+ build (function_builder &b, const function_group_info &group,
+ bool preserve_user_namespace) const override
+ {
+ b.add_overloaded_functions (group, MODE_offset, preserve_user_namespace);
+ build_all (b, "_,as,vu0,v0", group, MODE_offset, preserve_user_namespace);
+ }
+
+ /* Resolve a scatter store that takes a scalar pointer base and a vector
+ displacement.
+
+ The stored data is the final argument, and it determines the
+ type suffix. */
+ tree
+ resolve (function_resolver &r) const override
+ {
+ unsigned int i, nargs;
+ type_suffix_index type;
+ if (!r.check_gp_argument (3, i, nargs)
+ || !r.require_pointer_type (0)
+ || (type = r.infer_vector_type (2)) == NUM_TYPE_SUFFIXES)
+ return error_mark_node;
+
+ /* Offset (arg 1) should be a vector of unsigned with same width as value
+ (arg 2). */
+ type_suffix_index offset_type
+ = find_type_suffix (TYPE_unsigned, type_suffixes[type].element_bits);
+ if (!r.require_matching_vector_type (1, offset_type))
+ return error_mark_node;
+
+ return r.resolve_to (r.mode_suffix_id, type);
+ }
+};
+SHAPE (store_scatter_offset)
+
/* <T0>_t vfoo[_t0](<T0>_t, <T0>_t, <T0>_t)
i.e. the standard shape for ternary operations that operate on
diff --git a/gcc/config/arm/arm-mve-builtins-shapes.h b/gcc/config/arm/arm-mve-builtins-shapes.h
index db7c631..be0e097 100644
--- a/gcc/config/arm/arm-mve-builtins-shapes.h
+++ b/gcc/config/arm/arm-mve-builtins-shapes.h
@@ -65,6 +65,7 @@ namespace arm_mve
extern const function_shape *const load_ext;
extern const function_shape *const mvn;
extern const function_shape *const store;
+ extern const function_shape *const store_scatter_offset;
extern const function_shape *const ternary;
extern const function_shape *const ternary_lshift;
extern const function_shape *const ternary_n;