Remove old autovect-branch by moving to "dead" directory.
[official-gcc.git] / old-autovect-branch / gcc / testsuite / gcc.dg / vmx / x-05.c
blob80c13dcf04edd2b686b1c6864478dd7cbd6bc69a
1 #include <altivec.h>
3 static vector unsigned char select2 = {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2};
4 static vector unsigned char select3 = {4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4};
5 static vector unsigned char select4 = {8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8};
6 static vector unsigned char select5 = {16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16};
7 static vector unsigned char select6 = {32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32};
8 static vector unsigned char select7 = {64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64};
9 static vector unsigned char select8 = {128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128};
11 static vector unsigned char control1
12 = {15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0};
13 static vector unsigned char control2
14 = {15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0};
15 static vector unsigned char control3
16 = {15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0};
17 static vector unsigned char control4
18 = {15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0};
19 static vector unsigned char control5
20 = {15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0};
21 static vector unsigned char control6
22 = {15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0};
23 static vector unsigned char control7
24 = {15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0};
25 static vector unsigned char control8
26 = {15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0};
27 static vector unsigned char rotate1 = {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1};
28 static vector unsigned char rotate2 = {3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3};
29 static vector unsigned char rotate3 = {5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5};
30 static vector unsigned char rotate4 = {7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7};
31 static vector unsigned char rotate5 = {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1};
32 static vector unsigned char rotate6 = {3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3};
33 static vector unsigned char rotate7 = {5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5};
34 static vector unsigned char rotate8 = {7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7};
36 static vector unsigned char permute_128(vector unsigned char input)
38 vector unsigned char result, new_bit;
40 /* and now the code */
41 result = vec_vperm(input, input, control1);
42 result = vec_rl(result, rotate1);
44 new_bit = vec_vperm(input, input, control2);
45 new_bit = vec_rl(new_bit, rotate2);
46 result = vec_sel(result, new_bit, select2);
48 new_bit = vec_vperm(input, input, control3);
49 new_bit = vec_rl(new_bit, rotate3);
50 result = vec_sel(result, new_bit, select3);
52 new_bit = vec_vperm(input, input, control4);
53 new_bit = vec_rl(new_bit, rotate4);
54 result = vec_sel(result, new_bit, select4);
56 new_bit = vec_vperm(input, input, control5);
57 new_bit = vec_rl(new_bit, rotate5);
58 result = vec_sel(result, new_bit, select5);
60 new_bit = vec_vperm(input, input, control6);
61 new_bit = vec_rl(new_bit, rotate6);
62 result = vec_sel(result, new_bit, select6);
64 new_bit = vec_vperm(input, input, control7);
65 new_bit = vec_rl(new_bit, rotate7);
66 result = vec_sel(result, new_bit, select7);
68 new_bit = vec_vperm(input, input, control8);
69 new_bit = vec_rl(new_bit, rotate8);
70 result = vec_sel(result, new_bit, select8);
72 return result;
75 int main()
77 vector unsigned char input
78 = {0,1,2,4,8,16,32,64,128,0,1,2,4,8,16,32};
79 vector unsigned char result = permute_128(input);
80 return 0;