public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r14-5620] arm: [MVE intrinsics] add load and store shapes
@ 2023-11-20 11:24 Christophe Lyon
  0 siblings, 0 replies; only message in thread
From: Christophe Lyon @ 2023-11-20 11:24 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:11458752063698ae91976d5242630cc62b709afd

commit r14-5620-g11458752063698ae91976d5242630cc62b709afd
Author: Christophe Lyon <christophe.lyon@linaro.org>
Date:   Wed Nov 15 08:04:24 2023 +0000

    arm: [MVE intrinsics] add load and store shapes
    
    This patch adds the load and store shapes descriptions.
    
    2023-11-16  Christophe Lyon  <christophe.lyon@linaro.org>
    
            gcc/
            * config/arm/arm-mve-builtins-shapes.cc (load, store): New.
            * config/arm/arm-mve-builtins-shapes.h (load, store): New.

Diff:
---
 gcc/config/arm/arm-mve-builtins-shapes.cc | 67 +++++++++++++++++++++++++++++++
 gcc/config/arm/arm-mve-builtins-shapes.h  |  2 +
 2 files changed, 69 insertions(+)

diff --git a/gcc/config/arm/arm-mve-builtins-shapes.cc b/gcc/config/arm/arm-mve-builtins-shapes.cc
index ce87ebcef30..fe983e7c736 100644
--- a/gcc/config/arm/arm-mve-builtins-shapes.cc
+++ b/gcc/config/arm/arm-mve-builtins-shapes.cc
@@ -1428,6 +1428,38 @@ struct inherent_def : public nonoverloaded_base
 };
 SHAPE (inherent)
 
+/* sv<t0>_t svfoo[_t0](const <t0>_t *)
+
+   Example: vld1q.
+   int8x16_t [__arm_]vld1q[_s8](int8_t const *base)
+   int8x16_t [__arm_]vld1q_z[_s8](int8_t const *base, mve_pred16_t p)  */
+struct load_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, "t0,al", group, MODE_none, preserve_user_namespace);
+  }
+
+  /* Resolve a call based purely on a pointer argument.  */
+  tree
+  resolve (function_resolver &r) const override
+  {
+    gcc_assert (r.mode_suffix_id == MODE_none);
+
+    unsigned int i, nargs;
+    type_suffix_index type;
+    if (!r.check_gp_argument (1, i, nargs)
+	|| (type = r.infer_pointer_type (i)) == NUM_TYPE_SUFFIXES)
+      return error_mark_node;
+
+    return r.resolve_to (r.mode_suffix_id, type);
+  }
+};
+SHAPE (load)
+
 /* <T0>_t vfoo[_t0](<T0>_t)
    <T0>_t vfoo_n_t0(<sT0>_t)
 
@@ -1477,6 +1509,41 @@ struct mvn_def : public overloaded_base<0>
 };
 SHAPE (mvn)
 
+/* void vfoo[_t0](<X>_t *, v<t0>[xN]_t)
+
+   where <X> might be tied to <t0> (for non-truncating stores) or might
+   depend on the function base name (for truncating stores).
+
+   Example: vst1q.
+   void [__arm_]vst1q[_s8](int8_t *base, int8x16_t value)
+   void [__arm_]vst1q_p[_s8](int8_t *base, int8x16_t value, mve_pred16_t p)  */
+struct store_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, "_,as,v0", group, MODE_none, preserve_user_namespace);
+  }
+
+  tree
+  resolve (function_resolver &r) const override
+  {
+    gcc_assert (r.mode_suffix_id == MODE_none);
+
+    unsigned int i, nargs;
+    type_suffix_index type;
+    if (!r.check_gp_argument (2, i, nargs)
+	|| !r.require_pointer_type (0)
+	|| (type = r.infer_vector_type (1)) == NUM_TYPE_SUFFIXES)
+      return error_mark_node;
+
+    return r.resolve_to (r.mode_suffix_id, type);
+  }
+};
+SHAPE (store)
+
 /* <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 a93245321c9..aa9309dec7e 100644
--- a/gcc/config/arm/arm-mve-builtins-shapes.h
+++ b/gcc/config/arm/arm-mve-builtins-shapes.h
@@ -61,7 +61,9 @@ namespace arm_mve
     extern const function_shape *const cmp;
     extern const function_shape *const create;
     extern const function_shape *const inherent;
+    extern const function_shape *const load;
     extern const function_shape *const mvn;
+    extern const function_shape *const store;
     extern const function_shape *const ternary;
     extern const function_shape *const ternary_lshift;
     extern const function_shape *const ternary_n;

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-11-20 11:24 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-20 11:24 [gcc r14-5620] arm: [MVE intrinsics] add load and store shapes Christophe Lyon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).