mirror of
https://github.com/rust-lang/rust.git
synced 2026-01-25 07:48:44 +00:00
library: Use fabsf128 in the implementation of abs
This FIXME was introduced in 6e2d934a88 ("Add more `f16` and `f128`
library functions and constants") but I can't actually find my
reasoning. As far as I can tell, LLVM has been lowering `fabs.f128` as
bitwise operations for a while across all targets so there shouldn't be
a problem here.
Thus, apply what is suggested in the FIXME.
This commit is contained in:
@@ -1326,9 +1326,7 @@ impl f128 {
|
||||
#[rustc_const_unstable(feature = "f128", issue = "116909")]
|
||||
#[must_use = "method returns a new number and does not mutate the original value"]
|
||||
pub const fn abs(self) -> Self {
|
||||
// FIXME(f16_f128): replace with `intrinsics::fabsf128` when available
|
||||
// We don't do this now because LLVM has lowering bugs for f128 math.
|
||||
Self::from_bits(self.to_bits() & !(1 << 127))
|
||||
intrinsics::fabsf128(self)
|
||||
}
|
||||
|
||||
/// Returns a number that represents the sign of `self`.
|
||||
|
||||
Reference in New Issue
Block a user