1 ------------------------------------------------------------------------------
3 -- GNAT RUN-TIME COMPONENTS --
5 -- A D A . N U M E R I C S . A U X _ F L O A T --
8 -- (Intrinsic/SIMD Version, Float) --
10 -- Copyright (C) 1992-2023, Free Software Foundation, Inc. --
12 -- GNAT is free software; you can redistribute it and/or modify it under --
13 -- terms of the GNU General Public License as published by the Free Soft- --
14 -- ware Foundation; either version 3, or (at your option) any later ver- --
15 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
16 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
17 -- or FITNESS FOR A PARTICULAR PURPOSE. --
19 -- As a special exception under Section 7 of GPL version 3, you are granted --
20 -- additional permissions described in the GCC Runtime Library Exception, --
21 -- version 3.1, as published by the Free Software Foundation. --
23 -- You should have received a copy of the GNU General Public License and --
24 -- a copy of the GCC Runtime Library Exception along with this program; --
25 -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
26 -- <http://www.gnu.org/licenses/>. --
28 -- GNAT was originally developed by the GNAT team at New York University. --
29 -- Extensive contributions were provided by Ada Core Technologies Inc. --
31 ------------------------------------------------------------------------------
33 -- This package provides the basic computational interface for the
34 -- generic elementary functions. With the intrinsic/SIMD version, the
35 -- compiler can use its knowledge of the functions to select the most
36 -- suitable implementation, including a vector implementation. These
37 -- interfaces are suitable for cases in which Float and C's float
38 -- share the same representation.
40 with Ada
.Numerics
.Aux_Linker_Options
;
41 pragma Warnings
(Off
, Ada
.Numerics
.Aux_Linker_Options
);
43 package Ada
.Numerics
.Aux_Float
is
48 -- We import these functions as intrinsics. Note that we label them
49 -- all as pure functions, because indeed all of them are in fact pure.
51 function Sin
(X
: T
) return T
with
52 Import
, Convention
=> Intrinsic
, External_Name
=> "sinf";
53 pragma Machine_Attribute
(Sin
, "simd", "notinbranch");
55 function Cos
(X
: T
) return T
with
56 Import
, Convention
=> Intrinsic
, External_Name
=> "cosf";
57 pragma Machine_Attribute
(Cos
, "simd", "notinbranch");
59 function Tan
(X
: T
) return T
with
60 Import
, Convention
=> Intrinsic
, External_Name
=> "tanf";
62 function Exp
(X
: T
) return T
with
63 Import
, Convention
=> Intrinsic
, External_Name
=> "expf";
64 pragma Machine_Attribute
(Exp
, "simd", "notinbranch");
66 function Sqrt
(X
: T
) return T
with
67 Import
, Convention
=> Intrinsic
, External_Name
=> "sqrtf";
69 function Log
(X
: T
) return T
with
70 Import
, Convention
=> Intrinsic
, External_Name
=> "logf";
71 pragma Machine_Attribute
(Log
, "simd", "notinbranch");
73 function Acos
(X
: T
) return T
with
74 Import
, Convention
=> Intrinsic
, External_Name
=> "acosf";
76 function Asin
(X
: T
) return T
with
77 Import
, Convention
=> Intrinsic
, External_Name
=> "asinf";
79 function Atan
(X
: T
) return T
with
80 Import
, Convention
=> Intrinsic
, External_Name
=> "atanf";
82 function Sinh
(X
: T
) return T
with
83 Import
, Convention
=> Intrinsic
, External_Name
=> "sinhf";
85 function Cosh
(X
: T
) return T
with
86 Import
, Convention
=> Intrinsic
, External_Name
=> "coshf";
88 function Tanh
(X
: T
) return T
with
89 Import
, Convention
=> Intrinsic
, External_Name
=> "tanhf";
91 function Pow
(X
, Y
: T
) return T
with
92 Import
, Convention
=> Intrinsic
, External_Name
=> "powf";
93 pragma Machine_Attribute
(Pow
, "simd", "notinbranch");
95 end Ada
.Numerics
.Aux_Float
;