summaryrefslogtreecommitdiffstats
path: root/vendor/compiler_builtins/src
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:11:38 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:12:43 +0000
commitcf94bdc0742c13e2a0cac864c478b8626b266e1b (patch)
tree044670aa50cc5e2b4229aa0b6b3df6676730c0a6 /vendor/compiler_builtins/src
parentAdding debian version 1.65.0+dfsg1-2. (diff)
downloadrustc-cf94bdc0742c13e2a0cac864c478b8626b266e1b.tar.xz
rustc-cf94bdc0742c13e2a0cac864c478b8626b266e1b.zip
Merging upstream version 1.66.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/compiler_builtins/src')
-rw-r--r--vendor/compiler_builtins/src/float/conv.rs6
-rw-r--r--vendor/compiler_builtins/src/float/div.rs6
-rw-r--r--vendor/compiler_builtins/src/int/specialized_div_rem/mod.rs5
-rw-r--r--vendor/compiler_builtins/src/macros.rs1
-rw-r--r--vendor/compiler_builtins/src/math.rs7
5 files changed, 16 insertions, 9 deletions
diff --git a/vendor/compiler_builtins/src/float/conv.rs b/vendor/compiler_builtins/src/float/conv.rs
index 68ba63408..19fdc2fdc 100644
--- a/vendor/compiler_builtins/src/float/conv.rs
+++ b/vendor/compiler_builtins/src/float/conv.rs
@@ -13,7 +13,7 @@ mod int_to_float {
let a = (i << n) >> 8; // Significant bits, with bit 24 still in tact.
let b = (i << n) << 24; // Insignificant bits, only relevant for rounding.
let m = a + ((b - (b >> 31 & !a)) >> 31); // Add one when we need to round up. Break ties to even.
- let e = 157 - n as u32; // Exponent plus 127, minus one.
+ let e = 157 - n; // Exponent plus 127, minus one.
(e << 23) + m // + not |, so the mantissa can overflow into the exponent.
}
@@ -42,8 +42,8 @@ mod int_to_float {
return 0;
}
let n = i.leading_zeros();
- let a = ((i << n) >> 11) as u64; // Significant bits, with bit 53 still in tact.
- let b = ((i << n) << 53) as u64; // Insignificant bits, only relevant for rounding.
+ let a = (i << n) >> 11; // Significant bits, with bit 53 still in tact.
+ let b = (i << n) << 53; // Insignificant bits, only relevant for rounding.
let m = a + ((b - (b >> 63 & !a)) >> 63); // Add one when we need to round up. Break ties to even.
let e = 1085 - n as u64; // Exponent plus 1023, minus one.
(e << 52) + m // + not |, so the mantissa can overflow into the exponent.
diff --git a/vendor/compiler_builtins/src/float/div.rs b/vendor/compiler_builtins/src/float/div.rs
index 528a8368d..c2d6c07e7 100644
--- a/vendor/compiler_builtins/src/float/div.rs
+++ b/vendor/compiler_builtins/src/float/div.rs
@@ -135,11 +135,11 @@ where
let mut correction: u32 =
negate_u32(((reciprocal as u64).wrapping_mul(q31b as u64) >> 32) as u32);
- reciprocal = ((reciprocal as u64).wrapping_mul(correction as u64) as u64 >> 31) as u32;
+ reciprocal = ((reciprocal as u64).wrapping_mul(correction as u64) >> 31) as u32;
correction = negate_u32(((reciprocal as u64).wrapping_mul(q31b as u64) >> 32) as u32);
- reciprocal = ((reciprocal as u64).wrapping_mul(correction as u64) as u64 >> 31) as u32;
+ reciprocal = ((reciprocal as u64).wrapping_mul(correction as u64) >> 31) as u32;
correction = negate_u32(((reciprocal as u64).wrapping_mul(q31b as u64) >> 32) as u32);
- reciprocal = ((reciprocal as u64).wrapping_mul(correction as u64) as u64 >> 31) as u32;
+ reciprocal = ((reciprocal as u64).wrapping_mul(correction as u64) >> 31) as u32;
// Exhaustive testing shows that the error in reciprocal after three steps
// is in the interval [-0x1.f58108p-31, 0x1.d0e48cp-29], in line with our
diff --git a/vendor/compiler_builtins/src/int/specialized_div_rem/mod.rs b/vendor/compiler_builtins/src/int/specialized_div_rem/mod.rs
index 6ec4675df..77034eb54 100644
--- a/vendor/compiler_builtins/src/int/specialized_div_rem/mod.rs
+++ b/vendor/compiler_builtins/src/int/specialized_div_rem/mod.rs
@@ -72,7 +72,10 @@ mod asymmetric;
/// impossible to reach by Rust users, unless `compiler-builtins` public division functions or
/// `core/std::unchecked_div/rem` are directly used without a zero check in front.
fn zero_div_fn() -> ! {
- unsafe { core::hint::unreachable_unchecked() }
+ // Calling the intrinsic directly, to avoid the `assert_unsafe_precondition` that cannot be used
+ // here because it involves non-`inline` functions
+ // (https://github.com/rust-lang/compiler-builtins/issues/491).
+ unsafe { core::intrinsics::unreachable() }
}
const USE_LZ: bool = {
diff --git a/vendor/compiler_builtins/src/macros.rs b/vendor/compiler_builtins/src/macros.rs
index 7d90b7aad..477c25684 100644
--- a/vendor/compiler_builtins/src/macros.rs
+++ b/vendor/compiler_builtins/src/macros.rs
@@ -266,6 +266,7 @@ macro_rules! intrinsics {
#[cfg(target_arch = "arm")]
pub mod $alias {
#[cfg_attr(not(feature = "mangled-names"), no_mangle)]
+ #[cfg_attr(all(not(windows), not(target_vendor="apple")), linkage = "weak")]
pub extern "aapcs" fn $alias( $($argname: $ty),* ) $(-> $ret)? {
super::$name($($argname),*)
}
diff --git a/vendor/compiler_builtins/src/math.rs b/vendor/compiler_builtins/src/math.rs
index fa9836186..3fc33b127 100644
--- a/vendor/compiler_builtins/src/math.rs
+++ b/vendor/compiler_builtins/src/math.rs
@@ -118,8 +118,11 @@ no_mangle! {
fn truncf(x: f32) -> f32;
}
-// only for the thumb*-none-eabi* targets
-#[cfg(all(target_arch = "arm", target_os = "none"))]
+// only for the thumb*-none-eabi* targets and riscv32*-none-elf targets that lack the floating point instruction set
+#[cfg(any(
+ all(target_arch = "arm", target_os = "none"),
+ all(target_arch = "riscv32", not(target_feature = "f"), target_os = "none")
+))]
no_mangle! {
fn fmin(x: f64, y: f64) -> f64;
fn fminf(x: f32, y: f32) -> f32;