* g++.dg/other/i386-2.C (dg-options): Add -mavx512pf.
[official-gcc.git] / gcc / testsuite / gcc.target / i386 / pr42542-2.c
blob80ed9c35ba5adbcb1a97ea2826f8d4983196d525
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 short v1[] __attribute__ ((aligned(16))) =
17 0x8000, 0x9000, 1, 10, 0xa000, 0xb000, 2, 20,
18 3, 30, 0xd000, 0xe000, 0xf000, 0xe000, 25, 30
20 unsigned short v2[] __attribute__ ((aligned(16))) =
22 4, 40, 0xb000, 0x8000, 5, 50, 0xc000, 0xf000,
23 0xd000, 0xa000, 6, 65, 7, 75, 0xe000, 0xc000
26 unsigned short max[] =
28 0x8000, 0x9000, 0xb000, 0x8000, 0xa000, 0xb000, 0xc000, 0xf000,
29 0xd000, 0xa000, 0xd000, 0xe000, 0xf000, 0xe000, 0xe000, 0xc000
32 unsigned short min[] =
34 4, 40, 1, 10, 5, 50, 2, 20,
35 3, 30, 6, 65, 7, 75, 25, 30
38 unsigned short res[16] __attribute__ ((aligned(16)));
40 extern void abort (void);
42 void
43 find_max (void)
45 int i;
47 for (i = 0; i < 16; 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 < 16; 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 < 16; i++)
68 if (res[i] != max[i])
69 err++;
71 find_min ();
72 for (i = 0; i < 16; i++)
73 if (res[i] != min[i])
74 err++;
76 if (err)
77 abort ();