about summary refs log tree commit diff
path: root/library/std/src
diff options
context:
space:
mode:
authorTrevor Gross <t.gross35@gmail.com>2025-02-23 14:30:25 -0500
committerGitHub <noreply@github.com>2025-02-23 14:30:25 -0500
commita2bb4d748db15454900f5830cfc6ab1c7311ea8b (patch)
tree8de549d2a4c71a53a6a5e9bc96216c4a657b3b12 /library/std/src
parent31719b59c87272e956e0855bf96e7f9239f46150 (diff)
parentb9d0555d11736f96b4fbbb83bfed94a7098a9ba7 (diff)
downloadrust-a2bb4d748db15454900f5830cfc6ab1c7311ea8b.tar.gz
rust-a2bb4d748db15454900f5830cfc6ab1c7311ea8b.zip
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
Diffstat (limited to 'library/std/src')
-rw-r--r--library/std/src/f128.rs2
-rw-r--r--library/std/src/f16.rs2
-rw-r--r--library/std/src/f32.rs2
-rw-r--r--library/std/src/f64.rs2
4 files changed, 4 insertions, 4 deletions
diff --git a/library/std/src/f128.rs b/library/std/src/f128.rs
index 14ce2b69ca4..974514c9c45 100644
--- a/library/std/src/f128.rs
+++ b/library/std/src/f128.rs
@@ -126,7 +126,7 @@ impl f128 {
     #[unstable(feature = "f128", issue = "116909")]
     #[must_use = "method returns a new number and does not mutate the original value"]
     pub fn round_ties_even(self) -> f128 {
-        unsafe { intrinsics::rintf128(self) }
+        intrinsics::round_ties_even_f128(self)
     }
 
     /// Returns the integer part of `self`.
diff --git a/library/std/src/f16.rs b/library/std/src/f16.rs
index 0af69dff05a..c3b51bf31de 100644
--- a/library/std/src/f16.rs
+++ b/library/std/src/f16.rs
@@ -126,7 +126,7 @@ impl f16 {
     #[unstable(feature = "f16", issue = "116909")]
     #[must_use = "method returns a new number and does not mutate the original value"]
     pub fn round_ties_even(self) -> f16 {
-        unsafe { intrinsics::rintf16(self) }
+        intrinsics::round_ties_even_f16(self)
     }
 
     /// Returns the integer part of `self`.
diff --git a/library/std/src/f32.rs b/library/std/src/f32.rs
index 295eee8700a..19fb24c8ee2 100644
--- a/library/std/src/f32.rs
+++ b/library/std/src/f32.rs
@@ -122,7 +122,7 @@ impl f32 {
     #[stable(feature = "round_ties_even", since = "1.77.0")]
     #[inline]
     pub fn round_ties_even(self) -> f32 {
-        unsafe { intrinsics::rintf32(self) }
+        intrinsics::round_ties_even_f32(self)
     }
 
     /// Returns the integer part of `self`.
diff --git a/library/std/src/f64.rs b/library/std/src/f64.rs
index 0d713ecbc73..f1c3cb56127 100644
--- a/library/std/src/f64.rs
+++ b/library/std/src/f64.rs
@@ -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`.