#include "vec-perm-indices.h"
#include "asan.h"
#include "gimple-range.h"
+#include "optabs-tree.h"
/* Nonzero if we are folding constants inside an initializer or a C++
manifestly-constant-evaluated context; zero otherwise.
itype = signed_type_for (itype);
arg00 = fold_convert_loc (loc, itype, arg00);
}
- return fold_build2_loc (loc, code == EQ_EXPR ? GE_EXPR : LT_EXPR,
- type, arg00, build_zero_cst (itype));
+ enum tree_code code2 = code == EQ_EXPR ? GE_EXPR : LT_EXPR;
+ /* Make sure to transform vector compares only to supported
+ ones or from unsupported ones and check that only after
+ IPA so offloaded code is handled correctly in this regard. */
+ if (!VECTOR_TYPE_P (itype)
+ || (cfun
+ && cfun->after_inlining
+ /* We can jump on EQ/NE but not GE/LT. */
+ && VECTOR_BOOLEAN_TYPE_P (type)
+ && (expand_vec_cmp_expr_p (itype, type, code2)
+ || !expand_vec_cmp_expr_p (TREE_TYPE (op0),
+ type, code))))
+ return fold_build2_loc (loc, code2,
+ type, arg00, build_zero_cst (itype));
}
}
--- /dev/null
+/* { dg-do compile } */
+/* { dg-additional-options "-Wno-psabi" } */
+/* { dg-additional-options "-mavx2" { target { x86_64-*-* i?86-*-* } } } */
+
+#define BS_VEC(type, num) type __attribute__((vector_size(num * sizeof(type))))
+
+int f( BS_VEC(short, 16)
+ BS_TEMP_206)
+{
+ BS_TEMP_206 = BS_TEMP_206 < 0;
+ if (BS_TEMP_206[0] | BS_TEMP_206[1] | BS_TEMP_206[2] | BS_TEMP_206[3]
+ | BS_TEMP_206[4] | BS_TEMP_206[5] | BS_TEMP_206[6] | BS_TEMP_206[7]
+ | BS_TEMP_206[8] | BS_TEMP_206[9] | BS_TEMP_206[10]
+ | BS_TEMP_206[11] | BS_TEMP_206[12] | BS_TEMP_206[13]
+ | BS_TEMP_206[14] | BS_TEMP_206[15])
+ return 1;
+ return 0;
+}