1 #include <altivec.h>
2
3 typedef union
4 {
5 unsigned int i;
6 float f;
7 } U32b;
8
9 typedef union
10 {
11 unsigned long long i;
12 double f;
13 } U64b;
14
15 __attribute__ ((noipa))
16 vector unsigned char
17 test1 ()
18 {
19 vector unsigned char v = {0xd, 0xd, 0xd, 0xd, 0xd, 0xd, 0xd, 0xd,
20 0xd, 0xd, 0xd, 0xd, 0xd, 0xd, 0xd, 0xd};
21 vector unsigned char res = vec_sld (v, v, 3);
22 return res;
23 }
24
25 __attribute__ ((noipa))
26 vector signed short
27 test2 ()
28 {
29 vector signed short v
30 = {0x7777, 0x7777, 0x7777, 0x7777, 0x7777, 0x7777, 0x7777, 0x7777};
31 vector signed short res = vec_sld (v, v, 5);
32 return res;
33 }
34
35 __attribute__ ((noipa))
36 vector signed int
37 test3 ()
38 {
39 vector signed int v = {0xbbbbbbbb, 0xbbbbbbbb, 0xbbbbbbbb, 0xbbbbbbbb};
40 vector signed int res = vec_sld (v, v, 7);
41 return res;
42 }
43
44 __attribute__ ((noipa))
45 vector unsigned int
46 test4 ()
47 {
48 vector unsigned int v = {0x07070707, 0x07070707, 0x07070707, 0x07070707};
49 vector unsigned int res = vec_sld (v, v, 9);
50 return res;
51 }
52
53 __attribute__ ((noipa))
54 vector unsigned long long
55 test5 ()
56 {
57 vector unsigned long long v = {0x4545454545454545ll, 0x4545454545454545ll};
58 vector unsigned long long res = vec_sld (v, v, 10);
59 return res;
60 }
61
62 __attribute__ ((noipa))
63 vector float
64 test6 ()
65 {
66 U32b u;
67 u.i = 0x17171717;
68 vector float vf = {u.f, u.f, u.f, u.f};
69 vector float res = vec_sld (vf, vf, 11);
70 return res;
71 }
72
73 __attribute__ ((noipa))
74 vector double
75 test7 ()
76 {
77 U64b u;
78 u.i = 0x5454545454545454ll;
79 vector double vf = {u.f, u.f};
80 vector double res = vec_sld (vf, vf, 13);
81 return res;
82 }
83