From: Eric Botcazou Date: Sun, 7 Apr 2019 10:34:19 +0000 (+0000) Subject: c-ada-spec.c (is_float128): New predicate extracted from... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=22be58735992f08020817687378d0004ac1ab680;p=gcc.git c-ada-spec.c (is_float128): New predicate extracted from... c-family/ * c-ada-spec.c (is_float128): New predicate extracted from... (dump_ada_node) : Use it to recognize __cfloat128. : ...here. Call it. ada/ * libgnat/i-cexten.ads (CFloat_128): New type. From-SVN: r270188 --- diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 81b5db972c4..7e36b01e9b2 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,7 @@ +2019-04-07 Eric Botcazou + + * libgnat/i-cexten.ads (CFloat_128): New type. + 2019-03-22 Dmitriy Anisimkov PR ada/89583 diff --git a/gcc/ada/libgnat/i-cexten.ads b/gcc/ada/libgnat/i-cexten.ads index bf396a41797..d0a07474662 100644 --- a/gcc/ada/libgnat/i-cexten.ads +++ b/gcc/ada/libgnat/i-cexten.ads @@ -74,7 +74,7 @@ package Interfaces.C.Extensions is for Signed_128'Alignment use unsigned_long_long'Alignment * 2; -- 128-bit floating-point type available on x86: - -- typedef long_double float_128 __attribute__ ((mode (TF))); + -- typedef float float_128 __attribute__ ((mode (TF))); type Float_128 is record low, high : unsigned_long_long; @@ -82,6 +82,14 @@ package Interfaces.C.Extensions is pragma Convention (C_Pass_By_Copy, Float_128); for Float_128'Alignment use unsigned_long_long'Alignment * 2; + -- 128-bit complex floating-point type available on x86: + -- typedef _Complex float cfloat_128 __attribute__ ((mode (TC))); + + type CFloat_128 is record + re, im : Float_128; + end record; + pragma Convention (C_Pass_By_Copy, CFloat_128); + -- Types for bitfields type Unsigned_1 is mod 2 ** 1; diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index f94140359aa..c62395f2acf 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,3 +1,9 @@ +2019-04-07 Eric Botcazou + + * c-ada-spec.c (is_float128): New predicate extracted from... + (dump_ada_node) : Use it to recognize __cfloat128. + : ...here. Call it. + 2019-04-05 David Malcolm PR c/89985 diff --git a/gcc/c-family/c-ada-spec.c b/gcc/c-family/c-ada-spec.c index e3ad8663764..2ca8bdaeaa3 100644 --- a/gcc/c-family/c-ada-spec.c +++ b/gcc/c-family/c-ada-spec.c @@ -2014,6 +2014,22 @@ dump_ada_enum_type (pretty_printer *buffer, tree node, int spc) } } +/* Return true if NODE is the __float128/_Float128 type. */ + +static bool +is_float128 (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, "__float128") || id_equal (name, "_Float128"); +} + static bool bitfield_used = false; /* Recursively dump in BUFFER Ada declarations corresponding to NODE of type @@ -2067,7 +2083,13 @@ dump_ada_node (pretty_printer *buffer, tree node, tree type, int spc, break; case COMPLEX_TYPE: - pp_string (buffer, ""); + if (is_float128 (TREE_TYPE (node))) + { + append_withs ("Interfaces.C.Extensions", false); + pp_string (buffer, "Extensions.CFloat_128"); + } + else + pp_string (buffer, ""); break; case ENUMERAL_TYPE: @@ -2078,11 +2100,7 @@ dump_ada_node (pretty_printer *buffer, tree node, tree type, int spc, break; case REAL_TYPE: - if (TYPE_NAME (node) - && TREE_CODE (TYPE_NAME (node)) == TYPE_DECL - && IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (node))) [0] == '_' - && (id_equal (DECL_NAME (TYPE_NAME (node)), "_Float128") - || id_equal (DECL_NAME (TYPE_NAME (node)), "__float128"))) + if (is_float128 (node)) { append_withs ("Interfaces.C.Extensions", false); pp_string (buffer, "Extensions.Float_128");