aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-common.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/c-common.c')
-rw-r--r--gcc/c-common.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/gcc/c-common.c b/gcc/c-common.c
index cadf757..68fa9cf 100644
--- a/gcc/c-common.c
+++ b/gcc/c-common.c
@@ -65,10 +65,12 @@ cpp_reader *parse_in; /* Declared in c-pragma.h. */
tree short_integer_type_node;
tree long_integer_type_node;
tree long_long_integer_type_node;
+ tree int128_integer_type_node;
tree short_unsigned_type_node;
tree long_unsigned_type_node;
tree long_long_unsigned_type_node;
+ tree int128_unsigned_type_node;
tree truthvalue_type_node;
tree truthvalue_false_node;
@@ -595,6 +597,7 @@ const struct c_common_resword c_common_reswords[] =
{ "__has_trivial_copy", RID_HAS_TRIVIAL_COPY, D_CXXONLY },
{ "__has_trivial_destructor", RID_HAS_TRIVIAL_DESTRUCTOR, D_CXXONLY },
{ "__has_virtual_destructor", RID_HAS_VIRTUAL_DESTRUCTOR, D_CXXONLY },
+ { "__int128", RID_INT128, 0 },
{ "__is_abstract", RID_IS_ABSTRACT, D_CXXONLY },
{ "__is_base_of", RID_IS_BASE_OF, D_CXXONLY },
{ "__is_class", RID_IS_CLASS, D_CXXONLY },
@@ -2857,6 +2860,11 @@ c_common_type_for_size (unsigned int bits, int unsignedp)
return (unsignedp ? long_long_unsigned_type_node
: long_long_integer_type_node);
+ if (int128_integer_type_node
+ && bits == TYPE_PRECISION (int128_integer_type_node))
+ return (unsignedp ? int128_unsigned_type_node
+ : int128_integer_type_node);
+
if (bits == TYPE_PRECISION (widest_integer_literal_type_node))
return (unsignedp ? widest_unsigned_literal_type_node
: widest_integer_literal_type_node);
@@ -2935,6 +2943,10 @@ c_common_type_for_mode (enum machine_mode mode, int unsignedp)
if (mode == TYPE_MODE (long_long_integer_type_node))
return unsignedp ? long_long_unsigned_type_node : long_long_integer_type_node;
+ if (int128_integer_type_node
+ && mode == TYPE_MODE (int128_integer_type_node))
+ return unsignedp ? int128_unsigned_type_node : int128_integer_type_node;
+
if (mode == TYPE_MODE (widest_integer_literal_type_node))
return unsignedp ? widest_unsigned_literal_type_node
: widest_integer_literal_type_node;
@@ -3148,6 +3160,10 @@ c_common_signed_or_unsigned_type (int unsignedp, tree type)
return unsignedp ? long_unsigned_type_node : long_integer_type_node;
if (type1 == long_long_integer_type_node || type1 == long_long_unsigned_type_node)
return unsignedp ? long_long_unsigned_type_node : long_long_integer_type_node;
+ if (int128_integer_type_node
+ && (type1 == int128_integer_type_node
+ || type1 == int128_unsigned_type_node))
+ return unsignedp ? int128_unsigned_type_node : int128_integer_type_node;
if (type1 == widest_integer_literal_type_node || type1 == widest_unsigned_literal_type_node)
return unsignedp ? widest_unsigned_literal_type_node : widest_integer_literal_type_node;
#if HOST_BITS_PER_WIDE_INT >= 64
@@ -3262,6 +3278,9 @@ c_common_signed_or_unsigned_type (int unsignedp, tree type)
if (TYPE_OK (long_long_integer_type_node))
return (unsignedp ? long_long_unsigned_type_node
: long_long_integer_type_node);
+ if (int128_integer_type_node && TYPE_OK (int128_integer_type_node))
+ return (unsignedp ? int128_unsigned_type_node
+ : int128_integer_type_node);
if (TYPE_OK (widest_integer_literal_type_node))
return (unsignedp ? widest_unsigned_literal_type_node
: widest_integer_literal_type_node);
@@ -3305,6 +3324,10 @@ c_build_bitfield_integer_type (unsigned HOST_WIDE_INT width, int unsignedp)
if (width == TYPE_PRECISION (long_long_integer_type_node))
return (unsignedp ? long_long_unsigned_type_node
: long_long_integer_type_node);
+ if (int128_integer_type_node
+ && width == TYPE_PRECISION (int128_integer_type_node))
+ return (unsignedp ? int128_unsigned_type_node
+ : int128_integer_type_node);
return build_nonstandard_integer_type (width, unsignedp);
}
@@ -4697,6 +4720,13 @@ c_common_nodes_and_builtins (void)
record_builtin_type (RID_UNSIGNED, "unsigned int", unsigned_type_node);
record_builtin_type (RID_MAX, "long unsigned int",
long_unsigned_type_node);
+ if (int128_integer_type_node != NULL_TREE)
+ {
+ record_builtin_type (RID_INT128, "__int128",
+ int128_integer_type_node);
+ record_builtin_type (RID_MAX, "__int128 unsigned",
+ int128_unsigned_type_node);
+ }
if (c_dialect_cxx ())
record_builtin_type (RID_MAX, "unsigned long", long_unsigned_type_node);
record_builtin_type (RID_MAX, "long long int",