1 /* { dg-do compile } */
2 /* { dg-options "-O2 -msse3 -fno-expensive-optimizations" } */
3 
4 typedef double __m128d __attribute__ ((__vector_size__ (16)));
5 
6 extern double p1[];
7 extern double p2[];
8 extern double ck[];
9 extern int n;
10 
chk_pd(double * v1,double * v2)11 __attribute__((__noinline__, __noclone__)) int chk_pd (double *v1, double *v2)
12 {
13   return v2[n] != v1[n];
14 }
15 
sse3_test_movddup_reg_subsume_ldsd(double * i1,double * r)16 static inline void sse3_test_movddup_reg_subsume_ldsd (double *i1, double *r)
17 {
18   __m128d t1 = (__m128d){*i1, 0};
19   __m128d t2 = __builtin_ia32_shufpd (t1, t1, 0);
20   __builtin_ia32_storeupd (r, t2);
21 }
22 
sse3_test(void)23 int sse3_test (void)
24 {
25   int i = 0;
26   int fail = 0;
27   for (; i < 80; i += 1)
28     {
29       ck[0] = p1[0];
30       fail += chk_pd (ck, p2);
31       sse3_test_movddup_reg_subsume_ldsd (p1, p2);
32     }
33   return fail;
34 }
35