public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Christophe Lyon <christophe.lyon@linaro.org>
To: gcc-patches@gcc.gnu.org, richard.sandiford@arm.com,
	richard.earnshaw@arm.com, kyrylo.tkachov@arm.com
Cc: Christophe Lyon <christophe.lyon@linaro.org>
Subject: [PATCH 4/6] arm: [MVE intrinsics] add load and store shapes
Date: Thu, 16 Nov 2023 15:26:15 +0000	[thread overview]
Message-ID: <20231116152617.2193377-4-christophe.lyon@linaro.org> (raw)
In-Reply-To: <20231116152617.2193377-1-christophe.lyon@linaro.org>

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.
---
 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;
-- 
2.34.1


  parent reply	other threads:[~2023-11-16 15:26 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-16 15:26 [PATCH 1/6] arm: Fix arm_simd_types and MVE scalar_types Christophe Lyon
2023-11-16 15:26 ` [PATCH 2/6] arm: [MVE intrinsics] Add support for void and load/store pointers as argument types Christophe Lyon
2023-11-16 16:47   ` Kyrylo Tkachov
2023-11-16 15:26 ` [PATCH 3/6] arm: [MVE intrinsics] Add support for contiguous loads and stores Christophe Lyon
2023-11-16 16:48   ` Kyrylo Tkachov
2023-11-23 13:29   ` Jan-Benedict Glaw
2023-11-23 15:57     ` Christophe Lyon
2023-11-16 15:26 ` Christophe Lyon [this message]
2023-11-16 16:49   ` [PATCH 4/6] arm: [MVE intrinsics] add load and store shapes Kyrylo Tkachov
2023-11-16 15:26 ` [PATCH 5/6] arm: [MVE intrinsics] fix vst1 tests Christophe Lyon
2023-11-16 15:30   ` Kyrylo Tkachov
2023-11-16 15:37     ` Christophe Lyon
2023-11-16 15:26 ` [PATCH 6/6] arm: [MVE intrinsics] rework vldq1 vst1q Christophe Lyon
2023-11-16 16:49   ` Kyrylo Tkachov
2023-11-16 16:46 ` [PATCH 1/6] arm: Fix arm_simd_types and MVE scalar_types Kyrylo Tkachov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231116152617.2193377-4-christophe.lyon@linaro.org \
    --to=christophe.lyon@linaro.org \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=kyrylo.tkachov@arm.com \
    --cc=richard.earnshaw@arm.com \
    --cc=richard.sandiford@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).