]> gcc.gnu.org Git - gcc.git/commitdiff
arm: [MVE intrinsics] add mvn shape
authorChristophe Lyon <christophe.lyon@arm.com>
Mon, 27 Feb 2023 18:50:04 +0000 (18:50 +0000)
committerChristophe Lyon <christophe.lyon@arm.com>
Fri, 12 May 2023 10:40:38 +0000 (12:40 +0200)
This patch adds the mvn shape description.

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

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

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

index 0542e87474640e3e07371429aec3afea3e87dc6f..92bb787329184754b9fa16ec967d3cdd42c99847 100644 (file)
@@ -1297,6 +1297,55 @@ struct inherent_def : public nonoverloaded_base
 };
 SHAPE (inherent)
 
+/* <T0>_t vfoo[_t0](<T0>_t)
+   <T0>_t vfoo_n_t0(<sT0>_t)
+
+   For MODE_n, define only the 16 and 32 bits versions.
+
+   Example: vmvnq.
+   int16x8_t [__arm_]vmvnq[_s16](int16x8_t a)
+   int16x8_t [__arm_]vmvnq_m[_s16](int16x8_t inactive, int16x8_t a, mve_pred16_t p)
+   int16x8_t [__arm_]vmvnq_x[_s16](int16x8_t a, mve_pred16_t p)
+   int16x8_t [__arm_]vmvnq_n_s16(const int16_t imm)
+   int16x8_t [__arm_]vmvnq_m[_n_s16](int16x8_t inactive, const int16_t imm, mve_pred16_t p)
+   int16x8_t [__arm_]vmvnq_x_n_s16(const int16_t imm, mve_pred16_t p)  */
+struct mvn_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);
+    /* Do not build a separate instance for MODE_n, since we want to
+       share vmvnq_m[_n_s16] with vmvnq_m[_s16].  */
+    build_all (b, "v0,v0", group, MODE_none, preserve_user_namespace);
+    build_16_32 (b, "v0,s0", group, MODE_n, preserve_user_namespace);
+  }
+
+  tree
+  resolve (function_resolver &r) const override
+  {
+    unsigned int i, nargs;
+    type_suffix_index type;
+    if (!r.check_gp_argument (1, i, nargs)
+       /* Same type for arg 0 and 1 if _m, so using 0 is OK */
+       || (type = r.infer_vector_type (0)) == NUM_TYPE_SUFFIXES)
+      return error_mark_node;
+
+  /* Skip last argument, may be scalar.  */
+    unsigned int last_arg = i;
+    for (i = 0; i < last_arg; i++)
+      if (!r.require_matching_vector_type (i, type))
+       return error_mark_node;
+
+    if (last_arg == 0)
+      return r.resolve_to (r.mode_suffix_id, type);
+
+    return r.finish_opt_n_resolution (last_arg, 0, type);
+  }
+};
+SHAPE (mvn)
+
 /* <T0>_t vfoo[_t0](<T0>_t, <T0>_t, <T0>_t)
 
    i.e. the standard shape for ternary operations that operate on
index bba38194ce212a316baafc3808f3803ba0b070e8..ba53e8cc52e064b6b6e8dfba3bad1d1aaba0eea2 100644 (file)
@@ -59,6 +59,7 @@ 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 mvn;
     extern const function_shape *const ternary;
     extern const function_shape *const ternary_n;
     extern const function_shape *const unary;
This page took 0.071271 seconds and 5 git commands to generate.