public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r11-6014] [Ada] Adjust again previous change to System.Fat_Gen
@ 2020-12-14 15:54 Pierre-Marie de Rodat
0 siblings, 0 replies; only message in thread
From: Pierre-Marie de Rodat @ 2020-12-14 15:54 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:b97b4e6f71da62cae325d1f41610cfb43870a4a1
commit r11-6014-gb97b4e6f71da62cae325d1f41610cfb43870a4a1
Author: Eric Botcazou <ebotcazou@adacore.com>
Date: Sun Nov 22 00:54:18 2020 +0100
[Ada] Adjust again previous change to System.Fat_Gen
gcc/ada/
* libgnat/s-fatgen.adb: Add with clause for Interfaces and use
type clause for Interfaces.Unsigned_64.
(Small): Comment out.
(Tiny): Likewise.
(Tiny16): New integer constant.
(Tiny32): Likewise.
(Tiny64): Likewise.
(Tiny80): New integer array constant.
(Pred): Declare a local overlay for Tiny.
(Succ): Likewise.
Diff:
---
gcc/ada/libgnat/s-fatgen.adb | 32 +++++++++++++++++++++++++++++---
1 file changed, 29 insertions(+), 3 deletions(-)
diff --git a/gcc/ada/libgnat/s-fatgen.adb b/gcc/ada/libgnat/s-fatgen.adb
index 64234b436f5..d297451d99c 100644
--- a/gcc/ada/libgnat/s-fatgen.adb
+++ b/gcc/ada/libgnat/s-fatgen.adb
@@ -35,12 +35,15 @@
-- floating-point implementations.
with Ada.Unchecked_Conversion;
+with Interfaces;
with System.Unsigned_Types;
pragma Warnings (Off, "non-static constant in preelaborated unit");
-- Every constant is static given our instantiation model
package body System.Fat_Gen is
+ use type Interfaces.Unsigned_64;
+
pragma Assert (T'Machine_Radix = 2);
-- This version does not handle radix 16
@@ -53,13 +56,22 @@ package body System.Fat_Gen is
Invrad : constant T := 1.0 / Rad;
-- Smallest positive mantissa in the canonical form (RM A.5.3(4))
- Small : constant T := Rad ** (T'Machine_Emin - 1);
- pragma Unreferenced (Small);
+ -- Small : constant T := Rad ** (T'Machine_Emin - 1);
-- Smallest positive normalized number
- Tiny : constant T := Rad ** (T'Machine_Emin - Mantissa);
+ -- Tiny : constant T := Rad ** (T'Machine_Emin - Mantissa);
-- Smallest positive denormalized number
+ Tiny16 : constant Interfaces.Unsigned_16 := 1;
+ Tiny32 : constant Interfaces.Unsigned_32 := 1;
+ Tiny64 : constant Interfaces.Unsigned_64 := 1;
+ Tiny80 : constant array (1 .. 2) of Interfaces.Unsigned_64 :=
+ (1 * Standard'Default_Bit_Order,
+ 2**48 * (1 - Standard'Default_Bit_Order));
+ -- We cannot use the direct declaration because it cannot be translated
+ -- into C90, as the hexadecimal floating constants were introduced in C99.
+ -- So we work around this by using an overlay of the integer constant.
+
RM1 : constant T := Rad ** (Mantissa - 1);
-- Smallest positive member of the large consecutive integers. It is equal
-- to the ratio Small / Tiny, which means that multiplying by it normalizes
@@ -411,6 +423,13 @@ package body System.Fat_Gen is
----------
function Pred (X : T) return T is
+ Tiny : constant T;
+ pragma Import (Ada, Tiny);
+ for Tiny'Address use (if T'Size = 16 then Tiny16'Address
+ elsif T'Size = 32 then Tiny32'Address
+ elsif T'Size = 64 then Tiny64'Address
+ elsif Mantissa = 64 then Tiny80'Address
+ else raise Program_Error);
X_Frac : T;
X_Exp : UI;
@@ -676,6 +695,13 @@ package body System.Fat_Gen is
----------
function Succ (X : T) return T is
+ Tiny : constant T;
+ pragma Import (Ada, Tiny);
+ for Tiny'Address use (if T'Size = 16 then Tiny16'Address
+ elsif T'Size = 32 then Tiny32'Address
+ elsif T'Size = 64 then Tiny64'Address
+ elsif Mantissa = 64 then Tiny80'Address
+ else raise Program_Error);
X_Frac : T;
X_Exp : UI;
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2020-12-14 15:54 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-14 15:54 [gcc r11-6014] [Ada] Adjust again previous change to System.Fat_Gen Pierre-Marie de Rodat
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).