-
Notifications
You must be signed in to change notification settings - Fork 13.3k
WIP/ POC Add no_iu128_fmt
config to disable 128 bit integer formatting.
#136385
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
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
Failed to set assignee to
|
This comment has been minimized.
This comment has been minimized.
@@ -638,21 +639,29 @@ fn parse_u64_into<const N: usize>(mut n: u64, buf: &mut [MaybeUninit<u8>; N], cu | |||
#[stable(feature = "rust1", since = "1.0.0")] | |||
impl fmt::Display for u128 { | |||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { | |||
fmt_u128(*self, true, f) | |||
if cfg!(no_iu128_fmt) { | |||
panic!("u128 formatting support is turned off") |
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.
Is it possible to disable the Display impl entirely instead?
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 tried a bit but removing it entirely would be a lot more intrusive since it is used in some other parts of core
.
I might be able to remove it, the current implementation is mostly a POC for a quick test.
Doing so would also need to disable NonZeroI/U128 Debug, which doesn't seem easy.
no_iu128_fmt
config to disable 128 bin integer formatting.no_iu128_fmt
config to disable 128 bit integer formatting.
This removes the panicking implementation of the x86 intrinsics. This requires a PR [0] for the rust core library to remove the need for the `__udivti3` intrinsic. This PR disables formatting support for the `i/u128` rust primitives when the `no_iu128_fmt` config option is set. In order to remove the need for the other intrinsics a recent rust version is required (Tested with 1.84). Link: rust-lang/rust#136385 [0] Signed-off-by: Christian Schrefl <[email protected]>
4f0fc0c
to
c16138b
Compare
The issue at hand is not the formatting implementation, it is the division code, correct? This should be captured directly in the PR description because it is the actual direct motivation and the PR description usually includes the motivation. What platforms actually require |
It's needed at least on x86_64 |
no_iu128_fmt
config to disable 128 bit integer formatting.no_iu128_fmt
config to disable 128 bit integer formatting.
Yeah, it seems everywhere needs it, on closer review. The gcc spec for what it does is confusing, but it's the 128-bit integer division intrinsic. |
It seems this was already attempted, but closed here. |
Add a new config option
no_iu128_fmt
to core, which disables some u/i 128 formatting in order to reduce the need for some division intrinsics in the linux kernel.RFC patch for linux that uses this:
https://lore.kernel.org/rust-for-linux/[email protected]/T/#u