Update CmpResult to use a pointer-sized return type

As seen at [1], LLVM uses `long long` on LLP64 (to get a 64-bit integer
matching pointer size) and `long` on everything else, with exceptions
for AArch64 and AVR. Our current logic always uses an `i32`. This
happens to work because LLVM uses 32-bit instructions to check the
output on x86-64, but the GCC checks the full 64-bit register so garbage
in the upper half leads to incorrect results.

Update our return type to be `isize`, with exceptions for AArch64 and
AVR.

Fixes: https://github.com/rust-lang/compiler-builtins/issues/919

[1]: 0cf3c437c1/compiler-rt/lib/builtins/fp_compare_impl.inc (L11-L27)
This commit is contained in:
Trevor Gross
2025-05-23 17:26:39 +00:00
committed by Trevor Gross
parent db21837095
commit 4c264c96ae
4 changed files with 47 additions and 25 deletions

View File

@@ -11,6 +11,8 @@ mod int_traits;
#[allow(unused_imports)]
pub use big::{i256, u256};
#[allow(unused_imports)]
pub(crate) use cfg_if;
pub use env::{FpResult, Round, Status};
#[allow(unused_imports)]
pub use float_traits::{DFloat, Float, HFloat, IntTy};