Merge from mainline (165734:167278).
[official-gcc/graphite-test-results.git] / gcc / testsuite / gcc.target / i386 / sse2-init-v2di-1.c
blobef1863c57dc880f7d21cd623c1bc6d82e90af881
1 /* { dg-do run } */
2 /* { dg-options "-O2 -msse2" } */
3 /* { dg-require-effective-target sse2 } */
5 #include "sse2-check.h"
7 #ifdef DEBUG
8 #include <stdio.h>
9 #endif
11 #include <emmintrin.h>
13 static void
14 __attribute__((noinline))
15 check (__m128i x, unsigned long long *v, int j)
17 union
19 __m128i x;
20 unsigned long long i[2];
21 } u;
22 unsigned int i;
24 u.x = x;
26 for (i = 0; i < sizeof (v) / sizeof (v[0]); i++)
27 if (i == j)
29 if (v[i] != u.i[i])
31 #ifdef DEBUG
32 printf ("%i: 0x%llx != 0x%llx\n", i, v[i], u.i[i]);
33 #endif
34 abort ();
37 else if (u.i[i] != 0)
39 #ifdef DEBUG
40 printf ("%i: 0x%llx != 0\n", i, u.i[i]);
41 #endif
42 abort ();
46 static void
47 __attribute__((noinline))
48 test (unsigned long long *v)
50 __m128i x;
52 x = _mm_set_epi64x (0, v[0]);
53 check (x, v, 0);
54 x = _mm_set_epi64x (v[1], 0);
55 check (x, v, 1);
58 static void
59 sse2_test (void)
61 unsigned long long v[2]
62 = { 0x7B5B546573745665LL, 0x63746F725D53475DLL };
63 test (v);