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

commit r15-1385-gd78694c238ccb0b530afe3fe5a7afbe7cda8ad4b
Author: Eric Botcazou <ebotca...@adacore.com>
Date:   Mon Jun 17 23:26:21 2024 +0200

    Add minimal support for __bf16 to -fdump-ada-spec
    
    gcc/c-family/
            * c-ada-spec.cc (is_float16): New predicate.
            (dump_ada_node) <REAL_TYPE>: Call it.

Diff:
---
 gcc/c-family/c-ada-spec.cc | 23 ++++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)

diff --git a/gcc/c-family/c-ada-spec.cc b/gcc/c-family/c-ada-spec.cc
index a41e93aeafb8..e1b1b2a4b73f 100644
--- a/gcc/c-family/c-ada-spec.cc
+++ b/gcc/c-family/c-ada-spec.cc
@@ -2077,6 +2077,22 @@ dump_ada_enum_type (pretty_printer *pp, tree node, tree 
type, int spc)
     }
 }
 
+/* Return true if NODE is the __bf16 type.  */
+
+static bool
+is_float16 (tree node)
+{
+  if (!TYPE_NAME (node) || TREE_CODE (TYPE_NAME (node)) != TYPE_DECL)
+    return false;
+
+  tree name = DECL_NAME (TYPE_NAME (node));
+
+  if (IDENTIFIER_POINTER (name) [0] != '_')
+    return false;
+
+  return id_equal (name, "__bf16");
+}
+
 /* Return true if NODE is the _Float32/_Float32x type.  */
 
 static bool
@@ -2210,7 +2226,12 @@ dump_ada_node (pretty_printer *pp, tree node, tree type, 
int spc,
       break;
 
     case REAL_TYPE:
-      if (is_float32 (node))
+      if (is_float16 (node))
+       {
+         pp_string (pp, "Short_Float");
+         break;
+       }
+      else if (is_float32 (node))
        {
          pp_string (pp, "Float");
          break;

Reply via email to