1 ------------------------------------------------------------------------------
3 -- GNAT COMPILER COMPONENTS --
5 -- G N A T . A L T I V E C . L O W _ L E V E L _ I N T E R F A C E --
9 -- Copyright (C) 2004-2015, Free Software Foundation, Inc. --
11 -- GNAT is free software; you can redistribute it and/or modify it under --
12 -- terms of the GNU General Public License as published by the Free Soft- --
13 -- ware Foundation; either version 3, or (at your option) any later ver- --
14 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
15 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
16 -- or FITNESS FOR A PARTICULAR PURPOSE. --
18 -- As a special exception under Section 7 of GPL version 3, you are granted --
19 -- additional permissions described in the GCC Runtime Library Exception, --
20 -- version 3.1, as published by the Free Software Foundation. --
22 -- You should have received a copy of the GNU General Public License and --
23 -- a copy of the GCC Runtime Library Exception along with this program; --
24 -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
25 -- <http://www.gnu.org/licenses/>. --
27 -- GNAT was originally developed by the GNAT team at New York University. --
28 -- Extensive contributions were provided by Ada Core Technologies Inc. --
30 ------------------------------------------------------------------------------
32 -- This unit provides entities to be used internally by the units common to
33 -- both bindings (Hard or Soft), and relevant to the interfacing with the
34 -- underlying Low Level support.
36 with GNAT.Altivec.Vector_Types; use GNAT.Altivec.Vector_Types;
37 with GNAT.Altivec.Low_Level_Vectors; use GNAT.Altivec.Low_Level_Vectors;
39 with Ada.Unchecked_Conversion;
41 package GNAT.Altivec.Low_Level_Interface is
43 -----------------------------------------
44 -- Conversions between low level types --
45 -----------------------------------------
47 function To_LL_VBC is new Ada.Unchecked_Conversion (LL_VBC, LL_VBC);
48 function To_LL_VBC is new Ada.Unchecked_Conversion (LL_VUC, LL_VBC);
49 function To_LL_VBC is new Ada.Unchecked_Conversion (LL_VSC, LL_VBC);
50 function To_LL_VBC is new Ada.Unchecked_Conversion (LL_VBS, LL_VBC);
51 function To_LL_VBC is new Ada.Unchecked_Conversion (LL_VUS, LL_VBC);
52 function To_LL_VBC is new Ada.Unchecked_Conversion (LL_VSS, LL_VBC);
53 function To_LL_VBC is new Ada.Unchecked_Conversion (LL_VBI, LL_VBC);
54 function To_LL_VBC is new Ada.Unchecked_Conversion (LL_VUI, LL_VBC);
55 function To_LL_VBC is new Ada.Unchecked_Conversion (LL_VSI, LL_VBC);
56 function To_LL_VBC is new Ada.Unchecked_Conversion (LL_VF, LL_VBC);
57 function To_LL_VBC is new Ada.Unchecked_Conversion (LL_VP, LL_VBC);
59 function To_LL_VUC is new Ada.Unchecked_Conversion (LL_VBC, LL_VUC);
60 function To_LL_VUC is new Ada.Unchecked_Conversion (LL_VUC, LL_VUC);
61 function To_LL_VUC is new Ada.Unchecked_Conversion (LL_VSC, LL_VUC);
62 function To_LL_VUC is new Ada.Unchecked_Conversion (LL_VBS, LL_VUC);
63 function To_LL_VUC is new Ada.Unchecked_Conversion (LL_VUS, LL_VUC);
64 function To_LL_VUC is new Ada.Unchecked_Conversion (LL_VSS, LL_VUC);
65 function To_LL_VUC is new Ada.Unchecked_Conversion (LL_VBI, LL_VUC);
66 function To_LL_VUC is new Ada.Unchecked_Conversion (LL_VUI, LL_VUC);
67 function To_LL_VUC is new Ada.Unchecked_Conversion (LL_VSI, LL_VUC);
68 function To_LL_VUC is new Ada.Unchecked_Conversion (LL_VF, LL_VUC);
69 function To_LL_VUC is new Ada.Unchecked_Conversion (LL_VP, LL_VUC);
71 function To_LL_VSC is new Ada.Unchecked_Conversion (LL_VBC, LL_VSC);
72 function To_LL_VSC is new Ada.Unchecked_Conversion (LL_VUC, LL_VSC);
73 function To_LL_VSC is new Ada.Unchecked_Conversion (LL_VSC, LL_VSC);
74 function To_LL_VSC is new Ada.Unchecked_Conversion (LL_VBS, LL_VSC);
75 function To_LL_VSC is new Ada.Unchecked_Conversion (LL_VUS, LL_VSC);
76 function To_LL_VSC is new Ada.Unchecked_Conversion (LL_VSS, LL_VSC);
77 function To_LL_VSC is new Ada.Unchecked_Conversion (LL_VBI, LL_VSC);
78 function To_LL_VSC is new Ada.Unchecked_Conversion (LL_VUI, LL_VSC);
79 function To_LL_VSC is new Ada.Unchecked_Conversion (LL_VSI, LL_VSC);
80 function To_LL_VSC is new Ada.Unchecked_Conversion (LL_VF, LL_VSC);
81 function To_LL_VSC is new Ada.Unchecked_Conversion (LL_VP, LL_VSC);
83 function To_LL_VBS is new Ada.Unchecked_Conversion (LL_VBC, LL_VBS);
84 function To_LL_VBS is new Ada.Unchecked_Conversion (LL_VUC, LL_VBS);
85 function To_LL_VBS is new Ada.Unchecked_Conversion (LL_VSC, LL_VBS);
86 function To_LL_VBS is new Ada.Unchecked_Conversion (LL_VBS, LL_VBS);
87 function To_LL_VBS is new Ada.Unchecked_Conversion (LL_VUS, LL_VBS);
88 function To_LL_VBS is new Ada.Unchecked_Conversion (LL_VSS, LL_VBS);
89 function To_LL_VBS is new Ada.Unchecked_Conversion (LL_VBI, LL_VBS);
90 function To_LL_VBS is new Ada.Unchecked_Conversion (LL_VUI, LL_VBS);
91 function To_LL_VBS is new Ada.Unchecked_Conversion (LL_VSI, LL_VBS);
92 function To_LL_VBS is new Ada.Unchecked_Conversion (LL_VF, LL_VBS);
93 function To_LL_VBS is new Ada.Unchecked_Conversion (LL_VP, LL_VBS);
95 function To_LL_VUS is new Ada.Unchecked_Conversion (LL_VBC, LL_VUS);
96 function To_LL_VUS is new Ada.Unchecked_Conversion (LL_VUC, LL_VUS);
97 function To_LL_VUS is new Ada.Unchecked_Conversion (LL_VSC, LL_VUS);
98 function To_LL_VUS is new Ada.Unchecked_Conversion (LL_VBS, LL_VUS);
99 function To_LL_VUS is new Ada.Unchecked_Conversion (LL_VUS, LL_VUS);
100 function To_LL_VUS is new Ada.Unchecked_Conversion (LL_VSS, LL_VUS);
101 function To_LL_VUS is new Ada.Unchecked_Conversion (LL_VBI, LL_VUS);
102 function To_LL_VUS is new Ada.Unchecked_Conversion (LL_VUI, LL_VUS);
103 function To_LL_VUS is new Ada.Unchecked_Conversion (LL_VSI, LL_VUS);
104 function To_LL_VUS is new Ada.Unchecked_Conversion (LL_VF, LL_VUS);
105 function To_LL_VUS is new Ada.Unchecked_Conversion (LL_VP, LL_VUS);
107 function To_LL_VSS is new Ada.Unchecked_Conversion (LL_VBC, LL_VSS);
108 function To_LL_VSS is new Ada.Unchecked_Conversion (LL_VUC, LL_VSS);
109 function To_LL_VSS is new Ada.Unchecked_Conversion (LL_VSC, LL_VSS);
110 function To_LL_VSS is new Ada.Unchecked_Conversion (LL_VBS, LL_VSS);
111 function To_LL_VSS is new Ada.Unchecked_Conversion (LL_VUS, LL_VSS);
112 function To_LL_VSS is new Ada.Unchecked_Conversion (LL_VSS, LL_VSS);
113 function To_LL_VSS is new Ada.Unchecked_Conversion (LL_VBI, LL_VSS);
114 function To_LL_VSS is new Ada.Unchecked_Conversion (LL_VUI, LL_VSS);
115 function To_LL_VSS is new Ada.Unchecked_Conversion (LL_VSI, LL_VSS);
116 function To_LL_VSS is new Ada.Unchecked_Conversion (LL_VF, LL_VSS);
117 function To_LL_VSS is new Ada.Unchecked_Conversion (LL_VP, LL_VSS);
119 function To_LL_VBI is new Ada.Unchecked_Conversion (LL_VBC, LL_VBI);
120 function To_LL_VBI is new Ada.Unchecked_Conversion (LL_VUC, LL_VBI);
121 function To_LL_VBI is new Ada.Unchecked_Conversion (LL_VSC, LL_VBI);
122 function To_LL_VBI is new Ada.Unchecked_Conversion (LL_VBS, LL_VBI);
123 function To_LL_VBI is new Ada.Unchecked_Conversion (LL_VUS, LL_VBI);
124 function To_LL_VBI is new Ada.Unchecked_Conversion (LL_VSS, LL_VBI);
125 function To_LL_VBI is new Ada.Unchecked_Conversion (LL_VBI, LL_VBI);
126 function To_LL_VBI is new Ada.Unchecked_Conversion (LL_VUI, LL_VBI);
127 function To_LL_VBI is new Ada.Unchecked_Conversion (LL_VSI, LL_VBI);
128 function To_LL_VBI is new Ada.Unchecked_Conversion (LL_VF, LL_VBI);
129 function To_LL_VBI is new Ada.Unchecked_Conversion (LL_VP, LL_VBI);
131 function To_LL_VUI is new Ada.Unchecked_Conversion (LL_VBC, LL_VUI);
132 function To_LL_VUI is new Ada.Unchecked_Conversion (LL_VUC, LL_VUI);
133 function To_LL_VUI is new Ada.Unchecked_Conversion (LL_VSC, LL_VUI);
134 function To_LL_VUI is new Ada.Unchecked_Conversion (LL_VBS, LL_VUI);
135 function To_LL_VUI is new Ada.Unchecked_Conversion (LL_VUS, LL_VUI);
136 function To_LL_VUI is new Ada.Unchecked_Conversion (LL_VSS, LL_VUI);
137 function To_LL_VUI is new Ada.Unchecked_Conversion (LL_VBI, LL_VUI);
138 function To_LL_VUI is new Ada.Unchecked_Conversion (LL_VUI, LL_VUI);
139 function To_LL_VUI is new Ada.Unchecked_Conversion (LL_VSI, LL_VUI);
140 function To_LL_VUI is new Ada.Unchecked_Conversion (LL_VF, LL_VUI);
141 function To_LL_VUI is new Ada.Unchecked_Conversion (LL_VP, LL_VUI);
143 function To_LL_VSI is new Ada.Unchecked_Conversion (LL_VBC, LL_VSI);
144 function To_LL_VSI is new Ada.Unchecked_Conversion (LL_VUC, LL_VSI);
145 function To_LL_VSI is new Ada.Unchecked_Conversion (LL_VSC, LL_VSI);
146 function To_LL_VSI is new Ada.Unchecked_Conversion (LL_VBS, LL_VSI);
147 function To_LL_VSI is new Ada.Unchecked_Conversion (LL_VUS, LL_VSI);
148 function To_LL_VSI is new Ada.Unchecked_Conversion (LL_VSS, LL_VSI);
149 function To_LL_VSI is new Ada.Unchecked_Conversion (LL_VBI, LL_VSI);
150 function To_LL_VSI is new Ada.Unchecked_Conversion (LL_VUI, LL_VSI);
151 function To_LL_VSI is new Ada.Unchecked_Conversion (LL_VSI, LL_VSI);
152 function To_LL_VSI is new Ada.Unchecked_Conversion (LL_VF, LL_VSI);
153 function To_LL_VSI is new Ada.Unchecked_Conversion (LL_VP, LL_VSI);
155 function To_LL_VF is new Ada.Unchecked_Conversion (LL_VBC, LL_VF);
156 function To_LL_VF is new Ada.Unchecked_Conversion (LL_VUC, LL_VF);
157 function To_LL_VF is new Ada.Unchecked_Conversion (LL_VSC, LL_VF);
158 function To_LL_VF is new Ada.Unchecked_Conversion (LL_VBS, LL_VF);
159 function To_LL_VF is new Ada.Unchecked_Conversion (LL_VUS, LL_VF);
160 function To_LL_VF is new Ada.Unchecked_Conversion (LL_VSS, LL_VF);
161 function To_LL_VF is new Ada.Unchecked_Conversion (LL_VBI, LL_VF);
162 function To_LL_VF is new Ada.Unchecked_Conversion (LL_VUI, LL_VF);
163 function To_LL_VF is new Ada.Unchecked_Conversion (LL_VSI, LL_VF);
164 function To_LL_VF is new Ada.Unchecked_Conversion (LL_VF, LL_VF);
165 function To_LL_VF is new Ada.Unchecked_Conversion (LL_VP, LL_VF);
167 function To_LL_VP is new Ada.Unchecked_Conversion (LL_VBC, LL_VP);
168 function To_LL_VP is new Ada.Unchecked_Conversion (LL_VUC, LL_VP);
169 function To_LL_VP is new Ada.Unchecked_Conversion (LL_VSC, LL_VP);
170 function To_LL_VP is new Ada.Unchecked_Conversion (LL_VBS, LL_VP);
171 function To_LL_VP is new Ada.Unchecked_Conversion (LL_VUS, LL_VP);
172 function To_LL_VP is new Ada.Unchecked_Conversion (LL_VSS, LL_VP);
173 function To_LL_VP is new Ada.Unchecked_Conversion (LL_VBI, LL_VP);
174 function To_LL_VP is new Ada.Unchecked_Conversion (LL_VUI, LL_VP);
175 function To_LL_VP is new Ada.Unchecked_Conversion (LL_VSI, LL_VP);
176 function To_LL_VP is new Ada.Unchecked_Conversion (LL_VF, LL_VP);
177 function To_LL_VP is new Ada.Unchecked_Conversion (LL_VP, LL_VP);
179 ----------------------------------------------
180 -- Conversions Between Pointer/Access Types --
181 ----------------------------------------------
184 new Ada.Unchecked_Conversion (vector_unsigned_char_ptr, c_ptr);
186 new Ada.Unchecked_Conversion (vector_signed_char_ptr, c_ptr);
188 new Ada.Unchecked_Conversion (vector_bool_char_ptr, c_ptr);
190 new Ada.Unchecked_Conversion (vector_unsigned_short_ptr, c_ptr);
192 new Ada.Unchecked_Conversion (vector_signed_short_ptr, c_ptr);
194 new Ada.Unchecked_Conversion (vector_bool_short_ptr, c_ptr);
196 new Ada.Unchecked_Conversion (vector_unsigned_int_ptr, c_ptr);
198 new Ada.Unchecked_Conversion (vector_signed_int_ptr, c_ptr);
200 new Ada.Unchecked_Conversion (vector_bool_int_ptr, c_ptr);
202 new Ada.Unchecked_Conversion (vector_float_ptr, c_ptr);
204 new Ada.Unchecked_Conversion (vector_pixel_ptr, c_ptr);
206 new Ada.Unchecked_Conversion (const_vector_bool_char_ptr, c_ptr);
208 new Ada.Unchecked_Conversion (const_vector_signed_char_ptr, c_ptr);
210 new Ada.Unchecked_Conversion (const_vector_unsigned_char_ptr, c_ptr);
212 new Ada.Unchecked_Conversion (const_vector_bool_short_ptr, c_ptr);
214 new Ada.Unchecked_Conversion (const_vector_signed_short_ptr, c_ptr);
216 new Ada.Unchecked_Conversion (const_vector_unsigned_short_ptr, c_ptr);
218 new Ada.Unchecked_Conversion (const_vector_bool_int_ptr, c_ptr);
220 new Ada.Unchecked_Conversion (const_vector_signed_int_ptr, c_ptr);
222 new Ada.Unchecked_Conversion (const_vector_unsigned_int_ptr, c_ptr);
224 new Ada.Unchecked_Conversion (const_vector_float_ptr, c_ptr);
226 new Ada.Unchecked_Conversion (const_vector_pixel_ptr, c_ptr);
228 new Ada.Unchecked_Conversion (c_ptr, c_ptr);
230 new Ada.Unchecked_Conversion (signed_char_ptr, c_ptr);
232 new Ada.Unchecked_Conversion (unsigned_char_ptr, c_ptr);
234 new Ada.Unchecked_Conversion (short_ptr, c_ptr);
236 new Ada.Unchecked_Conversion (signed_short_ptr, c_ptr);
238 new Ada.Unchecked_Conversion (unsigned_short_ptr, c_ptr);
240 new Ada.Unchecked_Conversion (int_ptr, c_ptr);
242 new Ada.Unchecked_Conversion (signed_int_ptr, c_ptr);
244 new Ada.Unchecked_Conversion (unsigned_int_ptr, c_ptr);
246 new Ada.Unchecked_Conversion (long_ptr, c_ptr);
248 new Ada.Unchecked_Conversion (signed_long_ptr, c_ptr);
250 new Ada.Unchecked_Conversion (unsigned_long_ptr, c_ptr);
252 new Ada.Unchecked_Conversion (float_ptr, c_ptr);
254 new Ada.Unchecked_Conversion (const_signed_char_ptr, c_ptr);
256 new Ada.Unchecked_Conversion (const_unsigned_char_ptr, c_ptr);
258 new Ada.Unchecked_Conversion (const_short_ptr, c_ptr);
260 new Ada.Unchecked_Conversion (const_signed_short_ptr, c_ptr);
262 new Ada.Unchecked_Conversion (const_unsigned_short_ptr, c_ptr);
264 new Ada.Unchecked_Conversion (const_int_ptr, c_ptr);
266 new Ada.Unchecked_Conversion (const_signed_int_ptr, c_ptr);
268 new Ada.Unchecked_Conversion (const_unsigned_int_ptr, c_ptr);
270 new Ada.Unchecked_Conversion (const_long_ptr, c_ptr);
272 new Ada.Unchecked_Conversion (const_signed_long_ptr, c_ptr);
274 new Ada.Unchecked_Conversion (const_unsigned_long_ptr, c_ptr);
276 new Ada.Unchecked_Conversion (const_float_ptr, c_ptr);
278 new Ada.Unchecked_Conversion (constv_char_ptr, c_ptr);
280 new Ada.Unchecked_Conversion (constv_signed_char_ptr, c_ptr);
282 new Ada.Unchecked_Conversion (constv_unsigned_char_ptr, c_ptr);
284 new Ada.Unchecked_Conversion (constv_short_ptr, c_ptr);
286 new Ada.Unchecked_Conversion (constv_signed_short_ptr, c_ptr);
288 new Ada.Unchecked_Conversion (constv_unsigned_short_ptr, c_ptr);
290 new Ada.Unchecked_Conversion (constv_int_ptr, c_ptr);
292 new Ada.Unchecked_Conversion (constv_signed_int_ptr, c_ptr);
294 new Ada.Unchecked_Conversion (constv_unsigned_int_ptr, c_ptr);
296 new Ada.Unchecked_Conversion (constv_long_ptr, c_ptr);
298 new Ada.Unchecked_Conversion (constv_signed_long_ptr, c_ptr);
300 new Ada.Unchecked_Conversion (constv_unsigned_long_ptr, c_ptr);
302 new Ada.Unchecked_Conversion (constv_float_ptr, c_ptr);
304 end GNAT.Altivec.Low_Level_Interface;