Debian Codegraph @

gcc/testsuite/gcc.dg/vect/pr65947-8.c

raw
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 27
8
9 /* Condition reduction with multiple types in the comparison. Will fail to
10 vectorize on architectures requiring matching vector sizes. */
11
12 int
13 condition_reduction (char *a, int min_v)
14 {
15 int last = N + 65;
16
17 for (int i = 0; i < N; i++)
18 if (a[i] < min_v)
19 last = a[i];
20
21 return last;
22 }
23
24
25 int
26 main (void)
27 {
28 char a[N] = {
29 1, 28, 3, 48, 5, 68, 7, -88, 89, 180,
30 121, 122, -123, 124, 12, -12, 12, 67, 84, 122,
31 67, 55, 112, 22, 45, 23, 111
32 };
33
34 check_vect ();
35
36 int ret = condition_reduction (a, 16);
37
38 if (ret != 12)
39 abort ();
40
41 return 0;
42 }
43
44 /* { dg-final { scan-tree-dump-not "LOOP VECTORIZED" "vect" { target { ! { vect_fold_extract_last } } } } } */
45 /* { dg-final { scan-tree-dump "LOOP VECTORIZED" "vect" { target { vect_fold_extract_last } } } } */
46 /* { dg-final { scan-tree-dump "multiple types in\[^\\n\\r\]* condition reduction" "vect" { target { ! { vect_fold_extract_last } } } } } */