diff options
Diffstat (limited to 'gcc/c')
-rw-r--r-- | gcc/c/c-decl.cc | 38 | ||||
-rw-r--r-- | gcc/c/c-parser.cc | 14 | ||||
-rw-r--r-- | gcc/c/c-tree.h | 5 | ||||
-rw-r--r-- | gcc/c/c-typeck.cc | 5 |
4 files changed, 55 insertions, 7 deletions
diff --git a/gcc/c/c-decl.cc b/gcc/c/c-decl.cc index e5045c6..3a45c02 100644 --- a/gcc/c/c-decl.cc +++ b/gcc/c/c-decl.cc @@ -12119,6 +12119,10 @@ declspecs_add_type (location_t loc, struct c_declspecs *specs, error_at (loc, ("both %<long%> and %<_Decimal128%> in " "declaration specifiers")); + else if (specs->typespec_word == cts_dfloat64x) + error_at (loc, + ("both %<long%> and %<_Decimal64x%> in " + "declaration specifiers")); else { specs->long_p = true; @@ -12184,6 +12188,10 @@ declspecs_add_type (location_t loc, struct c_declspecs *specs, error_at (loc, ("both %<short%> and %<_Decimal128%> in " "declaration specifiers")); + else if (specs->typespec_word == cts_dfloat64x) + error_at (loc, + ("both %<short%> and %<_Decimal64x%> in " + "declaration specifiers")); else { specs->short_p = true; @@ -12236,6 +12244,10 @@ declspecs_add_type (location_t loc, struct c_declspecs *specs, error_at (loc, ("both %<signed%> and %<_Decimal128%> in " "declaration specifiers")); + else if (specs->typespec_word == cts_dfloat64x) + error_at (loc, + ("both %<signed%> and %<_Decimal64x%> in " + "declaration specifiers")); else { specs->signed_p = true; @@ -12288,6 +12300,10 @@ declspecs_add_type (location_t loc, struct c_declspecs *specs, error_at (loc, ("both %<unsigned%> and %<_Decimal128%> in " "declaration specifiers")); + else if (specs->typespec_word == cts_dfloat64x) + error_at (loc, + ("both %<unsigned%> and %<_Decimal64x%> in " + "declaration specifiers")); else { specs->unsigned_p = true; @@ -12327,6 +12343,10 @@ declspecs_add_type (location_t loc, struct c_declspecs *specs, error_at (loc, ("both %<complex%> and %<_Decimal128%> in " "declaration specifiers")); + else if (specs->typespec_word == cts_dfloat64x) + error_at (loc, + ("both %<complex%> and %<_Decimal64x%> in " + "declaration specifiers")); else if (specs->typespec_word == cts_fract) error_at (loc, ("both %<complex%> and %<_Fract%> in " @@ -12408,6 +12428,10 @@ declspecs_add_type (location_t loc, struct c_declspecs *specs, error_at (loc, ("both %<_Sat%> and %<_Decimal128%> in " "declaration specifiers")); + else if (specs->typespec_word == cts_dfloat64x) + error_at (loc, + ("both %<_Sat%> and %<_Decimal64x%> in " + "declaration specifiers")); else if (specs->complex_p) error_at (loc, ("both %<_Sat%> and %<complex%> in " @@ -12733,14 +12757,17 @@ declspecs_add_type (location_t loc, struct c_declspecs *specs, case RID_DFLOAT32: case RID_DFLOAT64: case RID_DFLOAT128: + case RID_DFLOAT64X: { const char *str; if (i == RID_DFLOAT32) str = "_Decimal32"; else if (i == RID_DFLOAT64) str = "_Decimal64"; - else + else if (i == RID_DFLOAT128) str = "_Decimal128"; + else + str = "_Decimal64x"; if (specs->long_long_p) error_at (loc, ("both %<long long%> and %qs in " @@ -12780,8 +12807,10 @@ declspecs_add_type (location_t loc, struct c_declspecs *specs, specs->typespec_word = cts_dfloat32; else if (i == RID_DFLOAT64) specs->typespec_word = cts_dfloat64; - else + else if (i == RID_DFLOAT128) specs->typespec_word = cts_dfloat128; + else + specs->typespec_word = cts_dfloat64x; specs->locations[cdw_typespec] = loc; } if (!targetm.decimal_float_supported_p ()) @@ -13350,6 +13379,7 @@ finish_declspecs (struct c_declspecs *specs) case cts_dfloat32: case cts_dfloat64: case cts_dfloat128: + case cts_dfloat64x: gcc_assert (!specs->long_p && !specs->long_long_p && !specs->short_p && !specs->signed_p && !specs->unsigned_p && !specs->complex_p); if (!targetm.decimal_float_supported_p ()) @@ -13358,8 +13388,10 @@ finish_declspecs (struct c_declspecs *specs) specs->type = dfloat32_type_node; else if (specs->typespec_word == cts_dfloat64) specs->type = dfloat64_type_node; - else + else if (specs->typespec_word == cts_dfloat128) specs->type = dfloat128_type_node; + else + specs->type = dfloat64x_type_node; break; case cts_fract: gcc_assert (!specs->complex_p); diff --git a/gcc/c/c-parser.cc b/gcc/c/c-parser.cc index 3ab8a49..70fbf94 100644 --- a/gcc/c/c-parser.cc +++ b/gcc/c/c-parser.cc @@ -597,6 +597,7 @@ c_keyword_starts_typename (enum rid keyword) case RID_DFLOAT32: case RID_DFLOAT64: case RID_DFLOAT128: + case RID_DFLOAT64X: CASE_RID_FLOATN_NX: case RID_BOOL: case RID_BITINT: @@ -801,6 +802,7 @@ c_token_starts_declspecs (c_token *token) case RID_DFLOAT32: case RID_DFLOAT64: case RID_DFLOAT128: + case RID_DFLOAT64X: CASE_RID_FLOATN_NX: case RID_BOOL: case RID_BITINT: @@ -3505,6 +3507,7 @@ c_parser_declspecs (c_parser *parser, struct c_declspecs *specs, case RID_DFLOAT32: case RID_DFLOAT64: case RID_DFLOAT128: + case RID_DFLOAT64X: CASE_RID_FLOATN_NX: case RID_BOOL: case RID_FRACT: @@ -5229,6 +5232,7 @@ c_parser_gnu_attribute_any_word (c_parser *parser) case RID_DFLOAT32: case RID_DFLOAT64: case RID_DFLOAT128: + case RID_DFLOAT64X: CASE_RID_FLOATN_NX: case RID_BOOL: case RID_BITINT: @@ -11897,6 +11901,7 @@ c_parser_postfix_expression (c_parser *parser) bool arg_binary = all_binary; bool arg_int_decimal = all_decimal; bool arg_int_floatnx = false; + bool arg_int_decimalx = false; for (unsigned int j = 1; j <= nargs; j++) { if (parm_kind[j] == tgmath_fixed) @@ -12001,6 +12006,8 @@ c_parser_postfix_expression (c_parser *parser) arg_int_floatnx = true; break; } + if (rtype == dfloat64x_type_node) + arg_int_decimalx = true; } tree arg_real = NULL_TREE; for (unsigned int j = 1; j <= nargs; j++) @@ -12012,10 +12019,12 @@ c_parser_postfix_expression (c_parser *parser) if (TREE_CODE (type) == COMPLEX_TYPE) type = TREE_TYPE (type); if (INTEGRAL_TYPE_P (type)) - type = (arg_int_decimal - ? dfloat64_type_node + type = (arg_int_decimalx + ? dfloat64x_type_node : arg_int_floatnx ? float32x_type_node + : arg_int_decimal + ? dfloat64_type_node : double_type_node); if (arg_real == NULL_TREE) arg_real = type; @@ -13173,6 +13182,7 @@ warn_for_abs (location_t loc, tree fndecl, tree arg) case BUILT_IN_FABSD32: case BUILT_IN_FABSD64: case BUILT_IN_FABSD128: + case BUILT_IN_FABSD64X: if (!DECIMAL_FLOAT_TYPE_P (atype)) { if (INTEGRAL_TYPE_P (atype)) diff --git a/gcc/c/c-tree.h b/gcc/c/c-tree.h index f6bcbab..d39bd238 100644 --- a/gcc/c/c-tree.h +++ b/gcc/c/c-tree.h @@ -287,8 +287,8 @@ enum c_storage_class { }; /* A type specifier keyword "void", "_Bool", "char", "int", "float", - "double", "_Decimal32", "_Decimal64", "_Decimal128", "_Fract", "_Accum", - "_BitInt", or none of these. */ + "double", "_Decimal32", "_Decimal64", "_Decimal128", "_Decimal64x", + "_Fract", "_Accum", "_BitInt", or none of these. */ enum c_typespec_keyword { cts_none, cts_void, @@ -301,6 +301,7 @@ enum c_typespec_keyword { cts_dfloat32, cts_dfloat64, cts_dfloat128, + cts_dfloat64x, cts_floatn_nx, cts_fract, cts_accum, diff --git a/gcc/c/c-typeck.cc b/gcc/c/c-typeck.cc index ced58c2..10b02da 100644 --- a/gcc/c/c-typeck.cc +++ b/gcc/c/c-typeck.cc @@ -1158,6 +1158,11 @@ c_common_type (tree t1, tree t2) if (TYPE_MAIN_VARIANT (t1) == dfloat128_type_node || TYPE_MAIN_VARIANT (t2) == dfloat128_type_node) return dfloat128_type_node; + /* And prefer _Decimal128 over _Decimal64x which has in GCC's + implementation the same mode. */ + else if (TYPE_MAIN_VARIANT (t1) == dfloat64x_type_node + || TYPE_MAIN_VARIANT (t2) == dfloat64x_type_node) + return dfloat64x_type_node; else if (TYPE_MAIN_VARIANT (t1) == dfloat64_type_node || TYPE_MAIN_VARIANT (t2) == dfloat64_type_node) return dfloat64_type_node; |