[WIP] Enable 128 bit integers on 32 bit targets#4009
Open
powerboat9 wants to merge 1 commit into
Open
Conversation
68b5bbc to
e6d4b55
Compare
pinskia
reviewed
Jul 26, 2025
| continue; | ||
|
|
||
| // assume size is not 0 | ||
| int idx = __builtin_ctz (normal_int_sizes[i]) - 3; |
Contributor
There was a problem hiding this comment.
Don't use __builtin_ctz directly.
Do:
int idx = exact_log2 (normal_int_sizes[i]);
if (idx == -1)
continue;
idx -= 3;
|
|
||
| } // namespace GGC | ||
|
|
||
| extern tree rust_int_trees[10]; |
Contributor
There was a problem hiding this comment.
This almost definitely needs GTY(()) here so the trees in rust_int_trees don't get GC'ed.
| case TyTy::IntType::I8: | ||
| translated = Backend::named_type ("i8", Backend::integer_type (false, 8), | ||
| BUILTINS_LOCATION); | ||
| translated = Backend::rust_int_trees[5]; |
Contributor
There was a problem hiding this comment.
I would have an enum for the special # 5 here.
Collaborator
Author
There was a problem hiding this comment.
I've introduced macros for roughly the same effect
| tree y = Backend::var_expression (y_param, UNDEF_LOCATION); | ||
|
|
||
| tree y_mask | ||
| = build_int_cst (unsigned_type_node, TYPE_SIZE (TREE_TYPE (x)) - 1); |
Contributor
There was a problem hiding this comment.
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 <powerboat9.gamer@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.