summaryrefslogtreecommitdiff
path: root/gcc/ada/s-fatgen.adb
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2005-03-15 16:18:21 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2005-03-15 16:18:21 +0000
commita6419052cd9791c5dc4b56b8aac26ea9dbe28810 (patch)
treeef20db6b2f67d18aef22e7989383a6bb9f23f5db /gcc/ada/s-fatgen.adb
parentb0939af7d4f311bba072111d8c3817fa1ec57a29 (diff)
downloadgcc-a6419052cd9791c5dc4b56b8aac26ea9dbe28810.tar.gz
2005-03-08 Geert Bosch <bosch@adacore.com>
* s-fatgen.adb (Valid): Extend special exceptions to account for long long float padding to also cover AMD64 and IA64. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@96508 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/s-fatgen.adb')
-rw-r--r--gcc/ada/s-fatgen.adb24
1 files changed, 17 insertions, 7 deletions
diff --git a/gcc/ada/s-fatgen.adb b/gcc/ada/s-fatgen.adb
index ac0b0a5f559..e713183d7fa 100644
--- a/gcc/ada/s-fatgen.adb
+++ b/gcc/ada/s-fatgen.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2004 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005 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- --
@@ -771,9 +771,19 @@ package body System.Fat_Gen is
type Float_Word is mod 2**Positive'Min (System.Word_Size, 32);
type Rep_Index is range 0 .. 7;
- Rep_Last : constant Rep_Index := (T'Size - 1) / Float_Word'Size;
+ Rep_Words : constant Positive :=
+ (T'Size + Float_Word'Size - 1) / Float_Word'Size;
+ Rep_Last : constant Rep_Index := Rep_Index'Min
+ (Rep_Index (Rep_Words - 1), (T'Mantissa + 16) / Float_Word'Size);
+ -- Determine the number of Float_Words needed for representing
+ -- the entire floating-poinit value. Do not take into account
+ -- excessive padding, as occurs on IA-64 where 80 bits floats get
+ -- padded to 128 bits. In general, the exponent field cannot
+ -- be larger than 15 bits, even for 128-bit floating-poin t types,
+ -- so the final format size won't be larger than T'Mantissa + 16.
- type Float_Rep is array (Rep_Index range 0 .. Rep_Last) of Float_Word;
+ type Float_Rep is
+ array (Rep_Index range 0 .. Rep_Index (Rep_Words - 1)) of Float_Word;
pragma Suppress_Initialization (Float_Rep);
-- This pragma supresses the generation of an initialization procedure
@@ -791,12 +801,12 @@ package body System.Fat_Gen is
Exponent_Factor : constant Float_Word :=
2**(Float_Word'Size - 1) /
Float_Word (IEEE_Emax - IEEE_Emin + 3) *
- Boolean'Pos (T'Size /= 96) +
- Boolean'Pos (T'Size = 96);
+ Boolean'Pos (Most_Significant_Word /= 2) +
+ Boolean'Pos (Most_Significant_Word = 2);
-- Factor that the extracted exponent needs to be divided by
-- to be in range 0 .. IEEE_Emax - IEEE_Emin + 2.
- -- Special kludge: Exponent_Factor is 0 for x86 double extended
- -- as GCC adds 16 unused bits to the type.
+ -- Special kludge: Exponent_Factor is 1 for x86/IA64 double extended
+ -- as GCC adds unused bits to the type.
Exponent_Mask : constant Float_Word :=
Float_Word (IEEE_Emax - IEEE_Emin + 2) *