public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/users/aoliva/heads/testme)] revamp ada.numerics.aux
@ 2020-10-07 13:58 Alexandre Oliva
  0 siblings, 0 replies; 3+ messages in thread
From: Alexandre Oliva @ 2020-10-07 13:58 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:30ef79d90072a83128393ab368a5c7cce67d564c

commit 30ef79d90072a83128393ab368a5c7cce67d564c
Author: Alexandre Oliva <oliva@adacore.com>
Date:   Fri Oct 2 06:20:17 2020 -0300

    revamp ada.numerics.aux

Diff:
---
 gcc/ada/Makefile.rtl                               |  33 ++--
 gcc/ada/libgnat/a-nallfl.ads                       | 105 ++++++++++++
 gcc/ada/libgnat/a-nallfl__nolibm.ads               | 100 +++++++++++
 gcc/ada/libgnat/a-nallfl__wraplf.ads               | 105 ++++++++++++
 gcc/ada/libgnat/a-nalofl.ads                       | 105 ++++++++++++
 gcc/ada/libgnat/a-nalofl__dummy.adb                |  32 ++++
 ...{a-numaux__vxworks.ads => a-nalofl__nolibm.ads} |  47 +++---
 .../{a-numaux__darwin.adb => a-nalofl__sincos.adb} |  56 +++----
 .../{a-numaux__darwin.ads => a-nalofl__sincos.ads} |  37 ++---
 gcc/ada/libgnat/a-nashfl.ads                       | 106 ++++++++++++
 gcc/ada/libgnat/a-nashfl__wraplf.ads               | 103 ++++++++++++
 gcc/ada/libgnat/a-ngcoty.adb                       |  34 ++--
 gcc/ada/libgnat/a-ngelfu.adb                       |  39 ++---
 gcc/ada/libgnat/a-nuaufl.ads                       | 105 ++++++++++++
 gcc/ada/libgnat/a-nuaufl__nolibm.ads               | 100 +++++++++++
 gcc/ada/libgnat/a-nuaufl__wraplf.ads               | 105 ++++++++++++
 gcc/ada/libgnat/a-nugeau.ads                       | 184 +++++++++++++++++++++
 .../libgnat/{a-numaux__dummy.adb => a-numaux.adb}  |   0
 gcc/ada/libgnat/a-numaux.ads                       | 112 ++++++-------
 gcc/ada/libgnat/a-numaux__libc-x86.ads             |  97 ++++++-----
 20 files changed, 1386 insertions(+), 219 deletions(-)

diff --git a/gcc/ada/Makefile.rtl b/gcc/ada/Makefile.rtl
index fc978a2f79e..e0b8a4466d8 100644
--- a/gcc/ada/Makefile.rtl
+++ b/gcc/ada/Makefile.rtl
@@ -234,6 +234,11 @@ GNATRTL_NONTASKING_OBJS= \
   a-nudira$(objext) \
   a-nuelfu$(objext) \
   a-nuflra$(objext) \
+  a-nugeau$(objext) \
+  a-nallfl$(objext) \
+  a-nalofl$(objext) \
+  a-nuaufl$(objext) \
+  a-nashfl$(objext) \
   a-numaux$(objext) \
   a-numeri$(objext) \
   a-nurear$(objext) \
@@ -764,6 +769,7 @@ GNATRTL_NONTASKING_OBJS= \
 # Non-tasking case:
 
 LIBGNAT_TARGET_PAIRS = \
+a-nalofl.adb<libgnat/a-nalofl__dummy.adb \
 a-intnam.ads<libgnarl/a-intnam__dummy.ads \
 s-inmaop.adb<libgnarl/s-inmaop__dummy.adb \
 s-intman.adb<libgnarl/s-intman__dummy.adb \
@@ -835,12 +841,10 @@ ATOMICS_BUILTINS_TARGET_PAIRS = \
 
 X86_TARGET_PAIRS = \
   a-numaux.ads<libgnat/a-numaux__libc-x86.ads \
-  a-numaux.adb<libgnat/a-numaux__dummy.adb \
   s-atocou.adb<libgnat/s-atocou__x86.adb
 
 X86_64_TARGET_PAIRS = \
   a-numaux.ads<libgnat/a-numaux__libc-x86.ads \
-  a-numaux.adb<libgnat/a-numaux__dummy.adb \
   s-atocou.adb<libgnat/s-atocou__builtin.adb
 
 # Implementation of symbolic traceback based on dwarf
@@ -916,7 +920,9 @@ ifeq ($(strip $(filter-out powerpc% wrs vxworks vxworksspe vxworks7% vxworks7spe
 
   LIBGNAT_TARGET_PAIRS = \
   a-intnam.ads<libgnarl/a-intnam__vxworks.ads \
-  a-numaux.ads<libgnat/a-numaux__vxworks.ads \
+  a-nalofl.ads<libgnat/a-nalofl__nolibm.ads \
+  a-nallfl.ads<libgnat/a-nallfl__nolibm.ads \
+  a-nuaufl.ads<libgnat/a-nuaufl__nolibm.ads \
   s-inmaop.adb<libgnarl/s-inmaop__vxworks.adb \
   s-intman.ads<libgnarl/s-intman__vxworks.ads \
   s-intman.adb<libgnarl/s-intman__vxworks.adb \
@@ -1039,7 +1045,9 @@ ifeq ($(strip $(filter-out powerpc% wrs vxworksae vxworksaespe,$(target_cpu) $(t
   LIBGNAT_TARGET_PAIRS = \
   a-elchha.adb<libgnat/a-elchha__vxworks-ppc-full.adb \
   a-intnam.ads<libgnarl/a-intnam__vxworks.ads \
-  a-numaux.ads<libgnat/a-numaux__vxworks.ads \
+  a-nalofl.ads<libgnat/a-nalofl__nolibm.ads \
+  a-nallfl.ads<libgnat/a-nallfl__nolibm.ads \
+  a-nuaufl.ads<libgnat/a-nuaufl__nolibm.ads \
   g-io.adb<hie/g-io__vxworks-cert.adb \
   s-inmaop.adb<libgnarl/s-inmaop__vxworks.adb \
   s-interr.adb<libgnarl/s-interr__vxworks.adb \
@@ -1095,7 +1103,9 @@ ifeq ($(strip $(filter-out %86 wrs vxworksae,$(target_cpu) $(target_vendor) $(ta
   LIBGNAT_TARGET_PAIRS = \
   a-elchha.adb<libgnat/a-elchha__vxworks-ppc-full.adb \
   a-intnam.ads<libgnarl/a-intnam__vxworks.ads \
-  a-numaux.ads<libgnat/a-numaux__vxworks.ads \
+  a-nalofl.ads<libgnat/a-nalofl__nolibm.ads \
+  a-nallfl.ads<libgnat/a-nallfl__nolibm.ads \
+  a-nuaufl.ads<libgnat/a-nuaufl__nolibm.ads \
   g-io.adb<hie/g-io__vxworks-cert.adb \
   s-inmaop.adb<libgnarl/s-inmaop__vxworks.adb \
   s-interr.adb<libgnarl/s-interr__vxworks.adb \
@@ -1314,7 +1324,9 @@ ifeq ($(strip $(filter-out aarch64 arm% coff wrs vx%,$(target_cpu) $(target_vend
 
   LIBGNAT_TARGET_PAIRS = \
   a-intnam.ads<libgnarl/a-intnam__vxworks.ads \
-  a-numaux.ads<libgnat/a-numaux__vxworks.ads \
+  a-nalofl.ads<libgnat/a-nalofl__nolibm.ads \
+  a-nallfl.ads<libgnat/a-nallfl__nolibm.ads \
+  a-nuaufl.ads<libgnat/a-nuaufl__nolibm.ads \
   s-inmaop.adb<libgnarl/s-inmaop__vxworks.adb \
   s-interr.adb<libgnarl/s-interr__vxworks.adb \
   s-intman.ads<libgnarl/s-intman__vxworks.ads \
@@ -1592,6 +1604,7 @@ endif
 ifeq ($(strip $(filter-out %86 kfreebsd%,$(target_cpu) $(target_os))),)
   LIBGNAT_TARGET_PAIRS = \
   a-intnam.ads<libgnarl/a-intnam__freebsd.ads \
+  a-numaux.ads<libgnat/a-numaux__libc-x86.ads \
   s-inmaop.adb<libgnarl/s-inmaop__posix.adb \
   s-intman.adb<libgnarl/s-intman__posix.adb \
   s-osinte.adb<libgnarl/s-osinte__posix.adb \
@@ -1648,8 +1661,6 @@ endif
 ifeq ($(strip $(filter-out x86_64 kfreebsd%,$(target_cpu) $(target_os))),)
   LIBGNAT_TARGET_PAIRS = \
   a-intnam.ads<libgnarl/a-intnam__freebsd.ads \
-  a-numaux.ads<libgnat/a-numaux__libc-x86.ads \
-  a-numaux.adb<libgnat/a-numaux__dummy.adb \
   s-inmaop.adb<libgnarl/s-inmaop__posix.adb \
   s-intman.adb<libgnarl/s-intman__posix.adb \
   s-osinte.adb<libgnarl/s-osinte__posix.adb \
@@ -2552,8 +2563,10 @@ ifeq ($(strip $(filter-out darwin%,$(target_os))),)
     LIBGNAT_TARGET_PAIRS += \
       s-intman.adb<libgnarl/s-intman__posix.adb \
       s-osprim.adb<libgnat/s-osprim__posix.adb \
-      a-numaux.ads<libgnat/a-numaux__darwin.ads \
-      a-numaux.adb<libgnat/a-numaux__darwin.adb \
+      a-nalofl.ads<libgnat/a-nalofl__sincos.ads \
+      a-nallfl.ads<libgnat/a-nallfl__wraplf.ads \
+      a-nuaufl.ads<libgnat/a-nuaufl__wraplf.ads \
+      a-nashfl.ads<libgnat/a-nashfl__wraplf.ads \
       $(ATOMICS_TARGET_PAIRS) \
       $(ATOMICS_BUILTINS_TARGET_PAIRS) \
       system.ads<libgnat/system-darwin-ppc.ads
diff --git a/gcc/ada/libgnat/a-nallfl.ads b/gcc/ada/libgnat/a-nallfl.ads
new file mode 100644
index 00000000000..d6d322134db
--- /dev/null
+++ b/gcc/ada/libgnat/a-nallfl.ads
@@ -0,0 +1,105 @@
+------------------------------------------------------------------------------
+--                                                                          --
+--                         GNAT RUN-TIME COMPONENTS                         --
+--                                                                          --
+--     A D A . N U M E R I C S . A U X _ L O N G _ L O N G _ F L O A T      --
+--                                                                          --
+--                                 S p e c                                  --
+--                  (C Math Library Version, Long Long Float)               --
+--                                                                          --
+--          Copyright (C) 1992-2020, Free Software Foundation, Inc.         --
+--                                                                          --
+-- GNAT is free software;  you can  redistribute it  and/or modify it under --
+-- terms of the  GNU General Public License as published  by the Free Soft- --
+-- ware  Foundation;  either version 3,  or (at your option) any later ver- --
+-- sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE.                                     --
+--                                                                          --
+-- As a special exception under Section 7 of GPL version 3, you are granted --
+-- additional permissions described in the GCC Runtime Library Exception,   --
+-- version 3.1, as published by the Free Software Foundation.               --
+--                                                                          --
+-- You should have received a copy of the GNU General Public License and    --
+-- a copy of the GCC Runtime Library Exception along with this program;     --
+-- see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see    --
+-- <http://www.gnu.org/licenses/>.                                          --
+--                                                                          --
+-- GNAT was originally developed  by the GNAT team at  New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc.      --
+--                                                                          --
+------------------------------------------------------------------------------
+
+--  This package provides the basic computational interface for the generic
+--  elementary functions. The C library version interfaces with the routines
+--  in the C mathematical library, and is thus quite portable.
+
+--  This version here is for use with normal Unix math functions, from
+--  libm. Alternative versions are provided for special situations:
+
+--    a-nallfl__wraplf    For use where long double intrinsics are missing
+--    a-nallfl__nolibm    For use on VxWorks (where we have no libm.a library)
+
+package Ada.Numerics.Aux_Long_Long_Float is
+   pragma Pure;
+
+   subtype T is Long_Long_Float;
+
+   pragma Linker_Options ("-lm");
+
+   --  We import these functions directly from C. Note that we label them
+   --  all as pure functions, because indeed all of them are in fact pure.
+
+   function Sin (X : T) return T;
+   pragma Import (Intrinsic, Sin, "sinl");
+   pragma Pure_Function (Sin);
+
+   function Cos (X : T) return T;
+   pragma Import (Intrinsic, Cos, "cosl");
+   pragma Pure_Function (Cos);
+
+   function Tan (X : T) return T;
+   pragma Import (Intrinsic, Tan, "tanl");
+   pragma Pure_Function (Tan);
+
+   function Exp (X : T) return T;
+   pragma Import (Intrinsic, Exp, "expl");
+   pragma Pure_Function (Exp);
+
+   function Sqrt (X : T) return T;
+   pragma Import (Intrinsic, Sqrt, "sqrtl");
+   pragma Pure_Function (Sqrt);
+
+   function Log (X : T) return T;
+   pragma Import (Intrinsic, Log, "logl");
+   pragma Pure_Function (Log);
+
+   function Acos (X : T) return T;
+   pragma Import (Intrinsic, Acos, "acosl");
+   pragma Pure_Function (Acos);
+
+   function Asin (X : T) return T;
+   pragma Import (Intrinsic, Asin, "asinl");
+   pragma Pure_Function (Asin);
+
+   function Atan (X : T) return T;
+   pragma Import (Intrinsic, Atan, "atanl");
+   pragma Pure_Function (Atan);
+
+   function Sinh (X : T) return T;
+   pragma Import (Intrinsic, Sinh, "sinhl");
+   pragma Pure_Function (Sinh);
+
+   function Cosh (X : T) return T;
+   pragma Import (Intrinsic, Cosh, "coshl");
+   pragma Pure_Function (Cosh);
+
+   function Tanh (X : T) return T;
+   pragma Import (Intrinsic, Tanh, "tanhl");
+   pragma Pure_Function (Tanh);
+
+   function Pow (X, Y : T) return T;
+   pragma Import (Intrinsic, Pow, "powl");
+   pragma Pure_Function (Pow);
+
+end Ada.Numerics.Aux_Long_Long_Float;
diff --git a/gcc/ada/libgnat/a-nallfl__nolibm.ads b/gcc/ada/libgnat/a-nallfl__nolibm.ads
new file mode 100644
index 00000000000..6677211f661
--- /dev/null
+++ b/gcc/ada/libgnat/a-nallfl__nolibm.ads
@@ -0,0 +1,100 @@
+------------------------------------------------------------------------------
+--                                                                          --
+--                         GNAT RUN-TIME COMPONENTS                         --
+--                                                                          --
+--     A D A . N U M E R I C S . A U X _ L O N G _ L O N G _ F L O A T      --
+--                                                                          --
+--                                 S p e c                                  --
+--                    (C Library Version, Long Long Float)                  --
+--                                                                          --
+--          Copyright (C) 1992-2020, Free Software Foundation, Inc.         --
+--                                                                          --
+-- GNAT is free software;  you can  redistribute it  and/or modify it under --
+-- terms of the  GNU General Public License as published  by the Free Soft- --
+-- ware  Foundation;  either version 3,  or (at your option) any later ver- --
+-- sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE.                                     --
+--                                                                          --
+-- As a special exception under Section 7 of GPL version 3, you are granted --
+-- additional permissions described in the GCC Runtime Library Exception,   --
+-- version 3.1, as published by the Free Software Foundation.               --
+--                                                                          --
+-- You should have received a copy of the GNU General Public License and    --
+-- a copy of the GCC Runtime Library Exception along with this program;     --
+-- see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see    --
+-- <http://www.gnu.org/licenses/>.                                          --
+--                                                                          --
+-- GNAT was originally developed  by the GNAT team at  New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc.      --
+--                                                                          --
+------------------------------------------------------------------------------
+
+--  This package provides the basic computational interface for the generic
+--  elementary functions. The C library version interfaces with the routines
+--  in the C mathematical library, and is thus quite portable.
+
+--  This version here is for use with normal Unix math functions, from
+--  libc, not libm.
+
+package Ada.Numerics.Aux_Long_Long_Float is
+   pragma Pure;
+
+   subtype T is Long_Long_Float;
+
+   --  We import these functions directly from C. Note that we label them
+   --  all as pure functions, because indeed all of them are in fact pure.
+
+   function Sin (X : T) return T;
+   pragma Import (Intrinsic, Sin, "sinl");
+   pragma Pure_Function (Sin);
+
+   function Cos (X : T) return T;
+   pragma Import (Intrinsic, Cos, "cosl");
+   pragma Pure_Function (Cos);
+
+   function Tan (X : T) return T;
+   pragma Import (Intrinsic, Tan, "tanl");
+   pragma Pure_Function (Tan);
+
+   function Exp (X : T) return T;
+   pragma Import (Intrinsic, Exp, "expl");
+   pragma Pure_Function (Exp);
+
+   function Sqrt (X : T) return T;
+   pragma Import (Intrinsic, Sqrt, "sqrtl");
+   pragma Pure_Function (Sqrt);
+
+   function Log (X : T) return T;
+   pragma Import (Intrinsic, Log, "logl");
+   pragma Pure_Function (Log);
+
+   function Acos (X : T) return T;
+   pragma Import (Intrinsic, Acos, "acosl");
+   pragma Pure_Function (Acos);
+
+   function Asin (X : T) return T;
+   pragma Import (Intrinsic, Asin, "asinl");
+   pragma Pure_Function (Asin);
+
+   function Atan (X : T) return T;
+   pragma Import (Intrinsic, Atan, "atanl");
+   pragma Pure_Function (Atan);
+
+   function Sinh (X : T) return T;
+   pragma Import (Intrinsic, Sinh, "sinhl");
+   pragma Pure_Function (Sinh);
+
+   function Cosh (X : T) return T;
+   pragma Import (Intrinsic, Cosh, "coshl");
+   pragma Pure_Function (Cosh);
+
+   function Tanh (X : T) return T;
+   pragma Import (Intrinsic, Tanh, "tanhl");
+   pragma Pure_Function (Tanh);
+
+   function Pow (X, Y : T) return T;
+   pragma Import (Intrinsic, Pow, "powl");
+   pragma Pure_Function (Pow);
+
+end Ada.Numerics.Aux_Long_Long_Float;
diff --git a/gcc/ada/libgnat/a-nallfl__wraplf.ads b/gcc/ada/libgnat/a-nallfl__wraplf.ads
new file mode 100644
index 00000000000..5c6c954852e
--- /dev/null
+++ b/gcc/ada/libgnat/a-nallfl__wraplf.ads
@@ -0,0 +1,105 @@
+------------------------------------------------------------------------------
+--                                                                          --
+--                         GNAT RUN-TIME COMPONENTS                         --
+--                                                                          --
+--     A D A . N U M E R I C S . A U X _ L O N G _ L O N G _ F L O A T      --
+--                                                                          --
+--                                 S p e c                                  --
+--              (Long Long Float Wrapper in terms of Long Float)            --
+--                                                                          --
+--          Copyright (C) 1992-2020, Free Software Foundation, Inc.         --
+--                                                                          --
+-- GNAT is free software;  you can  redistribute it  and/or modify it under --
+-- terms of the  GNU General Public License as published  by the Free Soft- --
+-- ware  Foundation;  either version 3,  or (at your option) any later ver- --
+-- sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE.                                     --
+--                                                                          --
+-- As a special exception under Section 7 of GPL version 3, you are granted --
+-- additional permissions described in the GCC Runtime Library Exception,   --
+-- version 3.1, as published by the Free Software Foundation.               --
+--                                                                          --
+-- You should have received a copy of the GNU General Public License and    --
+-- a copy of the GCC Runtime Library Exception along with this program;     --
+-- see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see    --
+-- <http://www.gnu.org/licenses/>.                                          --
+--                                                                          --
+-- GNAT was originally developed  by the GNAT team at  New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc.      --
+--                                                                          --
+------------------------------------------------------------------------------
+
+--  This package provides the basic computational interface for the generic
+--  elementary functions. The C library version interfaces with the routines
+--  in the C mathematical library, and is thus quite portable.
+
+--  This version here is for use when long double functions are not
+--  present in the C library, so we use the double ones instead.
+
+with Ada.Numerics.Aux_Long_Float;
+
+package Ada.Numerics.Aux_Long_Long_Float is
+   pragma Pure;
+
+   subtype T is Long_Long_Float;
+
+   package Aux renames Aux_Long_Float;
+
+   subtype W is Aux.T;
+
+   --  Use the Aux implementation.
+
+   function Sin (X : T) return T
+   is (T (Aux.Sin (W (X))));
+   pragma Inline (Sin);
+
+   function Cos (X : T) return T
+   is (T (Aux.Cos (W (X))));
+   pragma Inline (Cos);
+
+   function Tan (X : T) return T
+   is (T (Aux.Tan (W (X))));
+   pragma Inline (Tan);
+
+   function Exp (X : T) return T
+   is (T (Aux.Exp (W (X))));
+   pragma Inline (Exp);
+
+   function Sqrt (X : T) return T
+   is (T (Aux.Sqrt (W (X))));
+   pragma Inline (Sqrt);
+
+   function Log (X : T) return T
+   is (T (Aux.Log (W (X))));
+   pragma Inline (Log);
+
+   function Acos (X : T) return T
+   is (T (Aux.Acos (W (X))));
+   pragma Inline (Acos);
+
+   function Asin (X : T) return T
+   is (T (Aux.Asin (W (X))));
+   pragma Inline (Asin);
+
+   function Atan (X : T) return T
+   is (T (Aux.Atan (W (X))));
+   pragma Inline (Atan);
+
+   function Sinh (X : T) return T
+   is (T (Aux.Sinh (W (X))));
+   pragma Inline (Sinh);
+
+   function Cosh (X : T) return T
+   is (T (Aux.Cosh (W (X))));
+   pragma Inline (Cosh);
+
+   function Tanh (X : T) return T
+   is (T (Aux.Tanh (W (X))));
+   pragma Inline (Tanh);
+
+   function Pow (X, Y : T) return T
+   is (T (Aux.Pow (W (X), W (Y))));
+   pragma Inline (Pow);
+
+end Ada.Numerics.Aux_Long_Long_Float;
diff --git a/gcc/ada/libgnat/a-nalofl.ads b/gcc/ada/libgnat/a-nalofl.ads
new file mode 100644
index 00000000000..4e0d7012409
--- /dev/null
+++ b/gcc/ada/libgnat/a-nalofl.ads
@@ -0,0 +1,105 @@
+------------------------------------------------------------------------------
+--                                                                          --
+--                         GNAT RUN-TIME COMPONENTS                         --
+--                                                                          --
+--          A D A . N U M E R I C S . A U X _ L O N G _ F L O A T           --
+--                                                                          --
+--                                 S p e c                                  --
+--                     (C Math Library Version, Long Float)                 --
+--                                                                          --
+--          Copyright (C) 1992-2020, Free Software Foundation, Inc.         --
+--                                                                          --
+-- GNAT is free software;  you can  redistribute it  and/or modify it under --
+-- terms of the  GNU General Public License as published  by the Free Soft- --
+-- ware  Foundation;  either version 3,  or (at your option) any later ver- --
+-- sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE.                                     --
+--                                                                          --
+-- As a special exception under Section 7 of GPL version 3, you are granted --
+-- additional permissions described in the GCC Runtime Library Exception,   --
+-- version 3.1, as published by the Free Software Foundation.               --
+--                                                                          --
+-- You should have received a copy of the GNU General Public License and    --
+-- a copy of the GCC Runtime Library Exception along with this program;     --
+-- see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see    --
+-- <http://www.gnu.org/licenses/>.                                          --
+--                                                                          --
+-- GNAT was originally developed  by the GNAT team at  New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc.      --
+--                                                                          --
+------------------------------------------------------------------------------
+
+--  This package provides the basic computational interface for the generic
+--  elementary functions. The C library version interfaces with the routines
+--  in the C mathematical library, and is thus quite portable.
+
+--  This version here is for use with normal Unix math functions, from
+--  libm. Alternative versions are provided for special situations:
+
+--    a-nalofl__nolibm    For use on VxWorks (where we have no libm.a library)
+--    a-nalofl__sincos    For use on Mac OS X (inaccurate sin and cos in libc)
+
+package Ada.Numerics.Aux_Long_Float is
+   pragma Pure;
+
+   subtype T is Long_Float;
+
+   pragma Linker_Options ("-lm");
+
+   --  We import these functions directly from C. Note that we label them
+   --  all as pure functions, because indeed all of them are in fact pure.
+
+   function Sin (X : T) return T;
+   pragma Import (Intrinsic, Sin, "sin");
+   pragma Pure_Function (Sin);
+
+   function Cos (X : T) return T;
+   pragma Import (Intrinsic, Cos, "cos");
+   pragma Pure_Function (Cos);
+
+   function Tan (X : T) return T;
+   pragma Import (Intrinsic, Tan, "tan");
+   pragma Pure_Function (Tan);
+
+   function Exp (X : T) return T;
+   pragma Import (Intrinsic, Exp, "exp");
+   pragma Pure_Function (Exp);
+
+   function Sqrt (X : T) return T;
+   pragma Import (Intrinsic, Sqrt, "sqrt");
+   pragma Pure_Function (Sqrt);
+
+   function Log (X : T) return T;
+   pragma Import (Intrinsic, Log, "log");
+   pragma Pure_Function (Log);
+
+   function Acos (X : T) return T;
+   pragma Import (Intrinsic, Acos, "acos");
+   pragma Pure_Function (Acos);
+
+   function Asin (X : T) return T;
+   pragma Import (Intrinsic, Asin, "asin");
+   pragma Pure_Function (Asin);
+
+   function Atan (X : T) return T;
+   pragma Import (Intrinsic, Atan, "atan");
+   pragma Pure_Function (Atan);
+
+   function Sinh (X : T) return T;
+   pragma Import (Intrinsic, Sinh, "sinh");
+   pragma Pure_Function (Sinh);
+
+   function Cosh (X : T) return T;
+   pragma Import (Intrinsic, Cosh, "cosh");
+   pragma Pure_Function (Cosh);
+
+   function Tanh (X : T) return T;
+   pragma Import (Intrinsic, Tanh, "tanh");
+   pragma Pure_Function (Tanh);
+
+   function Pow (X, Y : T) return T;
+   pragma Import (Intrinsic, Pow, "pow");
+   pragma Pure_Function (Pow);
+
+end Ada.Numerics.Aux_Long_Float;
diff --git a/gcc/ada/libgnat/a-nalofl__dummy.adb b/gcc/ada/libgnat/a-nalofl__dummy.adb
new file mode 100644
index 00000000000..def7d72d237
--- /dev/null
+++ b/gcc/ada/libgnat/a-nalofl__dummy.adb
@@ -0,0 +1,32 @@
+------------------------------------------------------------------------------
+--                                                                          --
+--                         GNAT RUN-TIME COMPONENTS                         --
+--                                                                          --
+--          A D A . N U M E R I C S . A U X _ L O N G _ F L O A T           --
+--                                                                          --
+--                                 B o d y                                  --
+--                                                                          --
+--          Copyright (C) 1992-2020, Free Software Foundation, Inc.         --
+--                                                                          --
+-- GNAT is free software;  you can  redistribute it  and/or modify it under --
+-- terms of the  GNU General Public License as published  by the Free Soft- --
+-- ware  Foundation;  either version 3,  or (at your option) any later ver- --
+-- sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE.                                     --
+--                                                                          --
+-- As a special exception under Section 7 of GPL version 3, you are granted --
+-- additional permissions described in the GCC Runtime Library Exception,   --
+-- version 3.1, as published by the Free Software Foundation.               --
+--                                                                          --
+-- You should have received a copy of the GNU General Public License and    --
+-- a copy of the GCC Runtime Library Exception along with this program;     --
+-- see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see    --
+-- <http://www.gnu.org/licenses/>.                                          --
+--                                                                          --
+-- GNAT was originally developed  by the GNAT team at  New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc.      --
+--                                                                          --
+------------------------------------------------------------------------------
+
+pragma No_Body;
diff --git a/gcc/ada/libgnat/a-numaux__vxworks.ads b/gcc/ada/libgnat/a-nalofl__nolibm.ads
similarity index 75%
rename from gcc/ada/libgnat/a-numaux__vxworks.ads
rename to gcc/ada/libgnat/a-nalofl__nolibm.ads
index 410655de8a6..d7bdd517e5d 100644
--- a/gcc/ada/libgnat/a-numaux__vxworks.ads
+++ b/gcc/ada/libgnat/a-nalofl__nolibm.ads
@@ -2,10 +2,10 @@
 --                                                                          --
 --                         GNAT RUN-TIME COMPONENTS                         --
 --                                                                          --
---                     A D A . N U M E R I C S . A U X                      --
+--          A D A . N U M E R I C S . A U X _ L O N G _ F L O A T           --
 --                                                                          --
 --                                 S p e c                                  --
---                       (C Library Version, VxWorks)                       --
+--                       (C Library Version, Long Float)                    --
 --                                                                          --
 --          Copyright (C) 1992-2020, Free Software Foundation, Inc.         --
 --                                                                          --
@@ -30,68 +30,73 @@
 --                                                                          --
 ------------------------------------------------------------------------------
 
---  Version for use on VxWorks (where we have no libm.a library), so the pragma
---  Linker_Options ("-lm") is omitted in this version.
+--  This package provides the basic computational interface for the generic
+--  elementary functions. The C library version interfaces with the routines
+--  in the C mathematical library, and is thus quite portable.
 
-package Ada.Numerics.Aux is
+--  This version here is for use with normal Unix math functions, from
+--  libc. Alternative versions are provided for special situations:
+
+--    a-nmaxlf__nolibm   For use on VxWorks (where we have no libm.a library)
+
+package Ada.Numerics.Aux_Long_Float is
    pragma Pure;
 
-   type Double is new Long_Float;
-   --  Type Double is the type used to call the C routines
+   subtype T is Long_Float;
 
    --  We import these functions directly from C. Note that we label them
    --  all as pure functions, because indeed all of them are in fact pure.
 
-   function Sin (X : Double) return Double;
+   function Sin (X : T) return T;
    pragma Import (Intrinsic, Sin, "sin");
    pragma Pure_Function (Sin);
 
-   function Cos (X : Double) return Double;
+   function Cos (X : T) return T;
    pragma Import (Intrinsic, Cos, "cos");
    pragma Pure_Function (Cos);
 
-   function Tan (X : Double) return Double;
+   function Tan (X : T) return T;
    pragma Import (Intrinsic, Tan, "tan");
    pragma Pure_Function (Tan);
 
-   function Exp (X : Double) return Double;
+   function Exp (X : T) return T;
    pragma Import (Intrinsic, Exp, "exp");
    pragma Pure_Function (Exp);
 
-   function Sqrt (X : Double) return Double;
+   function Sqrt (X : T) return T;
    pragma Import (Intrinsic, Sqrt, "sqrt");
    pragma Pure_Function (Sqrt);
 
-   function Log (X : Double) return Double;
+   function Log (X : T) return T;
    pragma Import (Intrinsic, Log, "log");
    pragma Pure_Function (Log);
 
-   function Acos (X : Double) return Double;
+   function Acos (X : T) return T;
    pragma Import (Intrinsic, Acos, "acos");
    pragma Pure_Function (Acos);
 
-   function Asin (X : Double) return Double;
+   function Asin (X : T) return T;
    pragma Import (Intrinsic, Asin, "asin");
    pragma Pure_Function (Asin);
 
-   function Atan (X : Double) return Double;
+   function Atan (X : T) return T;
    pragma Import (Intrinsic, Atan, "atan");
    pragma Pure_Function (Atan);
 
-   function Sinh (X : Double) return Double;
+   function Sinh (X : T) return T;
    pragma Import (Intrinsic, Sinh, "sinh");
    pragma Pure_Function (Sinh);
 
-   function Cosh (X : Double) return Double;
+   function Cosh (X : T) return T;
    pragma Import (Intrinsic, Cosh, "cosh");
    pragma Pure_Function (Cosh);
 
-   function Tanh (X : Double) return Double;
+   function Tanh (X : T) return T;
    pragma Import (Intrinsic, Tanh, "tanh");
    pragma Pure_Function (Tanh);
 
-   function Pow (X, Y : Double) return Double;
+   function Pow (X, Y : T) return T;
    pragma Import (Intrinsic, Pow, "pow");
    pragma Pure_Function (Pow);
 
-end Ada.Numerics.Aux;
+end Ada.Numerics.Aux_Long_Float;
diff --git a/gcc/ada/libgnat/a-numaux__darwin.adb b/gcc/ada/libgnat/a-nalofl__sincos.adb
similarity index 81%
rename from gcc/ada/libgnat/a-numaux__darwin.adb
rename to gcc/ada/libgnat/a-nalofl__sincos.adb
index 85fdd2468b5..58cda134fde 100644
--- a/gcc/ada/libgnat/a-numaux__darwin.adb
+++ b/gcc/ada/libgnat/a-nalofl__sincos.adb
@@ -2,7 +2,7 @@
 --                                                                          --
 --                         GNAT RUN-TIME COMPONENTS                         --
 --                                                                          --
---                     A D A . N U M E R I C S . A U X                      --
+--          A D A . N U M E R I C S . A U X _ L O N G _ F L O A T           --
 --                                                                          --
 --                                 B o d y                                  --
 --                          (Apple OS X Version)                            --
@@ -30,16 +30,16 @@
 --                                                                          --
 ------------------------------------------------------------------------------
 
-package body Ada.Numerics.Aux is
+package body Ada.Numerics.Aux.LF is
 
    -----------------------
    -- Local subprograms --
    -----------------------
 
-   function Is_Nan (X : Double) return Boolean;
+   function Is_Nan (X : T) return Boolean;
    --  Return True iff X is a IEEE NaN value
 
-   procedure Reduce (X : in out Double; Q : out Natural);
+   procedure Reduce (X : in out T; Q : out Natural);
    --  Implement reduction of X by Pi/2. Q is the quadrant of the final
    --  result in the range 0..3. The absolute value of X is at most Pi/4.
    --  It is needed to avoid a loss of accuracy for sin near Pi and cos
@@ -50,8 +50,8 @@ package body Ada.Numerics.Aux is
    --  of the trigonometric functions in their reduced domain.
    --  These approximations have been computed using Maple.
 
-   function Sine_Approx (X : Double) return Double;
-   function Cosine_Approx (X : Double) return Double;
+   function Sine_Approx (X : T) return T;
+   function Cosine_Approx (X : T) return T;
 
    pragma Inline (Reduce);
    pragma Inline (Sine_Approx);
@@ -61,8 +61,8 @@ package body Ada.Numerics.Aux is
    -- Cosine_Approx --
    -------------------
 
-   function Cosine_Approx (X : Double) return Double is
-      XX : constant Double := X * X;
+   function Cosine_Approx (X : T) return T is
+      XX : constant T := X * X;
    begin
       return (((((16#8.DC57FBD05F640#E-08 * XX
               - 16#4.9F7D00BF25D80#E-06) * XX
@@ -77,8 +77,8 @@ package body Ada.Numerics.Aux is
    -- Sine_Approx --
    -----------------
 
-   function Sine_Approx (X : Double) return Double is
-      XX : constant Double := X * X;
+   function Sine_Approx (X : T) return T is
+      XX : constant T := X * X;
    begin
       return (((((16#A.EA2D4ABE41808#E-09 * XX
               - 16#6.B974C10F9D078#E-07) * XX
@@ -92,7 +92,7 @@ package body Ada.Numerics.Aux is
    -- Is_Nan --
    ------------
 
-   function Is_Nan (X : Double) return Boolean is
+   function Is_Nan (X : T) return Boolean is
    begin
       --  The IEEE NaN values are the only ones that do not equal themselves
 
@@ -103,20 +103,20 @@ package body Ada.Numerics.Aux is
    -- Reduce --
    ------------
 
-   procedure Reduce (X : in out Double; Q : out Natural) is
+   procedure Reduce (X : in out T; Q : out Natural) is
       Half_Pi     : constant := Pi / 2.0;
       Two_Over_Pi : constant := 2.0 / Pi;
 
-      HM : constant := Integer'Min (Double'Machine_Mantissa / 2, Natural'Size);
-      M  : constant Double := 0.5 + 2.0**(1 - HM); -- Splitting constant
-      P1 : constant Double := Double'Leading_Part (Half_Pi, HM);
-      P2 : constant Double := Double'Leading_Part (Half_Pi - P1, HM);
-      P3 : constant Double := Double'Leading_Part (Half_Pi - P1 - P2, HM);
-      P4 : constant Double := Double'Leading_Part (Half_Pi - P1 - P2 - P3, HM);
-      P5 : constant Double := Double'Leading_Part (Half_Pi - P1 - P2 - P3
+      HM : constant := Integer'Min (T'Machine_Mantissa / 2, Natural'Size);
+      M  : constant T := 0.5 + 2.0**(1 - HM); -- Splitting constant
+      P1 : constant T := T'Leading_Part (Half_Pi, HM);
+      P2 : constant T := T'Leading_Part (Half_Pi - P1, HM);
+      P3 : constant T := T'Leading_Part (Half_Pi - P1 - P2, HM);
+      P4 : constant T := T'Leading_Part (Half_Pi - P1 - P2 - P3, HM);
+      P5 : constant T := T'Leading_Part (Half_Pi - P1 - P2 - P3
                                                                  - P4, HM);
-      P6 : constant Double := Double'Model (Half_Pi - P1 - P2 - P3 - P4 - P5);
-      K  : Double;
+      P6 : constant T := T'Model (Half_Pi - P1 - P2 - P3 - P4 - P5);
+      K  : T;
       R  : Integer;
 
    begin
@@ -142,9 +142,9 @@ package body Ada.Numerics.Aux is
 
       --  Go through an integer temporary so as to use machine instructions
 
-      R := Integer (Double'Rounding (K));
+      R := Integer (T'Rounding (K));
       Q := R mod 4;
-      K := Double (R);
+      K := T (R);
       X := (((((X - K * P1) - K * P2) - K * P3) - K * P4) - K * P5) - K * P6;
    end Reduce;
 
@@ -152,8 +152,8 @@ package body Ada.Numerics.Aux is
    -- Cos --
    ---------
 
-   function Cos (X : Double) return Double is
-      Reduced_X : Double := abs X;
+   function Cos (X : T) return T is
+      Reduced_X : T := abs X;
       Quadrant  : Natural range 0 .. 3;
 
    begin
@@ -182,8 +182,8 @@ package body Ada.Numerics.Aux is
    -- Sin --
    ---------
 
-   function Sin (X : Double) return Double is
-      Reduced_X : Double := X;
+   function Sin (X : T) return T is
+      Reduced_X : T := X;
       Quadrant  : Natural range 0 .. 3;
 
    begin
@@ -208,4 +208,4 @@ package body Ada.Numerics.Aux is
       return Sine_Approx (Reduced_X);
    end Sin;
 
-end Ada.Numerics.Aux;
+end Ada.Numerics.Aux.LF;
diff --git a/gcc/ada/libgnat/a-numaux__darwin.ads b/gcc/ada/libgnat/a-nalofl__sincos.ads
similarity index 83%
rename from gcc/ada/libgnat/a-numaux__darwin.ads
rename to gcc/ada/libgnat/a-nalofl__sincos.ads
index add87a49193..7e46a79074c 100644
--- a/gcc/ada/libgnat/a-numaux__darwin.ads
+++ b/gcc/ada/libgnat/a-nalofl__sincos.ads
@@ -2,7 +2,7 @@
 --                                                                          --
 --                         GNAT RUN-TIME COMPONENTS                         --
 --                                                                          --
---                     A D A . N U M E R I C S . A U X                      --
+--          A D A . N U M E R I C S . A U X _ L O N G _ F L O A T           --
 --                                                                          --
 --                                 S p e c                                  --
 --                          (Apple OS X Version)                            --
@@ -34,70 +34,69 @@
 --  except for sine/cosine which have been implemented directly in Ada to get
 --  the required accuracy.
 
-package Ada.Numerics.Aux is
+package Ada.Numerics.Aux_Long_Float is
    pragma Pure;
 
-   pragma Linker_Options ("-lm");
+   subtype T is Long_Float;
 
-   type Double is new Long_Float;
-   --  Type Double is the type used to call the C routines
+   pragma Linker_Options ("-lm");
 
    --  The following functions have been implemented in Ada, since
    --  the OS X math library didn't meet accuracy requirements for
    --  argument reduction. The implementation here has been tailored
    --  to match Ada strict mode Numerics requirements while maintaining
    --  maximum efficiency.
-   function Sin (X : Double) return Double;
+   function Sin (X : T) return T;
    pragma Inline (Sin);
 
-   function Cos (X : Double) return Double;
+   function Cos (X : T) return T;
    pragma Inline (Cos);
 
    --  We import these functions directly from C. Note that we label them
    --  all as pure functions, because indeed all of them are in fact pure.
 
-   function Tan (X : Double) return Double;
+   function Tan (X : T) return T;
    pragma Import (Intrinsic, Tan, "tan");
    pragma Pure_Function (Tan);
 
-   function Exp (X : Double) return Double;
+   function Exp (X : T) return T;
    pragma Import (Intrinsic, Exp, "exp");
    pragma Pure_Function (Exp);
 
-   function Sqrt (X : Double) return Double;
+   function Sqrt (X : T) return T;
    pragma Import (Intrinsic, Sqrt, "sqrt");
    pragma Pure_Function (Sqrt);
 
-   function Log (X : Double) return Double;
+   function Log (X : T) return T;
    pragma Import (Intrinsic, Log, "log");
    pragma Pure_Function (Log);
 
-   function Acos (X : Double) return Double;
+   function Acos (X : T) return T;
    pragma Import (Intrinsic, Acos, "acos");
    pragma Pure_Function (Acos);
 
-   function Asin (X : Double) return Double;
+   function Asin (X : T) return T;
    pragma Import (Intrinsic, Asin, "asin");
    pragma Pure_Function (Asin);
 
-   function Atan (X : Double) return Double;
+   function Atan (X : T) return T;
    pragma Import (Intrinsic, Atan, "atan");
    pragma Pure_Function (Atan);
 
-   function Sinh (X : Double) return Double;
+   function Sinh (X : T) return T;
    pragma Import (Intrinsic, Sinh, "sinh");
    pragma Pure_Function (Sinh);
 
-   function Cosh (X : Double) return Double;
+   function Cosh (X : T) return T;
    pragma Import (Intrinsic, Cosh, "cosh");
    pragma Pure_Function (Cosh);
 
-   function Tanh (X : Double) return Double;
+   function Tanh (X : T) return T;
    pragma Import (Intrinsic, Tanh, "tanh");
    pragma Pure_Function (Tanh);
 
-   function Pow (X, Y : Double) return Double;
+   function Pow (X, Y : T) return T;
    pragma Import (Intrinsic, Pow, "pow");
    pragma Pure_Function (Pow);
 
-end Ada.Numerics.Aux;
+end Ada.Numerics.Aux_Long_Float;
diff --git a/gcc/ada/libgnat/a-nashfl.ads b/gcc/ada/libgnat/a-nashfl.ads
new file mode 100644
index 00000000000..00cfad05c31
--- /dev/null
+++ b/gcc/ada/libgnat/a-nashfl.ads
@@ -0,0 +1,106 @@
+------------------------------------------------------------------------------
+--                                                                          --
+--                         GNAT RUN-TIME COMPONENTS                         --
+--                                                                          --
+--         A D A . N U M E R I C S . A U X _ S H O R T _ F L O A T          --
+--                                                                          --
+--                                 S p e c                                  --
+--                  (Short Float Wrapper in terms of Float)                 --
+--                                                                          --
+--          Copyright (C) 1992-2020, Free Software Foundation, Inc.         --
+--                                                                          --
+-- GNAT is free software;  you can  redistribute it  and/or modify it under --
+-- terms of the  GNU General Public License as published  by the Free Soft- --
+-- ware  Foundation;  either version 3,  or (at your option) any later ver- --
+-- sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE.                                     --
+--                                                                          --
+-- As a special exception under Section 7 of GPL version 3, you are granted --
+-- additional permissions described in the GCC Runtime Library Exception,   --
+-- version 3.1, as published by the Free Software Foundation.               --
+--                                                                          --
+-- You should have received a copy of the GNU General Public License and    --
+-- a copy of the GCC Runtime Library Exception along with this program;     --
+-- see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see    --
+-- <http://www.gnu.org/licenses/>.                                          --
+--                                                                          --
+-- GNAT was originally developed  by the GNAT team at  New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc.      --
+--                                                                          --
+------------------------------------------------------------------------------
+
+--  This package provides the basic computational interface for the generic
+--  elementary functions. The C library version interfaces with the routines
+--  in the C mathematical library, and is thus quite portable.
+
+--  This version here is for use when Short Float functions are not
+--  present in the C library, but Float ones are. Alternative versions
+--  are provided for special situations:
+
+--    a-nashfl__wraplf    For use where float intrinsics are missing
+
+with Ada.Numerics.Aux_Float;
+
+package Ada.Numerics.Aux_Short_Float is
+   pragma Pure;
+
+   subtype T is Short_Float;
+   package Aux renames Aux_Float;
+   subtype W is Aux.T;
+
+   --  Use the Aux implementation.
+
+   function Sin (X : T) return T
+   is (T (Aux.Sin (W (X))));
+   pragma Inline (Sin);
+
+   function Cos (X : T) return T
+   is (T (Aux.Cos (W (X))));
+   pragma Inline (Cos);
+
+   function Tan (X : T) return T
+   is (T (Aux.Tan (W (X))));
+   pragma Inline (Tan);
+
+   function Exp (X : T) return T
+   is (T (Aux.Exp (W (X))));
+   pragma Inline (Exp);
+
+   function Sqrt (X : T) return T
+   is (T (Aux.Sqrt (W (X))));
+   pragma Inline (Sqrt);
+
+   function Log (X : T) return T
+   is (T (Aux.Log (W (X))));
+   pragma Inline (Log);
+
+   function Acos (X : T) return T
+   is (T (Aux.Acos (W (X))));
+   pragma Inline (Acos);
+
+   function Asin (X : T) return T
+   is (T (Aux.Asin (W (X))));
+   pragma Inline (Asin);
+
+   function Atan (X : T) return T
+   is (T (Aux.Atan (W (X))));
+   pragma Inline (Atan);
+
+   function Sinh (X : T) return T
+   is (T (Aux.Sinh (W (X))));
+   pragma Inline (Sinh);
+
+   function Cosh (X : T) return T
+   is (T (Aux.Cosh (W (X))));
+   pragma Inline (Cosh);
+
+   function Tanh (X : T) return T
+   is (T (Aux.Tanh (W (X))));
+   pragma Inline (Tanh);
+
+   function Pow (X, Y : T) return T
+   is (T (Aux.Pow (W (X), W (Y))));
+   pragma Inline (Pow);
+
+end Ada.Numerics.Aux_Short_Float;
diff --git a/gcc/ada/libgnat/a-nashfl__wraplf.ads b/gcc/ada/libgnat/a-nashfl__wraplf.ads
new file mode 100644
index 00000000000..bebd809ad8c
--- /dev/null
+++ b/gcc/ada/libgnat/a-nashfl__wraplf.ads
@@ -0,0 +1,103 @@
+------------------------------------------------------------------------------
+--                                                                          --
+--                         GNAT RUN-TIME COMPONENTS                         --
+--                                                                          --
+--         A D A . N U M E R I C S . A U X _ S H O R T _ F L O A T          --
+--                                                                          --
+--                                 S p e c                                  --
+--                (Short Float Wrapper in terms of Long Float)              --
+--                                                                          --
+--          Copyright (C) 1992-2020, Free Software Foundation, Inc.         --
+--                                                                          --
+-- GNAT is free software;  you can  redistribute it  and/or modify it under --
+-- terms of the  GNU General Public License as published  by the Free Soft- --
+-- ware  Foundation;  either version 3,  or (at your option) any later ver- --
+-- sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE.                                     --
+--                                                                          --
+-- As a special exception under Section 7 of GPL version 3, you are granted --
+-- additional permissions described in the GCC Runtime Library Exception,   --
+-- version 3.1, as published by the Free Software Foundation.               --
+--                                                                          --
+-- You should have received a copy of the GNU General Public License and    --
+-- a copy of the GCC Runtime Library Exception along with this program;     --
+-- see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see    --
+-- <http://www.gnu.org/licenses/>.                                          --
+--                                                                          --
+-- GNAT was originally developed  by the GNAT team at  New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc.      --
+--                                                                          --
+------------------------------------------------------------------------------
+
+--  This package provides the basic computational interface for the generic
+--  elementary functions. The C library version interfaces with the routines
+--  in the C mathematical library, and is thus quite portable.
+
+--  This version here is for use when short float and float functions
+--  are not present in the C library, but double ones are.
+
+with Ada.Numerics.Aux_Long_Float;
+
+package Ada.Numerics.Aux_Short_Float is
+   pragma Pure;
+
+   subtype T is Short_Float;
+   package Aux renames Aux_Long_Float;
+   subtype W is Aux.T;
+
+   --  Use the Aux implementation.
+
+   function Sin (X : T) return T
+   is (T (Aux.Sin (W (X))));
+   pragma Inline (Sin);
+
+   function Cos (X : T) return T
+   is (T (Aux.Cos (W (X))));
+   pragma Inline (Cos);
+
+   function Tan (X : T) return T
+   is (T (Aux.Tan (W (X))));
+   pragma Inline (Tan);
+
+   function Exp (X : T) return T
+   is (T (Aux.Exp (W (X))));
+   pragma Inline (Exp);
+
+   function Sqrt (X : T) return T
+   is (T (Aux.Sqrt (W (X))));
+   pragma Inline (Sqrt);
+
+   function Log (X : T) return T
+   is (T (Aux.Log (W (X))));
+   pragma Inline (Log);
+
+   function Acos (X : T) return T
+   is (T (Aux.Acos (W (X))));
+   pragma Inline (Acos);
+
+   function Asin (X : T) return T
+   is (T (Aux.Asin (W (X))));
+   pragma Inline (Asin);
+
+   function Atan (X : T) return T
+   is (T (Aux.Atan (W (X))));
+   pragma Inline (Atan);
+
+   function Sinh (X : T) return T
+   is (T (Aux.Sinh (W (X))));
+   pragma Inline (Sinh);
+
+   function Cosh (X : T) return T
+   is (T (Aux.Cosh (W (X))));
+   pragma Inline (Cosh);
+
+   function Tanh (X : T) return T
+   is (T (Aux.Tanh (W (X))));
+   pragma Inline (Tanh);
+
+   function Pow (X, Y : T) return T
+   is (T (Aux.Pow (W (X), W (Y))));
+   pragma Inline (Pow);
+
+end Ada.Numerics.Aux_Short_Float;
diff --git a/gcc/ada/libgnat/a-ngcoty.adb b/gcc/ada/libgnat/a-ngcoty.adb
index 6785ccf34a9..85f660819f9 100644
--- a/gcc/ada/libgnat/a-ngcoty.adb
+++ b/gcc/ada/libgnat/a-ngcoty.adb
@@ -29,10 +29,12 @@
 --                                                                          --
 ------------------------------------------------------------------------------
 
-with Ada.Numerics.Aux; use Ada.Numerics.Aux;
+with Ada.Numerics.Generic_Aux;
 
 package body Ada.Numerics.Generic_Complex_Types is
 
+   package Aux is new Ada.Numerics.Generic_Aux (Real);
+
    subtype R is Real'Base;
 
    Two_Pi  : constant R := R (2.0) * Pi;
@@ -440,7 +442,7 @@ package body Ada.Numerics.Generic_Complex_Types is
          end if;
 
       else
-         arg := R (Atan (Double (abs (b / a))));
+         arg := Aux.Atan (abs (b / a));
 
          if a > 0.0 then
             if b > 0.0 then
@@ -507,8 +509,8 @@ package body Ada.Numerics.Generic_Complex_Types is
       if Modulus = 0.0 then
          return (0.0, 0.0);
       else
-         return (Modulus * R (Cos (Double (Argument))),
-                 Modulus * R (Sin (Double (Argument))));
+         return (Modulus * Aux.Cos (Argument),
+                 Modulus * Aux.Sin (Argument));
       end if;
    end Compose_From_Polar;
 
@@ -536,8 +538,8 @@ package body Ada.Numerics.Generic_Complex_Types is
             return (0.0, -Modulus);
          else
             Arg := Two_Pi * Argument / Cycle;
-            return (Modulus * R (Cos (Double (Arg))),
-                    Modulus * R (Sin (Double (Arg))));
+            return (Modulus * Aux.Cos (Arg),
+                    Modulus * Aux.Sin (Arg));
          end if;
       else
          raise Argument_Error;
@@ -597,8 +599,8 @@ package body Ada.Numerics.Generic_Complex_Types is
       exception
          when Constraint_Error =>
             pragma Assert (X.Re /= 0.0);
-            return R (Double (abs (X.Re))
-              * Sqrt (1.0 + (Double (X.Im) / Double (X.Re)) ** 2));
+            return R (abs (X.Re))
+              * Aux.Sqrt (1.0 + (R (X.Im) / R (X.Re)) ** 2);
       end;
 
       begin
@@ -612,8 +614,8 @@ package body Ada.Numerics.Generic_Complex_Types is
       exception
          when Constraint_Error =>
             pragma Assert (X.Im /= 0.0);
-            return R (Double (abs (X.Im))
-              * Sqrt (1.0 + (Double (X.Re) / Double (X.Im)) ** 2));
+            return R (abs (X.Im))
+              * Aux.Sqrt (1.0 + (R (X.Re) / R (X.Im)) ** 2);
       end;
 
       --  Now deal with cases of underflow. If only one of the squares
@@ -632,13 +634,11 @@ package body Ada.Numerics.Generic_Complex_Types is
 
             else
                if abs (X.Re) > abs (X.Im) then
-                  return
-                    R (Double (abs (X.Re))
-                      * Sqrt (1.0 + (Double (X.Im) / Double (X.Re)) ** 2));
+                  return R (abs (X.Re))
+                    * Aux.Sqrt (1.0 + (R (X.Im) / R (X.Re)) ** 2);
                else
-                  return
-                    R (Double (abs (X.Im))
-                      * Sqrt (1.0 + (Double (X.Re) / Double (X.Im)) ** 2));
+                  return R (abs (X.Im))
+                    * Aux.Sqrt (1.0 + (R (X.Re) / R (X.Im)) ** 2);
                end if;
             end if;
 
@@ -652,7 +652,7 @@ package body Ada.Numerics.Generic_Complex_Types is
       --  In all other cases, the naive computation will do
 
       else
-         return R (Sqrt (Double (Re2 + Im2)));
+         return Aux.Sqrt (Re2 + Im2);
       end if;
    end Modulus;
 
diff --git a/gcc/ada/libgnat/a-ngelfu.adb b/gcc/ada/libgnat/a-ngelfu.adb
index 7e7c6623850..57b310c19d7 100644
--- a/gcc/ada/libgnat/a-ngelfu.adb
+++ b/gcc/ada/libgnat/a-ngelfu.adb
@@ -36,13 +36,13 @@
 --  Uses functions sqrt, exp, log, pow, sin, asin, cos, acos, tan, atan, sinh,
 --  cosh, tanh from C library via math.h
 
-with Ada.Numerics.Aux;
+with Ada.Numerics.Generic_Aux;
 
 package body Ada.Numerics.Generic_Elementary_Functions with
   SPARK_Mode => Off
 is
 
-   use type Ada.Numerics.Aux.Double;
+   package Aux is new Ada.Numerics.Generic_Aux (Float_Type);
 
    Sqrt_Two : constant := 1.41421_35623_73095_04880_16887_24209_69807_85696;
    Log_Two  : constant := 0.69314_71805_59945_30941_72321_21458_17656_80755;
@@ -50,7 +50,6 @@ is
    Half_Log_Two : constant := Log_Two / 2;
 
    subtype T is Float_Type'Base;
-   subtype Double is Aux.Double;
 
    Two_Pi  : constant T := 2.0 * Pi;
    Half_Pi : constant T := Pi / 2.0;
@@ -150,8 +149,7 @@ is
                      Rest := Rest - 0.25;
                   end if;
 
-                  Result := Result *
-                    Float_Type'Base (Aux.Pow (Double (Left), Double (Rest)));
+                  Result := Result * Aux.Pow (Left, Rest);
 
                   if Right >= 0.0 then
                      return Result;
@@ -159,8 +157,7 @@ is
                      return (1.0 / Result);
                   end if;
                else
-                  return
-                    Float_Type'Base (Aux.Pow (Double (Left), Double (Right)));
+                  return Aux.Pow (Left, Right);
                end if;
             end if;
 
@@ -194,7 +191,7 @@ is
          return Pi;
       end if;
 
-      Temp := Float_Type'Base (Aux.Acos (Double (X)));
+      Temp := Aux.Acos (X);
 
       if Temp < 0.0 then
          Temp := Pi + Temp;
@@ -332,7 +329,7 @@ is
          return -(Pi / 2.0);
       end if;
 
-      return Float_Type'Base (Aux.Asin (Double (X)));
+      return Aux.Asin (X);
    end Arcsin;
 
    --  Arbitrary cycle
@@ -515,7 +512,7 @@ is
          return 1.0;
       end if;
 
-      return Float_Type'Base (Aux.Cos (Double (X)));
+      return Aux.Cos (X);
    end Cos;
 
    --  Arbitrary cycle
@@ -568,7 +565,7 @@ is
          return 1.0 / X;
       end if;
 
-      return 1.0 / Float_Type'Base (Aux.Tan (Double (X)));
+      return 1.0 / Aux.Tan (X);
    end Cot;
 
    --  Arbitrary cycle
@@ -617,7 +614,7 @@ is
          return 1.0 / X;
       end if;
 
-      return 1.0 / Float_Type'Base (Aux.Tanh (Double (X)));
+      return 1.0 / Aux.Tanh (X);
    end Coth;
 
    ---------
@@ -632,7 +629,7 @@ is
          return 1.0;
       end if;
 
-      Result := Float_Type'Base (Aux.Exp (Double (X)));
+      Result := Aux.Exp (X);
 
       --  Deal with case of Exp returning IEEE infinity. If Machine_Overflows
       --  is False, then we can just leave it as an infinity (and indeed we
@@ -716,7 +713,7 @@ is
       Raw_Atan :=
         (if Z < Sqrt_Epsilon then Z
          elsif Z = 1.0 then Pi / 4.0
-         else Float_Type'Base (Aux.Atan (Double (Z))));
+         else Aux.Atan (Z));
 
       if abs Y > abs X then
          Raw_Atan := Half_Pi - Raw_Atan;
@@ -747,7 +744,7 @@ is
          return 0.0;
       end if;
 
-      return Float_Type'Base (Aux.Log (Double (X)));
+      return Aux.Log (X);
    end Log;
 
    --  Arbitrary base
@@ -767,7 +764,7 @@ is
          return 0.0;
       end if;
 
-      return Float_Type'Base (Aux.Log (Double (X)) / Aux.Log (Double (Base)));
+      return Aux.Log (X) / Aux.Log (Base);
    end Log;
 
    ---------
@@ -782,7 +779,7 @@ is
          return X;
       end if;
 
-      return Float_Type'Base (Aux.Sin (Double (X)));
+      return Aux.Sin (X);
    end Sin;
 
    --  Arbitrary cycle
@@ -816,7 +813,7 @@ is
       --  Could test for 12.0 * abs T = Cycle, and return an exact value in
       --  those cases. It is not clear this is worth the extra test though.
 
-      return Float_Type'Base (Aux.Sin (Double (T / Cycle * Two_Pi)));
+      return Aux.Sin (T / Cycle * Two_Pi);
    end Sin;
 
    ----------
@@ -899,7 +896,7 @@ is
          return X;
       end if;
 
-      return Float_Type'Base (Aux.Sqrt (Double (X)));
+      return Aux.Sqrt (X);
    end Sqrt;
 
    ---------
@@ -919,7 +916,7 @@ is
       --  with, it is impossible for X to be exactly pi/2, and the result is
       --  always in range.
 
-      return Float_Type'Base (Aux.Tan (Double (X)));
+      return Aux.Tan (X);
    end Tan;
 
    --  Arbitrary cycle
@@ -992,7 +989,7 @@ is
          return X + X * R;
 
       else
-         return Float_Type'Base (Aux.Tanh (Double (X)));
+         return Aux.Tanh (X);
       end if;
    end Tanh;
 
diff --git a/gcc/ada/libgnat/a-nuaufl.ads b/gcc/ada/libgnat/a-nuaufl.ads
new file mode 100644
index 00000000000..88deda87f9a
--- /dev/null
+++ b/gcc/ada/libgnat/a-nuaufl.ads
@@ -0,0 +1,105 @@
+------------------------------------------------------------------------------
+--                                                                          --
+--                         GNAT RUN-TIME COMPONENTS                         --
+--                                                                          --
+--               A D A . N U M E R I C S . A U X _ F L O A T                --
+--                                                                          --
+--                                 S p e c                                  --
+--                      (C Math Library Version, Float)                     --
+--                                                                          --
+--          Copyright (C) 1992-2020, Free Software Foundation, Inc.         --
+--                                                                          --
+-- GNAT is free software;  you can  redistribute it  and/or modify it under --
+-- terms of the  GNU General Public License as published  by the Free Soft- --
+-- ware  Foundation;  either version 3,  or (at your option) any later ver- --
+-- sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE.                                     --
+--                                                                          --
+-- As a special exception under Section 7 of GPL version 3, you are granted --
+-- additional permissions described in the GCC Runtime Library Exception,   --
+-- version 3.1, as published by the Free Software Foundation.               --
+--                                                                          --
+-- You should have received a copy of the GNU General Public License and    --
+-- a copy of the GCC Runtime Library Exception along with this program;     --
+-- see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see    --
+-- <http://www.gnu.org/licenses/>.                                          --
+--                                                                          --
+-- GNAT was originally developed  by the GNAT team at  New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc.      --
+--                                                                          --
+------------------------------------------------------------------------------
+
+--  This package provides the basic computational interface for the generic
+--  elementary functions. The C library version interfaces with the routines
+--  in the C mathematical library, and is thus quite portable.
+
+--  This version here is for use with normal Unix math functions, from
+--  libm. Alternative versions are provided for special situations:
+
+--    a-nuaufl__nolibm    For use on VxWorks (where we have no libm.a library)
+--    a-naaufl__wraplf    For use where float intrinsics are missing
+
+package Ada.Numerics.Aux_Float is
+   pragma Pure;
+
+   subtype T is Float;
+
+   pragma Linker_Options ("-lm");
+
+   --  We import these functions directly from C. Note that we label them
+   --  all as pure functions, because indeed all of them are in fact pure.
+
+   function Sin (X : T) return T;
+   pragma Import (Intrinsic, Sin, "sinf");
+   pragma Pure_Function (Sin);
+
+   function Cos (X : T) return T;
+   pragma Import (Intrinsic, Cos, "cosf");
+   pragma Pure_Function (Cos);
+
+   function Tan (X : T) return T;
+   pragma Import (Intrinsic, Tan, "tanf");
+   pragma Pure_Function (Tan);
+
+   function Exp (X : T) return T;
+   pragma Import (Intrinsic, Exp, "expf");
+   pragma Pure_Function (Exp);
+
+   function Sqrt (X : T) return T;
+   pragma Import (Intrinsic, Sqrt, "sqrtf");
+   pragma Pure_Function (Sqrt);
+
+   function Log (X : T) return T;
+   pragma Import (Intrinsic, Log, "logf");
+   pragma Pure_Function (Log);
+
+   function Acos (X : T) return T;
+   pragma Import (Intrinsic, Acos, "acosf");
+   pragma Pure_Function (Acos);
+
+   function Asin (X : T) return T;
+   pragma Import (Intrinsic, Asin, "asinf");
+   pragma Pure_Function (Asin);
+
+   function Atan (X : T) return T;
+   pragma Import (Intrinsic, Atan, "atanf");
+   pragma Pure_Function (Atan);
+
+   function Sinh (X : T) return T;
+   pragma Import (Intrinsic, Sinh, "sinhf");
+   pragma Pure_Function (Sinh);
+
+   function Cosh (X : T) return T;
+   pragma Import (Intrinsic, Cosh, "coshf");
+   pragma Pure_Function (Cosh);
+
+   function Tanh (X : T) return T;
+   pragma Import (Intrinsic, Tanh, "tanhf");
+   pragma Pure_Function (Tanh);
+
+   function Pow (X, Y : T) return T;
+   pragma Import (Intrinsic, Pow, "powf");
+   pragma Pure_Function (Pow);
+
+end Ada.Numerics.Aux_Float;
diff --git a/gcc/ada/libgnat/a-nuaufl__nolibm.ads b/gcc/ada/libgnat/a-nuaufl__nolibm.ads
new file mode 100644
index 00000000000..4247d45d117
--- /dev/null
+++ b/gcc/ada/libgnat/a-nuaufl__nolibm.ads
@@ -0,0 +1,100 @@
+------------------------------------------------------------------------------
+--                                                                          --
+--                         GNAT RUN-TIME COMPONENTS                         --
+--                                                                          --
+--               A D A . N U M E R I C S . A U X _ F L O A T                --
+--                                                                          --
+--                                 S p e c                                  --
+--                         (C Library Version, Float)                       --
+--                                                                          --
+--          Copyright (C) 1992-2020, Free Software Foundation, Inc.         --
+--                                                                          --
+-- GNAT is free software;  you can  redistribute it  and/or modify it under --
+-- terms of the  GNU General Public License as published  by the Free Soft- --
+-- ware  Foundation;  either version 3,  or (at your option) any later ver- --
+-- sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE.                                     --
+--                                                                          --
+-- As a special exception under Section 7 of GPL version 3, you are granted --
+-- additional permissions described in the GCC Runtime Library Exception,   --
+-- version 3.1, as published by the Free Software Foundation.               --
+--                                                                          --
+-- You should have received a copy of the GNU General Public License and    --
+-- a copy of the GCC Runtime Library Exception along with this program;     --
+-- see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see    --
+-- <http://www.gnu.org/licenses/>.                                          --
+--                                                                          --
+-- GNAT was originally developed  by the GNAT team at  New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc.      --
+--                                                                          --
+------------------------------------------------------------------------------
+
+--  This package provides the basic computational interface for the generic
+--  elementary functions. The C library version interfaces with the routines
+--  in the C mathematical library, and is thus quite portable.
+
+--  This version here is for use with normal Unix math functions, from
+--  libc.
+
+package Ada.Numerics.Aux_Float is
+   pragma Pure;
+
+   subtype T is Float;
+
+   --  We import these functions directly from C. Note that we label them
+   --  all as pure functions, because indeed all of them are in fact pure.
+
+   function Sin (X : T) return T;
+   pragma Import (Intrinsic, Sin, "sinf");
+   pragma Pure_Function (Sin);
+
+   function Cos (X : T) return T;
+   pragma Import (Intrinsic, Cos, "cosf");
+   pragma Pure_Function (Cos);
+
+   function Tan (X : T) return T;
+   pragma Import (Intrinsic, Tan, "tanf");
+   pragma Pure_Function (Tan);
+
+   function Exp (X : T) return T;
+   pragma Import (Intrinsic, Exp, "expf");
+   pragma Pure_Function (Exp);
+
+   function Sqrt (X : T) return T;
+   pragma Import (Intrinsic, Sqrt, "sqrtf");
+   pragma Pure_Function (Sqrt);
+
+   function Log (X : T) return T;
+   pragma Import (Intrinsic, Log, "logf");
+   pragma Pure_Function (Log);
+
+   function Acos (X : T) return T;
+   pragma Import (Intrinsic, Acos, "acosf");
+   pragma Pure_Function (Acos);
+
+   function Asin (X : T) return T;
+   pragma Import (Intrinsic, Asin, "asinf");
+   pragma Pure_Function (Asin);
+
+   function Atan (X : T) return T;
+   pragma Import (Intrinsic, Atan, "atanf");
+   pragma Pure_Function (Atan);
+
+   function Sinh (X : T) return T;
+   pragma Import (Intrinsic, Sinh, "sinhf");
+   pragma Pure_Function (Sinh);
+
+   function Cosh (X : T) return T;
+   pragma Import (Intrinsic, Cosh, "coshf");
+   pragma Pure_Function (Cosh);
+
+   function Tanh (X : T) return T;
+   pragma Import (Intrinsic, Tanh, "tanhf");
+   pragma Pure_Function (Tanh);
+
+   function Pow (X, Y : T) return T;
+   pragma Import (Intrinsic, Pow, "powf");
+   pragma Pure_Function (Pow);
+
+end Ada.Numerics.Aux_Float;
diff --git a/gcc/ada/libgnat/a-nuaufl__wraplf.ads b/gcc/ada/libgnat/a-nuaufl__wraplf.ads
new file mode 100644
index 00000000000..eb32ba73876
--- /dev/null
+++ b/gcc/ada/libgnat/a-nuaufl__wraplf.ads
@@ -0,0 +1,105 @@
+------------------------------------------------------------------------------
+--                                                                          --
+--                         GNAT RUN-TIME COMPONENTS                         --
+--                                                                          --
+--               A D A . N U M E R I C S . A U X _ F L O A T                --
+--                                                                          --
+--                                 S p e c                                  --
+--                   (Float Wrapper in terms of Long Float)                 --
+--                                                                          --
+--          Copyright (C) 1992-2020, Free Software Foundation, Inc.         --
+--                                                                          --
+-- GNAT is free software;  you can  redistribute it  and/or modify it under --
+-- terms of the  GNU General Public License as published  by the Free Soft- --
+-- ware  Foundation;  either version 3,  or (at your option) any later ver- --
+-- sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE.                                     --
+--                                                                          --
+-- As a special exception under Section 7 of GPL version 3, you are granted --
+-- additional permissions described in the GCC Runtime Library Exception,   --
+-- version 3.1, as published by the Free Software Foundation.               --
+--                                                                          --
+-- You should have received a copy of the GNU General Public License and    --
+-- a copy of the GCC Runtime Library Exception along with this program;     --
+-- see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see    --
+-- <http://www.gnu.org/licenses/>.                                          --
+--                                                                          --
+-- GNAT was originally developed  by the GNAT team at  New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc.      --
+--                                                                          --
+------------------------------------------------------------------------------
+
+--  This package provides the basic computational interface for the generic
+--  elementary functions. The C library version interfaces with the routines
+--  in the C mathematical library, and is thus quite portable.
+
+--  This version here is for use when float functions are not present
+--  in the C library, but double ones are.
+
+with Ada.Numerics.Aux_Long_Float;
+
+package Ada.Numerics.Aux_Float is
+   pragma Pure;
+
+   subtype T is Float;
+
+   subtype T is Float;
+   package Aux renames Aux_Long_Float;
+   subtype W is Aux.T;
+
+   --  Use the Aux implementation.
+
+   function Sin (X : T) return T
+   is (T (Aux.Sin (W (X))));
+   pragma Inline (Sin);
+
+   function Cos (X : T) return T
+   is (T (Aux.Cos (W (X))));
+   pragma Inline (Cos);
+
+   function Tan (X : T) return T
+   is (T (Aux.Tan (W (X))));
+   pragma Inline (Tan);
+
+   function Exp (X : T) return T
+   is (T (Aux.Exp (W (X))));
+   pragma Inline (Exp);
+
+   function Sqrt (X : T) return T
+   is (T (Aux.Sqrt (W (X))));
+   pragma Inline (Sqrt);
+
+   function Log (X : T) return T
+   is (T (Aux.Log (W (X))));
+   pragma Inline (Log);
+
+   function Acos (X : T) return T
+   is (T (Aux.Acos (W (X))));
+   pragma Inline (Acos);
+
+   function Asin (X : T) return T
+   is (T (Aux.Asin (W (X))));
+   pragma Inline (Asin);
+
+   function Atan (X : T) return T
+   is (T (Aux.Atan (W (X))));
+   pragma Inline (Atan);
+
+   function Sinh (X : T) return T
+   is (T (Aux.Sinh (W (X))));
+   pragma Inline (Sinh);
+
+   function Cosh (X : T) return T
+   is (T (Aux.Cosh (W (X))));
+   pragma Inline (Cosh);
+
+   function Tanh (X : T) return T
+   is (T (Aux.Tanh (W (X))));
+   pragma Inline (Tanh);
+
+   function Pow (X, Y : T) return T
+   is (T (Aux.Pow (W (X), W (Y))));
+   pragma Inline (Pow);
+
+end Ada.Numerics.Aux_Float;
diff --git a/gcc/ada/libgnat/a-nugeau.ads b/gcc/ada/libgnat/a-nugeau.ads
new file mode 100644
index 00000000000..94f5560c75c
--- /dev/null
+++ b/gcc/ada/libgnat/a-nugeau.ads
@@ -0,0 +1,184 @@
+------------------------------------------------------------------------------
+--                                                                          --
+--                         GNAT RUN-TIME COMPONENTS                         --
+--                                                                          --
+--             A D A . N U M E R I C S . G E N E R I C _ A U X              --
+--                                                                          --
+--                                 S p e c                                  --
+--                            (Generic Wrapper)                             --
+--                                                                          --
+--          Copyright (C) 1992-2020, Free Software Foundation, Inc.         --
+--                                                                          --
+-- GNAT is free software;  you can  redistribute it  and/or modify it under --
+-- terms of the  GNU General Public License as published  by the Free Soft- --
+-- ware  Foundation;  either version 3,  or (at your option) any later ver- --
+-- sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE.                                     --
+--                                                                          --
+-- As a special exception under Section 7 of GPL version 3, you are granted --
+-- additional permissions described in the GCC Runtime Library Exception,   --
+-- version 3.1, as published by the Free Software Foundation.               --
+--                                                                          --
+-- You should have received a copy of the GNU General Public License and    --
+-- a copy of the GCC Runtime Library Exception along with this program;     --
+-- see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see    --
+-- <http://www.gnu.org/licenses/>.                                          --
+--                                                                          --
+-- GNAT was originally developed  by the GNAT team at  New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc.      --
+--                                                                          --
+------------------------------------------------------------------------------
+
+--  This package provides the basic computational interface for the generic
+--  elementary functions. The C library version interfaces with the routines
+--  in the C mathematical library.
+
+--  This version here is for use with normal Unix math functions.
+
+with Ada.Numerics.Aux_Long_Long_Float;
+with Ada.Numerics.Aux_Long_Float;
+with Ada.Numerics.Aux_Float;
+with Ada.Numerics.Aux_Short_Float;
+
+generic
+   type T is digits <>;
+package Ada.Numerics.Generic_Aux is
+   pragma Pure;
+
+   package LLF renames Ada.Numerics.Aux_Long_Long_Float;
+   package LF renames Ada.Numerics.Aux_Long_Float;
+   package F renames Ada.Numerics.Aux_Float;
+   package SF renames Ada.Numerics.Aux_Short_Float;
+
+   function Sin (X : T'Base) return T'Base
+   is (if T'Base'Digits > Long_Float'Digits
+         then T'Base (LLF.Sin (Long_Long_Float (X)))
+         elsif T'Base'Digits > Float'Digits
+         then T'Base (LF.Sin (Long_Float (X)))
+         elsif T'Base'Digits > Short_Float'Digits
+         then T'Base (F.Sin (Float (X)))
+         else T'Base (SF.Sin (Short_Float (X))));
+   pragma Inline (Sin);
+
+   function Cos (X : T'Base) return T'Base
+   is (if T'Base'Digits > Long_Float'Digits
+         then T'Base (LLF.Cos (Long_Long_Float (X)))
+         elsif T'Base'Digits > Float'Digits
+         then T'Base (LF.Cos (Long_Float (X)))
+         elsif T'Base'Digits > Short_Float'Digits
+         then T'Base (F.Cos (Float (X)))
+         else T'Base (SF.Cos (Short_Float (X))));
+   pragma Inline (Cos);
+
+   function Tan (X : T'Base) return T'Base
+   is (if T'Base'Digits > Long_Float'Digits
+         then T'Base (LLF.Tan (Long_Long_Float (X)))
+         elsif T'Base'Digits > Float'Digits
+         then T'Base (LF.Tan (Long_Float (X)))
+         elsif T'Base'Digits > Short_Float'Digits
+         then T'Base (F.Tan (Float (X)))
+         else T'Base (SF.Tan (Short_Float (X))));
+   pragma Inline (Tan);
+
+   function Exp (X : T'Base) return T'Base
+   is (if T'Base'Digits > Long_Float'Digits
+         then T'Base (LLF.Exp (Long_Long_Float (X)))
+         elsif T'Base'Digits > Float'Digits
+         then T'Base (LF.Exp (Long_Float (X)))
+         elsif T'Base'Digits > Short_Float'Digits
+         then T'Base (F.Exp (Float (X)))
+         else T'Base (SF.Exp (Short_Float (X))));
+   pragma Inline (Exp);
+
+   function Sqrt (X : T'Base) return T'Base
+   is (if T'Base'Digits > Long_Float'Digits
+         then T'Base (LLF.Sqrt (Long_Long_Float (X)))
+         elsif T'Base'Digits > Float'Digits
+         then T'Base (LF.Sqrt (Long_Float (X)))
+         elsif T'Base'Digits > Short_Float'Digits
+         then T'Base (F.Sqrt (Float (X)))
+         else T'Base (SF.Sqrt (Short_Float (X))));
+   pragma Inline (Sqrt);
+
+   function Log (X : T'Base) return T'Base
+   is (if T'Base'Digits > Long_Float'Digits
+         then T'Base (LLF.Log (Long_Long_Float (X)))
+         elsif T'Base'Digits > Float'Digits
+         then T'Base (LF.Log (Long_Float (X)))
+         elsif T'Base'Digits > Short_Float'Digits
+         then T'Base (F.Log (Float (X)))
+         else T'Base (SF.Log (Short_Float (X))));
+   pragma Inline (Log);
+
+   function Acos (X : T'Base) return T'Base
+   is (if T'Base'Digits > Long_Float'Digits
+         then T'Base (LLF.Acos (Long_Long_Float (X)))
+         elsif T'Base'Digits > Float'Digits
+         then T'Base (LF.Acos (Long_Float (X)))
+         elsif T'Base'Digits > Short_Float'Digits
+         then T'Base (F.Acos (Float (X)))
+         else T'Base (SF.Acos (Short_Float (X))));
+   pragma Inline (Acos);
+
+   function Asin (X : T'Base) return T'Base
+   is (if T'Base'Digits > Long_Float'Digits
+         then T'Base (LLF.Asin (Long_Long_Float (X)))
+         elsif T'Base'Digits > Float'Digits
+         then T'Base (LF.Asin (Long_Float (X)))
+         elsif T'Base'Digits > Short_Float'Digits
+         then T'Base (F.Asin (Float (X)))
+         else T'Base (SF.Asin (Short_Float (X))));
+   pragma Inline (Asin);
+
+   function Atan (X : T'Base) return T'Base
+   is (if T'Base'Digits > Long_Float'Digits
+         then T'Base (LLF.Atan (Long_Long_Float (X)))
+         elsif T'Base'Digits > Float'Digits
+         then T'Base (LF.Atan (Long_Float (X)))
+         elsif T'Base'Digits > Short_Float'Digits
+         then T'Base (F.Atan (Float (X)))
+         else T'Base (SF.Atan (Short_Float (X))));
+   pragma Inline (Atan);
+
+   function Sinh (X : T'Base) return T'Base
+   is (if T'Base'Digits > Long_Float'Digits
+         then T'Base (LLF.Sinh (Long_Long_Float (X)))
+         elsif T'Base'Digits > Float'Digits
+         then T'Base (LF.Sinh (Long_Float (X)))
+         elsif T'Base'Digits > Short_Float'Digits
+         then T'Base (F.Sinh (Float (X)))
+         else T'Base (SF.Sinh (Short_Float (X))));
+   pragma Inline (Sinh);
+
+   function Cosh (X : T'Base) return T'Base
+   is (if T'Base'Digits > Long_Float'Digits
+         then T'Base (LLF.Cosh (Long_Long_Float (X)))
+         elsif T'Base'Digits > Float'Digits
+         then T'Base (LF.Cosh (Long_Float (X)))
+         elsif T'Base'Digits > Short_Float'Digits
+         then T'Base (F.Cosh (Float (X)))
+         else T'Base (SF.Cosh (Short_Float (X))));
+   pragma Inline (Cosh);
+
+   function Tanh (X : T'Base) return T'Base
+   is (if T'Base'Digits > Long_Float'Digits
+         then T'Base (LLF.Tanh (Long_Long_Float (X)))
+         elsif T'Base'Digits > Float'Digits
+         then T'Base (LF.Tanh (Long_Float (X)))
+         elsif T'Base'Digits > Short_Float'Digits
+         then T'Base (F.Tanh (Float (X)))
+         else T'Base (SF.Tanh (Short_Float (X))));
+   pragma Inline (Tanh);
+
+   function Pow (X, Y : T'Base) return T'Base
+   is (if T'Base'Digits > Long_Float'Digits
+         then T'Base (LLF.Pow (Long_Long_Float (X), Long_Long_Float (Y)))
+         elsif T'Base'Digits > Float'Digits
+         then T'Base (LF.Pow (Long_Float (X), Long_Float (Y)))
+         elsif T'Base'Digits > Short_Float'Digits
+         then T'Base (F.Pow (Float (X), Float (Y)))
+         else T'Base (SF.Pow (Short_Float (X), Short_Float (Y))));
+   pragma Inline (Pow);
+
+end Ada.Numerics.Generic_Aux;
diff --git a/gcc/ada/libgnat/a-numaux__dummy.adb b/gcc/ada/libgnat/a-numaux.adb
similarity index 100%
rename from gcc/ada/libgnat/a-numaux__dummy.adb
rename to gcc/ada/libgnat/a-numaux.adb
diff --git a/gcc/ada/libgnat/a-numaux.ads b/gcc/ada/libgnat/a-numaux.ads
index 4154e1ab216..9e697247b0a 100644
--- a/gcc/ada/libgnat/a-numaux.ads
+++ b/gcc/ada/libgnat/a-numaux.ads
@@ -5,7 +5,7 @@
 --                     A D A . N U M E R I C S . A U X                      --
 --                                                                          --
 --                                 S p e c                                  --
---                       (C Library Version, non-x86)                       --
+--                      (Backward-Compatibility Version)                    --
 --                                                                          --
 --          Copyright (C) 1992-2020, Free Software Foundation, Inc.         --
 --                                                                          --
@@ -30,83 +30,79 @@
 --                                                                          --
 ------------------------------------------------------------------------------
 
---  This package provides the basic computational interface for the generic
---  elementary functions. The C library version interfaces with the routines
---  in the C mathematical library, and is thus quite portable, although it may
---  not necessarily meet the requirements for accuracy in the numerics annex.
---  One advantage of using this package is that it will interface directly to
---  hardware instructions, such as the those provided on the Intel x86.
+--  This is a backward-compatibility package, for users of this
+--  internal package before the introduction of Generic_Aux.
 
---  This version here is for use with normal Unix math functions. Alternative
---  versions are provided for special situations:
+--  This version here is for use with Double mapping to Long_Float.
+--  Alternative versions are provided for special situations:
 
---    a-numaux-darwin    For PowerPC/Darwin (special handling of sin/cos)
---    a-numaux-libc-x86  For the x86, using 80-bit long double format
---    a-numaux-x86       For the x86, using 80-bit long double format with
---                       inline asm statements
---    a-numaux-vxworks   For use on VxWorks (where we have no libm.a library)
+--    a-numaux__libc-x86    Map Double to x86's 80-bit Long_Long_Float
+
+with Ada.Numerics.Aux_Long_Float;
 
 package Ada.Numerics.Aux is
    pragma Pure;
 
-   pragma Linker_Options ("-lm");
-
    type Double is new Long_Float;
-   --  Type Double is the type used to call the C routines
 
-   --  We import these functions directly from C. Note that we label them
-   --  all as pure functions, because indeed all of them are in fact pure.
+   subtype T is Double;
+
+   package Aux renames Aux_Long_Float;
+
+   subtype W is Aux.T;
+
+   --  Use the Aux implementation.
 
-   function Sin (X : Double) return Double;
-   pragma Import (Intrinsic, Sin, "sin");
-   pragma Pure_Function (Sin);
+   function Sin (X : T) return T
+   is (T (Aux.Sin (W (X))));
+   pragma Inline (Sin);
 
-   function Cos (X : Double) return Double;
-   pragma Import (Intrinsic, Cos, "cos");
-   pragma Pure_Function (Cos);
+   function Cos (X : T) return T
+   is (T (Aux.Cos (W (X))));
+   pragma Inline (Cos);
 
-   function Tan (X : Double) return Double;
-   pragma Import (Intrinsic, Tan, "tan");
-   pragma Pure_Function (Tan);
+   function Tan (X : T) return T
+   is (T (Aux.Tan (W (X))));
+   pragma Inline (Tan);
 
-   function Exp (X : Double) return Double;
-   pragma Import (Intrinsic, Exp, "exp");
-   pragma Pure_Function (Exp);
+   function Exp (X : T) return T
+   is (T (Aux.Exp (W (X))));
+   pragma Inline (Exp);
 
-   function Sqrt (X : Double) return Double;
-   pragma Import (Intrinsic, Sqrt, "sqrt");
-   pragma Pure_Function (Sqrt);
+   function Sqrt (X : T) return T
+   is (T (Aux.Sqrt (W (X))));
+   pragma Inline (Sqrt);
 
-   function Log (X : Double) return Double;
-   pragma Import (Intrinsic, Log, "log");
-   pragma Pure_Function (Log);
+   function Log (X : T) return T
+   is (T (Aux.Log (W (X))));
+   pragma Inline (Log);
 
-   function Acos (X : Double) return Double;
-   pragma Import (Intrinsic, Acos, "acos");
-   pragma Pure_Function (Acos);
+   function Acos (X : T) return T
+   is (T (Aux.Acos (W (X))));
+   pragma Inline (Acos);
 
-   function Asin (X : Double) return Double;
-   pragma Import (Intrinsic, Asin, "asin");
-   pragma Pure_Function (Asin);
+   function Asin (X : T) return T
+   is (T (Aux.Asin (W (X))));
+   pragma Inline (Asin);
 
-   function Atan (X : Double) return Double;
-   pragma Import (Intrinsic, Atan, "atan");
-   pragma Pure_Function (Atan);
+   function Atan (X : T) return T
+   is (T (Aux.Atan (W (X))));
+   pragma Inline (Atan);
 
-   function Sinh (X : Double) return Double;
-   pragma Import (Intrinsic, Sinh, "sinh");
-   pragma Pure_Function (Sinh);
+   function Sinh (X : T) return T
+   is (T (Aux.Sinh (W (X))));
+   pragma Inline (Sinh);
 
-   function Cosh (X : Double) return Double;
-   pragma Import (Intrinsic, Cosh, "cosh");
-   pragma Pure_Function (Cosh);
+   function Cosh (X : T) return T
+   is (T (Aux.Cosh (W (X))));
+   pragma Inline (Cosh);
 
-   function Tanh (X : Double) return Double;
-   pragma Import (Intrinsic, Tanh, "tanh");
-   pragma Pure_Function (Tanh);
+   function Tanh (X : T) return T
+   is (T (Aux.Tanh (W (X))));
+   pragma Inline (Tanh);
 
-   function Pow (X, Y : Double) return Double;
-   pragma Import (Intrinsic, Pow, "pow");
-   pragma Pure_Function (Pow);
+   function Pow (X, Y : T) return T
+   is (T (Aux.Pow (W (X), W (Y))));
+   pragma Inline (Pow);
 
 end Ada.Numerics.Aux;
diff --git a/gcc/ada/libgnat/a-numaux__libc-x86.ads b/gcc/ada/libgnat/a-numaux__libc-x86.ads
index f6deebecbad..64b7cb55b6d 100644
--- a/gcc/ada/libgnat/a-numaux__libc-x86.ads
+++ b/gcc/ada/libgnat/a-numaux__libc-x86.ads
@@ -5,7 +5,7 @@
 --                     A D A . N U M E R I C S . A U X                      --
 --                                                                          --
 --                                 S p e c                                  --
---                       (C Library Version for x86)                        --
+--                    (x86 Backward-Compatibility Version)                  --
 --                                                                          --
 --          Copyright (C) 1992-2020, Free Software Foundation, Inc.         --
 --                                                                          --
@@ -30,68 +30,75 @@
 --                                                                          --
 ------------------------------------------------------------------------------
 
---  This version is for the x86 using the 80-bit x86 long double format
+--  This is a backward-compatibility package, for users of this
+--  internal package before the introduction of Generic_Aux on x86,
+--  where the Double type mapped to Long Long Float.
+
+with Ada.Numerics.Aux_Long_Long_Float;
 
 package Ada.Numerics.Aux is
    pragma Pure;
 
-   pragma Linker_Options ("-lm");
-
    type Double is new Long_Long_Float;
 
-   --  We import these functions directly from C. Note that we label them
-   --  all as pure functions, because indeed all of them are in fact pure.
+   subtype T is Double;
+
+   package Aux renames Aux_Long_Long_Float;
+
+   subtype W is Aux.T;
+
+   --  Use the Aux implementation.
 
-   function Sin (X : Double) return Double;
-   pragma Import (Intrinsic, Sin, "sinl");
-   pragma Pure_Function (Sin);
+   function Sin (X : T) return T
+   is (T (Aux.Sin (W (X))));
+   pragma Inline (Sin);
 
-   function Cos (X : Double) return Double;
-   pragma Import (Intrinsic, Cos, "cosl");
-   pragma Pure_Function (Cos);
+   function Cos (X : T) return T
+   is (T (Aux.Cos (W (X))));
+   pragma Inline (Cos);
 
-   function Tan (X : Double) return Double;
-   pragma Import (Intrinsic, Tan, "tanl");
-   pragma Pure_Function (Tan);
+   function Tan (X : T) return T
+   is (T (Aux.Tan (W (X))));
+   pragma Inline (Tan);
 
-   function Exp (X : Double) return Double;
-   pragma Import (Intrinsic, Exp, "expl");
-   pragma Pure_Function (Exp);
+   function Exp (X : T) return T
+   is (T (Aux.Exp (W (X))));
+   pragma Inline (Exp);
 
-   function Sqrt (X : Double) return Double;
-   pragma Import (Intrinsic, Sqrt, "sqrtl");
-   pragma Pure_Function (Sqrt);
+   function Sqrt (X : T) return T
+   is (T (Aux.Sqrt (W (X))));
+   pragma Inline (Sqrt);
 
-   function Log (X : Double) return Double;
-   pragma Import (Intrinsic, Log, "logl");
-   pragma Pure_Function (Log);
+   function Log (X : T) return T
+   is (T (Aux.Log (W (X))));
+   pragma Inline (Log);
 
-   function Acos (X : Double) return Double;
-   pragma Import (Intrinsic, Acos, "acosl");
-   pragma Pure_Function (Acos);
+   function Acos (X : T) return T
+   is (T (Aux.Acos (W (X))));
+   pragma Inline (Acos);
 
-   function Asin (X : Double) return Double;
-   pragma Import (Intrinsic, Asin, "asinl");
-   pragma Pure_Function (Asin);
+   function Asin (X : T) return T
+   is (T (Aux.Asin (W (X))));
+   pragma Inline (Asin);
 
-   function Atan (X : Double) return Double;
-   pragma Import (Intrinsic, Atan, "atanl");
-   pragma Pure_Function (Atan);
+   function Atan (X : T) return T
+   is (T (Aux.Atan (W (X))));
+   pragma Inline (Atan);
 
-   function Sinh (X : Double) return Double;
-   pragma Import (Intrinsic, Sinh, "sinhl");
-   pragma Pure_Function (Sinh);
+   function Sinh (X : T) return T
+   is (T (Aux.Sinh (W (X))));
+   pragma Inline (Sinh);
 
-   function Cosh (X : Double) return Double;
-   pragma Import (Intrinsic, Cosh, "coshl");
-   pragma Pure_Function (Cosh);
+   function Cosh (X : T) return T
+   is (T (Aux.Cosh (W (X))));
+   pragma Inline (Cosh);
 
-   function Tanh (X : Double) return Double;
-   pragma Import (Intrinsic, Tanh, "tanhl");
-   pragma Pure_Function (Tanh);
+   function Tanh (X : T) return T
+   is (T (Aux.Tanh (W (X))));
+   pragma Inline (Tanh);
 
-   function Pow (X, Y : Double) return Double;
-   pragma Import (Intrinsic, Pow, "powl");
-   pragma Pure_Function (Pow);
+   function Pow (X, Y : T) return T
+   is (T (Aux.Pow (W (X), W (Y))));
+   pragma Inline (Pow);
 
 end Ada.Numerics.Aux;


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [gcc(refs/users/aoliva/heads/testme)] revamp ada.numerics.aux
@ 2020-10-12 17:31 Alexandre Oliva
  0 siblings, 0 replies; 3+ messages in thread
From: Alexandre Oliva @ 2020-10-12 17:31 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:d5300d5750c20a5625f0d3c7f9355753ca012f9a

commit d5300d5750c20a5625f0d3c7f9355753ca012f9a
Author: Alexandre Oliva <oliva@adacore.com>
Date:   Mon Oct 12 14:28:22 2020 -0300

    revamp ada.numerics.aux
    
    Instead of mapping elementary functions for all types to a single
    type, use the intrinsics available for the various base types.
    
    A new Ada.Numerics.Generic_Aux is introduced to explicitly dispatch,
    based on the 'Digits attribute of the base type, to the various
    newly-added Aux_Short_Float, Aux_Float, Aux_Long_Float, or
    Aux_Long_Long_Float.
    
    By default, the Short unit is implemented in terms of the Float by
    default, and the others rely on the elementary fnuctions from the C
    Math library for float, double and long double types, respectively.
    
    Variants that don't link with -lm are retained for vxworks.  The Aux
    variant that open-coded Sin and Cos becomes Aux_Long_Float, and
    elementary functions of other types are implemented in terms of it.
    
    The original Ada.Numerics.Aux is retained, for backward compatibility,
    as a wrapper for Aux_Long_Float.  On x86, where Aux was
    Long_Long_Float-based, it's retained as a wrapper for
    Aux_Long_Long_Float instead.
    
    Generic_Elementary_Functions and Generic_Complex_Elementary_Functions
    are adjusted to use Generic_Aux, avoiding the type conversions and
    inefficiencies of computing results in higher precision.
    
    
    for  gcc/ada/ChangeLog
    
            * Makefile.rtl (GNATRTL_NONTASKING_OBJS): Compile Ada.Numerics
            child units Generic_Aux, Aux_Long_Long_Float, Aux_Long_Float,
            Aux_Float, and Aux_Short_Float.
            (X86_TARGET_PAIRS): Drop dummy body for Aux.
            (X86_64_TARGET_PAIRS): Likewise.
            (LIBGNAT_TARGET_PAIRS): Select dummy body for Aux_Long_Float.
            On VxWorks, select the nolibm variants.  Drop the redundant
            libc-x86 numaux variants on x86* kfreebsd variants.  On
            Darwin, select the sincos variant of Aux_Long_Float, and use
            the wraplf variants for other types.
            * libgnat/a-numaux.ads: Replace with Aux_Long_Long_Float
            wrapper. Rename original to...
            * libgnat/a-nallfl.ads: ... this.  Adjust.
            * libgnat/a-nallfl__nolibm.ads: New.
            * libgnat/a-nallfl__wraplf.ads: New.
            * libgnat/a-numaux.ads: Replace with Aux_Long_Float wrapper.
            Rename original to...
            * libgnat/a-nalofl.ads: ... this.  Adjust.
            * libgnat/a-nalofl__dummy.adb: New.
            * libgnat/a-numaux__vxworks.ads: Rename to...
            * libgnat/a-nalofl__nolibm.ads: ... this.
            * libgnat/a-numaux__darwin.adb: Rename to...
            * libgnat/a-nalofl__sincos.adb: ... this.
            * libgnat/a-numaux__darwin.ads: Rename to...
            * libgnat/a-nalofl__sincos.ads: ... this.
            * libgnat/a-nashfl.ads: New.
            * libgnat/a-nashfl__wraplf.ads: New.
            * libgnat/a-nuaufl.ads: New.
            * libgnat/a-nuaufl__nolibm.ads: New.
            * libgnat/a-nuaufl__wraplf.ads: New.
            * libgnat/a-nugeau.ads: New.
            * libgnat/a-numaux__dummy.adb: Rename to...
            * libgnat/a-numaux.adb: ... this.
            * libgnat/a-ngcoty.adb: Switch to Generic_Aux.  Drop redundant
            conversions.
            * libgnat/a-ngelfu.adb: Likewise.

Diff:
---
 gcc/ada/Makefile.rtl                               |  33 ++--
 gcc/ada/libgnat/a-nallfl.ads                       | 105 ++++++++++++
 gcc/ada/libgnat/a-nallfl__nolibm.ads               | 100 +++++++++++
 gcc/ada/libgnat/a-nallfl__wraplf.ads               | 105 ++++++++++++
 gcc/ada/libgnat/a-nalofl.ads                       | 105 ++++++++++++
 gcc/ada/libgnat/a-nalofl__dummy.adb                |  32 ++++
 ...{a-numaux__vxworks.ads => a-nalofl__nolibm.ads} |  47 +++---
 .../{a-numaux__darwin.adb => a-nalofl__sincos.adb} |  56 +++----
 .../{a-numaux__darwin.ads => a-nalofl__sincos.ads} |  37 ++---
 gcc/ada/libgnat/a-nashfl.ads                       | 106 ++++++++++++
 gcc/ada/libgnat/a-nashfl__wraplf.ads               | 103 ++++++++++++
 gcc/ada/libgnat/a-ngcoty.adb                       |  34 ++--
 gcc/ada/libgnat/a-ngelfu.adb                       |  39 ++---
 gcc/ada/libgnat/a-nuaufl.ads                       | 105 ++++++++++++
 gcc/ada/libgnat/a-nuaufl__nolibm.ads               | 100 +++++++++++
 gcc/ada/libgnat/a-nuaufl__wraplf.ads               | 105 ++++++++++++
 gcc/ada/libgnat/a-nugeau.ads                       | 184 +++++++++++++++++++++
 .../libgnat/{a-numaux__dummy.adb => a-numaux.adb}  |   0
 gcc/ada/libgnat/a-numaux.ads                       |  99 ++++++-----
 gcc/ada/libgnat/a-numaux__libc-x86.ads             |  84 ++++++----
 20 files changed, 1386 insertions(+), 193 deletions(-)

diff --git a/gcc/ada/Makefile.rtl b/gcc/ada/Makefile.rtl
index fc978a2f79e..db32e100519 100644
--- a/gcc/ada/Makefile.rtl
+++ b/gcc/ada/Makefile.rtl
@@ -234,6 +234,11 @@ GNATRTL_NONTASKING_OBJS= \
   a-nudira$(objext) \
   a-nuelfu$(objext) \
   a-nuflra$(objext) \
+  a-nugeau$(objext) \
+  a-nallfl$(objext) \
+  a-nalofl$(objext) \
+  a-nuaufl$(objext) \
+  a-nashfl$(objext) \
   a-numaux$(objext) \
   a-numeri$(objext) \
   a-nurear$(objext) \
@@ -764,6 +769,7 @@ GNATRTL_NONTASKING_OBJS= \
 # Non-tasking case:
 
 LIBGNAT_TARGET_PAIRS = \
+a-nalofl.adb<libgnat/a-nalofl__dummy.adb \
 a-intnam.ads<libgnarl/a-intnam__dummy.ads \
 s-inmaop.adb<libgnarl/s-inmaop__dummy.adb \
 s-intman.adb<libgnarl/s-intman__dummy.adb \
@@ -835,12 +841,10 @@ ATOMICS_BUILTINS_TARGET_PAIRS = \
 
 X86_TARGET_PAIRS = \
   a-numaux.ads<libgnat/a-numaux__libc-x86.ads \
-  a-numaux.adb<libgnat/a-numaux__dummy.adb \
   s-atocou.adb<libgnat/s-atocou__x86.adb
 
 X86_64_TARGET_PAIRS = \
   a-numaux.ads<libgnat/a-numaux__libc-x86.ads \
-  a-numaux.adb<libgnat/a-numaux__dummy.adb \
   s-atocou.adb<libgnat/s-atocou__builtin.adb
 
 # Implementation of symbolic traceback based on dwarf
@@ -916,7 +920,9 @@ ifeq ($(strip $(filter-out powerpc% wrs vxworks vxworksspe vxworks7% vxworks7spe
 
   LIBGNAT_TARGET_PAIRS = \
   a-intnam.ads<libgnarl/a-intnam__vxworks.ads \
-  a-numaux.ads<libgnat/a-numaux__vxworks.ads \
+  a-nalofl.ads<libgnat/a-nalofl__nolibm.ads \
+  a-nallfl.ads<libgnat/a-nallfl__nolibm.ads \
+  a-nuaufl.ads<libgnat/a-nuaufl__nolibm.ads \
   s-inmaop.adb<libgnarl/s-inmaop__vxworks.adb \
   s-intman.ads<libgnarl/s-intman__vxworks.ads \
   s-intman.adb<libgnarl/s-intman__vxworks.adb \
@@ -1039,7 +1045,9 @@ ifeq ($(strip $(filter-out powerpc% wrs vxworksae vxworksaespe,$(target_cpu) $(t
   LIBGNAT_TARGET_PAIRS = \
   a-elchha.adb<libgnat/a-elchha__vxworks-ppc-full.adb \
   a-intnam.ads<libgnarl/a-intnam__vxworks.ads \
-  a-numaux.ads<libgnat/a-numaux__vxworks.ads \
+  a-nalofl.ads<libgnat/a-nalofl__nolibm.ads \
+  a-nallfl.ads<libgnat/a-nallfl__nolibm.ads \
+  a-nuaufl.ads<libgnat/a-nuaufl__nolibm.ads \
   g-io.adb<hie/g-io__vxworks-cert.adb \
   s-inmaop.adb<libgnarl/s-inmaop__vxworks.adb \
   s-interr.adb<libgnarl/s-interr__vxworks.adb \
@@ -1095,7 +1103,9 @@ ifeq ($(strip $(filter-out %86 wrs vxworksae,$(target_cpu) $(target_vendor) $(ta
   LIBGNAT_TARGET_PAIRS = \
   a-elchha.adb<libgnat/a-elchha__vxworks-ppc-full.adb \
   a-intnam.ads<libgnarl/a-intnam__vxworks.ads \
-  a-numaux.ads<libgnat/a-numaux__vxworks.ads \
+  a-nalofl.ads<libgnat/a-nalofl__nolibm.ads \
+  a-nallfl.ads<libgnat/a-nallfl__nolibm.ads \
+  a-nuaufl.ads<libgnat/a-nuaufl__nolibm.ads \
   g-io.adb<hie/g-io__vxworks-cert.adb \
   s-inmaop.adb<libgnarl/s-inmaop__vxworks.adb \
   s-interr.adb<libgnarl/s-interr__vxworks.adb \
@@ -1314,7 +1324,9 @@ ifeq ($(strip $(filter-out aarch64 arm% coff wrs vx%,$(target_cpu) $(target_vend
 
   LIBGNAT_TARGET_PAIRS = \
   a-intnam.ads<libgnarl/a-intnam__vxworks.ads \
-  a-numaux.ads<libgnat/a-numaux__vxworks.ads \
+  a-nalofl.ads<libgnat/a-nalofl__nolibm.ads \
+  a-nallfl.ads<libgnat/a-nallfl__nolibm.ads \
+  a-nuaufl.ads<libgnat/a-nuaufl__nolibm.ads \
   s-inmaop.adb<libgnarl/s-inmaop__vxworks.adb \
   s-interr.adb<libgnarl/s-interr__vxworks.adb \
   s-intman.ads<libgnarl/s-intman__vxworks.ads \
@@ -1648,8 +1660,6 @@ endif
 ifeq ($(strip $(filter-out x86_64 kfreebsd%,$(target_cpu) $(target_os))),)
   LIBGNAT_TARGET_PAIRS = \
   a-intnam.ads<libgnarl/a-intnam__freebsd.ads \
-  a-numaux.ads<libgnat/a-numaux__libc-x86.ads \
-  a-numaux.adb<libgnat/a-numaux__dummy.adb \
   s-inmaop.adb<libgnarl/s-inmaop__posix.adb \
   s-intman.adb<libgnarl/s-intman__posix.adb \
   s-osinte.adb<libgnarl/s-osinte__posix.adb \
@@ -2552,8 +2562,11 @@ ifeq ($(strip $(filter-out darwin%,$(target_os))),)
     LIBGNAT_TARGET_PAIRS += \
       s-intman.adb<libgnarl/s-intman__posix.adb \
       s-osprim.adb<libgnat/s-osprim__posix.adb \
-      a-numaux.ads<libgnat/a-numaux__darwin.ads \
-      a-numaux.adb<libgnat/a-numaux__darwin.adb \
+      a-nalofl.adb<libgnat/a-nalofl__sincos.adb \
+      a-nalofl.ads<libgnat/a-nalofl__sincos.ads \
+      a-nallfl.ads<libgnat/a-nallfl__wraplf.ads \
+      a-nuaufl.ads<libgnat/a-nuaufl__wraplf.ads \
+      a-nashfl.ads<libgnat/a-nashfl__wraplf.ads \
       $(ATOMICS_TARGET_PAIRS) \
       $(ATOMICS_BUILTINS_TARGET_PAIRS) \
       system.ads<libgnat/system-darwin-ppc.ads
diff --git a/gcc/ada/libgnat/a-nallfl.ads b/gcc/ada/libgnat/a-nallfl.ads
new file mode 100644
index 00000000000..d6d322134db
--- /dev/null
+++ b/gcc/ada/libgnat/a-nallfl.ads
@@ -0,0 +1,105 @@
+------------------------------------------------------------------------------
+--                                                                          --
+--                         GNAT RUN-TIME COMPONENTS                         --
+--                                                                          --
+--     A D A . N U M E R I C S . A U X _ L O N G _ L O N G _ F L O A T      --
+--                                                                          --
+--                                 S p e c                                  --
+--                  (C Math Library Version, Long Long Float)               --
+--                                                                          --
+--          Copyright (C) 1992-2020, Free Software Foundation, Inc.         --
+--                                                                          --
+-- GNAT is free software;  you can  redistribute it  and/or modify it under --
+-- terms of the  GNU General Public License as published  by the Free Soft- --
+-- ware  Foundation;  either version 3,  or (at your option) any later ver- --
+-- sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE.                                     --
+--                                                                          --
+-- As a special exception under Section 7 of GPL version 3, you are granted --
+-- additional permissions described in the GCC Runtime Library Exception,   --
+-- version 3.1, as published by the Free Software Foundation.               --
+--                                                                          --
+-- You should have received a copy of the GNU General Public License and    --
+-- a copy of the GCC Runtime Library Exception along with this program;     --
+-- see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see    --
+-- <http://www.gnu.org/licenses/>.                                          --
+--                                                                          --
+-- GNAT was originally developed  by the GNAT team at  New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc.      --
+--                                                                          --
+------------------------------------------------------------------------------
+
+--  This package provides the basic computational interface for the generic
+--  elementary functions. The C library version interfaces with the routines
+--  in the C mathematical library, and is thus quite portable.
+
+--  This version here is for use with normal Unix math functions, from
+--  libm. Alternative versions are provided for special situations:
+
+--    a-nallfl__wraplf    For use where long double intrinsics are missing
+--    a-nallfl__nolibm    For use on VxWorks (where we have no libm.a library)
+
+package Ada.Numerics.Aux_Long_Long_Float is
+   pragma Pure;
+
+   subtype T is Long_Long_Float;
+
+   pragma Linker_Options ("-lm");
+
+   --  We import these functions directly from C. Note that we label them
+   --  all as pure functions, because indeed all of them are in fact pure.
+
+   function Sin (X : T) return T;
+   pragma Import (Intrinsic, Sin, "sinl");
+   pragma Pure_Function (Sin);
+
+   function Cos (X : T) return T;
+   pragma Import (Intrinsic, Cos, "cosl");
+   pragma Pure_Function (Cos);
+
+   function Tan (X : T) return T;
+   pragma Import (Intrinsic, Tan, "tanl");
+   pragma Pure_Function (Tan);
+
+   function Exp (X : T) return T;
+   pragma Import (Intrinsic, Exp, "expl");
+   pragma Pure_Function (Exp);
+
+   function Sqrt (X : T) return T;
+   pragma Import (Intrinsic, Sqrt, "sqrtl");
+   pragma Pure_Function (Sqrt);
+
+   function Log (X : T) return T;
+   pragma Import (Intrinsic, Log, "logl");
+   pragma Pure_Function (Log);
+
+   function Acos (X : T) return T;
+   pragma Import (Intrinsic, Acos, "acosl");
+   pragma Pure_Function (Acos);
+
+   function Asin (X : T) return T;
+   pragma Import (Intrinsic, Asin, "asinl");
+   pragma Pure_Function (Asin);
+
+   function Atan (X : T) return T;
+   pragma Import (Intrinsic, Atan, "atanl");
+   pragma Pure_Function (Atan);
+
+   function Sinh (X : T) return T;
+   pragma Import (Intrinsic, Sinh, "sinhl");
+   pragma Pure_Function (Sinh);
+
+   function Cosh (X : T) return T;
+   pragma Import (Intrinsic, Cosh, "coshl");
+   pragma Pure_Function (Cosh);
+
+   function Tanh (X : T) return T;
+   pragma Import (Intrinsic, Tanh, "tanhl");
+   pragma Pure_Function (Tanh);
+
+   function Pow (X, Y : T) return T;
+   pragma Import (Intrinsic, Pow, "powl");
+   pragma Pure_Function (Pow);
+
+end Ada.Numerics.Aux_Long_Long_Float;
diff --git a/gcc/ada/libgnat/a-nallfl__nolibm.ads b/gcc/ada/libgnat/a-nallfl__nolibm.ads
new file mode 100644
index 00000000000..6677211f661
--- /dev/null
+++ b/gcc/ada/libgnat/a-nallfl__nolibm.ads
@@ -0,0 +1,100 @@
+------------------------------------------------------------------------------
+--                                                                          --
+--                         GNAT RUN-TIME COMPONENTS                         --
+--                                                                          --
+--     A D A . N U M E R I C S . A U X _ L O N G _ L O N G _ F L O A T      --
+--                                                                          --
+--                                 S p e c                                  --
+--                    (C Library Version, Long Long Float)                  --
+--                                                                          --
+--          Copyright (C) 1992-2020, Free Software Foundation, Inc.         --
+--                                                                          --
+-- GNAT is free software;  you can  redistribute it  and/or modify it under --
+-- terms of the  GNU General Public License as published  by the Free Soft- --
+-- ware  Foundation;  either version 3,  or (at your option) any later ver- --
+-- sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE.                                     --
+--                                                                          --
+-- As a special exception under Section 7 of GPL version 3, you are granted --
+-- additional permissions described in the GCC Runtime Library Exception,   --
+-- version 3.1, as published by the Free Software Foundation.               --
+--                                                                          --
+-- You should have received a copy of the GNU General Public License and    --
+-- a copy of the GCC Runtime Library Exception along with this program;     --
+-- see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see    --
+-- <http://www.gnu.org/licenses/>.                                          --
+--                                                                          --
+-- GNAT was originally developed  by the GNAT team at  New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc.      --
+--                                                                          --
+------------------------------------------------------------------------------
+
+--  This package provides the basic computational interface for the generic
+--  elementary functions. The C library version interfaces with the routines
+--  in the C mathematical library, and is thus quite portable.
+
+--  This version here is for use with normal Unix math functions, from
+--  libc, not libm.
+
+package Ada.Numerics.Aux_Long_Long_Float is
+   pragma Pure;
+
+   subtype T is Long_Long_Float;
+
+   --  We import these functions directly from C. Note that we label them
+   --  all as pure functions, because indeed all of them are in fact pure.
+
+   function Sin (X : T) return T;
+   pragma Import (Intrinsic, Sin, "sinl");
+   pragma Pure_Function (Sin);
+
+   function Cos (X : T) return T;
+   pragma Import (Intrinsic, Cos, "cosl");
+   pragma Pure_Function (Cos);
+
+   function Tan (X : T) return T;
+   pragma Import (Intrinsic, Tan, "tanl");
+   pragma Pure_Function (Tan);
+
+   function Exp (X : T) return T;
+   pragma Import (Intrinsic, Exp, "expl");
+   pragma Pure_Function (Exp);
+
+   function Sqrt (X : T) return T;
+   pragma Import (Intrinsic, Sqrt, "sqrtl");
+   pragma Pure_Function (Sqrt);
+
+   function Log (X : T) return T;
+   pragma Import (Intrinsic, Log, "logl");
+   pragma Pure_Function (Log);
+
+   function Acos (X : T) return T;
+   pragma Import (Intrinsic, Acos, "acosl");
+   pragma Pure_Function (Acos);
+
+   function Asin (X : T) return T;
+   pragma Import (Intrinsic, Asin, "asinl");
+   pragma Pure_Function (Asin);
+
+   function Atan (X : T) return T;
+   pragma Import (Intrinsic, Atan, "atanl");
+   pragma Pure_Function (Atan);
+
+   function Sinh (X : T) return T;
+   pragma Import (Intrinsic, Sinh, "sinhl");
+   pragma Pure_Function (Sinh);
+
+   function Cosh (X : T) return T;
+   pragma Import (Intrinsic, Cosh, "coshl");
+   pragma Pure_Function (Cosh);
+
+   function Tanh (X : T) return T;
+   pragma Import (Intrinsic, Tanh, "tanhl");
+   pragma Pure_Function (Tanh);
+
+   function Pow (X, Y : T) return T;
+   pragma Import (Intrinsic, Pow, "powl");
+   pragma Pure_Function (Pow);
+
+end Ada.Numerics.Aux_Long_Long_Float;
diff --git a/gcc/ada/libgnat/a-nallfl__wraplf.ads b/gcc/ada/libgnat/a-nallfl__wraplf.ads
new file mode 100644
index 00000000000..5c6c954852e
--- /dev/null
+++ b/gcc/ada/libgnat/a-nallfl__wraplf.ads
@@ -0,0 +1,105 @@
+------------------------------------------------------------------------------
+--                                                                          --
+--                         GNAT RUN-TIME COMPONENTS                         --
+--                                                                          --
+--     A D A . N U M E R I C S . A U X _ L O N G _ L O N G _ F L O A T      --
+--                                                                          --
+--                                 S p e c                                  --
+--              (Long Long Float Wrapper in terms of Long Float)            --
+--                                                                          --
+--          Copyright (C) 1992-2020, Free Software Foundation, Inc.         --
+--                                                                          --
+-- GNAT is free software;  you can  redistribute it  and/or modify it under --
+-- terms of the  GNU General Public License as published  by the Free Soft- --
+-- ware  Foundation;  either version 3,  or (at your option) any later ver- --
+-- sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE.                                     --
+--                                                                          --
+-- As a special exception under Section 7 of GPL version 3, you are granted --
+-- additional permissions described in the GCC Runtime Library Exception,   --
+-- version 3.1, as published by the Free Software Foundation.               --
+--                                                                          --
+-- You should have received a copy of the GNU General Public License and    --
+-- a copy of the GCC Runtime Library Exception along with this program;     --
+-- see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see    --
+-- <http://www.gnu.org/licenses/>.                                          --
+--                                                                          --
+-- GNAT was originally developed  by the GNAT team at  New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc.      --
+--                                                                          --
+------------------------------------------------------------------------------
+
+--  This package provides the basic computational interface for the generic
+--  elementary functions. The C library version interfaces with the routines
+--  in the C mathematical library, and is thus quite portable.
+
+--  This version here is for use when long double functions are not
+--  present in the C library, so we use the double ones instead.
+
+with Ada.Numerics.Aux_Long_Float;
+
+package Ada.Numerics.Aux_Long_Long_Float is
+   pragma Pure;
+
+   subtype T is Long_Long_Float;
+
+   package Aux renames Aux_Long_Float;
+
+   subtype W is Aux.T;
+
+   --  Use the Aux implementation.
+
+   function Sin (X : T) return T
+   is (T (Aux.Sin (W (X))));
+   pragma Inline (Sin);
+
+   function Cos (X : T) return T
+   is (T (Aux.Cos (W (X))));
+   pragma Inline (Cos);
+
+   function Tan (X : T) return T
+   is (T (Aux.Tan (W (X))));
+   pragma Inline (Tan);
+
+   function Exp (X : T) return T
+   is (T (Aux.Exp (W (X))));
+   pragma Inline (Exp);
+
+   function Sqrt (X : T) return T
+   is (T (Aux.Sqrt (W (X))));
+   pragma Inline (Sqrt);
+
+   function Log (X : T) return T
+   is (T (Aux.Log (W (X))));
+   pragma Inline (Log);
+
+   function Acos (X : T) return T
+   is (T (Aux.Acos (W (X))));
+   pragma Inline (Acos);
+
+   function Asin (X : T) return T
+   is (T (Aux.Asin (W (X))));
+   pragma Inline (Asin);
+
+   function Atan (X : T) return T
+   is (T (Aux.Atan (W (X))));
+   pragma Inline (Atan);
+
+   function Sinh (X : T) return T
+   is (T (Aux.Sinh (W (X))));
+   pragma Inline (Sinh);
+
+   function Cosh (X : T) return T
+   is (T (Aux.Cosh (W (X))));
+   pragma Inline (Cosh);
+
+   function Tanh (X : T) return T
+   is (T (Aux.Tanh (W (X))));
+   pragma Inline (Tanh);
+
+   function Pow (X, Y : T) return T
+   is (T (Aux.Pow (W (X), W (Y))));
+   pragma Inline (Pow);
+
+end Ada.Numerics.Aux_Long_Long_Float;
diff --git a/gcc/ada/libgnat/a-nalofl.ads b/gcc/ada/libgnat/a-nalofl.ads
new file mode 100644
index 00000000000..4e0d7012409
--- /dev/null
+++ b/gcc/ada/libgnat/a-nalofl.ads
@@ -0,0 +1,105 @@
+------------------------------------------------------------------------------
+--                                                                          --
+--                         GNAT RUN-TIME COMPONENTS                         --
+--                                                                          --
+--          A D A . N U M E R I C S . A U X _ L O N G _ F L O A T           --
+--                                                                          --
+--                                 S p e c                                  --
+--                     (C Math Library Version, Long Float)                 --
+--                                                                          --
+--          Copyright (C) 1992-2020, Free Software Foundation, Inc.         --
+--                                                                          --
+-- GNAT is free software;  you can  redistribute it  and/or modify it under --
+-- terms of the  GNU General Public License as published  by the Free Soft- --
+-- ware  Foundation;  either version 3,  or (at your option) any later ver- --
+-- sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE.                                     --
+--                                                                          --
+-- As a special exception under Section 7 of GPL version 3, you are granted --
+-- additional permissions described in the GCC Runtime Library Exception,   --
+-- version 3.1, as published by the Free Software Foundation.               --
+--                                                                          --
+-- You should have received a copy of the GNU General Public License and    --
+-- a copy of the GCC Runtime Library Exception along with this program;     --
+-- see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see    --
+-- <http://www.gnu.org/licenses/>.                                          --
+--                                                                          --
+-- GNAT was originally developed  by the GNAT team at  New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc.      --
+--                                                                          --
+------------------------------------------------------------------------------
+
+--  This package provides the basic computational interface for the generic
+--  elementary functions. The C library version interfaces with the routines
+--  in the C mathematical library, and is thus quite portable.
+
+--  This version here is for use with normal Unix math functions, from
+--  libm. Alternative versions are provided for special situations:
+
+--    a-nalofl__nolibm    For use on VxWorks (where we have no libm.a library)
+--    a-nalofl__sincos    For use on Mac OS X (inaccurate sin and cos in libc)
+
+package Ada.Numerics.Aux_Long_Float is
+   pragma Pure;
+
+   subtype T is Long_Float;
+
+   pragma Linker_Options ("-lm");
+
+   --  We import these functions directly from C. Note that we label them
+   --  all as pure functions, because indeed all of them are in fact pure.
+
+   function Sin (X : T) return T;
+   pragma Import (Intrinsic, Sin, "sin");
+   pragma Pure_Function (Sin);
+
+   function Cos (X : T) return T;
+   pragma Import (Intrinsic, Cos, "cos");
+   pragma Pure_Function (Cos);
+
+   function Tan (X : T) return T;
+   pragma Import (Intrinsic, Tan, "tan");
+   pragma Pure_Function (Tan);
+
+   function Exp (X : T) return T;
+   pragma Import (Intrinsic, Exp, "exp");
+   pragma Pure_Function (Exp);
+
+   function Sqrt (X : T) return T;
+   pragma Import (Intrinsic, Sqrt, "sqrt");
+   pragma Pure_Function (Sqrt);
+
+   function Log (X : T) return T;
+   pragma Import (Intrinsic, Log, "log");
+   pragma Pure_Function (Log);
+
+   function Acos (X : T) return T;
+   pragma Import (Intrinsic, Acos, "acos");
+   pragma Pure_Function (Acos);
+
+   function Asin (X : T) return T;
+   pragma Import (Intrinsic, Asin, "asin");
+   pragma Pure_Function (Asin);
+
+   function Atan (X : T) return T;
+   pragma Import (Intrinsic, Atan, "atan");
+   pragma Pure_Function (Atan);
+
+   function Sinh (X : T) return T;
+   pragma Import (Intrinsic, Sinh, "sinh");
+   pragma Pure_Function (Sinh);
+
+   function Cosh (X : T) return T;
+   pragma Import (Intrinsic, Cosh, "cosh");
+   pragma Pure_Function (Cosh);
+
+   function Tanh (X : T) return T;
+   pragma Import (Intrinsic, Tanh, "tanh");
+   pragma Pure_Function (Tanh);
+
+   function Pow (X, Y : T) return T;
+   pragma Import (Intrinsic, Pow, "pow");
+   pragma Pure_Function (Pow);
+
+end Ada.Numerics.Aux_Long_Float;
diff --git a/gcc/ada/libgnat/a-nalofl__dummy.adb b/gcc/ada/libgnat/a-nalofl__dummy.adb
new file mode 100644
index 00000000000..def7d72d237
--- /dev/null
+++ b/gcc/ada/libgnat/a-nalofl__dummy.adb
@@ -0,0 +1,32 @@
+------------------------------------------------------------------------------
+--                                                                          --
+--                         GNAT RUN-TIME COMPONENTS                         --
+--                                                                          --
+--          A D A . N U M E R I C S . A U X _ L O N G _ F L O A T           --
+--                                                                          --
+--                                 B o d y                                  --
+--                                                                          --
+--          Copyright (C) 1992-2020, Free Software Foundation, Inc.         --
+--                                                                          --
+-- GNAT is free software;  you can  redistribute it  and/or modify it under --
+-- terms of the  GNU General Public License as published  by the Free Soft- --
+-- ware  Foundation;  either version 3,  or (at your option) any later ver- --
+-- sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE.                                     --
+--                                                                          --
+-- As a special exception under Section 7 of GPL version 3, you are granted --
+-- additional permissions described in the GCC Runtime Library Exception,   --
+-- version 3.1, as published by the Free Software Foundation.               --
+--                                                                          --
+-- You should have received a copy of the GNU General Public License and    --
+-- a copy of the GCC Runtime Library Exception along with this program;     --
+-- see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see    --
+-- <http://www.gnu.org/licenses/>.                                          --
+--                                                                          --
+-- GNAT was originally developed  by the GNAT team at  New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc.      --
+--                                                                          --
+------------------------------------------------------------------------------
+
+pragma No_Body;
diff --git a/gcc/ada/libgnat/a-numaux__vxworks.ads b/gcc/ada/libgnat/a-nalofl__nolibm.ads
similarity index 75%
rename from gcc/ada/libgnat/a-numaux__vxworks.ads
rename to gcc/ada/libgnat/a-nalofl__nolibm.ads
index 410655de8a6..d7bdd517e5d 100644
--- a/gcc/ada/libgnat/a-numaux__vxworks.ads
+++ b/gcc/ada/libgnat/a-nalofl__nolibm.ads
@@ -2,10 +2,10 @@
 --                                                                          --
 --                         GNAT RUN-TIME COMPONENTS                         --
 --                                                                          --
---                     A D A . N U M E R I C S . A U X                      --
+--          A D A . N U M E R I C S . A U X _ L O N G _ F L O A T           --
 --                                                                          --
 --                                 S p e c                                  --
---                       (C Library Version, VxWorks)                       --
+--                       (C Library Version, Long Float)                    --
 --                                                                          --
 --          Copyright (C) 1992-2020, Free Software Foundation, Inc.         --
 --                                                                          --
@@ -30,68 +30,73 @@
 --                                                                          --
 ------------------------------------------------------------------------------
 
---  Version for use on VxWorks (where we have no libm.a library), so the pragma
---  Linker_Options ("-lm") is omitted in this version.
+--  This package provides the basic computational interface for the generic
+--  elementary functions. The C library version interfaces with the routines
+--  in the C mathematical library, and is thus quite portable.
 
-package Ada.Numerics.Aux is
+--  This version here is for use with normal Unix math functions, from
+--  libc. Alternative versions are provided for special situations:
+
+--    a-nmaxlf__nolibm   For use on VxWorks (where we have no libm.a library)
+
+package Ada.Numerics.Aux_Long_Float is
    pragma Pure;
 
-   type Double is new Long_Float;
-   --  Type Double is the type used to call the C routines
+   subtype T is Long_Float;
 
    --  We import these functions directly from C. Note that we label them
    --  all as pure functions, because indeed all of them are in fact pure.
 
-   function Sin (X : Double) return Double;
+   function Sin (X : T) return T;
    pragma Import (Intrinsic, Sin, "sin");
    pragma Pure_Function (Sin);
 
-   function Cos (X : Double) return Double;
+   function Cos (X : T) return T;
    pragma Import (Intrinsic, Cos, "cos");
    pragma Pure_Function (Cos);
 
-   function Tan (X : Double) return Double;
+   function Tan (X : T) return T;
    pragma Import (Intrinsic, Tan, "tan");
    pragma Pure_Function (Tan);
 
-   function Exp (X : Double) return Double;
+   function Exp (X : T) return T;
    pragma Import (Intrinsic, Exp, "exp");
    pragma Pure_Function (Exp);
 
-   function Sqrt (X : Double) return Double;
+   function Sqrt (X : T) return T;
    pragma Import (Intrinsic, Sqrt, "sqrt");
    pragma Pure_Function (Sqrt);
 
-   function Log (X : Double) return Double;
+   function Log (X : T) return T;
    pragma Import (Intrinsic, Log, "log");
    pragma Pure_Function (Log);
 
-   function Acos (X : Double) return Double;
+   function Acos (X : T) return T;
    pragma Import (Intrinsic, Acos, "acos");
    pragma Pure_Function (Acos);
 
-   function Asin (X : Double) return Double;
+   function Asin (X : T) return T;
    pragma Import (Intrinsic, Asin, "asin");
    pragma Pure_Function (Asin);
 
-   function Atan (X : Double) return Double;
+   function Atan (X : T) return T;
    pragma Import (Intrinsic, Atan, "atan");
    pragma Pure_Function (Atan);
 
-   function Sinh (X : Double) return Double;
+   function Sinh (X : T) return T;
    pragma Import (Intrinsic, Sinh, "sinh");
    pragma Pure_Function (Sinh);
 
-   function Cosh (X : Double) return Double;
+   function Cosh (X : T) return T;
    pragma Import (Intrinsic, Cosh, "cosh");
    pragma Pure_Function (Cosh);
 
-   function Tanh (X : Double) return Double;
+   function Tanh (X : T) return T;
    pragma Import (Intrinsic, Tanh, "tanh");
    pragma Pure_Function (Tanh);
 
-   function Pow (X, Y : Double) return Double;
+   function Pow (X, Y : T) return T;
    pragma Import (Intrinsic, Pow, "pow");
    pragma Pure_Function (Pow);
 
-end Ada.Numerics.Aux;
+end Ada.Numerics.Aux_Long_Float;
diff --git a/gcc/ada/libgnat/a-numaux__darwin.adb b/gcc/ada/libgnat/a-nalofl__sincos.adb
similarity index 81%
rename from gcc/ada/libgnat/a-numaux__darwin.adb
rename to gcc/ada/libgnat/a-nalofl__sincos.adb
index 85fdd2468b5..58cda134fde 100644
--- a/gcc/ada/libgnat/a-numaux__darwin.adb
+++ b/gcc/ada/libgnat/a-nalofl__sincos.adb
@@ -2,7 +2,7 @@
 --                                                                          --
 --                         GNAT RUN-TIME COMPONENTS                         --
 --                                                                          --
---                     A D A . N U M E R I C S . A U X                      --
+--          A D A . N U M E R I C S . A U X _ L O N G _ F L O A T           --
 --                                                                          --
 --                                 B o d y                                  --
 --                          (Apple OS X Version)                            --
@@ -30,16 +30,16 @@
 --                                                                          --
 ------------------------------------------------------------------------------
 
-package body Ada.Numerics.Aux is
+package body Ada.Numerics.Aux.LF is
 
    -----------------------
    -- Local subprograms --
    -----------------------
 
-   function Is_Nan (X : Double) return Boolean;
+   function Is_Nan (X : T) return Boolean;
    --  Return True iff X is a IEEE NaN value
 
-   procedure Reduce (X : in out Double; Q : out Natural);
+   procedure Reduce (X : in out T; Q : out Natural);
    --  Implement reduction of X by Pi/2. Q is the quadrant of the final
    --  result in the range 0..3. The absolute value of X is at most Pi/4.
    --  It is needed to avoid a loss of accuracy for sin near Pi and cos
@@ -50,8 +50,8 @@ package body Ada.Numerics.Aux is
    --  of the trigonometric functions in their reduced domain.
    --  These approximations have been computed using Maple.
 
-   function Sine_Approx (X : Double) return Double;
-   function Cosine_Approx (X : Double) return Double;
+   function Sine_Approx (X : T) return T;
+   function Cosine_Approx (X : T) return T;
 
    pragma Inline (Reduce);
    pragma Inline (Sine_Approx);
@@ -61,8 +61,8 @@ package body Ada.Numerics.Aux is
    -- Cosine_Approx --
    -------------------
 
-   function Cosine_Approx (X : Double) return Double is
-      XX : constant Double := X * X;
+   function Cosine_Approx (X : T) return T is
+      XX : constant T := X * X;
    begin
       return (((((16#8.DC57FBD05F640#E-08 * XX
               - 16#4.9F7D00BF25D80#E-06) * XX
@@ -77,8 +77,8 @@ package body Ada.Numerics.Aux is
    -- Sine_Approx --
    -----------------
 
-   function Sine_Approx (X : Double) return Double is
-      XX : constant Double := X * X;
+   function Sine_Approx (X : T) return T is
+      XX : constant T := X * X;
    begin
       return (((((16#A.EA2D4ABE41808#E-09 * XX
               - 16#6.B974C10F9D078#E-07) * XX
@@ -92,7 +92,7 @@ package body Ada.Numerics.Aux is
    -- Is_Nan --
    ------------
 
-   function Is_Nan (X : Double) return Boolean is
+   function Is_Nan (X : T) return Boolean is
    begin
       --  The IEEE NaN values are the only ones that do not equal themselves
 
@@ -103,20 +103,20 @@ package body Ada.Numerics.Aux is
    -- Reduce --
    ------------
 
-   procedure Reduce (X : in out Double; Q : out Natural) is
+   procedure Reduce (X : in out T; Q : out Natural) is
       Half_Pi     : constant := Pi / 2.0;
       Two_Over_Pi : constant := 2.0 / Pi;
 
-      HM : constant := Integer'Min (Double'Machine_Mantissa / 2, Natural'Size);
-      M  : constant Double := 0.5 + 2.0**(1 - HM); -- Splitting constant
-      P1 : constant Double := Double'Leading_Part (Half_Pi, HM);
-      P2 : constant Double := Double'Leading_Part (Half_Pi - P1, HM);
-      P3 : constant Double := Double'Leading_Part (Half_Pi - P1 - P2, HM);
-      P4 : constant Double := Double'Leading_Part (Half_Pi - P1 - P2 - P3, HM);
-      P5 : constant Double := Double'Leading_Part (Half_Pi - P1 - P2 - P3
+      HM : constant := Integer'Min (T'Machine_Mantissa / 2, Natural'Size);
+      M  : constant T := 0.5 + 2.0**(1 - HM); -- Splitting constant
+      P1 : constant T := T'Leading_Part (Half_Pi, HM);
+      P2 : constant T := T'Leading_Part (Half_Pi - P1, HM);
+      P3 : constant T := T'Leading_Part (Half_Pi - P1 - P2, HM);
+      P4 : constant T := T'Leading_Part (Half_Pi - P1 - P2 - P3, HM);
+      P5 : constant T := T'Leading_Part (Half_Pi - P1 - P2 - P3
                                                                  - P4, HM);
-      P6 : constant Double := Double'Model (Half_Pi - P1 - P2 - P3 - P4 - P5);
-      K  : Double;
+      P6 : constant T := T'Model (Half_Pi - P1 - P2 - P3 - P4 - P5);
+      K  : T;
       R  : Integer;
 
    begin
@@ -142,9 +142,9 @@ package body Ada.Numerics.Aux is
 
       --  Go through an integer temporary so as to use machine instructions
 
-      R := Integer (Double'Rounding (K));
+      R := Integer (T'Rounding (K));
       Q := R mod 4;
-      K := Double (R);
+      K := T (R);
       X := (((((X - K * P1) - K * P2) - K * P3) - K * P4) - K * P5) - K * P6;
    end Reduce;
 
@@ -152,8 +152,8 @@ package body Ada.Numerics.Aux is
    -- Cos --
    ---------
 
-   function Cos (X : Double) return Double is
-      Reduced_X : Double := abs X;
+   function Cos (X : T) return T is
+      Reduced_X : T := abs X;
       Quadrant  : Natural range 0 .. 3;
 
    begin
@@ -182,8 +182,8 @@ package body Ada.Numerics.Aux is
    -- Sin --
    ---------
 
-   function Sin (X : Double) return Double is
-      Reduced_X : Double := X;
+   function Sin (X : T) return T is
+      Reduced_X : T := X;
       Quadrant  : Natural range 0 .. 3;
 
    begin
@@ -208,4 +208,4 @@ package body Ada.Numerics.Aux is
       return Sine_Approx (Reduced_X);
    end Sin;
 
-end Ada.Numerics.Aux;
+end Ada.Numerics.Aux.LF;
diff --git a/gcc/ada/libgnat/a-numaux__darwin.ads b/gcc/ada/libgnat/a-nalofl__sincos.ads
similarity index 83%
rename from gcc/ada/libgnat/a-numaux__darwin.ads
rename to gcc/ada/libgnat/a-nalofl__sincos.ads
index add87a49193..7e46a79074c 100644
--- a/gcc/ada/libgnat/a-numaux__darwin.ads
+++ b/gcc/ada/libgnat/a-nalofl__sincos.ads
@@ -2,7 +2,7 @@
 --                                                                          --
 --                         GNAT RUN-TIME COMPONENTS                         --
 --                                                                          --
---                     A D A . N U M E R I C S . A U X                      --
+--          A D A . N U M E R I C S . A U X _ L O N G _ F L O A T           --
 --                                                                          --
 --                                 S p e c                                  --
 --                          (Apple OS X Version)                            --
@@ -34,70 +34,69 @@
 --  except for sine/cosine which have been implemented directly in Ada to get
 --  the required accuracy.
 
-package Ada.Numerics.Aux is
+package Ada.Numerics.Aux_Long_Float is
    pragma Pure;
 
-   pragma Linker_Options ("-lm");
+   subtype T is Long_Float;
 
-   type Double is new Long_Float;
-   --  Type Double is the type used to call the C routines
+   pragma Linker_Options ("-lm");
 
    --  The following functions have been implemented in Ada, since
    --  the OS X math library didn't meet accuracy requirements for
    --  argument reduction. The implementation here has been tailored
    --  to match Ada strict mode Numerics requirements while maintaining
    --  maximum efficiency.
-   function Sin (X : Double) return Double;
+   function Sin (X : T) return T;
    pragma Inline (Sin);
 
-   function Cos (X : Double) return Double;
+   function Cos (X : T) return T;
    pragma Inline (Cos);
 
    --  We import these functions directly from C. Note that we label them
    --  all as pure functions, because indeed all of them are in fact pure.
 
-   function Tan (X : Double) return Double;
+   function Tan (X : T) return T;
    pragma Import (Intrinsic, Tan, "tan");
    pragma Pure_Function (Tan);
 
-   function Exp (X : Double) return Double;
+   function Exp (X : T) return T;
    pragma Import (Intrinsic, Exp, "exp");
    pragma Pure_Function (Exp);
 
-   function Sqrt (X : Double) return Double;
+   function Sqrt (X : T) return T;
    pragma Import (Intrinsic, Sqrt, "sqrt");
    pragma Pure_Function (Sqrt);
 
-   function Log (X : Double) return Double;
+   function Log (X : T) return T;
    pragma Import (Intrinsic, Log, "log");
    pragma Pure_Function (Log);
 
-   function Acos (X : Double) return Double;
+   function Acos (X : T) return T;
    pragma Import (Intrinsic, Acos, "acos");
    pragma Pure_Function (Acos);
 
-   function Asin (X : Double) return Double;
+   function Asin (X : T) return T;
    pragma Import (Intrinsic, Asin, "asin");
    pragma Pure_Function (Asin);
 
-   function Atan (X : Double) return Double;
+   function Atan (X : T) return T;
    pragma Import (Intrinsic, Atan, "atan");
    pragma Pure_Function (Atan);
 
-   function Sinh (X : Double) return Double;
+   function Sinh (X : T) return T;
    pragma Import (Intrinsic, Sinh, "sinh");
    pragma Pure_Function (Sinh);
 
-   function Cosh (X : Double) return Double;
+   function Cosh (X : T) return T;
    pragma Import (Intrinsic, Cosh, "cosh");
    pragma Pure_Function (Cosh);
 
-   function Tanh (X : Double) return Double;
+   function Tanh (X : T) return T;
    pragma Import (Intrinsic, Tanh, "tanh");
    pragma Pure_Function (Tanh);
 
-   function Pow (X, Y : Double) return Double;
+   function Pow (X, Y : T) return T;
    pragma Import (Intrinsic, Pow, "pow");
    pragma Pure_Function (Pow);
 
-end Ada.Numerics.Aux;
+end Ada.Numerics.Aux_Long_Float;
diff --git a/gcc/ada/libgnat/a-nashfl.ads b/gcc/ada/libgnat/a-nashfl.ads
new file mode 100644
index 00000000000..00cfad05c31
--- /dev/null
+++ b/gcc/ada/libgnat/a-nashfl.ads
@@ -0,0 +1,106 @@
+------------------------------------------------------------------------------
+--                                                                          --
+--                         GNAT RUN-TIME COMPONENTS                         --
+--                                                                          --
+--         A D A . N U M E R I C S . A U X _ S H O R T _ F L O A T          --
+--                                                                          --
+--                                 S p e c                                  --
+--                  (Short Float Wrapper in terms of Float)                 --
+--                                                                          --
+--          Copyright (C) 1992-2020, Free Software Foundation, Inc.         --
+--                                                                          --
+-- GNAT is free software;  you can  redistribute it  and/or modify it under --
+-- terms of the  GNU General Public License as published  by the Free Soft- --
+-- ware  Foundation;  either version 3,  or (at your option) any later ver- --
+-- sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE.                                     --
+--                                                                          --
+-- As a special exception under Section 7 of GPL version 3, you are granted --
+-- additional permissions described in the GCC Runtime Library Exception,   --
+-- version 3.1, as published by the Free Software Foundation.               --
+--                                                                          --
+-- You should have received a copy of the GNU General Public License and    --
+-- a copy of the GCC Runtime Library Exception along with this program;     --
+-- see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see    --
+-- <http://www.gnu.org/licenses/>.                                          --
+--                                                                          --
+-- GNAT was originally developed  by the GNAT team at  New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc.      --
+--                                                                          --
+------------------------------------------------------------------------------
+
+--  This package provides the basic computational interface for the generic
+--  elementary functions. The C library version interfaces with the routines
+--  in the C mathematical library, and is thus quite portable.
+
+--  This version here is for use when Short Float functions are not
+--  present in the C library, but Float ones are. Alternative versions
+--  are provided for special situations:
+
+--    a-nashfl__wraplf    For use where float intrinsics are missing
+
+with Ada.Numerics.Aux_Float;
+
+package Ada.Numerics.Aux_Short_Float is
+   pragma Pure;
+
+   subtype T is Short_Float;
+   package Aux renames Aux_Float;
+   subtype W is Aux.T;
+
+   --  Use the Aux implementation.
+
+   function Sin (X : T) return T
+   is (T (Aux.Sin (W (X))));
+   pragma Inline (Sin);
+
+   function Cos (X : T) return T
+   is (T (Aux.Cos (W (X))));
+   pragma Inline (Cos);
+
+   function Tan (X : T) return T
+   is (T (Aux.Tan (W (X))));
+   pragma Inline (Tan);
+
+   function Exp (X : T) return T
+   is (T (Aux.Exp (W (X))));
+   pragma Inline (Exp);
+
+   function Sqrt (X : T) return T
+   is (T (Aux.Sqrt (W (X))));
+   pragma Inline (Sqrt);
+
+   function Log (X : T) return T
+   is (T (Aux.Log (W (X))));
+   pragma Inline (Log);
+
+   function Acos (X : T) return T
+   is (T (Aux.Acos (W (X))));
+   pragma Inline (Acos);
+
+   function Asin (X : T) return T
+   is (T (Aux.Asin (W (X))));
+   pragma Inline (Asin);
+
+   function Atan (X : T) return T
+   is (T (Aux.Atan (W (X))));
+   pragma Inline (Atan);
+
+   function Sinh (X : T) return T
+   is (T (Aux.Sinh (W (X))));
+   pragma Inline (Sinh);
+
+   function Cosh (X : T) return T
+   is (T (Aux.Cosh (W (X))));
+   pragma Inline (Cosh);
+
+   function Tanh (X : T) return T
+   is (T (Aux.Tanh (W (X))));
+   pragma Inline (Tanh);
+
+   function Pow (X, Y : T) return T
+   is (T (Aux.Pow (W (X), W (Y))));
+   pragma Inline (Pow);
+
+end Ada.Numerics.Aux_Short_Float;
diff --git a/gcc/ada/libgnat/a-nashfl__wraplf.ads b/gcc/ada/libgnat/a-nashfl__wraplf.ads
new file mode 100644
index 00000000000..bebd809ad8c
--- /dev/null
+++ b/gcc/ada/libgnat/a-nashfl__wraplf.ads
@@ -0,0 +1,103 @@
+------------------------------------------------------------------------------
+--                                                                          --
+--                         GNAT RUN-TIME COMPONENTS                         --
+--                                                                          --
+--         A D A . N U M E R I C S . A U X _ S H O R T _ F L O A T          --
+--                                                                          --
+--                                 S p e c                                  --
+--                (Short Float Wrapper in terms of Long Float)              --
+--                                                                          --
+--          Copyright (C) 1992-2020, Free Software Foundation, Inc.         --
+--                                                                          --
+-- GNAT is free software;  you can  redistribute it  and/or modify it under --
+-- terms of the  GNU General Public License as published  by the Free Soft- --
+-- ware  Foundation;  either version 3,  or (at your option) any later ver- --
+-- sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE.                                     --
+--                                                                          --
+-- As a special exception under Section 7 of GPL version 3, you are granted --
+-- additional permissions described in the GCC Runtime Library Exception,   --
+-- version 3.1, as published by the Free Software Foundation.               --
+--                                                                          --
+-- You should have received a copy of the GNU General Public License and    --
+-- a copy of the GCC Runtime Library Exception along with this program;     --
+-- see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see    --
+-- <http://www.gnu.org/licenses/>.                                          --
+--                                                                          --
+-- GNAT was originally developed  by the GNAT team at  New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc.      --
+--                                                                          --
+------------------------------------------------------------------------------
+
+--  This package provides the basic computational interface for the generic
+--  elementary functions. The C library version interfaces with the routines
+--  in the C mathematical library, and is thus quite portable.
+
+--  This version here is for use when short float and float functions
+--  are not present in the C library, but double ones are.
+
+with Ada.Numerics.Aux_Long_Float;
+
+package Ada.Numerics.Aux_Short_Float is
+   pragma Pure;
+
+   subtype T is Short_Float;
+   package Aux renames Aux_Long_Float;
+   subtype W is Aux.T;
+
+   --  Use the Aux implementation.
+
+   function Sin (X : T) return T
+   is (T (Aux.Sin (W (X))));
+   pragma Inline (Sin);
+
+   function Cos (X : T) return T
+   is (T (Aux.Cos (W (X))));
+   pragma Inline (Cos);
+
+   function Tan (X : T) return T
+   is (T (Aux.Tan (W (X))));
+   pragma Inline (Tan);
+
+   function Exp (X : T) return T
+   is (T (Aux.Exp (W (X))));
+   pragma Inline (Exp);
+
+   function Sqrt (X : T) return T
+   is (T (Aux.Sqrt (W (X))));
+   pragma Inline (Sqrt);
+
+   function Log (X : T) return T
+   is (T (Aux.Log (W (X))));
+   pragma Inline (Log);
+
+   function Acos (X : T) return T
+   is (T (Aux.Acos (W (X))));
+   pragma Inline (Acos);
+
+   function Asin (X : T) return T
+   is (T (Aux.Asin (W (X))));
+   pragma Inline (Asin);
+
+   function Atan (X : T) return T
+   is (T (Aux.Atan (W (X))));
+   pragma Inline (Atan);
+
+   function Sinh (X : T) return T
+   is (T (Aux.Sinh (W (X))));
+   pragma Inline (Sinh);
+
+   function Cosh (X : T) return T
+   is (T (Aux.Cosh (W (X))));
+   pragma Inline (Cosh);
+
+   function Tanh (X : T) return T
+   is (T (Aux.Tanh (W (X))));
+   pragma Inline (Tanh);
+
+   function Pow (X, Y : T) return T
+   is (T (Aux.Pow (W (X), W (Y))));
+   pragma Inline (Pow);
+
+end Ada.Numerics.Aux_Short_Float;
diff --git a/gcc/ada/libgnat/a-ngcoty.adb b/gcc/ada/libgnat/a-ngcoty.adb
index 6785ccf34a9..85f660819f9 100644
--- a/gcc/ada/libgnat/a-ngcoty.adb
+++ b/gcc/ada/libgnat/a-ngcoty.adb
@@ -29,10 +29,12 @@
 --                                                                          --
 ------------------------------------------------------------------------------
 
-with Ada.Numerics.Aux; use Ada.Numerics.Aux;
+with Ada.Numerics.Generic_Aux;
 
 package body Ada.Numerics.Generic_Complex_Types is
 
+   package Aux is new Ada.Numerics.Generic_Aux (Real);
+
    subtype R is Real'Base;
 
    Two_Pi  : constant R := R (2.0) * Pi;
@@ -440,7 +442,7 @@ package body Ada.Numerics.Generic_Complex_Types is
          end if;
 
       else
-         arg := R (Atan (Double (abs (b / a))));
+         arg := Aux.Atan (abs (b / a));
 
          if a > 0.0 then
             if b > 0.0 then
@@ -507,8 +509,8 @@ package body Ada.Numerics.Generic_Complex_Types is
       if Modulus = 0.0 then
          return (0.0, 0.0);
       else
-         return (Modulus * R (Cos (Double (Argument))),
-                 Modulus * R (Sin (Double (Argument))));
+         return (Modulus * Aux.Cos (Argument),
+                 Modulus * Aux.Sin (Argument));
       end if;
    end Compose_From_Polar;
 
@@ -536,8 +538,8 @@ package body Ada.Numerics.Generic_Complex_Types is
             return (0.0, -Modulus);
          else
             Arg := Two_Pi * Argument / Cycle;
-            return (Modulus * R (Cos (Double (Arg))),
-                    Modulus * R (Sin (Double (Arg))));
+            return (Modulus * Aux.Cos (Arg),
+                    Modulus * Aux.Sin (Arg));
          end if;
       else
          raise Argument_Error;
@@ -597,8 +599,8 @@ package body Ada.Numerics.Generic_Complex_Types is
       exception
          when Constraint_Error =>
             pragma Assert (X.Re /= 0.0);
-            return R (Double (abs (X.Re))
-              * Sqrt (1.0 + (Double (X.Im) / Double (X.Re)) ** 2));
+            return R (abs (X.Re))
+              * Aux.Sqrt (1.0 + (R (X.Im) / R (X.Re)) ** 2);
       end;
 
       begin
@@ -612,8 +614,8 @@ package body Ada.Numerics.Generic_Complex_Types is
       exception
          when Constraint_Error =>
             pragma Assert (X.Im /= 0.0);
-            return R (Double (abs (X.Im))
-              * Sqrt (1.0 + (Double (X.Re) / Double (X.Im)) ** 2));
+            return R (abs (X.Im))
+              * Aux.Sqrt (1.0 + (R (X.Re) / R (X.Im)) ** 2);
       end;
 
       --  Now deal with cases of underflow. If only one of the squares
@@ -632,13 +634,11 @@ package body Ada.Numerics.Generic_Complex_Types is
 
             else
                if abs (X.Re) > abs (X.Im) then
-                  return
-                    R (Double (abs (X.Re))
-                      * Sqrt (1.0 + (Double (X.Im) / Double (X.Re)) ** 2));
+                  return R (abs (X.Re))
+                    * Aux.Sqrt (1.0 + (R (X.Im) / R (X.Re)) ** 2);
                else
-                  return
-                    R (Double (abs (X.Im))
-                      * Sqrt (1.0 + (Double (X.Re) / Double (X.Im)) ** 2));
+                  return R (abs (X.Im))
+                    * Aux.Sqrt (1.0 + (R (X.Re) / R (X.Im)) ** 2);
                end if;
             end if;
 
@@ -652,7 +652,7 @@ package body Ada.Numerics.Generic_Complex_Types is
       --  In all other cases, the naive computation will do
 
       else
-         return R (Sqrt (Double (Re2 + Im2)));
+         return Aux.Sqrt (Re2 + Im2);
       end if;
    end Modulus;
 
diff --git a/gcc/ada/libgnat/a-ngelfu.adb b/gcc/ada/libgnat/a-ngelfu.adb
index 7e7c6623850..57b310c19d7 100644
--- a/gcc/ada/libgnat/a-ngelfu.adb
+++ b/gcc/ada/libgnat/a-ngelfu.adb
@@ -36,13 +36,13 @@
 --  Uses functions sqrt, exp, log, pow, sin, asin, cos, acos, tan, atan, sinh,
 --  cosh, tanh from C library via math.h
 
-with Ada.Numerics.Aux;
+with Ada.Numerics.Generic_Aux;
 
 package body Ada.Numerics.Generic_Elementary_Functions with
   SPARK_Mode => Off
 is
 
-   use type Ada.Numerics.Aux.Double;
+   package Aux is new Ada.Numerics.Generic_Aux (Float_Type);
 
    Sqrt_Two : constant := 1.41421_35623_73095_04880_16887_24209_69807_85696;
    Log_Two  : constant := 0.69314_71805_59945_30941_72321_21458_17656_80755;
@@ -50,7 +50,6 @@ is
    Half_Log_Two : constant := Log_Two / 2;
 
    subtype T is Float_Type'Base;
-   subtype Double is Aux.Double;
 
    Two_Pi  : constant T := 2.0 * Pi;
    Half_Pi : constant T := Pi / 2.0;
@@ -150,8 +149,7 @@ is
                      Rest := Rest - 0.25;
                   end if;
 
-                  Result := Result *
-                    Float_Type'Base (Aux.Pow (Double (Left), Double (Rest)));
+                  Result := Result * Aux.Pow (Left, Rest);
 
                   if Right >= 0.0 then
                      return Result;
@@ -159,8 +157,7 @@ is
                      return (1.0 / Result);
                   end if;
                else
-                  return
-                    Float_Type'Base (Aux.Pow (Double (Left), Double (Right)));
+                  return Aux.Pow (Left, Right);
                end if;
             end if;
 
@@ -194,7 +191,7 @@ is
          return Pi;
       end if;
 
-      Temp := Float_Type'Base (Aux.Acos (Double (X)));
+      Temp := Aux.Acos (X);
 
       if Temp < 0.0 then
          Temp := Pi + Temp;
@@ -332,7 +329,7 @@ is
          return -(Pi / 2.0);
       end if;
 
-      return Float_Type'Base (Aux.Asin (Double (X)));
+      return Aux.Asin (X);
    end Arcsin;
 
    --  Arbitrary cycle
@@ -515,7 +512,7 @@ is
          return 1.0;
       end if;
 
-      return Float_Type'Base (Aux.Cos (Double (X)));
+      return Aux.Cos (X);
    end Cos;
 
    --  Arbitrary cycle
@@ -568,7 +565,7 @@ is
          return 1.0 / X;
       end if;
 
-      return 1.0 / Float_Type'Base (Aux.Tan (Double (X)));
+      return 1.0 / Aux.Tan (X);
    end Cot;
 
    --  Arbitrary cycle
@@ -617,7 +614,7 @@ is
          return 1.0 / X;
       end if;
 
-      return 1.0 / Float_Type'Base (Aux.Tanh (Double (X)));
+      return 1.0 / Aux.Tanh (X);
    end Coth;
 
    ---------
@@ -632,7 +629,7 @@ is
          return 1.0;
       end if;
 
-      Result := Float_Type'Base (Aux.Exp (Double (X)));
+      Result := Aux.Exp (X);
 
       --  Deal with case of Exp returning IEEE infinity. If Machine_Overflows
       --  is False, then we can just leave it as an infinity (and indeed we
@@ -716,7 +713,7 @@ is
       Raw_Atan :=
         (if Z < Sqrt_Epsilon then Z
          elsif Z = 1.0 then Pi / 4.0
-         else Float_Type'Base (Aux.Atan (Double (Z))));
+         else Aux.Atan (Z));
 
       if abs Y > abs X then
          Raw_Atan := Half_Pi - Raw_Atan;
@@ -747,7 +744,7 @@ is
          return 0.0;
       end if;
 
-      return Float_Type'Base (Aux.Log (Double (X)));
+      return Aux.Log (X);
    end Log;
 
    --  Arbitrary base
@@ -767,7 +764,7 @@ is
          return 0.0;
       end if;
 
-      return Float_Type'Base (Aux.Log (Double (X)) / Aux.Log (Double (Base)));
+      return Aux.Log (X) / Aux.Log (Base);
    end Log;
 
    ---------
@@ -782,7 +779,7 @@ is
          return X;
       end if;
 
-      return Float_Type'Base (Aux.Sin (Double (X)));
+      return Aux.Sin (X);
    end Sin;
 
    --  Arbitrary cycle
@@ -816,7 +813,7 @@ is
       --  Could test for 12.0 * abs T = Cycle, and return an exact value in
       --  those cases. It is not clear this is worth the extra test though.
 
-      return Float_Type'Base (Aux.Sin (Double (T / Cycle * Two_Pi)));
+      return Aux.Sin (T / Cycle * Two_Pi);
    end Sin;
 
    ----------
@@ -899,7 +896,7 @@ is
          return X;
       end if;
 
-      return Float_Type'Base (Aux.Sqrt (Double (X)));
+      return Aux.Sqrt (X);
    end Sqrt;
 
    ---------
@@ -919,7 +916,7 @@ is
       --  with, it is impossible for X to be exactly pi/2, and the result is
       --  always in range.
 
-      return Float_Type'Base (Aux.Tan (Double (X)));
+      return Aux.Tan (X);
    end Tan;
 
    --  Arbitrary cycle
@@ -992,7 +989,7 @@ is
          return X + X * R;
 
       else
-         return Float_Type'Base (Aux.Tanh (Double (X)));
+         return Aux.Tanh (X);
       end if;
    end Tanh;
 
diff --git a/gcc/ada/libgnat/a-nuaufl.ads b/gcc/ada/libgnat/a-nuaufl.ads
new file mode 100644
index 00000000000..88deda87f9a
--- /dev/null
+++ b/gcc/ada/libgnat/a-nuaufl.ads
@@ -0,0 +1,105 @@
+------------------------------------------------------------------------------
+--                                                                          --
+--                         GNAT RUN-TIME COMPONENTS                         --
+--                                                                          --
+--               A D A . N U M E R I C S . A U X _ F L O A T                --
+--                                                                          --
+--                                 S p e c                                  --
+--                      (C Math Library Version, Float)                     --
+--                                                                          --
+--          Copyright (C) 1992-2020, Free Software Foundation, Inc.         --
+--                                                                          --
+-- GNAT is free software;  you can  redistribute it  and/or modify it under --
+-- terms of the  GNU General Public License as published  by the Free Soft- --
+-- ware  Foundation;  either version 3,  or (at your option) any later ver- --
+-- sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE.                                     --
+--                                                                          --
+-- As a special exception under Section 7 of GPL version 3, you are granted --
+-- additional permissions described in the GCC Runtime Library Exception,   --
+-- version 3.1, as published by the Free Software Foundation.               --
+--                                                                          --
+-- You should have received a copy of the GNU General Public License and    --
+-- a copy of the GCC Runtime Library Exception along with this program;     --
+-- see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see    --
+-- <http://www.gnu.org/licenses/>.                                          --
+--                                                                          --
+-- GNAT was originally developed  by the GNAT team at  New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc.      --
+--                                                                          --
+------------------------------------------------------------------------------
+
+--  This package provides the basic computational interface for the generic
+--  elementary functions. The C library version interfaces with the routines
+--  in the C mathematical library, and is thus quite portable.
+
+--  This version here is for use with normal Unix math functions, from
+--  libm. Alternative versions are provided for special situations:
+
+--    a-nuaufl__nolibm    For use on VxWorks (where we have no libm.a library)
+--    a-naaufl__wraplf    For use where float intrinsics are missing
+
+package Ada.Numerics.Aux_Float is
+   pragma Pure;
+
+   subtype T is Float;
+
+   pragma Linker_Options ("-lm");
+
+   --  We import these functions directly from C. Note that we label them
+   --  all as pure functions, because indeed all of them are in fact pure.
+
+   function Sin (X : T) return T;
+   pragma Import (Intrinsic, Sin, "sinf");
+   pragma Pure_Function (Sin);
+
+   function Cos (X : T) return T;
+   pragma Import (Intrinsic, Cos, "cosf");
+   pragma Pure_Function (Cos);
+
+   function Tan (X : T) return T;
+   pragma Import (Intrinsic, Tan, "tanf");
+   pragma Pure_Function (Tan);
+
+   function Exp (X : T) return T;
+   pragma Import (Intrinsic, Exp, "expf");
+   pragma Pure_Function (Exp);
+
+   function Sqrt (X : T) return T;
+   pragma Import (Intrinsic, Sqrt, "sqrtf");
+   pragma Pure_Function (Sqrt);
+
+   function Log (X : T) return T;
+   pragma Import (Intrinsic, Log, "logf");
+   pragma Pure_Function (Log);
+
+   function Acos (X : T) return T;
+   pragma Import (Intrinsic, Acos, "acosf");
+   pragma Pure_Function (Acos);
+
+   function Asin (X : T) return T;
+   pragma Import (Intrinsic, Asin, "asinf");
+   pragma Pure_Function (Asin);
+
+   function Atan (X : T) return T;
+   pragma Import (Intrinsic, Atan, "atanf");
+   pragma Pure_Function (Atan);
+
+   function Sinh (X : T) return T;
+   pragma Import (Intrinsic, Sinh, "sinhf");
+   pragma Pure_Function (Sinh);
+
+   function Cosh (X : T) return T;
+   pragma Import (Intrinsic, Cosh, "coshf");
+   pragma Pure_Function (Cosh);
+
+   function Tanh (X : T) return T;
+   pragma Import (Intrinsic, Tanh, "tanhf");
+   pragma Pure_Function (Tanh);
+
+   function Pow (X, Y : T) return T;
+   pragma Import (Intrinsic, Pow, "powf");
+   pragma Pure_Function (Pow);
+
+end Ada.Numerics.Aux_Float;
diff --git a/gcc/ada/libgnat/a-nuaufl__nolibm.ads b/gcc/ada/libgnat/a-nuaufl__nolibm.ads
new file mode 100644
index 00000000000..4247d45d117
--- /dev/null
+++ b/gcc/ada/libgnat/a-nuaufl__nolibm.ads
@@ -0,0 +1,100 @@
+------------------------------------------------------------------------------
+--                                                                          --
+--                         GNAT RUN-TIME COMPONENTS                         --
+--                                                                          --
+--               A D A . N U M E R I C S . A U X _ F L O A T                --
+--                                                                          --
+--                                 S p e c                                  --
+--                         (C Library Version, Float)                       --
+--                                                                          --
+--          Copyright (C) 1992-2020, Free Software Foundation, Inc.         --
+--                                                                          --
+-- GNAT is free software;  you can  redistribute it  and/or modify it under --
+-- terms of the  GNU General Public License as published  by the Free Soft- --
+-- ware  Foundation;  either version 3,  or (at your option) any later ver- --
+-- sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE.                                     --
+--                                                                          --
+-- As a special exception under Section 7 of GPL version 3, you are granted --
+-- additional permissions described in the GCC Runtime Library Exception,   --
+-- version 3.1, as published by the Free Software Foundation.               --
+--                                                                          --
+-- You should have received a copy of the GNU General Public License and    --
+-- a copy of the GCC Runtime Library Exception along with this program;     --
+-- see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see    --
+-- <http://www.gnu.org/licenses/>.                                          --
+--                                                                          --
+-- GNAT was originally developed  by the GNAT team at  New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc.      --
+--                                                                          --
+------------------------------------------------------------------------------
+
+--  This package provides the basic computational interface for the generic
+--  elementary functions. The C library version interfaces with the routines
+--  in the C mathematical library, and is thus quite portable.
+
+--  This version here is for use with normal Unix math functions, from
+--  libc.
+
+package Ada.Numerics.Aux_Float is
+   pragma Pure;
+
+   subtype T is Float;
+
+   --  We import these functions directly from C. Note that we label them
+   --  all as pure functions, because indeed all of them are in fact pure.
+
+   function Sin (X : T) return T;
+   pragma Import (Intrinsic, Sin, "sinf");
+   pragma Pure_Function (Sin);
+
+   function Cos (X : T) return T;
+   pragma Import (Intrinsic, Cos, "cosf");
+   pragma Pure_Function (Cos);
+
+   function Tan (X : T) return T;
+   pragma Import (Intrinsic, Tan, "tanf");
+   pragma Pure_Function (Tan);
+
+   function Exp (X : T) return T;
+   pragma Import (Intrinsic, Exp, "expf");
+   pragma Pure_Function (Exp);
+
+   function Sqrt (X : T) return T;
+   pragma Import (Intrinsic, Sqrt, "sqrtf");
+   pragma Pure_Function (Sqrt);
+
+   function Log (X : T) return T;
+   pragma Import (Intrinsic, Log, "logf");
+   pragma Pure_Function (Log);
+
+   function Acos (X : T) return T;
+   pragma Import (Intrinsic, Acos, "acosf");
+   pragma Pure_Function (Acos);
+
+   function Asin (X : T) return T;
+   pragma Import (Intrinsic, Asin, "asinf");
+   pragma Pure_Function (Asin);
+
+   function Atan (X : T) return T;
+   pragma Import (Intrinsic, Atan, "atanf");
+   pragma Pure_Function (Atan);
+
+   function Sinh (X : T) return T;
+   pragma Import (Intrinsic, Sinh, "sinhf");
+   pragma Pure_Function (Sinh);
+
+   function Cosh (X : T) return T;
+   pragma Import (Intrinsic, Cosh, "coshf");
+   pragma Pure_Function (Cosh);
+
+   function Tanh (X : T) return T;
+   pragma Import (Intrinsic, Tanh, "tanhf");
+   pragma Pure_Function (Tanh);
+
+   function Pow (X, Y : T) return T;
+   pragma Import (Intrinsic, Pow, "powf");
+   pragma Pure_Function (Pow);
+
+end Ada.Numerics.Aux_Float;
diff --git a/gcc/ada/libgnat/a-nuaufl__wraplf.ads b/gcc/ada/libgnat/a-nuaufl__wraplf.ads
new file mode 100644
index 00000000000..eb32ba73876
--- /dev/null
+++ b/gcc/ada/libgnat/a-nuaufl__wraplf.ads
@@ -0,0 +1,105 @@
+------------------------------------------------------------------------------
+--                                                                          --
+--                         GNAT RUN-TIME COMPONENTS                         --
+--                                                                          --
+--               A D A . N U M E R I C S . A U X _ F L O A T                --
+--                                                                          --
+--                                 S p e c                                  --
+--                   (Float Wrapper in terms of Long Float)                 --
+--                                                                          --
+--          Copyright (C) 1992-2020, Free Software Foundation, Inc.         --
+--                                                                          --
+-- GNAT is free software;  you can  redistribute it  and/or modify it under --
+-- terms of the  GNU General Public License as published  by the Free Soft- --
+-- ware  Foundation;  either version 3,  or (at your option) any later ver- --
+-- sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE.                                     --
+--                                                                          --
+-- As a special exception under Section 7 of GPL version 3, you are granted --
+-- additional permissions described in the GCC Runtime Library Exception,   --
+-- version 3.1, as published by the Free Software Foundation.               --
+--                                                                          --
+-- You should have received a copy of the GNU General Public License and    --
+-- a copy of the GCC Runtime Library Exception along with this program;     --
+-- see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see    --
+-- <http://www.gnu.org/licenses/>.                                          --
+--                                                                          --
+-- GNAT was originally developed  by the GNAT team at  New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc.      --
+--                                                                          --
+------------------------------------------------------------------------------
+
+--  This package provides the basic computational interface for the generic
+--  elementary functions. The C library version interfaces with the routines
+--  in the C mathematical library, and is thus quite portable.
+
+--  This version here is for use when float functions are not present
+--  in the C library, but double ones are.
+
+with Ada.Numerics.Aux_Long_Float;
+
+package Ada.Numerics.Aux_Float is
+   pragma Pure;
+
+   subtype T is Float;
+
+   subtype T is Float;
+   package Aux renames Aux_Long_Float;
+   subtype W is Aux.T;
+
+   --  Use the Aux implementation.
+
+   function Sin (X : T) return T
+   is (T (Aux.Sin (W (X))));
+   pragma Inline (Sin);
+
+   function Cos (X : T) return T
+   is (T (Aux.Cos (W (X))));
+   pragma Inline (Cos);
+
+   function Tan (X : T) return T
+   is (T (Aux.Tan (W (X))));
+   pragma Inline (Tan);
+
+   function Exp (X : T) return T
+   is (T (Aux.Exp (W (X))));
+   pragma Inline (Exp);
+
+   function Sqrt (X : T) return T
+   is (T (Aux.Sqrt (W (X))));
+   pragma Inline (Sqrt);
+
+   function Log (X : T) return T
+   is (T (Aux.Log (W (X))));
+   pragma Inline (Log);
+
+   function Acos (X : T) return T
+   is (T (Aux.Acos (W (X))));
+   pragma Inline (Acos);
+
+   function Asin (X : T) return T
+   is (T (Aux.Asin (W (X))));
+   pragma Inline (Asin);
+
+   function Atan (X : T) return T
+   is (T (Aux.Atan (W (X))));
+   pragma Inline (Atan);
+
+   function Sinh (X : T) return T
+   is (T (Aux.Sinh (W (X))));
+   pragma Inline (Sinh);
+
+   function Cosh (X : T) return T
+   is (T (Aux.Cosh (W (X))));
+   pragma Inline (Cosh);
+
+   function Tanh (X : T) return T
+   is (T (Aux.Tanh (W (X))));
+   pragma Inline (Tanh);
+
+   function Pow (X, Y : T) return T
+   is (T (Aux.Pow (W (X), W (Y))));
+   pragma Inline (Pow);
+
+end Ada.Numerics.Aux_Float;
diff --git a/gcc/ada/libgnat/a-nugeau.ads b/gcc/ada/libgnat/a-nugeau.ads
new file mode 100644
index 00000000000..94f5560c75c
--- /dev/null
+++ b/gcc/ada/libgnat/a-nugeau.ads
@@ -0,0 +1,184 @@
+------------------------------------------------------------------------------
+--                                                                          --
+--                         GNAT RUN-TIME COMPONENTS                         --
+--                                                                          --
+--             A D A . N U M E R I C S . G E N E R I C _ A U X              --
+--                                                                          --
+--                                 S p e c                                  --
+--                            (Generic Wrapper)                             --
+--                                                                          --
+--          Copyright (C) 1992-2020, Free Software Foundation, Inc.         --
+--                                                                          --
+-- GNAT is free software;  you can  redistribute it  and/or modify it under --
+-- terms of the  GNU General Public License as published  by the Free Soft- --
+-- ware  Foundation;  either version 3,  or (at your option) any later ver- --
+-- sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE.                                     --
+--                                                                          --
+-- As a special exception under Section 7 of GPL version 3, you are granted --
+-- additional permissions described in the GCC Runtime Library Exception,   --
+-- version 3.1, as published by the Free Software Foundation.               --
+--                                                                          --
+-- You should have received a copy of the GNU General Public License and    --
+-- a copy of the GCC Runtime Library Exception along with this program;     --
+-- see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see    --
+-- <http://www.gnu.org/licenses/>.                                          --
+--                                                                          --
+-- GNAT was originally developed  by the GNAT team at  New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc.      --
+--                                                                          --
+------------------------------------------------------------------------------
+
+--  This package provides the basic computational interface for the generic
+--  elementary functions. The C library version interfaces with the routines
+--  in the C mathematical library.
+
+--  This version here is for use with normal Unix math functions.
+
+with Ada.Numerics.Aux_Long_Long_Float;
+with Ada.Numerics.Aux_Long_Float;
+with Ada.Numerics.Aux_Float;
+with Ada.Numerics.Aux_Short_Float;
+
+generic
+   type T is digits <>;
+package Ada.Numerics.Generic_Aux is
+   pragma Pure;
+
+   package LLF renames Ada.Numerics.Aux_Long_Long_Float;
+   package LF renames Ada.Numerics.Aux_Long_Float;
+   package F renames Ada.Numerics.Aux_Float;
+   package SF renames Ada.Numerics.Aux_Short_Float;
+
+   function Sin (X : T'Base) return T'Base
+   is (if T'Base'Digits > Long_Float'Digits
+         then T'Base (LLF.Sin (Long_Long_Float (X)))
+         elsif T'Base'Digits > Float'Digits
+         then T'Base (LF.Sin (Long_Float (X)))
+         elsif T'Base'Digits > Short_Float'Digits
+         then T'Base (F.Sin (Float (X)))
+         else T'Base (SF.Sin (Short_Float (X))));
+   pragma Inline (Sin);
+
+   function Cos (X : T'Base) return T'Base
+   is (if T'Base'Digits > Long_Float'Digits
+         then T'Base (LLF.Cos (Long_Long_Float (X)))
+         elsif T'Base'Digits > Float'Digits
+         then T'Base (LF.Cos (Long_Float (X)))
+         elsif T'Base'Digits > Short_Float'Digits
+         then T'Base (F.Cos (Float (X)))
+         else T'Base (SF.Cos (Short_Float (X))));
+   pragma Inline (Cos);
+
+   function Tan (X : T'Base) return T'Base
+   is (if T'Base'Digits > Long_Float'Digits
+         then T'Base (LLF.Tan (Long_Long_Float (X)))
+         elsif T'Base'Digits > Float'Digits
+         then T'Base (LF.Tan (Long_Float (X)))
+         elsif T'Base'Digits > Short_Float'Digits
+         then T'Base (F.Tan (Float (X)))
+         else T'Base (SF.Tan (Short_Float (X))));
+   pragma Inline (Tan);
+
+   function Exp (X : T'Base) return T'Base
+   is (if T'Base'Digits > Long_Float'Digits
+         then T'Base (LLF.Exp (Long_Long_Float (X)))
+         elsif T'Base'Digits > Float'Digits
+         then T'Base (LF.Exp (Long_Float (X)))
+         elsif T'Base'Digits > Short_Float'Digits
+         then T'Base (F.Exp (Float (X)))
+         else T'Base (SF.Exp (Short_Float (X))));
+   pragma Inline (Exp);
+
+   function Sqrt (X : T'Base) return T'Base
+   is (if T'Base'Digits > Long_Float'Digits
+         then T'Base (LLF.Sqrt (Long_Long_Float (X)))
+         elsif T'Base'Digits > Float'Digits
+         then T'Base (LF.Sqrt (Long_Float (X)))
+         elsif T'Base'Digits > Short_Float'Digits
+         then T'Base (F.Sqrt (Float (X)))
+         else T'Base (SF.Sqrt (Short_Float (X))));
+   pragma Inline (Sqrt);
+
+   function Log (X : T'Base) return T'Base
+   is (if T'Base'Digits > Long_Float'Digits
+         then T'Base (LLF.Log (Long_Long_Float (X)))
+         elsif T'Base'Digits > Float'Digits
+         then T'Base (LF.Log (Long_Float (X)))
+         elsif T'Base'Digits > Short_Float'Digits
+         then T'Base (F.Log (Float (X)))
+         else T'Base (SF.Log (Short_Float (X))));
+   pragma Inline (Log);
+
+   function Acos (X : T'Base) return T'Base
+   is (if T'Base'Digits > Long_Float'Digits
+         then T'Base (LLF.Acos (Long_Long_Float (X)))
+         elsif T'Base'Digits > Float'Digits
+         then T'Base (LF.Acos (Long_Float (X)))
+         elsif T'Base'Digits > Short_Float'Digits
+         then T'Base (F.Acos (Float (X)))
+         else T'Base (SF.Acos (Short_Float (X))));
+   pragma Inline (Acos);
+
+   function Asin (X : T'Base) return T'Base
+   is (if T'Base'Digits > Long_Float'Digits
+         then T'Base (LLF.Asin (Long_Long_Float (X)))
+         elsif T'Base'Digits > Float'Digits
+         then T'Base (LF.Asin (Long_Float (X)))
+         elsif T'Base'Digits > Short_Float'Digits
+         then T'Base (F.Asin (Float (X)))
+         else T'Base (SF.Asin (Short_Float (X))));
+   pragma Inline (Asin);
+
+   function Atan (X : T'Base) return T'Base
+   is (if T'Base'Digits > Long_Float'Digits
+         then T'Base (LLF.Atan (Long_Long_Float (X)))
+         elsif T'Base'Digits > Float'Digits
+         then T'Base (LF.Atan (Long_Float (X)))
+         elsif T'Base'Digits > Short_Float'Digits
+         then T'Base (F.Atan (Float (X)))
+         else T'Base (SF.Atan (Short_Float (X))));
+   pragma Inline (Atan);
+
+   function Sinh (X : T'Base) return T'Base
+   is (if T'Base'Digits > Long_Float'Digits
+         then T'Base (LLF.Sinh (Long_Long_Float (X)))
+         elsif T'Base'Digits > Float'Digits
+         then T'Base (LF.Sinh (Long_Float (X)))
+         elsif T'Base'Digits > Short_Float'Digits
+         then T'Base (F.Sinh (Float (X)))
+         else T'Base (SF.Sinh (Short_Float (X))));
+   pragma Inline (Sinh);
+
+   function Cosh (X : T'Base) return T'Base
+   is (if T'Base'Digits > Long_Float'Digits
+         then T'Base (LLF.Cosh (Long_Long_Float (X)))
+         elsif T'Base'Digits > Float'Digits
+         then T'Base (LF.Cosh (Long_Float (X)))
+         elsif T'Base'Digits > Short_Float'Digits
+         then T'Base (F.Cosh (Float (X)))
+         else T'Base (SF.Cosh (Short_Float (X))));
+   pragma Inline (Cosh);
+
+   function Tanh (X : T'Base) return T'Base
+   is (if T'Base'Digits > Long_Float'Digits
+         then T'Base (LLF.Tanh (Long_Long_Float (X)))
+         elsif T'Base'Digits > Float'Digits
+         then T'Base (LF.Tanh (Long_Float (X)))
+         elsif T'Base'Digits > Short_Float'Digits
+         then T'Base (F.Tanh (Float (X)))
+         else T'Base (SF.Tanh (Short_Float (X))));
+   pragma Inline (Tanh);
+
+   function Pow (X, Y : T'Base) return T'Base
+   is (if T'Base'Digits > Long_Float'Digits
+         then T'Base (LLF.Pow (Long_Long_Float (X), Long_Long_Float (Y)))
+         elsif T'Base'Digits > Float'Digits
+         then T'Base (LF.Pow (Long_Float (X), Long_Float (Y)))
+         elsif T'Base'Digits > Short_Float'Digits
+         then T'Base (F.Pow (Float (X), Float (Y)))
+         else T'Base (SF.Pow (Short_Float (X), Short_Float (Y))));
+   pragma Inline (Pow);
+
+end Ada.Numerics.Generic_Aux;
diff --git a/gcc/ada/libgnat/a-numaux__dummy.adb b/gcc/ada/libgnat/a-numaux.adb
similarity index 100%
rename from gcc/ada/libgnat/a-numaux__dummy.adb
rename to gcc/ada/libgnat/a-numaux.adb
diff --git a/gcc/ada/libgnat/a-numaux.ads b/gcc/ada/libgnat/a-numaux.ads
index 4154e1ab216..e60f11c8a57 100644
--- a/gcc/ada/libgnat/a-numaux.ads
+++ b/gcc/ada/libgnat/a-numaux.ads
@@ -5,7 +5,7 @@
 --                     A D A . N U M E R I C S . A U X                      --
 --                                                                          --
 --                                 S p e c                                  --
---                       (C Library Version, non-x86)                       --
+--                      (Backward-Compatibility Version)                    --
 --                                                                          --
 --          Copyright (C) 1992-2020, Free Software Foundation, Inc.         --
 --                                                                          --
@@ -30,83 +30,92 @@
 --                                                                          --
 ------------------------------------------------------------------------------
 
---  This package provides the basic computational interface for the generic
---  elementary functions. The C library version interfaces with the routines
---  in the C mathematical library, and is thus quite portable, although it may
---  not necessarily meet the requirements for accuracy in the numerics annex.
---  One advantage of using this package is that it will interface directly to
---  hardware instructions, such as the those provided on the Intel x86.
+--  This is a backward-compatibility package, for users of this
+--  internal package before the introduction of Generic_Aux.
 
---  This version here is for use with normal Unix math functions. Alternative
---  versions are provided for special situations:
+--  This version here is for use with Double mapping to Long_Float.
+--  Alternative versions are provided for special situations:
 
---    a-numaux-darwin    For PowerPC/Darwin (special handling of sin/cos)
---    a-numaux-libc-x86  For the x86, using 80-bit long double format
---    a-numaux-x86       For the x86, using 80-bit long double format with
---                       inline asm statements
---    a-numaux-vxworks   For use on VxWorks (where we have no libm.a library)
+--    a-numaux__libc-x86    Map Double to x86's 80-bit Long_Long_Float
+
+with Ada.Numerics.Aux_Long_Float;
 
 package Ada.Numerics.Aux is
    pragma Pure;
 
-   pragma Linker_Options ("-lm");
-
    type Double is new Long_Float;
-   --  Type Double is the type used to call the C routines
 
-   --  We import these functions directly from C. Note that we label them
-   --  all as pure functions, because indeed all of them are in fact pure.
+   subtype T is Double;
+
+   package Aux renames Aux_Long_Float;
+
+   subtype W is Aux.T;
+
+   --  Use the Aux implementation.
 
-   function Sin (X : Double) return Double;
-   pragma Import (Intrinsic, Sin, "sin");
+   function Sin (X : T) return T
+   is (T (Aux.Sin (W (X))));
+   pragma Inline (Sin);
    pragma Pure_Function (Sin);
 
-   function Cos (X : Double) return Double;
-   pragma Import (Intrinsic, Cos, "cos");
+   function Cos (X : T) return T
+   is (T (Aux.Cos (W (X))));
+   pragma Inline (Cos);
    pragma Pure_Function (Cos);
 
-   function Tan (X : Double) return Double;
-   pragma Import (Intrinsic, Tan, "tan");
+   function Tan (X : T) return T
+   is (T (Aux.Tan (W (X))));
+   pragma Inline (Tan);
    pragma Pure_Function (Tan);
 
-   function Exp (X : Double) return Double;
-   pragma Import (Intrinsic, Exp, "exp");
+   function Exp (X : T) return T
+   is (T (Aux.Exp (W (X))));
+   pragma Inline (Exp);
    pragma Pure_Function (Exp);
 
-   function Sqrt (X : Double) return Double;
-   pragma Import (Intrinsic, Sqrt, "sqrt");
+   function Sqrt (X : T) return T
+   is (T (Aux.Sqrt (W (X))));
+   pragma Inline (Sqrt);
    pragma Pure_Function (Sqrt);
 
-   function Log (X : Double) return Double;
-   pragma Import (Intrinsic, Log, "log");
+   function Log (X : T) return T
+   is (T (Aux.Log (W (X))));
+   pragma Inline (Log);
    pragma Pure_Function (Log);
 
-   function Acos (X : Double) return Double;
-   pragma Import (Intrinsic, Acos, "acos");
+   function Acos (X : T) return T
+   is (T (Aux.Acos (W (X))));
+   pragma Inline (Acos);
    pragma Pure_Function (Acos);
 
-   function Asin (X : Double) return Double;
-   pragma Import (Intrinsic, Asin, "asin");
+   function Asin (X : T) return T
+   is (T (Aux.Asin (W (X))));
+   pragma Inline (Asin);
    pragma Pure_Function (Asin);
 
-   function Atan (X : Double) return Double;
-   pragma Import (Intrinsic, Atan, "atan");
+   function Atan (X : T) return T
+   is (T (Aux.Atan (W (X))));
+   pragma Inline (Atan);
    pragma Pure_Function (Atan);
 
-   function Sinh (X : Double) return Double;
-   pragma Import (Intrinsic, Sinh, "sinh");
+   function Sinh (X : T) return T
+   is (T (Aux.Sinh (W (X))));
+   pragma Inline (Sinh);
    pragma Pure_Function (Sinh);
 
-   function Cosh (X : Double) return Double;
-   pragma Import (Intrinsic, Cosh, "cosh");
+   function Cosh (X : T) return T
+   is (T (Aux.Cosh (W (X))));
+   pragma Inline (Cosh);
    pragma Pure_Function (Cosh);
 
-   function Tanh (X : Double) return Double;
-   pragma Import (Intrinsic, Tanh, "tanh");
+   function Tanh (X : T) return T
+   is (T (Aux.Tanh (W (X))));
+   pragma Inline (Tanh);
    pragma Pure_Function (Tanh);
 
-   function Pow (X, Y : Double) return Double;
-   pragma Import (Intrinsic, Pow, "pow");
+   function Pow (X, Y : T) return T
+   is (T (Aux.Pow (W (X), W (Y))));
+   pragma Inline (Pow);
    pragma Pure_Function (Pow);
 
 end Ada.Numerics.Aux;
diff --git a/gcc/ada/libgnat/a-numaux__libc-x86.ads b/gcc/ada/libgnat/a-numaux__libc-x86.ads
index f6deebecbad..3dfdad129ce 100644
--- a/gcc/ada/libgnat/a-numaux__libc-x86.ads
+++ b/gcc/ada/libgnat/a-numaux__libc-x86.ads
@@ -5,7 +5,7 @@
 --                     A D A . N U M E R I C S . A U X                      --
 --                                                                          --
 --                                 S p e c                                  --
---                       (C Library Version for x86)                        --
+--                    (x86 Backward-Compatibility Version)                  --
 --                                                                          --
 --          Copyright (C) 1992-2020, Free Software Foundation, Inc.         --
 --                                                                          --
@@ -30,68 +30,88 @@
 --                                                                          --
 ------------------------------------------------------------------------------
 
---  This version is for the x86 using the 80-bit x86 long double format
+--  This is a backward-compatibility package, for users of this
+--  internal package before the introduction of Generic_Aux on x86,
+--  where the Double type mapped to Long Long Float.
+
+with Ada.Numerics.Aux_Long_Long_Float;
 
 package Ada.Numerics.Aux is
    pragma Pure;
 
-   pragma Linker_Options ("-lm");
-
    type Double is new Long_Long_Float;
 
-   --  We import these functions directly from C. Note that we label them
-   --  all as pure functions, because indeed all of them are in fact pure.
+   subtype T is Double;
+
+   package Aux renames Aux_Long_Long_Float;
+
+   subtype W is Aux.T;
+
+   --  Use the Aux implementation.
 
-   function Sin (X : Double) return Double;
-   pragma Import (Intrinsic, Sin, "sinl");
+   function Sin (X : T) return T
+   is (T (Aux.Sin (W (X))));
+   pragma Inline (Sin);
    pragma Pure_Function (Sin);
 
-   function Cos (X : Double) return Double;
-   pragma Import (Intrinsic, Cos, "cosl");
+   function Cos (X : T) return T
+   is (T (Aux.Cos (W (X))));
+   pragma Inline (Cos);
    pragma Pure_Function (Cos);
 
-   function Tan (X : Double) return Double;
-   pragma Import (Intrinsic, Tan, "tanl");
+   function Tan (X : T) return T
+   is (T (Aux.Tan (W (X))));
+   pragma Inline (Tan);
    pragma Pure_Function (Tan);
 
-   function Exp (X : Double) return Double;
-   pragma Import (Intrinsic, Exp, "expl");
+   function Exp (X : T) return T
+   is (T (Aux.Exp (W (X))));
+   pragma Inline (Exp);
    pragma Pure_Function (Exp);
 
-   function Sqrt (X : Double) return Double;
-   pragma Import (Intrinsic, Sqrt, "sqrtl");
+   function Sqrt (X : T) return T
+   is (T (Aux.Sqrt (W (X))));
+   pragma Inline (Sqrt);
    pragma Pure_Function (Sqrt);
 
-   function Log (X : Double) return Double;
-   pragma Import (Intrinsic, Log, "logl");
+   function Log (X : T) return T
+   is (T (Aux.Log (W (X))));
+   pragma Inline (Log);
    pragma Pure_Function (Log);
 
-   function Acos (X : Double) return Double;
-   pragma Import (Intrinsic, Acos, "acosl");
+   function Acos (X : T) return T
+   is (T (Aux.Acos (W (X))));
+   pragma Inline (Acos);
    pragma Pure_Function (Acos);
 
-   function Asin (X : Double) return Double;
-   pragma Import (Intrinsic, Asin, "asinl");
+   function Asin (X : T) return T
+   is (T (Aux.Asin (W (X))));
+   pragma Inline (Asin);
    pragma Pure_Function (Asin);
 
-   function Atan (X : Double) return Double;
-   pragma Import (Intrinsic, Atan, "atanl");
+   function Atan (X : T) return T
+   is (T (Aux.Atan (W (X))));
+   pragma Inline (Atan);
    pragma Pure_Function (Atan);
 
-   function Sinh (X : Double) return Double;
-   pragma Import (Intrinsic, Sinh, "sinhl");
+   function Sinh (X : T) return T
+   is (T (Aux.Sinh (W (X))));
+   pragma Inline (Sinh);
    pragma Pure_Function (Sinh);
 
-   function Cosh (X : Double) return Double;
-   pragma Import (Intrinsic, Cosh, "coshl");
+   function Cosh (X : T) return T
+   is (T (Aux.Cosh (W (X))));
+   pragma Inline (Cosh);
    pragma Pure_Function (Cosh);
 
-   function Tanh (X : Double) return Double;
-   pragma Import (Intrinsic, Tanh, "tanhl");
+   function Tanh (X : T) return T
+   is (T (Aux.Tanh (W (X))));
+   pragma Inline (Tanh);
    pragma Pure_Function (Tanh);
 
-   function Pow (X, Y : Double) return Double;
-   pragma Import (Intrinsic, Pow, "powl");
+   function Pow (X, Y : T) return T
+   is (T (Aux.Pow (W (X), W (Y))));
+   pragma Inline (Pow);
    pragma Pure_Function (Pow);
 
 end Ada.Numerics.Aux;


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [gcc(refs/users/aoliva/heads/testme)] revamp ada.numerics.aux
@ 2020-10-06 10:45 Alexandre Oliva
  0 siblings, 0 replies; 3+ messages in thread
From: Alexandre Oliva @ 2020-10-06 10:45 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:da5852a0740aacfde210111fd2a7f252ed9ded7b

commit da5852a0740aacfde210111fd2a7f252ed9ded7b
Author: Alexandre Oliva <oliva@adacore.com>
Date:   Fri Oct 2 06:20:17 2020 -0300

    revamp ada.numerics.aux

Diff:
---
 gcc/ada/Makefile.rtl                               |  33 ++--
 gcc/ada/libgnat/a-nallfl.ads                       | 105 ++++++++++++
 gcc/ada/libgnat/a-nallfl__nolibm.ads               | 100 +++++++++++
 gcc/ada/libgnat/a-nallfl__wraplf.ads               | 105 ++++++++++++
 gcc/ada/libgnat/a-nalofl.ads                       | 105 ++++++++++++
 gcc/ada/libgnat/a-nalofl__dummy.adb                |  32 ++++
 ...{a-numaux__vxworks.ads => a-nalofl__nolibm.ads} |  47 +++---
 .../{a-numaux__darwin.adb => a-nalofl__sincos.adb} |  56 +++----
 .../{a-numaux__darwin.ads => a-nalofl__sincos.ads} |  37 ++---
 gcc/ada/libgnat/a-nashfl.ads                       | 106 ++++++++++++
 gcc/ada/libgnat/a-nashfl__wraplf.ads               | 103 ++++++++++++
 gcc/ada/libgnat/a-ngcoty.adb                       |  34 ++--
 gcc/ada/libgnat/a-ngelfu.adb                       |  39 ++---
 gcc/ada/libgnat/a-nuaufl.ads                       | 105 ++++++++++++
 gcc/ada/libgnat/a-nuaufl__nolibm.ads               | 100 +++++++++++
 gcc/ada/libgnat/a-nuaufl__wraplf.ads               | 105 ++++++++++++
 gcc/ada/libgnat/a-nugeau.ads                       | 184 +++++++++++++++++++++
 .../libgnat/{a-numaux__dummy.adb => a-numaux.adb}  |   0
 gcc/ada/libgnat/a-numaux.ads                       | 112 ++++++-------
 gcc/ada/libgnat/a-numaux__libc-x86.ads             |  97 ++++++-----
 20 files changed, 1386 insertions(+), 219 deletions(-)

diff --git a/gcc/ada/Makefile.rtl b/gcc/ada/Makefile.rtl
index fc978a2f79e..e0b8a4466d8 100644
--- a/gcc/ada/Makefile.rtl
+++ b/gcc/ada/Makefile.rtl
@@ -234,6 +234,11 @@ GNATRTL_NONTASKING_OBJS= \
   a-nudira$(objext) \
   a-nuelfu$(objext) \
   a-nuflra$(objext) \
+  a-nugeau$(objext) \
+  a-nallfl$(objext) \
+  a-nalofl$(objext) \
+  a-nuaufl$(objext) \
+  a-nashfl$(objext) \
   a-numaux$(objext) \
   a-numeri$(objext) \
   a-nurear$(objext) \
@@ -764,6 +769,7 @@ GNATRTL_NONTASKING_OBJS= \
 # Non-tasking case:
 
 LIBGNAT_TARGET_PAIRS = \
+a-nalofl.adb<libgnat/a-nalofl__dummy.adb \
 a-intnam.ads<libgnarl/a-intnam__dummy.ads \
 s-inmaop.adb<libgnarl/s-inmaop__dummy.adb \
 s-intman.adb<libgnarl/s-intman__dummy.adb \
@@ -835,12 +841,10 @@ ATOMICS_BUILTINS_TARGET_PAIRS = \
 
 X86_TARGET_PAIRS = \
   a-numaux.ads<libgnat/a-numaux__libc-x86.ads \
-  a-numaux.adb<libgnat/a-numaux__dummy.adb \
   s-atocou.adb<libgnat/s-atocou__x86.adb
 
 X86_64_TARGET_PAIRS = \
   a-numaux.ads<libgnat/a-numaux__libc-x86.ads \
-  a-numaux.adb<libgnat/a-numaux__dummy.adb \
   s-atocou.adb<libgnat/s-atocou__builtin.adb
 
 # Implementation of symbolic traceback based on dwarf
@@ -916,7 +920,9 @@ ifeq ($(strip $(filter-out powerpc% wrs vxworks vxworksspe vxworks7% vxworks7spe
 
   LIBGNAT_TARGET_PAIRS = \
   a-intnam.ads<libgnarl/a-intnam__vxworks.ads \
-  a-numaux.ads<libgnat/a-numaux__vxworks.ads \
+  a-nalofl.ads<libgnat/a-nalofl__nolibm.ads \
+  a-nallfl.ads<libgnat/a-nallfl__nolibm.ads \
+  a-nuaufl.ads<libgnat/a-nuaufl__nolibm.ads \
   s-inmaop.adb<libgnarl/s-inmaop__vxworks.adb \
   s-intman.ads<libgnarl/s-intman__vxworks.ads \
   s-intman.adb<libgnarl/s-intman__vxworks.adb \
@@ -1039,7 +1045,9 @@ ifeq ($(strip $(filter-out powerpc% wrs vxworksae vxworksaespe,$(target_cpu) $(t
   LIBGNAT_TARGET_PAIRS = \
   a-elchha.adb<libgnat/a-elchha__vxworks-ppc-full.adb \
   a-intnam.ads<libgnarl/a-intnam__vxworks.ads \
-  a-numaux.ads<libgnat/a-numaux__vxworks.ads \
+  a-nalofl.ads<libgnat/a-nalofl__nolibm.ads \
+  a-nallfl.ads<libgnat/a-nallfl__nolibm.ads \
+  a-nuaufl.ads<libgnat/a-nuaufl__nolibm.ads \
   g-io.adb<hie/g-io__vxworks-cert.adb \
   s-inmaop.adb<libgnarl/s-inmaop__vxworks.adb \
   s-interr.adb<libgnarl/s-interr__vxworks.adb \
@@ -1095,7 +1103,9 @@ ifeq ($(strip $(filter-out %86 wrs vxworksae,$(target_cpu) $(target_vendor) $(ta
   LIBGNAT_TARGET_PAIRS = \
   a-elchha.adb<libgnat/a-elchha__vxworks-ppc-full.adb \
   a-intnam.ads<libgnarl/a-intnam__vxworks.ads \
-  a-numaux.ads<libgnat/a-numaux__vxworks.ads \
+  a-nalofl.ads<libgnat/a-nalofl__nolibm.ads \
+  a-nallfl.ads<libgnat/a-nallfl__nolibm.ads \
+  a-nuaufl.ads<libgnat/a-nuaufl__nolibm.ads \
   g-io.adb<hie/g-io__vxworks-cert.adb \
   s-inmaop.adb<libgnarl/s-inmaop__vxworks.adb \
   s-interr.adb<libgnarl/s-interr__vxworks.adb \
@@ -1314,7 +1324,9 @@ ifeq ($(strip $(filter-out aarch64 arm% coff wrs vx%,$(target_cpu) $(target_vend
 
   LIBGNAT_TARGET_PAIRS = \
   a-intnam.ads<libgnarl/a-intnam__vxworks.ads \
-  a-numaux.ads<libgnat/a-numaux__vxworks.ads \
+  a-nalofl.ads<libgnat/a-nalofl__nolibm.ads \
+  a-nallfl.ads<libgnat/a-nallfl__nolibm.ads \
+  a-nuaufl.ads<libgnat/a-nuaufl__nolibm.ads \
   s-inmaop.adb<libgnarl/s-inmaop__vxworks.adb \
   s-interr.adb<libgnarl/s-interr__vxworks.adb \
   s-intman.ads<libgnarl/s-intman__vxworks.ads \
@@ -1592,6 +1604,7 @@ endif
 ifeq ($(strip $(filter-out %86 kfreebsd%,$(target_cpu) $(target_os))),)
   LIBGNAT_TARGET_PAIRS = \
   a-intnam.ads<libgnarl/a-intnam__freebsd.ads \
+  a-numaux.ads<libgnat/a-numaux__libc-x86.ads \
   s-inmaop.adb<libgnarl/s-inmaop__posix.adb \
   s-intman.adb<libgnarl/s-intman__posix.adb \
   s-osinte.adb<libgnarl/s-osinte__posix.adb \
@@ -1648,8 +1661,6 @@ endif
 ifeq ($(strip $(filter-out x86_64 kfreebsd%,$(target_cpu) $(target_os))),)
   LIBGNAT_TARGET_PAIRS = \
   a-intnam.ads<libgnarl/a-intnam__freebsd.ads \
-  a-numaux.ads<libgnat/a-numaux__libc-x86.ads \
-  a-numaux.adb<libgnat/a-numaux__dummy.adb \
   s-inmaop.adb<libgnarl/s-inmaop__posix.adb \
   s-intman.adb<libgnarl/s-intman__posix.adb \
   s-osinte.adb<libgnarl/s-osinte__posix.adb \
@@ -2552,8 +2563,10 @@ ifeq ($(strip $(filter-out darwin%,$(target_os))),)
     LIBGNAT_TARGET_PAIRS += \
       s-intman.adb<libgnarl/s-intman__posix.adb \
       s-osprim.adb<libgnat/s-osprim__posix.adb \
-      a-numaux.ads<libgnat/a-numaux__darwin.ads \
-      a-numaux.adb<libgnat/a-numaux__darwin.adb \
+      a-nalofl.ads<libgnat/a-nalofl__sincos.ads \
+      a-nallfl.ads<libgnat/a-nallfl__wraplf.ads \
+      a-nuaufl.ads<libgnat/a-nuaufl__wraplf.ads \
+      a-nashfl.ads<libgnat/a-nashfl__wraplf.ads \
       $(ATOMICS_TARGET_PAIRS) \
       $(ATOMICS_BUILTINS_TARGET_PAIRS) \
       system.ads<libgnat/system-darwin-ppc.ads
diff --git a/gcc/ada/libgnat/a-nallfl.ads b/gcc/ada/libgnat/a-nallfl.ads
new file mode 100644
index 00000000000..d6d322134db
--- /dev/null
+++ b/gcc/ada/libgnat/a-nallfl.ads
@@ -0,0 +1,105 @@
+------------------------------------------------------------------------------
+--                                                                          --
+--                         GNAT RUN-TIME COMPONENTS                         --
+--                                                                          --
+--     A D A . N U M E R I C S . A U X _ L O N G _ L O N G _ F L O A T      --
+--                                                                          --
+--                                 S p e c                                  --
+--                  (C Math Library Version, Long Long Float)               --
+--                                                                          --
+--          Copyright (C) 1992-2020, Free Software Foundation, Inc.         --
+--                                                                          --
+-- GNAT is free software;  you can  redistribute it  and/or modify it under --
+-- terms of the  GNU General Public License as published  by the Free Soft- --
+-- ware  Foundation;  either version 3,  or (at your option) any later ver- --
+-- sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE.                                     --
+--                                                                          --
+-- As a special exception under Section 7 of GPL version 3, you are granted --
+-- additional permissions described in the GCC Runtime Library Exception,   --
+-- version 3.1, as published by the Free Software Foundation.               --
+--                                                                          --
+-- You should have received a copy of the GNU General Public License and    --
+-- a copy of the GCC Runtime Library Exception along with this program;     --
+-- see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see    --
+-- <http://www.gnu.org/licenses/>.                                          --
+--                                                                          --
+-- GNAT was originally developed  by the GNAT team at  New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc.      --
+--                                                                          --
+------------------------------------------------------------------------------
+
+--  This package provides the basic computational interface for the generic
+--  elementary functions. The C library version interfaces with the routines
+--  in the C mathematical library, and is thus quite portable.
+
+--  This version here is for use with normal Unix math functions, from
+--  libm. Alternative versions are provided for special situations:
+
+--    a-nallfl__wraplf    For use where long double intrinsics are missing
+--    a-nallfl__nolibm    For use on VxWorks (where we have no libm.a library)
+
+package Ada.Numerics.Aux_Long_Long_Float is
+   pragma Pure;
+
+   subtype T is Long_Long_Float;
+
+   pragma Linker_Options ("-lm");
+
+   --  We import these functions directly from C. Note that we label them
+   --  all as pure functions, because indeed all of them are in fact pure.
+
+   function Sin (X : T) return T;
+   pragma Import (Intrinsic, Sin, "sinl");
+   pragma Pure_Function (Sin);
+
+   function Cos (X : T) return T;
+   pragma Import (Intrinsic, Cos, "cosl");
+   pragma Pure_Function (Cos);
+
+   function Tan (X : T) return T;
+   pragma Import (Intrinsic, Tan, "tanl");
+   pragma Pure_Function (Tan);
+
+   function Exp (X : T) return T;
+   pragma Import (Intrinsic, Exp, "expl");
+   pragma Pure_Function (Exp);
+
+   function Sqrt (X : T) return T;
+   pragma Import (Intrinsic, Sqrt, "sqrtl");
+   pragma Pure_Function (Sqrt);
+
+   function Log (X : T) return T;
+   pragma Import (Intrinsic, Log, "logl");
+   pragma Pure_Function (Log);
+
+   function Acos (X : T) return T;
+   pragma Import (Intrinsic, Acos, "acosl");
+   pragma Pure_Function (Acos);
+
+   function Asin (X : T) return T;
+   pragma Import (Intrinsic, Asin, "asinl");
+   pragma Pure_Function (Asin);
+
+   function Atan (X : T) return T;
+   pragma Import (Intrinsic, Atan, "atanl");
+   pragma Pure_Function (Atan);
+
+   function Sinh (X : T) return T;
+   pragma Import (Intrinsic, Sinh, "sinhl");
+   pragma Pure_Function (Sinh);
+
+   function Cosh (X : T) return T;
+   pragma Import (Intrinsic, Cosh, "coshl");
+   pragma Pure_Function (Cosh);
+
+   function Tanh (X : T) return T;
+   pragma Import (Intrinsic, Tanh, "tanhl");
+   pragma Pure_Function (Tanh);
+
+   function Pow (X, Y : T) return T;
+   pragma Import (Intrinsic, Pow, "powl");
+   pragma Pure_Function (Pow);
+
+end Ada.Numerics.Aux_Long_Long_Float;
diff --git a/gcc/ada/libgnat/a-nallfl__nolibm.ads b/gcc/ada/libgnat/a-nallfl__nolibm.ads
new file mode 100644
index 00000000000..6677211f661
--- /dev/null
+++ b/gcc/ada/libgnat/a-nallfl__nolibm.ads
@@ -0,0 +1,100 @@
+------------------------------------------------------------------------------
+--                                                                          --
+--                         GNAT RUN-TIME COMPONENTS                         --
+--                                                                          --
+--     A D A . N U M E R I C S . A U X _ L O N G _ L O N G _ F L O A T      --
+--                                                                          --
+--                                 S p e c                                  --
+--                    (C Library Version, Long Long Float)                  --
+--                                                                          --
+--          Copyright (C) 1992-2020, Free Software Foundation, Inc.         --
+--                                                                          --
+-- GNAT is free software;  you can  redistribute it  and/or modify it under --
+-- terms of the  GNU General Public License as published  by the Free Soft- --
+-- ware  Foundation;  either version 3,  or (at your option) any later ver- --
+-- sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE.                                     --
+--                                                                          --
+-- As a special exception under Section 7 of GPL version 3, you are granted --
+-- additional permissions described in the GCC Runtime Library Exception,   --
+-- version 3.1, as published by the Free Software Foundation.               --
+--                                                                          --
+-- You should have received a copy of the GNU General Public License and    --
+-- a copy of the GCC Runtime Library Exception along with this program;     --
+-- see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see    --
+-- <http://www.gnu.org/licenses/>.                                          --
+--                                                                          --
+-- GNAT was originally developed  by the GNAT team at  New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc.      --
+--                                                                          --
+------------------------------------------------------------------------------
+
+--  This package provides the basic computational interface for the generic
+--  elementary functions. The C library version interfaces with the routines
+--  in the C mathematical library, and is thus quite portable.
+
+--  This version here is for use with normal Unix math functions, from
+--  libc, not libm.
+
+package Ada.Numerics.Aux_Long_Long_Float is
+   pragma Pure;
+
+   subtype T is Long_Long_Float;
+
+   --  We import these functions directly from C. Note that we label them
+   --  all as pure functions, because indeed all of them are in fact pure.
+
+   function Sin (X : T) return T;
+   pragma Import (Intrinsic, Sin, "sinl");
+   pragma Pure_Function (Sin);
+
+   function Cos (X : T) return T;
+   pragma Import (Intrinsic, Cos, "cosl");
+   pragma Pure_Function (Cos);
+
+   function Tan (X : T) return T;
+   pragma Import (Intrinsic, Tan, "tanl");
+   pragma Pure_Function (Tan);
+
+   function Exp (X : T) return T;
+   pragma Import (Intrinsic, Exp, "expl");
+   pragma Pure_Function (Exp);
+
+   function Sqrt (X : T) return T;
+   pragma Import (Intrinsic, Sqrt, "sqrtl");
+   pragma Pure_Function (Sqrt);
+
+   function Log (X : T) return T;
+   pragma Import (Intrinsic, Log, "logl");
+   pragma Pure_Function (Log);
+
+   function Acos (X : T) return T;
+   pragma Import (Intrinsic, Acos, "acosl");
+   pragma Pure_Function (Acos);
+
+   function Asin (X : T) return T;
+   pragma Import (Intrinsic, Asin, "asinl");
+   pragma Pure_Function (Asin);
+
+   function Atan (X : T) return T;
+   pragma Import (Intrinsic, Atan, "atanl");
+   pragma Pure_Function (Atan);
+
+   function Sinh (X : T) return T;
+   pragma Import (Intrinsic, Sinh, "sinhl");
+   pragma Pure_Function (Sinh);
+
+   function Cosh (X : T) return T;
+   pragma Import (Intrinsic, Cosh, "coshl");
+   pragma Pure_Function (Cosh);
+
+   function Tanh (X : T) return T;
+   pragma Import (Intrinsic, Tanh, "tanhl");
+   pragma Pure_Function (Tanh);
+
+   function Pow (X, Y : T) return T;
+   pragma Import (Intrinsic, Pow, "powl");
+   pragma Pure_Function (Pow);
+
+end Ada.Numerics.Aux_Long_Long_Float;
diff --git a/gcc/ada/libgnat/a-nallfl__wraplf.ads b/gcc/ada/libgnat/a-nallfl__wraplf.ads
new file mode 100644
index 00000000000..e075e792747
--- /dev/null
+++ b/gcc/ada/libgnat/a-nallfl__wraplf.ads
@@ -0,0 +1,105 @@
+------------------------------------------------------------------------------
+--                                                                          --
+--                         GNAT RUN-TIME COMPONENTS                         --
+--                                                                          --
+--     A D A . N U M E R I C S . A U X _ L O N G _ L O N G _ F L O A T      --
+--                                                                          --
+--                                 S p e c                                  --
+--              (Long Long Float Wrapper in terms of Long Float)            --
+--                                                                          --
+--          Copyright (C) 1992-2020, Free Software Foundation, Inc.         --
+--                                                                          --
+-- GNAT is free software;  you can  redistribute it  and/or modify it under --
+-- terms of the  GNU General Public License as published  by the Free Soft- --
+-- ware  Foundation;  either version 3,  or (at your option) any later ver- --
+-- sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE.                                     --
+--                                                                          --
+-- As a special exception under Section 7 of GPL version 3, you are granted --
+-- additional permissions described in the GCC Runtime Library Exception,   --
+-- version 3.1, as published by the Free Software Foundation.               --
+--                                                                          --
+-- You should have received a copy of the GNU General Public License and    --
+-- a copy of the GCC Runtime Library Exception along with this program;     --
+-- see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see    --
+-- <http://www.gnu.org/licenses/>.                                          --
+--                                                                          --
+-- GNAT was originally developed  by the GNAT team at  New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc.      --
+--                                                                          --
+------------------------------------------------------------------------------
+
+--  This package provides the basic computational interface for the generic
+--  elementary functions. The C library version interfaces with the routines
+--  in the C mathematical library, and is thus quite portable.
+
+--  This version here is for use when long double functions are not
+--  present in the C library, so we use the double ones instead.
+
+with Ada.Numerics.Aux_Long_Float;
+
+package Ada.Numerics.Aux_Long_Long_Float is
+   pragma Pure;
+
+   subtype T is Long_Long_Float;
+
+   package Aux renames Aux_Long_Float;
+
+   subtype W is Aux.T;
+   
+   --  Use the Aux implementation.
+
+   function Sin (X : T) return T
+   is (T (Aux.Sin (W (X))));
+   pragma Inline (Sin);
+
+   function Cos (X : T) return T
+   is (T (Aux.Cos (W (X))));
+   pragma Inline (Cos);
+
+   function Tan (X : T) return T
+   is (T (Aux.Tan (W (X))));
+   pragma Inline (Tan);
+
+   function Exp (X : T) return T
+   is (T (Aux.Exp (W (X))));
+   pragma Inline (Exp);
+
+   function Sqrt (X : T) return T
+   is (T (Aux.Sqrt (W (X))));
+   pragma Inline (Sqrt);
+
+   function Log (X : T) return T
+   is (T (Aux.Log (W (X))));
+   pragma Inline (Log);
+
+   function Acos (X : T) return T
+   is (T (Aux.Acos (W (X))));
+   pragma Inline (Acos);
+
+   function Asin (X : T) return T
+   is (T (Aux.Asin (W (X))));
+   pragma Inline (Asin);
+
+   function Atan (X : T) return T
+   is (T (Aux.Atan (W (X))));
+   pragma Inline (Atan);
+
+   function Sinh (X : T) return T
+   is (T (Aux.Sinh (W (X))));
+   pragma Inline (Sinh);
+
+   function Cosh (X : T) return T
+   is (T (Aux.Cosh (W (X))));
+   pragma Inline (Cosh);
+
+   function Tanh (X : T) return T
+   is (T (Aux.Tanh (W (X))));
+   pragma Inline (Tanh);
+
+   function Pow (X, Y : T) return T
+   is (T (Aux.Pow (W (X), W (Y))));
+   pragma Inline (Pow);
+   
+end Ada.Numerics.Aux_Long_Long_Float;
diff --git a/gcc/ada/libgnat/a-nalofl.ads b/gcc/ada/libgnat/a-nalofl.ads
new file mode 100644
index 00000000000..4e0d7012409
--- /dev/null
+++ b/gcc/ada/libgnat/a-nalofl.ads
@@ -0,0 +1,105 @@
+------------------------------------------------------------------------------
+--                                                                          --
+--                         GNAT RUN-TIME COMPONENTS                         --
+--                                                                          --
+--          A D A . N U M E R I C S . A U X _ L O N G _ F L O A T           --
+--                                                                          --
+--                                 S p e c                                  --
+--                     (C Math Library Version, Long Float)                 --
+--                                                                          --
+--          Copyright (C) 1992-2020, Free Software Foundation, Inc.         --
+--                                                                          --
+-- GNAT is free software;  you can  redistribute it  and/or modify it under --
+-- terms of the  GNU General Public License as published  by the Free Soft- --
+-- ware  Foundation;  either version 3,  or (at your option) any later ver- --
+-- sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE.                                     --
+--                                                                          --
+-- As a special exception under Section 7 of GPL version 3, you are granted --
+-- additional permissions described in the GCC Runtime Library Exception,   --
+-- version 3.1, as published by the Free Software Foundation.               --
+--                                                                          --
+-- You should have received a copy of the GNU General Public License and    --
+-- a copy of the GCC Runtime Library Exception along with this program;     --
+-- see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see    --
+-- <http://www.gnu.org/licenses/>.                                          --
+--                                                                          --
+-- GNAT was originally developed  by the GNAT team at  New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc.      --
+--                                                                          --
+------------------------------------------------------------------------------
+
+--  This package provides the basic computational interface for the generic
+--  elementary functions. The C library version interfaces with the routines
+--  in the C mathematical library, and is thus quite portable.
+
+--  This version here is for use with normal Unix math functions, from
+--  libm. Alternative versions are provided for special situations:
+
+--    a-nalofl__nolibm    For use on VxWorks (where we have no libm.a library)
+--    a-nalofl__sincos    For use on Mac OS X (inaccurate sin and cos in libc)
+
+package Ada.Numerics.Aux_Long_Float is
+   pragma Pure;
+
+   subtype T is Long_Float;
+
+   pragma Linker_Options ("-lm");
+
+   --  We import these functions directly from C. Note that we label them
+   --  all as pure functions, because indeed all of them are in fact pure.
+
+   function Sin (X : T) return T;
+   pragma Import (Intrinsic, Sin, "sin");
+   pragma Pure_Function (Sin);
+
+   function Cos (X : T) return T;
+   pragma Import (Intrinsic, Cos, "cos");
+   pragma Pure_Function (Cos);
+
+   function Tan (X : T) return T;
+   pragma Import (Intrinsic, Tan, "tan");
+   pragma Pure_Function (Tan);
+
+   function Exp (X : T) return T;
+   pragma Import (Intrinsic, Exp, "exp");
+   pragma Pure_Function (Exp);
+
+   function Sqrt (X : T) return T;
+   pragma Import (Intrinsic, Sqrt, "sqrt");
+   pragma Pure_Function (Sqrt);
+
+   function Log (X : T) return T;
+   pragma Import (Intrinsic, Log, "log");
+   pragma Pure_Function (Log);
+
+   function Acos (X : T) return T;
+   pragma Import (Intrinsic, Acos, "acos");
+   pragma Pure_Function (Acos);
+
+   function Asin (X : T) return T;
+   pragma Import (Intrinsic, Asin, "asin");
+   pragma Pure_Function (Asin);
+
+   function Atan (X : T) return T;
+   pragma Import (Intrinsic, Atan, "atan");
+   pragma Pure_Function (Atan);
+
+   function Sinh (X : T) return T;
+   pragma Import (Intrinsic, Sinh, "sinh");
+   pragma Pure_Function (Sinh);
+
+   function Cosh (X : T) return T;
+   pragma Import (Intrinsic, Cosh, "cosh");
+   pragma Pure_Function (Cosh);
+
+   function Tanh (X : T) return T;
+   pragma Import (Intrinsic, Tanh, "tanh");
+   pragma Pure_Function (Tanh);
+
+   function Pow (X, Y : T) return T;
+   pragma Import (Intrinsic, Pow, "pow");
+   pragma Pure_Function (Pow);
+
+end Ada.Numerics.Aux_Long_Float;
diff --git a/gcc/ada/libgnat/a-nalofl__dummy.adb b/gcc/ada/libgnat/a-nalofl__dummy.adb
new file mode 100644
index 00000000000..def7d72d237
--- /dev/null
+++ b/gcc/ada/libgnat/a-nalofl__dummy.adb
@@ -0,0 +1,32 @@
+------------------------------------------------------------------------------
+--                                                                          --
+--                         GNAT RUN-TIME COMPONENTS                         --
+--                                                                          --
+--          A D A . N U M E R I C S . A U X _ L O N G _ F L O A T           --
+--                                                                          --
+--                                 B o d y                                  --
+--                                                                          --
+--          Copyright (C) 1992-2020, Free Software Foundation, Inc.         --
+--                                                                          --
+-- GNAT is free software;  you can  redistribute it  and/or modify it under --
+-- terms of the  GNU General Public License as published  by the Free Soft- --
+-- ware  Foundation;  either version 3,  or (at your option) any later ver- --
+-- sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE.                                     --
+--                                                                          --
+-- As a special exception under Section 7 of GPL version 3, you are granted --
+-- additional permissions described in the GCC Runtime Library Exception,   --
+-- version 3.1, as published by the Free Software Foundation.               --
+--                                                                          --
+-- You should have received a copy of the GNU General Public License and    --
+-- a copy of the GCC Runtime Library Exception along with this program;     --
+-- see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see    --
+-- <http://www.gnu.org/licenses/>.                                          --
+--                                                                          --
+-- GNAT was originally developed  by the GNAT team at  New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc.      --
+--                                                                          --
+------------------------------------------------------------------------------
+
+pragma No_Body;
diff --git a/gcc/ada/libgnat/a-numaux__vxworks.ads b/gcc/ada/libgnat/a-nalofl__nolibm.ads
similarity index 75%
rename from gcc/ada/libgnat/a-numaux__vxworks.ads
rename to gcc/ada/libgnat/a-nalofl__nolibm.ads
index 410655de8a6..d7bdd517e5d 100644
--- a/gcc/ada/libgnat/a-numaux__vxworks.ads
+++ b/gcc/ada/libgnat/a-nalofl__nolibm.ads
@@ -2,10 +2,10 @@
 --                                                                          --
 --                         GNAT RUN-TIME COMPONENTS                         --
 --                                                                          --
---                     A D A . N U M E R I C S . A U X                      --
+--          A D A . N U M E R I C S . A U X _ L O N G _ F L O A T           --
 --                                                                          --
 --                                 S p e c                                  --
---                       (C Library Version, VxWorks)                       --
+--                       (C Library Version, Long Float)                    --
 --                                                                          --
 --          Copyright (C) 1992-2020, Free Software Foundation, Inc.         --
 --                                                                          --
@@ -30,68 +30,73 @@
 --                                                                          --
 ------------------------------------------------------------------------------
 
---  Version for use on VxWorks (where we have no libm.a library), so the pragma
---  Linker_Options ("-lm") is omitted in this version.
+--  This package provides the basic computational interface for the generic
+--  elementary functions. The C library version interfaces with the routines
+--  in the C mathematical library, and is thus quite portable.
 
-package Ada.Numerics.Aux is
+--  This version here is for use with normal Unix math functions, from
+--  libc. Alternative versions are provided for special situations:
+
+--    a-nmaxlf__nolibm   For use on VxWorks (where we have no libm.a library)
+
+package Ada.Numerics.Aux_Long_Float is
    pragma Pure;
 
-   type Double is new Long_Float;
-   --  Type Double is the type used to call the C routines
+   subtype T is Long_Float;
 
    --  We import these functions directly from C. Note that we label them
    --  all as pure functions, because indeed all of them are in fact pure.
 
-   function Sin (X : Double) return Double;
+   function Sin (X : T) return T;
    pragma Import (Intrinsic, Sin, "sin");
    pragma Pure_Function (Sin);
 
-   function Cos (X : Double) return Double;
+   function Cos (X : T) return T;
    pragma Import (Intrinsic, Cos, "cos");
    pragma Pure_Function (Cos);
 
-   function Tan (X : Double) return Double;
+   function Tan (X : T) return T;
    pragma Import (Intrinsic, Tan, "tan");
    pragma Pure_Function (Tan);
 
-   function Exp (X : Double) return Double;
+   function Exp (X : T) return T;
    pragma Import (Intrinsic, Exp, "exp");
    pragma Pure_Function (Exp);
 
-   function Sqrt (X : Double) return Double;
+   function Sqrt (X : T) return T;
    pragma Import (Intrinsic, Sqrt, "sqrt");
    pragma Pure_Function (Sqrt);
 
-   function Log (X : Double) return Double;
+   function Log (X : T) return T;
    pragma Import (Intrinsic, Log, "log");
    pragma Pure_Function (Log);
 
-   function Acos (X : Double) return Double;
+   function Acos (X : T) return T;
    pragma Import (Intrinsic, Acos, "acos");
    pragma Pure_Function (Acos);
 
-   function Asin (X : Double) return Double;
+   function Asin (X : T) return T;
    pragma Import (Intrinsic, Asin, "asin");
    pragma Pure_Function (Asin);
 
-   function Atan (X : Double) return Double;
+   function Atan (X : T) return T;
    pragma Import (Intrinsic, Atan, "atan");
    pragma Pure_Function (Atan);
 
-   function Sinh (X : Double) return Double;
+   function Sinh (X : T) return T;
    pragma Import (Intrinsic, Sinh, "sinh");
    pragma Pure_Function (Sinh);
 
-   function Cosh (X : Double) return Double;
+   function Cosh (X : T) return T;
    pragma Import (Intrinsic, Cosh, "cosh");
    pragma Pure_Function (Cosh);
 
-   function Tanh (X : Double) return Double;
+   function Tanh (X : T) return T;
    pragma Import (Intrinsic, Tanh, "tanh");
    pragma Pure_Function (Tanh);
 
-   function Pow (X, Y : Double) return Double;
+   function Pow (X, Y : T) return T;
    pragma Import (Intrinsic, Pow, "pow");
    pragma Pure_Function (Pow);
 
-end Ada.Numerics.Aux;
+end Ada.Numerics.Aux_Long_Float;
diff --git a/gcc/ada/libgnat/a-numaux__darwin.adb b/gcc/ada/libgnat/a-nalofl__sincos.adb
similarity index 81%
rename from gcc/ada/libgnat/a-numaux__darwin.adb
rename to gcc/ada/libgnat/a-nalofl__sincos.adb
index 85fdd2468b5..58cda134fde 100644
--- a/gcc/ada/libgnat/a-numaux__darwin.adb
+++ b/gcc/ada/libgnat/a-nalofl__sincos.adb
@@ -2,7 +2,7 @@
 --                                                                          --
 --                         GNAT RUN-TIME COMPONENTS                         --
 --                                                                          --
---                     A D A . N U M E R I C S . A U X                      --
+--          A D A . N U M E R I C S . A U X _ L O N G _ F L O A T           --
 --                                                                          --
 --                                 B o d y                                  --
 --                          (Apple OS X Version)                            --
@@ -30,16 +30,16 @@
 --                                                                          --
 ------------------------------------------------------------------------------
 
-package body Ada.Numerics.Aux is
+package body Ada.Numerics.Aux.LF is
 
    -----------------------
    -- Local subprograms --
    -----------------------
 
-   function Is_Nan (X : Double) return Boolean;
+   function Is_Nan (X : T) return Boolean;
    --  Return True iff X is a IEEE NaN value
 
-   procedure Reduce (X : in out Double; Q : out Natural);
+   procedure Reduce (X : in out T; Q : out Natural);
    --  Implement reduction of X by Pi/2. Q is the quadrant of the final
    --  result in the range 0..3. The absolute value of X is at most Pi/4.
    --  It is needed to avoid a loss of accuracy for sin near Pi and cos
@@ -50,8 +50,8 @@ package body Ada.Numerics.Aux is
    --  of the trigonometric functions in their reduced domain.
    --  These approximations have been computed using Maple.
 
-   function Sine_Approx (X : Double) return Double;
-   function Cosine_Approx (X : Double) return Double;
+   function Sine_Approx (X : T) return T;
+   function Cosine_Approx (X : T) return T;
 
    pragma Inline (Reduce);
    pragma Inline (Sine_Approx);
@@ -61,8 +61,8 @@ package body Ada.Numerics.Aux is
    -- Cosine_Approx --
    -------------------
 
-   function Cosine_Approx (X : Double) return Double is
-      XX : constant Double := X * X;
+   function Cosine_Approx (X : T) return T is
+      XX : constant T := X * X;
    begin
       return (((((16#8.DC57FBD05F640#E-08 * XX
               - 16#4.9F7D00BF25D80#E-06) * XX
@@ -77,8 +77,8 @@ package body Ada.Numerics.Aux is
    -- Sine_Approx --
    -----------------
 
-   function Sine_Approx (X : Double) return Double is
-      XX : constant Double := X * X;
+   function Sine_Approx (X : T) return T is
+      XX : constant T := X * X;
    begin
       return (((((16#A.EA2D4ABE41808#E-09 * XX
               - 16#6.B974C10F9D078#E-07) * XX
@@ -92,7 +92,7 @@ package body Ada.Numerics.Aux is
    -- Is_Nan --
    ------------
 
-   function Is_Nan (X : Double) return Boolean is
+   function Is_Nan (X : T) return Boolean is
    begin
       --  The IEEE NaN values are the only ones that do not equal themselves
 
@@ -103,20 +103,20 @@ package body Ada.Numerics.Aux is
    -- Reduce --
    ------------
 
-   procedure Reduce (X : in out Double; Q : out Natural) is
+   procedure Reduce (X : in out T; Q : out Natural) is
       Half_Pi     : constant := Pi / 2.0;
       Two_Over_Pi : constant := 2.0 / Pi;
 
-      HM : constant := Integer'Min (Double'Machine_Mantissa / 2, Natural'Size);
-      M  : constant Double := 0.5 + 2.0**(1 - HM); -- Splitting constant
-      P1 : constant Double := Double'Leading_Part (Half_Pi, HM);
-      P2 : constant Double := Double'Leading_Part (Half_Pi - P1, HM);
-      P3 : constant Double := Double'Leading_Part (Half_Pi - P1 - P2, HM);
-      P4 : constant Double := Double'Leading_Part (Half_Pi - P1 - P2 - P3, HM);
-      P5 : constant Double := Double'Leading_Part (Half_Pi - P1 - P2 - P3
+      HM : constant := Integer'Min (T'Machine_Mantissa / 2, Natural'Size);
+      M  : constant T := 0.5 + 2.0**(1 - HM); -- Splitting constant
+      P1 : constant T := T'Leading_Part (Half_Pi, HM);
+      P2 : constant T := T'Leading_Part (Half_Pi - P1, HM);
+      P3 : constant T := T'Leading_Part (Half_Pi - P1 - P2, HM);
+      P4 : constant T := T'Leading_Part (Half_Pi - P1 - P2 - P3, HM);
+      P5 : constant T := T'Leading_Part (Half_Pi - P1 - P2 - P3
                                                                  - P4, HM);
-      P6 : constant Double := Double'Model (Half_Pi - P1 - P2 - P3 - P4 - P5);
-      K  : Double;
+      P6 : constant T := T'Model (Half_Pi - P1 - P2 - P3 - P4 - P5);
+      K  : T;
       R  : Integer;
 
    begin
@@ -142,9 +142,9 @@ package body Ada.Numerics.Aux is
 
       --  Go through an integer temporary so as to use machine instructions
 
-      R := Integer (Double'Rounding (K));
+      R := Integer (T'Rounding (K));
       Q := R mod 4;
-      K := Double (R);
+      K := T (R);
       X := (((((X - K * P1) - K * P2) - K * P3) - K * P4) - K * P5) - K * P6;
    end Reduce;
 
@@ -152,8 +152,8 @@ package body Ada.Numerics.Aux is
    -- Cos --
    ---------
 
-   function Cos (X : Double) return Double is
-      Reduced_X : Double := abs X;
+   function Cos (X : T) return T is
+      Reduced_X : T := abs X;
       Quadrant  : Natural range 0 .. 3;
 
    begin
@@ -182,8 +182,8 @@ package body Ada.Numerics.Aux is
    -- Sin --
    ---------
 
-   function Sin (X : Double) return Double is
-      Reduced_X : Double := X;
+   function Sin (X : T) return T is
+      Reduced_X : T := X;
       Quadrant  : Natural range 0 .. 3;
 
    begin
@@ -208,4 +208,4 @@ package body Ada.Numerics.Aux is
       return Sine_Approx (Reduced_X);
    end Sin;
 
-end Ada.Numerics.Aux;
+end Ada.Numerics.Aux.LF;
diff --git a/gcc/ada/libgnat/a-numaux__darwin.ads b/gcc/ada/libgnat/a-nalofl__sincos.ads
similarity index 83%
rename from gcc/ada/libgnat/a-numaux__darwin.ads
rename to gcc/ada/libgnat/a-nalofl__sincos.ads
index add87a49193..7e46a79074c 100644
--- a/gcc/ada/libgnat/a-numaux__darwin.ads
+++ b/gcc/ada/libgnat/a-nalofl__sincos.ads
@@ -2,7 +2,7 @@
 --                                                                          --
 --                         GNAT RUN-TIME COMPONENTS                         --
 --                                                                          --
---                     A D A . N U M E R I C S . A U X                      --
+--          A D A . N U M E R I C S . A U X _ L O N G _ F L O A T           --
 --                                                                          --
 --                                 S p e c                                  --
 --                          (Apple OS X Version)                            --
@@ -34,70 +34,69 @@
 --  except for sine/cosine which have been implemented directly in Ada to get
 --  the required accuracy.
 
-package Ada.Numerics.Aux is
+package Ada.Numerics.Aux_Long_Float is
    pragma Pure;
 
-   pragma Linker_Options ("-lm");
+   subtype T is Long_Float;
 
-   type Double is new Long_Float;
-   --  Type Double is the type used to call the C routines
+   pragma Linker_Options ("-lm");
 
    --  The following functions have been implemented in Ada, since
    --  the OS X math library didn't meet accuracy requirements for
    --  argument reduction. The implementation here has been tailored
    --  to match Ada strict mode Numerics requirements while maintaining
    --  maximum efficiency.
-   function Sin (X : Double) return Double;
+   function Sin (X : T) return T;
    pragma Inline (Sin);
 
-   function Cos (X : Double) return Double;
+   function Cos (X : T) return T;
    pragma Inline (Cos);
 
    --  We import these functions directly from C. Note that we label them
    --  all as pure functions, because indeed all of them are in fact pure.
 
-   function Tan (X : Double) return Double;
+   function Tan (X : T) return T;
    pragma Import (Intrinsic, Tan, "tan");
    pragma Pure_Function (Tan);
 
-   function Exp (X : Double) return Double;
+   function Exp (X : T) return T;
    pragma Import (Intrinsic, Exp, "exp");
    pragma Pure_Function (Exp);
 
-   function Sqrt (X : Double) return Double;
+   function Sqrt (X : T) return T;
    pragma Import (Intrinsic, Sqrt, "sqrt");
    pragma Pure_Function (Sqrt);
 
-   function Log (X : Double) return Double;
+   function Log (X : T) return T;
    pragma Import (Intrinsic, Log, "log");
    pragma Pure_Function (Log);
 
-   function Acos (X : Double) return Double;
+   function Acos (X : T) return T;
    pragma Import (Intrinsic, Acos, "acos");
    pragma Pure_Function (Acos);
 
-   function Asin (X : Double) return Double;
+   function Asin (X : T) return T;
    pragma Import (Intrinsic, Asin, "asin");
    pragma Pure_Function (Asin);
 
-   function Atan (X : Double) return Double;
+   function Atan (X : T) return T;
    pragma Import (Intrinsic, Atan, "atan");
    pragma Pure_Function (Atan);
 
-   function Sinh (X : Double) return Double;
+   function Sinh (X : T) return T;
    pragma Import (Intrinsic, Sinh, "sinh");
    pragma Pure_Function (Sinh);
 
-   function Cosh (X : Double) return Double;
+   function Cosh (X : T) return T;
    pragma Import (Intrinsic, Cosh, "cosh");
    pragma Pure_Function (Cosh);
 
-   function Tanh (X : Double) return Double;
+   function Tanh (X : T) return T;
    pragma Import (Intrinsic, Tanh, "tanh");
    pragma Pure_Function (Tanh);
 
-   function Pow (X, Y : Double) return Double;
+   function Pow (X, Y : T) return T;
    pragma Import (Intrinsic, Pow, "pow");
    pragma Pure_Function (Pow);
 
-end Ada.Numerics.Aux;
+end Ada.Numerics.Aux_Long_Float;
diff --git a/gcc/ada/libgnat/a-nashfl.ads b/gcc/ada/libgnat/a-nashfl.ads
new file mode 100644
index 00000000000..00cfad05c31
--- /dev/null
+++ b/gcc/ada/libgnat/a-nashfl.ads
@@ -0,0 +1,106 @@
+------------------------------------------------------------------------------
+--                                                                          --
+--                         GNAT RUN-TIME COMPONENTS                         --
+--                                                                          --
+--         A D A . N U M E R I C S . A U X _ S H O R T _ F L O A T          --
+--                                                                          --
+--                                 S p e c                                  --
+--                  (Short Float Wrapper in terms of Float)                 --
+--                                                                          --
+--          Copyright (C) 1992-2020, Free Software Foundation, Inc.         --
+--                                                                          --
+-- GNAT is free software;  you can  redistribute it  and/or modify it under --
+-- terms of the  GNU General Public License as published  by the Free Soft- --
+-- ware  Foundation;  either version 3,  or (at your option) any later ver- --
+-- sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE.                                     --
+--                                                                          --
+-- As a special exception under Section 7 of GPL version 3, you are granted --
+-- additional permissions described in the GCC Runtime Library Exception,   --
+-- version 3.1, as published by the Free Software Foundation.               --
+--                                                                          --
+-- You should have received a copy of the GNU General Public License and    --
+-- a copy of the GCC Runtime Library Exception along with this program;     --
+-- see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see    --
+-- <http://www.gnu.org/licenses/>.                                          --
+--                                                                          --
+-- GNAT was originally developed  by the GNAT team at  New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc.      --
+--                                                                          --
+------------------------------------------------------------------------------
+
+--  This package provides the basic computational interface for the generic
+--  elementary functions. The C library version interfaces with the routines
+--  in the C mathematical library, and is thus quite portable.
+
+--  This version here is for use when Short Float functions are not
+--  present in the C library, but Float ones are. Alternative versions
+--  are provided for special situations:
+
+--    a-nashfl__wraplf    For use where float intrinsics are missing
+
+with Ada.Numerics.Aux_Float;
+
+package Ada.Numerics.Aux_Short_Float is
+   pragma Pure;
+
+   subtype T is Short_Float;
+   package Aux renames Aux_Float;
+   subtype W is Aux.T;
+
+   --  Use the Aux implementation.
+
+   function Sin (X : T) return T
+   is (T (Aux.Sin (W (X))));
+   pragma Inline (Sin);
+
+   function Cos (X : T) return T
+   is (T (Aux.Cos (W (X))));
+   pragma Inline (Cos);
+
+   function Tan (X : T) return T
+   is (T (Aux.Tan (W (X))));
+   pragma Inline (Tan);
+
+   function Exp (X : T) return T
+   is (T (Aux.Exp (W (X))));
+   pragma Inline (Exp);
+
+   function Sqrt (X : T) return T
+   is (T (Aux.Sqrt (W (X))));
+   pragma Inline (Sqrt);
+
+   function Log (X : T) return T
+   is (T (Aux.Log (W (X))));
+   pragma Inline (Log);
+
+   function Acos (X : T) return T
+   is (T (Aux.Acos (W (X))));
+   pragma Inline (Acos);
+
+   function Asin (X : T) return T
+   is (T (Aux.Asin (W (X))));
+   pragma Inline (Asin);
+
+   function Atan (X : T) return T
+   is (T (Aux.Atan (W (X))));
+   pragma Inline (Atan);
+
+   function Sinh (X : T) return T
+   is (T (Aux.Sinh (W (X))));
+   pragma Inline (Sinh);
+
+   function Cosh (X : T) return T
+   is (T (Aux.Cosh (W (X))));
+   pragma Inline (Cosh);
+
+   function Tanh (X : T) return T
+   is (T (Aux.Tanh (W (X))));
+   pragma Inline (Tanh);
+
+   function Pow (X, Y : T) return T
+   is (T (Aux.Pow (W (X), W (Y))));
+   pragma Inline (Pow);
+
+end Ada.Numerics.Aux_Short_Float;
diff --git a/gcc/ada/libgnat/a-nashfl__wraplf.ads b/gcc/ada/libgnat/a-nashfl__wraplf.ads
new file mode 100644
index 00000000000..bebd809ad8c
--- /dev/null
+++ b/gcc/ada/libgnat/a-nashfl__wraplf.ads
@@ -0,0 +1,103 @@
+------------------------------------------------------------------------------
+--                                                                          --
+--                         GNAT RUN-TIME COMPONENTS                         --
+--                                                                          --
+--         A D A . N U M E R I C S . A U X _ S H O R T _ F L O A T          --
+--                                                                          --
+--                                 S p e c                                  --
+--                (Short Float Wrapper in terms of Long Float)              --
+--                                                                          --
+--          Copyright (C) 1992-2020, Free Software Foundation, Inc.         --
+--                                                                          --
+-- GNAT is free software;  you can  redistribute it  and/or modify it under --
+-- terms of the  GNU General Public License as published  by the Free Soft- --
+-- ware  Foundation;  either version 3,  or (at your option) any later ver- --
+-- sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE.                                     --
+--                                                                          --
+-- As a special exception under Section 7 of GPL version 3, you are granted --
+-- additional permissions described in the GCC Runtime Library Exception,   --
+-- version 3.1, as published by the Free Software Foundation.               --
+--                                                                          --
+-- You should have received a copy of the GNU General Public License and    --
+-- a copy of the GCC Runtime Library Exception along with this program;     --
+-- see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see    --
+-- <http://www.gnu.org/licenses/>.                                          --
+--                                                                          --
+-- GNAT was originally developed  by the GNAT team at  New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc.      --
+--                                                                          --
+------------------------------------------------------------------------------
+
+--  This package provides the basic computational interface for the generic
+--  elementary functions. The C library version interfaces with the routines
+--  in the C mathematical library, and is thus quite portable.
+
+--  This version here is for use when short float and float functions
+--  are not present in the C library, but double ones are.
+
+with Ada.Numerics.Aux_Long_Float;
+
+package Ada.Numerics.Aux_Short_Float is
+   pragma Pure;
+
+   subtype T is Short_Float;
+   package Aux renames Aux_Long_Float;
+   subtype W is Aux.T;
+
+   --  Use the Aux implementation.
+
+   function Sin (X : T) return T
+   is (T (Aux.Sin (W (X))));
+   pragma Inline (Sin);
+
+   function Cos (X : T) return T
+   is (T (Aux.Cos (W (X))));
+   pragma Inline (Cos);
+
+   function Tan (X : T) return T
+   is (T (Aux.Tan (W (X))));
+   pragma Inline (Tan);
+
+   function Exp (X : T) return T
+   is (T (Aux.Exp (W (X))));
+   pragma Inline (Exp);
+
+   function Sqrt (X : T) return T
+   is (T (Aux.Sqrt (W (X))));
+   pragma Inline (Sqrt);
+
+   function Log (X : T) return T
+   is (T (Aux.Log (W (X))));
+   pragma Inline (Log);
+
+   function Acos (X : T) return T
+   is (T (Aux.Acos (W (X))));
+   pragma Inline (Acos);
+
+   function Asin (X : T) return T
+   is (T (Aux.Asin (W (X))));
+   pragma Inline (Asin);
+
+   function Atan (X : T) return T
+   is (T (Aux.Atan (W (X))));
+   pragma Inline (Atan);
+
+   function Sinh (X : T) return T
+   is (T (Aux.Sinh (W (X))));
+   pragma Inline (Sinh);
+
+   function Cosh (X : T) return T
+   is (T (Aux.Cosh (W (X))));
+   pragma Inline (Cosh);
+
+   function Tanh (X : T) return T
+   is (T (Aux.Tanh (W (X))));
+   pragma Inline (Tanh);
+
+   function Pow (X, Y : T) return T
+   is (T (Aux.Pow (W (X), W (Y))));
+   pragma Inline (Pow);
+
+end Ada.Numerics.Aux_Short_Float;
diff --git a/gcc/ada/libgnat/a-ngcoty.adb b/gcc/ada/libgnat/a-ngcoty.adb
index 6785ccf34a9..85f660819f9 100644
--- a/gcc/ada/libgnat/a-ngcoty.adb
+++ b/gcc/ada/libgnat/a-ngcoty.adb
@@ -29,10 +29,12 @@
 --                                                                          --
 ------------------------------------------------------------------------------
 
-with Ada.Numerics.Aux; use Ada.Numerics.Aux;
+with Ada.Numerics.Generic_Aux;
 
 package body Ada.Numerics.Generic_Complex_Types is
 
+   package Aux is new Ada.Numerics.Generic_Aux (Real);
+
    subtype R is Real'Base;
 
    Two_Pi  : constant R := R (2.0) * Pi;
@@ -440,7 +442,7 @@ package body Ada.Numerics.Generic_Complex_Types is
          end if;
 
       else
-         arg := R (Atan (Double (abs (b / a))));
+         arg := Aux.Atan (abs (b / a));
 
          if a > 0.0 then
             if b > 0.0 then
@@ -507,8 +509,8 @@ package body Ada.Numerics.Generic_Complex_Types is
       if Modulus = 0.0 then
          return (0.0, 0.0);
       else
-         return (Modulus * R (Cos (Double (Argument))),
-                 Modulus * R (Sin (Double (Argument))));
+         return (Modulus * Aux.Cos (Argument),
+                 Modulus * Aux.Sin (Argument));
       end if;
    end Compose_From_Polar;
 
@@ -536,8 +538,8 @@ package body Ada.Numerics.Generic_Complex_Types is
             return (0.0, -Modulus);
          else
             Arg := Two_Pi * Argument / Cycle;
-            return (Modulus * R (Cos (Double (Arg))),
-                    Modulus * R (Sin (Double (Arg))));
+            return (Modulus * Aux.Cos (Arg),
+                    Modulus * Aux.Sin (Arg));
          end if;
       else
          raise Argument_Error;
@@ -597,8 +599,8 @@ package body Ada.Numerics.Generic_Complex_Types is
       exception
          when Constraint_Error =>
             pragma Assert (X.Re /= 0.0);
-            return R (Double (abs (X.Re))
-              * Sqrt (1.0 + (Double (X.Im) / Double (X.Re)) ** 2));
+            return R (abs (X.Re))
+              * Aux.Sqrt (1.0 + (R (X.Im) / R (X.Re)) ** 2);
       end;
 
       begin
@@ -612,8 +614,8 @@ package body Ada.Numerics.Generic_Complex_Types is
       exception
          when Constraint_Error =>
             pragma Assert (X.Im /= 0.0);
-            return R (Double (abs (X.Im))
-              * Sqrt (1.0 + (Double (X.Re) / Double (X.Im)) ** 2));
+            return R (abs (X.Im))
+              * Aux.Sqrt (1.0 + (R (X.Re) / R (X.Im)) ** 2);
       end;
 
       --  Now deal with cases of underflow. If only one of the squares
@@ -632,13 +634,11 @@ package body Ada.Numerics.Generic_Complex_Types is
 
             else
                if abs (X.Re) > abs (X.Im) then
-                  return
-                    R (Double (abs (X.Re))
-                      * Sqrt (1.0 + (Double (X.Im) / Double (X.Re)) ** 2));
+                  return R (abs (X.Re))
+                    * Aux.Sqrt (1.0 + (R (X.Im) / R (X.Re)) ** 2);
                else
-                  return
-                    R (Double (abs (X.Im))
-                      * Sqrt (1.0 + (Double (X.Re) / Double (X.Im)) ** 2));
+                  return R (abs (X.Im))
+                    * Aux.Sqrt (1.0 + (R (X.Re) / R (X.Im)) ** 2);
                end if;
             end if;
 
@@ -652,7 +652,7 @@ package body Ada.Numerics.Generic_Complex_Types is
       --  In all other cases, the naive computation will do
 
       else
-         return R (Sqrt (Double (Re2 + Im2)));
+         return Aux.Sqrt (Re2 + Im2);
       end if;
    end Modulus;
 
diff --git a/gcc/ada/libgnat/a-ngelfu.adb b/gcc/ada/libgnat/a-ngelfu.adb
index 7e7c6623850..57b310c19d7 100644
--- a/gcc/ada/libgnat/a-ngelfu.adb
+++ b/gcc/ada/libgnat/a-ngelfu.adb
@@ -36,13 +36,13 @@
 --  Uses functions sqrt, exp, log, pow, sin, asin, cos, acos, tan, atan, sinh,
 --  cosh, tanh from C library via math.h
 
-with Ada.Numerics.Aux;
+with Ada.Numerics.Generic_Aux;
 
 package body Ada.Numerics.Generic_Elementary_Functions with
   SPARK_Mode => Off
 is
 
-   use type Ada.Numerics.Aux.Double;
+   package Aux is new Ada.Numerics.Generic_Aux (Float_Type);
 
    Sqrt_Two : constant := 1.41421_35623_73095_04880_16887_24209_69807_85696;
    Log_Two  : constant := 0.69314_71805_59945_30941_72321_21458_17656_80755;
@@ -50,7 +50,6 @@ is
    Half_Log_Two : constant := Log_Two / 2;
 
    subtype T is Float_Type'Base;
-   subtype Double is Aux.Double;
 
    Two_Pi  : constant T := 2.0 * Pi;
    Half_Pi : constant T := Pi / 2.0;
@@ -150,8 +149,7 @@ is
                      Rest := Rest - 0.25;
                   end if;
 
-                  Result := Result *
-                    Float_Type'Base (Aux.Pow (Double (Left), Double (Rest)));
+                  Result := Result * Aux.Pow (Left, Rest);
 
                   if Right >= 0.0 then
                      return Result;
@@ -159,8 +157,7 @@ is
                      return (1.0 / Result);
                   end if;
                else
-                  return
-                    Float_Type'Base (Aux.Pow (Double (Left), Double (Right)));
+                  return Aux.Pow (Left, Right);
                end if;
             end if;
 
@@ -194,7 +191,7 @@ is
          return Pi;
       end if;
 
-      Temp := Float_Type'Base (Aux.Acos (Double (X)));
+      Temp := Aux.Acos (X);
 
       if Temp < 0.0 then
          Temp := Pi + Temp;
@@ -332,7 +329,7 @@ is
          return -(Pi / 2.0);
       end if;
 
-      return Float_Type'Base (Aux.Asin (Double (X)));
+      return Aux.Asin (X);
    end Arcsin;
 
    --  Arbitrary cycle
@@ -515,7 +512,7 @@ is
          return 1.0;
       end if;
 
-      return Float_Type'Base (Aux.Cos (Double (X)));
+      return Aux.Cos (X);
    end Cos;
 
    --  Arbitrary cycle
@@ -568,7 +565,7 @@ is
          return 1.0 / X;
       end if;
 
-      return 1.0 / Float_Type'Base (Aux.Tan (Double (X)));
+      return 1.0 / Aux.Tan (X);
    end Cot;
 
    --  Arbitrary cycle
@@ -617,7 +614,7 @@ is
          return 1.0 / X;
       end if;
 
-      return 1.0 / Float_Type'Base (Aux.Tanh (Double (X)));
+      return 1.0 / Aux.Tanh (X);
    end Coth;
 
    ---------
@@ -632,7 +629,7 @@ is
          return 1.0;
       end if;
 
-      Result := Float_Type'Base (Aux.Exp (Double (X)));
+      Result := Aux.Exp (X);
 
       --  Deal with case of Exp returning IEEE infinity. If Machine_Overflows
       --  is False, then we can just leave it as an infinity (and indeed we
@@ -716,7 +713,7 @@ is
       Raw_Atan :=
         (if Z < Sqrt_Epsilon then Z
          elsif Z = 1.0 then Pi / 4.0
-         else Float_Type'Base (Aux.Atan (Double (Z))));
+         else Aux.Atan (Z));
 
       if abs Y > abs X then
          Raw_Atan := Half_Pi - Raw_Atan;
@@ -747,7 +744,7 @@ is
          return 0.0;
       end if;
 
-      return Float_Type'Base (Aux.Log (Double (X)));
+      return Aux.Log (X);
    end Log;
 
    --  Arbitrary base
@@ -767,7 +764,7 @@ is
          return 0.0;
       end if;
 
-      return Float_Type'Base (Aux.Log (Double (X)) / Aux.Log (Double (Base)));
+      return Aux.Log (X) / Aux.Log (Base);
    end Log;
 
    ---------
@@ -782,7 +779,7 @@ is
          return X;
       end if;
 
-      return Float_Type'Base (Aux.Sin (Double (X)));
+      return Aux.Sin (X);
    end Sin;
 
    --  Arbitrary cycle
@@ -816,7 +813,7 @@ is
       --  Could test for 12.0 * abs T = Cycle, and return an exact value in
       --  those cases. It is not clear this is worth the extra test though.
 
-      return Float_Type'Base (Aux.Sin (Double (T / Cycle * Two_Pi)));
+      return Aux.Sin (T / Cycle * Two_Pi);
    end Sin;
 
    ----------
@@ -899,7 +896,7 @@ is
          return X;
       end if;
 
-      return Float_Type'Base (Aux.Sqrt (Double (X)));
+      return Aux.Sqrt (X);
    end Sqrt;
 
    ---------
@@ -919,7 +916,7 @@ is
       --  with, it is impossible for X to be exactly pi/2, and the result is
       --  always in range.
 
-      return Float_Type'Base (Aux.Tan (Double (X)));
+      return Aux.Tan (X);
    end Tan;
 
    --  Arbitrary cycle
@@ -992,7 +989,7 @@ is
          return X + X * R;
 
       else
-         return Float_Type'Base (Aux.Tanh (Double (X)));
+         return Aux.Tanh (X);
       end if;
    end Tanh;
 
diff --git a/gcc/ada/libgnat/a-nuaufl.ads b/gcc/ada/libgnat/a-nuaufl.ads
new file mode 100644
index 00000000000..88deda87f9a
--- /dev/null
+++ b/gcc/ada/libgnat/a-nuaufl.ads
@@ -0,0 +1,105 @@
+------------------------------------------------------------------------------
+--                                                                          --
+--                         GNAT RUN-TIME COMPONENTS                         --
+--                                                                          --
+--               A D A . N U M E R I C S . A U X _ F L O A T                --
+--                                                                          --
+--                                 S p e c                                  --
+--                      (C Math Library Version, Float)                     --
+--                                                                          --
+--          Copyright (C) 1992-2020, Free Software Foundation, Inc.         --
+--                                                                          --
+-- GNAT is free software;  you can  redistribute it  and/or modify it under --
+-- terms of the  GNU General Public License as published  by the Free Soft- --
+-- ware  Foundation;  either version 3,  or (at your option) any later ver- --
+-- sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE.                                     --
+--                                                                          --
+-- As a special exception under Section 7 of GPL version 3, you are granted --
+-- additional permissions described in the GCC Runtime Library Exception,   --
+-- version 3.1, as published by the Free Software Foundation.               --
+--                                                                          --
+-- You should have received a copy of the GNU General Public License and    --
+-- a copy of the GCC Runtime Library Exception along with this program;     --
+-- see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see    --
+-- <http://www.gnu.org/licenses/>.                                          --
+--                                                                          --
+-- GNAT was originally developed  by the GNAT team at  New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc.      --
+--                                                                          --
+------------------------------------------------------------------------------
+
+--  This package provides the basic computational interface for the generic
+--  elementary functions. The C library version interfaces with the routines
+--  in the C mathematical library, and is thus quite portable.
+
+--  This version here is for use with normal Unix math functions, from
+--  libm. Alternative versions are provided for special situations:
+
+--    a-nuaufl__nolibm    For use on VxWorks (where we have no libm.a library)
+--    a-naaufl__wraplf    For use where float intrinsics are missing
+
+package Ada.Numerics.Aux_Float is
+   pragma Pure;
+
+   subtype T is Float;
+
+   pragma Linker_Options ("-lm");
+
+   --  We import these functions directly from C. Note that we label them
+   --  all as pure functions, because indeed all of them are in fact pure.
+
+   function Sin (X : T) return T;
+   pragma Import (Intrinsic, Sin, "sinf");
+   pragma Pure_Function (Sin);
+
+   function Cos (X : T) return T;
+   pragma Import (Intrinsic, Cos, "cosf");
+   pragma Pure_Function (Cos);
+
+   function Tan (X : T) return T;
+   pragma Import (Intrinsic, Tan, "tanf");
+   pragma Pure_Function (Tan);
+
+   function Exp (X : T) return T;
+   pragma Import (Intrinsic, Exp, "expf");
+   pragma Pure_Function (Exp);
+
+   function Sqrt (X : T) return T;
+   pragma Import (Intrinsic, Sqrt, "sqrtf");
+   pragma Pure_Function (Sqrt);
+
+   function Log (X : T) return T;
+   pragma Import (Intrinsic, Log, "logf");
+   pragma Pure_Function (Log);
+
+   function Acos (X : T) return T;
+   pragma Import (Intrinsic, Acos, "acosf");
+   pragma Pure_Function (Acos);
+
+   function Asin (X : T) return T;
+   pragma Import (Intrinsic, Asin, "asinf");
+   pragma Pure_Function (Asin);
+
+   function Atan (X : T) return T;
+   pragma Import (Intrinsic, Atan, "atanf");
+   pragma Pure_Function (Atan);
+
+   function Sinh (X : T) return T;
+   pragma Import (Intrinsic, Sinh, "sinhf");
+   pragma Pure_Function (Sinh);
+
+   function Cosh (X : T) return T;
+   pragma Import (Intrinsic, Cosh, "coshf");
+   pragma Pure_Function (Cosh);
+
+   function Tanh (X : T) return T;
+   pragma Import (Intrinsic, Tanh, "tanhf");
+   pragma Pure_Function (Tanh);
+
+   function Pow (X, Y : T) return T;
+   pragma Import (Intrinsic, Pow, "powf");
+   pragma Pure_Function (Pow);
+
+end Ada.Numerics.Aux_Float;
diff --git a/gcc/ada/libgnat/a-nuaufl__nolibm.ads b/gcc/ada/libgnat/a-nuaufl__nolibm.ads
new file mode 100644
index 00000000000..4247d45d117
--- /dev/null
+++ b/gcc/ada/libgnat/a-nuaufl__nolibm.ads
@@ -0,0 +1,100 @@
+------------------------------------------------------------------------------
+--                                                                          --
+--                         GNAT RUN-TIME COMPONENTS                         --
+--                                                                          --
+--               A D A . N U M E R I C S . A U X _ F L O A T                --
+--                                                                          --
+--                                 S p e c                                  --
+--                         (C Library Version, Float)                       --
+--                                                                          --
+--          Copyright (C) 1992-2020, Free Software Foundation, Inc.         --
+--                                                                          --
+-- GNAT is free software;  you can  redistribute it  and/or modify it under --
+-- terms of the  GNU General Public License as published  by the Free Soft- --
+-- ware  Foundation;  either version 3,  or (at your option) any later ver- --
+-- sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE.                                     --
+--                                                                          --
+-- As a special exception under Section 7 of GPL version 3, you are granted --
+-- additional permissions described in the GCC Runtime Library Exception,   --
+-- version 3.1, as published by the Free Software Foundation.               --
+--                                                                          --
+-- You should have received a copy of the GNU General Public License and    --
+-- a copy of the GCC Runtime Library Exception along with this program;     --
+-- see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see    --
+-- <http://www.gnu.org/licenses/>.                                          --
+--                                                                          --
+-- GNAT was originally developed  by the GNAT team at  New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc.      --
+--                                                                          --
+------------------------------------------------------------------------------
+
+--  This package provides the basic computational interface for the generic
+--  elementary functions. The C library version interfaces with the routines
+--  in the C mathematical library, and is thus quite portable.
+
+--  This version here is for use with normal Unix math functions, from
+--  libc.
+
+package Ada.Numerics.Aux_Float is
+   pragma Pure;
+
+   subtype T is Float;
+
+   --  We import these functions directly from C. Note that we label them
+   --  all as pure functions, because indeed all of them are in fact pure.
+
+   function Sin (X : T) return T;
+   pragma Import (Intrinsic, Sin, "sinf");
+   pragma Pure_Function (Sin);
+
+   function Cos (X : T) return T;
+   pragma Import (Intrinsic, Cos, "cosf");
+   pragma Pure_Function (Cos);
+
+   function Tan (X : T) return T;
+   pragma Import (Intrinsic, Tan, "tanf");
+   pragma Pure_Function (Tan);
+
+   function Exp (X : T) return T;
+   pragma Import (Intrinsic, Exp, "expf");
+   pragma Pure_Function (Exp);
+
+   function Sqrt (X : T) return T;
+   pragma Import (Intrinsic, Sqrt, "sqrtf");
+   pragma Pure_Function (Sqrt);
+
+   function Log (X : T) return T;
+   pragma Import (Intrinsic, Log, "logf");
+   pragma Pure_Function (Log);
+
+   function Acos (X : T) return T;
+   pragma Import (Intrinsic, Acos, "acosf");
+   pragma Pure_Function (Acos);
+
+   function Asin (X : T) return T;
+   pragma Import (Intrinsic, Asin, "asinf");
+   pragma Pure_Function (Asin);
+
+   function Atan (X : T) return T;
+   pragma Import (Intrinsic, Atan, "atanf");
+   pragma Pure_Function (Atan);
+
+   function Sinh (X : T) return T;
+   pragma Import (Intrinsic, Sinh, "sinhf");
+   pragma Pure_Function (Sinh);
+
+   function Cosh (X : T) return T;
+   pragma Import (Intrinsic, Cosh, "coshf");
+   pragma Pure_Function (Cosh);
+
+   function Tanh (X : T) return T;
+   pragma Import (Intrinsic, Tanh, "tanhf");
+   pragma Pure_Function (Tanh);
+
+   function Pow (X, Y : T) return T;
+   pragma Import (Intrinsic, Pow, "powf");
+   pragma Pure_Function (Pow);
+
+end Ada.Numerics.Aux_Float;
diff --git a/gcc/ada/libgnat/a-nuaufl__wraplf.ads b/gcc/ada/libgnat/a-nuaufl__wraplf.ads
new file mode 100644
index 00000000000..eb32ba73876
--- /dev/null
+++ b/gcc/ada/libgnat/a-nuaufl__wraplf.ads
@@ -0,0 +1,105 @@
+------------------------------------------------------------------------------
+--                                                                          --
+--                         GNAT RUN-TIME COMPONENTS                         --
+--                                                                          --
+--               A D A . N U M E R I C S . A U X _ F L O A T                --
+--                                                                          --
+--                                 S p e c                                  --
+--                   (Float Wrapper in terms of Long Float)                 --
+--                                                                          --
+--          Copyright (C) 1992-2020, Free Software Foundation, Inc.         --
+--                                                                          --
+-- GNAT is free software;  you can  redistribute it  and/or modify it under --
+-- terms of the  GNU General Public License as published  by the Free Soft- --
+-- ware  Foundation;  either version 3,  or (at your option) any later ver- --
+-- sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE.                                     --
+--                                                                          --
+-- As a special exception under Section 7 of GPL version 3, you are granted --
+-- additional permissions described in the GCC Runtime Library Exception,   --
+-- version 3.1, as published by the Free Software Foundation.               --
+--                                                                          --
+-- You should have received a copy of the GNU General Public License and    --
+-- a copy of the GCC Runtime Library Exception along with this program;     --
+-- see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see    --
+-- <http://www.gnu.org/licenses/>.                                          --
+--                                                                          --
+-- GNAT was originally developed  by the GNAT team at  New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc.      --
+--                                                                          --
+------------------------------------------------------------------------------
+
+--  This package provides the basic computational interface for the generic
+--  elementary functions. The C library version interfaces with the routines
+--  in the C mathematical library, and is thus quite portable.
+
+--  This version here is for use when float functions are not present
+--  in the C library, but double ones are.
+
+with Ada.Numerics.Aux_Long_Float;
+
+package Ada.Numerics.Aux_Float is
+   pragma Pure;
+
+   subtype T is Float;
+
+   subtype T is Float;
+   package Aux renames Aux_Long_Float;
+   subtype W is Aux.T;
+
+   --  Use the Aux implementation.
+
+   function Sin (X : T) return T
+   is (T (Aux.Sin (W (X))));
+   pragma Inline (Sin);
+
+   function Cos (X : T) return T
+   is (T (Aux.Cos (W (X))));
+   pragma Inline (Cos);
+
+   function Tan (X : T) return T
+   is (T (Aux.Tan (W (X))));
+   pragma Inline (Tan);
+
+   function Exp (X : T) return T
+   is (T (Aux.Exp (W (X))));
+   pragma Inline (Exp);
+
+   function Sqrt (X : T) return T
+   is (T (Aux.Sqrt (W (X))));
+   pragma Inline (Sqrt);
+
+   function Log (X : T) return T
+   is (T (Aux.Log (W (X))));
+   pragma Inline (Log);
+
+   function Acos (X : T) return T
+   is (T (Aux.Acos (W (X))));
+   pragma Inline (Acos);
+
+   function Asin (X : T) return T
+   is (T (Aux.Asin (W (X))));
+   pragma Inline (Asin);
+
+   function Atan (X : T) return T
+   is (T (Aux.Atan (W (X))));
+   pragma Inline (Atan);
+
+   function Sinh (X : T) return T
+   is (T (Aux.Sinh (W (X))));
+   pragma Inline (Sinh);
+
+   function Cosh (X : T) return T
+   is (T (Aux.Cosh (W (X))));
+   pragma Inline (Cosh);
+
+   function Tanh (X : T) return T
+   is (T (Aux.Tanh (W (X))));
+   pragma Inline (Tanh);
+
+   function Pow (X, Y : T) return T
+   is (T (Aux.Pow (W (X), W (Y))));
+   pragma Inline (Pow);
+
+end Ada.Numerics.Aux_Float;
diff --git a/gcc/ada/libgnat/a-nugeau.ads b/gcc/ada/libgnat/a-nugeau.ads
new file mode 100644
index 00000000000..94f5560c75c
--- /dev/null
+++ b/gcc/ada/libgnat/a-nugeau.ads
@@ -0,0 +1,184 @@
+------------------------------------------------------------------------------
+--                                                                          --
+--                         GNAT RUN-TIME COMPONENTS                         --
+--                                                                          --
+--             A D A . N U M E R I C S . G E N E R I C _ A U X              --
+--                                                                          --
+--                                 S p e c                                  --
+--                            (Generic Wrapper)                             --
+--                                                                          --
+--          Copyright (C) 1992-2020, Free Software Foundation, Inc.         --
+--                                                                          --
+-- GNAT is free software;  you can  redistribute it  and/or modify it under --
+-- terms of the  GNU General Public License as published  by the Free Soft- --
+-- ware  Foundation;  either version 3,  or (at your option) any later ver- --
+-- sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE.                                     --
+--                                                                          --
+-- As a special exception under Section 7 of GPL version 3, you are granted --
+-- additional permissions described in the GCC Runtime Library Exception,   --
+-- version 3.1, as published by the Free Software Foundation.               --
+--                                                                          --
+-- You should have received a copy of the GNU General Public License and    --
+-- a copy of the GCC Runtime Library Exception along with this program;     --
+-- see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see    --
+-- <http://www.gnu.org/licenses/>.                                          --
+--                                                                          --
+-- GNAT was originally developed  by the GNAT team at  New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc.      --
+--                                                                          --
+------------------------------------------------------------------------------
+
+--  This package provides the basic computational interface for the generic
+--  elementary functions. The C library version interfaces with the routines
+--  in the C mathematical library.
+
+--  This version here is for use with normal Unix math functions.
+
+with Ada.Numerics.Aux_Long_Long_Float;
+with Ada.Numerics.Aux_Long_Float;
+with Ada.Numerics.Aux_Float;
+with Ada.Numerics.Aux_Short_Float;
+
+generic
+   type T is digits <>;
+package Ada.Numerics.Generic_Aux is
+   pragma Pure;
+
+   package LLF renames Ada.Numerics.Aux_Long_Long_Float;
+   package LF renames Ada.Numerics.Aux_Long_Float;
+   package F renames Ada.Numerics.Aux_Float;
+   package SF renames Ada.Numerics.Aux_Short_Float;
+
+   function Sin (X : T'Base) return T'Base
+   is (if T'Base'Digits > Long_Float'Digits
+         then T'Base (LLF.Sin (Long_Long_Float (X)))
+         elsif T'Base'Digits > Float'Digits
+         then T'Base (LF.Sin (Long_Float (X)))
+         elsif T'Base'Digits > Short_Float'Digits
+         then T'Base (F.Sin (Float (X)))
+         else T'Base (SF.Sin (Short_Float (X))));
+   pragma Inline (Sin);
+
+   function Cos (X : T'Base) return T'Base
+   is (if T'Base'Digits > Long_Float'Digits
+         then T'Base (LLF.Cos (Long_Long_Float (X)))
+         elsif T'Base'Digits > Float'Digits
+         then T'Base (LF.Cos (Long_Float (X)))
+         elsif T'Base'Digits > Short_Float'Digits
+         then T'Base (F.Cos (Float (X)))
+         else T'Base (SF.Cos (Short_Float (X))));
+   pragma Inline (Cos);
+
+   function Tan (X : T'Base) return T'Base
+   is (if T'Base'Digits > Long_Float'Digits
+         then T'Base (LLF.Tan (Long_Long_Float (X)))
+         elsif T'Base'Digits > Float'Digits
+         then T'Base (LF.Tan (Long_Float (X)))
+         elsif T'Base'Digits > Short_Float'Digits
+         then T'Base (F.Tan (Float (X)))
+         else T'Base (SF.Tan (Short_Float (X))));
+   pragma Inline (Tan);
+
+   function Exp (X : T'Base) return T'Base
+   is (if T'Base'Digits > Long_Float'Digits
+         then T'Base (LLF.Exp (Long_Long_Float (X)))
+         elsif T'Base'Digits > Float'Digits
+         then T'Base (LF.Exp (Long_Float (X)))
+         elsif T'Base'Digits > Short_Float'Digits
+         then T'Base (F.Exp (Float (X)))
+         else T'Base (SF.Exp (Short_Float (X))));
+   pragma Inline (Exp);
+
+   function Sqrt (X : T'Base) return T'Base
+   is (if T'Base'Digits > Long_Float'Digits
+         then T'Base (LLF.Sqrt (Long_Long_Float (X)))
+         elsif T'Base'Digits > Float'Digits
+         then T'Base (LF.Sqrt (Long_Float (X)))
+         elsif T'Base'Digits > Short_Float'Digits
+         then T'Base (F.Sqrt (Float (X)))
+         else T'Base (SF.Sqrt (Short_Float (X))));
+   pragma Inline (Sqrt);
+
+   function Log (X : T'Base) return T'Base
+   is (if T'Base'Digits > Long_Float'Digits
+         then T'Base (LLF.Log (Long_Long_Float (X)))
+         elsif T'Base'Digits > Float'Digits
+         then T'Base (LF.Log (Long_Float (X)))
+         elsif T'Base'Digits > Short_Float'Digits
+         then T'Base (F.Log (Float (X)))
+         else T'Base (SF.Log (Short_Float (X))));
+   pragma Inline (Log);
+
+   function Acos (X : T'Base) return T'Base
+   is (if T'Base'Digits > Long_Float'Digits
+         then T'Base (LLF.Acos (Long_Long_Float (X)))
+         elsif T'Base'Digits > Float'Digits
+         then T'Base (LF.Acos (Long_Float (X)))
+         elsif T'Base'Digits > Short_Float'Digits
+         then T'Base (F.Acos (Float (X)))
+         else T'Base (SF.Acos (Short_Float (X))));
+   pragma Inline (Acos);
+
+   function Asin (X : T'Base) return T'Base
+   is (if T'Base'Digits > Long_Float'Digits
+         then T'Base (LLF.Asin (Long_Long_Float (X)))
+         elsif T'Base'Digits > Float'Digits
+         then T'Base (LF.Asin (Long_Float (X)))
+         elsif T'Base'Digits > Short_Float'Digits
+         then T'Base (F.Asin (Float (X)))
+         else T'Base (SF.Asin (Short_Float (X))));
+   pragma Inline (Asin);
+
+   function Atan (X : T'Base) return T'Base
+   is (if T'Base'Digits > Long_Float'Digits
+         then T'Base (LLF.Atan (Long_Long_Float (X)))
+         elsif T'Base'Digits > Float'Digits
+         then T'Base (LF.Atan (Long_Float (X)))
+         elsif T'Base'Digits > Short_Float'Digits
+         then T'Base (F.Atan (Float (X)))
+         else T'Base (SF.Atan (Short_Float (X))));
+   pragma Inline (Atan);
+
+   function Sinh (X : T'Base) return T'Base
+   is (if T'Base'Digits > Long_Float'Digits
+         then T'Base (LLF.Sinh (Long_Long_Float (X)))
+         elsif T'Base'Digits > Float'Digits
+         then T'Base (LF.Sinh (Long_Float (X)))
+         elsif T'Base'Digits > Short_Float'Digits
+         then T'Base (F.Sinh (Float (X)))
+         else T'Base (SF.Sinh (Short_Float (X))));
+   pragma Inline (Sinh);
+
+   function Cosh (X : T'Base) return T'Base
+   is (if T'Base'Digits > Long_Float'Digits
+         then T'Base (LLF.Cosh (Long_Long_Float (X)))
+         elsif T'Base'Digits > Float'Digits
+         then T'Base (LF.Cosh (Long_Float (X)))
+         elsif T'Base'Digits > Short_Float'Digits
+         then T'Base (F.Cosh (Float (X)))
+         else T'Base (SF.Cosh (Short_Float (X))));
+   pragma Inline (Cosh);
+
+   function Tanh (X : T'Base) return T'Base
+   is (if T'Base'Digits > Long_Float'Digits
+         then T'Base (LLF.Tanh (Long_Long_Float (X)))
+         elsif T'Base'Digits > Float'Digits
+         then T'Base (LF.Tanh (Long_Float (X)))
+         elsif T'Base'Digits > Short_Float'Digits
+         then T'Base (F.Tanh (Float (X)))
+         else T'Base (SF.Tanh (Short_Float (X))));
+   pragma Inline (Tanh);
+
+   function Pow (X, Y : T'Base) return T'Base
+   is (if T'Base'Digits > Long_Float'Digits
+         then T'Base (LLF.Pow (Long_Long_Float (X), Long_Long_Float (Y)))
+         elsif T'Base'Digits > Float'Digits
+         then T'Base (LF.Pow (Long_Float (X), Long_Float (Y)))
+         elsif T'Base'Digits > Short_Float'Digits
+         then T'Base (F.Pow (Float (X), Float (Y)))
+         else T'Base (SF.Pow (Short_Float (X), Short_Float (Y))));
+   pragma Inline (Pow);
+
+end Ada.Numerics.Generic_Aux;
diff --git a/gcc/ada/libgnat/a-numaux__dummy.adb b/gcc/ada/libgnat/a-numaux.adb
similarity index 100%
rename from gcc/ada/libgnat/a-numaux__dummy.adb
rename to gcc/ada/libgnat/a-numaux.adb
diff --git a/gcc/ada/libgnat/a-numaux.ads b/gcc/ada/libgnat/a-numaux.ads
index 4154e1ab216..9e697247b0a 100644
--- a/gcc/ada/libgnat/a-numaux.ads
+++ b/gcc/ada/libgnat/a-numaux.ads
@@ -5,7 +5,7 @@
 --                     A D A . N U M E R I C S . A U X                      --
 --                                                                          --
 --                                 S p e c                                  --
---                       (C Library Version, non-x86)                       --
+--                      (Backward-Compatibility Version)                    --
 --                                                                          --
 --          Copyright (C) 1992-2020, Free Software Foundation, Inc.         --
 --                                                                          --
@@ -30,83 +30,79 @@
 --                                                                          --
 ------------------------------------------------------------------------------
 
---  This package provides the basic computational interface for the generic
---  elementary functions. The C library version interfaces with the routines
---  in the C mathematical library, and is thus quite portable, although it may
---  not necessarily meet the requirements for accuracy in the numerics annex.
---  One advantage of using this package is that it will interface directly to
---  hardware instructions, such as the those provided on the Intel x86.
+--  This is a backward-compatibility package, for users of this
+--  internal package before the introduction of Generic_Aux.
 
---  This version here is for use with normal Unix math functions. Alternative
---  versions are provided for special situations:
+--  This version here is for use with Double mapping to Long_Float.
+--  Alternative versions are provided for special situations:
 
---    a-numaux-darwin    For PowerPC/Darwin (special handling of sin/cos)
---    a-numaux-libc-x86  For the x86, using 80-bit long double format
---    a-numaux-x86       For the x86, using 80-bit long double format with
---                       inline asm statements
---    a-numaux-vxworks   For use on VxWorks (where we have no libm.a library)
+--    a-numaux__libc-x86    Map Double to x86's 80-bit Long_Long_Float
+
+with Ada.Numerics.Aux_Long_Float;
 
 package Ada.Numerics.Aux is
    pragma Pure;
 
-   pragma Linker_Options ("-lm");
-
    type Double is new Long_Float;
-   --  Type Double is the type used to call the C routines
 
-   --  We import these functions directly from C. Note that we label them
-   --  all as pure functions, because indeed all of them are in fact pure.
+   subtype T is Double;
+
+   package Aux renames Aux_Long_Float;
+
+   subtype W is Aux.T;
+
+   --  Use the Aux implementation.
 
-   function Sin (X : Double) return Double;
-   pragma Import (Intrinsic, Sin, "sin");
-   pragma Pure_Function (Sin);
+   function Sin (X : T) return T
+   is (T (Aux.Sin (W (X))));
+   pragma Inline (Sin);
 
-   function Cos (X : Double) return Double;
-   pragma Import (Intrinsic, Cos, "cos");
-   pragma Pure_Function (Cos);
+   function Cos (X : T) return T
+   is (T (Aux.Cos (W (X))));
+   pragma Inline (Cos);
 
-   function Tan (X : Double) return Double;
-   pragma Import (Intrinsic, Tan, "tan");
-   pragma Pure_Function (Tan);
+   function Tan (X : T) return T
+   is (T (Aux.Tan (W (X))));
+   pragma Inline (Tan);
 
-   function Exp (X : Double) return Double;
-   pragma Import (Intrinsic, Exp, "exp");
-   pragma Pure_Function (Exp);
+   function Exp (X : T) return T
+   is (T (Aux.Exp (W (X))));
+   pragma Inline (Exp);
 
-   function Sqrt (X : Double) return Double;
-   pragma Import (Intrinsic, Sqrt, "sqrt");
-   pragma Pure_Function (Sqrt);
+   function Sqrt (X : T) return T
+   is (T (Aux.Sqrt (W (X))));
+   pragma Inline (Sqrt);
 
-   function Log (X : Double) return Double;
-   pragma Import (Intrinsic, Log, "log");
-   pragma Pure_Function (Log);
+   function Log (X : T) return T
+   is (T (Aux.Log (W (X))));
+   pragma Inline (Log);
 
-   function Acos (X : Double) return Double;
-   pragma Import (Intrinsic, Acos, "acos");
-   pragma Pure_Function (Acos);
+   function Acos (X : T) return T
+   is (T (Aux.Acos (W (X))));
+   pragma Inline (Acos);
 
-   function Asin (X : Double) return Double;
-   pragma Import (Intrinsic, Asin, "asin");
-   pragma Pure_Function (Asin);
+   function Asin (X : T) return T
+   is (T (Aux.Asin (W (X))));
+   pragma Inline (Asin);
 
-   function Atan (X : Double) return Double;
-   pragma Import (Intrinsic, Atan, "atan");
-   pragma Pure_Function (Atan);
+   function Atan (X : T) return T
+   is (T (Aux.Atan (W (X))));
+   pragma Inline (Atan);
 
-   function Sinh (X : Double) return Double;
-   pragma Import (Intrinsic, Sinh, "sinh");
-   pragma Pure_Function (Sinh);
+   function Sinh (X : T) return T
+   is (T (Aux.Sinh (W (X))));
+   pragma Inline (Sinh);
 
-   function Cosh (X : Double) return Double;
-   pragma Import (Intrinsic, Cosh, "cosh");
-   pragma Pure_Function (Cosh);
+   function Cosh (X : T) return T
+   is (T (Aux.Cosh (W (X))));
+   pragma Inline (Cosh);
 
-   function Tanh (X : Double) return Double;
-   pragma Import (Intrinsic, Tanh, "tanh");
-   pragma Pure_Function (Tanh);
+   function Tanh (X : T) return T
+   is (T (Aux.Tanh (W (X))));
+   pragma Inline (Tanh);
 
-   function Pow (X, Y : Double) return Double;
-   pragma Import (Intrinsic, Pow, "pow");
-   pragma Pure_Function (Pow);
+   function Pow (X, Y : T) return T
+   is (T (Aux.Pow (W (X), W (Y))));
+   pragma Inline (Pow);
 
 end Ada.Numerics.Aux;
diff --git a/gcc/ada/libgnat/a-numaux__libc-x86.ads b/gcc/ada/libgnat/a-numaux__libc-x86.ads
index f6deebecbad..64b7cb55b6d 100644
--- a/gcc/ada/libgnat/a-numaux__libc-x86.ads
+++ b/gcc/ada/libgnat/a-numaux__libc-x86.ads
@@ -5,7 +5,7 @@
 --                     A D A . N U M E R I C S . A U X                      --
 --                                                                          --
 --                                 S p e c                                  --
---                       (C Library Version for x86)                        --
+--                    (x86 Backward-Compatibility Version)                  --
 --                                                                          --
 --          Copyright (C) 1992-2020, Free Software Foundation, Inc.         --
 --                                                                          --
@@ -30,68 +30,75 @@
 --                                                                          --
 ------------------------------------------------------------------------------
 
---  This version is for the x86 using the 80-bit x86 long double format
+--  This is a backward-compatibility package, for users of this
+--  internal package before the introduction of Generic_Aux on x86,
+--  where the Double type mapped to Long Long Float.
+
+with Ada.Numerics.Aux_Long_Long_Float;
 
 package Ada.Numerics.Aux is
    pragma Pure;
 
-   pragma Linker_Options ("-lm");
-
    type Double is new Long_Long_Float;
 
-   --  We import these functions directly from C. Note that we label them
-   --  all as pure functions, because indeed all of them are in fact pure.
+   subtype T is Double;
+
+   package Aux renames Aux_Long_Long_Float;
+
+   subtype W is Aux.T;
+
+   --  Use the Aux implementation.
 
-   function Sin (X : Double) return Double;
-   pragma Import (Intrinsic, Sin, "sinl");
-   pragma Pure_Function (Sin);
+   function Sin (X : T) return T
+   is (T (Aux.Sin (W (X))));
+   pragma Inline (Sin);
 
-   function Cos (X : Double) return Double;
-   pragma Import (Intrinsic, Cos, "cosl");
-   pragma Pure_Function (Cos);
+   function Cos (X : T) return T
+   is (T (Aux.Cos (W (X))));
+   pragma Inline (Cos);
 
-   function Tan (X : Double) return Double;
-   pragma Import (Intrinsic, Tan, "tanl");
-   pragma Pure_Function (Tan);
+   function Tan (X : T) return T
+   is (T (Aux.Tan (W (X))));
+   pragma Inline (Tan);
 
-   function Exp (X : Double) return Double;
-   pragma Import (Intrinsic, Exp, "expl");
-   pragma Pure_Function (Exp);
+   function Exp (X : T) return T
+   is (T (Aux.Exp (W (X))));
+   pragma Inline (Exp);
 
-   function Sqrt (X : Double) return Double;
-   pragma Import (Intrinsic, Sqrt, "sqrtl");
-   pragma Pure_Function (Sqrt);
+   function Sqrt (X : T) return T
+   is (T (Aux.Sqrt (W (X))));
+   pragma Inline (Sqrt);
 
-   function Log (X : Double) return Double;
-   pragma Import (Intrinsic, Log, "logl");
-   pragma Pure_Function (Log);
+   function Log (X : T) return T
+   is (T (Aux.Log (W (X))));
+   pragma Inline (Log);
 
-   function Acos (X : Double) return Double;
-   pragma Import (Intrinsic, Acos, "acosl");
-   pragma Pure_Function (Acos);
+   function Acos (X : T) return T
+   is (T (Aux.Acos (W (X))));
+   pragma Inline (Acos);
 
-   function Asin (X : Double) return Double;
-   pragma Import (Intrinsic, Asin, "asinl");
-   pragma Pure_Function (Asin);
+   function Asin (X : T) return T
+   is (T (Aux.Asin (W (X))));
+   pragma Inline (Asin);
 
-   function Atan (X : Double) return Double;
-   pragma Import (Intrinsic, Atan, "atanl");
-   pragma Pure_Function (Atan);
+   function Atan (X : T) return T
+   is (T (Aux.Atan (W (X))));
+   pragma Inline (Atan);
 
-   function Sinh (X : Double) return Double;
-   pragma Import (Intrinsic, Sinh, "sinhl");
-   pragma Pure_Function (Sinh);
+   function Sinh (X : T) return T
+   is (T (Aux.Sinh (W (X))));
+   pragma Inline (Sinh);
 
-   function Cosh (X : Double) return Double;
-   pragma Import (Intrinsic, Cosh, "coshl");
-   pragma Pure_Function (Cosh);
+   function Cosh (X : T) return T
+   is (T (Aux.Cosh (W (X))));
+   pragma Inline (Cosh);
 
-   function Tanh (X : Double) return Double;
-   pragma Import (Intrinsic, Tanh, "tanhl");
-   pragma Pure_Function (Tanh);
+   function Tanh (X : T) return T
+   is (T (Aux.Tanh (W (X))));
+   pragma Inline (Tanh);
 
-   function Pow (X, Y : Double) return Double;
-   pragma Import (Intrinsic, Pow, "powl");
-   pragma Pure_Function (Pow);
+   function Pow (X, Y : T) return T
+   is (T (Aux.Pow (W (X), W (Y))));
+   pragma Inline (Pow);
 
 end Ada.Numerics.Aux;


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-10-12 17:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-07 13:58 [gcc(refs/users/aoliva/heads/testme)] revamp ada.numerics.aux Alexandre Oliva
  -- strict thread matches above, loose matches on Subject: below --
2020-10-12 17:31 Alexandre Oliva
2020-10-06 10:45 Alexandre Oliva

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).