]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
arm: [MVE intrinsics] add ternary_lshift shape
authorChristophe Lyon <christophe.lyon@arm.com>
Tue, 28 Feb 2023 16:00:59 +0000 (16:00 +0000)
committerChristophe Lyon <christophe.lyon@arm.com>
Fri, 12 May 2023 10:40:39 +0000 (12:40 +0200)
This patch adds the ternary_lshift shape description.

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

gcc/
* config/arm/arm-mve-builtins-shapes.cc (ternary_lshift): New.
* config/arm/arm-mve-builtins-shapes.h (ternary_lshift): New.

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

index 9afa12910dc5e75d2d8771d488607013d90fb82f..30f511eb4f245d4f1ed5e3bf48f7946f7a016e46 100644 (file)
@@ -1372,6 +1372,44 @@ struct ternary_def : public overloaded_base<0>
 };
 SHAPE (ternary)
 
+/* <T0>_t vfoo[_t0](<T0>_t, <T0>_t, const int)
+
+   i.e. ternary operations that operate on a pair of vectors of the
+   same type as the destination, and take a third integer argument.
+
+   Check that 'imm' is in the [0..#bits-1] range.
+
+   Example: vsliq.
+   int16x8_t [__arm_]vsliq[_n_s16](int16x8_t a, int16x8_t b, const int imm)
+   int16x8_t [__arm_]vsliq_m[_n_s16](int16x8_t a, int16x8_t b, const int imm, mve_pred16_t p)  */
+struct ternary_lshift_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_n, preserve_user_namespace);
+    build_all (b, "v0,v0,v0,ss32", group, MODE_n, preserve_user_namespace);
+  }
+
+  tree
+  resolve (function_resolver &r) const override
+  {
+    return r.resolve_uniform (2, 1);
+  }
+
+  bool
+  check (function_checker &c) const override
+  {
+    if (c.mode_suffix_id != MODE_n)
+      return true;
+
+    unsigned int bits = c.type_suffix (0).element_bits;
+    return c.require_immediate_range (2, 0, bits - 1);
+  }
+};
+SHAPE (ternary_lshift)
+
 /* <T0>_t vfoo[_n_t0](<T0>_t, <T0>_t, <S0>_t)
 
    i.e. the standard shape for ternary operations that operate on a
index 6e818092a870e1b5057af45d87fe17f0f34ea190..73375186d82806f6335170fd3fe85f982b8cef05 100644 (file)
@@ -61,6 +61,7 @@ namespace arm_mve
     extern const function_shape *const inherent;
     extern const function_shape *const mvn;
     extern const function_shape *const ternary;
+    extern const function_shape *const ternary_lshift;
     extern const function_shape *const ternary_n;
     extern const function_shape *const ternary_opt_n;
     extern const function_shape *const unary;