Update concepts branch to revision 131834
[official-gcc.git] / gcc / testsuite / gcc.target / i386 / sse4_1-pmaxuw.c
blob99248c1f579ac51585d14a258d393bb2ff375918
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 64
11 static void
12 sse4_1_test (void)
14 union
16 __m128i x[NUM / 8];
17 unsigned short i[NUM];
18 } dst, src1, src2;
19 int i;
20 unsigned short max;
22 for (i = 0; i < NUM; i++)
24 src1.i[i] = i * i;
25 src2.i[i] = i + 20;
26 if ((i % 8))
27 src2.i[i] |= 0x8000;
30 for (i = 0; i < NUM; i += 8)
31 dst.x[i / 8] = _mm_max_epu16 (src1.x[i / 8], src2.x[i / 8]);
33 for (i = 0; i < NUM; i++)
35 max = src1.i[i] <= src2.i[i] ? src2.i[i] : src1.i[i];
36 if (max != dst.i[i])
37 abort ();