aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/gcc-interface/trans.c
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2020-09-12 12:59:09 +0200
committerEric Botcazou <ebotcazou@adacore.com>2020-09-12 13:01:19 +0200
commitf2d9f95e9ccac1376aee73345b8b4a00e803d67d (patch)
tree641d16d23406a8f3a611ee8f608fdc0cac592264 /gcc/ada/gcc-interface/trans.c
parentfe47e8163928d2cc42ad84634cfd147f948aad4a (diff)
downloadgcc-f2d9f95e9ccac1376aee73345b8b4a00e803d67d.zip
gcc-f2d9f95e9ccac1376aee73345b8b4a00e803d67d.tar.gz
gcc-f2d9f95e9ccac1376aee73345b8b4a00e803d67d.tar.bz2
Add preliminary support for 128-bit integer types
This is only the gigi part, in preparation for the bulk of the implementation. gcc/ada/ChangeLog: * fe.h: Fix pilot error in previous change. * gcc-interface/gigi.h (enum standard_datatypes): Add ADT_mulv128_decl. (mulv128_decl): New macro. (get_target_long_long_long_size): Declare. * gcc-interface/decl.c (gnat_to_gnu_entity): Use a maximum size of 128 bits for discrete types if Enable_128bit_Types is true. * gcc-interface/targtyps.c: Include target.h. (get_target_long_long_long_size): New function. * gcc-interface/trans.c (gigi): Initialize mulv128_decl if need be. (build_binary_op_trapv): Call it for 128-bit multiplication. * gcc-interface/utils.c (make_type_from_size): Enforce a maximum size of 128 bits if Enable_128bit_Types is true.
Diffstat (limited to 'gcc/ada/gcc-interface/trans.c')
-rw-r--r--gcc/ada/gcc-interface/trans.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/gcc/ada/gcc-interface/trans.c b/gcc/ada/gcc-interface/trans.c
index 39d4d28..9be1295 100644
--- a/gcc/ada/gcc-interface/trans.c
+++ b/gcc/ada/gcc-interface/trans.c
@@ -439,6 +439,19 @@ gigi (Node_Id gnat_root,
NULL_TREE, is_default, true, true, true, false,
false, NULL, Empty);
+ if (Enable_128bit_Types)
+ {
+ tree int128_type = gnat_type_for_size (128, 0);
+ mulv128_decl
+ = create_subprog_decl (get_identifier ("__gnat_mulv128"), NULL_TREE,
+ build_function_type_list (int128_type,
+ int128_type,
+ int128_type,
+ NULL_TREE),
+ NULL_TREE, is_default, true, true, true, false,
+ false, NULL, Empty);
+ }
+
/* Name of the _Parent field in tagged record types. */
parent_name_id = get_identifier (Get_Name_String (Name_uParent));
@@ -9388,6 +9401,15 @@ build_binary_op_trapv (enum tree_code code, tree gnu_type, tree left,
convert (int64, rhs)));
}
+ /* Likewise for a 128-bit mult and a 64-bit target. */
+ else if (code == MULT_EXPR && precision == 128 && BITS_PER_WORD < 128)
+ {
+ tree int128 = gnat_type_for_size (128, 0);
+ return convert (gnu_type, build_call_n_expr (mulv128_decl, 2,
+ convert (int128, lhs),
+ convert (int128, rhs)));
+ }
+
enum internal_fn icode;
switch (code)