1------------------------------------------------------------------------------
2--                                                                          --
3--                         GNAT COMPILER COMPONENTS                         --
4--                                                                          --
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      --
6--                                                                          --
7--                                 S p e c                                  --
8--                                                                          --
9--          Copyright (C) 2004-2018, Free Software Foundation, Inc.         --
10--                                                                          --
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.                                     --
17--                                                                          --
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.               --
21--                                                                          --
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/>.                                          --
26--                                                                          --
27-- GNAT was originally developed  by the GNAT team at  New York University. --
28-- Extensive contributions were provided by Ada Core Technologies Inc.      --
29--                                                                          --
30------------------------------------------------------------------------------
31
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.
35
36with GNAT.Altivec.Vector_Types;      use GNAT.Altivec.Vector_Types;
37with GNAT.Altivec.Low_Level_Vectors; use GNAT.Altivec.Low_Level_Vectors;
38
39with Ada.Unchecked_Conversion;
40
41package GNAT.Altivec.Low_Level_Interface is
42
43   -----------------------------------------
44   -- Conversions between low level types --
45   -----------------------------------------
46
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);
58
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);
70
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);
82
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);
94
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);
106
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);
118
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);
130
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);
142
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);
154
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);
166
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);
178
179   ----------------------------------------------
180   -- Conversions Between Pointer/Access Types --
181   ----------------------------------------------
182
183   function To_PTR is
184      new Ada.Unchecked_Conversion (vector_unsigned_char_ptr, c_ptr);
185   function To_PTR is
186      new Ada.Unchecked_Conversion (vector_signed_char_ptr, c_ptr);
187   function To_PTR is
188      new Ada.Unchecked_Conversion (vector_bool_char_ptr, c_ptr);
189   function To_PTR is
190      new Ada.Unchecked_Conversion (vector_unsigned_short_ptr, c_ptr);
191   function To_PTR is
192      new Ada.Unchecked_Conversion (vector_signed_short_ptr, c_ptr);
193   function To_PTR is
194      new Ada.Unchecked_Conversion (vector_bool_short_ptr, c_ptr);
195   function To_PTR is
196      new Ada.Unchecked_Conversion (vector_unsigned_int_ptr, c_ptr);
197   function To_PTR is
198      new Ada.Unchecked_Conversion (vector_signed_int_ptr, c_ptr);
199   function To_PTR is
200      new Ada.Unchecked_Conversion (vector_bool_int_ptr, c_ptr);
201   function To_PTR is
202      new Ada.Unchecked_Conversion (vector_float_ptr, c_ptr);
203   function To_PTR is
204      new Ada.Unchecked_Conversion (vector_pixel_ptr, c_ptr);
205   function To_PTR is
206      new Ada.Unchecked_Conversion (const_vector_bool_char_ptr, c_ptr);
207   function To_PTR is
208      new Ada.Unchecked_Conversion (const_vector_signed_char_ptr, c_ptr);
209   function To_PTR is
210      new Ada.Unchecked_Conversion (const_vector_unsigned_char_ptr, c_ptr);
211   function To_PTR is
212      new Ada.Unchecked_Conversion (const_vector_bool_short_ptr, c_ptr);
213   function To_PTR is
214      new Ada.Unchecked_Conversion (const_vector_signed_short_ptr, c_ptr);
215   function To_PTR is
216      new Ada.Unchecked_Conversion (const_vector_unsigned_short_ptr, c_ptr);
217   function To_PTR is
218      new Ada.Unchecked_Conversion (const_vector_bool_int_ptr, c_ptr);
219   function To_PTR is
220      new Ada.Unchecked_Conversion (const_vector_signed_int_ptr, c_ptr);
221   function To_PTR is
222      new Ada.Unchecked_Conversion (const_vector_unsigned_int_ptr, c_ptr);
223   function To_PTR is
224      new Ada.Unchecked_Conversion (const_vector_float_ptr, c_ptr);
225   function To_PTR is
226      new Ada.Unchecked_Conversion (const_vector_pixel_ptr, c_ptr);
227   function To_PTR is
228      new Ada.Unchecked_Conversion (c_ptr, c_ptr);
229   function To_PTR is
230      new Ada.Unchecked_Conversion (signed_char_ptr, c_ptr);
231   function To_PTR is
232      new Ada.Unchecked_Conversion (unsigned_char_ptr, c_ptr);
233   function To_PTR is
234      new Ada.Unchecked_Conversion (short_ptr, c_ptr);
235   function To_PTR is
236      new Ada.Unchecked_Conversion (signed_short_ptr, c_ptr);
237   function To_PTR is
238      new Ada.Unchecked_Conversion (unsigned_short_ptr, c_ptr);
239   function To_PTR is
240      new Ada.Unchecked_Conversion (int_ptr, c_ptr);
241   function To_PTR is
242      new Ada.Unchecked_Conversion (signed_int_ptr, c_ptr);
243   function To_PTR is
244      new Ada.Unchecked_Conversion (unsigned_int_ptr, c_ptr);
245   function To_PTR is
246      new Ada.Unchecked_Conversion (long_ptr, c_ptr);
247   function To_PTR is
248      new Ada.Unchecked_Conversion (signed_long_ptr, c_ptr);
249   function To_PTR is
250      new Ada.Unchecked_Conversion (unsigned_long_ptr, c_ptr);
251   function To_PTR is
252      new Ada.Unchecked_Conversion (float_ptr, c_ptr);
253   function To_PTR is
254      new Ada.Unchecked_Conversion (const_signed_char_ptr, c_ptr);
255   function To_PTR is
256      new Ada.Unchecked_Conversion (const_unsigned_char_ptr, c_ptr);
257   function To_PTR is
258      new Ada.Unchecked_Conversion (const_short_ptr, c_ptr);
259   function To_PTR is
260      new Ada.Unchecked_Conversion (const_signed_short_ptr, c_ptr);
261   function To_PTR is
262      new Ada.Unchecked_Conversion (const_unsigned_short_ptr, c_ptr);
263   function To_PTR is
264      new Ada.Unchecked_Conversion (const_int_ptr, c_ptr);
265   function To_PTR is
266      new Ada.Unchecked_Conversion (const_signed_int_ptr, c_ptr);
267   function To_PTR is
268      new Ada.Unchecked_Conversion (const_unsigned_int_ptr, c_ptr);
269   function To_PTR is
270      new Ada.Unchecked_Conversion (const_long_ptr, c_ptr);
271   function To_PTR is
272      new Ada.Unchecked_Conversion (const_signed_long_ptr, c_ptr);
273   function To_PTR is
274      new Ada.Unchecked_Conversion (const_unsigned_long_ptr, c_ptr);
275   function To_PTR is
276      new Ada.Unchecked_Conversion (const_float_ptr, c_ptr);
277   function To_PTR is
278      new Ada.Unchecked_Conversion (constv_char_ptr, c_ptr);
279   function To_PTR is
280      new Ada.Unchecked_Conversion (constv_signed_char_ptr, c_ptr);
281   function To_PTR is
282      new Ada.Unchecked_Conversion (constv_unsigned_char_ptr, c_ptr);
283   function To_PTR is
284      new Ada.Unchecked_Conversion (constv_short_ptr, c_ptr);
285   function To_PTR is
286      new Ada.Unchecked_Conversion (constv_signed_short_ptr, c_ptr);
287   function To_PTR is
288      new Ada.Unchecked_Conversion (constv_unsigned_short_ptr, c_ptr);
289   function To_PTR is
290      new Ada.Unchecked_Conversion (constv_int_ptr, c_ptr);
291   function To_PTR is
292      new Ada.Unchecked_Conversion (constv_signed_int_ptr, c_ptr);
293   function To_PTR is
294      new Ada.Unchecked_Conversion (constv_unsigned_int_ptr, c_ptr);
295   function To_PTR is
296      new Ada.Unchecked_Conversion (constv_long_ptr, c_ptr);
297   function To_PTR is
298      new Ada.Unchecked_Conversion (constv_signed_long_ptr, c_ptr);
299   function To_PTR is
300      new Ada.Unchecked_Conversion (constv_unsigned_long_ptr, c_ptr);
301   function To_PTR is
302      new Ada.Unchecked_Conversion (constv_float_ptr, c_ptr);
303
304end GNAT.Altivec.Low_Level_Interface;
305