2015-12-10 Vladimir Makarov <vmakarov@redhat.com>
[official-gcc.git] / gcc / testsuite / gcc.target / i386 / sse4_1-insvqi.c
blob784201e2d94f9d548f87caea762d1de0339d9d8a
1 /* { dg-do run } */
2 /* { dg-require-effective-target sse4 } */
3 /* { dg-options "-O2 -msse4.1" } */
5 #ifndef CHECK_H
6 #define CHECK_H "sse4_1-check.h"
7 #endif
9 #ifndef TEST
10 #define TEST sse4_1_test
11 #endif
13 #include CHECK_H
15 #include <smmintrin.h>
16 #include <string.h>
18 typedef char T __attribute__((may_alias));
19 struct S { __m128i d; };
21 __m128i
22 __attribute__((noinline))
23 foo (__m128i y, char x)
25 struct S s;
27 s.d = y;
28 ((T *) &s.d)[1] = x;
29 return s.d;
32 static void
33 TEST (void)
35 union
37 __m128i x;
38 unsigned int i[4];
39 unsigned char c[16];
40 } res, val, tmp;
41 unsigned char ins[4] = { 3, 4, 5, 6 };
43 val.i[0] = 0x35251505;
44 val.i[1] = 0x75655545;
45 val.i[2] = 0xB5A59585;
46 val.i[3] = 0xF5E5D5C5;
48 res.x = foo (val.x, ins[3]);
50 tmp.x = val.x;
51 tmp.c[1] = ins[3];
52 if (memcmp (&tmp, &res, sizeof (tmp)))
53 abort ();