Remove old autovect-branch by moving to "dead" directory.
[official-gcc.git] / old-autovect-branch / gcc / testsuite / gcc.target / i386 / sse-11.c
blob3ec5e7bb12481d4eb1d280b58791b0cf66b81c3c
1 /* PR rtl-optimization/21239 */
2 /* { dg-do run { target i?86-*-* x86_64-*-* } } */
3 /* { dg-options "-O2 -msse2" } */
4 #include <emmintrin.h>
5 #include "../../gcc.dg/i386-cpuid.h"
7 extern void abort (void);
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 void __attribute__((noinline))
53 run_tests (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 ();
76 int
77 main ()
79 unsigned long cpu_facilities;
80 unsigned int i;
81 double a[19], b[19];
83 cpu_facilities = i386_cpuid ();
85 if ((cpu_facilities & (bit_MMX | bit_SSE | bit_SSE2 | bit_CMOV))
86 != (bit_MMX | bit_SSE | bit_SSE2 | bit_CMOV))
87 /* If host has no vector support, pass. */
88 return 0;
90 run_tests ();
91 return 0;