public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [Ada] Do not second-guess the hardware for underflow handling of Scaling
@ 2021-05-06  7:58 Pierre-Marie de Rodat
  0 siblings, 0 replies; only message in thread
From: Pierre-Marie de Rodat @ 2021-05-06  7:58 UTC (permalink / raw)
  To: gcc-patches; +Cc: Eric Botcazou

[-- Attachment #1: Type: text/plain, Size: 301 bytes --]

This defers to the hardware implementation for the handling of underflow
in the Scaling routine also in the case where denormals are not supported.

Tested on x86_64-pc-linux-gnu, committed on trunk

gcc/ada/

	* libgnat/s-fatgen.adb (Scaling): Use single handling of
	underflow.  Add pragma Annotate.

[-- Attachment #2: patch.diff --]
[-- Type: text/x-diff, Size: 1058 bytes --]

diff --git a/gcc/ada/libgnat/s-fatgen.adb b/gcc/ada/libgnat/s-fatgen.adb
--- a/gcc/ada/libgnat/s-fatgen.adb
+++ b/gcc/ada/libgnat/s-fatgen.adb
@@ -781,11 +781,9 @@ package body System.Fat_Gen is
          --  Check for underflow
 
          elsif Adjustment < IEEE_Emin - Exp then
-            --  Check for gradual underflow
+            --  Check for possibly gradual underflow (up to the hardware)
 
-            if T'Denorm
-              and then Adjustment >= IEEE_Emin - Mantissa - Exp
-            then
+            if Adjustment >= IEEE_Emin - Mantissa - Exp then
                Expf := IEEE_Emin;
                Expi := Exp + Adjustment - Expf;
 
@@ -810,6 +808,9 @@ package body System.Fat_Gen is
             --  Given that Expi >= -Mantissa, only -64 is problematic
 
             if Expi = -64 then
+               pragma Annotate
+                 (CodePeer, Intentional, "test always false",
+                  "test always false in some instantiations");
                XX := XX / 2.0;
                Expi := -63;
             end if;



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-05-06  7:58 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-06  7:58 [Ada] Do not second-guess the hardware for underflow handling of Scaling 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).