Skip to content

gccrs: 128bit integer support is limited on 32 bit platforms #4007

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

philberty
Copy link
Member

This is a wider gcc issue we will need to address at some point but this test runs fine under 32 bit more without the 128bit lang item for rotate here.

gcc/testsuite/ChangeLog:

* rust/execute/torture/sip-hasher.rs: remove 128bit lang item

This is a wider gcc issue we will need to address at some point but this
test runs fine under 32 bit more without the 128bit lang item for rotate
here.

gcc/testsuite/ChangeLog:

	* rust/execute/torture/sip-hasher.rs: remove 128bit lang item

Signed-off-by: Philip Herron <[email protected]>
@@ -1,4 +1,3 @@
// { dg-skip-if "" { *-*-* } { "-m32" } { "" } }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe as @tschwinge suggested it'd be better to dg-ice for 32-bit?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should link to #4003 in the commit message anyway

@philberty
Copy link
Member Author

yeah i was testing quite a bit here and normal things like the arithmetic operators like +, - etc wok on 128 bit integers but rotate doesnt the C front-end explicitly says 128bit doesnt work on 32 bit.

From testing it seems as though rotates and shifts dont work.

The RTL passes do try to expand the rotate into two parts like two u64's as far as i can tell in gdb but this a bit beyond my ability right now its hitting stuff in the code relating to the target option support so i think its a wider thing to ask GCC folks about at this point.

@philberty
Copy link
Member Author

@tschwinge @dkm @CohenArthur what do you think i should do? I think i can tweak this test case to pass for this alpine 32 bit CI but not sure who to poke in GCC about this maybe i should just ask on the gcc mailing list i guess?

@tschwinge
Copy link
Member

As far as I know, GCC supports 128-bit integers only for certain (64-bit?) targets, but not for 32-bit targets. As far as I remember, the new GCC/Cobol support is also running into that (because they need 128-bit integers) -- so maybe that'll get resolved sooner or later.

I see C, C++ test cases conditionalize __int128 usage on #ifdef __SIZEOF_INT128__, or effective-target int128, for example. The latter works for GCC/Rust, too, so I suppose we could do something like dg-additional-options -frust-cfg=int128 { target int128 }, and conditionalize u128, i128 on #[cfg(int128)] (untested)?

@tschwinge
Copy link
Member

A follow-on question then is whether Rust mandates u128, i128 support unconditionally, so we'll have to make that work also for 32-bit configurations? (Like Cobol, apparently.)

@tschwinge
Copy link
Member

By the way, I see u128, i128 appear in some of our test cases, and commented out in others. All that could -- at least for now -- use effective-target int128, I suppose?

@powerboat9
Copy link
Collaborator

https://blog.rust-lang.org/2024/03/30/i128-layout-update/
rust-lang/lang-team#255
https://godbolt.org/z/EYMbdx63K

Looks like rustc didn't have a stable ABI for i128 in 1.49. However, I'm fairly certain rustc supports i128 on ~all targets.

@powerboat9
Copy link
Collaborator

rust-lang/rustc_codegen_gcc#71
rust-lang/rustc_codegen_gcc#103

@dkm
Copy link
Member

dkm commented Jul 25, 2025

@tschwinge @dkm @CohenArthur what do you think i should do? I think i can tweak this test case to pass for this alpine 32 bit CI but not sure who to poke in GCC about this maybe i should just ask on the gcc mailing list i guess?

if you don't feel like sending a mail, IRC is also an option.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Todo
Development

Successfully merging this pull request may close these issues.

5 participants