From 3e3c523954e59f0d9515f2fcbac3a4e7591cbbdb Mon Sep 17 00:00:00 2001 From: Folkert de Vries Date: Wed, 22 Jan 2025 20:10:29 +0100 Subject: [PATCH] simplify the `vec_abs` implementation --- .../crates/core_arch/src/s390x/vector.rs | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/library/stdarch/crates/core_arch/src/s390x/vector.rs b/library/stdarch/crates/core_arch/src/s390x/vector.rs index 808196dd071b..61a17e561105 100644 --- a/library/stdarch/crates/core_arch/src/s390x/vector.rs +++ b/library/stdarch/crates/core_arch/src/s390x/vector.rs @@ -384,21 +384,9 @@ mod sealed { impl_abs! { vec_abs_i32, i32x4 } impl_abs! { vec_abs_i64, i64x2 } - #[inline] - #[target_feature(enable = "vector")] - unsafe fn vec_abs_f32(v: vector_float) -> vector_float { - let v: u32x4 = transmute(v); - - transmute(simd_and(v, u32x4::splat(0x7FFFFFFF))) - } - - #[inline] - #[target_feature(enable = "vector")] - unsafe fn vec_abs_f64(v: vector_double) -> vector_double { - let v: u64x2 = transmute(v); - - transmute(simd_and(v, u64x2::splat(0x7FFFFFFF_FFFFFFFF))) - } + // FIXME(vector-enhancements-1) + test_impl! { vec_abs_f32 (v: vector_float) -> vector_float [ simd_fabs, _ ] } + test_impl! { vec_abs_f64 (v: vector_double) -> vector_double [ simd_fabs, vflpdb ] } impl_vec_trait! { [VectorAbs vec_abs] vec_abs_f32 (vector_float) } impl_vec_trait! { [VectorAbs vec_abs] vec_abs_f64 (vector_double) }