Merge from trunk
[official-gcc.git] / gcc / testsuite / gcc.dg / vmx / lde-be-order.c
blob9a6d5bae52df148be9e2cb2ac52c5c34b41d29dd
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 init ()
15 int i;
16 #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
17 for (i = 15; i >= 0; --i)
18 #else
19 for (i = 0; i < 16; ++i)
20 #endif
22 svuc[i] = i;
23 svsc[i] = i - 8;
25 #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
26 for (i = 7; i >= 0; --i)
27 #else
28 for (i = 0; i < 8; ++i)
29 #endif
31 svus[i] = i;
32 svss[i] = i - 4;
34 #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
35 for (i = 3; i >= 0; --i)
36 #else
37 for (i = 0; i < 4; ++i)
38 #endif
40 svui[i] = i;
41 svsi[i] = i - 2;
42 svf[i] = i * 1.0f;
46 static void test ()
48 vector unsigned char vuc;
49 vector signed char vsc;
50 vector unsigned short vus;
51 vector signed short vss;
52 vector unsigned int vui;
53 vector signed int vsi;
54 vector float vf;
56 init ();
58 vuc = vec_lde (9*1, (unsigned char *)svuc);
59 vsc = vec_lde (14*1, (signed char *)svsc);
60 vus = vec_lde (7*2, (unsigned short *)svus);
61 vss = vec_lde (1*2, (signed short *)svss);
62 vui = vec_lde (3*4, (unsigned int *)svui);
63 vsi = vec_lde (2*4, (signed int *)svsi);
64 vf = vec_lde (0*4, (float *)svf);
66 check (vec_extract (vuc, 9) == 9, "vuc");
67 check (vec_extract (vsc, 14) == 6, "vsc");
68 check (vec_extract (vus, 7) == 7, "vus");
69 check (vec_extract (vss, 1) == -3, "vss");
70 check (vec_extract (vui, 3) == 3, "vui");
71 check (vec_extract (vsi, 2) == 0, "vsi");
72 check (vec_extract (vf, 0) == 0.0, "vf");