Stop only if there aren't any usable algorithms
[official-gcc.git] / gcc / testsuite / gcc.target / i386 / pr42542-1.c
blob761b91b182d6a939bc90a943b727eead8a422d76
1 /* { dg-do run } */
2 /* { dg-options "-O1 -msse2 -ftree-vectorize" } */
3 /* { dg-require-effective-target sse2 } */
5 #ifndef CHECK_H
6 #define CHECK_H "sse2-check.h"
7 #endif
9 #ifndef TEST
10 #define TEST sse2_test
11 #endif
13 #include CHECK_H
15 unsigned int v1[] __attribute__ ((aligned(16))) =
17 0x80000000, 1, 0xa0000000, 2,
18 3, 0xd0000000, 0xf0000000, 0xe0000000
20 unsigned int v2[] __attribute__ ((aligned(16))) =
22 4, 0xb0000000, 5, 0xc0000000,
23 0xd0000000, 6, 7, 8
26 unsigned int max[] =
28 0x80000000, 0xb0000000, 0xa0000000, 0xc0000000,
29 0xd0000000, 0xd0000000, 0xf0000000, 0xe0000000
32 unsigned int min[] =
34 4, 1, 5, 2,
35 3, 6, 7, 8
38 unsigned int res[8] __attribute__ ((aligned(16)));
40 extern void abort (void);
42 void
43 find_max (void)
45 int i;
47 for (i = 0; i < 8; i++)
48 res[i] = v1[i] < v2[i] ? v2[i] : v1[i];
51 void
52 find_min (void)
54 int i;
56 for (i = 0; i < 8; i++)
57 res[i] = v1[i] > v2[i] ? v2[i] : v1[i];
60 static void
61 TEST (void)
63 int i;
64 int err = 0;
66 find_max ();
67 for (i = 0; i < 8; i++)
68 if (res[i] != max[i])
69 err++;
71 find_min ();
72 for (i = 0; i < 8; i++)
73 if (res[i] != min[i])
74 err++;
76 if (err)
77 abort ();