Merge from trunk
[official-gcc.git] / gcc / testsuite / gcc.dg / vmx / unpack.c
blob3c13163cb7b0bfcd8bf292b879fe9736b6f59131
1 #include "harness.h"
3 #define BIG 4294967295
5 static void test()
7 /* Input vectors. */
8 vector signed char vsc = {-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7};
9 vector bool char vbc = {0,255,255,0,0,0,255,0,255,0,0,255,255,255,0,255};
10 vector pixel vp = {(0<<15) + (1<<10) + (2<<5) + 3,
11 (1<<15) + (4<<10) + (5<<5) + 6,
12 (0<<15) + (7<<10) + (8<<5) + 9,
13 (1<<15) + (10<<10) + (11<<5) + 12,
14 (1<<15) + (13<<10) + (14<<5) + 15,
15 (0<<15) + (16<<10) + (17<<5) + 18,
16 (1<<15) + (19<<10) + (20<<5) + 21,
17 (0<<15) + (22<<10) + (23<<5) + 24};
18 vector signed short vss = {-4,-3,-2,-1,0,1,2,3};
19 vector bool short vbs = {0,65535,65535,0,0,0,65535,0};
21 /* Result vectors. */
22 vector signed short vsch, vscl;
23 vector bool short vbsh, vbsl;
24 vector unsigned int vuih, vuil;
25 vector signed int vsih, vsil;
26 vector bool int vbih, vbil;
28 /* Expected result vectors. */
29 vector signed short vschr = {-8,-7,-6,-5,-4,-3,-2,-1};
30 vector signed short vsclr = {0,1,2,3,4,5,6,7};
31 vector bool short vbshr = {0,65535,65535,0,0,0,65535,0};
32 vector bool short vbslr = {65535,0,0,65535,65535,65535,0,65535};
33 vector unsigned int vuihr = {(0<<24) + (1<<16) + (2<<8) + 3,
34 (65535<<24) + (4<<16) + (5<<8) + 6,
35 (0<<24) + (7<<16) + (8<<8) + 9,
36 (65535<<24) + (10<<16) + (11<<8) + 12};
37 vector unsigned int vuilr = {(65535<<24) + (13<<16) + (14<<8) + 15,
38 (0<<24) + (16<<16) + (17<<8) + 18,
39 (65535<<24) + (19<<16) + (20<<8) + 21,
40 (0<<24) + (22<<16) + (23<<8) + 24};
41 vector signed int vsihr = {-4,-3,-2,-1};
42 vector signed int vsilr = {0,1,2,3};
43 vector bool int vbihr = {0,BIG,BIG,0};
44 vector bool int vbilr = {0,0,BIG,0};
46 vsch = vec_unpackh (vsc);
47 vscl = vec_unpackl (vsc);
48 vbsh = vec_unpackh (vbc);
49 vbsl = vec_unpackl (vbc);
50 vuih = vec_unpackh (vp);
51 vuil = vec_unpackl (vp);
52 vsih = vec_unpackh (vss);
53 vsil = vec_unpackl (vss);
54 vbih = vec_unpackh (vbs);
55 vbil = vec_unpackl (vbs);
57 check (vec_all_eq (vsch, vschr), "vsch");
58 check (vec_all_eq (vscl, vsclr), "vscl");
59 check (vec_all_eq (vbsh, vbshr), "vbsh");
60 check (vec_all_eq (vbsl, vbslr), "vbsl");
61 check (vec_all_eq (vuih, vuihr), "vuih");
62 check (vec_all_eq (vuil, vuilr), "vuil");
63 check (vec_all_eq (vsih, vsihr), "vsih");
64 check (vec_all_eq (vsil, vsilr), "vsil");
65 check (vec_all_eq (vbih, vbihr), "vbih");
66 check (vec_all_eq (vbil, vbilr), "vbil");