Update concepts branch to revision 131834
[official-gcc.git] / gcc / testsuite / gcc.target / i386 / sse4_1-pmaxsb.c
blob5bd007e52c2bdd61e394aea229e66e8689a4fc56
1 /* { dg-do run } */
2 /* { dg-require-effective-target sse4 } */
3 /* { dg-options "-O2 -msse4.1" } */
5 #include "sse4_1-check.h"
7 #include <smmintrin.h>
9 #define NUM 1024
11 static void
12 sse4_1_test (void)
14 union
16 __m128i x[NUM / 16];
17 char i[NUM];
18 } dst, src1, src2;
19 int i, sign = 1;
20 char max;
22 for (i = 0; i < NUM; i++)
24 src1.i[i] = i * i * sign;
25 src2.i[i] = (i + 20) * sign;
26 sign = -sign;
29 for (i = 0; i < NUM; i += 16)
30 dst.x[i / 16] = _mm_max_epi8 (src1.x[i / 16], src2.x[i / 16]);
32 for (i = 0; i < NUM; i++)
34 max = src1.i[i] <= src2.i[i] ? src2.i[i] : src1.i[i];
35 if (max != dst.i[i])
36 abort ();