gcc:
[official-gcc.git] / gcc / testsuite / gcc.dg / vmx / ste-be-order.c
blob75f2004f37217e89384314e71203b591958db442
1 /* { dg-options "-maltivec=be -mabi=altivec -std=gnu99 -mno-vsx" } */
3 #include "harness.h"
5 static unsigned char svuc[16] __attribute__ ((aligned (16)));
6 static signed char svsc[16] __attribute__ ((aligned (16)));
7 static unsigned short svus[8] __attribute__ ((aligned (16)));
8 static signed short svss[8] __attribute__ ((aligned (16)));
9 static unsigned int svui[4] __attribute__ ((aligned (16)));
10 static signed int svsi[4] __attribute__ ((aligned (16)));
11 static float svf[4] __attribute__ ((aligned (16)));
13 static void check_arrays ()
15 check (svuc[9] == 9, "svuc");
16 check (svsc[14] == 6, "svsc");
17 check (svus[7] == 7, "svus");
18 check (svss[1] == -3, "svss");
19 check (svui[3] == 3, "svui");
20 check (svsi[2] == 0, "svsi");
21 check (svf[0] == 0.0, "svf");
24 static void test ()
26 #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
27 vector unsigned char vuc = {15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0};
28 vector signed char vsc = {7,6,5,4,3,2,1,0,-1,-2,-3,-4,-5,-6,-7,-8};
29 vector unsigned short vus = {7,6,5,4,3,2,1,0};
30 vector signed short vss = {3,2,1,0,-1,-2,-3,-4};
31 vector unsigned int vui = {3,2,1,0};
32 vector signed int vsi = {1,0,-1,-2};
33 vector float vf = {3.0,2.0,1.0,0.0};
34 #else
35 vector unsigned char vuc = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
36 vector signed char vsc = {-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7};
37 vector unsigned short vus = {0,1,2,3,4,5,6,7};
38 vector signed short vss = {-4,-3,-2,-1,0,1,2,3};
39 vector unsigned int vui = {0,1,2,3};
40 vector signed int vsi = {-2,-1,0,1};
41 vector float vf = {0.0,1.0,2.0,3.0};
42 #endif
44 vec_ste (vuc, 9*1, (unsigned char *)svuc);
45 vec_ste (vsc, 14*1, (signed char *)svsc);
46 vec_ste (vus, 7*2, (unsigned short *)svus);
47 vec_ste (vss, 1*2, (signed short *)svss);
48 vec_ste (vui, 3*4, (unsigned int *)svui);
49 vec_ste (vsi, 2*4, (signed int *)svsi);
50 vec_ste (vf, 0*4, (float *)svf);
52 check_arrays ();