PR middle-end/77357 - strlen of constant strings not folded
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / pr65947-3.c
blob427abdb4140090cec89835eaa4b72d3c874d217f
1 /* { dg-require-effective-target vect_condition } */
3 #include "tree-vect.h"
5 extern void abort (void) __attribute__ ((noreturn));
7 #define N 37
9 /* Non-simple condition reduction with additional variable and unsigned
10 types. */
12 unsigned int
13 condition_reduction (unsigned int *a, unsigned int min_v, unsigned int *b)
15 unsigned int last = N + 65;
16 unsigned int aval;
18 for (unsigned int i = 0; i < N; i++)
20 aval = a[i];
21 if (b[i] < min_v)
22 last = aval;
24 return last;
28 int
29 main (void)
31 unsigned int a[N] = {
32 31, 32, 33, 34, 35, 36, 37,
33 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
34 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
35 11, 12, 13, 14, 15, 16, 17, 18, 19, 20
37 unsigned int b[N] = {
38 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
39 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
40 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
41 31, 32, 33, 34, 35, 36, 37
44 check_vect ();
46 unsigned int ret = condition_reduction (a, 16, b);
48 if (ret != 13)
49 abort ();
51 return 0;
54 /* { dg-final { scan-tree-dump-times "LOOP VECTORIZED" 2 "vect" } } */
55 /* { dg-final { scan-tree-dump-times "optimizing condition reduction with FOLD_EXTRACT_LAST" 4 "vect" { target vect_fold_extract_last } } } */
56 /* { dg-final { scan-tree-dump-not "condition expression based on integer induction." "vect" } } */