diff options
| author | Folkert de Vries <folkert@folkertdev.nl> | 2025-01-22 17:06:52 +0100 |
|---|---|---|
| committer | Amanieu d'Antras <amanieu@gmail.com> | 2025-02-23 23:21:35 +0000 |
| commit | bed15215fb73dae4fb161635d4e99b79e355e8e9 (patch) | |
| tree | 18dca6023ed753917414b895ae4722388bd71bb4 /library/stdarch/crates | |
| parent | cefc61d22e4d326210ca40ac7168134fc8b276da (diff) | |
| download | rust-bed15215fb73dae4fb161635d4e99b79e355e8e9.tar.gz rust-bed15215fb73dae4fb161635d4e99b79e355e8e9.zip | |
impl `VectorMax/Min` for `vector_float/double`
these implementations work with just the vector target feature, but they only get a dedicated instruction in vector-enhancements-1
Diffstat (limited to 'library/stdarch/crates')
| -rw-r--r-- | library/stdarch/crates/core_arch/src/s390x/macros.rs | 7 | ||||
| -rw-r--r-- | library/stdarch/crates/core_arch/src/s390x/vector.rs | 14 |
2 files changed, 21 insertions, 0 deletions
diff --git a/library/stdarch/crates/core_arch/src/s390x/macros.rs b/library/stdarch/crates/core_arch/src/s390x/macros.rs index 92faf387bd7..4c11b1d00e0 100644 --- a/library/stdarch/crates/core_arch/src/s390x/macros.rs +++ b/library/stdarch/crates/core_arch/src/s390x/macros.rs @@ -2,6 +2,13 @@ #![allow(unused_imports)] // FIXME remove when more tests are added macro_rules! test_impl { + ($fun:ident ($($v:ident : $ty:ty),*) -> $r:ty [$call:ident, _]) => { + #[inline] + #[target_feature(enable = "vector")] + pub unsafe fn $fun ($($v : $ty),*) -> $r { + $call ($($v),*) + } + }; ($fun:ident +($($v:ident : $ty:ty),*) -> $r:ty [$call:ident, $instr:ident]) => { #[inline] #[target_feature(enable = "vector")] diff --git a/library/stdarch/crates/core_arch/src/s390x/vector.rs b/library/stdarch/crates/core_arch/src/s390x/vector.rs index 420a8176bba..808196dd071 100644 --- a/library/stdarch/crates/core_arch/src/s390x/vector.rs +++ b/library/stdarch/crates/core_arch/src/s390x/vector.rs @@ -330,6 +330,13 @@ mod sealed { impl_vec_trait! { [VectorMax vec_max] ~(vmxlb, vmxb, vmxlh, vmxh, vmxlf, vmxf, vmxlg, vmxg) } + // FIXME(vector-enhancements-1) test for the `vfmaxsb` etc. instruction + test_impl! { vec_vfmaxsb (a: vector_float, b: vector_float) -> vector_float [simd_fmax, _] } + test_impl! { vec_vfmaxdb (a: vector_double, b: vector_double) -> vector_double [simd_fmax, _] } + + impl_vec_trait!([VectorMax vec_max] vec_vfmaxsb (vector_float, vector_float) -> vector_float); + impl_vec_trait!([VectorMax vec_max] vec_vfmaxdb (vector_double, vector_double) -> vector_double); + #[unstable(feature = "stdarch_s390x", issue = "135681")] pub trait VectorMin<Other> { type Result; @@ -348,6 +355,13 @@ mod sealed { impl_vec_trait! { [VectorMin vec_min] ~(vmxlb, vmxb, vmxlh, vmxh, vmxlf, vmxf, vmxlg, vmxg) } + // FIXME(vector-enhancements-1) test for the `vfminsb` etc. instruction + test_impl! { vec_vfminsb (a: vector_float, b: vector_float) -> vector_float [simd_fmin, _] } + test_impl! { vec_vfmindb (a: vector_double, b: vector_double) -> vector_double [simd_fmin, _] } + + impl_vec_trait!([VectorMin vec_min] vec_vfminsb (vector_float, vector_float) -> vector_float); + impl_vec_trait!([VectorMin vec_min] vec_vfmindb (vector_double, vector_double) -> vector_double); + #[unstable(feature = "stdarch_s390x", issue = "135681")] pub trait VectorAbs { unsafe fn vec_abs(self) -> Self; |
