Merge from mainline
[official-gcc.git] / gcc / testsuite / gcc.target / i386 / sse-17.c
blob86d22c42c533a67f537e8ed3c4f7b5207a6dc831
1 /* { dg-do run { target i?86-*-* x86_64-*-* } } */
2 /* { dg-options "-O2 -msse2" } */
3 #include <xmmintrin.h>
4 extern void abort();
5 int untrue = 0;
6 typedef union {
7 __v4sf v;
8 float f[4];
9 } u;
10 void foo (u, u) __attribute__((noinline));
11 void foo (u a, u b) {
12 if (b.f[0] != 7.0 || b.f[1] != 8.0 || b.f[2] != 3.0 || b.f[3] != 4.0)
13 abort();
15 void bar (__v4sf, __v4sf) __attribute__((noinline));
16 void bar (__v4sf a __attribute((unused)), __v4sf b __attribute((unused))) { untrue = 0;}
17 __v4sf setupa () __attribute((noinline));
18 __v4sf setupa () { __v4sf t = { 1.0, 2.0, 3.0, 4.0 }; return t; }
19 __v4sf setupb () __attribute((noinline));
20 __v4sf setupb () { __v4sf t = { 5.0, 6.0, 7.0, 8.0 }; return t; }
21 main() {
22 u a, b;
23 a.v = setupa ();
24 b.v = setupb ();
25 if (untrue)
26 bar(a.v, b.v);
27 b.v = (__v4sf) _mm_movehl_ps ((__m128)a.v, (__m128)b.v);
28 foo (a, b);
29 return 0;