1 /* { dg-do run { target lp64 } } */
2 /* { dg-require-effective-target vsx_hw } */
3 /* { dg-options "-O2 -mvsx" } */
9 #define ELEMENTS -12345.0, 23456.0
12 vector
double sv
= (vector
double) { ELEMENTS
};
13 vector
double splat
= (vector
double) { SPLAT
, SPLAT
};
14 vector
double sv_global
, sp_global
;
15 static vector
double sv_static
, sp_static
;
16 static const int expected
[] = { ELEMENTS
};
18 extern void check (vector
double a
)
19 __attribute__((__noinline__
));
21 extern void check_splat (vector
double a
)
22 __attribute__((__noinline__
));
24 extern vector
double pack_reg (double a
, double b
)
25 __attribute__((__noinline__
));
27 extern vector
double pack_from_ptr (double *p_a
, double *p_b
)
28 __attribute__((__noinline__
));
30 extern vector
double pack_const (void)
31 __attribute__((__noinline__
));
33 extern void pack_ptr (vector
double *p
, double a
, double b
)
34 __attribute__((__noinline__
));
36 extern void pack_static (double a
, double b
)
37 __attribute__((__noinline__
));
39 extern void pack_global (double a
, double b
)
40 __attribute__((__noinline__
));
42 extern vector
double splat_reg (double a
)
43 __attribute__((__noinline__
));
45 extern vector
double splat_from_ptr (double *p
)
46 __attribute__((__noinline__
));
48 extern vector
double splat_const (void)
49 __attribute__((__noinline__
));
51 extern void splat_ptr (vector
double *p
, double a
)
52 __attribute__((__noinline__
));
54 extern void splat_static (double a
)
55 __attribute__((__noinline__
));
57 extern void splat_global (double a
)
58 __attribute__((__noinline__
));
61 check (vector
double a
)
65 for (i
= 0; i
< 2; i
++)
66 if (vec_extract (a
, i
) != expected
[i
])
71 check_splat (vector
double a
)
75 for (i
= 0; i
< 2; i
++)
76 if (vec_extract (a
, i
) != SPLAT
)
81 pack_reg (double a
, double b
)
83 return (vector
double) { a
, b
};
87 pack_from_ptr (double *p_a
, double *p_b
)
89 return (vector
double) { *p_a
, *p_b
};
95 return (vector
double) { ELEMENTS
};
99 pack_ptr (vector
double *p
, double a
, double b
)
101 *p
= (vector
double) { a
, b
};
105 pack_static (double a
, double b
)
107 sv_static
= (vector
double) { a
, b
};
111 pack_global (double a
, double b
)
113 sv_global
= (vector
double) { a
, b
};
119 return (vector
double) { a
, a
};
123 splat_from_ptr (double *p
)
125 return (vector
double) { *p
, *p
};
131 return (vector
double) { SPLAT
, SPLAT
};
135 splat_ptr (vector
double *p
, double a
)
137 *p
= (vector
double) { a
, a
};
141 splat_static (double a
)
143 sp_static
= (vector
double) { a
, a
};
147 splat_global (double a
)
149 sp_global
= (vector
double) { a
, a
};
154 vector
double sv2
, sv3
;
156 double mem2
[2] = { ELEMENTS
};
160 check (pack_reg (ELEMENTS
));
162 check (pack_from_ptr (&mem2
[0], &mem2
[1]));
164 check (pack_const ());
166 pack_ptr (&sv2
, ELEMENTS
);
169 pack_static (ELEMENTS
);
172 pack_global (ELEMENTS
);
177 check_splat (splat_reg (SPLAT
));
179 check_splat (splat_from_ptr (&mem
));
181 check_splat (splat_const ());
183 splat_ptr (&sv2
, SPLAT
);
186 splat_static (SPLAT
);
187 check_splat (sp_static
);
189 splat_global (SPLAT
);
190 check_splat (sp_global
);