Stop only if there aren't any usable algorithms
[official-gcc.git] / gcc / testsuite / gcc.target / i386 / pr42542-4.c
blobafb298989c92041e6019ed68627421b99a575482
1 /* { dg-do run } */
2 /* { dg-require-effective-target sse4 } */
3 /* { dg-options "-O1 -msse4.2 -ftree-vectorize" } */
5 #include "sse4_2-check.h"
7 unsigned long long v1[] __attribute__ ((aligned(16))) =
9 0x8000000000000000ULL, 2,
10 3, 0xd000000000000000ULL
12 unsigned long long v2[] __attribute__ ((aligned(16))) =
14 4, 0xb000000000000000ULL,
15 0xf000000000000000ULL, 6
18 unsigned long long max[] =
20 0x8000000000000000ULL, 0xb000000000000000ULL,
21 0xf000000000000000ULL, 0xd000000000000000ULL
24 unsigned long long min[] =
26 4, 2,
27 3, 6
30 unsigned long long res[4] __attribute__ ((aligned(16)));
32 extern void abort (void);
34 void
35 find_max (void)
37 int i;
39 for (i = 0; i < 4; i++)
40 res[i] = v1[i] < v2[i] ? v2[i] : v1[i];
43 void
44 find_min (void)
46 int i;
48 for (i = 0; i < 4; i++)
49 res[i] = v1[i] > v2[i] ? v2[i] : v1[i];
52 static void
53 sse4_2_test (void)
55 int i;
56 int err = 0;
58 find_max ();
59 for (i = 0; i < 4; i++)
60 if (res[i] != max[i])
61 err++;
63 find_min ();
64 for (i = 0; i < 4; i++)
65 if (res[i] != min[i])
66 err++;
68 if (err)
69 abort ();