Skip to content

Commit 2df74bb

Browse files
committed
remove simd_reduce_{min,max}_nanless
1 parent 3dc631a commit 2df74bb

File tree

8 files changed

+3
-61
lines changed

8 files changed

+3
-61
lines changed

compiler/rustc_codegen_cranelift/src/intrinsics/simd.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -743,7 +743,7 @@ pub(super) fn codegen_simd_intrinsic_call<'tcx>(
743743
simd_reduce(fx, v, None, ret, &|fx, _ty, a, b| fx.bcx.ins().bxor(a, b));
744744
}
745745

746-
sym::simd_reduce_min | sym::simd_reduce_min_nanless => {
746+
sym::simd_reduce_min => {
747747
intrinsic_args!(fx, args => (v); intrinsic);
748748

749749
if !v.layout().ty.is_simd() {
@@ -762,7 +762,7 @@ pub(super) fn codegen_simd_intrinsic_call<'tcx>(
762762
});
763763
}
764764

765-
sym::simd_reduce_max | sym::simd_reduce_max_nanless => {
765+
sym::simd_reduce_max => {
766766
intrinsic_args!(fx, args => (v); intrinsic);
767767

768768
if !v.layout().ty.is_simd() {

compiler/rustc_codegen_gcc/src/intrinsic/simd.rs

-3
Original file line numberDiff line numberDiff line change
@@ -1041,9 +1041,6 @@ pub fn generic_simd_intrinsic<'a, 'gcc, 'tcx>(
10411041

10421042
minmax_red!(simd_reduce_min: vector_reduce_min, vector_reduce_fmin);
10431043
minmax_red!(simd_reduce_max: vector_reduce_max, vector_reduce_fmax);
1044-
// TODO(sadlerap): revisit these intrinsics to generate more optimal reductions
1045-
minmax_red!(simd_reduce_min_nanless: vector_reduce_min, vector_reduce_fmin);
1046-
minmax_red!(simd_reduce_max_nanless: vector_reduce_max, vector_reduce_fmax);
10471044

10481045
macro_rules! bitwise_red {
10491046
($name:ident : $op:expr, $boolean:expr) => {

compiler/rustc_codegen_llvm/src/builder.rs

-16
Original file line numberDiff line numberDiff line change
@@ -1406,22 +1406,6 @@ impl<'a, 'll, 'tcx> Builder<'a, 'll, 'tcx> {
14061406
llvm::LLVMRustBuildVectorReduceFMax(self.llbuilder, src, /*NoNaNs:*/ false)
14071407
}
14081408
}
1409-
pub fn vector_reduce_fmin_fast(&mut self, src: &'ll Value) -> &'ll Value {
1410-
unsafe {
1411-
let instr =
1412-
llvm::LLVMRustBuildVectorReduceFMin(self.llbuilder, src, /*NoNaNs:*/ true);
1413-
llvm::LLVMRustSetFastMath(instr);
1414-
instr
1415-
}
1416-
}
1417-
pub fn vector_reduce_fmax_fast(&mut self, src: &'ll Value) -> &'ll Value {
1418-
unsafe {
1419-
let instr =
1420-
llvm::LLVMRustBuildVectorReduceFMax(self.llbuilder, src, /*NoNaNs:*/ true);
1421-
llvm::LLVMRustSetFastMath(instr);
1422-
instr
1423-
}
1424-
}
14251409
pub fn vector_reduce_min(&mut self, src: &'ll Value, is_signed: bool) -> &'ll Value {
14261410
unsafe { llvm::LLVMRustBuildVectorReduceMin(self.llbuilder, src, is_signed) }
14271411
}

compiler/rustc_codegen_llvm/src/intrinsic.rs

-3
Original file line numberDiff line numberDiff line change
@@ -1920,9 +1920,6 @@ fn generic_simd_intrinsic<'ll, 'tcx>(
19201920
minmax_red!(simd_reduce_min: vector_reduce_min, vector_reduce_fmin);
19211921
minmax_red!(simd_reduce_max: vector_reduce_max, vector_reduce_fmax);
19221922

1923-
minmax_red!(simd_reduce_min_nanless: vector_reduce_min, vector_reduce_fmin_fast);
1924-
minmax_red!(simd_reduce_max_nanless: vector_reduce_max, vector_reduce_fmax_fast);
1925-
19261923
macro_rules! bitwise_red {
19271924
($name:ident : $red:ident, $boolean:expr) => {
19281925
if name == sym::$name {

compiler/rustc_hir_analysis/src/check/intrinsic.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -606,9 +606,7 @@ pub fn check_platform_intrinsic_type(
606606
| sym::simd_reduce_or
607607
| sym::simd_reduce_xor
608608
| sym::simd_reduce_min
609-
| sym::simd_reduce_max
610-
| sym::simd_reduce_min_nanless
611-
| sym::simd_reduce_max_nanless => (2, 0, vec![param(0)], param(1)),
609+
| sym::simd_reduce_max => (2, 0, vec![param(0)], param(1)),
612610
sym::simd_shuffle => (3, 0, vec![param(0), param(0), param(1)], param(2)),
613611
sym::simd_shuffle_generic => (2, 1, vec![param(0), param(0)], param(1)),
614612
_ => {

compiler/rustc_span/src/symbol.rs

-2
Original file line numberDiff line numberDiff line change
@@ -1553,9 +1553,7 @@ symbols! {
15531553
simd_reduce_and,
15541554
simd_reduce_any,
15551555
simd_reduce_max,
1556-
simd_reduce_max_nanless,
15571556
simd_reduce_min,
1558-
simd_reduce_min_nanless,
15591557
simd_reduce_mul_ordered,
15601558
simd_reduce_mul_unordered,
15611559
simd_reduce_or,

library/core/src/intrinsics/simd.rs

-26
Original file line numberDiff line numberDiff line change
@@ -385,19 +385,6 @@ extern "platform-intrinsic" {
385385
/// For floating-point values, uses IEEE-754 `maxNum`.
386386
pub fn simd_reduce_max<T, U>(x: T) -> U;
387387

388-
/// Return the maximum element of a vector.
389-
///
390-
/// `T` must be a vector of integer or floating-point primitive types.
391-
///
392-
/// `U` must be the element type of `T`.
393-
///
394-
/// For floating-point values, uses IEEE-754 `maxNum`.
395-
///
396-
/// # Safety
397-
///
398-
/// All input elements must be finite (i.e., not NAN and not +/- INF).
399-
pub fn simd_reduce_max_nanless<T, U>(x: T) -> U;
400-
401388
/// Return the minimum element of a vector.
402389
///
403390
/// `T` must be a vector of integer or floating-point primitive types.
@@ -407,19 +394,6 @@ extern "platform-intrinsic" {
407394
/// For floating-point values, uses IEEE-754 `minNum`.
408395
pub fn simd_reduce_min<T, U>(x: T) -> U;
409396

410-
/// Return the minimum element of a vector.
411-
///
412-
/// `T` must be a vector of integer or floating-point primitive types.
413-
///
414-
/// `U` must be the element type of `T`.
415-
///
416-
/// For floating-point values, uses IEEE-754 `minNum`.
417-
///
418-
/// # Safety
419-
///
420-
/// All input elements must be finite (i.e., not NAN and not +/- INF).
421-
pub fn simd_reduce_min_nanless<T, U>(x: T) -> U;
422-
423397
/// Logical "and" all elements together.
424398
///
425399
/// `T` must be a vector of integer or floating-point primitive types.

tests/ui/simd/intrinsic/generic-reduction-pass.rs

-6
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@ extern "platform-intrinsic" {
3131
fn simd_reduce_mul_ordered<T, U>(x: T, acc: U) -> U;
3232
fn simd_reduce_min<T, U>(x: T) -> U;
3333
fn simd_reduce_max<T, U>(x: T) -> U;
34-
fn simd_reduce_min_nanless<T, U>(x: T) -> U;
35-
fn simd_reduce_max_nanless<T, U>(x: T) -> U;
3634
fn simd_reduce_and<T, U>(x: T) -> U;
3735
fn simd_reduce_or<T, U>(x: T) -> U;
3836
fn simd_reduce_xor<T, U>(x: T) -> U;
@@ -127,10 +125,6 @@ fn main() {
127125
assert_eq!(r, -2_f32);
128126
let r: f32 = simd_reduce_max(x);
129127
assert_eq!(r, 4_f32);
130-
let r: f32 = simd_reduce_min_nanless(x);
131-
assert_eq!(r, -2_f32);
132-
let r: f32 = simd_reduce_max_nanless(x);
133-
assert_eq!(r, 4_f32);
134128
}
135129

136130
unsafe {

0 commit comments

Comments
 (0)