public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Pierre-Marie de Rodat <pmderodat@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r12-5665] [Ada] Add query for extended precision floating-point types
Date: Wed,  1 Dec 2021 10:26:04 +0000 (GMT)	[thread overview]
Message-ID: <20211201102604.CE6643858003@sourceware.org> (raw)

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

commit r12-5665-gbe8de8e127b06017f2c3602c81de99ad5937ef9d
Author: Yannick Moy <moy@adacore.com>
Date:   Mon Nov 8 11:53:42 2021 +0100

    [Ada] Add query for extended precision floating-point types
    
    gcc/ada/
    
            * sem_util.adb (Is_Extended_Precision_Floating_Point_Type): New
            function.
            * sem_util.ads (Is_Extended_Precision_Floating_Point_Type): New
            function.

Diff:
---
 gcc/ada/sem_util.adb | 14 ++++++++++++++
 gcc/ada/sem_util.ads |  9 +++++++++
 2 files changed, 23 insertions(+)

diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb
index f8e9888fdd6..77302924e11 100644
--- a/gcc/ada/sem_util.adb
+++ b/gcc/ada/sem_util.adb
@@ -17541,6 +17541,20 @@ package body Sem_Util is
       end if;
    end Is_Expression_Function_Or_Completion;
 
+   -----------------------------------------------
+   -- Is_Extended_Precision_Floating_Point_Type --
+   -----------------------------------------------
+
+   function Is_Extended_Precision_Floating_Point_Type
+     (E : Entity_Id) return Boolean is
+   begin
+      return Is_Floating_Point_Type (E)
+        and then Machine_Radix_Value (E) = Uint_2
+        and then Machine_Mantissa_Value (E) = Uint_64
+        and then Machine_Emax_Value (E) = Uint_2 ** Uint_14
+        and then Machine_Emin_Value (E) = Uint_3 - (Uint_2 ** Uint_14);
+   end Is_Extended_Precision_Floating_Point_Type;
+
    -----------------------
    -- Is_EVF_Expression --
    -----------------------
diff --git a/gcc/ada/sem_util.ads b/gcc/ada/sem_util.ads
index 8b74ab6fe68..e251f1ad9fc 100644
--- a/gcc/ada/sem_util.ads
+++ b/gcc/ada/sem_util.ads
@@ -2045,6 +2045,15 @@ package Sem_Util is
    --  Determine whether subprogram [body] Subp denotes an expression function
    --  or is completed by an expression function body.
 
+   function Is_Extended_Precision_Floating_Point_Type
+     (E : Entity_Id) return Boolean;
+   --  Return whether E is an extended precision floating point type,
+   --  characterized by:
+   --  . machine_radix = 2
+   --  . machine_mantissa = 64
+   --  . machine_emax = 2**14
+   --  . machine_emin = 3 - machine_emax
+
    function Is_EVF_Expression (N : Node_Id) return Boolean;
    --  Determine whether node N denotes a reference to a formal parameter of
    --  a specific tagged type whose related subprogram is subject to pragma


                 reply	other threads:[~2021-12-01 10:26 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211201102604.CE6643858003@sourceware.org \
    --to=pmderodat@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).