Skip to content

Commit f07d386

Browse files
committed
Add Float::make_quiet method
Upstream LLVM commit: 83ba349ae0a853e0c2cd8e8aadc88993e9fb9a19 Previous commit, 36606cf07080a44a1a9157f80112f9512bd6a3bf, has been skipped because it does not affect the Rust port.
1 parent 38e61cd commit f07d386

File tree

4 files changed

+18
-2
lines changed

4 files changed

+18
-2
lines changed

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
members = ["fuzz"]
33

44
[workspace.package]
5-
version = "0.2.0+llvm-6109e70c72fc"
5+
version = "0.2.0+llvm-83ba349ae0a8"
66
edition = "2021"
77
license = "Apache-2.0 WITH LLVM-exception"
88

src/ieee.rs

+9
Original file line numberDiff line numberDiff line change
@@ -1825,6 +1825,15 @@ impl<S: Semantics> Float for IeeeFloat<S> {
18251825
self.read_only_category_do_not_mutate
18261826
}
18271827

1828+
fn make_quiet(mut self) -> Self {
1829+
if self.is_nan() {
1830+
self.sig[0] |= S::QNAN_SIGNIFICAND;
1831+
self
1832+
} else {
1833+
self
1834+
}
1835+
}
1836+
18281837
fn get_exact_inverse(self) -> Option<Self> {
18291838
// Special floats and denormals have no exact inverse.
18301839
if !self.is_finite_non_zero() {

src/lib.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//! Port of LLVM's APFloat software floating-point implementation from the
22
//! following C++ sources (please update commit hash when backporting):
3-
//! https://github.com/llvm/llvm-project/commit/6109e70c72fc5171d25c4467fc3cfe6eb2029f50
3+
//! https://github.com/llvm/llvm-project/commit/83ba349ae0a853e0c2cd8e8aadc88993e9fb9a19
44
//! * `llvm/include/llvm/ADT/APFloat.h` -> `Float` and `FloatConvert` traits
55
//! * `llvm/lib/Support/APFloat.cpp` -> `ieee` and `ppc` modules
66
//! * `llvm/unittests/ADT/APFloatTest.cpp` -> `tests` directory
@@ -570,6 +570,9 @@ pub trait Float:
570570
self.round_to_integral(Round::TowardZero).value.bitwise_eq(self)
571571
}
572572

573+
/// If the value is a signaling NaN, makes it quiet
574+
fn make_quiet(self) -> Self;
575+
573576
/// If this value has an exact multiplicative inverse, return it.
574577
fn get_exact_inverse(self) -> Option<Self>;
575578

src/ppc.rs

+4
Original file line numberDiff line numberDiff line change
@@ -420,6 +420,10 @@ where
420420
self.0.is_integer() && self.1.is_integer()
421421
}
422422

423+
fn make_quiet(self) -> Self {
424+
Self(self.0.make_quiet(), self.1)
425+
}
426+
423427
fn get_exact_inverse(self) -> Option<Self> {
424428
Fallback::from(self).get_exact_inverse().map(Self::from)
425429
}

0 commit comments

Comments
 (0)