2018-01-16 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / pr65947-6.c
blobb072c8d33a2143426556aefbda592df1c7ced7c4
1 /* { dg-require-effective-target vect_condition } */
3 #include "tree-vect.h"
5 extern void abort (void) __attribute__ ((noreturn));
7 #define N 30
9 /* Condition reduction where loop type is different than the data type. */
11 int
12 condition_reduction (int *a, int min_v)
14 int last = N + 65;
16 for (char i = 0; i < N; i++)
17 if (a[i] < min_v)
18 last = a[i];
20 return last;
24 int
25 main (void)
27 int a[N] = {
28 67, 32, 45, 43, 21, -11, 12, 3, 4, 5,
29 6, 76, -32, 56, -32, -1, 4, 5, 6, 99,
30 43, 22, -3, 22, 16, 34, 55, 31, 87, 324
33 check_vect ();
35 int ret = condition_reduction (a, 16);
37 if (ret != -3)
38 abort ();
40 return 0;
43 /* { dg-final { scan-tree-dump-times "LOOP VECTORIZED" 2 "vect" } } */
44 /* { dg-final { scan-tree-dump-times "optimizing condition reduction with FOLD_EXTRACT_LAST" 4 "vect" { target vect_fold_extract_last } } } */
45 /* { dg-final { scan-tree-dump-not "condition expression based on integer induction." "vect" } } */