]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
arm: [MVE intrinsics] add load_ext_gather_offset shape
authorChristophe Lyon <christophe.lyon@linaro.org>
Thu, 17 Oct 2024 19:35:21 +0000 (19:35 +0000)
committerChristophe Lyon <christophe.lyon@linaro.org>
Fri, 13 Dec 2024 14:23:31 +0000 (14:23 +0000)
This patch adds the load_ext_gather_offset shape description.

gcc/ChangeLog:

* config/arm/arm-mve-builtins-shapes.cc (struct load_ext_gather):
New.
(struct load_ext_gather_offset_def): New.
* config/arm/arm-mve-builtins-shapes.h (load_ext_gather_offset):
New.

gcc/config/arm/arm-mve-builtins-shapes.cc
gcc/config/arm/arm-mve-builtins-shapes.h

index 03714ffb4354ed9469f212a139578ffa5c97397c..28b90454417d2cab86ca8845419a3356a7a85588 100644 (file)
@@ -1535,6 +1535,64 @@ struct load_ext_def : public nonoverloaded_base
 };
 SHAPE (load_ext)
 
+/* Base class for load_ext_gather_offset and load_ext_gather_shifted_offset,
+   which differ only in the units of the displacement.  */
+struct load_ext_gather : 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;
+  }
+};
+
+/* <T0>_t vfoo[_t0](<X>_t const *, <Y>_t)
+
+   where <X> might be tied to <t0> (for non-extending loads) or might
+   depend on the function base name (for extending loads),
+   <Y> has the same width as <T0> but is of unsigned type.
+
+   Example: vldrhq_gather_offset
+   int16x8_t [__arm_]vldrhq_gather_offset[_s16](int16_t const *base, uint16x8_t offset)
+   int32x4_t [__arm_]vldrhq_gather_offset_z[_s32](int16_t const *base, uint32x4_t offset, mve_pred16_t p)  */
+struct load_ext_gather_offset_def : public load_ext_gather
+{
+  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, "v0,al,vu0", group, MODE_offset, preserve_user_namespace);
+  }
+
+  tree
+  resolve (function_resolver &r) const override
+  {
+    unsigned int i, nargs;
+    mode_suffix_index mode = MODE_offset;
+    type_suffix_index ptr_type;
+    type_suffix_index offset_type;
+    if (!r.check_gp_argument (2, i, nargs)
+       || (ptr_type = r.infer_pointer_type (0)) == NUM_TYPE_SUFFIXES
+       || (offset_type = r.infer_vector_type (1)) == NUM_TYPE_SUFFIXES)
+      return error_mark_node;
+
+    /* tclass comes from base argument, element bits come from the offset
+       argument.  */
+    type_suffix_index type = find_type_suffix (type_suffixes[ptr_type].tclass,
+                              type_suffixes[offset_type].element_bits);
+
+    return r.resolve_to (mode, type);
+  }
+};
+SHAPE (load_ext_gather_offset)
+
 /* <T0>_t vfoo[_t0](<T0>_t)
    <T0>_t vfoo_n_t0(<sT0>_t)
 
index 1d361addd7624a14c7cc43dc8d80a7f5ce0604f8..9113d55dab43e6dfa29f7c25a96c0c71195a795f 100644 (file)
@@ -63,6 +63,7 @@ namespace arm_mve
     extern const function_shape *const inherent;
     extern const function_shape *const load;
     extern const function_shape *const load_ext;
+    extern const function_shape *const load_ext_gather_offset;
     extern const function_shape *const mvn;
     extern const function_shape *const store;
     extern const function_shape *const store_scatter_base;