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-2005, 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 2, 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. See the GNU General Public License --
17 -- for more details. You should have received a copy of the GNU General --
18 -- Public License distributed with GNAT; see file COPYING. If not, write --
19 -- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
20 -- MA 02111-1307, USA. --
22 -- As a special exception, if other files instantiate generics from this --
23 -- unit, or you link this unit with other files to produce an executable, --
24 -- this unit does not by itself cause the resulting executable to be --
25 -- covered by the GNU General Public License. This exception does not --
26 -- however invalidate any other reasons why the executable file might be --
27 -- covered by the GNU Public License. --
29 -- GNAT was originally developed by the GNAT team at New York University. --
30 -- Extensive contributions were provided by Ada Core Technologies Inc. --
32 ------------------------------------------------------------------------------
34 -- This unit provides entities to be used internally by the units common to
35 -- both bindings (Hard or Soft), and relevant to the interfacing with the
36 -- underlying Low Level support.
38 -- The set of "services" includes:
40 -- o Imports to the low level routines for which a direct binding is
41 -- mandatory (or just possible when analyzed as such).
43 -- o Conversion routines (unchecked) between low level types, or between
44 -- various pointer representations.
46 with GNAT.Altivec.Vector_Types;
47 with GNAT.Altivec.Low_Level_Vectors;
49 with Ada.Unchecked_Conversion;
51 package GNAT.Altivec.Low_Level_Interface is
53 ----------------------------------------------------------------------------
54 -- Imports for "argument must be literal" constraints in the Hard binding --
55 ----------------------------------------------------------------------------
57 use GNAT.Altivec.Vector_Types;
61 function vec_ctf_vui_cint_r_vf
62 (A : vector_unsigned_int;
63 B : c_int) return vector_float;
66 (LL_Altivec, vec_ctf_vui_cint_r_vf, "__builtin_altivec_vcfux");
68 function vec_ctf_vsi_cint_r_vf
69 (A : vector_signed_int;
70 B : c_int) return vector_float;
73 (LL_Altivec, vec_ctf_vsi_cint_r_vf, "__builtin_altivec_vcfsx");
77 function vec_vcfsx_vsi_cint_r_vf
78 (A : vector_signed_int;
79 B : c_int) return vector_float;
82 (LL_Altivec, vec_vcfsx_vsi_cint_r_vf, "__builtin_altivec_vcfsx");
86 function vec_vcfux_vui_cint_r_vf
87 (A : vector_unsigned_int;
88 B : c_int) return vector_float;
91 (LL_Altivec, vec_vcfux_vui_cint_r_vf, "__builtin_altivec_vcfux");
95 function vec_cts_vf_cint_r_vsi
97 B : c_int) return vector_signed_int;
100 (LL_Altivec, vec_cts_vf_cint_r_vsi, "__builtin_altivec_vctsxs");
104 function vec_ctu_vf_cint_r_vui
106 B : c_int) return vector_unsigned_int;
109 (LL_Altivec, vec_ctu_vf_cint_r_vui, "__builtin_altivec_vctuxs");
113 procedure vec_dss_cint
117 (LL_Altivec, vec_dss_cint, "__builtin_altivec_dss");
121 procedure vec_dst_kvucp_cint_cint
122 (A : const_vector_unsigned_char_ptr;
127 (LL_Altivec, vec_dst_kvucp_cint_cint, "__builtin_altivec_dst");
129 procedure vec_dst_kvscp_cint_cint
130 (A : const_vector_signed_char_ptr;
135 (LL_Altivec, vec_dst_kvscp_cint_cint, "__builtin_altivec_dst");
137 procedure vec_dst_kvbcp_cint_cint
138 (A : const_vector_bool_char_ptr;
143 (LL_Altivec, vec_dst_kvbcp_cint_cint, "__builtin_altivec_dst");
145 procedure vec_dst_kvusp_cint_cint
146 (A : const_vector_unsigned_short_ptr;
151 (LL_Altivec, vec_dst_kvusp_cint_cint, "__builtin_altivec_dst");
153 procedure vec_dst_kvssp_cint_cint
154 (A : const_vector_signed_short_ptr;
159 (LL_Altivec, vec_dst_kvssp_cint_cint, "__builtin_altivec_dst");
161 procedure vec_dst_kvbsp_cint_cint
162 (A : const_vector_bool_short_ptr;
167 (LL_Altivec, vec_dst_kvbsp_cint_cint, "__builtin_altivec_dst");
169 procedure vec_dst_kvxp_cint_cint
170 (A : const_vector_pixel_ptr;
175 (LL_Altivec, vec_dst_kvxp_cint_cint, "__builtin_altivec_dst");
177 procedure vec_dst_kvuip_cint_cint
178 (A : const_vector_unsigned_int_ptr;
183 (LL_Altivec, vec_dst_kvuip_cint_cint, "__builtin_altivec_dst");
185 procedure vec_dst_kvsip_cint_cint
186 (A : const_vector_signed_int_ptr;
191 (LL_Altivec, vec_dst_kvsip_cint_cint, "__builtin_altivec_dst");
193 procedure vec_dst_kvbip_cint_cint
194 (A : const_vector_bool_int_ptr;
199 (LL_Altivec, vec_dst_kvbip_cint_cint, "__builtin_altivec_dst");
201 procedure vec_dst_kvfp_cint_cint
202 (A : const_vector_float_ptr;
207 (LL_Altivec, vec_dst_kvfp_cint_cint, "__builtin_altivec_dst");
209 procedure vec_dst_kucp_cint_cint
210 (A : const_unsigned_char_ptr;
215 (LL_Altivec, vec_dst_kucp_cint_cint, "__builtin_altivec_dst");
217 procedure vec_dst_kscp_cint_cint
218 (A : const_signed_char_ptr;
223 (LL_Altivec, vec_dst_kscp_cint_cint, "__builtin_altivec_dst");
225 procedure vec_dst_kusp_cint_cint
226 (A : const_unsigned_short_ptr;
231 (LL_Altivec, vec_dst_kusp_cint_cint, "__builtin_altivec_dst");
233 procedure vec_dst_ksp_cint_cint
234 (A : const_short_ptr;
239 (LL_Altivec, vec_dst_ksp_cint_cint, "__builtin_altivec_dst");
241 procedure vec_dst_kuip_cint_cint
242 (A : const_unsigned_int_ptr;
247 (LL_Altivec, vec_dst_kuip_cint_cint, "__builtin_altivec_dst");
249 procedure vec_dst_kip_cint_cint
255 (LL_Altivec, vec_dst_kip_cint_cint, "__builtin_altivec_dst");
257 procedure vec_dst_kulongp_cint_cint
258 (A : const_unsigned_long_ptr;
263 (LL_Altivec, vec_dst_kulongp_cint_cint, "__builtin_altivec_dst");
265 procedure vec_dst_klongp_cint_cint
271 (LL_Altivec, vec_dst_klongp_cint_cint, "__builtin_altivec_dst");
273 procedure vec_dst_kfp_cint_cint
274 (A : const_float_ptr;
279 (LL_Altivec, vec_dst_kfp_cint_cint, "__builtin_altivec_dst");
283 procedure vec_dstst_kvucp_cint_cint
284 (A : const_vector_unsigned_char_ptr;
289 (LL_Altivec, vec_dstst_kvucp_cint_cint, "__builtin_altivec_dstst");
291 procedure vec_dstst_kvscp_cint_cint
292 (A : const_vector_signed_char_ptr;
297 (LL_Altivec, vec_dstst_kvscp_cint_cint, "__builtin_altivec_dstst");
299 procedure vec_dstst_kvbcp_cint_cint
300 (A : const_vector_bool_char_ptr;
305 (LL_Altivec, vec_dstst_kvbcp_cint_cint, "__builtin_altivec_dstst");
307 procedure vec_dstst_kvusp_cint_cint
308 (A : const_vector_unsigned_short_ptr;
313 (LL_Altivec, vec_dstst_kvusp_cint_cint, "__builtin_altivec_dstst");
315 procedure vec_dstst_kvssp_cint_cint
316 (A : const_vector_signed_short_ptr;
321 (LL_Altivec, vec_dstst_kvssp_cint_cint, "__builtin_altivec_dstst");
323 procedure vec_dstst_kvbsp_cint_cint
324 (A : const_vector_bool_short_ptr;
329 (LL_Altivec, vec_dstst_kvbsp_cint_cint, "__builtin_altivec_dstst");
331 procedure vec_dstst_kvxp_cint_cint
332 (A : const_vector_pixel_ptr;
337 (LL_Altivec, vec_dstst_kvxp_cint_cint, "__builtin_altivec_dstst");
339 procedure vec_dstst_kvuip_cint_cint
340 (A : const_vector_unsigned_int_ptr;
345 (LL_Altivec, vec_dstst_kvuip_cint_cint, "__builtin_altivec_dstst");
347 procedure vec_dstst_kvsip_cint_cint
348 (A : const_vector_signed_int_ptr;
353 (LL_Altivec, vec_dstst_kvsip_cint_cint, "__builtin_altivec_dstst");
355 procedure vec_dstst_kvbip_cint_cint
356 (A : const_vector_bool_int_ptr;
361 (LL_Altivec, vec_dstst_kvbip_cint_cint, "__builtin_altivec_dstst");
363 procedure vec_dstst_kvfp_cint_cint
364 (A : const_vector_float_ptr;
369 (LL_Altivec, vec_dstst_kvfp_cint_cint, "__builtin_altivec_dstst");
371 procedure vec_dstst_kucp_cint_cint
372 (A : const_unsigned_char_ptr;
377 (LL_Altivec, vec_dstst_kucp_cint_cint, "__builtin_altivec_dstst");
379 procedure vec_dstst_kscp_cint_cint
380 (A : const_signed_char_ptr;
385 (LL_Altivec, vec_dstst_kscp_cint_cint, "__builtin_altivec_dstst");
387 procedure vec_dstst_kusp_cint_cint
388 (A : const_unsigned_short_ptr;
393 (LL_Altivec, vec_dstst_kusp_cint_cint, "__builtin_altivec_dstst");
395 procedure vec_dstst_ksp_cint_cint
396 (A : const_short_ptr;
401 (LL_Altivec, vec_dstst_ksp_cint_cint, "__builtin_altivec_dstst");
403 procedure vec_dstst_kuip_cint_cint
404 (A : const_unsigned_int_ptr;
409 (LL_Altivec, vec_dstst_kuip_cint_cint, "__builtin_altivec_dstst");
411 procedure vec_dstst_kip_cint_cint
417 (LL_Altivec, vec_dstst_kip_cint_cint, "__builtin_altivec_dstst");
419 procedure vec_dstst_kulongp_cint_cint
420 (A : const_unsigned_long_ptr;
425 (LL_Altivec, vec_dstst_kulongp_cint_cint, "__builtin_altivec_dstst");
427 procedure vec_dstst_klongp_cint_cint
433 (LL_Altivec, vec_dstst_klongp_cint_cint, "__builtin_altivec_dstst");
435 procedure vec_dstst_kfp_cint_cint
436 (A : const_float_ptr;
441 (LL_Altivec, vec_dstst_kfp_cint_cint, "__builtin_altivec_dstst");
445 procedure vec_dststt_kvucp_cint_cint
446 (A : const_vector_unsigned_char_ptr;
451 (LL_Altivec, vec_dststt_kvucp_cint_cint, "__builtin_altivec_dststt");
453 procedure vec_dststt_kvscp_cint_cint
454 (A : const_vector_signed_char_ptr;
459 (LL_Altivec, vec_dststt_kvscp_cint_cint, "__builtin_altivec_dststt");
461 procedure vec_dststt_kvbcp_cint_cint
462 (A : const_vector_bool_char_ptr;
467 (LL_Altivec, vec_dststt_kvbcp_cint_cint, "__builtin_altivec_dststt");
469 procedure vec_dststt_kvusp_cint_cint
470 (A : const_vector_unsigned_short_ptr;
475 (LL_Altivec, vec_dststt_kvusp_cint_cint, "__builtin_altivec_dststt");
477 procedure vec_dststt_kvssp_cint_cint
478 (A : const_vector_signed_short_ptr;
483 (LL_Altivec, vec_dststt_kvssp_cint_cint, "__builtin_altivec_dststt");
485 procedure vec_dststt_kvbsp_cint_cint
486 (A : const_vector_bool_short_ptr;
491 (LL_Altivec, vec_dststt_kvbsp_cint_cint, "__builtin_altivec_dststt");
493 procedure vec_dststt_kvxp_cint_cint
494 (A : const_vector_pixel_ptr;
499 (LL_Altivec, vec_dststt_kvxp_cint_cint, "__builtin_altivec_dststt");
501 procedure vec_dststt_kvuip_cint_cint
502 (A : const_vector_unsigned_int_ptr;
507 (LL_Altivec, vec_dststt_kvuip_cint_cint, "__builtin_altivec_dststt");
509 procedure vec_dststt_kvsip_cint_cint
510 (A : const_vector_signed_int_ptr;
515 (LL_Altivec, vec_dststt_kvsip_cint_cint, "__builtin_altivec_dststt");
517 procedure vec_dststt_kvbip_cint_cint
518 (A : const_vector_bool_int_ptr;
523 (LL_Altivec, vec_dststt_kvbip_cint_cint, "__builtin_altivec_dststt");
525 procedure vec_dststt_kvfp_cint_cint
526 (A : const_vector_float_ptr;
531 (LL_Altivec, vec_dststt_kvfp_cint_cint, "__builtin_altivec_dststt");
533 procedure vec_dststt_kucp_cint_cint
534 (A : const_unsigned_char_ptr;
539 (LL_Altivec, vec_dststt_kucp_cint_cint, "__builtin_altivec_dststt");
541 procedure vec_dststt_kscp_cint_cint
542 (A : const_signed_char_ptr;
547 (LL_Altivec, vec_dststt_kscp_cint_cint, "__builtin_altivec_dststt");
549 procedure vec_dststt_kusp_cint_cint
550 (A : const_unsigned_short_ptr;
555 (LL_Altivec, vec_dststt_kusp_cint_cint, "__builtin_altivec_dststt");
557 procedure vec_dststt_ksp_cint_cint
558 (A : const_short_ptr;
563 (LL_Altivec, vec_dststt_ksp_cint_cint, "__builtin_altivec_dststt");
565 procedure vec_dststt_kuip_cint_cint
566 (A : const_unsigned_int_ptr;
571 (LL_Altivec, vec_dststt_kuip_cint_cint, "__builtin_altivec_dststt");
573 procedure vec_dststt_kip_cint_cint
579 (LL_Altivec, vec_dststt_kip_cint_cint, "__builtin_altivec_dststt");
581 procedure vec_dststt_kulongp_cint_cint
582 (A : const_unsigned_long_ptr;
587 (LL_Altivec, vec_dststt_kulongp_cint_cint, "__builtin_altivec_dststt");
589 procedure vec_dststt_klongp_cint_cint
595 (LL_Altivec, vec_dststt_klongp_cint_cint, "__builtin_altivec_dststt");
597 procedure vec_dststt_kfp_cint_cint
598 (A : const_float_ptr;
603 (LL_Altivec, vec_dststt_kfp_cint_cint, "__builtin_altivec_dststt");
607 procedure vec_dstt_kvucp_cint_cint
608 (A : const_vector_unsigned_char_ptr;
613 (LL_Altivec, vec_dstt_kvucp_cint_cint, "__builtin_altivec_dstt");
615 procedure vec_dstt_kvscp_cint_cint
616 (A : const_vector_signed_char_ptr;
621 (LL_Altivec, vec_dstt_kvscp_cint_cint, "__builtin_altivec_dstt");
623 procedure vec_dstt_kvbcp_cint_cint
624 (A : const_vector_bool_char_ptr;
629 (LL_Altivec, vec_dstt_kvbcp_cint_cint, "__builtin_altivec_dstt");
631 procedure vec_dstt_kvusp_cint_cint
632 (A : const_vector_unsigned_short_ptr;
637 (LL_Altivec, vec_dstt_kvusp_cint_cint, "__builtin_altivec_dstt");
639 procedure vec_dstt_kvssp_cint_cint
640 (A : const_vector_signed_short_ptr;
645 (LL_Altivec, vec_dstt_kvssp_cint_cint, "__builtin_altivec_dstt");
647 procedure vec_dstt_kvbsp_cint_cint
648 (A : const_vector_bool_short_ptr;
653 (LL_Altivec, vec_dstt_kvbsp_cint_cint, "__builtin_altivec_dstt");
655 procedure vec_dstt_kvxp_cint_cint
656 (A : const_vector_pixel_ptr;
661 (LL_Altivec, vec_dstt_kvxp_cint_cint, "__builtin_altivec_dstt");
663 procedure vec_dstt_kvuip_cint_cint
664 (A : const_vector_unsigned_int_ptr;
669 (LL_Altivec, vec_dstt_kvuip_cint_cint, "__builtin_altivec_dstt");
671 procedure vec_dstt_kvsip_cint_cint
672 (A : const_vector_signed_int_ptr;
677 (LL_Altivec, vec_dstt_kvsip_cint_cint, "__builtin_altivec_dstt");
679 procedure vec_dstt_kvbip_cint_cint
680 (A : const_vector_bool_int_ptr;
685 (LL_Altivec, vec_dstt_kvbip_cint_cint, "__builtin_altivec_dstt");
687 procedure vec_dstt_kvfp_cint_cint
688 (A : const_vector_float_ptr;
693 (LL_Altivec, vec_dstt_kvfp_cint_cint, "__builtin_altivec_dstt");
695 procedure vec_dstt_kucp_cint_cint
696 (A : const_unsigned_char_ptr;
701 (LL_Altivec, vec_dstt_kucp_cint_cint, "__builtin_altivec_dstt");
703 procedure vec_dstt_kscp_cint_cint
704 (A : const_signed_char_ptr;
709 (LL_Altivec, vec_dstt_kscp_cint_cint, "__builtin_altivec_dstt");
711 procedure vec_dstt_kusp_cint_cint
712 (A : const_unsigned_short_ptr;
717 (LL_Altivec, vec_dstt_kusp_cint_cint, "__builtin_altivec_dstt");
719 procedure vec_dstt_ksp_cint_cint
720 (A : const_short_ptr;
725 (LL_Altivec, vec_dstt_ksp_cint_cint, "__builtin_altivec_dstt");
727 procedure vec_dstt_kuip_cint_cint
728 (A : const_unsigned_int_ptr;
733 (LL_Altivec, vec_dstt_kuip_cint_cint, "__builtin_altivec_dstt");
735 procedure vec_dstt_kip_cint_cint
741 (LL_Altivec, vec_dstt_kip_cint_cint, "__builtin_altivec_dstt");
743 procedure vec_dstt_kulongp_cint_cint
744 (A : const_unsigned_long_ptr;
749 (LL_Altivec, vec_dstt_kulongp_cint_cint, "__builtin_altivec_dstt");
751 procedure vec_dstt_klongp_cint_cint
757 (LL_Altivec, vec_dstt_klongp_cint_cint, "__builtin_altivec_dstt");
759 procedure vec_dstt_kfp_cint_cint
760 (A : const_float_ptr;
765 (LL_Altivec, vec_dstt_kfp_cint_cint, "__builtin_altivec_dstt");
769 -- ??? The base GCC implementation maps everything to vsldoi_4si, while
770 -- it defines builtin variants for all the modes. Adjust here, to avoid
771 -- the infamous argument mode mismatch.
773 function vec_sld_vf_vf_cint_r_vf
776 C : c_int) return vector_float;
779 (LL_Altivec, vec_sld_vf_vf_cint_r_vf, "__builtin_altivec_vsldoi_4sf");
781 function vec_sld_vsi_vsi_cint_r_vsi
782 (A : vector_signed_int;
783 B : vector_signed_int;
784 C : c_int) return vector_signed_int;
787 (LL_Altivec, vec_sld_vsi_vsi_cint_r_vsi, "__builtin_altivec_vsldoi_4si");
789 function vec_sld_vui_vui_cint_r_vui
790 (A : vector_unsigned_int;
791 B : vector_unsigned_int;
792 C : c_int) return vector_unsigned_int;
795 (LL_Altivec, vec_sld_vui_vui_cint_r_vui, "__builtin_altivec_vsldoi_4si");
797 function vec_sld_vbi_vbi_cint_r_vbi
798 (A : vector_bool_int;
800 C : c_int) return vector_bool_int;
803 (LL_Altivec, vec_sld_vbi_vbi_cint_r_vbi, "__builtin_altivec_vsldoi_4si");
805 function vec_sld_vss_vss_cint_r_vss
806 (A : vector_signed_short;
807 B : vector_signed_short;
808 C : c_int) return vector_signed_short;
811 (LL_Altivec, vec_sld_vss_vss_cint_r_vss, "__builtin_altivec_vsldoi_8hi");
813 function vec_sld_vus_vus_cint_r_vus
814 (A : vector_unsigned_short;
815 B : vector_unsigned_short;
816 C : c_int) return vector_unsigned_short;
819 (LL_Altivec, vec_sld_vus_vus_cint_r_vus, "__builtin_altivec_vsldoi_8hi");
821 function vec_sld_vbs_vbs_cint_r_vbs
822 (A : vector_bool_short;
823 B : vector_bool_short;
824 C : c_int) return vector_bool_short;
827 (LL_Altivec, vec_sld_vbs_vbs_cint_r_vbs, "__builtin_altivec_vsldoi_8hi");
829 function vec_sld_vx_vx_cint_r_vx
832 C : c_int) return vector_pixel;
835 (LL_Altivec, vec_sld_vx_vx_cint_r_vx, "__builtin_altivec_vsldoi_4si");
837 function vec_sld_vsc_vsc_cint_r_vsc
838 (A : vector_signed_char;
839 B : vector_signed_char;
840 C : c_int) return vector_signed_char;
843 (LL_Altivec, vec_sld_vsc_vsc_cint_r_vsc, "__builtin_altivec_vsldoi_16qi");
845 function vec_sld_vuc_vuc_cint_r_vuc
846 (A : vector_unsigned_char;
847 B : vector_unsigned_char;
848 C : c_int) return vector_unsigned_char;
851 (LL_Altivec, vec_sld_vuc_vuc_cint_r_vuc, "__builtin_altivec_vsldoi_16qi");
853 function vec_sld_vbc_vbc_cint_r_vbc
854 (A : vector_bool_char;
855 B : vector_bool_char;
856 C : c_int) return vector_bool_char;
859 (LL_Altivec, vec_sld_vbc_vbc_cint_r_vbc, "__builtin_altivec_vsldoi_16qi");
863 function vec_splat_vsc_cint_r_vsc
864 (A : vector_signed_char;
865 B : c_int) return vector_signed_char;
868 (LL_Altivec, vec_splat_vsc_cint_r_vsc, "__builtin_altivec_vspltb");
870 function vec_splat_vuc_cint_r_vuc
871 (A : vector_unsigned_char;
872 B : c_int) return vector_unsigned_char;
875 (LL_Altivec, vec_splat_vuc_cint_r_vuc, "__builtin_altivec_vspltb");
877 function vec_splat_vbc_cint_r_vbc
878 (A : vector_bool_char;
879 B : c_int) return vector_bool_char;
882 (LL_Altivec, vec_splat_vbc_cint_r_vbc, "__builtin_altivec_vspltb");
884 function vec_splat_vss_cint_r_vss
885 (A : vector_signed_short;
886 B : c_int) return vector_signed_short;
889 (LL_Altivec, vec_splat_vss_cint_r_vss, "__builtin_altivec_vsplth");
891 function vec_splat_vus_cint_r_vus
892 (A : vector_unsigned_short;
893 B : c_int) return vector_unsigned_short;
896 (LL_Altivec, vec_splat_vus_cint_r_vus, "__builtin_altivec_vsplth");
898 function vec_splat_vbs_cint_r_vbs
899 (A : vector_bool_short;
900 B : c_int) return vector_bool_short;
903 (LL_Altivec, vec_splat_vbs_cint_r_vbs, "__builtin_altivec_vsplth");
905 function vec_splat_vx_cint_r_vx
907 B : c_int) return vector_pixel;
910 (LL_Altivec, vec_splat_vx_cint_r_vx, "__builtin_altivec_vsplth");
912 function vec_splat_vf_cint_r_vf
914 B : c_int) return vector_float;
917 (LL_Altivec, vec_splat_vf_cint_r_vf, "__builtin_altivec_vspltw");
919 function vec_splat_vsi_cint_r_vsi
920 (A : vector_signed_int;
921 B : c_int) return vector_signed_int;
924 (LL_Altivec, vec_splat_vsi_cint_r_vsi, "__builtin_altivec_vspltw");
926 function vec_splat_vui_cint_r_vui
927 (A : vector_unsigned_int;
928 B : c_int) return vector_unsigned_int;
931 (LL_Altivec, vec_splat_vui_cint_r_vui, "__builtin_altivec_vspltw");
933 function vec_splat_vbi_cint_r_vbi
934 (A : vector_bool_int;
935 B : c_int) return vector_bool_int;
938 (LL_Altivec, vec_splat_vbi_cint_r_vbi, "__builtin_altivec_vspltw");
942 function vec_vspltw_vf_cint_r_vf
944 B : c_int) return vector_float;
947 (LL_Altivec, vec_vspltw_vf_cint_r_vf, "__builtin_altivec_vspltw");
949 function vec_vspltw_vsi_cint_r_vsi
950 (A : vector_signed_int;
951 B : c_int) return vector_signed_int;
954 (LL_Altivec, vec_vspltw_vsi_cint_r_vsi, "__builtin_altivec_vspltw");
956 function vec_vspltw_vui_cint_r_vui
957 (A : vector_unsigned_int;
958 B : c_int) return vector_unsigned_int;
961 (LL_Altivec, vec_vspltw_vui_cint_r_vui, "__builtin_altivec_vspltw");
963 function vec_vspltw_vbi_cint_r_vbi
964 (A : vector_bool_int;
965 B : c_int) return vector_bool_int;
968 (LL_Altivec, vec_vspltw_vbi_cint_r_vbi, "__builtin_altivec_vspltw");
972 function vec_vsplth_vbs_cint_r_vbs
973 (A : vector_bool_short;
974 B : c_int) return vector_bool_short;
977 (LL_Altivec, vec_vsplth_vbs_cint_r_vbs, "__builtin_altivec_vsplth");
979 function vec_vsplth_vss_cint_r_vss
980 (A : vector_signed_short;
981 B : c_int) return vector_signed_short;
984 (LL_Altivec, vec_vsplth_vss_cint_r_vss, "__builtin_altivec_vsplth");
986 function vec_vsplth_vus_cint_r_vus
987 (A : vector_unsigned_short;
988 B : c_int) return vector_unsigned_short;
991 (LL_Altivec, vec_vsplth_vus_cint_r_vus, "__builtin_altivec_vsplth");
993 function vec_vsplth_vx_cint_r_vx
995 B : c_int) return vector_pixel;
998 (LL_Altivec, vec_vsplth_vx_cint_r_vx, "__builtin_altivec_vsplth");
1002 function vec_vspltb_vsc_cint_r_vsc
1003 (A : vector_signed_char;
1004 B : c_int) return vector_signed_char;
1007 (LL_Altivec, vec_vspltb_vsc_cint_r_vsc, "__builtin_altivec_vspltb");
1009 function vec_vspltb_vuc_cint_r_vuc
1010 (A : vector_unsigned_char;
1011 B : c_int) return vector_unsigned_char;
1014 (LL_Altivec, vec_vspltb_vuc_cint_r_vuc, "__builtin_altivec_vspltb");
1016 function vec_vspltb_vbc_cint_r_vbc
1017 (A : vector_bool_char;
1018 B : c_int) return vector_bool_char;
1021 (LL_Altivec, vec_vspltb_vbc_cint_r_vbc, "__builtin_altivec_vspltb");
1025 function vec_splat_s8_cint_r_vsc
1026 (A : c_int) return vector_signed_char;
1029 (LL_Altivec, vec_splat_s8_cint_r_vsc, "__builtin_altivec_vspltisb");
1033 function vec_splat_s16_cint_r_vss
1034 (A : c_int) return vector_signed_short;
1037 (LL_Altivec, vec_splat_s16_cint_r_vss, "__builtin_altivec_vspltish");
1041 function vec_splat_s32_cint_r_vsi
1042 (A : c_int) return vector_signed_int;
1045 (LL_Altivec, vec_splat_s32_cint_r_vsi, "__builtin_altivec_vspltisw");
1049 function vec_splat_u8_cint_r_vuc
1050 (A : c_int) return vector_unsigned_char;
1053 (LL_Altivec, vec_splat_u8_cint_r_vuc, "__builtin_altivec_vspltisb");
1057 function vec_splat_u16_cint_r_vus
1058 (A : c_int) return vector_unsigned_short;
1061 (LL_Altivec, vec_splat_u16_cint_r_vus, "__builtin_altivec_vspltish");
1065 function vec_splat_u32_cint_r_vui
1066 (A : c_int) return vector_unsigned_int;
1069 (LL_Altivec, vec_splat_u32_cint_r_vui, "__builtin_altivec_vspltisw");
1071 ------------------------------------------------------------
1072 -- Imports for low-level signature consistent subprograms --
1073 ------------------------------------------------------------
1077 procedure vec_dssall;
1080 (LL_Altivec, vec_dssall, "__builtin_altivec_dssall");
1082 -----------------------------------------
1083 -- Conversions between low level types --
1084 -----------------------------------------
1086 use GNAT.Altivec.Low_Level_Vectors;
1088 -- Something like...
1090 -- TYPES="LL_VBC LL_VUC LL_VSC LL_VBS LL_VUS LL_VSS \
1091 -- LL_VBI LL_VUI LL_VSI LL_VF LL_VP"
1092 -- for TT in `echo $TYPES`; do
1093 -- for ST in `echo $TYPES`; do
1094 -- echo "function To_$TT is new Ada.Unchecked_Conversion ($ST, $TT);"
1099 function To_LL_VBC is new Ada.Unchecked_Conversion (LL_VBC, LL_VBC);
1100 function To_LL_VBC is new Ada.Unchecked_Conversion (LL_VUC, LL_VBC);
1101 function To_LL_VBC is new Ada.Unchecked_Conversion (LL_VSC, LL_VBC);
1102 function To_LL_VBC is new Ada.Unchecked_Conversion (LL_VBS, LL_VBC);
1103 function To_LL_VBC is new Ada.Unchecked_Conversion (LL_VUS, LL_VBC);
1104 function To_LL_VBC is new Ada.Unchecked_Conversion (LL_VSS, LL_VBC);
1105 function To_LL_VBC is new Ada.Unchecked_Conversion (LL_VBI, LL_VBC);
1106 function To_LL_VBC is new Ada.Unchecked_Conversion (LL_VUI, LL_VBC);
1107 function To_LL_VBC is new Ada.Unchecked_Conversion (LL_VSI, LL_VBC);
1108 function To_LL_VBC is new Ada.Unchecked_Conversion (LL_VF, LL_VBC);
1109 function To_LL_VBC is new Ada.Unchecked_Conversion (LL_VP, LL_VBC);
1111 function To_LL_VUC is new Ada.Unchecked_Conversion (LL_VBC, LL_VUC);
1112 function To_LL_VUC is new Ada.Unchecked_Conversion (LL_VUC, LL_VUC);
1113 function To_LL_VUC is new Ada.Unchecked_Conversion (LL_VSC, LL_VUC);
1114 function To_LL_VUC is new Ada.Unchecked_Conversion (LL_VBS, LL_VUC);
1115 function To_LL_VUC is new Ada.Unchecked_Conversion (LL_VUS, LL_VUC);
1116 function To_LL_VUC is new Ada.Unchecked_Conversion (LL_VSS, LL_VUC);
1117 function To_LL_VUC is new Ada.Unchecked_Conversion (LL_VBI, LL_VUC);
1118 function To_LL_VUC is new Ada.Unchecked_Conversion (LL_VUI, LL_VUC);
1119 function To_LL_VUC is new Ada.Unchecked_Conversion (LL_VSI, LL_VUC);
1120 function To_LL_VUC is new Ada.Unchecked_Conversion (LL_VF, LL_VUC);
1121 function To_LL_VUC is new Ada.Unchecked_Conversion (LL_VP, LL_VUC);
1123 function To_LL_VSC is new Ada.Unchecked_Conversion (LL_VBC, LL_VSC);
1124 function To_LL_VSC is new Ada.Unchecked_Conversion (LL_VUC, LL_VSC);
1125 function To_LL_VSC is new Ada.Unchecked_Conversion (LL_VSC, LL_VSC);
1126 function To_LL_VSC is new Ada.Unchecked_Conversion (LL_VBS, LL_VSC);
1127 function To_LL_VSC is new Ada.Unchecked_Conversion (LL_VUS, LL_VSC);
1128 function To_LL_VSC is new Ada.Unchecked_Conversion (LL_VSS, LL_VSC);
1129 function To_LL_VSC is new Ada.Unchecked_Conversion (LL_VBI, LL_VSC);
1130 function To_LL_VSC is new Ada.Unchecked_Conversion (LL_VUI, LL_VSC);
1131 function To_LL_VSC is new Ada.Unchecked_Conversion (LL_VSI, LL_VSC);
1132 function To_LL_VSC is new Ada.Unchecked_Conversion (LL_VF, LL_VSC);
1133 function To_LL_VSC is new Ada.Unchecked_Conversion (LL_VP, LL_VSC);
1135 function To_LL_VBS is new Ada.Unchecked_Conversion (LL_VBC, LL_VBS);
1136 function To_LL_VBS is new Ada.Unchecked_Conversion (LL_VUC, LL_VBS);
1137 function To_LL_VBS is new Ada.Unchecked_Conversion (LL_VSC, LL_VBS);
1138 function To_LL_VBS is new Ada.Unchecked_Conversion (LL_VBS, LL_VBS);
1139 function To_LL_VBS is new Ada.Unchecked_Conversion (LL_VUS, LL_VBS);
1140 function To_LL_VBS is new Ada.Unchecked_Conversion (LL_VSS, LL_VBS);
1141 function To_LL_VBS is new Ada.Unchecked_Conversion (LL_VBI, LL_VBS);
1142 function To_LL_VBS is new Ada.Unchecked_Conversion (LL_VUI, LL_VBS);
1143 function To_LL_VBS is new Ada.Unchecked_Conversion (LL_VSI, LL_VBS);
1144 function To_LL_VBS is new Ada.Unchecked_Conversion (LL_VF, LL_VBS);
1145 function To_LL_VBS is new Ada.Unchecked_Conversion (LL_VP, LL_VBS);
1147 function To_LL_VUS is new Ada.Unchecked_Conversion (LL_VBC, LL_VUS);
1148 function To_LL_VUS is new Ada.Unchecked_Conversion (LL_VUC, LL_VUS);
1149 function To_LL_VUS is new Ada.Unchecked_Conversion (LL_VSC, LL_VUS);
1150 function To_LL_VUS is new Ada.Unchecked_Conversion (LL_VBS, LL_VUS);
1151 function To_LL_VUS is new Ada.Unchecked_Conversion (LL_VUS, LL_VUS);
1152 function To_LL_VUS is new Ada.Unchecked_Conversion (LL_VSS, LL_VUS);
1153 function To_LL_VUS is new Ada.Unchecked_Conversion (LL_VBI, LL_VUS);
1154 function To_LL_VUS is new Ada.Unchecked_Conversion (LL_VUI, LL_VUS);
1155 function To_LL_VUS is new Ada.Unchecked_Conversion (LL_VSI, LL_VUS);
1156 function To_LL_VUS is new Ada.Unchecked_Conversion (LL_VF, LL_VUS);
1157 function To_LL_VUS is new Ada.Unchecked_Conversion (LL_VP, LL_VUS);
1159 function To_LL_VSS is new Ada.Unchecked_Conversion (LL_VBC, LL_VSS);
1160 function To_LL_VSS is new Ada.Unchecked_Conversion (LL_VUC, LL_VSS);
1161 function To_LL_VSS is new Ada.Unchecked_Conversion (LL_VSC, LL_VSS);
1162 function To_LL_VSS is new Ada.Unchecked_Conversion (LL_VBS, LL_VSS);
1163 function To_LL_VSS is new Ada.Unchecked_Conversion (LL_VUS, LL_VSS);
1164 function To_LL_VSS is new Ada.Unchecked_Conversion (LL_VSS, LL_VSS);
1165 function To_LL_VSS is new Ada.Unchecked_Conversion (LL_VBI, LL_VSS);
1166 function To_LL_VSS is new Ada.Unchecked_Conversion (LL_VUI, LL_VSS);
1167 function To_LL_VSS is new Ada.Unchecked_Conversion (LL_VSI, LL_VSS);
1168 function To_LL_VSS is new Ada.Unchecked_Conversion (LL_VF, LL_VSS);
1169 function To_LL_VSS is new Ada.Unchecked_Conversion (LL_VP, LL_VSS);
1171 function To_LL_VBI is new Ada.Unchecked_Conversion (LL_VBC, LL_VBI);
1172 function To_LL_VBI is new Ada.Unchecked_Conversion (LL_VUC, LL_VBI);
1173 function To_LL_VBI is new Ada.Unchecked_Conversion (LL_VSC, LL_VBI);
1174 function To_LL_VBI is new Ada.Unchecked_Conversion (LL_VBS, LL_VBI);
1175 function To_LL_VBI is new Ada.Unchecked_Conversion (LL_VUS, LL_VBI);
1176 function To_LL_VBI is new Ada.Unchecked_Conversion (LL_VSS, LL_VBI);
1177 function To_LL_VBI is new Ada.Unchecked_Conversion (LL_VBI, LL_VBI);
1178 function To_LL_VBI is new Ada.Unchecked_Conversion (LL_VUI, LL_VBI);
1179 function To_LL_VBI is new Ada.Unchecked_Conversion (LL_VSI, LL_VBI);
1180 function To_LL_VBI is new Ada.Unchecked_Conversion (LL_VF, LL_VBI);
1181 function To_LL_VBI is new Ada.Unchecked_Conversion (LL_VP, LL_VBI);
1183 function To_LL_VUI is new Ada.Unchecked_Conversion (LL_VBC, LL_VUI);
1184 function To_LL_VUI is new Ada.Unchecked_Conversion (LL_VUC, LL_VUI);
1185 function To_LL_VUI is new Ada.Unchecked_Conversion (LL_VSC, LL_VUI);
1186 function To_LL_VUI is new Ada.Unchecked_Conversion (LL_VBS, LL_VUI);
1187 function To_LL_VUI is new Ada.Unchecked_Conversion (LL_VUS, LL_VUI);
1188 function To_LL_VUI is new Ada.Unchecked_Conversion (LL_VSS, LL_VUI);
1189 function To_LL_VUI is new Ada.Unchecked_Conversion (LL_VBI, LL_VUI);
1190 function To_LL_VUI is new Ada.Unchecked_Conversion (LL_VUI, LL_VUI);
1191 function To_LL_VUI is new Ada.Unchecked_Conversion (LL_VSI, LL_VUI);
1192 function To_LL_VUI is new Ada.Unchecked_Conversion (LL_VF, LL_VUI);
1193 function To_LL_VUI is new Ada.Unchecked_Conversion (LL_VP, LL_VUI);
1195 function To_LL_VSI is new Ada.Unchecked_Conversion (LL_VBC, LL_VSI);
1196 function To_LL_VSI is new Ada.Unchecked_Conversion (LL_VUC, LL_VSI);
1197 function To_LL_VSI is new Ada.Unchecked_Conversion (LL_VSC, LL_VSI);
1198 function To_LL_VSI is new Ada.Unchecked_Conversion (LL_VBS, LL_VSI);
1199 function To_LL_VSI is new Ada.Unchecked_Conversion (LL_VUS, LL_VSI);
1200 function To_LL_VSI is new Ada.Unchecked_Conversion (LL_VSS, LL_VSI);
1201 function To_LL_VSI is new Ada.Unchecked_Conversion (LL_VBI, LL_VSI);
1202 function To_LL_VSI is new Ada.Unchecked_Conversion (LL_VUI, LL_VSI);
1203 function To_LL_VSI is new Ada.Unchecked_Conversion (LL_VSI, LL_VSI);
1204 function To_LL_VSI is new Ada.Unchecked_Conversion (LL_VF, LL_VSI);
1205 function To_LL_VSI is new Ada.Unchecked_Conversion (LL_VP, LL_VSI);
1207 function To_LL_VF is new Ada.Unchecked_Conversion (LL_VBC, LL_VF);
1208 function To_LL_VF is new Ada.Unchecked_Conversion (LL_VUC, LL_VF);
1209 function To_LL_VF is new Ada.Unchecked_Conversion (LL_VSC, LL_VF);
1210 function To_LL_VF is new Ada.Unchecked_Conversion (LL_VBS, LL_VF);
1211 function To_LL_VF is new Ada.Unchecked_Conversion (LL_VUS, LL_VF);
1212 function To_LL_VF is new Ada.Unchecked_Conversion (LL_VSS, LL_VF);
1213 function To_LL_VF is new Ada.Unchecked_Conversion (LL_VBI, LL_VF);
1214 function To_LL_VF is new Ada.Unchecked_Conversion (LL_VUI, LL_VF);
1215 function To_LL_VF is new Ada.Unchecked_Conversion (LL_VSI, LL_VF);
1216 function To_LL_VF is new Ada.Unchecked_Conversion (LL_VF, LL_VF);
1217 function To_LL_VF is new Ada.Unchecked_Conversion (LL_VP, LL_VF);
1219 function To_LL_VP is new Ada.Unchecked_Conversion (LL_VBC, LL_VP);
1220 function To_LL_VP is new Ada.Unchecked_Conversion (LL_VUC, LL_VP);
1221 function To_LL_VP is new Ada.Unchecked_Conversion (LL_VSC, LL_VP);
1222 function To_LL_VP is new Ada.Unchecked_Conversion (LL_VBS, LL_VP);
1223 function To_LL_VP is new Ada.Unchecked_Conversion (LL_VUS, LL_VP);
1224 function To_LL_VP is new Ada.Unchecked_Conversion (LL_VSS, LL_VP);
1225 function To_LL_VP is new Ada.Unchecked_Conversion (LL_VBI, LL_VP);
1226 function To_LL_VP is new Ada.Unchecked_Conversion (LL_VUI, LL_VP);
1227 function To_LL_VP is new Ada.Unchecked_Conversion (LL_VSI, LL_VP);
1228 function To_LL_VP is new Ada.Unchecked_Conversion (LL_VF, LL_VP);
1229 function To_LL_VP is new Ada.Unchecked_Conversion (LL_VP, LL_VP);
1231 ----------------------------------------------
1232 -- Conversions between pointer/access types --
1233 ----------------------------------------------
1236 new Ada.Unchecked_Conversion (vector_unsigned_char_ptr, c_ptr);
1238 new Ada.Unchecked_Conversion (vector_signed_char_ptr, c_ptr);
1240 new Ada.Unchecked_Conversion (vector_bool_char_ptr, c_ptr);
1242 new Ada.Unchecked_Conversion (vector_unsigned_short_ptr, c_ptr);
1244 new Ada.Unchecked_Conversion (vector_signed_short_ptr, c_ptr);
1246 new Ada.Unchecked_Conversion (vector_bool_short_ptr, c_ptr);
1248 new Ada.Unchecked_Conversion (vector_unsigned_int_ptr, c_ptr);
1250 new Ada.Unchecked_Conversion (vector_signed_int_ptr, c_ptr);
1252 new Ada.Unchecked_Conversion (vector_bool_int_ptr, c_ptr);
1254 new Ada.Unchecked_Conversion (vector_float_ptr, c_ptr);
1256 new Ada.Unchecked_Conversion (vector_pixel_ptr, c_ptr);
1258 new Ada.Unchecked_Conversion (const_vector_bool_char_ptr, c_ptr);
1260 new Ada.Unchecked_Conversion (const_vector_signed_char_ptr, c_ptr);
1262 new Ada.Unchecked_Conversion (const_vector_unsigned_char_ptr, c_ptr);
1264 new Ada.Unchecked_Conversion (const_vector_bool_short_ptr, c_ptr);
1266 new Ada.Unchecked_Conversion (const_vector_signed_short_ptr, c_ptr);
1268 new Ada.Unchecked_Conversion (const_vector_unsigned_short_ptr, c_ptr);
1270 new Ada.Unchecked_Conversion (const_vector_bool_int_ptr, c_ptr);
1272 new Ada.Unchecked_Conversion (const_vector_signed_int_ptr, c_ptr);
1274 new Ada.Unchecked_Conversion (const_vector_unsigned_int_ptr, c_ptr);
1276 new Ada.Unchecked_Conversion (const_vector_float_ptr, c_ptr);
1278 new Ada.Unchecked_Conversion (const_vector_pixel_ptr, c_ptr);
1280 new Ada.Unchecked_Conversion (c_ptr, c_ptr);
1282 new Ada.Unchecked_Conversion (signed_char_ptr, c_ptr);
1284 new Ada.Unchecked_Conversion (unsigned_char_ptr, c_ptr);
1286 new Ada.Unchecked_Conversion (short_ptr, c_ptr);
1288 new Ada.Unchecked_Conversion (signed_short_ptr, c_ptr);
1290 new Ada.Unchecked_Conversion (unsigned_short_ptr, c_ptr);
1292 new Ada.Unchecked_Conversion (int_ptr, c_ptr);
1294 new Ada.Unchecked_Conversion (signed_int_ptr, c_ptr);
1296 new Ada.Unchecked_Conversion (unsigned_int_ptr, c_ptr);
1298 new Ada.Unchecked_Conversion (long_ptr, c_ptr);
1300 new Ada.Unchecked_Conversion (signed_long_ptr, c_ptr);
1302 new Ada.Unchecked_Conversion (unsigned_long_ptr, c_ptr);
1304 new Ada.Unchecked_Conversion (float_ptr, c_ptr);
1306 new Ada.Unchecked_Conversion (const_signed_char_ptr, c_ptr);
1308 new Ada.Unchecked_Conversion (const_unsigned_char_ptr, c_ptr);
1310 new Ada.Unchecked_Conversion (const_short_ptr, c_ptr);
1312 new Ada.Unchecked_Conversion (const_signed_short_ptr, c_ptr);
1314 new Ada.Unchecked_Conversion (const_unsigned_short_ptr, c_ptr);
1316 new Ada.Unchecked_Conversion (const_int_ptr, c_ptr);
1318 new Ada.Unchecked_Conversion (const_signed_int_ptr, c_ptr);
1320 new Ada.Unchecked_Conversion (const_unsigned_int_ptr, c_ptr);
1322 new Ada.Unchecked_Conversion (const_long_ptr, c_ptr);
1324 new Ada.Unchecked_Conversion (const_signed_long_ptr, c_ptr);
1326 new Ada.Unchecked_Conversion (const_unsigned_long_ptr, c_ptr);
1328 new Ada.Unchecked_Conversion (const_float_ptr, c_ptr);
1330 new Ada.Unchecked_Conversion (constv_char_ptr, c_ptr);
1332 new Ada.Unchecked_Conversion (constv_signed_char_ptr, c_ptr);
1334 new Ada.Unchecked_Conversion (constv_unsigned_char_ptr, c_ptr);
1336 new Ada.Unchecked_Conversion (constv_short_ptr, c_ptr);
1338 new Ada.Unchecked_Conversion (constv_signed_short_ptr, c_ptr);
1340 new Ada.Unchecked_Conversion (constv_unsigned_short_ptr, c_ptr);
1342 new Ada.Unchecked_Conversion (constv_int_ptr, c_ptr);
1344 new Ada.Unchecked_Conversion (constv_signed_int_ptr, c_ptr);
1346 new Ada.Unchecked_Conversion (constv_unsigned_int_ptr, c_ptr);
1348 new Ada.Unchecked_Conversion (constv_long_ptr, c_ptr);
1350 new Ada.Unchecked_Conversion (constv_signed_long_ptr, c_ptr);
1352 new Ada.Unchecked_Conversion (constv_unsigned_long_ptr, c_ptr);
1354 new Ada.Unchecked_Conversion (constv_float_ptr, c_ptr);
1356 end GNAT.Altivec.Low_Level_Interface;