Remove old autovect-branch by moving to "dead" directory.
[official-gcc.git] / old-autovect-branch / gcc / testsuite / gcc.dg / vmx / x-04.c
blob44694c8a6d5dd5932962099148483ec5299330d6
1 #include <altivec.h>
2 vector unsigned char
3 permute_128(vector unsigned char input)
5 vector unsigned char result, new_bit;
7 vector unsigned char select2 = ((vector unsigned char){2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2});
8 vector unsigned char select3 = ((vector unsigned char){4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4});
9 vector unsigned char select4 = ((vector unsigned char){8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8});
10 vector unsigned char select5 = ((vector unsigned char){16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16});
11 vector unsigned char select6 = ((vector unsigned char){32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32});
12 vector unsigned char select7 = ((vector unsigned char){64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64});
13 vector unsigned char select8 = ((vector unsigned char){128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128});
15 vector unsigned char control1
16 = ((vector unsigned char){15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0});
17 vector unsigned char control2
18 = ((vector unsigned char){15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0});
19 vector unsigned char control3
20 = ((vector unsigned char){15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0});
21 vector unsigned char control4
22 = ((vector unsigned char){15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0});
23 vector unsigned char control5
24 = ((vector unsigned char){15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0});
25 vector unsigned char control6
26 = ((vector unsigned char){15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0});
27 vector unsigned char control7
28 = ((vector unsigned char){15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0});
29 vector unsigned char control8
30 = ((vector unsigned char){15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0});
31 vector unsigned char rotate1 = ((vector unsigned char){1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1});
32 vector unsigned char rotate2 = ((vector unsigned char){3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3});
33 vector unsigned char rotate3 = ((vector unsigned char){5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5});
34 vector unsigned char rotate4 = ((vector unsigned char){7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7});
35 vector unsigned char rotate5 = ((vector unsigned char){1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1});
36 vector unsigned char rotate6 = ((vector unsigned char){3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3});
37 vector unsigned char rotate7 = ((vector unsigned char){5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5});
38 vector unsigned char rotate8 = ((vector unsigned char){7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7});
40 result = vec_vperm(input, input, control1);
41 result = vec_rl(result, rotate1);
43 new_bit = vec_vperm(input, input, control2);
44 new_bit = vec_rl(new_bit, rotate2);
45 result = vec_sel(result, new_bit, select2);
47 new_bit = vec_vperm(input, input, control3);
48 new_bit = vec_rl(new_bit, rotate3);
49 result = vec_sel(result, new_bit, select3);
51 new_bit = vec_vperm(input, input, control4);
52 new_bit = vec_rl(new_bit, rotate4);
53 result = vec_sel(result, new_bit, select4);
55 new_bit = vec_vperm(input, input, control5);
56 new_bit = vec_rl(new_bit, rotate5);
57 result = vec_sel(result, new_bit, select5);
59 new_bit = vec_vperm(input, input, control6);
60 new_bit = vec_rl(new_bit, rotate6);
61 result = vec_sel(result, new_bit, select6);
63 new_bit = vec_vperm(input, input, control7);
64 new_bit = vec_rl(new_bit, rotate7);
65 result = vec_sel(result, new_bit, select7);
67 new_bit = vec_vperm(input, input, control8);
68 new_bit = vec_rl(new_bit, rotate8);
69 result = vec_sel(result, new_bit, select8);
71 return result;
74 int main()
76 vector unsigned char input
77 = ((vector unsigned char){0,1,2,4,8,16,32,64,128,0,1,2,4,8,16,32});
78 vector unsigned char result = permute_128(input);
79 return 0;