@@ -52,7 +52,28 @@ types! {
5252}
5353
5454#[ allow( improper_ctypes) ]
55- extern "C" { }
55+ #[ rustfmt:: skip]
56+ extern "unadjusted" {
57+ #[ link_name = "llvm.smax.v16i8" ] fn vmxb ( a : vector_signed_char , b : vector_signed_char ) -> vector_signed_char ;
58+ #[ link_name = "llvm.smax.v8i16" ] fn vmxh ( a : vector_signed_short , b : vector_signed_short ) -> vector_signed_short ;
59+ #[ link_name = "llvm.smax.v4i32" ] fn vmxf ( a : vector_signed_int , b : vector_signed_int ) -> vector_signed_int ;
60+ #[ link_name = "llvm.smax.v2i64" ] fn vmxg ( a : vector_signed_long_long , b : vector_signed_long_long ) -> vector_signed_long_long ;
61+
62+ #[ link_name = "llvm.umax.v16i8" ] fn vmxlb ( a : vector_unsigned_char , b : vector_unsigned_char ) -> vector_unsigned_char ;
63+ #[ link_name = "llvm.umax.v8i16" ] fn vmxlh ( a : vector_unsigned_short , b : vector_unsigned_short ) -> vector_unsigned_short ;
64+ #[ link_name = "llvm.umax.v4i32" ] fn vmxlf ( a : vector_unsigned_int , b : vector_unsigned_int ) -> vector_unsigned_int ;
65+ #[ link_name = "llvm.umax.v2i64" ] fn vmxlg ( a : vector_unsigned_long_long , b : vector_unsigned_long_long ) -> vector_unsigned_long_long ;
66+
67+ #[ link_name = "llvm.smin.v16i8" ] fn vmnb ( a : vector_signed_char , b : vector_signed_char ) -> vector_signed_char ;
68+ #[ link_name = "llvm.smin.v8i16" ] fn vmnh ( a : vector_signed_short , b : vector_signed_short ) -> vector_signed_short ;
69+ #[ link_name = "llvm.smin.v4i32" ] fn vmnf ( a : vector_signed_int , b : vector_signed_int ) -> vector_signed_int ;
70+ #[ link_name = "llvm.smin.v2i64" ] fn vmng ( a : vector_signed_long_long , b : vector_signed_long_long ) -> vector_signed_long_long ;
71+
72+ #[ link_name = "llvm.umin.v16i8" ] fn vmnlb ( a : vector_unsigned_char , b : vector_unsigned_char ) -> vector_unsigned_char ;
73+ #[ link_name = "llvm.umin.v8i16" ] fn vmnlh ( a : vector_unsigned_short , b : vector_unsigned_short ) -> vector_unsigned_short ;
74+ #[ link_name = "llvm.umin.v4i32" ] fn vmnlf ( a : vector_unsigned_int , b : vector_unsigned_int ) -> vector_unsigned_int ;
75+ #[ link_name = "llvm.umin.v2i64" ] fn vmnlg ( a : vector_unsigned_long_long , b : vector_unsigned_long_long ) -> vector_unsigned_long_long ;
76+ }
5677
5778impl_from ! { i8x16, u8x16, i16x8, u16x8, i32x4, u32x4, i64x2, u64x2, f32x4, f64x2 }
5879
@@ -286,6 +307,43 @@ mod sealed {
286307 impl_mul ! ( vml_float, vector_float, std_simd) ;
287308 impl_mul ! ( vml_double, vector_double, vfmdb) ;
288309 }
310+
311+
312+ #[ unstable( feature = "stdarch_s390x" , issue = "135681" ) ]
313+ pub trait VectorMax < Other > {
314+ type Result ;
315+ unsafe fn vec_max ( self , b : Other ) -> Self :: Result ;
316+ }
317+
318+ test_impl ! { vec_vmxsb ( a: vector_signed_char, b: vector_signed_char) -> vector_signed_char [ vmxb, vmxb] }
319+ test_impl ! { vec_vmxsh ( a: vector_signed_short, b: vector_signed_short) -> vector_signed_short [ vmxh, vmxh] }
320+ test_impl ! { vec_vmxsf ( a: vector_signed_int, b: vector_signed_int) -> vector_signed_int [ vmxf, vmxf] }
321+ test_impl ! { vec_vmxsg ( a: vector_signed_long_long, b: vector_signed_long_long) -> vector_signed_long_long [ vmxg, vmxg] }
322+
323+ test_impl ! { vec_vmxslb ( a: vector_unsigned_char, b: vector_unsigned_char) -> vector_unsigned_char [ vmxlb, vmxlb] }
324+ test_impl ! { vec_vmxslh ( a: vector_unsigned_short, b: vector_unsigned_short) -> vector_unsigned_short [ vmxlh, vmxlh] }
325+ test_impl ! { vec_vmxslf ( a: vector_unsigned_int, b: vector_unsigned_int) -> vector_unsigned_int [ vmxlf, vmxlf] }
326+ test_impl ! { vec_vmxslg ( a: vector_unsigned_long_long, b: vector_unsigned_long_long) -> vector_unsigned_long_long [ vmxlg, vmxlg] }
327+
328+ impl_vec_trait ! { [ VectorMax vec_max] ~( vmxlb, vmxb, vmxlh, vmxh, vmxlf, vmxf, vmxlg, vmxg) }
329+
330+ #[ unstable( feature = "stdarch_s390x" , issue = "135681" ) ]
331+ pub trait VectorMin < Other > {
332+ type Result ;
333+ unsafe fn vec_min ( self , b : Other ) -> Self :: Result ;
334+ }
335+
336+ test_impl ! { vec_vmnsb ( a: vector_signed_char, b: vector_signed_char) -> vector_signed_char [ vmnb, vmnb] }
337+ test_impl ! { vec_vmnsh ( a: vector_signed_short, b: vector_signed_short) -> vector_signed_short [ vmnh, vmnh] }
338+ test_impl ! { vec_vmnsf ( a: vector_signed_int, b: vector_signed_int) -> vector_signed_int [ vmnf, vmnf] }
339+ test_impl ! { vec_vmnsg ( a: vector_signed_long_long, b: vector_signed_long_long) -> vector_signed_long_long [ vmng, vmng] }
340+
341+ test_impl ! { vec_vmnslb ( a: vector_unsigned_char, b: vector_unsigned_char) -> vector_unsigned_char [ vmnlb, vmnlb] }
342+ test_impl ! { vec_vmnslh ( a: vector_unsigned_short, b: vector_unsigned_short) -> vector_unsigned_short [ vmnlh, vmnlh] }
343+ test_impl ! { vec_vmnslf ( a: vector_unsigned_int, b: vector_unsigned_int) -> vector_unsigned_int [ vmnlf, vmnlf] }
344+ test_impl ! { vec_vmnslg ( a: vector_unsigned_long_long, b: vector_unsigned_long_long) -> vector_unsigned_long_long [ vmnlg, vmnlg] }
345+
346+ impl_vec_trait ! { [ VectorMin vec_min] ~( vmxlb, vmxb, vmxlh, vmxh, vmxlf, vmxf, vmxlg, vmxg) }
289347}
290348
291349/// Vector pointwise addition.
@@ -327,6 +385,28 @@ where
327385 a. vec_mul ( b)
328386}
329387
388+ /// Vector max.
389+ #[ inline]
390+ #[ target_feature( enable = "vector" ) ]
391+ #[ unstable( feature = "stdarch_s390x" , issue = "135681" ) ]
392+ pub unsafe fn vec_max < T , U > ( a : T , b : U ) -> <T as sealed:: VectorMax < U > >:: Result
393+ where
394+ T : sealed:: VectorMax < U > ,
395+ {
396+ a. vec_max ( b)
397+ }
398+
399+ /// Vector min.
400+ #[ inline]
401+ #[ target_feature( enable = "vector" ) ]
402+ #[ unstable( feature = "stdarch_s390x" , issue = "135681" ) ]
403+ pub unsafe fn vec_min < T , U > ( a : T , b : U ) -> <T as sealed:: VectorMin < U > >:: Result
404+ where
405+ T : sealed:: VectorMin < U > ,
406+ {
407+ a. vec_min ( b)
408+ }
409+
330410#[ cfg( test) ]
331411mod tests {
332412 use super :: * ;
0 commit comments