2017-12-05 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / pr65947-12.c
blob8e2c46f1a6b75c838d0f6b9fdad813d3c34e6902
1 /* { dg-require-effective-target vect_condition } */
3 #include "tree-vect.h"
5 extern void abort (void) __attribute__ ((noreturn));
7 #define N 32
9 /* Simple condition reduction where the result is a negative of the induction.
10 Will fail to vectorize to a simple case. */
12 signed int
13 condition_reduction (signed int *a, signed int min_v)
15 signed int last = -1;
17 for (signed int i = 0; i < N; i++)
18 if (a[i] < min_v)
19 last = -i;
21 return last;
24 int
25 main (void)
27 signed int a[N] = {
28 11, -12, 13, 14, 15, 16, 17, 18, 19, 20,
29 1, 2, -3, 4, 5, 6, 7, -8, 9, 10,
30 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
31 31, 32
34 check_vect ();
36 signed int ret = condition_reduction (a, 16);
38 if (ret != -19)
39 abort ();
41 return 0;
44 /* { dg-final { scan-tree-dump-times "LOOP VECTORIZED" 2 "vect" } } */
45 /* { dg-final { scan-tree-dump-not "condition expression based on integer induction." "vect" } } */