]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
arm: [MVE intrinsics] add binary_widen_n shape
authorChristophe Lyon <christophe.lyon@arm.com>
Fri, 10 Feb 2023 09:24:23 +0000 (09:24 +0000)
committerChristophe Lyon <christophe.lyon@arm.com>
Tue, 9 May 2023 11:07:42 +0000 (13:07 +0200)
This patch adds the binary_widen_n shape description.

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

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

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

index e26604510a2d13f89c748b70a4c08ace489ca5c7..1d43b8871bfafa4a236a61e103433084e5ef775f 100644 (file)
@@ -821,6 +821,59 @@ struct binary_rshift_narrow_unsigned_def : public overloaded_base<0>
 };
 SHAPE (binary_rshift_narrow_unsigned)
 
+/* <T0:twice>_t vfoo[_n_t0](<T0>_t, const int)
+
+   Check that 'imm' is in the [1..#bits] range.
+
+   Example: vshllbq.
+   int16x8_t [__arm_]vshllbq[_n_s8](int8x16_t a, const int imm)
+   int16x8_t [__arm_]vshllbq_m[_n_s8](int16x8_t inactive, int8x16_t a, const int imm, mve_pred16_t p)
+   int16x8_t [__arm_]vshllbq_x[_n_s8](int8x16_t a, const int imm, mve_pred16_t p)  */
+struct binary_widen_n_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, "vw0,v0,s0", group, MODE_n, preserve_user_namespace);
+  }
+
+  tree
+  resolve (function_resolver &r) const override
+  {
+    unsigned int i, nargs;
+    type_suffix_index type;
+    tree res;
+    if (!r.check_gp_argument (2, i, nargs)
+       || (type = r.infer_vector_type (i - 1)) == NUM_TYPE_SUFFIXES
+       || !r.require_integer_immediate (i))
+      return error_mark_node;
+
+    type_suffix_index wide_suffix
+      = find_type_suffix (type_suffixes[type].tclass,
+                         type_suffixes[type].element_bits * 2);
+
+    /* Check the inactive argument has the wide type.  */
+    if (((r.pred == PRED_m) && (r.infer_vector_type (0) == wide_suffix))
+       || r.pred == PRED_none
+       || r.pred == PRED_x)
+      if ((res = r.lookup_form (r.mode_suffix_id, type)))
+       return res;
+
+    return r.report_no_such_form (type);
+  }
+
+  bool
+  check (function_checker &c) const override
+  {
+    unsigned int bits = c.type_suffix (0).element_bits;
+    return c.require_immediate_range (1, 1, bits);
+  }
+
+};
+SHAPE (binary_widen_n)
+
 /* <T0>xN_t vfoo[_t0](uint64_t, uint64_t)
 
    where there are N arguments in total.
index 825e1bb2a3cb1226a6e7d37e5930d105bf028ca1..dd2597dc6f5d29e1c4b1137cda8e12af9e8bc4df 100644 (file)
@@ -45,6 +45,7 @@ namespace arm_mve
     extern const function_shape *const binary_rshift;
     extern const function_shape *const binary_rshift_narrow;
     extern const function_shape *const binary_rshift_narrow_unsigned;
+    extern const function_shape *const binary_widen_n;
     extern const function_shape *const create;
     extern const function_shape *const inherent;
     extern const function_shape *const unary;