2015-05-04 Sandra Loosemore <sandra@codesourcery.com>
[official-gcc.git] / gcc / testsuite / gcc.dg / vmx / st.c
blob3339b728314474fcf69736bf83d65d366d8a43ad
1 #include "harness.h"
3 static unsigned char svuc[16] __attribute__ ((aligned (16)));
4 static signed char svsc[16] __attribute__ ((aligned (16)));
5 static unsigned char svbc[16] __attribute__ ((aligned (16)));
6 static unsigned short svus[8] __attribute__ ((aligned (16)));
7 static signed short svss[8] __attribute__ ((aligned (16)));
8 static unsigned short svbs[8] __attribute__ ((aligned (16)));
9 static unsigned short svp[8] __attribute__ ((aligned (16)));
10 static unsigned int svui[4] __attribute__ ((aligned (16)));
11 static signed int svsi[4] __attribute__ ((aligned (16)));
12 static unsigned int svbi[4] __attribute__ ((aligned (16)));
13 static float svf[4] __attribute__ ((aligned (16)));
15 static void check_arrays ()
17 unsigned int i;
18 for (i = 0; i < 16; ++i)
20 check (svuc[i] == i, "svuc");
21 check (svsc[i] == i - 8, "svsc");
22 check (svbc[i] == ((i % 2) ? 0xff : 0), "svbc");
24 for (i = 0; i < 8; ++i)
26 check (svus[i] == i, "svus");
27 check (svss[i] == i - 4, "svss");
28 check (svbs[i] == ((i % 2) ? 0xffff : 0), "svbs");
29 check (svp[i] == i, "svp");
31 for (i = 0; i < 4; ++i)
33 check (svui[i] == i, "svui");
34 check (svsi[i] == i - 2, "svsi");
35 check (svbi[i] == ((i % 2) ? 0xffffffff : 0), "svbi");
36 check (svf[i] == i * 1.0f, "svf");
40 static void test ()
42 vector unsigned char vuc = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
43 vector signed char vsc = {-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7};
44 vector bool char vbc = {0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255};
45 vector unsigned short vus = {0,1,2,3,4,5,6,7};
46 vector signed short vss = {-4,-3,-2,-1,0,1,2,3};
47 vector bool short vbs = {0,65535,0,65535,0,65535,0,65535};
48 vector pixel vp = {0,1,2,3,4,5,6,7};
49 vector unsigned int vui = {0,1,2,3};
50 vector signed int vsi = {-2,-1,0,1};
51 vector bool int vbi = {0,0xffffffff,0,0xffffffff};
52 vector float vf = {0.0,1.0,2.0,3.0};
54 vec_st (vuc, 0, (vector unsigned char *)svuc);
55 vec_st (vsc, 0, (vector signed char *)svsc);
56 vec_st (vbc, 0, (vector bool char *)svbc);
57 vec_st (vus, 0, (vector unsigned short *)svus);
58 vec_st (vss, 0, (vector signed short *)svss);
59 vec_st (vbs, 0, (vector bool short *)svbs);
60 vec_st (vp, 0, (vector pixel *)svp);
61 vec_st (vui, 0, (vector unsigned int *)svui);
62 vec_st (vsi, 0, (vector signed int *)svsi);
63 vec_st (vbi, 0, (vector bool int *)svbi);
64 vec_st (vf, 0, (vector float *)svf);
66 check_arrays ();