Closed
Description
This code
#![feature(unchecked_math)]
pub fn sub(x: &u8) -> usize {
unsafe { x.unchecked_sub(10) as usize }
}
currently emits
example::sub:
mov al, byte ptr [rdi]
add al, -10
movzx eax, al
ret
which should instead be
example::sub2:
movzx eax, byte ptr [rdi]
add rax, -10
ret
I unfortunately do not have the background to check whether its rustc or LLVM that's the cause of the issue; I'd be happy to file a bug against LLVM if it is on that side, but would need some pointers on how best to produce a useful bug report.
cc #85122