]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
arm: [MVE intrinsics] add binary_orrq shape
authorChristophe Lyon <christophe.lyon@arm.com>
Mon, 20 Feb 2023 14:04:29 +0000 (14:04 +0000)
committerChristophe Lyon <christophe.lyon@arm.com>
Wed, 3 May 2023 14:58:27 +0000 (16:58 +0200)
patch adds the binary_orrq shape description.

MODE_n intrinsics use a set of predicates (preds_m_or_none) different
the MODE_none ones, so we explicitly reference preds_m_or_none from
the shape, thus we need to make it a global array.

2022-09-08  Christophe Lyon  <christophe.lyon@arm.com>

gcc/
* config/arm/arm-mve-builtins-shapes.cc (binary_orrq): New.
* config/arm/arm-mve-builtins-shapes.h (binary_orrq): New.
* config/arm/arm-mve-builtins.cc (preds_m_or_none): Remove static.
* config/arm/arm-mve-builtins.h (preds_m_or_none): Declare.

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

index e69faae4e2c009ddb98d3e8082f94f2f3c77384b..e2f0984e4a0a21558611a8fbf6c2ddc65e691da0 100644 (file)
@@ -397,6 +397,67 @@ struct binary_opt_n_def : public overloaded_base<0>
 };
 SHAPE (binary_opt_n)
 
+/* <T0>_t vfoo[t0](<T0>_t, <T0>_t)
+   <T0>_t vfoo[_n_t0](<T0>_t, <S0>_t)
+
+   Where the _n form only supports s16/s32/u16/u32 types as for vorrq.
+
+   Example: vorrq.
+   int16x8_t [__arm_]vorrq[_s16](int16x8_t a, int16x8_t b)
+   int16x8_t [__arm_]vorrq_m[_s16](int16x8_t inactive, int16x8_t a, int16x8_t b, mve_pred16_t p)
+   int16x8_t [__arm_]vorrq_x[_s16](int16x8_t a, int16x8_t b, mve_pred16_t p)
+   int16x8_t [__arm_]vorrq[_n_s16](int16x8_t a, const int16_t imm)
+   int16x8_t [__arm_]vorrq_m_n[_s16](int16x8_t a, const int16_t imm, mve_pred16_t p)  */
+struct binary_orrq_def : public overloaded_base<0>
+{
+  bool
+  explicit_mode_suffix_p (enum predication_index pred, enum mode_suffix_index mode) const override
+  {
+    return (mode == MODE_n
+           && pred == PRED_m);
+  }
+
+  bool
+  skip_overload_p (enum predication_index pred, enum mode_suffix_index mode) const override
+  {
+    switch (mode)
+      {
+      case MODE_none:
+       return false;
+
+       /* For MODE_n, share the overloaded instance with MODE_none, except for PRED_m.  */
+      case MODE_n:
+       return pred != PRED_m;
+
+      default:
+       gcc_unreachable ();
+      }
+  }
+
+  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);
+    b.add_overloaded_functions (group, MODE_n, preserve_user_namespace);
+    build_all (b, "v0,v0,v0", group, MODE_none, preserve_user_namespace);
+    build_16_32 (b, "v0,v0,s0", group, MODE_n, preserve_user_namespace, false, preds_m_or_none);
+  }
+
+  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 (0)) == NUM_TYPE_SUFFIXES)
+      return error_mark_node;
+
+    return r.finish_opt_n_resolution (i, 0, type);
+  }
+};
+SHAPE (binary_orrq)
+
 /* <T0>[xN]_t vfoo_t0().
 
    Example: vuninitializedq.
index b00ee5eb57af5bb2e108db44b7049e9561c1514b..618b3226050029e3beef476fad5c010551d1b75b 100644 (file)
@@ -36,6 +36,7 @@ namespace arm_mve
 
     extern const function_shape *const binary;
     extern const function_shape *const binary_opt_n;
+    extern const function_shape *const binary_orrq;
     extern const function_shape *const inherent;
     extern const function_shape *const unary_convert;
 
index e409a029346ac3d1d626f0afbc0a0a65f1a7edca..c74e890bd3df9dff1994ac7b27bc61e313ffbd89 100644 (file)
@@ -285,7 +285,7 @@ static const predication_index preds_none[] = { PRED_none, NUM_PREDS };
 
 /* Used by functions that have the m (merging) predicated form, and in
    addition have an unpredicated form.  */
-static const predication_index preds_m_or_none[] = {
+const predication_index preds_m_or_none[] = {
   PRED_m, PRED_none, NUM_PREDS
 };
 
index a20d2fb5d86c5509004b293ae15365cfafacf780..c9b51a0c77bc28e3a34ccc2197cf55fa1c9c991e 100644 (file)
@@ -135,6 +135,9 @@ enum predication_index
   NUM_PREDS
 };
 
+/* Some shapes need access to some predicate sets.  */
+extern const predication_index preds_m_or_none[];
+
 /* Classifies element types, based on type suffixes with the bit count
    removed.  */
 enum type_class_index