111
|
1 /* { dg-require-effective-target vect_condition } */
|
|
2
|
|
3 #include "tree-vect.h"
|
|
4
|
|
5 extern void abort (void) __attribute__ ((noreturn));
|
|
6
|
|
7 #define N 32
|
|
8
|
131
|
9 /* Simple condition reduction with a reversed loop. */
|
111
|
10
|
|
11 int
|
|
12 condition_reduction (int *a, int min_v)
|
|
13 {
|
|
14 int last = -1;
|
|
15
|
|
16 for (int i = N-1; i >=0; i--)
|
|
17 if (a[i] < min_v)
|
|
18 last = i;
|
|
19
|
|
20 return last;
|
|
21 }
|
|
22
|
|
23 int
|
|
24 main (void)
|
|
25 {
|
|
26 int a[N] = {
|
|
27 17, 28, 13, 14, 15, 16, 17, 18, 19, 20,
|
|
28 1, 2, -3, 4, 5, 6, 7, -8, 9, 10,
|
|
29 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
|
|
30 31, 32
|
|
31 };
|
|
32
|
|
33 check_vect ();
|
|
34
|
|
35 int ret = condition_reduction (a, 16);
|
|
36
|
|
37 if (ret != 2)
|
|
38 abort ();
|
|
39
|
|
40 return 0;
|
|
41 }
|
|
42
|
|
43 /* { dg-final { scan-tree-dump-times "LOOP VECTORIZED" 2 "vect" } } */
|
131
|
44 /* { dg-final { scan-tree-dump-times "condition expression based on integer induction." 4 "vect" { xfail vect_fold_extract_last } } } */
|
|
45 /* { dg-final { scan-tree-dump-times "optimizing condition reduction with FOLD_EXTRACT_LAST" 4 "vect" { target vect_fold_extract_last } } } */
|