libcpp, c, middle-end: Optimize initializers using #embed in C
[official-gcc.git] / gcc / testsuite / gcc.dg / vmx / splat-vsx.c
blob9ea38ed7df1859aaf1abf8e12227b57889a32d34
1 /* { dg-skip-if "" { powerpc*-*-darwin* } } */
2 /* { dg-options "-maltivec -mabi=altivec -std=gnu99 -mvsx" } */
3 /* { dg-require-effective-target powerpc_vsx } */
5 #include "harness.h"
7 static void test()
9 /* Input vectors. */
10 vector unsigned int vui = {0,1,2,3};
11 vector signed int vsi = {-2,-1,0,1};
12 vector float vf = {-2.0,-1.0,0.0,1.0};
14 /* Result vectors. */
15 vector unsigned int vuir;
16 vector signed int vsir;
17 vector float vfr;
19 /* Expected result vectors. */
20 vector unsigned int vuier = {2,2,2,2};
21 vector signed int vsier = {1,1,1,1};
22 vector float vfer = {-1.0,-1.0,-1.0,-1.0};
24 vuir = vec_splat (vui, 2);
25 vsir = vec_splat (vsi, 3);
26 vfr = vec_splat (vf, 1);
28 check (vec_all_eq (vuir, vuier), "vui");
29 check (vec_all_eq (vsir, vsier), "vsi");
30 check (vec_all_eq (vfr, vfer ), "vf");