File tree Expand file tree Collapse file tree 2 files changed +6
-10
lines changed Expand file tree Collapse file tree 2 files changed +6
-10
lines changed Original file line number Diff line number Diff line change @@ -46,6 +46,10 @@ extern "platform-intrinsic" {
46
46
/// fabs
47
47
pub(crate) fn simd_fabs<T>(x: T) -> T;
48
48
49
+ // minnum/maxnum
50
+ pub(crate) fn simd_fmin<T>(x: T, y: T) -> T;
51
+ pub(crate) fn simd_fmax<T>(x: T, y: T) -> T;
52
+
49
53
pub(crate) fn simd_eq<T, U>(x: T, y: T) -> U;
50
54
pub(crate) fn simd_ne<T, U>(x: T, y: T) -> U;
51
55
pub(crate) fn simd_lt<T, U>(x: T, y: T) -> U;
Original file line number Diff line number Diff line change @@ -141,11 +141,7 @@ macro_rules! impl_float_vector {
141
141
#[inline]
142
142
#[must_use = "method returns a new vector and does not mutate the original value"]
143
143
pub fn min(self, other: Self) -> Self {
144
- // TODO consider using an intrinsic
145
- self.is_nan().select(
146
- other,
147
- self.lanes_ge(other).select(other, self)
148
- )
144
+ unsafe { intrinsics::simd_fmin(self, other) }
149
145
}
150
146
151
147
/// Returns the maximum of each lane.
@@ -154,11 +150,7 @@ macro_rules! impl_float_vector {
154
150
#[inline]
155
151
#[must_use = "method returns a new vector and does not mutate the original value"]
156
152
pub fn max(self, other: Self) -> Self {
157
- // TODO consider using an intrinsic
158
- self.is_nan().select(
159
- other,
160
- self.lanes_le(other).select(other, self)
161
- )
153
+ unsafe { intrinsics::simd_fmax(self, other) }
162
154
}
163
155
164
156
/// Restrict each lane to a certain interval unless it is NaN.
You can’t perform that action at this time.
0 commit comments