1
Fork 0

Rollup merge of #136543 - RalfJung:round-ties-even, r=tgross35

intrinsics: unify rint, roundeven, nearbyint in a single round_ties_even intrinsic

LLVM has three intrinsics here that all do the same thing (when used in the default FP environment). There's no reason Rust needs to copy that historically-grown mess -- let's just have one intrinsic and leave it up to the LLVM backend to decide how to lower that.

Suggested by `@hanna-kruppe` in https://github.com/rust-lang/rust/issues/136459; Cc `@tgross35`

try-job: test-various
This commit is contained in:
Trevor Gross 2025-02-23 14:30:25 -05:00 committed by GitHub
commit a2bb4d748d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 127 additions and 208 deletions

View file

@ -122,7 +122,7 @@ impl f64 {
#[stable(feature = "round_ties_even", since = "1.77.0")]
#[inline]
pub fn round_ties_even(self) -> f64 {
unsafe { intrinsics::rintf64(self) }
intrinsics::round_ties_even_f64(self)
}
/// Returns the integer part of `self`.