]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
arm: [MVE intrinsics] add binary_maxamina shape
authorChristophe Lyon <christophe.lyon@arm.com>
Mon, 13 Feb 2023 21:46:30 +0000 (21:46 +0000)
committerChristophe Lyon <christophe.lyon@arm.com>
Tue, 9 May 2023 18:31:16 +0000 (20:31 +0200)
This patch adds the binary_maxamina shape description.

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

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

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

index 1324abd1c12e32881deae697707380e188b30895..c9eac80d1e30ebed69ea1095ae322a4a6fe6879e 100644 (file)
@@ -401,6 +401,46 @@ struct binary_rshift_def : public overloaded_base<0>
 };
 SHAPE (binary_rshift)
 
+
+/* <uT0>_t vfoo[_t0](<uT0>_t, <T0>_t)
+
+   i.e. binary operations that take a vector of unsigned elements as first argument and a
+   vector of signed elements as second argument, and produce a vector of unsigned elements.
+
+   Example: vminaq.
+   uint8x16_t [__arm_]vminaq[_s8](uint8x16_t a, int8x16_t b)
+   uint8x16_t [__arm_]vminaq_m[_s8](uint8x16_t a, int8x16_t b, mve_pred16_t p)  */
+struct binary_maxamina_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, "vu0,vu0,vs0", group, MODE_none, preserve_user_namespace);
+  }
+
+  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 (i)) == NUM_TYPE_SUFFIXES)
+      return error_mark_node;
+
+    /* Check that the first argument has the expeected unsigned
+       type.  */
+    type_suffix_index return_type
+      = find_type_suffix (TYPE_unsigned, type_suffixes[type].element_bits);
+    if (!r.require_matching_vector_type (0, return_type))
+      return error_mark_node;
+
+    return r.resolve_to (r.mode_suffix_id, type);
+  }
+};
+SHAPE (binary_maxamina)
+
 /* <uS0>_t vfoo[_<t0>](<uS0>_t, <T0>_t)
 
    Example: vmaxavq.
index cf4c523ab1a204b07e961d99a145b4270bf9cc73..7f582d7375a135b3c687dc3ddd05a309c72ec6b9 100644 (file)
@@ -37,6 +37,7 @@ namespace arm_mve
     extern const function_shape *const binary;
     extern const function_shape *const binary_lshift;
     extern const function_shape *const binary_lshift_r;
+    extern const function_shape *const binary_maxamina;
     extern const function_shape *const binary_maxavminav;
     extern const function_shape *const binary_maxvminv;
     extern const function_shape *const binary_move_narrow;