--- /dev/null
+/* { dg-add-options vect_early_break } */
+/* { dg-require-effective-target vect_early_break } */
+/* { dg-require-effective-target vect_int } */
+/* { dg-require-effective-target bitint } */
+
+__attribute__((noipa)) void
+bar (unsigned long *p)
+{
+ __builtin_memset (p, 0, 142 * sizeof (unsigned long));
+ p[17] = 0x50000000000UL;
+}
+
+__attribute__((noipa)) int
+foo (void)
+{
+ unsigned long r[142];
+ bar (r);
+ unsigned long v = ((long) r[0] >> 31);
+ if (v + 1 > 1)
+ return 1;
+ for (unsigned long i = 1; i <= 140; ++i)
+ if (r[i] != v)
+ return 1;
+ unsigned long w = r[141];
+ if ((unsigned long) (((long) (w << 60)) >> 60) != v)
+ return 1;
+ return 0;
+}
+
+int
+main ()
+{
+ if (foo () != 1)
+ __builtin_abort ();
+}
--- /dev/null
+/* { dg-add-options vect_early_break } */
+/* { dg-require-effective-target vect_early_break } */
+/* { dg-require-effective-target vect_int } */
+/* { dg-require-effective-target bitint } */
+
+_BitInt(998) b;
+char c;
+char d;
+char e;
+char f;
+char g;
+char h;
+char i;
+char j;
+
+void
+foo(char y, _BitInt(9020) a, char *r)
+{
+ char x = __builtin_mul_overflow_p(a << sizeof(a), y, 0);
+ x += c + d + e + f + g + h + i + j + b;
+ *r = x;
+}
+
+int
+main(void)
+{
+ char x;
+ foo(5, 5, &x);
+ if (x != 1)
+ __builtin_abort();
+ return 0;
+}
rewrite conditions to always be a comparison against 0. To do this it
sometimes flips the edges. This is fine for scalar, but for vector we
then have to flip the test, as we're still assuming that if you take the
- branch edge that we found the exit condition. */
+ branch edge that we found the exit condition. i.e. we need to know whether
+ we are generating a `forall` or an `exist` condition. */
auto new_code = NE_EXPR;
auto reduc_optab = ior_optab;
auto reduc_op = BIT_IOR_EXPR;
tree cst = build_zero_cst (vectype);
+ edge exit_true_edge = EDGE_SUCC (gimple_bb (cond_stmt), 0);
+ if (exit_true_edge->flags & EDGE_FALSE_VALUE)
+ exit_true_edge = EDGE_SUCC (gimple_bb (cond_stmt), 1);
+ gcc_assert (exit_true_edge->flags & EDGE_TRUE_VALUE);
if (flow_bb_inside_loop_p (LOOP_VINFO_LOOP (loop_vinfo),
- BRANCH_EDGE (gimple_bb (cond_stmt))->dest))
+ exit_true_edge->dest))
{
new_code = EQ_EXPR;
reduc_optab = and_optab;