-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Dellvmize some intrinsics (use u32
instead of Self
in some integer intrinsics)
#124003
Conversation
Some changes occurred to the CTFE / Miri engine cc @rust-lang/miri |
This comment has been minimized.
This comment has been minimized.
@@ -487,7 +492,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> { | |||
sym::bitreverse => (bits << extra).reverse_bits(), | |||
_ => bug!("not a numeric intrinsic: {}", name), | |||
}; | |||
Ok(Scalar::from_uint(bits_out, layout.size)) | |||
Ok(Scalar::from_uint(bits_out, ret_layout.size)) |
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 looks like it can ICE when bswap/bitrevere is called with a too small ret_layout.
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.
How would that happen though? The intrinsics are defined like pub fn bitreverse<T: Copy>(x: T) -> T;
, so the ret_layout
must be the same?
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.
That's an extremely non-local invariant. This function here should make sense on its own without worrying about what happens in the standard library.
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.
Maybe add an assertion that for bswap/bitreverse, the two layouts are the same.
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 think this is true in general with intrinsics, we implicitly depend on their signature in a lot of ways. Either way, I added an assertion.
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.
In the interpreter and Miri we always have local assertions for these things.
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.
(Looks like some CI issues?)
|
This comment was marked as resolved.
This comment was marked as resolved.
6c7556f
to
4b6bbcb
Compare
The Miri subtree was changed cc @rust-lang/miri |
This comment has been minimized.
This comment has been minimized.
Some changes occurred in compiler/rustc_codegen_cranelift cc @bjorn3 |
This comment has been minimized.
This comment has been minimized.
Some changes occurred in compiler/rustc_codegen_gcc |
This comment has been minimized.
This comment has been minimized.
caee014
to
468179c
Compare
@rustbot ready I was not able to fix the gcc backend (could not run tests locally and using CI seemed like too much trouble), so I just commented the tests out ^^' Other backends should be working, unless I missed something. |
Is the error you got from the GCC codegen the one we see in the message above?
? |
@antoyo this is the error I got, but if I'd fix it, I would just get a different error, because gcc (now) casts to the wrong type |
Did you try to change |
I did not, precisely because I wasn't able to test things |
Ok, you might want to join this discussion so we can figure out how to make this better. |
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.
The changes here all look good to me.
@RalfJung , did you want to look further at the CTFE parts?
I'm a bit uncertain about the cg_gcc state here. The amount being disabled is small so seems fine enough to do and resolve later, but I also don't feel confident in saying what the expectations are for it.
The interpreter changes LGTM. |
While we do prefer to avoid disabling code like was done here (and we're always happy to help implement the stuff in the PR), we're OK with people not implementing the stuff and doing it on our side. I guess we could think at some point of allowing us to fix the cg_gcc stuff in PR made by other people, but we should also think about that carefully to not block people. All of that to say, I'm OK with the cg_gcc changes here. |
hokay! @bors r=scottmcm,RalfJung,antoyo |
…tmcm,RalfJung,antoyo Dellvmize some intrinsics (use `u32` instead of `Self` in some integer intrinsics) This implements rust-lang/compiler-team#693 minus what was implemented in rust-lang#123226. Note: I decided to _not_ change `shl`/... builder methods, as it just doesn't seem worth it. r? `@scottmcm`
…iaskrgr Rollup of 3 pull requests Successful merges: - rust-lang#124003 (Dellvmize some intrinsics (use `u32` instead of `Self` in some integer intrinsics)) - rust-lang#124169 (Don't fatal when calling `expect_one_of` when recovering arg in `parse_seq`) - rust-lang#124286 (Subtree sync for rustc_codegen_cranelift) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#124003 - WaffleLapkin:dellvmization, r=scottmcm,RalfJung,antoyo Dellvmize some intrinsics (use `u32` instead of `Self` in some integer intrinsics) This implements rust-lang/compiler-team#693 minus what was implemented in rust-lang#123226. Note: I decided to _not_ change `shl`/... builder methods, as it just doesn't seem worth it. r? ``@scottmcm``
Thanks to everyone involved <3 |
…tmcm,RalfJung,antoyo Dellvmize some intrinsics (use `u32` instead of `Self` in some integer intrinsics) This implements rust-lang/compiler-team#693 minus what was implemented in rust-lang#123226. Note: I decided to _not_ change `shl`/... builder methods, as it just doesn't seem worth it. r? ``@scottmcm``
…tmcm,RalfJung,antoyo Dellvmize some intrinsics (use `u32` instead of `Self` in some integer intrinsics) This implements rust-lang/compiler-team#693 minus what was implemented in rust-lang#123226. Note: I decided to _not_ change `shl`/... builder methods, as it just doesn't seem worth it. r? ``@scottmcm``
This implements rust-lang/compiler-team#693 minus what was implemented in #123226.
Note: I decided to not change
shl
/... builder methods, as it just doesn't seem worth it.r? @scottmcm