new file mode 100644
@@ -0,0 +1,63 @@
+// { dg-options "-O2" }
+
+#include <arm_sve.h>
+
+svint8_t
+f1 (svint8_t x, svint8_t y)
+{
+ return x / y; // { dg-message {unsupported operation on variable-length vectors} }
+}
+
+svint16_t
+f2 (svint16_t x)
+{
+ return x / 4; // { dg-message {unsupported operation on variable-length vectors} }
+}
+
+svint32_t
+f3 (svint32_t x, svint32_t y)
+{
+ return x % y; // { dg-message {unsupported operation on variable-length vectors} }
+}
+
+svuint8_t
+f4 (svuint8_t x)
+{
+ return x % 3; // { dg-message {unsupported operation on variable-length vectors} }
+}
+
+svbfloat16_t
+f5 (svbfloat16_t x, svbfloat16_t y)
+{
+ return x + y; // { dg-message {unsupported operation on variable-length vectors} }
+}
+
+svint16_t
+f6 (svbfloat16_t x, svbfloat16_t y)
+{
+ return x < y; // { dg-message {unsupported operation on variable-length vectors} }
+}
+
+svint16_t
+f7 (svbfloat16_t x)
+{
+ return __builtin_convertvector (x, svint16_t); // { dg-message {unsupported operation on variable-length vectors} }
+}
+
+svbfloat16_t
+f8 (svint16_t x)
+{
+ return __builtin_convertvector (x, svbfloat16_t); // { dg-message {unsupported operation on variable-length vectors} }
+}
+
+svint16_t
+f9 (svint16_t x)
+{
+ return x / svindex_s16 (1, 1); // { dg-message {unsupported operation on variable-length vectors} }
+}
+
+svint16_t
+f10 (svint16_t x)
+{
+ return x % svdupq_s16 (1, 2, 3, 4, 5, 6, 7, 8); // { dg-message {unsupported operation on variable-length vectors} }
+}
new file mode 100644
@@ -0,0 +1,15 @@
+// { dg-options "-O0" }
+
+#include <arm_sve.h>
+
+svint32_t
+f1 (svint32_t x, svint32_t y)
+{
+ return x < y;
+}
+
+svint64_t
+f2 (svfloat64_t x, svfloat64_t y)
+{
+ return x != y;
+}
new file mode 100644
@@ -0,0 +1,27 @@
+// { dg-options "-O2" }
+
+#include <arm_sve.h>
+
+svint8_t
+f1 (svint8_t x, svint8_t y, svint8_t z)
+{
+ return __builtin_shuffle (x, y, z); // { dg-message {unsupported permutation of variable-length vectors} }
+}
+
+svint8_t
+f2 (svint8_t x, svint8_t z)
+{
+ return __builtin_shuffle (x, z); // { dg-message {unsupported permutation of variable-length vectors} }
+}
+
+svfloat64_t
+f3 (svfloat64_t x, svfloat64_t y, svuint64_t z)
+{
+ return __builtin_shuffle (x, y, z); // { dg-message {unsupported permutation of variable-length vectors} }
+}
+
+svbool_t
+f4 (svbool_t x, svint8_t z)
+{
+ return __builtin_shuffle (x, x, z); // { dg-message {unsupported permutation of variable-length vectors} }
+}
new file mode 100644
@@ -0,0 +1,28 @@
+// { dg-options "-O0" }
+
+#include <arm_sve.h>
+
+svint8_t
+f1 (svint8_t x, svint8_t y)
+{
+ return __builtin_shuffle (x, y, (svint8_t) {});
+}
+
+svint8_t
+f2 (svint8_t x, svint8_t y)
+{
+ return __builtin_shuffle (x, y, svdup_s8 (1));
+}
+
+svuint8_t
+f3 (svuint8_t x)
+{
+ return __builtin_shuffle (x, svindex_u8 (0, 2));
+}
+
+svint8_t
+f4 (svint8_t x, svint8_t y)
+{
+ return __builtin_shuffle (x, y, svdupq_s8 (0, 1, 2, 3, 4, 5, 6, 7,
+ 8, 9, 10, 11, 12, 13, 14, 15));
+}
new file mode 100644
@@ -0,0 +1,63 @@
+/* { dg-options "-O2" } */
+
+#include <arm_sve.h>
+
+svint8_t
+f1 (svint8_t x, svint8_t y)
+{
+ return x / y; /* { dg-message {unsupported operation on variable-length vectors} } */
+}
+
+svint16_t
+f2 (svint16_t x)
+{
+ return x / 4; /* { dg-message {unsupported operation on variable-length vectors} } */
+}
+
+svint32_t
+f3 (svint32_t x, svint32_t y)
+{
+ return x % y; /* { dg-message {unsupported operation on variable-length vectors} } */
+}
+
+svuint8_t
+f4 (svuint8_t x)
+{
+ return x % 3; /* { dg-message {unsupported operation on variable-length vectors} } */
+}
+
+svbfloat16_t
+f5 (svbfloat16_t x, svbfloat16_t y)
+{
+ return x + y; /* { dg-message {unsupported operation on variable-length vectors} } */
+}
+
+svint16_t
+f6 (svbfloat16_t x, svbfloat16_t y)
+{
+ return x < y; /* { dg-message {unsupported operation on variable-length vectors} } */
+}
+
+svint16_t
+f7 (svbfloat16_t x)
+{
+ return __builtin_convertvector (x, svint16_t); /* { dg-message {unsupported operation on variable-length vectors} } */
+}
+
+svbfloat16_t
+f8 (svint16_t x)
+{
+ return __builtin_convertvector (x, svbfloat16_t); /* { dg-message {unsupported operation on variable-length vectors} } */
+}
+
+svint16_t
+f9 (svint16_t x)
+{
+ return x / svindex_s16 (1, 1); /* { dg-message {unsupported operation on variable-length vectors} } */
+}
+
+svint16_t
+f10 (svint16_t x)
+{
+ return x % svdupq_s16 (1, 2, 3, 4, 5, 6, 7, 8); /* { dg-message {unsupported operation on variable-length vectors} } */
+}
new file mode 100644
@@ -0,0 +1,15 @@
+/* { dg-options "-O0" } */
+
+#include <arm_sve.h>
+
+svint32_t
+f1 (svint32_t x, svint32_t y)
+{
+ return x < y;
+}
+
+svint64_t
+f2 (svfloat64_t x, svfloat64_t y)
+{
+ return x != y;
+}
new file mode 100644
@@ -0,0 +1,27 @@
+/* { dg-options "-O2" } */
+
+#include <arm_sve.h>
+
+svint8_t
+f1 (svint8_t x, svint8_t y, svint8_t z)
+{
+ return __builtin_shuffle (x, y, z); /* { dg-message {unsupported permutation of variable-length vectors} } */
+}
+
+svint8_t
+f2 (svint8_t x, svint8_t z)
+{
+ return __builtin_shuffle (x, z); /* { dg-message {unsupported permutation of variable-length vectors} } */
+}
+
+svfloat64_t
+f3 (svfloat64_t x, svfloat64_t y, svuint64_t z)
+{
+ return __builtin_shuffle (x, y, z); /* { dg-message {unsupported permutation of variable-length vectors} } */
+}
+
+svbool_t
+f4 (svbool_t x, svint8_t z)
+{
+ return __builtin_shuffle (x, x, z); /* { dg-message {unsupported permutation of variable-length vectors} } */
+}
new file mode 100644
@@ -0,0 +1,28 @@
+/* { dg-options "-O0" } */
+
+#include <arm_sve.h>
+
+svint8_t
+f1 (svint8_t x, svint8_t y)
+{
+ return __builtin_shuffle (x, y, (svint8_t) {});
+}
+
+svint8_t
+f2 (svint8_t x, svint8_t y)
+{
+ return __builtin_shuffle (x, y, svdup_s8 (1));
+}
+
+svuint8_t
+f3 (svuint8_t x)
+{
+ return __builtin_shuffle (x, svindex_u8 (0, 2));
+}
+
+svint8_t
+f4 (svint8_t x, svint8_t y)
+{
+ return __builtin_shuffle (x, y, svdupq_s8 (0, 1, 2, 3, 4, 5, 6, 7,
+ 8, 9, 10, 11, 12, 13, 14, 15));
+}
new file mode 100644
@@ -0,0 +1,20 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+#include <arm_sve.h>
+
+svint32_t
+f1 (svint32_t x, svint32_t y)
+{
+ return x < y;
+}
+
+void
+f2 (int *restrict a, int *restrict b, int n)
+{
+ for (int i = 0; i < n; i++)
+ if (b[i] > 3)
+ a[i] = b[i];
+}
+
+/* { dg-final { scan-assembler-times {\tcmp[gl]t\t} 2 } } */
@@ -288,6 +288,13 @@ expand_vector_piecewise (gimple_stmt_iterator *gsi, elem_op_func f,
tree a, tree b, enum tree_code code,
bool parallel_p, tree ret_type = NULL_TREE)
{
+ location_t loc = gimple_location (gsi_stmt (*gsi));
+ if (!TYPE_VECTOR_SUBPARTS (type).is_constant ())
+ {
+ sorry_at (loc, "unsupported operation on variable-length vectors");
+ return build_zero_cst (ret_type ? ret_type : type);
+ }
+
vec<constructor_elt, va_gc> *v;
tree part_width = TYPE_SIZE (inner_type);
tree index = bitsize_int (0);
@@ -295,7 +302,6 @@ expand_vector_piecewise (gimple_stmt_iterator *gsi, elem_op_func f,
int delta = (VECTOR_TYPE_P (inner_type)
? nunits_for_known_piecewise_op (inner_type) : 1);
int i;
- location_t loc = gimple_location (gsi_stmt (*gsi));
if (nunits == 1
|| warning_suppressed_p (gsi_stmt (*gsi),
@@ -704,7 +710,9 @@ expand_vector_divmod (gimple_stmt_iterator *gsi, tree type, tree op0,
bool use_abs_op1 = false;
int mode = -1, this_mode;
int pre_shift = -1, post_shift;
- unsigned int nunits = nunits_for_known_piecewise_op (type);
+ unsigned HOST_WIDE_INT nunits;
+ if (!TYPE_VECTOR_SUBPARTS (type).is_constant (&nunits))
+ return NULL_TREE;
int *shifts = XALLOCAVEC (int, nunits * 4);
int *pre_shifts = shifts + nunits;
int *post_shifts = pre_shifts + nunits;
@@ -1628,10 +1636,6 @@ lower_vec_perm (gimple_stmt_iterator *gsi)
location_t loc = gimple_location (gsi_stmt (*gsi));
unsigned i;
- if (!TYPE_VECTOR_SUBPARTS (res_vect_type).is_constant (&elements)
- || !TYPE_VECTOR_SUBPARTS (vect_type).is_constant (&in_elements))
- return;
-
if (TREE_CODE (mask) == SSA_NAME)
{
gimple *def_stmt = SSA_NAME_DEF_STMT (mask);
@@ -1658,6 +1662,15 @@ lower_vec_perm (gimple_stmt_iterator *gsi)
else if (can_vec_perm_var_p (TYPE_MODE (vect_type)))
return;
+ if (!TYPE_VECTOR_SUBPARTS (res_vect_type).is_constant (&elements)
+ || !TYPE_VECTOR_SUBPARTS (vect_type).is_constant (&in_elements))
+ {
+ sorry_at (loc, "unsupported permutation of variable-length vectors");
+ gimple_assign_set_rhs_from_tree (gsi, build_zero_cst (res_vect_type));
+ update_stmt (gsi_stmt (*gsi));
+ return;
+ }
+
if (!warning_suppressed_p (stmt, OPT_Wvector_operation_performance))
warning_at (loc, OPT_Wvector_operation_performance,
"vector shuffling operation will be expanded piecewise");