-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Incorrect sign extension from i32
to i64
on AArch64
#21627
Comments
Just had a chat on #llvm and got a lot of help from Tim Northover. He found out that the bug has already been discovered and fixed in LLVM: llvm-mirror/llvm@ca07e25 How/would it be possible to adapt that fix to the LLVM used by rust? |
More thinking-aloud: since the problem is in FastISel, which can be turned off, the problem can be worked around at rust side with no need to touch the LLVM currently in use. By passing some extra options (
|
Before ca07e256f62f772d14c42f41af46f2aeacc54983, LLVM's AArch64FastISel had a sign (and zero?) extension bug. Until rustc gets its LLVM past that commit, the way of workaround is to pass an option to LLVM that forces the disabling of FastISel (which would normally kick in for -O0). Fixes rust-lang#21627
Before ca07e256f62f772d14c42f41af46f2aeacc54983, LLVM's AArch64FastISel had a sign (and zero?) extension bug. Until rustc gets its LLVM past that commit, the way of workaround is to pass an option to LLVM that forces the disabling of FastISel (which would normally kick in for -O0). Fixes rust-lang#21627
When compiling the following code (which is a minimized version of
impl_to_primitive_int_to_int!
from libcore/num/mod.rs) on AArch64 with rustc from 2015-01-24, the output is unfortunatelyNO :(
The disassembled code of
main
starts as:The problem is with the two moves at
0x7210
and0x7214
, which erroneously clear the top 32 bits ofx8
, which thus becomes0x80000000
instead of the expected0xffffffff80000000
.The error was first found in the rustup_20150109 branch of Servo (servo/servo#4716), but the latest Rust also exhibits the problem (as shown above).
The text was updated successfully, but these errors were encountered: