1 /* { dg-require-effective-target vect_float } */
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_fmax (x0
, ptr
[i
+ 0]);
11 x1
= __builtin_fmax (x1
, ptr
[i
+ 1]);
27 for (int i
= 0; i
< N
; i
+= 2)
29 a
[i
] = i
< HALF
? i
: HALF
;
33 test (-1, -1, res
, a
, 2);
34 if (res
[0] != 0 || res
[1] != 0)
37 test (-1, -1, res
, a
, 6);
38 if (res
[0] != 4 || res
[1] != 0)
41 test (-1, -1, res
, a
, 8);
42 if (res
[0] != 6 || res
[1] != 0)
45 test (-1, -1, res
, a
, 10);
46 if (res
[0] != 8 || res
[1] != 1)
49 test (-1, -1, res
, a
, HALF
- 2);
50 if (res
[0] != HALF
- 4 || res
[1] != HALF
/ 8 - 1)
53 test (-1, -1, res
, a
, HALF
);
54 if (res
[0] != HALF
- 2 || res
[1] != HALF
/ 8 - 1)
57 test (-1, -1, res
, a
, HALF
+ 2);
58 if (res
[0] != HALF
|| res
[1] != HALF
/ 8)
61 test (-1, -1, res
, a
, HALF
+ 8);
62 if (res
[0] != HALF
|| res
[1] != HALF
/ 8)
65 test (-1, -1, res
, a
, HALF
+ 10);
66 if (res
[0] != HALF
|| res
[1] != HALF
/ 8 + 1)
69 test (-1, -1, res
, a
, N
);
70 if (res
[0] != HALF
|| res
[1] != N
/ 8 - 1)
73 test (HALF
+ 1, -1, res
, a
, N
);
74 if (res
[0] != HALF
+ 1 || res
[1] != N
/ 8 - 1)
77 test (HALF
+ 1, N
, res
, a
, N
);
78 if (res
[0] != HALF
+ 1 || res
[1] != N
)
84 /* { dg-final { scan-tree-dump "Detected reduction" "vect" } } */
85 /* { dg-final { scan-tree-dump "LOOP VECTORIZED" "vect" { target vect_max_reduc } } } */