svn merge -r102224:107263 svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-3_4-branch
[official-gcc.git] / gcc / testsuite / gcc.dg / i386-sse-11.c
blob2ea4006164d10c209b0db4be7af66df825f46db6
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 "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 __attribute__((noinline))
22 run_tests (void)
24 unsigned int i;
25 double a[16], b[16];
26 for (i = 0; i < 16; ++i)
28 a[i] = 1;
29 b[i] = 2;
31 foo (16, a, b);
32 for (i = 0; i < 16; ++i)
34 if (a[i] != 2)
35 abort ();
39 int
40 main ()
42 unsigned long cpu_facilities;
43 unsigned int i;
44 double a[19], b[19];
46 cpu_facilities = i386_cpuid ();
48 if ((cpu_facilities & (bit_MMX | bit_SSE | bit_SSE2 | bit_CMOV))
49 != (bit_MMX | bit_SSE | bit_SSE2 | bit_CMOV))
50 /* If host has no vector support, pass. */
51 return 0;
53 run_tests ();
54 return 0;