about summary refs log tree commit diff
path: root/library/compiler-builtins/libm/src/math
diff options
context:
space:
mode:
authorTrevor Gross <tmgross@umich.edu>2025-05-23 17:26:39 +0000
committerTrevor Gross <t.gross35@gmail.com>2025-05-28 02:58:42 -0400
commit4c264c96ae30e45c503fbb24e452ea948c5229af (patch)
tree8baaa8ca15c4d9b5ca8bc8e14797cfab6d2860d8 /library/compiler-builtins/libm/src/math
parentdb21837095f18a76d1fecb7d55547688a6b19647 (diff)
downloadrust-4c264c96ae30e45c503fbb24e452ea948c5229af.tar.gz
rust-4c264c96ae30e45c503fbb24e452ea948c5229af.zip
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]: https://github.com/llvm/llvm-project/blob/0cf3c437c18ed27d9663d87804a9a15ff6874af2/compiler-rt/lib/builtins/fp_compare_impl.inc#L11-L27
Diffstat (limited to 'library/compiler-builtins/libm/src/math')
-rw-r--r--library/compiler-builtins/libm/src/math/support/mod.rs2
1 files changed, 2 insertions, 0 deletions
diff --git a/library/compiler-builtins/libm/src/math/support/mod.rs b/library/compiler-builtins/libm/src/math/support/mod.rs
index a4f596ab844..2771cfd32c8 100644
--- a/library/compiler-builtins/libm/src/math/support/mod.rs
+++ b/library/compiler-builtins/libm/src/math/support/mod.rs
@@ -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};