Commit cd8e18e7 by Olivier Hainque Committed by Arnaud Charlet

g-allein.ads, [...]: Code clean ups.

2015-02-20  Olivier Hainque  <hainque@adacore.com>

	* g-allein.ads, g-alveop.ads, g-alveop.adb: Code clean ups.

From-SVN: r220865
parent 9b9e7e8a
2015-02-20 Olivier Hainque <hainque@adacore.com> 2015-02-20 Olivier Hainque <hainque@adacore.com>
* g-allein.ads (vec_vspltw): Remove. * g-allein.ads, g-alveop.ads, g-alveop.adb: Code clean ups.
* g-alveop.ad?: Replace vec_vspltw renamings by proper Inline_Always
wrappers with Intrinsic convention.
2015-02-20 Olivier Hainque <hainque@adacore.com>
* g-allein.ads (vec_dstt): Remove.
* g-alveop.ad?: Replace vec_dstt renamings by proper Inline_Always
wrappers with Intrinsic convention.
2015-02-20 Olivier Hainque <hainque@adacore.com>
* g-allein.ads (vec_dst): Remove.
* g-alveop.ad?: Replace vec_dst renamings by proper Inline_Always
wrappers with Intrinsic convention.
2015-02-20 Olivier Hainque <hainque@adacore.com>
* g-allein.ads (vec_dss, vec_dssall): Remove.
* g-alveop.ads (vec_dss, vec_dssall): Rename the ll versions.
2015-02-20 Robert Dewar <dewar@adacore.com> 2015-02-20 Robert Dewar <dewar@adacore.com>
......
...@@ -33,292 +33,17 @@ ...@@ -33,292 +33,17 @@
-- both bindings (Hard or Soft), and relevant to the interfacing with the -- both bindings (Hard or Soft), and relevant to the interfacing with the
-- underlying Low Level support. -- underlying Low Level support.
-- The set of "services" includes: with GNAT.Altivec.Vector_Types; use GNAT.Altivec.Vector_Types;
-- with GNAT.Altivec.Low_Level_Vectors; use GNAT.Altivec.Low_Level_Vectors;
-- o Imports to the low level routines for which a direct binding is
-- mandatory (or just possible when analyzed as such).
--
-- o Conversion routines (unchecked) between low level types, or between
-- various pointer representations.
with GNAT.Altivec.Vector_Types;
with GNAT.Altivec.Low_Level_Vectors;
with Ada.Unchecked_Conversion; with Ada.Unchecked_Conversion;
package GNAT.Altivec.Low_Level_Interface is package GNAT.Altivec.Low_Level_Interface is
----------------------------------------------------------------------------
-- Imports for "argument must be literal" constraints in the Hard binding --
----------------------------------------------------------------------------
use GNAT.Altivec.Vector_Types;
-- vec_sld --
-- ??? The base GCC implementation maps everything to vsldoi_4si, while
-- it defines builtin variants for all the modes. Adjust here, to avoid
-- the infamous argument mode mismatch.
function vec_sld_vf_vf_cint_r_vf
(A : vector_float;
B : vector_float;
C : c_int) return vector_float;
pragma Import
(LL_Altivec, vec_sld_vf_vf_cint_r_vf, "__builtin_altivec_vsldoi_4sf");
function vec_sld_vsi_vsi_cint_r_vsi
(A : vector_signed_int;
B : vector_signed_int;
C : c_int) return vector_signed_int;
pragma Import
(LL_Altivec, vec_sld_vsi_vsi_cint_r_vsi, "__builtin_altivec_vsldoi_4si");
function vec_sld_vui_vui_cint_r_vui
(A : vector_unsigned_int;
B : vector_unsigned_int;
C : c_int) return vector_unsigned_int;
pragma Import
(LL_Altivec, vec_sld_vui_vui_cint_r_vui, "__builtin_altivec_vsldoi_4si");
function vec_sld_vbi_vbi_cint_r_vbi
(A : vector_bool_int;
B : vector_bool_int;
C : c_int) return vector_bool_int;
pragma Import
(LL_Altivec, vec_sld_vbi_vbi_cint_r_vbi, "__builtin_altivec_vsldoi_4si");
function vec_sld_vss_vss_cint_r_vss
(A : vector_signed_short;
B : vector_signed_short;
C : c_int) return vector_signed_short;
pragma Import
(LL_Altivec, vec_sld_vss_vss_cint_r_vss, "__builtin_altivec_vsldoi_8hi");
function vec_sld_vus_vus_cint_r_vus
(A : vector_unsigned_short;
B : vector_unsigned_short;
C : c_int) return vector_unsigned_short;
pragma Import
(LL_Altivec, vec_sld_vus_vus_cint_r_vus, "__builtin_altivec_vsldoi_8hi");
function vec_sld_vbs_vbs_cint_r_vbs
(A : vector_bool_short;
B : vector_bool_short;
C : c_int) return vector_bool_short;
pragma Import
(LL_Altivec, vec_sld_vbs_vbs_cint_r_vbs, "__builtin_altivec_vsldoi_8hi");
function vec_sld_vx_vx_cint_r_vx
(A : vector_pixel;
B : vector_pixel;
C : c_int) return vector_pixel;
pragma Import
(LL_Altivec, vec_sld_vx_vx_cint_r_vx, "__builtin_altivec_vsldoi_8hi");
function vec_sld_vsc_vsc_cint_r_vsc
(A : vector_signed_char;
B : vector_signed_char;
C : c_int) return vector_signed_char;
pragma Import
(LL_Altivec, vec_sld_vsc_vsc_cint_r_vsc, "__builtin_altivec_vsldoi_16qi");
function vec_sld_vuc_vuc_cint_r_vuc
(A : vector_unsigned_char;
B : vector_unsigned_char;
C : c_int) return vector_unsigned_char;
pragma Import
(LL_Altivec, vec_sld_vuc_vuc_cint_r_vuc, "__builtin_altivec_vsldoi_16qi");
function vec_sld_vbc_vbc_cint_r_vbc
(A : vector_bool_char;
B : vector_bool_char;
C : c_int) return vector_bool_char;
pragma Import
(LL_Altivec, vec_sld_vbc_vbc_cint_r_vbc, "__builtin_altivec_vsldoi_16qi");
-- vec_splat --
function vec_splat_vsc_cint_r_vsc
(A : vector_signed_char;
B : c_int) return vector_signed_char;
pragma Import
(LL_Altivec, vec_splat_vsc_cint_r_vsc, "__builtin_altivec_vspltb");
function vec_splat_vuc_cint_r_vuc
(A : vector_unsigned_char;
B : c_int) return vector_unsigned_char;
pragma Import
(LL_Altivec, vec_splat_vuc_cint_r_vuc, "__builtin_altivec_vspltb");
function vec_splat_vbc_cint_r_vbc
(A : vector_bool_char;
B : c_int) return vector_bool_char;
pragma Import
(LL_Altivec, vec_splat_vbc_cint_r_vbc, "__builtin_altivec_vspltb");
function vec_splat_vss_cint_r_vss
(A : vector_signed_short;
B : c_int) return vector_signed_short;
pragma Import
(LL_Altivec, vec_splat_vss_cint_r_vss, "__builtin_altivec_vsplth");
function vec_splat_vus_cint_r_vus
(A : vector_unsigned_short;
B : c_int) return vector_unsigned_short;
pragma Import
(LL_Altivec, vec_splat_vus_cint_r_vus, "__builtin_altivec_vsplth");
function vec_splat_vbs_cint_r_vbs
(A : vector_bool_short;
B : c_int) return vector_bool_short;
pragma Import
(LL_Altivec, vec_splat_vbs_cint_r_vbs, "__builtin_altivec_vsplth");
function vec_splat_vx_cint_r_vx
(A : vector_pixel;
B : c_int) return vector_pixel;
pragma Import
(LL_Altivec, vec_splat_vx_cint_r_vx, "__builtin_altivec_vsplth");
function vec_splat_vf_cint_r_vf
(A : vector_float;
B : c_int) return vector_float;
pragma Import
(LL_Altivec, vec_splat_vf_cint_r_vf, "__builtin_altivec_vspltw");
function vec_splat_vsi_cint_r_vsi
(A : vector_signed_int;
B : c_int) return vector_signed_int;
pragma Import
(LL_Altivec, vec_splat_vsi_cint_r_vsi, "__builtin_altivec_vspltw");
function vec_splat_vui_cint_r_vui
(A : vector_unsigned_int;
B : c_int) return vector_unsigned_int;
pragma Import
(LL_Altivec, vec_splat_vui_cint_r_vui, "__builtin_altivec_vspltw");
function vec_splat_vbi_cint_r_vbi
(A : vector_bool_int;
B : c_int) return vector_bool_int;
pragma Import
(LL_Altivec, vec_splat_vbi_cint_r_vbi, "__builtin_altivec_vspltw");
-- vec_vspltb --
function vec_vspltb_vsc_cint_r_vsc
(A : vector_signed_char;
B : c_int) return vector_signed_char;
pragma Import
(LL_Altivec, vec_vspltb_vsc_cint_r_vsc, "__builtin_altivec_vspltb");
function vec_vspltb_vuc_cint_r_vuc
(A : vector_unsigned_char;
B : c_int) return vector_unsigned_char;
pragma Import
(LL_Altivec, vec_vspltb_vuc_cint_r_vuc, "__builtin_altivec_vspltb");
function vec_vspltb_vbc_cint_r_vbc
(A : vector_bool_char;
B : c_int) return vector_bool_char;
pragma Import
(LL_Altivec, vec_vspltb_vbc_cint_r_vbc, "__builtin_altivec_vspltb");
-- vec_splat_s8 --
function vec_splat_s8_cint_r_vsc
(A : c_int) return vector_signed_char;
pragma Import
(LL_Altivec, vec_splat_s8_cint_r_vsc, "__builtin_altivec_vspltisb");
-- vec_splat_s16 --
function vec_splat_s16_cint_r_vss
(A : c_int) return vector_signed_short;
pragma Import
(LL_Altivec, vec_splat_s16_cint_r_vss, "__builtin_altivec_vspltish");
-- vec_splat_s32 --
function vec_splat_s32_cint_r_vsi
(A : c_int) return vector_signed_int;
pragma Import
(LL_Altivec, vec_splat_s32_cint_r_vsi, "__builtin_altivec_vspltisw");
-- vec_splat_u8 --
function vec_splat_u8_cint_r_vuc
(A : c_int) return vector_unsigned_char;
pragma Import
(LL_Altivec, vec_splat_u8_cint_r_vuc, "__builtin_altivec_vspltisb");
-- vec_splat_u16 --
function vec_splat_u16_cint_r_vus
(A : c_int) return vector_unsigned_short;
pragma Import
(LL_Altivec, vec_splat_u16_cint_r_vus, "__builtin_altivec_vspltish");
-- vec_splat_u32 --
function vec_splat_u32_cint_r_vui
(A : c_int) return vector_unsigned_int;
pragma Import
(LL_Altivec, vec_splat_u32_cint_r_vui, "__builtin_altivec_vspltisw");
------------------------------------------------------------
-- Imports for low-level signature consistent subprograms --
------------------------------------------------------------
----------------------------------------- -----------------------------------------
-- Conversions between low level types -- -- Conversions between low level types --
----------------------------------------- -----------------------------------------
use GNAT.Altivec.Low_Level_Vectors;
-- Something like...
--
-- TYPES="LL_VBC LL_VUC LL_VSC LL_VBS LL_VUS LL_VSS \
-- LL_VBI LL_VUI LL_VSI LL_VF LL_VP"
-- for TT in `echo $TYPES`; do
-- for ST in `echo $TYPES`; do
-- echo "function To_$TT is new Ada.Unchecked_Conversion ($ST, $TT);"
-- done
-- echo ""
-- done
function To_LL_VBC is new Ada.Unchecked_Conversion (LL_VBC, LL_VBC); function To_LL_VBC is new Ada.Unchecked_Conversion (LL_VBC, LL_VBC);
function To_LL_VBC is new Ada.Unchecked_Conversion (LL_VUC, LL_VBC); function To_LL_VBC is new Ada.Unchecked_Conversion (LL_VUC, LL_VBC);
function To_LL_VBC is new Ada.Unchecked_Conversion (LL_VSC, LL_VBC); function To_LL_VBC is new Ada.Unchecked_Conversion (LL_VSC, LL_VBC);
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
-- -- -- --
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
with GNAT.Altivec.Low_Level_Vectors; use GNAT.Altivec.Low_Level_Vectors; with GNAT.Altivec.Low_Level_Interface; use GNAT.Altivec.Low_Level_Interface;
package body GNAT.Altivec.Vector_Operations is package body GNAT.Altivec.Vector_Operations is
...@@ -8273,6 +8273,116 @@ package body GNAT.Altivec.Vector_Operations is ...@@ -8273,6 +8273,116 @@ package body GNAT.Altivec.Vector_Operations is
return To_LL_VP (vsplth (To_LL_VSS (A), B)); return To_LL_VP (vsplth (To_LL_VSS (A), B));
end vec_vsplth; end vec_vsplth;
-- vec_vspltb --
function vec_vspltb
(A : vector_unsigned_char;
B : c_int) return vector_unsigned_char
is
begin
return To_LL_VUC (vspltb (To_LL_VSC (A), B));
end vec_vspltb;
function vec_vspltb
(A : vector_bool_char;
B : c_int) return vector_bool_char
is
begin
return To_LL_VBC (vspltb (To_LL_VSC (A), B));
end vec_vspltb;
-- vec_splat_u8 --
function vec_splat_u8
(A : c_int) return vector_unsigned_char
is
begin
return To_LL_VUC (vspltisb (A));
end vec_splat_u8;
-- vec_splat_u16 --
function vec_splat_u16
(A : c_int) return vector_unsigned_short
is
begin
return To_LL_VUS (vspltish (A));
end vec_splat_u16;
-- vec_splat_u32 --
function vec_splat_u32
(A : c_int) return vector_unsigned_int
is
begin
return To_LL_VUI (vspltisw (A));
end vec_splat_u32;
-- vec_sld --
function vec_sld
(A : vector_unsigned_int;
B : vector_unsigned_int;
C : c_int) return vector_unsigned_int
is
begin
return To_LL_VUI (vsldoi_4si (To_LL_VSI (A), To_LL_VSI (B), C));
end vec_sld;
function vec_sld
(A : vector_bool_int;
B : vector_bool_int;
C : c_int) return vector_bool_int
is
begin
return To_LL_VBI (vsldoi_4si (To_LL_VSI (A), To_LL_VSI (B), C));
end vec_sld;
function vec_sld
(A : vector_unsigned_short;
B : vector_unsigned_short;
C : c_int) return vector_unsigned_short
is
begin
return To_LL_VUS (vsldoi_8hi (To_LL_VSS (A), To_LL_VSS (B), C));
end vec_sld;
function vec_sld
(A : vector_bool_short;
B : vector_bool_short;
C : c_int) return vector_bool_short
is
begin
return To_LL_VBS (vsldoi_8hi (To_LL_VSS (A), To_LL_VSS (B), C));
end vec_sld;
function vec_sld
(A : vector_pixel;
B : vector_pixel;
C : c_int) return vector_pixel
is
begin
return To_LL_VP (vsldoi_8hi (To_LL_VSS (A), To_LL_VSS (B), C));
end vec_sld;
function vec_sld
(A : vector_unsigned_char;
B : vector_unsigned_char;
C : c_int) return vector_unsigned_char
is
begin
return To_LL_VUC (vsldoi_16qi (To_LL_VSC (A), To_LL_VSC (B), C));
end vec_sld;
function vec_sld
(A : vector_bool_char;
B : vector_bool_char;
C : c_int) return vector_bool_char
is
begin
return To_LL_VBC (vsldoi_16qi (To_LL_VSC (A), To_LL_VSC (B), C));
end vec_sld;
----------------------------------- -----------------------------------
-- Bodies for Altivec predicates -- -- Bodies for Altivec predicates --
----------------------------------- -----------------------------------
......
...@@ -33,14 +33,70 @@ ...@@ -33,14 +33,70 @@
-- objects. It is common to both the Soft and the Hard bindings. -- objects. It is common to both the Soft and the Hard bindings.
with GNAT.Altivec.Vector_Types; use GNAT.Altivec.Vector_Types; with GNAT.Altivec.Vector_Types; use GNAT.Altivec.Vector_Types;
with GNAT.Altivec.Low_Level_Interface; use GNAT.Altivec.Low_Level_Interface; with GNAT.Altivec.Low_Level_Vectors; use GNAT.Altivec.Low_Level_Vectors;
with GNAT.Altivec.Low_Level_Vectors;
package GNAT.Altivec.Vector_Operations is package GNAT.Altivec.Vector_Operations is
-- The vast majority of the operations exposed here are type conversion -------------------------------------
-- wrappers around a much smaller set of low level primitives, exposed by -- Different flavors of interfaces --
-- the Altivec.Low_Level_Interface package. -------------------------------------
-- The vast majority of the user visible functions are just neutral type
-- conversion wrappers around calls to low level primitives. For instance:
--
-- function vec_sll
-- (A : vector_signed_int;
-- B : vector_unsigned_char) return vector_signed_int is
-- begin
-- return To_VSI (vsl (To_VSI (A), To_VSI (B)));
-- end vec_sll;
--
-- We actually don't always need an explicit wrapper and can bind directly
-- with a straight Import of the low level routine, or a renaming of such
-- instead.
--
-- A direct binding is not possible (that is, a wrapper is mandatory) in
-- a number of cases:
--
-- o When the high-level/low-level types don't match, in which case a
-- straight import would risk wrong code generation or compiler blowups in
-- the Hard binding case. This is the case for 'B' in the example above.
--
-- o When the high-level/low-level argument lists differ, as is the case
-- for most of the AltiVec predicates, relying on a low-level primitive
-- which expects a control code argument, like:
--
-- function vec_any_ne
-- (A : vector_signed_int;
-- B : vector_signed_int) return c_int is
-- begin
-- return vcmpequw_p (CR6_LT_REV, To_VSI (A), To_VSI (B));
-- end vec_any_ne;
--
-- o When the high-level/low-level arguments order don't match, as in:
--
-- function vec_cmplt
-- (A : vector_unsigned_char;
-- B : vector_unsigned_char) return vector_bool_char is
-- begin
-- return To_VBC (vcmpgtub (To_VSC (B), To_VSC (A)));
-- end vec_cmplt;
-----------------------------
-- Inlining considerations --
-----------------------------
-- The intent in the Hard binding case is to eventually map operations to
-- hardware instructions. Needless to say, intermediate function calls do
-- not fit this purpose, so all the user visible subprograms need to be
-- marked Inline_Always. Some of the builtins we eventually bind to expect
-- literal arguments. Wrappers to such builtins are made Convention
-- Intrinsic as well so we don't attempt to compile the bodies on their
-- own.
-- In the soft case, the bulk of the work is performed by the low level
-- routines, and those exported by this unit are short enough for the
-- inlining to make sense and even be beneficial.
------------------------------------------------------- -------------------------------------------------------
-- [PIM-4.4 Generic and Specific AltiVec operations] -- -- [PIM-4.4 Generic and Specific AltiVec operations] --
...@@ -987,6 +1043,9 @@ package GNAT.Altivec.Vector_Operations is ...@@ -987,6 +1043,9 @@ package GNAT.Altivec.Vector_Operations is
B : c_int; B : c_int;
C : c_int); C : c_int);
pragma Inline_Always (vec_dst);
pragma Convention (Intrinsic, vec_dst);
-- vec_dstst -- -- vec_dstst --
procedure vec_dstst procedure vec_dstst
...@@ -1089,6 +1148,9 @@ package GNAT.Altivec.Vector_Operations is ...@@ -1089,6 +1148,9 @@ package GNAT.Altivec.Vector_Operations is
B : c_int; B : c_int;
C : c_int); C : c_int);
pragma Inline_Always (vec_dstst);
pragma Convention (Intrinsic, vec_dstst);
-- vec_dststt -- -- vec_dststt --
procedure vec_dststt procedure vec_dststt
...@@ -1191,6 +1253,9 @@ package GNAT.Altivec.Vector_Operations is ...@@ -1191,6 +1253,9 @@ package GNAT.Altivec.Vector_Operations is
B : c_int; B : c_int;
C : c_int); C : c_int);
pragma Inline_Always (vec_dststt);
pragma Convention (Intrinsic, vec_dststt);
-- vec_dstt -- -- vec_dstt --
procedure vec_dstt procedure vec_dstt
...@@ -1293,6 +1358,9 @@ package GNAT.Altivec.Vector_Operations is ...@@ -1293,6 +1358,9 @@ package GNAT.Altivec.Vector_Operations is
B : c_int; B : c_int;
C : c_int); C : c_int);
pragma Inline_Always (vec_dstt);
pragma Convention (Intrinsic, vec_dstt);
-- vec_expte -- -- vec_expte --
function vec_expte function vec_expte
...@@ -2963,70 +3031,66 @@ package GNAT.Altivec.Vector_Operations is ...@@ -2963,70 +3031,66 @@ package GNAT.Altivec.Vector_Operations is
-- vec_sld -- -- vec_sld --
function vec_sld function vec_sld
(A : vector_float;
B : vector_float;
C : c_int) return vector_float
renames Low_Level_Interface.vec_sld_vf_vf_cint_r_vf;
function vec_sld
(A : vector_signed_int;
B : vector_signed_int;
C : c_int) return vector_signed_int
renames Low_Level_Interface.vec_sld_vsi_vsi_cint_r_vsi;
function vec_sld
(A : vector_unsigned_int; (A : vector_unsigned_int;
B : vector_unsigned_int; B : vector_unsigned_int;
C : c_int) return vector_unsigned_int C : c_int) return vector_unsigned_int;
renames Low_Level_Interface.vec_sld_vui_vui_cint_r_vui;
function vec_sld function vec_sld
(A : vector_bool_int; (A : vector_bool_int;
B : vector_bool_int; B : vector_bool_int;
C : c_int) return vector_bool_int C : c_int) return vector_bool_int;
renames Low_Level_Interface.vec_sld_vbi_vbi_cint_r_vbi;
function vec_sld
(A : vector_signed_short;
B : vector_signed_short;
C : c_int) return vector_signed_short
renames Low_Level_Interface.vec_sld_vss_vss_cint_r_vss;
function vec_sld function vec_sld
(A : vector_unsigned_short; (A : vector_unsigned_short;
B : vector_unsigned_short; B : vector_unsigned_short;
C : c_int) return vector_unsigned_short C : c_int) return vector_unsigned_short;
renames Low_Level_Interface.vec_sld_vus_vus_cint_r_vus;
function vec_sld function vec_sld
(A : vector_bool_short; (A : vector_bool_short;
B : vector_bool_short; B : vector_bool_short;
C : c_int) return vector_bool_short C : c_int) return vector_bool_short;
renames Low_Level_Interface.vec_sld_vbs_vbs_cint_r_vbs;
function vec_sld function vec_sld
(A : vector_pixel; (A : vector_pixel;
B : vector_pixel; B : vector_pixel;
C : c_int) return vector_pixel C : c_int) return vector_pixel;
renames Low_Level_Interface.vec_sld_vx_vx_cint_r_vx;
function vec_sld
(A : vector_signed_char;
B : vector_signed_char;
C : c_int) return vector_signed_char
renames Low_Level_Interface.vec_sld_vsc_vsc_cint_r_vsc;
function vec_sld function vec_sld
(A : vector_unsigned_char; (A : vector_unsigned_char;
B : vector_unsigned_char; B : vector_unsigned_char;
C : c_int) return vector_unsigned_char C : c_int) return vector_unsigned_char;
renames Low_Level_Interface.vec_sld_vuc_vuc_cint_r_vuc;
function vec_sld function vec_sld
(A : vector_bool_char; (A : vector_bool_char;
B : vector_bool_char; B : vector_bool_char;
C : c_int) return vector_bool_char C : c_int) return vector_bool_char;
renames Low_Level_Interface.vec_sld_vbc_vbc_cint_r_vbc;
pragma Inline_Always (vec_sld);
pragma Convention (Intrinsic, vec_sld);
function vec_sld
(A : vector_float;
B : vector_float;
C : c_int) return vector_float
renames Low_Level_Vectors.vsldoi_4sf;
function vec_sld
(A : vector_signed_int;
B : vector_signed_int;
C : c_int) return vector_signed_int
renames Low_Level_Vectors.vsldoi_4si;
function vec_sld
(A : vector_signed_short;
B : vector_signed_short;
C : c_int) return vector_signed_short
renames Low_Level_Vectors.vsldoi_8hi;
function vec_sld
(A : vector_signed_char;
B : vector_signed_char;
C : c_int) return vector_signed_char
renames Low_Level_Vectors.vsldoi_16qi;
-- vec_sll -- -- vec_sll --
...@@ -3216,63 +3280,6 @@ package GNAT.Altivec.Vector_Operations is ...@@ -3216,63 +3280,6 @@ package GNAT.Altivec.Vector_Operations is
(A : vector_unsigned_char; (A : vector_unsigned_char;
B : vector_unsigned_char) return vector_unsigned_char; B : vector_unsigned_char) return vector_unsigned_char;
-- vec_splat --
function vec_splat
(A : vector_signed_char;
B : c_int) return vector_signed_char
renames Low_Level_Interface.vec_splat_vsc_cint_r_vsc;
function vec_splat
(A : vector_unsigned_char;
B : c_int) return vector_unsigned_char
renames Low_Level_Interface.vec_splat_vuc_cint_r_vuc;
function vec_splat
(A : vector_bool_char;
B : c_int) return vector_bool_char
renames Low_Level_Interface.vec_splat_vbc_cint_r_vbc;
function vec_splat
(A : vector_signed_short;
B : c_int) return vector_signed_short
renames Low_Level_Interface.vec_splat_vss_cint_r_vss;
function vec_splat
(A : vector_unsigned_short;
B : c_int) return vector_unsigned_short
renames Low_Level_Interface.vec_splat_vus_cint_r_vus;
function vec_splat
(A : vector_bool_short;
B : c_int) return vector_bool_short
renames Low_Level_Interface.vec_splat_vbs_cint_r_vbs;
function vec_splat
(A : vector_pixel;
B : c_int) return vector_pixel
renames Low_Level_Interface.vec_splat_vx_cint_r_vx;
function vec_splat
(A : vector_float;
B : c_int) return vector_float
renames Low_Level_Interface.vec_splat_vf_cint_r_vf;
function vec_splat
(A : vector_signed_int;
B : c_int) return vector_signed_int
renames Low_Level_Interface.vec_splat_vsi_cint_r_vsi;
function vec_splat
(A : vector_unsigned_int;
B : c_int) return vector_unsigned_int
renames Low_Level_Interface.vec_splat_vui_cint_r_vui;
function vec_splat
(A : vector_bool_int;
B : c_int) return vector_bool_int
renames Low_Level_Interface.vec_splat_vbi_cint_r_vbi;
-- vec_vspltw -- -- vec_vspltw --
function vec_vspltw function vec_vspltw
...@@ -3320,55 +3327,38 @@ package GNAT.Altivec.Vector_Operations is ...@@ -3320,55 +3327,38 @@ package GNAT.Altivec.Vector_Operations is
-- vec_vspltb -- -- vec_vspltb --
function vec_vspltb function vec_vspltb
(A : vector_signed_char;
B : c_int) return vector_signed_char
renames Low_Level_Interface.vec_vspltb_vsc_cint_r_vsc;
function vec_vspltb
(A : vector_unsigned_char; (A : vector_unsigned_char;
B : c_int) return vector_unsigned_char B : c_int) return vector_unsigned_char;
renames Low_Level_Interface.vec_vspltb_vuc_cint_r_vuc;
function vec_vspltb function vec_vspltb
(A : vector_bool_char; (A : vector_bool_char;
B : c_int) return vector_bool_char B : c_int) return vector_bool_char;
renames Low_Level_Interface.vec_vspltb_vbc_cint_r_vbc;
-- vec_splat_s8 -- pragma Inline_Always (vec_vspltb);
pragma Convention (Intrinsic, vec_vspltb);
function vec_splat_s8 function vec_vspltb
(A : vector_signed_char;
B : c_int) return vector_signed_char
renames Low_Level_Vectors.vspltb;
-- vec_vspltisb --
function vec_vspltisb
(A : c_int) return vector_signed_char (A : c_int) return vector_signed_char
renames Low_Level_Interface.vec_splat_s8_cint_r_vsc; renames Low_Level_Vectors.vspltisb;
-- vec_splat_s16 -- -- vec_vspltish --
function vec_splat_s16 function vec_vspltish
(A : c_int) return vector_signed_short (A : c_int) return vector_signed_short
renames Low_Level_Interface.vec_splat_s16_cint_r_vss; renames Low_Level_Vectors.vspltish;
-- vec_splat_s32 -- -- vec_vspltisw --
function vec_splat_s32 function vec_vspltisw
(A : c_int) return vector_signed_int (A : c_int) return vector_signed_int
renames Low_Level_Interface.vec_splat_s32_cint_r_vsi; renames Low_Level_Vectors.vspltisw;
-- vec_splat_u8 --
function vec_splat_u8
(A : c_int) return vector_unsigned_char
renames Low_Level_Interface.vec_splat_u8_cint_r_vuc;
-- vec_splat_u16 --
function vec_splat_u16
(A : c_int) return vector_unsigned_short
renames Low_Level_Interface.vec_splat_u16_cint_r_vus;
-- vec_splat_u32 --
function vec_splat_u32
(A : c_int) return vector_unsigned_int
renames Low_Level_Interface.vec_splat_u32_cint_r_vui;
-- vec_sr -- -- vec_sr --
...@@ -5729,6 +5719,105 @@ package GNAT.Altivec.Vector_Operations is ...@@ -5729,6 +5719,105 @@ package GNAT.Altivec.Vector_Operations is
-- Straight overloads of routines aboves -- -- Straight overloads of routines aboves --
------------------------------------------- -------------------------------------------
-- vec_splat_s8 --
function vec_splat_s8
(A : c_int) return vector_signed_char
renames vec_vspltisb;
-- vec_splat_s16 --
function vec_splat_s16
(A : c_int) return vector_signed_short
renames vec_vspltish;
-- vec_splat_s32 --
function vec_splat_s32
(A : c_int) return vector_signed_int
renames vec_vspltisw;
-- vec_splat --
function vec_splat
(A : vector_signed_char;
B : c_int) return vector_signed_char
renames vec_vspltb;
function vec_splat
(A : vector_unsigned_char;
B : c_int) return vector_unsigned_char
renames vec_vspltb;
function vec_splat
(A : vector_bool_char;
B : c_int) return vector_bool_char
renames vec_vspltb;
function vec_splat
(A : vector_signed_short;
B : c_int) return vector_signed_short
renames vec_vsplth;
function vec_splat
(A : vector_unsigned_short;
B : c_int) return vector_unsigned_short
renames vec_vsplth;
function vec_splat
(A : vector_bool_short;
B : c_int) return vector_bool_short
renames vec_vsplth;
function vec_splat
(A : vector_pixel;
B : c_int) return vector_pixel
renames vec_vsplth;
function vec_splat
(A : vector_float;
B : c_int) return vector_float
renames vec_vspltw;
function vec_splat
(A : vector_signed_int;
B : c_int) return vector_signed_int
renames vec_vspltw;
function vec_splat
(A : vector_unsigned_int;
B : c_int) return vector_unsigned_int
renames vec_vspltw;
function vec_splat
(A : vector_bool_int;
B : c_int) return vector_bool_int
renames vec_vspltw;
-- vec_splat_u8 --
function vec_splat_u8
(A : c_int) return vector_unsigned_char;
pragma Inline_Always (vec_splat_u8);
pragma Convention (Intrinsic, vec_splat_u8);
-- vec_splat_u16 --
function vec_splat_u16
(A : c_int) return vector_unsigned_short;
pragma Inline_Always (vec_splat_u16);
pragma Convention (Intrinsic, vec_splat_u16);
-- vec_splat_u32 --
function vec_splat_u32
(A : c_int) return vector_unsigned_int;
pragma Inline_Always (vec_splat_u32);
pragma Convention (Intrinsic, vec_splat_u32);
-- vec_ctf -- -- vec_ctf --
function vec_ctf function vec_ctf
...@@ -6997,24 +7086,6 @@ package GNAT.Altivec.Vector_Operations is ...@@ -6997,24 +7086,6 @@ package GNAT.Altivec.Vector_Operations is
B : vector_unsigned_char) return vector_unsigned_char B : vector_unsigned_char) return vector_unsigned_char
renames vec_slo; renames vec_slo;
-- vec_vspltisb --
function vec_vspltisb
(A : c_int) return vector_signed_char
renames vec_splat_s8;
-- vec_vspltish --
function vec_vspltish
(A : c_int) return vector_signed_short
renames vec_splat_s16;
-- vec_vspltisw --
function vec_vspltisw
(A : c_int) return vector_signed_int
renames vec_splat_s32;
-- vec_vsr -- -- vec_vsr --
function vec_vsr function vec_vsr
...@@ -7740,62 +7811,6 @@ package GNAT.Altivec.Vector_Operations is ...@@ -7740,62 +7811,6 @@ package GNAT.Altivec.Vector_Operations is
private private
-------------------------------------
-- Different flavors of interfaces --
-------------------------------------
-- The vast majority of the user visible functions are just neutral type
-- conversion wrappers around calls to low level primitives. For instance:
--
-- function vec_sll
-- (A : vector_signed_int;
-- B : vector_unsigned_char) return vector_signed_int is
-- begin
-- return To_VSI (vsl (To_VSI (A), To_VSI (B)));
-- end vec_sll;
--
-- We actually don't always need an explicit wrapper and can bind directly
-- with a straight Import of the low level routine, or a renaming of such
-- instead.
--
-- A direct binding is not possible (that is, a wrapper is mandatory) in
-- a number of cases:
--
-- o When the high-level/low-level types don't match, in which case a
-- straight import would risk wrong code generation or compiler blowups in
-- the Hard binding case. This is the case for 'B' in the example above.
--
-- o When the high-level/low-level argument lists differ, as is the case
-- for most of the AltiVec predicates, relying on a low-level primitive
-- which expects a control code argument, like:
--
-- function vec_any_ne
-- (A : vector_signed_int;
-- B : vector_signed_int) return c_int is
-- begin
-- return vcmpequw_p (CR6_LT_REV, To_VSI (A), To_VSI (B));
-- end vec_any_ne;
--
-- o When the high-level/low-level arguments order don't match, as in:
--
-- function vec_cmplt
-- (A : vector_unsigned_char;
-- B : vector_unsigned_char) return vector_bool_char is
-- begin
-- return To_VBC (vcmpgtub (To_VSC (B), To_VSC (A)));
-- end vec_cmplt;
-----------------------------
-- Inlining considerations --
-----------------------------
-- The intent in the Hard binding case is to eventually map operations to
-- hardware instructions. Needless to say, intermediate function calls do
-- not fit this purpose, so all the user visible subprograms are inlined.
-- In the soft case, the bulk of the work is performed by the low level
-- routines, and those exported by this unit are short enough for the
-- inlining to make sense and even be beneficial, so...
pragma Inline_Always (vec_abs); pragma Inline_Always (vec_abs);
pragma Inline_Always (vec_abss); pragma Inline_Always (vec_abss);
pragma Inline_Always (vec_add); pragma Inline_Always (vec_add);
...@@ -8000,18 +8015,6 @@ private ...@@ -8000,18 +8015,6 @@ private
pragma Inline_Always (vec_any_numeric); pragma Inline_Always (vec_any_numeric);
pragma Inline_Always (vec_any_out); pragma Inline_Always (vec_any_out);
pragma Inline_Always (vec_dst);
pragma Convention (Intrinsic, vec_dst);
pragma Inline_Always (vec_dstt);
pragma Convention (Intrinsic, vec_dstt);
pragma Inline_Always (vec_dstst);
pragma Convention (Intrinsic, vec_dstst);
pragma Inline_Always (vec_dststt);
pragma Convention (Intrinsic, vec_dststt);
-- Similarly, vec_step is expected to be turned into a compile time -- Similarly, vec_step is expected to be turned into a compile time
-- constant, so ... -- constant, so ...
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment