cfgexpand: Expand comment on when non-var clobbers can show up
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / vect-fmin-3.c
blob2e282ba6878ad86f9eea2698f646b7474ac3fe2a
1 /* { dg-require-effective-target vect_float } */
3 #include "tree-vect.h"
5 void __attribute__((noipa))
6 test (double x0, double x1, double *restrict res, double *restrict ptr, int n)
8 for (int i = 0; i < n; i += 2)
10 x0 = __builtin_fmin (x0, ptr[i + 0]);
11 x1 = __builtin_fmin (x1, ptr[i + 1]);
13 res[0] = x0;
14 res[1] = x1;
17 #define N 128
18 #define HALF (N / 2)
20 int
21 main (void)
23 check_vect ();
25 double res[2], a[N];
27 for (int i = 0; i < N; i += 2)
29 a[i] = i < HALF ? HALF - i : 0;
30 a[i + 1] = -i / 8;
33 test (N, N, res, a, 2);
34 if (res[0] != HALF || res[1] != 0)
35 __builtin_abort ();
37 test (N, N, res, a, 6);
38 if (res[0] != HALF - 4 || res[1] != 0)
39 __builtin_abort ();
41 test (N, N, res, a, 8);
42 if (res[0] != HALF - 6 || res[1] != 0)
43 __builtin_abort ();
45 test (N, N, res, a, 10);
46 if (res[0] != HALF - 8 || res[1] != -1)
47 __builtin_abort ();
49 test (N, N, res, a, HALF - 2);
50 if (res[0] != 4 || res[1] != -HALF / 8 + 1)
51 __builtin_abort ();
53 test (N, N, res, a, HALF);
54 if (res[0] != 2 || res[1] != -HALF / 8 + 1)
55 __builtin_abort ();
57 test (N, N, res, a, HALF + 2);
58 if (res[0] != 0 || res[1] != -HALF / 8)
59 __builtin_abort ();
61 test (N, N, res, a, HALF + 8);
62 if (res[0] != 0 || res[1] != -HALF / 8)
63 __builtin_abort ();
65 test (N, N, res, a, HALF + 10);
66 if (res[0] != 0 || res[1] != -HALF / 8 - 1)
67 __builtin_abort ();
69 test (N, N, res, a, N);
70 if (res[0] != 0 || res[1] != -N / 8 + 1)
71 __builtin_abort ();
73 test (-1, N, res, a, N);
74 if (res[0] != -1 || res[1] != -N / 8 + 1)
75 __builtin_abort ();
77 test (-1, -N / 8, res, a, N);
78 if (res[0] != -1 || res[1] != -N / 8)
79 __builtin_abort ();
81 return 0;
84 /* { dg-final { scan-tree-dump "Detected reduction" "vect" } } */
85 /* { dg-final { scan-tree-dump "LOOP VECTORIZED" "vect" { target vect_max_reduc } } } */