-
Notifications
You must be signed in to change notification settings - Fork 184
[WIP] Enable 128 bit integers on 32 bit targets #4009
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
68b5bbc
to
e6d4b55
Compare
gcc/rust/rust-gcc.cc
Outdated
continue; | ||
|
||
// assume size is not 0 | ||
int idx = __builtin_ctz (normal_int_sizes[i]) - 3; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't use __builtin_ctz directly.
Do:
int idx = exact_log2 (normal_int_sizes[i]);
if (idx == -1)
continue;
idx -= 3;
gcc/rust/rust-backend.h
Outdated
@@ -50,6 +50,9 @@ using Rust::GGC::Ident; | |||
|
|||
} // namespace GGC | |||
|
|||
extern tree rust_int_trees[10]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This almost definitely needs GTY(()) here so the trees in rust_int_trees don't get GC'ed.
@@ -504,32 +504,23 @@ TyTyResolveCompile::visit (const TyTy::IntType &type) | |||
switch (type.get_int_kind ()) | |||
{ | |||
case TyTy::IntType::I8: | |||
translated = Backend::named_type ("i8", Backend::integer_type (false, 8), | |||
BUILTINS_LOCATION); | |||
translated = Backend::rust_int_trees[5]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would have an enum for the special # 5 here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've introduced macros for roughly the same effect
@@ -557,8 +558,16 @@ rotate_handler (Context *ctx, TyTy::FnType *fntype, tree_code op) | |||
// BUILTIN rotate FN BODY BEGIN | |||
tree x = Backend::var_expression (x_param, UNDEF_LOCATION); | |||
tree y = Backend::var_expression (y_param, UNDEF_LOCATION); | |||
|
|||
tree y_mask | |||
= build_int_cst (unsigned_type_node, TYPE_SIZE (TREE_TYPE (x)) - 1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/TYPE_SIZE (TREE_TYPE (x)) - 1/element_precision (TREE_TYPE (x)) - 1/
This tweaks how we handle the right hand side of rotate intrinsics and tweaks how we handle integers so that we can fall back on _BitInt(128) on some targets. gcc/rust/ChangeLog: * backend/rust-compile-intrinsic.cc: Include "convert.h". (rotate_handler): Convert the second parameter into an unsigned int. * rust-backend.h (RUST_INT_TREE_U8): Define macro. (RUST_INT_TREE_U16): Likewise. (RUST_INT_TREE_U32): Likewise. (RUST_INT_TREE_U64): Likewise. (RUST_INT_TREE_U128): Likewise. (RUST_INT_TREE_I8): Likewise. (RUST_INT_TREE_I16): Likewise. (RUST_INT_TREE_I32): Likewise. (RUST_INT_TREE_I64): Likewise. (RUST_INT_TREE_I128): Likewise. (rust_int_trees): Declare extern variable. (rust_int_names): Likewise. * rust-gcc.cc: Include "target.h". (rust_int_trees): Define variable. (rust_int_names): Likewise. (setup_normal_integers): Define static function to set up rust_int_trees. (init): Call setup_normal_integers. * backend/rust-compile-type.cc (TyTyResolveCompile::visit): Use rust_int_trees via macros to obtain integer type trees. * config-lang.in (gtfiles): Add "rust-backend.h". gcc/testsuite/ChangeLog: * rust/execute/torture/sip-hasher.rs: Enable on 32 bit targets. Signed-off-by: Owen Avery <[email protected]>
No description provided.