We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
This Rust code, when compiled for aarch64-unknown-linux-gnu, generates only one instruction.
aarch64-unknown-linux-gnu
#[inline(never)] pub fn write(out: &mut [u32; 2], a: u64) { out[0] = a as u32; out[1] = (a >> 32) as u32; }
example::write::h4c19b1f2c54c5627: str x1, [x0] ret
However, inefficient code is emitted when there are 2 or more u64s to store.
u64
#[inline(never)] pub fn write2(out: &mut [u32; 4], a: u64, b: u64) { out[0] = a as u32; out[1] = (a >> 32) as u32; out[2] = b as u32; out[3] = (b >> 32) as u32; }
example::write2::h650f933056ff8897: lsr x8, x1, #32 lsr x9, x2, #32 stp w1, w8, [x0] stp w2, w9, [x0, #8] ret
Compiler Explorer.
The text was updated successfully, but these errors were encountered:
@llvm/issue-subscribers-backend-aarch64
Author: ud2 (0f-0b)
#[inline(never)] pub fn write(out: &mut [u32; 2], a: u64) { out[0] = a as u32; out[1] = (a >> 32) as u32; }
#[inline(never)] pub fn write2(out: &mut [u32; 4], a: u64, b: u64) { out[0] = a as u32; out[1] = (a >> 32) as u32; out[2] = b as u32; out[3] = (b >> 32) as u32; }
example::write2::h650f933056ff8897: lsr x8, x1, #<!-- -->32 lsr x9, x2, #<!-- -->32 stp w1, w8, [x0] stp w2, w9, [x0, #<!-- -->8] ret
Sorry, something went wrong.
No branches or pull requests
This Rust code, when compiled for
aarch64-unknown-linux-gnu
, generates only one instruction.However, inefficient code is emitted when there are 2 or more
u64
s to store.Compiler Explorer.
The text was updated successfully, but these errors were encountered: