-
Notifications
You must be signed in to change notification settings - Fork 13.3k
[WIP] Spiking on asm!
+ pointer as const
#132045
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
base: master
Are you sure you want to change the base?
[WIP] Spiking on asm!
+ pointer as const
#132045
Conversation
r? @davidtwco rustbot has assigned @davidtwco. Use |
What is working? I am testing this change with the following smoke test use std::arch::asm;
use std::ptr::addr_of;
#[no_mangle]
static FOO: (u8, u8) = (42, 24);
#[no_mangle]
fn inline() {
let mut x: i64 = addr_of!(FOO) as _;
unsafe {
asm!(
"lea rax, {1}",
"movzx rax, byte ptr [rax]",
"mov {0}, rax",
inout(reg) x,
const &FOO.1 as *const u8,
out("rax") _
)
};
assert_eq!(x, 24);
}
fn main() {
inline();
} This is however coming with a few caveats.
|
The job Click to see the possible cause of the failure (guessed by this bot)
|
☔ The latest upstream changes (presumably #132581) made this pull request unmergeable. Please resolve the merge conflicts. |
A quick a dirty implementation of #132012.
Related to #128464
This will remain as a draft. Details in discussion thread below.