Merged with mainline at revision 128810.
[official-gcc.git] / gcc / testsuite / gcc.target / i386 / sse-11.c
blob3745dbf7f6022595e241b5e579c154db5ca6bb91
1 /* PR rtl-optimization/21239 */
2 /* { dg-do run } */
3 /* { dg-options "-O2 -msse2" } */
5 #include "sse2-check.h"
7 #include <emmintrin.h>
9 void
10 foo (unsigned int x, double *y, const double *z)
12 __m128d tmp;
13 while (x)
15 tmp = _mm_load_sd (z);
16 _mm_store_sd (y, tmp);
17 --x; ++z; ++y;
21 void
22 bar (unsigned int x, float *y, const float *z)
24 __m128 tmp;
25 unsigned int i;
26 for (i = 0; i < x; ++i)
28 tmp = (__m128) { *z, 0, 0, 0 };
29 *y = __builtin_ia32_vec_ext_v4sf (tmp, 0);
30 ++z; ++y;
32 for (i = 0; i < x; ++i)
34 tmp = (__m128) { 0, *z, 0, 0 };
35 *y = __builtin_ia32_vec_ext_v4sf (tmp, 1);
36 ++z; ++y;
38 for (i = 0; i < x; ++i)
40 tmp = (__m128) { 0, 0, *z, 0 };
41 *y = __builtin_ia32_vec_ext_v4sf (tmp, 2);
42 ++z; ++y;
44 for (i = 0; i < x; ++i)
46 tmp = (__m128) { 0, 0, 0, *z };
47 *y = __builtin_ia32_vec_ext_v4sf (tmp, 3);
48 ++z; ++y;
52 static void
53 sse2_test (void)
55 unsigned int i;
56 double a[16], b[16];
57 float c[16], d[16];
58 for (i = 0; i < 16; ++i)
60 a[i] = 1;
61 b[i] = 2;
62 c[i] = 3;
63 d[i] = 4;
65 foo (16, a, b);
66 bar (4, c, d);
67 for (i = 0; i < 16; ++i)
69 if (a[i] != 2)
70 abort ();
71 if (c[i] != 4)
72 abort ();