]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Add minimal support for __bf16 to -fdump-ada-spec
authorEric Botcazou <ebotcazou@adacore.com>
Mon, 17 Jun 2024 21:26:21 +0000 (23:26 +0200)
committerEric Botcazou <ebotcazou@adacore.com>
Mon, 17 Jun 2024 21:28:19 +0000 (23:28 +0200)
gcc/c-family/
* c-ada-spec.cc (is_float16): New predicate.
(dump_ada_node) <REAL_TYPE>: Call it.

gcc/c-family/c-ada-spec.cc

index a41e93aeafb81441c978ebb312209daea1fa4233..e1b1b2a4b73f703b04b04c757a5c097e79ce3fe4 100644 (file)
@@ -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;