1 /* Disable warnings to squelch deprecation message about -maltivec=be. */
2 /* { dg-options "-w -maltivec=be -mabi=altivec -std=gnu99 -mno-vsx -Wno-shift-overflow" } */
3
4 #include "harness.h"
5
6 #define BIG 4294967295
7
test()8 static void test()
9 {
10 /* Input vectors. */
11 vector signed char vsc = {-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7};
12 vector bool char vbc = {0,255,255,0,0,0,255,0,255,0,0,255,255,255,0,255};
13 vector pixel vp = {(0<<15) + (1<<10) + (2<<5) + 3,
14 (1<<15) + (4<<10) + (5<<5) + 6,
15 (0<<15) + (7<<10) + (8<<5) + 9,
16 (1<<15) + (10<<10) + (11<<5) + 12,
17 (1<<15) + (13<<10) + (14<<5) + 15,
18 (0<<15) + (16<<10) + (17<<5) + 18,
19 (1<<15) + (19<<10) + (20<<5) + 21,
20 (0<<15) + (22<<10) + (23<<5) + 24};
21 vector signed short vss = {-4,-3,-2,-1,0,1,2,3};
22 vector bool short vbs = {0,65535,65535,0,0,0,65535,0};
23
24 /* Result vectors. */
25 vector signed short vsch, vscl;
26 vector bool short vbsh, vbsl;
27 vector unsigned int vuih, vuil;
28 vector signed int vsih, vsil;
29 vector bool int vbih, vbil;
30
31 /* Expected result vectors. */
32 #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
33 vector signed short vschr = {0,1,2,3,4,5,6,7};
34 vector signed short vsclr = {-8,-7,-6,-5,-4,-3,-2,-1};
35 vector bool short vbshr = {65535,0,0,65535,65535,65535,0,65535};
36 vector bool short vbslr = {0,65535,65535,0,0,0,65535,0};
37 vector unsigned int vuihr = {(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 unsigned int vuilr = {(0<<24) + (1<<16) + (2<<8) + 3,
42 (65535<<24) + (4<<16) + (5<<8) + 6,
43 (0<<24) + (7<<16) + (8<<8) + 9,
44 (65535<<24) + (10<<16) + (11<<8) + 12};
45 vector signed int vsihr = {0,1,2,3};
46 vector signed int vsilr = {-4,-3,-2,-1};
47 vector bool int vbihr = {0,0,BIG,0};
48 vector bool int vbilr = {0,BIG,BIG,0};
49 #else
50 vector signed short vschr = {-8,-7,-6,-5,-4,-3,-2,-1};
51 vector signed short vsclr = {0,1,2,3,4,5,6,7};
52 vector bool short vbshr = {0,65535,65535,0,0,0,65535,0};
53 vector bool short vbslr = {65535,0,0,65535,65535,65535,0,65535};
54 vector unsigned int vuihr = {(0<<24) + (1<<16) + (2<<8) + 3,
55 (65535<<24) + (4<<16) + (5<<8) + 6,
56 (0<<24) + (7<<16) + (8<<8) + 9,
57 (65535<<24) + (10<<16) + (11<<8) + 12};
58 vector unsigned int vuilr = {(65535<<24) + (13<<16) + (14<<8) + 15,
59 (0<<24) + (16<<16) + (17<<8) + 18,
60 (65535<<24) + (19<<16) + (20<<8) + 21,
61 (0<<24) + (22<<16) + (23<<8) + 24};
62 vector signed int vsihr = {-4,-3,-2,-1};
63 vector signed int vsilr = {0,1,2,3};
64 vector bool int vbihr = {0,BIG,BIG,0};
65 vector bool int vbilr = {0,0,BIG,0};
66 #endif
67
68 vsch = vec_unpackh (vsc);
69 vscl = vec_unpackl (vsc);
70 vbsh = vec_unpackh (vbc);
71 vbsl = vec_unpackl (vbc);
72 vuih = vec_unpackh (vp);
73 vuil = vec_unpackl (vp);
74 vsih = vec_unpackh (vss);
75 vsil = vec_unpackl (vss);
76 vbih = vec_unpackh (vbs);
77 vbil = vec_unpackl (vbs);
78
79 check (vec_all_eq (vsch, vschr), "vsch");
80 check (vec_all_eq (vscl, vsclr), "vscl");
81 check (vec_all_eq (vbsh, vbshr), "vbsh");
82 check (vec_all_eq (vbsl, vbslr), "vbsl");
83 check (vec_all_eq (vuih, vuihr), "vuih");
84 check (vec_all_eq (vuil, vuilr), "vuil");
85 check (vec_all_eq (vsih, vsihr), "vsih");
86 check (vec_all_eq (vsil, vsilr), "vsil");
87 check (vec_all_eq (vbih, vbihr), "vbih");
88 check (vec_all_eq (vbil, vbilr), "vbil");
89 }
90