OSDN Git Service

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