public inbox for gcc-regression@sourceware.org
help / color / mirror / Atom feed
* [TCWG CI] Failure after basepoints/gcc-13-2887-gb04208895fe: c++: Implement P1467R9 - Extended floating-point types and standard names compiler part except for bfloat16 [PR106652]
@ 2022-09-28 16:42 ci_notify
  0 siblings, 0 replies; 2+ messages in thread
From: ci_notify @ 2022-09-28 16:42 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: gcc-regression

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

Failure after basepoints/gcc-13-2887-gb04208895fe: c++: Implement P1467R9 - Extended floating-point types and standard names compiler part except for bfloat16 [PR106652]:

Results changed to
-10
# true:
0
# build_abe binutils:
1
# build_abe bootstrap_debug:
# FAILED
# First few build errors in logs:
# 00:00:29     /usr/include/bits/floatn.h:86:9: error: multiple types in one declaration
# 00:00:29     /usr/include/bits/floatn.h:86:20: error: declaration does not declare anything [-fpermissive]
# 00:00:29     /usr/include/bits/floatn-common.h:214:9: error: multiple types in one declaration
# 00:00:29     /usr/include/bits/floatn-common.h:214:15: error: declaration does not declare anything [-fpermissive]
# 00:00:29     /usr/include/bits/floatn-common.h:251:9: error: multiple types in one declaration
# 00:00:29     /usr/include/bits/floatn-common.h:251:16: error: declaration does not declare anything [-fpermissive]
# 00:08:09 make[3]: [Makefile:1787: aarch64-unknown-linux-gnu/bits/largefile-config.h] Error 1 (ignored)
# 00:08:09 make[3]: [Makefile:1788: aarch64-unknown-linux-gnu/bits/largefile-config.h] Error 1 (ignored)
# 00:08:10 /usr/include/aarch64-linux-gnu/bits/floatn.h:80:14: error: multiple types in one declaration
# 00:08:10 /usr/include/aarch64-linux-gnu/bits/floatn.h:80:21: error: declaration does not declare anything [-fpermissive]

from
-10
# true:
0
# build_abe binutils:
1
# build_abe bootstrap_debug:
2

THIS IS THE END OF INTERESTING STUFF.  BELOW ARE LINKS TO BUILDS, REPRODUCTION INSTRUCTIONS, AND THE RAW COMMIT.

For latest status see comments in https://linaro.atlassian.net/browse/GNU-692 .
Status of basepoints/gcc-13-2887-gb04208895fe commit for tcwg_gcc_bootstrap:
commit b04208895fed34171eac6bafb60c90048eb1cb0c
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Tue Sep 27 08:04:06 2022 +0200

    c++: Implement P1467R9 - Extended floating-point types and standard names compiler part except for bfloat16 [PR106652]
    
    The following patch implements the compiler part of C++23
    P1467R9 - Extended floating-point types and standard names compiler part
    by introducing _Float{16,32,64,128} as keywords and builtin types
    like they are implemented for C already since GCC 7, with DF{16,32,64,128}_
    mangling.
    It also introduces _Float{32,64,128}x for C++ with the
    https://github.com/itanium-cxx-abi/cxx-abi/pull/147
    proposed mangling of DF{32,64,128}x.
    The patch doesn't add anything for bfloat16_t support, as right now
    __bf16 type refuses all conversions and arithmetic operations.
    The patch wants to keep backwards compatibility with how __float128 has
    been handled in C++ before, both for mangling and behavior in binary
    operations, overload resolution etc.  So, there are some backend changes
    where for C __float128 and _Float128 are the same type (float128_type_node
    and float128t_type_node are the same pointer), but for C++ they are distinct
    types which mangle differently and _Float128 is treated as extended
    floating-point type while __float128 is treated as non-standard floating
    point type.  The various C++23 changes about how floating-point types
    are changed are actually implemented as written in the spec only if at least
    one of the types involved is _Float{16,32,64,128,32x,64x,128x} (_FloatNx are
    also treated as extended floating-point types) and kept previous behavior
    otherwise.  For float/double/long double the rules are actually written that
    they behave the same as before.
    There is some backwards incompatibility at least on x86 regarding _Float16,
    because that type was already used by that name and with the DF16_ mangling
    (but only since GCC 12 and I think it isn't that widely used in the wild
    yet).  E.g. config/i386/avx512fp16intrin.h shows the issues, where
    in C or in GCC 12 in C++ one could pass 0.0f to a builtin taking _Float16
    argument, but with the changes that is not possible anymore, one needs
    to either use 0.0f16 or (_Float16) 0.0f.
    We have also a problem with glibc headers, where since glibc 2.27
    math.h and complex.h aren't compilable with these changes.  One gets
    errors like:
    In file included from /usr/include/math.h:43,
                     from abc.c:1:
    /usr/include/bits/floatn.h:86:9: error: multiple types in one declaration
       86 | typedef __float128 _Float128;
          |         ^~~~~~~~~~
    /usr/include/bits/floatn.h:86:20: error: declaration does not declare anything [-fpermissive]
       86 | typedef __float128 _Float128;
          |                    ^~~~~~~~~
    In file included from /usr/include/bits/floatn.h:119:
    /usr/include/bits/floatn-common.h:214:9: error: multiple types in one declaration
      214 | typedef float _Float32;
          |         ^~~~~
    /usr/include/bits/floatn-common.h:214:15: error: declaration does not declare anything [-fpermissive]
      214 | typedef float _Float32;
          |               ^~~~~~~~
    /usr/include/bits/floatn-common.h:251:9: error: multiple types in one declaration
      251 | typedef double _Float64;
          |         ^~~~~~
    /usr/include/bits/floatn-common.h:251:16: error: declaration does not declare anything [-fpermissive]
      251 | typedef double _Float64;
          |                ^~~~~~~~
    This is from snippets like:
     /* The remaining of this file provides support for older compilers.  */
     # if __HAVE_FLOAT128
    
     /* The type _Float128 exists only since GCC 7.0.  */
     #  if !__GNUC_PREREQ (7, 0) || defined __cplusplus
     typedef __float128 _Float128;
     #  endif
    where it hardcodes that C++ doesn't have _Float{16,32,64,128,32x,64x,128x} support nor
    {f,F}{16,32,64,128}{,x} literal suffixes nor _Complex _Float{16,32,64,128,32x,64x,128x}.
    The patch fixincludes this for now and hopefully if this is committed, then
    glibc can change those.  The patch changes those
     #  if !__GNUC_PREREQ (7, 0) || defined __cplusplus
    conditions to
     #  if !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0))
    Another thing is mangling, as said above, Itanium C++ ABI specifies
    DF <number> _ as _Float{16,32,64,128} mangling, but GCC was implementing
    a mangling incompatible with that starting with DF for fixed point types.
    Fixed point was never supported in C++ though, I believe the reason why
    the mangling has been added was that due to a bug it would leak into the
    C++ FE through decltype (0.0r) etc.  But that has been shortly after the
    mangling was added fixed (I think in the same GCC release cycle), so we
    now reject 0.0r etc. in C++.  If we ever need the fixed point mangling,
    I think it can be readded but better with a different prefix so that it
    doesn't conflict with the published standard manglings.  So, this patch
    also kills the fixed point mangling and implements the DF <number> _
    demangling.
    The patch predefines __STDCPP_FLOAT{16,32,64,128}_T__ macros when
    those types are available, but only for C++23, while the underlying types
    are available in C++98 and later including the {f,F}{16,32,64,128} literal
    suffixes (but those with a pedwarn for C++20 and earlier).  My understanding
    is that it needs to be predefined by the compiler, on the other side
    predefining even for older modes when <stdfloat> is a new C++23 header
    would be weird.  One can find out if _Float{16,32,64,128,32x,64x,128x} is
    supported in C++ by
    __GNUC__ >= 13 && defined(__FLT{16,32,64,128,32X,64X,128X}_MANT_DIG__)
    (but that doesn't work well with older G++ 13 snapshots).
    
    As for std::bfloat16_t, three targets (aarch64, arm and x86) apparently
    "support" __bf16 type which has the bfloat16 format, but isn't really
    usable, e.g. {aarch64,arm,ix86}_invalid_conversion disallow any conversions
    from or to type with BFmode, {aarch64,arm,ix86}_invalid_unary_op disallows
    any unary operations on those except for ADDR_EXPR and
    {aarch64,arm,ix86}_invalid_binary_op disallows any binary operation on
    those.  So, I think we satisfy:
    "If the implementation supports an extended floating-point type with the
    properties, as specified by ISO/IEC/IEEE 60559, of radix (b) of 2, storage
    width in bits (k) of 16, precision in bits (p) of 8, maximum exponent (emax)
    of 127, and exponent field width in bits (w) of 8, then the typedef-name
    std::bfloat16_t is defined in the header <stdfloat> and names such a type,
    the macro __STDCPP_BFLOAT16_T__ is defined, and the floating-point literal
    suffixes bf16 and BF16 are supported."
    because we don't really support those right now.
    
    2022-09-27  Jakub Jelinek  <jakub@redhat.com>
    
            PR c++/106652
            PR c++/85518
    gcc/
            * tree-core.h (enum tree_index): Add TI_FLOAT128T_TYPE
            enumerator.
            * tree.h (float128t_type_node): Define.
            * tree.cc (build_common_tree_nodes): Initialize float128t_type_node.
            * builtins.def (DEF_FLOATN_BUILTIN): Adjust comment now that
            _Float<N> is supported in C++ too.
            * config/i386/i386.cc (ix86_mangle_type): Only mangle as "g"
            float128t_type_node.
            * config/i386/i386-builtins.cc (ix86_init_builtin_types): Use
            float128t_type_node for __float128 instead of float128_type_node
            and create it if NULL.
            * config/i386/avx512fp16intrin.h (_mm_setzero_ph, _mm256_setzero_ph,
            _mm512_setzero_ph, _mm_set_sh, _mm_load_sh): Use 0.0f16 instead of
            0.0f.
            * config/ia64/ia64.cc (ia64_init_builtins): Use
            float128t_type_node for __float128 instead of float128_type_node
            and create it if NULL.
            * config/rs6000/rs6000-c.cc (is_float128_p): Also return true
            for float128t_type_node if non-NULL.
            * config/rs6000/rs6000.cc (rs6000_mangle_type): Don't mangle
            float128_type_node as "u9__ieee128".
            * config/rs6000/rs6000-builtin.cc (rs6000_init_builtins): Use
            float128t_type_node for __float128 instead of float128_type_node
            and create it if NULL.
    gcc/c-family/
            * c-common.cc (c_common_reswords): Change _Float{16,32,64,128} and
            _Float{32,64,128}x flags from D_CONLY to 0.
            (shorten_binary_op): Punt if common_type returns error_mark_node.
            (shorten_compare): Likewise.
            (c_common_nodes_and_builtins): For C++ record _Float{16,32,64,128}
            and _Float{32,64,128}x builtin types if available.  For C++
            clear float128t_type_node.
            * c-cppbuiltin.cc (c_cpp_builtins): Predefine
            __STDCPP_FLOAT{16,32,64,128}_T__ for C++23 if supported.
            * c-lex.cc (interpret_float): For q/Q suffixes prefer
            float128t_type_node over float128_type_node.  Allow
            {f,F}{16,32,64,128} suffixes for C++ if supported with pedwarn
            for C++20 and older.  Allow {f,F}{32,64,128}x suffixes for C++
            with pedwarn.  Don't call excess_precision_type for C++.
    gcc/cp/
            * cp-tree.h (cp_compare_floating_point_conversion_ranks): Implement
            P1467R9 - Extended floating-point types and standard names except
            for std::bfloat16_t for now.  Declare.
            (extended_float_type_p): New inline function.
            * mangle.cc (write_builtin_type): Mangle float{16,32,64,128}_type_node
            as DF{16,32,64,128}_.  Mangle float{32,64,128}x_type_node as
            DF{32,64,128}x.  Remove FIXED_POINT_TYPE mangling that conflicts
            with that.
            * typeck2.cc (check_narrowing): If one of ftype or type is extended
            floating-point type, compare floating-point conversion ranks.
            * parser.cc (cp_keyword_starts_decl_specifier_p): Handle
            CASE_RID_FLOATN_NX.
            (cp_parser_simple_type_specifier): Likewise and diagnose missing
            _Float<N> or _Float<N>x support if not supported by target.
            * typeck.cc (cp_compare_floating_point_conversion_ranks): New function.
            (cp_common_type): If both types are REAL_TYPE and one or both are
            extended floating-point types, select common type based on comparison
            of floating-point conversion ranks and subranks.
            (cp_build_binary_op): Diagnose operation with floating point arguments
            with unordered conversion ranks.
            * call.cc (standard_conversion): For floating-point conversion, if
            either from or to are extended floating-point types, set conv->bad_p
            for implicit conversion from larger to smaller conversion rank or
            with unordered conversion ranks.
            (convert_like_internal): Emit a pedwarn on such conversions.
            (build_conditional_expr): Diagnose operation with floating point
            arguments with unordered conversion ranks.
            (convert_arg_to_ellipsis): Don't promote extended floating-point types
            narrower than double to double.
            (compare_ics): Implement P1467R9 [over.ics.rank]/4 changes.
    gcc/testsuite/
            * g++.dg/cpp23/ext-floating1.C: New test.
            * g++.dg/cpp23/ext-floating2.C: New test.
            * g++.dg/cpp23/ext-floating3.C: New test.
            * g++.dg/cpp23/ext-floating4.C: New test.
            * g++.dg/cpp23/ext-floating5.C: New test.
            * g++.dg/cpp23/ext-floating6.C: New test.
            * g++.dg/cpp23/ext-floating7.C: New test.
            * g++.dg/cpp23/ext-floating8.C: New test.
            * g++.dg/cpp23/ext-floating9.C: New test.
            * g++.dg/cpp23/ext-floating10.C: New test.
            * g++.dg/cpp23/ext-floating.h: New file.
            * g++.target/i386/float16-1.C: Adjust expected diagnostics.
    libcpp/
            * expr.cc (interpret_float_suffix): Allow {f,F}{16,32,64,128} and
            {f,F}{32,64,128}x suffixes for C++.
    include/
            * demangle.h (enum demangle_component_type): Add
            DEMANGLE_COMPONENT_EXTENDED_BUILTIN_TYPE.
            (struct demangle_component): Add u.s_extended_builtin member.
    libiberty/
            * cp-demangle.c (d_dump): Handle
            DEMANGLE_COMPONENT_EXTENDED_BUILTIN_TYPE.  Don't handle
            DEMANGLE_COMPONENT_FIXED_TYPE.
            (d_make_extended_builtin_type): New function.
            (cplus_demangle_builtin_types): Add _Float entry.
            (cplus_demangle_type): For DF demangle it as _Float<N> or
            _Float<N>x rather than fixed point which conflicts with it.
            (d_count_templates_scopes): Handle
            DEMANGLE_COMPONENT_EXTENDED_BUILTIN_TYPE.  Just break; for
            DEMANGLE_COMPONENT_FIXED_TYPE.
            (d_find_pack): Handle DEMANGLE_COMPONENT_EXTENDED_BUILTIN_TYPE.
            Don't handle DEMANGLE_COMPONENT_FIXED_TYPE.
            (d_print_comp_inner): Likewise.
            * cp-demangle.h (D_BUILTIN_TYPE_COUNT): Bump.
            * testsuite/demangle-expected: Replace _Z3xxxDFyuVb test
            with _Z3xxxDF16_DF32_DF64_DF128_CDF16_Vb.  Add
            _Z3xxxDF32xDF64xDF128xCDF32xVb test.
    fixincludes/
            * inclhack.def (glibc_cxx_floatn_1, glibc_cxx_floatn_2,
            glibc_cxx_floatn_3): New fixes.
            * tests/base/bits/floatn.h: New file.
            * fixincl.x: Regenerated.
* master-aarch64-bootstrap_debug
** Failure after basepoints/gcc-13-2887-gb04208895fe: c++: Implement P1467R9 - Extended floating-point types and standard names compiler part except for bfloat16 [PR106652]:
** https://ci.linaro.org/job/tcwg_gcc_bootstrap-build-master-aarch64-bootstrap_debug/440/

Bad  build: https://ci.linaro.org/job/tcwg_gcc_bootstrap-build-master-aarch64-bootstrap_debug/440/artifact/artifacts
Good build: https://ci.linaro.org/job/tcwg_gcc_bootstrap-build-master-aarch64-bootstrap_debug/439/artifact/artifacts

Reproduce current build:
<cut>
mkdir -p investigate-gcc-b04208895fed34171eac6bafb60c90048eb1cb0c
cd investigate-gcc-b04208895fed34171eac6bafb60c90048eb1cb0c

# Fetch scripts
git clone https://git.linaro.org/toolchain/jenkins-scripts

# Fetch manifests for bad and good builds
mkdir -p bad/artifacts good/artifacts
curl -o bad/artifacts/manifest.sh https://ci.linaro.org/job/tcwg_gcc_bootstrap-build-master-aarch64-bootstrap_debug/440/artifact/artifacts/manifest.sh --fail
curl -o good/artifacts/manifest.sh https://ci.linaro.org/job/tcwg_gcc_bootstrap-build-master-aarch64-bootstrap_debug/439/artifact/artifacts/manifest.sh --fail

# Reproduce bad build
(cd bad; ../jenkins-scripts/tcwg_gnu-build.sh ^^ true %%rr[top_artifacts] artifacts)
# Reproduce good build
(cd good; ../jenkins-scripts/tcwg_gnu-build.sh ^^ true %%rr[top_artifacts] artifacts)
</cut>

Full commit (up to 1000 lines):
<cut>
commit b04208895fed34171eac6bafb60c90048eb1cb0c
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Tue Sep 27 08:04:06 2022 +0200

    c++: Implement P1467R9 - Extended floating-point types and standard names compiler part except for bfloat16 [PR106652]
    
    The following patch implements the compiler part of C++23
    P1467R9 - Extended floating-point types and standard names compiler part
    by introducing _Float{16,32,64,128} as keywords and builtin types
    like they are implemented for C already since GCC 7, with DF{16,32,64,128}_
    mangling.
    It also introduces _Float{32,64,128}x for C++ with the
    https://github.com/itanium-cxx-abi/cxx-abi/pull/147
    proposed mangling of DF{32,64,128}x.
    The patch doesn't add anything for bfloat16_t support, as right now
    __bf16 type refuses all conversions and arithmetic operations.
    The patch wants to keep backwards compatibility with how __float128 has
    been handled in C++ before, both for mangling and behavior in binary
    operations, overload resolution etc.  So, there are some backend changes
    where for C __float128 and _Float128 are the same type (float128_type_node
    and float128t_type_node are the same pointer), but for C++ they are distinct
    types which mangle differently and _Float128 is treated as extended
    floating-point type while __float128 is treated as non-standard floating
    point type.  The various C++23 changes about how floating-point types
    are changed are actually implemented as written in the spec only if at least
    one of the types involved is _Float{16,32,64,128,32x,64x,128x} (_FloatNx are
    also treated as extended floating-point types) and kept previous behavior
    otherwise.  For float/double/long double the rules are actually written that
    they behave the same as before.
    There is some backwards incompatibility at least on x86 regarding _Float16,
    because that type was already used by that name and with the DF16_ mangling
    (but only since GCC 12 and I think it isn't that widely used in the wild
    yet).  E.g. config/i386/avx512fp16intrin.h shows the issues, where
    in C or in GCC 12 in C++ one could pass 0.0f to a builtin taking _Float16
    argument, but with the changes that is not possible anymore, one needs
    to either use 0.0f16 or (_Float16) 0.0f.
    We have also a problem with glibc headers, where since glibc 2.27
    math.h and complex.h aren't compilable with these changes.  One gets
    errors like:
    In file included from /usr/include/math.h:43,
                     from abc.c:1:
    /usr/include/bits/floatn.h:86:9: error: multiple types in one declaration
       86 | typedef __float128 _Float128;
          |         ^~~~~~~~~~
    /usr/include/bits/floatn.h:86:20: error: declaration does not declare anything [-fpermissive]
       86 | typedef __float128 _Float128;
          |                    ^~~~~~~~~
    In file included from /usr/include/bits/floatn.h:119:
    /usr/include/bits/floatn-common.h:214:9: error: multiple types in one declaration
      214 | typedef float _Float32;
          |         ^~~~~
    /usr/include/bits/floatn-common.h:214:15: error: declaration does not declare anything [-fpermissive]
      214 | typedef float _Float32;
          |               ^~~~~~~~
    /usr/include/bits/floatn-common.h:251:9: error: multiple types in one declaration
      251 | typedef double _Float64;
          |         ^~~~~~
    /usr/include/bits/floatn-common.h:251:16: error: declaration does not declare anything [-fpermissive]
      251 | typedef double _Float64;
          |                ^~~~~~~~
    This is from snippets like:
     /* The remaining of this file provides support for older compilers.  */
     # if __HAVE_FLOAT128
    
     /* The type _Float128 exists only since GCC 7.0.  */
     #  if !__GNUC_PREREQ (7, 0) || defined __cplusplus
     typedef __float128 _Float128;
     #  endif
    where it hardcodes that C++ doesn't have _Float{16,32,64,128,32x,64x,128x} support nor
    {f,F}{16,32,64,128}{,x} literal suffixes nor _Complex _Float{16,32,64,128,32x,64x,128x}.
    The patch fixincludes this for now and hopefully if this is committed, then
    glibc can change those.  The patch changes those
     #  if !__GNUC_PREREQ (7, 0) || defined __cplusplus
    conditions to
     #  if !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0))
    Another thing is mangling, as said above, Itanium C++ ABI specifies
    DF <number> _ as _Float{16,32,64,128} mangling, but GCC was implementing
    a mangling incompatible with that starting with DF for fixed point types.
    Fixed point was never supported in C++ though, I believe the reason why
    the mangling has been added was that due to a bug it would leak into the
    C++ FE through decltype (0.0r) etc.  But that has been shortly after the
    mangling was added fixed (I think in the same GCC release cycle), so we
    now reject 0.0r etc. in C++.  If we ever need the fixed point mangling,
    I think it can be readded but better with a different prefix so that it
    doesn't conflict with the published standard manglings.  So, this patch
    also kills the fixed point mangling and implements the DF <number> _
    demangling.
    The patch predefines __STDCPP_FLOAT{16,32,64,128}_T__ macros when
    those types are available, but only for C++23, while the underlying types
    are available in C++98 and later including the {f,F}{16,32,64,128} literal
    suffixes (but those with a pedwarn for C++20 and earlier).  My understanding
    is that it needs to be predefined by the compiler, on the other side
    predefining even for older modes when <stdfloat> is a new C++23 header
    would be weird.  One can find out if _Float{16,32,64,128,32x,64x,128x} is
    supported in C++ by
    __GNUC__ >= 13 && defined(__FLT{16,32,64,128,32X,64X,128X}_MANT_DIG__)
    (but that doesn't work well with older G++ 13 snapshots).
    
    As for std::bfloat16_t, three targets (aarch64, arm and x86) apparently
    "support" __bf16 type which has the bfloat16 format, but isn't really
    usable, e.g. {aarch64,arm,ix86}_invalid_conversion disallow any conversions
    from or to type with BFmode, {aarch64,arm,ix86}_invalid_unary_op disallows
    any unary operations on those except for ADDR_EXPR and
    {aarch64,arm,ix86}_invalid_binary_op disallows any binary operation on
    those.  So, I think we satisfy:
    "If the implementation supports an extended floating-point type with the
    properties, as specified by ISO/IEC/IEEE 60559, of radix (b) of 2, storage
    width in bits (k) of 16, precision in bits (p) of 8, maximum exponent (emax)
    of 127, and exponent field width in bits (w) of 8, then the typedef-name
    std::bfloat16_t is defined in the header <stdfloat> and names such a type,
    the macro __STDCPP_BFLOAT16_T__ is defined, and the floating-point literal
    suffixes bf16 and BF16 are supported."
    because we don't really support those right now.
    
    2022-09-27  Jakub Jelinek  <jakub@redhat.com>
    
            PR c++/106652
            PR c++/85518
    gcc/
            * tree-core.h (enum tree_index): Add TI_FLOAT128T_TYPE
            enumerator.
            * tree.h (float128t_type_node): Define.
            * tree.cc (build_common_tree_nodes): Initialize float128t_type_node.
            * builtins.def (DEF_FLOATN_BUILTIN): Adjust comment now that
            _Float<N> is supported in C++ too.
            * config/i386/i386.cc (ix86_mangle_type): Only mangle as "g"
            float128t_type_node.
            * config/i386/i386-builtins.cc (ix86_init_builtin_types): Use
            float128t_type_node for __float128 instead of float128_type_node
            and create it if NULL.
            * config/i386/avx512fp16intrin.h (_mm_setzero_ph, _mm256_setzero_ph,
            _mm512_setzero_ph, _mm_set_sh, _mm_load_sh): Use 0.0f16 instead of
            0.0f.
            * config/ia64/ia64.cc (ia64_init_builtins): Use
            float128t_type_node for __float128 instead of float128_type_node
            and create it if NULL.
            * config/rs6000/rs6000-c.cc (is_float128_p): Also return true
            for float128t_type_node if non-NULL.
            * config/rs6000/rs6000.cc (rs6000_mangle_type): Don't mangle
            float128_type_node as "u9__ieee128".
            * config/rs6000/rs6000-builtin.cc (rs6000_init_builtins): Use
            float128t_type_node for __float128 instead of float128_type_node
            and create it if NULL.
    gcc/c-family/
            * c-common.cc (c_common_reswords): Change _Float{16,32,64,128} and
            _Float{32,64,128}x flags from D_CONLY to 0.
            (shorten_binary_op): Punt if common_type returns error_mark_node.
            (shorten_compare): Likewise.
            (c_common_nodes_and_builtins): For C++ record _Float{16,32,64,128}
            and _Float{32,64,128}x builtin types if available.  For C++
            clear float128t_type_node.
            * c-cppbuiltin.cc (c_cpp_builtins): Predefine
            __STDCPP_FLOAT{16,32,64,128}_T__ for C++23 if supported.
            * c-lex.cc (interpret_float): For q/Q suffixes prefer
            float128t_type_node over float128_type_node.  Allow
            {f,F}{16,32,64,128} suffixes for C++ if supported with pedwarn
            for C++20 and older.  Allow {f,F}{32,64,128}x suffixes for C++
            with pedwarn.  Don't call excess_precision_type for C++.
    gcc/cp/
            * cp-tree.h (cp_compare_floating_point_conversion_ranks): Implement
            P1467R9 - Extended floating-point types and standard names except
            for std::bfloat16_t for now.  Declare.
            (extended_float_type_p): New inline function.
            * mangle.cc (write_builtin_type): Mangle float{16,32,64,128}_type_node
            as DF{16,32,64,128}_.  Mangle float{32,64,128}x_type_node as
            DF{32,64,128}x.  Remove FIXED_POINT_TYPE mangling that conflicts
            with that.
            * typeck2.cc (check_narrowing): If one of ftype or type is extended
            floating-point type, compare floating-point conversion ranks.
            * parser.cc (cp_keyword_starts_decl_specifier_p): Handle
            CASE_RID_FLOATN_NX.
            (cp_parser_simple_type_specifier): Likewise and diagnose missing
            _Float<N> or _Float<N>x support if not supported by target.
            * typeck.cc (cp_compare_floating_point_conversion_ranks): New function.
            (cp_common_type): If both types are REAL_TYPE and one or both are
            extended floating-point types, select common type based on comparison
            of floating-point conversion ranks and subranks.
            (cp_build_binary_op): Diagnose operation with floating point arguments
            with unordered conversion ranks.
            * call.cc (standard_conversion): For floating-point conversion, if
            either from or to are extended floating-point types, set conv->bad_p
            for implicit conversion from larger to smaller conversion rank or
            with unordered conversion ranks.
            (convert_like_internal): Emit a pedwarn on such conversions.
            (build_conditional_expr): Diagnose operation with floating point
            arguments with unordered conversion ranks.
            (convert_arg_to_ellipsis): Don't promote extended floating-point types
            narrower than double to double.
            (compare_ics): Implement P1467R9 [over.ics.rank]/4 changes.
    gcc/testsuite/
            * g++.dg/cpp23/ext-floating1.C: New test.
            * g++.dg/cpp23/ext-floating2.C: New test.
            * g++.dg/cpp23/ext-floating3.C: New test.
            * g++.dg/cpp23/ext-floating4.C: New test.
            * g++.dg/cpp23/ext-floating5.C: New test.
            * g++.dg/cpp23/ext-floating6.C: New test.
            * g++.dg/cpp23/ext-floating7.C: New test.
            * g++.dg/cpp23/ext-floating8.C: New test.
            * g++.dg/cpp23/ext-floating9.C: New test.
            * g++.dg/cpp23/ext-floating10.C: New test.
            * g++.dg/cpp23/ext-floating.h: New file.
            * g++.target/i386/float16-1.C: Adjust expected diagnostics.
    libcpp/
            * expr.cc (interpret_float_suffix): Allow {f,F}{16,32,64,128} and
            {f,F}{32,64,128}x suffixes for C++.
    include/
            * demangle.h (enum demangle_component_type): Add
            DEMANGLE_COMPONENT_EXTENDED_BUILTIN_TYPE.
            (struct demangle_component): Add u.s_extended_builtin member.
    libiberty/
            * cp-demangle.c (d_dump): Handle
            DEMANGLE_COMPONENT_EXTENDED_BUILTIN_TYPE.  Don't handle
            DEMANGLE_COMPONENT_FIXED_TYPE.
            (d_make_extended_builtin_type): New function.
            (cplus_demangle_builtin_types): Add _Float entry.
            (cplus_demangle_type): For DF demangle it as _Float<N> or
            _Float<N>x rather than fixed point which conflicts with it.
            (d_count_templates_scopes): Handle
            DEMANGLE_COMPONENT_EXTENDED_BUILTIN_TYPE.  Just break; for
            DEMANGLE_COMPONENT_FIXED_TYPE.
            (d_find_pack): Handle DEMANGLE_COMPONENT_EXTENDED_BUILTIN_TYPE.
            Don't handle DEMANGLE_COMPONENT_FIXED_TYPE.
            (d_print_comp_inner): Likewise.
            * cp-demangle.h (D_BUILTIN_TYPE_COUNT): Bump.
            * testsuite/demangle-expected: Replace _Z3xxxDFyuVb test
            with _Z3xxxDF16_DF32_DF64_DF128_CDF16_Vb.  Add
            _Z3xxxDF32xDF64xDF128xCDF32xVb test.
    fixincludes/
            * inclhack.def (glibc_cxx_floatn_1, glibc_cxx_floatn_2,
            glibc_cxx_floatn_3): New fixes.
            * tests/base/bits/floatn.h: New file.
            * fixincl.x: Regenerated.
---
 fixincludes/fixincl.x                       | 154 +++++++++-
 fixincludes/inclhack.def                    |  96 ++++++
 fixincludes/tests/base/bits/floatn.h        |  74 +++++
 gcc/builtins.def                            |   5 +-
 gcc/c-family/c-common.cc                    |  37 ++-
 gcc/c-family/c-cppbuiltin.cc                |   8 +
 gcc/c-family/c-lex.cc                       |  20 +-
 gcc/config/i386/avx512fp16intrin.h          |  11 +-
 gcc/config/i386/i386-builtins.cc            |  15 +-
 gcc/config/i386/i386.cc                     |   5 +-
 gcc/config/ia64/ia64.cc                     |  24 +-
 gcc/config/rs6000/rs6000-builtin.cc         |  17 +-
 gcc/config/rs6000/rs6000-c.cc               |   1 +
 gcc/config/rs6000/rs6000.cc                 |   6 +-
 gcc/cp/call.cc                              | 130 +++++++-
 gcc/cp/cp-tree.h                            |  13 +
 gcc/cp/mangle.cc                            |  67 +----
 gcc/cp/parser.cc                            |   9 +
 gcc/cp/typeck.cc                            | 172 ++++++++++-
 gcc/cp/typeck2.cc                           |  25 +-
 gcc/testsuite/g++.dg/cpp23/ext-floating.h   |  30 ++
 gcc/testsuite/g++.dg/cpp23/ext-floating1.C  | 447 ++++++++++++++++++++++++++++
 gcc/testsuite/g++.dg/cpp23/ext-floating10.C |  13 +
 gcc/testsuite/g++.dg/cpp23/ext-floating2.C  | 157 ++++++++++
 gcc/testsuite/g++.dg/cpp23/ext-floating3.C  | 134 +++++++++
 gcc/testsuite/g++.dg/cpp23/ext-floating4.C  | 126 ++++++++
 gcc/testsuite/g++.dg/cpp23/ext-floating5.C  |  13 +
 gcc/testsuite/g++.dg/cpp23/ext-floating6.C  |  30 ++
 gcc/testsuite/g++.dg/cpp23/ext-floating7.C  | 119 ++++++++
 gcc/testsuite/g++.dg/cpp23/ext-floating8.C  |  13 +
 gcc/testsuite/g++.dg/cpp23/ext-floating9.C  |  13 +
 gcc/testsuite/g++.target/i386/float16-1.C   |   4 +-
 gcc/tree-core.h                             |   4 +
 gcc/tree.cc                                 |   1 +
 gcc/tree.h                                  |   4 +
 include/demangle.h                          |  14 +
 libcpp/expr.cc                              |   1 -
 libiberty/cp-demangle.c                     | 100 ++++---
 libiberty/cp-demangle.h                     |   2 +-
 libiberty/testsuite/demangle-expected       |   8 +-
 40 files changed, 1974 insertions(+), 148 deletions(-)

diff --git a/fixincludes/fixincl.x b/fixincludes/fixincl.x
index bad490453b7..56c37b7fd08 100644
--- a/fixincludes/fixincl.x
+++ b/fixincludes/fixincl.x
@@ -2,11 +2,11 @@
  *
  * DO NOT EDIT THIS FILE   (fixincl.x)
  *
- * It has been AutoGen-ed  February 27, 2022 at 07:47:03 PM by AutoGen 5.18.16
+ * It has been AutoGen-ed  September 27, 2022 at 12:49:21 AM by AutoGen 5.18.16
  * From the definitions    inclhack.def
  * and the template file   fixincl
  */
-/* DO NOT SVN-MERGE THIS FILE, EITHER Sun Feb 27 19:47:03 UTC 2022
+/* DO NOT SVN-MERGE THIS FILE, EITHER Tue Sep 27 00:49:21 CEST 2022
  *
  * You must regenerate it.  Use the ./genfixes script.
  *
@@ -15,7 +15,7 @@
  * certain ANSI-incompatible system header files which are fixed to work
  * correctly with ANSI C and placed in a directory that GNU C will search.
  *
- * This file contains 267 fixup descriptions.
+ * This file contains 270 fixup descriptions.
  *
  * See README for more information.
  *
@@ -4105,6 +4105,132 @@ static const char* apzGlibc_C99_Inline_4Patch[] = {
     "%0 __attribute__ ((__gnu_inline__))",
     (char*)NULL };
 
+/* * * * * * * * * * * * * * * * * * * * * * * * * *
+ *
+ *  Description of Glibc_Cxx_Floatn_1 fix
+ */
+tSCC zGlibc_Cxx_Floatn_1Name[] =
+     "glibc_cxx_floatn_1";
+
+/*
+ *  File name selection pattern
+ */
+tSCC zGlibc_Cxx_Floatn_1List[] =
+  "bits/floatn.h\0bits/floatn-common.h\0";
+/*
+ *  Machine/OS name selection pattern
+ */
+#define apzGlibc_Cxx_Floatn_1Machs (const char**)NULL
+
+/*
+ *  content selection pattern - do fix if pattern found
+ */
+tSCC zGlibc_Cxx_Floatn_1Select0[] =
+       "^([ \t]*#[ \t]*if !__GNUC_PREREQ \\(7, 0\\) \\|\\| )defined __cplusplus\n\
+(([ \t]*/\\*[^\n\
+]*\\*/\n\
+)?([ \t]*#[ \t]*if[^\n\
+]*\n\
+)?[ \t]*#[ \t]*define __f(16|32|64|128)x?\\()";
+
+#define    GLIBC_CXX_FLOATN_1_TEST_CT  1
+static tTestDesc aGlibc_Cxx_Floatn_1Tests[] = {
+  { TT_EGREP,    zGlibc_Cxx_Floatn_1Select0, (regex_t*)NULL }, };
+
+/*
+ *  Fix Command Arguments for Glibc_Cxx_Floatn_1
+ */
+static const char* apzGlibc_Cxx_Floatn_1Patch[] = {
+    "format",
+    "%1(defined __cplusplus && !__GNUC_PREREQ (13, 0))\n\
+%2",
+    (char*)NULL };
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * *
+ *
+ *  Description of Glibc_Cxx_Floatn_2 fix
+ */
+tSCC zGlibc_Cxx_Floatn_2Name[] =
+     "glibc_cxx_floatn_2";
+
+/*
+ *  File name selection pattern
+ */
+tSCC zGlibc_Cxx_Floatn_2List[] =
+  "bits/floatn.h\0bits/floatn-common.h\0";
+/*
+ *  Machine/OS name selection pattern
+ */
+#define apzGlibc_Cxx_Floatn_2Machs (const char**)NULL
+
+/*
+ *  content selection pattern - do fix if pattern found
+ */
+tSCC zGlibc_Cxx_Floatn_2Select0[] =
+       "^([ \t]*#[ \t]*if !__GNUC_PREREQ \\(7, 0\\) \\|\\| )defined __cplusplus\n\
+(([ \t]*/\\*[^\n\
+]*\\*/\n\
+)?[ \t]*typedef[ \t]+[^\n\
+]*[ \t]+_Float(16|32|64|128)x?([ \t]+__attribute__ \\(\\(__mode__ \\(__HF__\\)\\)\\))?;)";
+
+#define    GLIBC_CXX_FLOATN_2_TEST_CT  1
+static tTestDesc aGlibc_Cxx_Floatn_2Tests[] = {
+  { TT_EGREP,    zGlibc_Cxx_Floatn_2Select0, (regex_t*)NULL }, };
+
+/*
+ *  Fix Command Arguments for Glibc_Cxx_Floatn_2
+ */
+static const char* apzGlibc_Cxx_Floatn_2Patch[] = {
+    "format",
+    "%1(defined __cplusplus && !__GNUC_PREREQ (13, 0))\n\
+%2",
+    (char*)NULL };
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * *
+ *
+ *  Description of Glibc_Cxx_Floatn_3 fix
+ */
+tSCC zGlibc_Cxx_Floatn_3Name[] =
+     "glibc_cxx_floatn_3";
+
+/*
+ *  File name selection pattern
+ */
+tSCC zGlibc_Cxx_Floatn_3List[] =
+  "bits/floatn.h\0bits/floatn-common.h\0";
+/*
+ *  Machine/OS name selection pattern
+ */
+#define apzGlibc_Cxx_Floatn_3Machs (const char**)NULL
+
+/*
+ *  content selection pattern - do fix if pattern found
+ */
+tSCC zGlibc_Cxx_Floatn_3Select0[] =
+       "^([ \t]*#[ \t]*if !__GNUC_PREREQ \\(7, 0\\) \\|\\| )defined __cplusplus\n\
+(([ \t]*/\\*[^\n\
+]*\n\
+?[^\n\
+]*\\*/\n\
+)?([ \t]*#[ \t]*if[^\n\
+]*\n\
+)?([ \t]*typedef[ \t]+[^\n\
+]*;\n\
+)?[ \t]*#[ \t]*define __CFLOAT(16|32|64|128)X?[ \t]+)";
+
+#define    GLIBC_CXX_FLOATN_3_TEST_CT  1
+static tTestDesc aGlibc_Cxx_Floatn_3Tests[] = {
+  { TT_EGREP,    zGlibc_Cxx_Floatn_3Select0, (regex_t*)NULL }, };
+
+/*
+ *  Fix Command Arguments for Glibc_Cxx_Floatn_3
+ */
+static const char* apzGlibc_Cxx_Floatn_3Patch[] = {
+    "format",
+    "%1(defined __cplusplus && !__GNUC_PREREQ (13, 0))\n\
+%2",
+    (char*)NULL };
+
 /* * * * * * * * * * * * * * * * * * * * * * * * * *
  *
  *  Description of Glibc_Mutex_Init fix
@@ -10872,9 +10998,9 @@ static const char* apzX11_SprintfPatch[] = {
  *
  *  List of all fixes
  */
-#define REGEX_COUNT          305
+#define REGEX_COUNT          308
 #define MACH_LIST_SIZE_LIMIT 187
-#define FIX_COUNT            267
+#define FIX_COUNT            270
 
 /*
  *  Enumerate the fixes
@@ -10977,6 +11103,9 @@ typedef enum {
     GLIBC_C99_INLINE_2_FIXIDX,
     GLIBC_C99_INLINE_3_FIXIDX,
     GLIBC_C99_INLINE_4_FIXIDX,
+    GLIBC_CXX_FLOATN_1_FIXIDX,
+    GLIBC_CXX_FLOATN_2_FIXIDX,
+    GLIBC_CXX_FLOATN_3_FIXIDX,
     GLIBC_MUTEX_INIT_FIXIDX,
     GLIBC_STDINT_FIXIDX,
     GLIBC_STRNCPY_FIXIDX,
@@ -11635,6 +11764,21 @@ tFixDesc fixDescList[ FIX_COUNT ] = {
      GLIBC_C99_INLINE_4_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
      aGlibc_C99_Inline_4Tests,   apzGlibc_C99_Inline_4Patch, 0 },
 
+  {  zGlibc_Cxx_Floatn_1Name,    zGlibc_Cxx_Floatn_1List,
+     apzGlibc_Cxx_Floatn_1Machs,
+     GLIBC_CXX_FLOATN_1_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
+     aGlibc_Cxx_Floatn_1Tests,   apzGlibc_Cxx_Floatn_1Patch, 0 },
+
+  {  zGlibc_Cxx_Floatn_2Name,    zGlibc_Cxx_Floatn_2List,
+     apzGlibc_Cxx_Floatn_2Machs,
+     GLIBC_CXX_FLOATN_2_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
+     aGlibc_Cxx_Floatn_2Tests,   apzGlibc_Cxx_Floatn_2Patch, 0 },
+
+  {  zGlibc_Cxx_Floatn_3Name,    zGlibc_Cxx_Floatn_3List,
+     apzGlibc_Cxx_Floatn_3Machs,
+     GLIBC_CXX_FLOATN_3_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
+     aGlibc_Cxx_Floatn_3Tests,   apzGlibc_Cxx_Floatn_3Patch, 0 },
+
   {  zGlibc_Mutex_InitName,    zGlibc_Mutex_InitList,
      apzGlibc_Mutex_InitMachs,
      GLIBC_MUTEX_INIT_TEST_CT, FD_MACH_ONLY,
diff --git a/fixincludes/inclhack.def b/fixincludes/inclhack.def
index 7605ac89aa2..a3f171ab4b6 100644
--- a/fixincludes/inclhack.def
+++ b/fixincludes/inclhack.def
@@ -2015,6 +2015,102 @@ fix = {
 	EOT;
 };
 
+/*  glibc-2.27 to 2.36 assume GCC 7 or later supports some or all
+ *  of _Float{16,32,64,128} and _Float{32,64,128}x keywords for C,
+ *  but doesn't for C++.
+ */
+fix = {
+    hackname  = glibc_cxx_floatn_1;
+    files     = bits/floatn.h, bits/floatn-common.h;
+    select    = "^([ \t]*#[ \t]*if !__GNUC_PREREQ \\(7, 0\\) \\|\\| )defined __cplusplus\n"
+		"(([ \t]*/\\*[^\n]*\\*/\n)?"
+		"([ \t]*#[ \t]*if[^\n]*\n)?"
+		"[ \t]*#[ \t]*define __f(16|32|64|128)x?\\()";
+    c_fix     = format;
+    c_fix_arg = "%1(defined __cplusplus && !__GNUC_PREREQ (13, 0))\n%2";
+    test_text = <<-EOT
+	#  if !__GNUC_PREREQ (7, 0) || defined __cplusplus
+	/* The literal suffix f128 exists only since GCC 7.0.  */
+	#   define __f128(x) x##l
+	#  else
+	#   define __f128(x) x##f128
+	#  endif
+	#  if !__GNUC_PREREQ (7, 0) || defined __cplusplus
+	/* The literal suffix (f128) exist for powerpc only since GCC 7.0.  */
+	#   if __LDBL_MANT_DIG__ == 113
+	#    define __f128(x) x##l
+	#   else
+	#    define __f128(x) x##q
+	#   endif
+	#  else
+	#   define __f128(x) x##f128
+	#  endif
+	#  if !__GNUC_PREREQ (7, 0) || defined __cplusplus
+	#   ifdef __NO_LONG_DOUBLE_MATH
+	#    define __f64(x) x##l
+	#   else
+	#    define __f64(x) x
+	#   endif
+	#  else
+	#   define __f64(x) x##f64
+	#  endif
+	EOT;
+};
+
+fix = {
+    hackname  = glibc_cxx_floatn_2;
+    files     = bits/floatn.h, bits/floatn-common.h;
+    select    = "^([ \t]*#[ \t]*if !__GNUC_PREREQ \\(7, 0\\) \\|\\| )defined __cplusplus\n"
+		"(([ \t]*/\\*[^\n]*\\*/\n)?"
+		"[ \t]*typedef[ \t]+[^\n]*[ \t]+_Float(16|32|64|128)x?([ \t]+__attribute__ \\(\\(__mode__ \\(__HF__\\)\\)\\))?;)";
+    c_fix     = format;
+    c_fix_arg = "%1(defined __cplusplus && !__GNUC_PREREQ (13, 0))\n%2";
+    test_text = <<-EOT
+	#  if !__GNUC_PREREQ (7, 0) || defined __cplusplus
+	typedef float _Float16 __attribute__ ((__mode__ (__HF__)));
+	#  endif
+	#  if !__GNUC_PREREQ (7, 0) || defined __cplusplus
+	typedef __float128 _Float128;
+	#  endif
+	EOT;
+};
+
+fix = {
+    hackname  = glibc_cxx_floatn_3;
+    files     = bits/floatn.h, bits/floatn-common.h;
+    select    = "^([ \t]*#[ \t]*if !__GNUC_PREREQ \\(7, 0\\) \\|\\| )defined __cplusplus\n"
+		"(([ \t]*/\\*[^\n]*\n?[^\n]*\\*/\n)?"
+		"([ \t]*#[ \t]*if[^\n]*\n)?"
+		"([ \t]*typedef[ \t]+[^\n]*;\n)?"
+		"[ \t]*#[ \t]*define __CFLOAT(16|32|64|128)X?[ \t]+)";
+    c_fix     = format;
+    c_fix_arg = "%1(defined __cplusplus && !__GNUC_PREREQ (13, 0))\n%2";
+    test_text = <<-EOT
+	#  if !__GNUC_PREREQ (7, 0) || defined __cplusplus
+	#   define __CFLOAT128 _Complex long double
+	#  else
+	#   define __CFLOAT128 _Complex _Float128
+	#  endif
+	#  if !__GNUC_PREREQ (7, 0) || defined __cplusplus
+	/* Add a typedef for older GCC compilers which don't natively support
+	   _Complex _Float128.  */
+	typedef _Complex float __cfloat128 __attribute__ ((__mode__ (__TC__)));
+	#   define __CFLOAT128 __cfloat128
+	#  else
+	#   define __CFLOAT128 _Complex _Float128
+	#  endif
+	#  if !__GNUC_PREREQ (7, 0) || defined __cplusplus
+	#   ifdef __NO_LONG_DOUBLE_MATH
+	#    define __CFLOAT64 _Complex long double
+	#   else
+	#    define __CFLOAT64 _Complex double
+	#   endif
+	#  else
+	#   define __CFLOAT64 _Complex _Float64
+	#  endif
+	EOT;
+};
+
 /*  glibc-2.3.5 defines pthread mutex initializers incorrectly,
  *  so we replace them with versions that correspond to the
  *  definition.
diff --git a/fixincludes/tests/base/bits/floatn.h b/fixincludes/tests/base/bits/floatn.h
new file mode 100644
index 00000000000..f09528b6e27
--- /dev/null
+++ b/fixincludes/tests/base/bits/floatn.h
@@ -0,0 +1,74 @@
+/*  DO NOT EDIT THIS FILE.
+
+    It has been auto-edited by fixincludes from:
+
+	"fixinc/tests/inc/bits/floatn.h"
+
+    This had to be done to correct non-standard usages in the
+    original, manufacturer supplied header file.  */
+
+
+
+#if defined( GLIBC_CXX_FLOATN_1_CHECK )
+#  if !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0))
+/* The literal suffix f128 exists only since GCC 7.0.  */
+#   define __f128(x) x##l
+#  else
+#   define __f128(x) x##f128
+#  endif
+#  if !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0))
+/* The literal suffix (f128) exist for powerpc only since GCC 7.0.  */
+#   if __LDBL_MANT_DIG__ == 113
+#    define __f128(x) x##l
+#   else
+#    define __f128(x) x##q
+#   endif
+#  else
+#   define __f128(x) x##f128
+#  endif
+#  if !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0))
+#   ifdef __NO_LONG_DOUBLE_MATH
+#    define __f64(x) x##l
+#   else
+#    define __f64(x) x
+#   endif
+#  else
+#   define __f64(x) x##f64
+#  endif
+#endif  /* GLIBC_CXX_FLOATN_1_CHECK */
+
+
+#if defined( GLIBC_CXX_FLOATN_2_CHECK )
+#  if !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0))
+typedef float _Float16 __attribute__ ((__mode__ (__HF__)));
+#  endif
+#  if !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0))
+typedef __float128 _Float128;
+#  endif
+#endif  /* GLIBC_CXX_FLOATN_2_CHECK */
+
+
+#if defined( GLIBC_CXX_FLOATN_3_CHECK )
+#  if !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0))
+#   define __CFLOAT128 _Complex long double
+#  else
+#   define __CFLOAT128 _Complex _Float128
+#  endif
+#  if !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0))
+/* Add a typedef for older GCC compilers which don't natively support
+   _Complex _Float128.  */
+typedef _Complex float __cfloat128 __attribute__ ((__mode__ (__TC__)));
+#   define __CFLOAT128 __cfloat128
+#  else
+#   define __CFLOAT128 _Complex _Float128
+#  endif
+#  if !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0))
+#   ifdef __NO_LONG_DOUBLE_MATH
+#    define __CFLOAT64 _Complex long double
+#   else
+#    define __CFLOAT64 _Complex double
+#   endif
+#  else
+#   define __CFLOAT64 _Complex _Float64
+#  endif
+#endif  /* GLIBC_CXX_FLOATN_3_CHECK */
diff --git a/gcc/builtins.def b/gcc/builtins.def
index f0236316850..109b3879220 100644
--- a/gcc/builtins.def
+++ b/gcc/builtins.def
@@ -114,9 +114,8 @@ along with GCC; see the file COPYING3.  If not see
    with an argument such as FLOAT32 to produce the enum value for the type.  If
    we are compiling for the C language with GNU extensions, we enable the name
    without the __builtin_ prefix as well as the name with the __builtin_
-   prefix.  C++ does not enable these names by default because they don't have
-   the _Float<N> and _Float<N>X keywords, and a class based library should use
-   the __builtin_ names.  */
+   prefix.  C++ does not enable these names by default because a class based
+   library should use the __builtin_ names.  */
 #undef DEF_FLOATN_BUILTIN
 #define DEF_FLOATN_BUILTIN(ENUM, NAME, TYPE, ATTRS)	\
   DEF_BUILTIN (ENUM, "__builtin_" NAME, BUILT_IN_NORMAL, TYPE, TYPE,	\
diff --git a/gcc/c-family/c-common.cc b/gcc/c-family/c-common.cc
index dce3045c9f2..cda6910e8c5 100644
--- a/gcc/c-family/c-common.cc
+++ b/gcc/c-family/c-common.cc
@@ -352,13 +352,13 @@ const struct c_common_resword c_common_reswords[] =
   { "_Bool",		RID_BOOL,      D_CONLY },
   { "_Complex",		RID_COMPLEX,	0 },
   { "_Imaginary",	RID_IMAGINARY, D_CONLY },
-  { "_Float16",         RID_FLOAT16,   D_CONLY },
-  { "_Float32",         RID_FLOAT32,   D_CONLY },
-  { "_Float64",         RID_FLOAT64,   D_CONLY },
-  { "_Float128",        RID_FLOAT128,  D_CONLY },
-  { "_Float32x",        RID_FLOAT32X,  D_CONLY },
-  { "_Float64x",        RID_FLOAT64X,  D_CONLY },
-  { "_Float128x",       RID_FLOAT128X, D_CONLY },
+  { "_Float16",         RID_FLOAT16,    0 },
+  { "_Float32",         RID_FLOAT32,    0 },
+  { "_Float64",         RID_FLOAT64,    0 },
+  { "_Float128",        RID_FLOAT128,   0 },
+  { "_Float32x",        RID_FLOAT32X,   0 },
+  { "_Float64x",        RID_FLOAT64X,   0 },
+  { "_Float128x",       RID_FLOAT128X,  0 },
   { "_Decimal32",       RID_DFLOAT32,  D_CONLY },
   { "_Decimal64",       RID_DFLOAT64,  D_CONLY },
   { "_Decimal128",      RID_DFLOAT128, D_CONLY },
@@ -1431,8 +1431,11 @@ shorten_binary_op (tree result_type, tree op0, tree op1, bool bitwise)
 	  == TYPE_PRECISION (TREE_TYPE (arg0)))
       && unsigned0 == unsigned1
       && (unsigned0 || !uns))
-    return c_common_signed_or_unsigned_type
-      (unsigned0, common_type (TREE_TYPE (arg0), TREE_TYPE (arg1)));
+    {
+      tree ctype = common_type (TREE_TYPE (arg0), TREE_TYPE (arg1));
+      if (ctype != error_mark_node)
+	return c_common_signed_or_unsigned_type (unsigned0, ctype);
+    }
 
   else if (TREE_CODE (arg0) == INTEGER_CST
 	   && (unsigned1 || !uns)
@@ -3204,9 +3207,10 @@ shorten_compare (location_t loc, tree *op0_ptr, tree *op1_ptr,
 
   else if (unsignedp0 == unsignedp1 && real1 == real2
 	   && TYPE_PRECISION (TREE_TYPE (primop0)) < TYPE_PRECISION (*restype_ptr)
-	   && TYPE_PRECISION (TREE_TYPE (primop1)) < TYPE_PRECISION (*restype_ptr))
+	   && TYPE_PRECISION (TREE_TYPE (primop1)) < TYPE_PRECISION (*restype_ptr)
+	   && (type = common_type (TREE_TYPE (primop0), TREE_TYPE (primop1)))
+	      != error_mark_node)
     {
-      type = common_type (TREE_TYPE (primop0), TREE_TYPE (primop1));
       type = c_common_signed_or_unsigned_type (unsignedp0
 					       || TYPE_UNSIGNED (*restype_ptr),
 					       type);
@@ -4380,11 +4384,18 @@ c_common_nodes_and_builtins (void)
   record_builtin_type (RID_DOUBLE, NULL, double_type_node);
   record_builtin_type (RID_MAX, "long double", long_double_type_node);
 
-  if (!c_dialect_cxx ())
-    for (i = 0; i < NUM_FLOATN_NX_TYPES; i++)
+  for (i = 0; i < NUM_FLOATN_NX_TYPES; i++)
+    {
       if (FLOATN_NX_TYPE_NODE (i) != NULL_TREE)
 	record_builtin_type ((enum rid) (RID_FLOATN_NX_FIRST + i), NULL,
 			     FLOATN_NX_TYPE_NODE (i));
+    }
+
+  /* For C, let float128t_type_node (__float128 in some backends) be the
+     same type as float128_type_node (_Float128), for C++ let those
+     be distinct types that mangle and behave differently.  */
+  if (c_dialect_cxx ())
+    float128t_type_node = NULL_TREE;
 
   /* Only supported decimal floating point extension if the target
      actually supports underlying modes. */
diff --git a/gcc/c-family/c-cppbuiltin.cc b/gcc/c-family/c-cppbuiltin.cc
index b709f845c81..e3f4d3d4565 100644
--- a/gcc/c-family/c-cppbuiltin.cc
+++ b/gcc/c-family/c-cppbuiltin.cc
@@ -1246,6 +1246,14 @@ c_cpp_builtins (cpp_reader *pfile)
     {
       if (FLOATN_NX_TYPE_NODE (i) == NULL_TREE)
 	continue;
+      if (c_dialect_cxx ()
+	  && cxx_dialect > cxx20
+	  && !floatn_nx_types[i].extended)
+	{
+	  char name[sizeof ("__STDCPP_FLOAT128_T__=1")];
+	  sprintf (name, "__STDCPP_FLOAT%d_T__=1", floatn_nx_types[i].n);
+	  cpp_define (pfile, name);
+	}
       char prefix[20], csuffix[20];
       sprintf (prefix, "FLT%d%s", floatn_nx_types[i].n,
 	       floatn_nx_types[i].extended ? "X" : "");
diff --git a/gcc/c-family/c-lex.cc b/gcc/c-family/c-lex.cc
index 110d029ee0c..4d2252fd946 100644
--- a/gcc/c-family/c-lex.cc
+++ b/gcc/c-family/c-lex.cc
@@ -960,6 +960,10 @@ interpret_float (const cpp_token *token, unsigned int flags,
 	  pedwarn (input_location, OPT_Wpedantic, "non-standard suffix on floating constant");
 
 	type = c_common_type_for_mode (mode, 0);
+	/* For Q suffix, prefer float128t_type_node (__float128) type
+	   over float128_type_node (_Float128) type if they are distinct.  */
+	if (type == float128_type_node && float128t_type_node)
+	  type = float128t_type_node;
 	gcc_assert (type);
       }
     else if ((flags & (CPP_N_FLOATN | CPP_N_FLOATNX)) != 0)
@@ -979,8 +983,17 @@ interpret_float (const cpp_token *token, unsigned int flags,
 	    error ("unsupported non-standard suffix on floating constant");
 	    return error_mark_node;
 	  }
+	else if (c_dialect_cxx () && !extended)
+	  {
+	    if (cxx_dialect < cxx23)
+	      pedwarn (input_location, OPT_Wpedantic,
+		       "%<f%d%> or %<F%d%> suffix on floating constant only "
+		       "available with %<-std=c++2b%> or %<-std=gnu++2b%>",
+		       n, n);
+	  }
 	else
-	  pedwarn (input_location, OPT_Wpedantic, "non-standard suffix on floating constant");
+	  pedwarn (input_location, OPT_Wpedantic,
+		   "non-standard suffix on floating constant");
       }
     else if ((flags & CPP_N_WIDTH) == CPP_N_LARGE)
       type = long_double_type_node;
@@ -990,7 +1003,10 @@ interpret_float (const cpp_token *token, unsigned int flags,
     else
       type = double_type_node;
 
-  const_type = excess_precision_type (type);
+  if (c_dialect_cxx ())
+    const_type = NULL_TREE;
+  else
+    const_type = excess_precision_type (type);
   if (!const_type)
     const_type = type;
 
diff --git a/gcc/config/i386/avx512fp16intrin.h b/gcc/config/i386/avx512fp16intrin.h
index 28041516bac..75f7475ad18 100644
--- a/gcc/config/i386/avx512fp16intrin.h
+++ b/gcc/config/i386/avx512fp16intrin.h
@@ -183,21 +183,21 @@ extern __inline __m128h
 __attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
 _mm_setzero_ph (void)
 {
-  return _mm_set1_ph (0.0f);
+  return _mm_set1_ph (0.0f16);
 }
 
 extern __inline __m256h
 __attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
 _mm256_setzero_ph (void)
 {
-  return _mm256_set1_ph (0.0f);
+  return _mm256_set1_ph (0.0f16);
 }
 
 extern __inline __m512h
 __attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
 _mm512_setzero_ph (void)
 {
-  return _mm512_set1_ph (0.0f);
+  return _mm512_set1_ph (0.0f16);
 }
 
 extern __inline __m128h
@@ -358,7 +358,8 @@ extern __inline __m128h
 __attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
 _mm_set_sh (_Float16 __F)
 {
-  return _mm_set_ph (0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, __F);
+  return _mm_set_ph (0.0f16, 0.0f16, 0.0f16, 0.0f16, 0.0f16, 0.0f16, 0.0f16,
+		     __F);
 }
 
 /* Create a vector with element 0 as *P and the rest zero.  */
@@ -366,7 +367,7 @@ extern __inline __m128h
 __attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
 _mm_load_sh (void const *__P)
 {
-  return _mm_set_ph (0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
+  return _mm_set_ph (0.0f16, 0.0f16, 0.0f16, 0.0f16, 0.0f16, 0.0f16, 0.0f16,
 		     *(_Float16 const *) __P);
 }
 
diff --git a/gcc/config/i386/i386-builtins.cc b/gcc/config/i386/i386-builtins.cc
index af2faee245b..b91aba18221 100644
--- a/gcc/config/i386/i386-builtins.cc
+++ b/gcc/config/i386/i386-builtins.cc
@@ -1409,9 +1409,18 @@ ix86_init_builtin_types (void)
   lang_hooks.types.register_builtin_type (float80_type_node, "__float80");
 
   /* The __float128 type.  The node has already been created as
-     _Float128, so we only need to register the __float128 name for
-     it.  */
-  lang_hooks.types.register_builtin_type (float128_type_node, "__float128");
+     _Float128, so for C we only need to register the __float128 name for
+     it.  For C++, we create a distinct type which will mangle differently
+     (g) vs. _Float128 (DF128_) and behave backwards compatibly.  */
+  if (float128t_type_node == NULL_TREE)
+    {
+      float128t_type_node = make_node (REAL_TYPE);
+      TYPE_PRECISION (float128t_type_node)
+	= TYPE_PRECISION (float128_type_node);
+      SET_TYPE_MODE (float128t_type_node, TYPE_MODE (float128_type_node));
+      layout_type (float128t_type_node);
+    }
+  lang_hooks.types.register_builtin_type (float128t_type_node, "__float128");
 
   ix86_register_float16_builtin_type ();
 
diff --git a/gcc/config/i386/i386.cc b/gcc/config/i386/i386.cc
index ca799da5d7e..4386caf843e 100644
--- a/gcc/config/i386/i386.cc
+++ b/gcc/config/i386/i386.cc
@@ -22735,7 +22735,10 @@ ix86_mangle_type (const_tree type)
       return "DF16_";
     case E_TFmode:
       /* __float128 is "g".  */
-      return "g";
+      if (type == float128t_type_node)
+	return "g";
+      /* _Float128 should mangle as "DF128_" done in generic code.  */
+      return NULL;
     case E_XFmode:
       /* "long double" or __float80 is "e".  */
       return "e";
diff --git a/gcc/config/ia64/ia64.cc b/gcc/config/ia64/ia64.cc
index 50ae7aa4cd6..d510573a0a4 100644
--- a/gcc/config/ia64/ia64.cc
+++ b/gcc/config/ia64/ia64.cc
@@ -10466,11 +10466,19 @@ ia64_init_builtins (void)
 	= build_pointer_type (build_qualified_type
 			      (char_type_node, TYPE_QUAL_CONST));
 
-      (*lang_hooks.types.register_builtin_type) (float128_type_node,
+      if (float128t_type_node == NULL_TREE)
+	{
+	  float128t_type_node = make_node (REAL_TYPE);
+	  TYPE_PRECISION (float128t_type_node)
+	    = TYPE_PRECISION (float128_type_node);
+	  layout_type (float128t_type_node);
+	  SET_TYPE_MODE (float128t_type_node, TYPE_MODE (float128_type_node));
+	}
+      (*lang_hooks.types.register_builtin_type) (float128t_type_node,
 						 "__float128");
 
       /* TFmode support builtins.  */
-      ftype = build_function_type_list (float128_type_node, NULL_TREE);
+      ftype = build_function_type_list (float128t_type_node, NULL_TREE);
       decl = add_builtin_function ("__builtin_infq", ftype,
 				   IA64_BUILTIN_INFQ, BUILT_IN_MD,
 				   NULL, NULL_TREE);
@@ -10481,7 +10489,7 @@ ia64_init_builtins (void)
 				   NULL, NULL_TREE);
       ia64_builtins[IA64_BUILTIN_HUGE_VALQ] = decl;
 
-      ftype = build_function_type_list (float128_type_node,
+      ftype = build_function_type_list (float128t_type_node,
 					const_string_type,
 					NULL_TREE);
       decl = add_builtin_function ("__builtin_nanq", ftype,
@@ -10496,8 +10504,8 @@ ia64_init_builtins (void)
       TREE_READONLY (decl) = 1;
       ia64_builtins[IA64_BUILTIN_NANSQ] = decl;
 
-      ftype = build_function_type_list (float128_type_node,
-					float128_type_node,
+      ftype = build_function_type_list (float128t_type_node,
+					float128t_type_node,
 					NULL_TREE);
       decl = add_builtin_function ("__builtin_fabsq", ftype,
 				   IA64_BUILTIN_FABSQ, BUILT_IN_MD,
@@ -10505,9 +10513,9 @@ ia64_init_builtins (void)
       TREE_READONLY (decl) = 1;
       ia64_builtins[IA64_BUILTIN_FABSQ] = decl;
 
-      ftype = build_function_type_list (float128_type_node,
-					float128_type_node,
-					float128_type_node,
+      ftype = build_function_type_list (float128t_type_node,
+					float128t_type_node,
+					float128t_type_node,
 					NULL_TREE);
       decl = add_builtin_function ("__builtin_copysignq", ftype,
 				   IA64_BUILTIN_COPYSIGNQ, BUILT_IN_MD,
diff --git a/gcc/config/rs6000/rs6000-builtin.cc b/gcc/config/rs6000/rs6000-builtin.cc
index 3ce729c1e6d..90ab39dc258 100644
--- a/gcc/config/rs6000/rs6000-builtin.cc
+++ b/gcc/config/rs6000/rs6000-builtin.cc
@@ -733,7 +733,22 @@ rs6000_init_builtins (void)
       if (TARGET_IEEEQUAD && TARGET_LONG_DOUBLE_128)
 	ieee128_float_type_node = long_double_type_node;
       else
-	ieee128_float_type_node = float128_type_node;
+	{
+	  /* For C we only need to register the __ieee128 name for
+	     it.  For C++, we create a distinct type which will mangle
+	     differently (u9__ieee128) vs. _Float128 (DF128_) and behave
+	     backwards compatibly.  */
+	  if (float128t_type_node == NULL_TREE)
+	    {
+	      float128t_type_node = make_node (REAL_TYPE);
+	      TYPE_PRECISION (float128t_type_node)
+		= TYPE_PRECISION (float128_type_node);
+	      layout_type (float128t_type_node);
+	      SET_TYPE_MODE (float128t_type_node,
+			     TYPE_MODE (float128_type_node));
+	    }
+	  ieee128_float_type_node = float128t_type_node;
+	}
       t = build_qualified_type (ieee128_float_type_node, TYPE_QUAL_CONST);
       lang_hooks.types.register_builtin_type (ieee128_float_type_node,
 					      "__ieee128");
diff --git a/gcc/config/rs6000/rs6000-c.cc b/gcc/config/rs6000/rs6000-c.cc
index ca9cc42028f..56609462629 100644
--- a/gcc/config/rs6000/rs6000-c.cc
</cut>

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [TCWG CI] Failure after basepoints/gcc-13-2887-gb04208895fe: c++: Implement P1467R9 - Extended floating-point types and standard names compiler part except for bfloat16 [PR106652]
@ 2022-09-27 14:58 ci_notify
  0 siblings, 0 replies; 2+ messages in thread
From: ci_notify @ 2022-09-27 14:58 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: gcc-regression

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

Failure after basepoints/gcc-13-2887-gb04208895fe: c++: Implement P1467R9 - Extended floating-point types and standard names compiler part except for bfloat16 [PR106652]:

Results changed to
-10
# true:
0
# build_abe binutils:
1
# build_abe gcc:
# FAILED
# First few build errors in logs:
# 00:00:14     /usr/include/bits/floatn.h:86:9: error: multiple types in one declaration
# 00:00:14     /usr/include/bits/floatn.h:86:20: error: declaration does not declare anything [-fpermissive]
# 00:00:14     /usr/include/bits/floatn-common.h:214:9: error: multiple types in one declaration
# 00:00:14     /usr/include/bits/floatn-common.h:214:15: error: declaration does not declare anything [-fpermissive]
# 00:00:14     /usr/include/bits/floatn-common.h:251:9: error: multiple types in one declaration
# 00:00:14     /usr/include/bits/floatn-common.h:251:16: error: declaration does not declare anything [-fpermissive]
# 00:03:01 make[2]: [Makefile:1787: aarch64-unknown-linux-gnu/bits/largefile-config.h] Error 1 (ignored)
# 00:03:01 make[2]: [Makefile:1788: aarch64-unknown-linux-gnu/bits/largefile-config.h] Error 1 (ignored)
# 00:03:02 /usr/include/aarch64-linux-gnu/bits/floatn.h:80:14: error: multiple types in one declaration
# 00:03:02 /usr/include/aarch64-linux-gnu/bits/floatn.h:80:21: error: declaration does not declare anything [-fpermissive]

from
-10
# true:
0
# build_abe binutils:
1
# build_abe gcc:
2
# build_abe linux:
4
# build_abe glibc:
5
# build_abe gdb:
6

THIS IS THE END OF INTERESTING STUFF.  BELOW ARE LINKS TO BUILDS, REPRODUCTION INSTRUCTIONS, AND THE RAW COMMIT.

For latest status see comments in https://linaro.atlassian.net/browse/GNU-692 .
Status of basepoints/gcc-13-2887-gb04208895fe commit for tcwg_gnu_native_build:
commit b04208895fed34171eac6bafb60c90048eb1cb0c
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Tue Sep 27 08:04:06 2022 +0200

    c++: Implement P1467R9 - Extended floating-point types and standard names compiler part except for bfloat16 [PR106652]
    
    The following patch implements the compiler part of C++23
    P1467R9 - Extended floating-point types and standard names compiler part
    by introducing _Float{16,32,64,128} as keywords and builtin types
    like they are implemented for C already since GCC 7, with DF{16,32,64,128}_
    mangling.
    It also introduces _Float{32,64,128}x for C++ with the
    https://github.com/itanium-cxx-abi/cxx-abi/pull/147
    proposed mangling of DF{32,64,128}x.
    The patch doesn't add anything for bfloat16_t support, as right now
    __bf16 type refuses all conversions and arithmetic operations.
    The patch wants to keep backwards compatibility with how __float128 has
    been handled in C++ before, both for mangling and behavior in binary
    operations, overload resolution etc.  So, there are some backend changes
    where for C __float128 and _Float128 are the same type (float128_type_node
    and float128t_type_node are the same pointer), but for C++ they are distinct
    types which mangle differently and _Float128 is treated as extended
    floating-point type while __float128 is treated as non-standard floating
    point type.  The various C++23 changes about how floating-point types
    are changed are actually implemented as written in the spec only if at least
    one of the types involved is _Float{16,32,64,128,32x,64x,128x} (_FloatNx are
    also treated as extended floating-point types) and kept previous behavior
    otherwise.  For float/double/long double the rules are actually written that
    they behave the same as before.
    There is some backwards incompatibility at least on x86 regarding _Float16,
    because that type was already used by that name and with the DF16_ mangling
    (but only since GCC 12 and I think it isn't that widely used in the wild
    yet).  E.g. config/i386/avx512fp16intrin.h shows the issues, where
    in C or in GCC 12 in C++ one could pass 0.0f to a builtin taking _Float16
    argument, but with the changes that is not possible anymore, one needs
    to either use 0.0f16 or (_Float16) 0.0f.
    We have also a problem with glibc headers, where since glibc 2.27
    math.h and complex.h aren't compilable with these changes.  One gets
    errors like:
    In file included from /usr/include/math.h:43,
                     from abc.c:1:
    /usr/include/bits/floatn.h:86:9: error: multiple types in one declaration
       86 | typedef __float128 _Float128;
          |         ^~~~~~~~~~
    /usr/include/bits/floatn.h:86:20: error: declaration does not declare anything [-fpermissive]
       86 | typedef __float128 _Float128;
          |                    ^~~~~~~~~
    In file included from /usr/include/bits/floatn.h:119:
    /usr/include/bits/floatn-common.h:214:9: error: multiple types in one declaration
      214 | typedef float _Float32;
          |         ^~~~~
    /usr/include/bits/floatn-common.h:214:15: error: declaration does not declare anything [-fpermissive]
      214 | typedef float _Float32;
          |               ^~~~~~~~
    /usr/include/bits/floatn-common.h:251:9: error: multiple types in one declaration
      251 | typedef double _Float64;
          |         ^~~~~~
    /usr/include/bits/floatn-common.h:251:16: error: declaration does not declare anything [-fpermissive]
      251 | typedef double _Float64;
          |                ^~~~~~~~
    This is from snippets like:
     /* The remaining of this file provides support for older compilers.  */
     # if __HAVE_FLOAT128
    
     /* The type _Float128 exists only since GCC 7.0.  */
     #  if !__GNUC_PREREQ (7, 0) || defined __cplusplus
     typedef __float128 _Float128;
     #  endif
    where it hardcodes that C++ doesn't have _Float{16,32,64,128,32x,64x,128x} support nor
    {f,F}{16,32,64,128}{,x} literal suffixes nor _Complex _Float{16,32,64,128,32x,64x,128x}.
    The patch fixincludes this for now and hopefully if this is committed, then
    glibc can change those.  The patch changes those
     #  if !__GNUC_PREREQ (7, 0) || defined __cplusplus
    conditions to
     #  if !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0))
    Another thing is mangling, as said above, Itanium C++ ABI specifies
    DF <number> _ as _Float{16,32,64,128} mangling, but GCC was implementing
    a mangling incompatible with that starting with DF for fixed point types.
    Fixed point was never supported in C++ though, I believe the reason why
    the mangling has been added was that due to a bug it would leak into the
    C++ FE through decltype (0.0r) etc.  But that has been shortly after the
    mangling was added fixed (I think in the same GCC release cycle), so we
    now reject 0.0r etc. in C++.  If we ever need the fixed point mangling,
    I think it can be readded but better with a different prefix so that it
    doesn't conflict with the published standard manglings.  So, this patch
    also kills the fixed point mangling and implements the DF <number> _
    demangling.
    The patch predefines __STDCPP_FLOAT{16,32,64,128}_T__ macros when
    those types are available, but only for C++23, while the underlying types
    are available in C++98 and later including the {f,F}{16,32,64,128} literal
    suffixes (but those with a pedwarn for C++20 and earlier).  My understanding
    is that it needs to be predefined by the compiler, on the other side
    predefining even for older modes when <stdfloat> is a new C++23 header
    would be weird.  One can find out if _Float{16,32,64,128,32x,64x,128x} is
    supported in C++ by
    __GNUC__ >= 13 && defined(__FLT{16,32,64,128,32X,64X,128X}_MANT_DIG__)
    (but that doesn't work well with older G++ 13 snapshots).
    
    As for std::bfloat16_t, three targets (aarch64, arm and x86) apparently
    "support" __bf16 type which has the bfloat16 format, but isn't really
    usable, e.g. {aarch64,arm,ix86}_invalid_conversion disallow any conversions
    from or to type with BFmode, {aarch64,arm,ix86}_invalid_unary_op disallows
    any unary operations on those except for ADDR_EXPR and
    {aarch64,arm,ix86}_invalid_binary_op disallows any binary operation on
    those.  So, I think we satisfy:
    "If the implementation supports an extended floating-point type with the
    properties, as specified by ISO/IEC/IEEE 60559, of radix (b) of 2, storage
    width in bits (k) of 16, precision in bits (p) of 8, maximum exponent (emax)
    of 127, and exponent field width in bits (w) of 8, then the typedef-name
    std::bfloat16_t is defined in the header <stdfloat> and names such a type,
    the macro __STDCPP_BFLOAT16_T__ is defined, and the floating-point literal
    suffixes bf16 and BF16 are supported."
    because we don't really support those right now.
    
    2022-09-27  Jakub Jelinek  <jakub@redhat.com>
    
            PR c++/106652
            PR c++/85518
    gcc/
            * tree-core.h (enum tree_index): Add TI_FLOAT128T_TYPE
            enumerator.
            * tree.h (float128t_type_node): Define.
            * tree.cc (build_common_tree_nodes): Initialize float128t_type_node.
            * builtins.def (DEF_FLOATN_BUILTIN): Adjust comment now that
            _Float<N> is supported in C++ too.
            * config/i386/i386.cc (ix86_mangle_type): Only mangle as "g"
            float128t_type_node.
            * config/i386/i386-builtins.cc (ix86_init_builtin_types): Use
            float128t_type_node for __float128 instead of float128_type_node
            and create it if NULL.
            * config/i386/avx512fp16intrin.h (_mm_setzero_ph, _mm256_setzero_ph,
            _mm512_setzero_ph, _mm_set_sh, _mm_load_sh): Use 0.0f16 instead of
            0.0f.
            * config/ia64/ia64.cc (ia64_init_builtins): Use
            float128t_type_node for __float128 instead of float128_type_node
            and create it if NULL.
            * config/rs6000/rs6000-c.cc (is_float128_p): Also return true
            for float128t_type_node if non-NULL.
            * config/rs6000/rs6000.cc (rs6000_mangle_type): Don't mangle
            float128_type_node as "u9__ieee128".
            * config/rs6000/rs6000-builtin.cc (rs6000_init_builtins): Use
            float128t_type_node for __float128 instead of float128_type_node
            and create it if NULL.
    gcc/c-family/
            * c-common.cc (c_common_reswords): Change _Float{16,32,64,128} and
            _Float{32,64,128}x flags from D_CONLY to 0.
            (shorten_binary_op): Punt if common_type returns error_mark_node.
            (shorten_compare): Likewise.
            (c_common_nodes_and_builtins): For C++ record _Float{16,32,64,128}
            and _Float{32,64,128}x builtin types if available.  For C++
            clear float128t_type_node.
            * c-cppbuiltin.cc (c_cpp_builtins): Predefine
            __STDCPP_FLOAT{16,32,64,128}_T__ for C++23 if supported.
            * c-lex.cc (interpret_float): For q/Q suffixes prefer
            float128t_type_node over float128_type_node.  Allow
            {f,F}{16,32,64,128} suffixes for C++ if supported with pedwarn
            for C++20 and older.  Allow {f,F}{32,64,128}x suffixes for C++
            with pedwarn.  Don't call excess_precision_type for C++.
    gcc/cp/
            * cp-tree.h (cp_compare_floating_point_conversion_ranks): Implement
            P1467R9 - Extended floating-point types and standard names except
            for std::bfloat16_t for now.  Declare.
            (extended_float_type_p): New inline function.
            * mangle.cc (write_builtin_type): Mangle float{16,32,64,128}_type_node
            as DF{16,32,64,128}_.  Mangle float{32,64,128}x_type_node as
            DF{32,64,128}x.  Remove FIXED_POINT_TYPE mangling that conflicts
            with that.
            * typeck2.cc (check_narrowing): If one of ftype or type is extended
            floating-point type, compare floating-point conversion ranks.
            * parser.cc (cp_keyword_starts_decl_specifier_p): Handle
            CASE_RID_FLOATN_NX.
            (cp_parser_simple_type_specifier): Likewise and diagnose missing
            _Float<N> or _Float<N>x support if not supported by target.
            * typeck.cc (cp_compare_floating_point_conversion_ranks): New function.
            (cp_common_type): If both types are REAL_TYPE and one or both are
            extended floating-point types, select common type based on comparison
            of floating-point conversion ranks and subranks.
            (cp_build_binary_op): Diagnose operation with floating point arguments
            with unordered conversion ranks.
            * call.cc (standard_conversion): For floating-point conversion, if
            either from or to are extended floating-point types, set conv->bad_p
            for implicit conversion from larger to smaller conversion rank or
            with unordered conversion ranks.
            (convert_like_internal): Emit a pedwarn on such conversions.
            (build_conditional_expr): Diagnose operation with floating point
            arguments with unordered conversion ranks.
            (convert_arg_to_ellipsis): Don't promote extended floating-point types
            narrower than double to double.
            (compare_ics): Implement P1467R9 [over.ics.rank]/4 changes.
    gcc/testsuite/
            * g++.dg/cpp23/ext-floating1.C: New test.
            * g++.dg/cpp23/ext-floating2.C: New test.
            * g++.dg/cpp23/ext-floating3.C: New test.
            * g++.dg/cpp23/ext-floating4.C: New test.
            * g++.dg/cpp23/ext-floating5.C: New test.
            * g++.dg/cpp23/ext-floating6.C: New test.
            * g++.dg/cpp23/ext-floating7.C: New test.
            * g++.dg/cpp23/ext-floating8.C: New test.
            * g++.dg/cpp23/ext-floating9.C: New test.
            * g++.dg/cpp23/ext-floating10.C: New test.
            * g++.dg/cpp23/ext-floating.h: New file.
            * g++.target/i386/float16-1.C: Adjust expected diagnostics.
    libcpp/
            * expr.cc (interpret_float_suffix): Allow {f,F}{16,32,64,128} and
            {f,F}{32,64,128}x suffixes for C++.
    include/
            * demangle.h (enum demangle_component_type): Add
            DEMANGLE_COMPONENT_EXTENDED_BUILTIN_TYPE.
            (struct demangle_component): Add u.s_extended_builtin member.
    libiberty/
            * cp-demangle.c (d_dump): Handle
            DEMANGLE_COMPONENT_EXTENDED_BUILTIN_TYPE.  Don't handle
            DEMANGLE_COMPONENT_FIXED_TYPE.
            (d_make_extended_builtin_type): New function.
            (cplus_demangle_builtin_types): Add _Float entry.
            (cplus_demangle_type): For DF demangle it as _Float<N> or
            _Float<N>x rather than fixed point which conflicts with it.
            (d_count_templates_scopes): Handle
            DEMANGLE_COMPONENT_EXTENDED_BUILTIN_TYPE.  Just break; for
            DEMANGLE_COMPONENT_FIXED_TYPE.
            (d_find_pack): Handle DEMANGLE_COMPONENT_EXTENDED_BUILTIN_TYPE.
            Don't handle DEMANGLE_COMPONENT_FIXED_TYPE.
            (d_print_comp_inner): Likewise.
            * cp-demangle.h (D_BUILTIN_TYPE_COUNT): Bump.
            * testsuite/demangle-expected: Replace _Z3xxxDFyuVb test
            with _Z3xxxDF16_DF32_DF64_DF128_CDF16_Vb.  Add
            _Z3xxxDF32xDF64xDF128xCDF32xVb test.
    fixincludes/
            * inclhack.def (glibc_cxx_floatn_1, glibc_cxx_floatn_2,
            glibc_cxx_floatn_3): New fixes.
            * tests/base/bits/floatn.h: New file.
            * fixincl.x: Regenerated.
* master-aarch64
** Failure after basepoints/gcc-13-2887-gb04208895fe: c++: Implement P1467R9 - Extended floating-point types and standard names compiler part except for bfloat16 [PR106652]:
** https://ci.linaro.org/job/tcwg_gnu_native_build-build-master-aarch64/464/

Bad  build: https://ci.linaro.org/job/tcwg_gnu_native_build-build-master-aarch64/464/artifact/artifacts
Good build: https://ci.linaro.org/job/tcwg_gnu_native_build-build-master-aarch64/463/artifact/artifacts

Reproduce current build:
<cut>
mkdir -p investigate-gcc-b04208895fed34171eac6bafb60c90048eb1cb0c
cd investigate-gcc-b04208895fed34171eac6bafb60c90048eb1cb0c

# Fetch scripts
git clone https://git.linaro.org/toolchain/jenkins-scripts

# Fetch manifests for bad and good builds
mkdir -p bad/artifacts good/artifacts
curl -o bad/artifacts/manifest.sh https://ci.linaro.org/job/tcwg_gnu_native_build-build-master-aarch64/464/artifact/artifacts/manifest.sh --fail
curl -o good/artifacts/manifest.sh https://ci.linaro.org/job/tcwg_gnu_native_build-build-master-aarch64/463/artifact/artifacts/manifest.sh --fail

# Reproduce bad build
(cd bad; ../jenkins-scripts/tcwg_gnu-build.sh ^^ true %%rr[top_artifacts] artifacts)
# Reproduce good build
(cd good; ../jenkins-scripts/tcwg_gnu-build.sh ^^ true %%rr[top_artifacts] artifacts)
</cut>

Full commit (up to 1000 lines):
<cut>
commit b04208895fed34171eac6bafb60c90048eb1cb0c
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Tue Sep 27 08:04:06 2022 +0200

    c++: Implement P1467R9 - Extended floating-point types and standard names compiler part except for bfloat16 [PR106652]
    
    The following patch implements the compiler part of C++23
    P1467R9 - Extended floating-point types and standard names compiler part
    by introducing _Float{16,32,64,128} as keywords and builtin types
    like they are implemented for C already since GCC 7, with DF{16,32,64,128}_
    mangling.
    It also introduces _Float{32,64,128}x for C++ with the
    https://github.com/itanium-cxx-abi/cxx-abi/pull/147
    proposed mangling of DF{32,64,128}x.
    The patch doesn't add anything for bfloat16_t support, as right now
    __bf16 type refuses all conversions and arithmetic operations.
    The patch wants to keep backwards compatibility with how __float128 has
    been handled in C++ before, both for mangling and behavior in binary
    operations, overload resolution etc.  So, there are some backend changes
    where for C __float128 and _Float128 are the same type (float128_type_node
    and float128t_type_node are the same pointer), but for C++ they are distinct
    types which mangle differently and _Float128 is treated as extended
    floating-point type while __float128 is treated as non-standard floating
    point type.  The various C++23 changes about how floating-point types
    are changed are actually implemented as written in the spec only if at least
    one of the types involved is _Float{16,32,64,128,32x,64x,128x} (_FloatNx are
    also treated as extended floating-point types) and kept previous behavior
    otherwise.  For float/double/long double the rules are actually written that
    they behave the same as before.
    There is some backwards incompatibility at least on x86 regarding _Float16,
    because that type was already used by that name and with the DF16_ mangling
    (but only since GCC 12 and I think it isn't that widely used in the wild
    yet).  E.g. config/i386/avx512fp16intrin.h shows the issues, where
    in C or in GCC 12 in C++ one could pass 0.0f to a builtin taking _Float16
    argument, but with the changes that is not possible anymore, one needs
    to either use 0.0f16 or (_Float16) 0.0f.
    We have also a problem with glibc headers, where since glibc 2.27
    math.h and complex.h aren't compilable with these changes.  One gets
    errors like:
    In file included from /usr/include/math.h:43,
                     from abc.c:1:
    /usr/include/bits/floatn.h:86:9: error: multiple types in one declaration
       86 | typedef __float128 _Float128;
          |         ^~~~~~~~~~
    /usr/include/bits/floatn.h:86:20: error: declaration does not declare anything [-fpermissive]
       86 | typedef __float128 _Float128;
          |                    ^~~~~~~~~
    In file included from /usr/include/bits/floatn.h:119:
    /usr/include/bits/floatn-common.h:214:9: error: multiple types in one declaration
      214 | typedef float _Float32;
          |         ^~~~~
    /usr/include/bits/floatn-common.h:214:15: error: declaration does not declare anything [-fpermissive]
      214 | typedef float _Float32;
          |               ^~~~~~~~
    /usr/include/bits/floatn-common.h:251:9: error: multiple types in one declaration
      251 | typedef double _Float64;
          |         ^~~~~~
    /usr/include/bits/floatn-common.h:251:16: error: declaration does not declare anything [-fpermissive]
      251 | typedef double _Float64;
          |                ^~~~~~~~
    This is from snippets like:
     /* The remaining of this file provides support for older compilers.  */
     # if __HAVE_FLOAT128
    
     /* The type _Float128 exists only since GCC 7.0.  */
     #  if !__GNUC_PREREQ (7, 0) || defined __cplusplus
     typedef __float128 _Float128;
     #  endif
    where it hardcodes that C++ doesn't have _Float{16,32,64,128,32x,64x,128x} support nor
    {f,F}{16,32,64,128}{,x} literal suffixes nor _Complex _Float{16,32,64,128,32x,64x,128x}.
    The patch fixincludes this for now and hopefully if this is committed, then
    glibc can change those.  The patch changes those
     #  if !__GNUC_PREREQ (7, 0) || defined __cplusplus
    conditions to
     #  if !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0))
    Another thing is mangling, as said above, Itanium C++ ABI specifies
    DF <number> _ as _Float{16,32,64,128} mangling, but GCC was implementing
    a mangling incompatible with that starting with DF for fixed point types.
    Fixed point was never supported in C++ though, I believe the reason why
    the mangling has been added was that due to a bug it would leak into the
    C++ FE through decltype (0.0r) etc.  But that has been shortly after the
    mangling was added fixed (I think in the same GCC release cycle), so we
    now reject 0.0r etc. in C++.  If we ever need the fixed point mangling,
    I think it can be readded but better with a different prefix so that it
    doesn't conflict with the published standard manglings.  So, this patch
    also kills the fixed point mangling and implements the DF <number> _
    demangling.
    The patch predefines __STDCPP_FLOAT{16,32,64,128}_T__ macros when
    those types are available, but only for C++23, while the underlying types
    are available in C++98 and later including the {f,F}{16,32,64,128} literal
    suffixes (but those with a pedwarn for C++20 and earlier).  My understanding
    is that it needs to be predefined by the compiler, on the other side
    predefining even for older modes when <stdfloat> is a new C++23 header
    would be weird.  One can find out if _Float{16,32,64,128,32x,64x,128x} is
    supported in C++ by
    __GNUC__ >= 13 && defined(__FLT{16,32,64,128,32X,64X,128X}_MANT_DIG__)
    (but that doesn't work well with older G++ 13 snapshots).
    
    As for std::bfloat16_t, three targets (aarch64, arm and x86) apparently
    "support" __bf16 type which has the bfloat16 format, but isn't really
    usable, e.g. {aarch64,arm,ix86}_invalid_conversion disallow any conversions
    from or to type with BFmode, {aarch64,arm,ix86}_invalid_unary_op disallows
    any unary operations on those except for ADDR_EXPR and
    {aarch64,arm,ix86}_invalid_binary_op disallows any binary operation on
    those.  So, I think we satisfy:
    "If the implementation supports an extended floating-point type with the
    properties, as specified by ISO/IEC/IEEE 60559, of radix (b) of 2, storage
    width in bits (k) of 16, precision in bits (p) of 8, maximum exponent (emax)
    of 127, and exponent field width in bits (w) of 8, then the typedef-name
    std::bfloat16_t is defined in the header <stdfloat> and names such a type,
    the macro __STDCPP_BFLOAT16_T__ is defined, and the floating-point literal
    suffixes bf16 and BF16 are supported."
    because we don't really support those right now.
    
    2022-09-27  Jakub Jelinek  <jakub@redhat.com>
    
            PR c++/106652
            PR c++/85518
    gcc/
            * tree-core.h (enum tree_index): Add TI_FLOAT128T_TYPE
            enumerator.
            * tree.h (float128t_type_node): Define.
            * tree.cc (build_common_tree_nodes): Initialize float128t_type_node.
            * builtins.def (DEF_FLOATN_BUILTIN): Adjust comment now that
            _Float<N> is supported in C++ too.
            * config/i386/i386.cc (ix86_mangle_type): Only mangle as "g"
            float128t_type_node.
            * config/i386/i386-builtins.cc (ix86_init_builtin_types): Use
            float128t_type_node for __float128 instead of float128_type_node
            and create it if NULL.
            * config/i386/avx512fp16intrin.h (_mm_setzero_ph, _mm256_setzero_ph,
            _mm512_setzero_ph, _mm_set_sh, _mm_load_sh): Use 0.0f16 instead of
            0.0f.
            * config/ia64/ia64.cc (ia64_init_builtins): Use
            float128t_type_node for __float128 instead of float128_type_node
            and create it if NULL.
            * config/rs6000/rs6000-c.cc (is_float128_p): Also return true
            for float128t_type_node if non-NULL.
            * config/rs6000/rs6000.cc (rs6000_mangle_type): Don't mangle
            float128_type_node as "u9__ieee128".
            * config/rs6000/rs6000-builtin.cc (rs6000_init_builtins): Use
            float128t_type_node for __float128 instead of float128_type_node
            and create it if NULL.
    gcc/c-family/
            * c-common.cc (c_common_reswords): Change _Float{16,32,64,128} and
            _Float{32,64,128}x flags from D_CONLY to 0.
            (shorten_binary_op): Punt if common_type returns error_mark_node.
            (shorten_compare): Likewise.
            (c_common_nodes_and_builtins): For C++ record _Float{16,32,64,128}
            and _Float{32,64,128}x builtin types if available.  For C++
            clear float128t_type_node.
            * c-cppbuiltin.cc (c_cpp_builtins): Predefine
            __STDCPP_FLOAT{16,32,64,128}_T__ for C++23 if supported.
            * c-lex.cc (interpret_float): For q/Q suffixes prefer
            float128t_type_node over float128_type_node.  Allow
            {f,F}{16,32,64,128} suffixes for C++ if supported with pedwarn
            for C++20 and older.  Allow {f,F}{32,64,128}x suffixes for C++
            with pedwarn.  Don't call excess_precision_type for C++.
    gcc/cp/
            * cp-tree.h (cp_compare_floating_point_conversion_ranks): Implement
            P1467R9 - Extended floating-point types and standard names except
            for std::bfloat16_t for now.  Declare.
            (extended_float_type_p): New inline function.
            * mangle.cc (write_builtin_type): Mangle float{16,32,64,128}_type_node
            as DF{16,32,64,128}_.  Mangle float{32,64,128}x_type_node as
            DF{32,64,128}x.  Remove FIXED_POINT_TYPE mangling that conflicts
            with that.
            * typeck2.cc (check_narrowing): If one of ftype or type is extended
            floating-point type, compare floating-point conversion ranks.
            * parser.cc (cp_keyword_starts_decl_specifier_p): Handle
            CASE_RID_FLOATN_NX.
            (cp_parser_simple_type_specifier): Likewise and diagnose missing
            _Float<N> or _Float<N>x support if not supported by target.
            * typeck.cc (cp_compare_floating_point_conversion_ranks): New function.
            (cp_common_type): If both types are REAL_TYPE and one or both are
            extended floating-point types, select common type based on comparison
            of floating-point conversion ranks and subranks.
            (cp_build_binary_op): Diagnose operation with floating point arguments
            with unordered conversion ranks.
            * call.cc (standard_conversion): For floating-point conversion, if
            either from or to are extended floating-point types, set conv->bad_p
            for implicit conversion from larger to smaller conversion rank or
            with unordered conversion ranks.
            (convert_like_internal): Emit a pedwarn on such conversions.
            (build_conditional_expr): Diagnose operation with floating point
            arguments with unordered conversion ranks.
            (convert_arg_to_ellipsis): Don't promote extended floating-point types
            narrower than double to double.
            (compare_ics): Implement P1467R9 [over.ics.rank]/4 changes.
    gcc/testsuite/
            * g++.dg/cpp23/ext-floating1.C: New test.
            * g++.dg/cpp23/ext-floating2.C: New test.
            * g++.dg/cpp23/ext-floating3.C: New test.
            * g++.dg/cpp23/ext-floating4.C: New test.
            * g++.dg/cpp23/ext-floating5.C: New test.
            * g++.dg/cpp23/ext-floating6.C: New test.
            * g++.dg/cpp23/ext-floating7.C: New test.
            * g++.dg/cpp23/ext-floating8.C: New test.
            * g++.dg/cpp23/ext-floating9.C: New test.
            * g++.dg/cpp23/ext-floating10.C: New test.
            * g++.dg/cpp23/ext-floating.h: New file.
            * g++.target/i386/float16-1.C: Adjust expected diagnostics.
    libcpp/
            * expr.cc (interpret_float_suffix): Allow {f,F}{16,32,64,128} and
            {f,F}{32,64,128}x suffixes for C++.
    include/
            * demangle.h (enum demangle_component_type): Add
            DEMANGLE_COMPONENT_EXTENDED_BUILTIN_TYPE.
            (struct demangle_component): Add u.s_extended_builtin member.
    libiberty/
            * cp-demangle.c (d_dump): Handle
            DEMANGLE_COMPONENT_EXTENDED_BUILTIN_TYPE.  Don't handle
            DEMANGLE_COMPONENT_FIXED_TYPE.
            (d_make_extended_builtin_type): New function.
            (cplus_demangle_builtin_types): Add _Float entry.
            (cplus_demangle_type): For DF demangle it as _Float<N> or
            _Float<N>x rather than fixed point which conflicts with it.
            (d_count_templates_scopes): Handle
            DEMANGLE_COMPONENT_EXTENDED_BUILTIN_TYPE.  Just break; for
            DEMANGLE_COMPONENT_FIXED_TYPE.
            (d_find_pack): Handle DEMANGLE_COMPONENT_EXTENDED_BUILTIN_TYPE.
            Don't handle DEMANGLE_COMPONENT_FIXED_TYPE.
            (d_print_comp_inner): Likewise.
            * cp-demangle.h (D_BUILTIN_TYPE_COUNT): Bump.
            * testsuite/demangle-expected: Replace _Z3xxxDFyuVb test
            with _Z3xxxDF16_DF32_DF64_DF128_CDF16_Vb.  Add
            _Z3xxxDF32xDF64xDF128xCDF32xVb test.
    fixincludes/
            * inclhack.def (glibc_cxx_floatn_1, glibc_cxx_floatn_2,
            glibc_cxx_floatn_3): New fixes.
            * tests/base/bits/floatn.h: New file.
            * fixincl.x: Regenerated.
---
 fixincludes/fixincl.x                       | 154 +++++++++-
 fixincludes/inclhack.def                    |  96 ++++++
 fixincludes/tests/base/bits/floatn.h        |  74 +++++
 gcc/builtins.def                            |   5 +-
 gcc/c-family/c-common.cc                    |  37 ++-
 gcc/c-family/c-cppbuiltin.cc                |   8 +
 gcc/c-family/c-lex.cc                       |  20 +-
 gcc/config/i386/avx512fp16intrin.h          |  11 +-
 gcc/config/i386/i386-builtins.cc            |  15 +-
 gcc/config/i386/i386.cc                     |   5 +-
 gcc/config/ia64/ia64.cc                     |  24 +-
 gcc/config/rs6000/rs6000-builtin.cc         |  17 +-
 gcc/config/rs6000/rs6000-c.cc               |   1 +
 gcc/config/rs6000/rs6000.cc                 |   6 +-
 gcc/cp/call.cc                              | 130 +++++++-
 gcc/cp/cp-tree.h                            |  13 +
 gcc/cp/mangle.cc                            |  67 +----
 gcc/cp/parser.cc                            |   9 +
 gcc/cp/typeck.cc                            | 172 ++++++++++-
 gcc/cp/typeck2.cc                           |  25 +-
 gcc/testsuite/g++.dg/cpp23/ext-floating.h   |  30 ++
 gcc/testsuite/g++.dg/cpp23/ext-floating1.C  | 447 ++++++++++++++++++++++++++++
 gcc/testsuite/g++.dg/cpp23/ext-floating10.C |  13 +
 gcc/testsuite/g++.dg/cpp23/ext-floating2.C  | 157 ++++++++++
 gcc/testsuite/g++.dg/cpp23/ext-floating3.C  | 134 +++++++++
 gcc/testsuite/g++.dg/cpp23/ext-floating4.C  | 126 ++++++++
 gcc/testsuite/g++.dg/cpp23/ext-floating5.C  |  13 +
 gcc/testsuite/g++.dg/cpp23/ext-floating6.C  |  30 ++
 gcc/testsuite/g++.dg/cpp23/ext-floating7.C  | 119 ++++++++
 gcc/testsuite/g++.dg/cpp23/ext-floating8.C  |  13 +
 gcc/testsuite/g++.dg/cpp23/ext-floating9.C  |  13 +
 gcc/testsuite/g++.target/i386/float16-1.C   |   4 +-
 gcc/tree-core.h                             |   4 +
 gcc/tree.cc                                 |   1 +
 gcc/tree.h                                  |   4 +
 include/demangle.h                          |  14 +
 libcpp/expr.cc                              |   1 -
 libiberty/cp-demangle.c                     | 100 ++++---
 libiberty/cp-demangle.h                     |   2 +-
 libiberty/testsuite/demangle-expected       |   8 +-
 40 files changed, 1974 insertions(+), 148 deletions(-)

diff --git a/fixincludes/fixincl.x b/fixincludes/fixincl.x
index bad490453b7..56c37b7fd08 100644
--- a/fixincludes/fixincl.x
+++ b/fixincludes/fixincl.x
@@ -2,11 +2,11 @@
  *
  * DO NOT EDIT THIS FILE   (fixincl.x)
  *
- * It has been AutoGen-ed  February 27, 2022 at 07:47:03 PM by AutoGen 5.18.16
+ * It has been AutoGen-ed  September 27, 2022 at 12:49:21 AM by AutoGen 5.18.16
  * From the definitions    inclhack.def
  * and the template file   fixincl
  */
-/* DO NOT SVN-MERGE THIS FILE, EITHER Sun Feb 27 19:47:03 UTC 2022
+/* DO NOT SVN-MERGE THIS FILE, EITHER Tue Sep 27 00:49:21 CEST 2022
  *
  * You must regenerate it.  Use the ./genfixes script.
  *
@@ -15,7 +15,7 @@
  * certain ANSI-incompatible system header files which are fixed to work
  * correctly with ANSI C and placed in a directory that GNU C will search.
  *
- * This file contains 267 fixup descriptions.
+ * This file contains 270 fixup descriptions.
  *
  * See README for more information.
  *
@@ -4105,6 +4105,132 @@ static const char* apzGlibc_C99_Inline_4Patch[] = {
     "%0 __attribute__ ((__gnu_inline__))",
     (char*)NULL };
 
+/* * * * * * * * * * * * * * * * * * * * * * * * * *
+ *
+ *  Description of Glibc_Cxx_Floatn_1 fix
+ */
+tSCC zGlibc_Cxx_Floatn_1Name[] =
+     "glibc_cxx_floatn_1";
+
+/*
+ *  File name selection pattern
+ */
+tSCC zGlibc_Cxx_Floatn_1List[] =
+  "bits/floatn.h\0bits/floatn-common.h\0";
+/*
+ *  Machine/OS name selection pattern
+ */
+#define apzGlibc_Cxx_Floatn_1Machs (const char**)NULL
+
+/*
+ *  content selection pattern - do fix if pattern found
+ */
+tSCC zGlibc_Cxx_Floatn_1Select0[] =
+       "^([ \t]*#[ \t]*if !__GNUC_PREREQ \\(7, 0\\) \\|\\| )defined __cplusplus\n\
+(([ \t]*/\\*[^\n\
+]*\\*/\n\
+)?([ \t]*#[ \t]*if[^\n\
+]*\n\
+)?[ \t]*#[ \t]*define __f(16|32|64|128)x?\\()";
+
+#define    GLIBC_CXX_FLOATN_1_TEST_CT  1
+static tTestDesc aGlibc_Cxx_Floatn_1Tests[] = {
+  { TT_EGREP,    zGlibc_Cxx_Floatn_1Select0, (regex_t*)NULL }, };
+
+/*
+ *  Fix Command Arguments for Glibc_Cxx_Floatn_1
+ */
+static const char* apzGlibc_Cxx_Floatn_1Patch[] = {
+    "format",
+    "%1(defined __cplusplus && !__GNUC_PREREQ (13, 0))\n\
+%2",
+    (char*)NULL };
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * *
+ *
+ *  Description of Glibc_Cxx_Floatn_2 fix
+ */
+tSCC zGlibc_Cxx_Floatn_2Name[] =
+     "glibc_cxx_floatn_2";
+
+/*
+ *  File name selection pattern
+ */
+tSCC zGlibc_Cxx_Floatn_2List[] =
+  "bits/floatn.h\0bits/floatn-common.h\0";
+/*
+ *  Machine/OS name selection pattern
+ */
+#define apzGlibc_Cxx_Floatn_2Machs (const char**)NULL
+
+/*
+ *  content selection pattern - do fix if pattern found
+ */
+tSCC zGlibc_Cxx_Floatn_2Select0[] =
+       "^([ \t]*#[ \t]*if !__GNUC_PREREQ \\(7, 0\\) \\|\\| )defined __cplusplus\n\
+(([ \t]*/\\*[^\n\
+]*\\*/\n\
+)?[ \t]*typedef[ \t]+[^\n\
+]*[ \t]+_Float(16|32|64|128)x?([ \t]+__attribute__ \\(\\(__mode__ \\(__HF__\\)\\)\\))?;)";
+
+#define    GLIBC_CXX_FLOATN_2_TEST_CT  1
+static tTestDesc aGlibc_Cxx_Floatn_2Tests[] = {
+  { TT_EGREP,    zGlibc_Cxx_Floatn_2Select0, (regex_t*)NULL }, };
+
+/*
+ *  Fix Command Arguments for Glibc_Cxx_Floatn_2
+ */
+static const char* apzGlibc_Cxx_Floatn_2Patch[] = {
+    "format",
+    "%1(defined __cplusplus && !__GNUC_PREREQ (13, 0))\n\
+%2",
+    (char*)NULL };
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * *
+ *
+ *  Description of Glibc_Cxx_Floatn_3 fix
+ */
+tSCC zGlibc_Cxx_Floatn_3Name[] =
+     "glibc_cxx_floatn_3";
+
+/*
+ *  File name selection pattern
+ */
+tSCC zGlibc_Cxx_Floatn_3List[] =
+  "bits/floatn.h\0bits/floatn-common.h\0";
+/*
+ *  Machine/OS name selection pattern
+ */
+#define apzGlibc_Cxx_Floatn_3Machs (const char**)NULL
+
+/*
+ *  content selection pattern - do fix if pattern found
+ */
+tSCC zGlibc_Cxx_Floatn_3Select0[] =
+       "^([ \t]*#[ \t]*if !__GNUC_PREREQ \\(7, 0\\) \\|\\| )defined __cplusplus\n\
+(([ \t]*/\\*[^\n\
+]*\n\
+?[^\n\
+]*\\*/\n\
+)?([ \t]*#[ \t]*if[^\n\
+]*\n\
+)?([ \t]*typedef[ \t]+[^\n\
+]*;\n\
+)?[ \t]*#[ \t]*define __CFLOAT(16|32|64|128)X?[ \t]+)";
+
+#define    GLIBC_CXX_FLOATN_3_TEST_CT  1
+static tTestDesc aGlibc_Cxx_Floatn_3Tests[] = {
+  { TT_EGREP,    zGlibc_Cxx_Floatn_3Select0, (regex_t*)NULL }, };
+
+/*
+ *  Fix Command Arguments for Glibc_Cxx_Floatn_3
+ */
+static const char* apzGlibc_Cxx_Floatn_3Patch[] = {
+    "format",
+    "%1(defined __cplusplus && !__GNUC_PREREQ (13, 0))\n\
+%2",
+    (char*)NULL };
+
 /* * * * * * * * * * * * * * * * * * * * * * * * * *
  *
  *  Description of Glibc_Mutex_Init fix
@@ -10872,9 +10998,9 @@ static const char* apzX11_SprintfPatch[] = {
  *
  *  List of all fixes
  */
-#define REGEX_COUNT          305
+#define REGEX_COUNT          308
 #define MACH_LIST_SIZE_LIMIT 187
-#define FIX_COUNT            267
+#define FIX_COUNT            270
 
 /*
  *  Enumerate the fixes
@@ -10977,6 +11103,9 @@ typedef enum {
     GLIBC_C99_INLINE_2_FIXIDX,
     GLIBC_C99_INLINE_3_FIXIDX,
     GLIBC_C99_INLINE_4_FIXIDX,
+    GLIBC_CXX_FLOATN_1_FIXIDX,
+    GLIBC_CXX_FLOATN_2_FIXIDX,
+    GLIBC_CXX_FLOATN_3_FIXIDX,
     GLIBC_MUTEX_INIT_FIXIDX,
     GLIBC_STDINT_FIXIDX,
     GLIBC_STRNCPY_FIXIDX,
@@ -11635,6 +11764,21 @@ tFixDesc fixDescList[ FIX_COUNT ] = {
      GLIBC_C99_INLINE_4_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
      aGlibc_C99_Inline_4Tests,   apzGlibc_C99_Inline_4Patch, 0 },
 
+  {  zGlibc_Cxx_Floatn_1Name,    zGlibc_Cxx_Floatn_1List,
+     apzGlibc_Cxx_Floatn_1Machs,
+     GLIBC_CXX_FLOATN_1_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
+     aGlibc_Cxx_Floatn_1Tests,   apzGlibc_Cxx_Floatn_1Patch, 0 },
+
+  {  zGlibc_Cxx_Floatn_2Name,    zGlibc_Cxx_Floatn_2List,
+     apzGlibc_Cxx_Floatn_2Machs,
+     GLIBC_CXX_FLOATN_2_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
+     aGlibc_Cxx_Floatn_2Tests,   apzGlibc_Cxx_Floatn_2Patch, 0 },
+
+  {  zGlibc_Cxx_Floatn_3Name,    zGlibc_Cxx_Floatn_3List,
+     apzGlibc_Cxx_Floatn_3Machs,
+     GLIBC_CXX_FLOATN_3_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
+     aGlibc_Cxx_Floatn_3Tests,   apzGlibc_Cxx_Floatn_3Patch, 0 },
+
   {  zGlibc_Mutex_InitName,    zGlibc_Mutex_InitList,
      apzGlibc_Mutex_InitMachs,
      GLIBC_MUTEX_INIT_TEST_CT, FD_MACH_ONLY,
diff --git a/fixincludes/inclhack.def b/fixincludes/inclhack.def
index 7605ac89aa2..a3f171ab4b6 100644
--- a/fixincludes/inclhack.def
+++ b/fixincludes/inclhack.def
@@ -2015,6 +2015,102 @@ fix = {
 	EOT;
 };
 
+/*  glibc-2.27 to 2.36 assume GCC 7 or later supports some or all
+ *  of _Float{16,32,64,128} and _Float{32,64,128}x keywords for C,
+ *  but doesn't for C++.
+ */
+fix = {
+    hackname  = glibc_cxx_floatn_1;
+    files     = bits/floatn.h, bits/floatn-common.h;
+    select    = "^([ \t]*#[ \t]*if !__GNUC_PREREQ \\(7, 0\\) \\|\\| )defined __cplusplus\n"
+		"(([ \t]*/\\*[^\n]*\\*/\n)?"
+		"([ \t]*#[ \t]*if[^\n]*\n)?"
+		"[ \t]*#[ \t]*define __f(16|32|64|128)x?\\()";
+    c_fix     = format;
+    c_fix_arg = "%1(defined __cplusplus && !__GNUC_PREREQ (13, 0))\n%2";
+    test_text = <<-EOT
+	#  if !__GNUC_PREREQ (7, 0) || defined __cplusplus
+	/* The literal suffix f128 exists only since GCC 7.0.  */
+	#   define __f128(x) x##l
+	#  else
+	#   define __f128(x) x##f128
+	#  endif
+	#  if !__GNUC_PREREQ (7, 0) || defined __cplusplus
+	/* The literal suffix (f128) exist for powerpc only since GCC 7.0.  */
+	#   if __LDBL_MANT_DIG__ == 113
+	#    define __f128(x) x##l
+	#   else
+	#    define __f128(x) x##q
+	#   endif
+	#  else
+	#   define __f128(x) x##f128
+	#  endif
+	#  if !__GNUC_PREREQ (7, 0) || defined __cplusplus
+	#   ifdef __NO_LONG_DOUBLE_MATH
+	#    define __f64(x) x##l
+	#   else
+	#    define __f64(x) x
+	#   endif
+	#  else
+	#   define __f64(x) x##f64
+	#  endif
+	EOT;
+};
+
+fix = {
+    hackname  = glibc_cxx_floatn_2;
+    files     = bits/floatn.h, bits/floatn-common.h;
+    select    = "^([ \t]*#[ \t]*if !__GNUC_PREREQ \\(7, 0\\) \\|\\| )defined __cplusplus\n"
+		"(([ \t]*/\\*[^\n]*\\*/\n)?"
+		"[ \t]*typedef[ \t]+[^\n]*[ \t]+_Float(16|32|64|128)x?([ \t]+__attribute__ \\(\\(__mode__ \\(__HF__\\)\\)\\))?;)";
+    c_fix     = format;
+    c_fix_arg = "%1(defined __cplusplus && !__GNUC_PREREQ (13, 0))\n%2";
+    test_text = <<-EOT
+	#  if !__GNUC_PREREQ (7, 0) || defined __cplusplus
+	typedef float _Float16 __attribute__ ((__mode__ (__HF__)));
+	#  endif
+	#  if !__GNUC_PREREQ (7, 0) || defined __cplusplus
+	typedef __float128 _Float128;
+	#  endif
+	EOT;
+};
+
+fix = {
+    hackname  = glibc_cxx_floatn_3;
+    files     = bits/floatn.h, bits/floatn-common.h;
+    select    = "^([ \t]*#[ \t]*if !__GNUC_PREREQ \\(7, 0\\) \\|\\| )defined __cplusplus\n"
+		"(([ \t]*/\\*[^\n]*\n?[^\n]*\\*/\n)?"
+		"([ \t]*#[ \t]*if[^\n]*\n)?"
+		"([ \t]*typedef[ \t]+[^\n]*;\n)?"
+		"[ \t]*#[ \t]*define __CFLOAT(16|32|64|128)X?[ \t]+)";
+    c_fix     = format;
+    c_fix_arg = "%1(defined __cplusplus && !__GNUC_PREREQ (13, 0))\n%2";
+    test_text = <<-EOT
+	#  if !__GNUC_PREREQ (7, 0) || defined __cplusplus
+	#   define __CFLOAT128 _Complex long double
+	#  else
+	#   define __CFLOAT128 _Complex _Float128
+	#  endif
+	#  if !__GNUC_PREREQ (7, 0) || defined __cplusplus
+	/* Add a typedef for older GCC compilers which don't natively support
+	   _Complex _Float128.  */
+	typedef _Complex float __cfloat128 __attribute__ ((__mode__ (__TC__)));
+	#   define __CFLOAT128 __cfloat128
+	#  else
+	#   define __CFLOAT128 _Complex _Float128
+	#  endif
+	#  if !__GNUC_PREREQ (7, 0) || defined __cplusplus
+	#   ifdef __NO_LONG_DOUBLE_MATH
+	#    define __CFLOAT64 _Complex long double
+	#   else
+	#    define __CFLOAT64 _Complex double
+	#   endif
+	#  else
+	#   define __CFLOAT64 _Complex _Float64
+	#  endif
+	EOT;
+};
+
 /*  glibc-2.3.5 defines pthread mutex initializers incorrectly,
  *  so we replace them with versions that correspond to the
  *  definition.
diff --git a/fixincludes/tests/base/bits/floatn.h b/fixincludes/tests/base/bits/floatn.h
new file mode 100644
index 00000000000..f09528b6e27
--- /dev/null
+++ b/fixincludes/tests/base/bits/floatn.h
@@ -0,0 +1,74 @@
+/*  DO NOT EDIT THIS FILE.
+
+    It has been auto-edited by fixincludes from:
+
+	"fixinc/tests/inc/bits/floatn.h"
+
+    This had to be done to correct non-standard usages in the
+    original, manufacturer supplied header file.  */
+
+
+
+#if defined( GLIBC_CXX_FLOATN_1_CHECK )
+#  if !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0))
+/* The literal suffix f128 exists only since GCC 7.0.  */
+#   define __f128(x) x##l
+#  else
+#   define __f128(x) x##f128
+#  endif
+#  if !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0))
+/* The literal suffix (f128) exist for powerpc only since GCC 7.0.  */
+#   if __LDBL_MANT_DIG__ == 113
+#    define __f128(x) x##l
+#   else
+#    define __f128(x) x##q
+#   endif
+#  else
+#   define __f128(x) x##f128
+#  endif
+#  if !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0))
+#   ifdef __NO_LONG_DOUBLE_MATH
+#    define __f64(x) x##l
+#   else
+#    define __f64(x) x
+#   endif
+#  else
+#   define __f64(x) x##f64
+#  endif
+#endif  /* GLIBC_CXX_FLOATN_1_CHECK */
+
+
+#if defined( GLIBC_CXX_FLOATN_2_CHECK )
+#  if !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0))
+typedef float _Float16 __attribute__ ((__mode__ (__HF__)));
+#  endif
+#  if !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0))
+typedef __float128 _Float128;
+#  endif
+#endif  /* GLIBC_CXX_FLOATN_2_CHECK */
+
+
+#if defined( GLIBC_CXX_FLOATN_3_CHECK )
+#  if !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0))
+#   define __CFLOAT128 _Complex long double
+#  else
+#   define __CFLOAT128 _Complex _Float128
+#  endif
+#  if !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0))
+/* Add a typedef for older GCC compilers which don't natively support
+   _Complex _Float128.  */
+typedef _Complex float __cfloat128 __attribute__ ((__mode__ (__TC__)));
+#   define __CFLOAT128 __cfloat128
+#  else
+#   define __CFLOAT128 _Complex _Float128
+#  endif
+#  if !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0))
+#   ifdef __NO_LONG_DOUBLE_MATH
+#    define __CFLOAT64 _Complex long double
+#   else
+#    define __CFLOAT64 _Complex double
+#   endif
+#  else
+#   define __CFLOAT64 _Complex _Float64
+#  endif
+#endif  /* GLIBC_CXX_FLOATN_3_CHECK */
diff --git a/gcc/builtins.def b/gcc/builtins.def
index f0236316850..109b3879220 100644
--- a/gcc/builtins.def
+++ b/gcc/builtins.def
@@ -114,9 +114,8 @@ along with GCC; see the file COPYING3.  If not see
    with an argument such as FLOAT32 to produce the enum value for the type.  If
    we are compiling for the C language with GNU extensions, we enable the name
    without the __builtin_ prefix as well as the name with the __builtin_
-   prefix.  C++ does not enable these names by default because they don't have
-   the _Float<N> and _Float<N>X keywords, and a class based library should use
-   the __builtin_ names.  */
+   prefix.  C++ does not enable these names by default because a class based
+   library should use the __builtin_ names.  */
 #undef DEF_FLOATN_BUILTIN
 #define DEF_FLOATN_BUILTIN(ENUM, NAME, TYPE, ATTRS)	\
   DEF_BUILTIN (ENUM, "__builtin_" NAME, BUILT_IN_NORMAL, TYPE, TYPE,	\
diff --git a/gcc/c-family/c-common.cc b/gcc/c-family/c-common.cc
index dce3045c9f2..cda6910e8c5 100644
--- a/gcc/c-family/c-common.cc
+++ b/gcc/c-family/c-common.cc
@@ -352,13 +352,13 @@ const struct c_common_resword c_common_reswords[] =
   { "_Bool",		RID_BOOL,      D_CONLY },
   { "_Complex",		RID_COMPLEX,	0 },
   { "_Imaginary",	RID_IMAGINARY, D_CONLY },
-  { "_Float16",         RID_FLOAT16,   D_CONLY },
-  { "_Float32",         RID_FLOAT32,   D_CONLY },
-  { "_Float64",         RID_FLOAT64,   D_CONLY },
-  { "_Float128",        RID_FLOAT128,  D_CONLY },
-  { "_Float32x",        RID_FLOAT32X,  D_CONLY },
-  { "_Float64x",        RID_FLOAT64X,  D_CONLY },
-  { "_Float128x",       RID_FLOAT128X, D_CONLY },
+  { "_Float16",         RID_FLOAT16,    0 },
+  { "_Float32",         RID_FLOAT32,    0 },
+  { "_Float64",         RID_FLOAT64,    0 },
+  { "_Float128",        RID_FLOAT128,   0 },
+  { "_Float32x",        RID_FLOAT32X,   0 },
+  { "_Float64x",        RID_FLOAT64X,   0 },
+  { "_Float128x",       RID_FLOAT128X,  0 },
   { "_Decimal32",       RID_DFLOAT32,  D_CONLY },
   { "_Decimal64",       RID_DFLOAT64,  D_CONLY },
   { "_Decimal128",      RID_DFLOAT128, D_CONLY },
@@ -1431,8 +1431,11 @@ shorten_binary_op (tree result_type, tree op0, tree op1, bool bitwise)
 	  == TYPE_PRECISION (TREE_TYPE (arg0)))
       && unsigned0 == unsigned1
       && (unsigned0 || !uns))
-    return c_common_signed_or_unsigned_type
-      (unsigned0, common_type (TREE_TYPE (arg0), TREE_TYPE (arg1)));
+    {
+      tree ctype = common_type (TREE_TYPE (arg0), TREE_TYPE (arg1));
+      if (ctype != error_mark_node)
+	return c_common_signed_or_unsigned_type (unsigned0, ctype);
+    }
 
   else if (TREE_CODE (arg0) == INTEGER_CST
 	   && (unsigned1 || !uns)
@@ -3204,9 +3207,10 @@ shorten_compare (location_t loc, tree *op0_ptr, tree *op1_ptr,
 
   else if (unsignedp0 == unsignedp1 && real1 == real2
 	   && TYPE_PRECISION (TREE_TYPE (primop0)) < TYPE_PRECISION (*restype_ptr)
-	   && TYPE_PRECISION (TREE_TYPE (primop1)) < TYPE_PRECISION (*restype_ptr))
+	   && TYPE_PRECISION (TREE_TYPE (primop1)) < TYPE_PRECISION (*restype_ptr)
+	   && (type = common_type (TREE_TYPE (primop0), TREE_TYPE (primop1)))
+	      != error_mark_node)
     {
-      type = common_type (TREE_TYPE (primop0), TREE_TYPE (primop1));
       type = c_common_signed_or_unsigned_type (unsignedp0
 					       || TYPE_UNSIGNED (*restype_ptr),
 					       type);
@@ -4380,11 +4384,18 @@ c_common_nodes_and_builtins (void)
   record_builtin_type (RID_DOUBLE, NULL, double_type_node);
   record_builtin_type (RID_MAX, "long double", long_double_type_node);
 
-  if (!c_dialect_cxx ())
-    for (i = 0; i < NUM_FLOATN_NX_TYPES; i++)
+  for (i = 0; i < NUM_FLOATN_NX_TYPES; i++)
+    {
       if (FLOATN_NX_TYPE_NODE (i) != NULL_TREE)
 	record_builtin_type ((enum rid) (RID_FLOATN_NX_FIRST + i), NULL,
 			     FLOATN_NX_TYPE_NODE (i));
+    }
+
+  /* For C, let float128t_type_node (__float128 in some backends) be the
+     same type as float128_type_node (_Float128), for C++ let those
+     be distinct types that mangle and behave differently.  */
+  if (c_dialect_cxx ())
+    float128t_type_node = NULL_TREE;
 
   /* Only supported decimal floating point extension if the target
      actually supports underlying modes. */
diff --git a/gcc/c-family/c-cppbuiltin.cc b/gcc/c-family/c-cppbuiltin.cc
index b709f845c81..e3f4d3d4565 100644
--- a/gcc/c-family/c-cppbuiltin.cc
+++ b/gcc/c-family/c-cppbuiltin.cc
@@ -1246,6 +1246,14 @@ c_cpp_builtins (cpp_reader *pfile)
     {
       if (FLOATN_NX_TYPE_NODE (i) == NULL_TREE)
 	continue;
+      if (c_dialect_cxx ()
+	  && cxx_dialect > cxx20
+	  && !floatn_nx_types[i].extended)
+	{
+	  char name[sizeof ("__STDCPP_FLOAT128_T__=1")];
+	  sprintf (name, "__STDCPP_FLOAT%d_T__=1", floatn_nx_types[i].n);
+	  cpp_define (pfile, name);
+	}
       char prefix[20], csuffix[20];
       sprintf (prefix, "FLT%d%s", floatn_nx_types[i].n,
 	       floatn_nx_types[i].extended ? "X" : "");
diff --git a/gcc/c-family/c-lex.cc b/gcc/c-family/c-lex.cc
index 110d029ee0c..4d2252fd946 100644
--- a/gcc/c-family/c-lex.cc
+++ b/gcc/c-family/c-lex.cc
@@ -960,6 +960,10 @@ interpret_float (const cpp_token *token, unsigned int flags,
 	  pedwarn (input_location, OPT_Wpedantic, "non-standard suffix on floating constant");
 
 	type = c_common_type_for_mode (mode, 0);
+	/* For Q suffix, prefer float128t_type_node (__float128) type
+	   over float128_type_node (_Float128) type if they are distinct.  */
+	if (type == float128_type_node && float128t_type_node)
+	  type = float128t_type_node;
 	gcc_assert (type);
       }
     else if ((flags & (CPP_N_FLOATN | CPP_N_FLOATNX)) != 0)
@@ -979,8 +983,17 @@ interpret_float (const cpp_token *token, unsigned int flags,
 	    error ("unsupported non-standard suffix on floating constant");
 	    return error_mark_node;
 	  }
+	else if (c_dialect_cxx () && !extended)
+	  {
+	    if (cxx_dialect < cxx23)
+	      pedwarn (input_location, OPT_Wpedantic,
+		       "%<f%d%> or %<F%d%> suffix on floating constant only "
+		       "available with %<-std=c++2b%> or %<-std=gnu++2b%>",
+		       n, n);
+	  }
 	else
-	  pedwarn (input_location, OPT_Wpedantic, "non-standard suffix on floating constant");
+	  pedwarn (input_location, OPT_Wpedantic,
+		   "non-standard suffix on floating constant");
       }
     else if ((flags & CPP_N_WIDTH) == CPP_N_LARGE)
       type = long_double_type_node;
@@ -990,7 +1003,10 @@ interpret_float (const cpp_token *token, unsigned int flags,
     else
       type = double_type_node;
 
-  const_type = excess_precision_type (type);
+  if (c_dialect_cxx ())
+    const_type = NULL_TREE;
+  else
+    const_type = excess_precision_type (type);
   if (!const_type)
     const_type = type;
 
diff --git a/gcc/config/i386/avx512fp16intrin.h b/gcc/config/i386/avx512fp16intrin.h
index 28041516bac..75f7475ad18 100644
--- a/gcc/config/i386/avx512fp16intrin.h
+++ b/gcc/config/i386/avx512fp16intrin.h
@@ -183,21 +183,21 @@ extern __inline __m128h
 __attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
 _mm_setzero_ph (void)
 {
-  return _mm_set1_ph (0.0f);
+  return _mm_set1_ph (0.0f16);
 }
 
 extern __inline __m256h
 __attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
 _mm256_setzero_ph (void)
 {
-  return _mm256_set1_ph (0.0f);
+  return _mm256_set1_ph (0.0f16);
 }
 
 extern __inline __m512h
 __attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
 _mm512_setzero_ph (void)
 {
-  return _mm512_set1_ph (0.0f);
+  return _mm512_set1_ph (0.0f16);
 }
 
 extern __inline __m128h
@@ -358,7 +358,8 @@ extern __inline __m128h
 __attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
 _mm_set_sh (_Float16 __F)
 {
-  return _mm_set_ph (0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, __F);
+  return _mm_set_ph (0.0f16, 0.0f16, 0.0f16, 0.0f16, 0.0f16, 0.0f16, 0.0f16,
+		     __F);
 }
 
 /* Create a vector with element 0 as *P and the rest zero.  */
@@ -366,7 +367,7 @@ extern __inline __m128h
 __attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
 _mm_load_sh (void const *__P)
 {
-  return _mm_set_ph (0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
+  return _mm_set_ph (0.0f16, 0.0f16, 0.0f16, 0.0f16, 0.0f16, 0.0f16, 0.0f16,
 		     *(_Float16 const *) __P);
 }
 
diff --git a/gcc/config/i386/i386-builtins.cc b/gcc/config/i386/i386-builtins.cc
index af2faee245b..b91aba18221 100644
--- a/gcc/config/i386/i386-builtins.cc
+++ b/gcc/config/i386/i386-builtins.cc
@@ -1409,9 +1409,18 @@ ix86_init_builtin_types (void)
   lang_hooks.types.register_builtin_type (float80_type_node, "__float80");
 
   /* The __float128 type.  The node has already been created as
-     _Float128, so we only need to register the __float128 name for
-     it.  */
-  lang_hooks.types.register_builtin_type (float128_type_node, "__float128");
+     _Float128, so for C we only need to register the __float128 name for
+     it.  For C++, we create a distinct type which will mangle differently
+     (g) vs. _Float128 (DF128_) and behave backwards compatibly.  */
+  if (float128t_type_node == NULL_TREE)
+    {
+      float128t_type_node = make_node (REAL_TYPE);
+      TYPE_PRECISION (float128t_type_node)
+	= TYPE_PRECISION (float128_type_node);
+      SET_TYPE_MODE (float128t_type_node, TYPE_MODE (float128_type_node));
+      layout_type (float128t_type_node);
+    }
+  lang_hooks.types.register_builtin_type (float128t_type_node, "__float128");
 
   ix86_register_float16_builtin_type ();
 
diff --git a/gcc/config/i386/i386.cc b/gcc/config/i386/i386.cc
index ca799da5d7e..4386caf843e 100644
--- a/gcc/config/i386/i386.cc
+++ b/gcc/config/i386/i386.cc
@@ -22735,7 +22735,10 @@ ix86_mangle_type (const_tree type)
       return "DF16_";
     case E_TFmode:
       /* __float128 is "g".  */
-      return "g";
+      if (type == float128t_type_node)
+	return "g";
+      /* _Float128 should mangle as "DF128_" done in generic code.  */
+      return NULL;
     case E_XFmode:
       /* "long double" or __float80 is "e".  */
       return "e";
diff --git a/gcc/config/ia64/ia64.cc b/gcc/config/ia64/ia64.cc
index 50ae7aa4cd6..d510573a0a4 100644
--- a/gcc/config/ia64/ia64.cc
+++ b/gcc/config/ia64/ia64.cc
@@ -10466,11 +10466,19 @@ ia64_init_builtins (void)
 	= build_pointer_type (build_qualified_type
 			      (char_type_node, TYPE_QUAL_CONST));
 
-      (*lang_hooks.types.register_builtin_type) (float128_type_node,
+      if (float128t_type_node == NULL_TREE)
+	{
+	  float128t_type_node = make_node (REAL_TYPE);
+	  TYPE_PRECISION (float128t_type_node)
+	    = TYPE_PRECISION (float128_type_node);
+	  layout_type (float128t_type_node);
+	  SET_TYPE_MODE (float128t_type_node, TYPE_MODE (float128_type_node));
+	}
+      (*lang_hooks.types.register_builtin_type) (float128t_type_node,
 						 "__float128");
 
       /* TFmode support builtins.  */
-      ftype = build_function_type_list (float128_type_node, NULL_TREE);
+      ftype = build_function_type_list (float128t_type_node, NULL_TREE);
       decl = add_builtin_function ("__builtin_infq", ftype,
 				   IA64_BUILTIN_INFQ, BUILT_IN_MD,
 				   NULL, NULL_TREE);
@@ -10481,7 +10489,7 @@ ia64_init_builtins (void)
 				   NULL, NULL_TREE);
       ia64_builtins[IA64_BUILTIN_HUGE_VALQ] = decl;
 
-      ftype = build_function_type_list (float128_type_node,
+      ftype = build_function_type_list (float128t_type_node,
 					const_string_type,
 					NULL_TREE);
       decl = add_builtin_function ("__builtin_nanq", ftype,
@@ -10496,8 +10504,8 @@ ia64_init_builtins (void)
       TREE_READONLY (decl) = 1;
       ia64_builtins[IA64_BUILTIN_NANSQ] = decl;
 
-      ftype = build_function_type_list (float128_type_node,
-					float128_type_node,
+      ftype = build_function_type_list (float128t_type_node,
+					float128t_type_node,
 					NULL_TREE);
       decl = add_builtin_function ("__builtin_fabsq", ftype,
 				   IA64_BUILTIN_FABSQ, BUILT_IN_MD,
@@ -10505,9 +10513,9 @@ ia64_init_builtins (void)
       TREE_READONLY (decl) = 1;
       ia64_builtins[IA64_BUILTIN_FABSQ] = decl;
 
-      ftype = build_function_type_list (float128_type_node,
-					float128_type_node,
-					float128_type_node,
+      ftype = build_function_type_list (float128t_type_node,
+					float128t_type_node,
+					float128t_type_node,
 					NULL_TREE);
       decl = add_builtin_function ("__builtin_copysignq", ftype,
 				   IA64_BUILTIN_COPYSIGNQ, BUILT_IN_MD,
diff --git a/gcc/config/rs6000/rs6000-builtin.cc b/gcc/config/rs6000/rs6000-builtin.cc
index 3ce729c1e6d..90ab39dc258 100644
--- a/gcc/config/rs6000/rs6000-builtin.cc
+++ b/gcc/config/rs6000/rs6000-builtin.cc
@@ -733,7 +733,22 @@ rs6000_init_builtins (void)
       if (TARGET_IEEEQUAD && TARGET_LONG_DOUBLE_128)
 	ieee128_float_type_node = long_double_type_node;
       else
-	ieee128_float_type_node = float128_type_node;
+	{
+	  /* For C we only need to register the __ieee128 name for
+	     it.  For C++, we create a distinct type which will mangle
+	     differently (u9__ieee128) vs. _Float128 (DF128_) and behave
+	     backwards compatibly.  */
+	  if (float128t_type_node == NULL_TREE)
+	    {
+	      float128t_type_node = make_node (REAL_TYPE);
+	      TYPE_PRECISION (float128t_type_node)
+		= TYPE_PRECISION (float128_type_node);
+	      layout_type (float128t_type_node);
+	      SET_TYPE_MODE (float128t_type_node,
+			     TYPE_MODE (float128_type_node));
+	    }
+	  ieee128_float_type_node = float128t_type_node;
+	}
       t = build_qualified_type (ieee128_float_type_node, TYPE_QUAL_CONST);
       lang_hooks.types.register_builtin_type (ieee128_float_type_node,
 					      "__ieee128");
diff --git a/gcc/config/rs6000/rs6000-c.cc b/gcc/config/rs6000/rs6000-c.cc
index ca9cc42028f..56609462629 100644
--- a/gcc/config/rs6000/rs6000-c.cc
</cut>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-09-28 16:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-28 16:42 [TCWG CI] Failure after basepoints/gcc-13-2887-gb04208895fe: c++: Implement P1467R9 - Extended floating-point types and standard names compiler part except for bfloat16 [PR106652] ci_notify
  -- strict thread matches above, loose matches on Subject: below --
2022-09-27 14:58 ci_notify

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).