1 /* { dg-do run } */
2 /* { dg-options "-O1 -ftree-vectorize" } */
3
4 unsigned int v1[] __attribute__ ((aligned(16))) =
5 {
6 0x80000000, 1, 0xa0000000, 2,
7 3, 0xd0000000, 0xf0000000, 0xe0000000
8 };
9 unsigned int v2[] __attribute__ ((aligned(16))) =
10 {
11 4, 0xb0000000, 5, 0xc0000000,
12 0xd0000000, 6, 7, 8
13 };
14
15 unsigned int max[] =
16 {
17 0x80000000, 0xb0000000, 0xa0000000, 0xc0000000,
18 0xd0000000, 0xd0000000, 0xf0000000, 0xe0000000
19 };
20
21 unsigned int min[] =
22 {
23 4, 1, 5, 2,
24 3, 6, 7, 8
25 };
26
27 unsigned int res[8] __attribute__ ((aligned(16)));
28
29 extern void abort (void);
30
31 void
find_max(void)32 find_max (void)
33 {
34 int i;
35
36 for (i = 0; i < 8; i++)
37 res[i] = v1[i] < v2[i] ? v2[i] : v1[i];
38 }
39
40 void
find_min(void)41 find_min (void)
42 {
43 int i;
44
45 for (i = 0; i < 8; i++)
46 res[i] = v1[i] > v2[i] ? v2[i] : v1[i];
47 }
48
main(void)49 int main (void)
50 {
51 int i;
52 int err = 0;
53
54 find_max ();
55 for (i = 0; i < 8; i++)
56 if (res[i] != max[i])
57 err++;
58
59 find_min ();
60 for (i = 0; i < 8; i++)
61 if (res[i] != min[i])
62 err++;
63
64 if (err)
65 abort ();
66
67 return 0;
68 }
69