@@ -51,6 +51,12 @@ types! {
5151 pub struct vector_double( 2 x f64 ) ;
5252}
5353
54+ #[ repr( packed) ]
55+ struct PackedTuple < T , U > {
56+ x : T ,
57+ y : U ,
58+ }
59+
5460#[ allow( improper_ctypes) ]
5561#[ rustfmt:: skip]
5662unsafe extern "unadjusted" {
@@ -124,6 +130,10 @@ unsafe extern "unadjusted" {
124130 #[ link_name = "llvm.s390.vfaeb" ] fn vfaeb ( a : vector_signed_char , b : vector_signed_char , c : i32 ) -> vector_signed_char ;
125131 #[ link_name = "llvm.s390.vfaeh" ] fn vfaeh ( a : vector_signed_short , b : vector_signed_short , c : i32 ) -> vector_signed_short ;
126132 #[ link_name = "llvm.s390.vfaef" ] fn vfaef ( a : vector_signed_int , b : vector_signed_int , c : i32 ) -> vector_signed_int ;
133+
134+ #[ link_name = "llvm.s390.vfaebs" ] fn vfaebs ( a : vector_signed_char , b : vector_signed_char , c : i32 ) -> PackedTuple < vector_signed_char , i32 > ;
135+ #[ link_name = "llvm.s390.vfaehs" ] fn vfaehs ( a : vector_signed_short , b : vector_signed_short , c : i32 ) -> PackedTuple < vector_signed_short , i32 > ;
136+ #[ link_name = "llvm.s390.vfaefs" ] fn vfaefs ( a : vector_signed_int , b : vector_signed_int , c : i32 ) -> PackedTuple < vector_signed_int , i32 > ;
127137}
128138
129139impl_from ! { i8x16, u8x16, i16x8, u16x8, i32x4, u32x4, i64x2, u64x2, f32x4, f64x2 }
@@ -1554,6 +1564,21 @@ mod sealed {
15541564 }
15551565
15561566 macro_rules! impl_vfae {
1567+ ( [ cc $Trait: ident $m: ident] $imm: literal $( $fun: ident $ty: ident) * ) => {
1568+ $(
1569+ #[ unstable( feature = "stdarch_s390x" , issue = "135681" ) ]
1570+ impl $Trait<Self > for $ty {
1571+ type Result = t_b!( $ty) ;
1572+ #[ inline]
1573+ #[ target_feature( enable = "vector" ) ]
1574+ unsafe fn $m( self , b: Self , c: * mut i32 ) -> Self :: Result {
1575+ let PackedTuple { x, y } = $fun:: <$imm>( transmute( self ) , transmute( b) ) ;
1576+ c. write( y) ;
1577+ transmute( x)
1578+ }
1579+ }
1580+ ) *
1581+ } ;
15571582 ( [ idx $Trait: ident $m: ident] $imm: literal $( $fun: ident $ty: ident $r: ident) * ) => {
15581583 $(
15591584 #[ unstable( feature = "stdarch_s390x" , issue = "135681" ) ]
@@ -1661,6 +1686,74 @@ mod sealed {
16611686 vfaef vector_unsigned_int vector_unsigned_int
16621687 vfaef vector_bool_int vector_unsigned_int
16631688 }
1689+
1690+ #[ inline]
1691+ #[ target_feature( enable = "vector" ) ]
1692+ #[ cfg_attr( test, assert_instr( vfaebs, IMM = 0 ) ) ]
1693+ unsafe fn vfaebs < const IMM : i32 > (
1694+ a : vector_signed_char ,
1695+ b : vector_signed_char ,
1696+ ) -> PackedTuple < vector_signed_char , i32 > {
1697+ super :: vfaebs ( a, b, IMM )
1698+ }
1699+ #[ inline]
1700+ #[ target_feature( enable = "vector" ) ]
1701+ #[ cfg_attr( test, assert_instr( vfaehs, IMM = 0 ) ) ]
1702+ unsafe fn vfaehs < const IMM : i32 > (
1703+ a : vector_signed_short ,
1704+ b : vector_signed_short ,
1705+ ) -> PackedTuple < vector_signed_short , i32 > {
1706+ super :: vfaehs ( a, b, IMM )
1707+ }
1708+ #[ inline]
1709+ #[ target_feature( enable = "vector" ) ]
1710+ #[ cfg_attr( test, assert_instr( vfaefs, IMM = 0 ) ) ]
1711+ unsafe fn vfaefs < const IMM : i32 > (
1712+ a : vector_signed_int ,
1713+ b : vector_signed_int ,
1714+ ) -> PackedTuple < vector_signed_int , i32 > {
1715+ super :: vfaefs ( a, b, IMM )
1716+ }
1717+
1718+ #[ unstable( feature = "stdarch_s390x" , issue = "135681" ) ]
1719+ pub trait VectorFindAnyEqCC < Other > {
1720+ type Result ;
1721+ unsafe fn vec_find_any_eq_cc ( self , other : Other , c : * mut i32 ) -> Self :: Result ;
1722+ }
1723+
1724+ impl_vfae ! { [ cc VectorFindAnyEqCC vec_find_any_eq_cc] 4
1725+ vfaebs vector_signed_char
1726+ vfaebs vector_unsigned_char
1727+ vfaebs vector_bool_char
1728+
1729+ vfaehs vector_signed_short
1730+ vfaehs vector_unsigned_short
1731+ vfaehs vector_bool_short
1732+
1733+ vfaefs vector_signed_int
1734+ vfaefs vector_unsigned_int
1735+ vfaefs vector_bool_int
1736+ }
1737+
1738+ #[ unstable( feature = "stdarch_s390x" , issue = "135681" ) ]
1739+ pub trait VectorFindAnyNeCC < Other > {
1740+ type Result ;
1741+ unsafe fn vec_find_any_ne_cc ( self , other : Other , c : * mut i32 ) -> Self :: Result ;
1742+ }
1743+
1744+ impl_vfae ! { [ cc VectorFindAnyNeCC vec_find_any_ne_cc] 12
1745+ vfaebs vector_signed_char
1746+ vfaebs vector_unsigned_char
1747+ vfaebs vector_bool_char
1748+
1749+ vfaehs vector_signed_short
1750+ vfaehs vector_unsigned_short
1751+ vfaehs vector_bool_short
1752+
1753+ vfaefs vector_signed_int
1754+ vfaefs vector_unsigned_int
1755+ vfaefs vector_bool_int
1756+ }
16641757}
16651758
16661759/// Vector element-wise addition.
@@ -2486,6 +2579,34 @@ where
24862579 a. vec_find_any_ne_idx ( b)
24872580}
24882581
2582+ #[ inline]
2583+ #[ target_feature( enable = "vector" ) ]
2584+ #[ unstable( feature = "stdarch_s390x" , issue = "135681" ) ]
2585+ pub unsafe fn vec_find_any_eq_cc < T , U > (
2586+ a : T ,
2587+ b : U ,
2588+ c : * mut i32 ,
2589+ ) -> <T as sealed:: VectorFindAnyEqCC < U > >:: Result
2590+ where
2591+ T : sealed:: VectorFindAnyEqCC < U > ,
2592+ {
2593+ a. vec_find_any_eq_cc ( b, c)
2594+ }
2595+
2596+ #[ inline]
2597+ #[ target_feature( enable = "vector" ) ]
2598+ #[ unstable( feature = "stdarch_s390x" , issue = "135681" ) ]
2599+ pub unsafe fn vec_find_any_ne_cc < T , U > (
2600+ a : T ,
2601+ b : U ,
2602+ c : * mut i32 ,
2603+ ) -> <T as sealed:: VectorFindAnyNeCC < U > >:: Result
2604+ where
2605+ T : sealed:: VectorFindAnyNeCC < U > ,
2606+ {
2607+ a. vec_find_any_ne_cc ( b, c)
2608+ }
2609+
24892610#[ cfg( test) ]
24902611mod tests {
24912612 use super :: * ;
@@ -3040,4 +3161,40 @@ mod tests {
30403161 [ 1 , 2 , 3 , 4 ] ,
30413162 [ 0 , 16 , 0 , 0 ]
30423163 }
3164+
3165+ #[ simd_test( enable = "vector" ) ]
3166+ fn test_vec_find_any_eq_cc ( ) {
3167+ let mut c = 0i32 ;
3168+
3169+ let a = vector_unsigned_int ( [ 1 , 2 , 3 , 4 ] ) ;
3170+ let b = vector_unsigned_int ( [ 5 , 3 , 7 , 8 ] ) ;
3171+
3172+ let d = unsafe { vec_find_any_eq_cc ( a, b, & mut c) } ;
3173+ assert_eq ! ( c, 1 ) ;
3174+ assert_eq ! ( d. as_array( ) , & [ 0 , 0 , -1 , 0 ] ) ;
3175+
3176+ let a = vector_unsigned_int ( [ 1 , 2 , 3 , 4 ] ) ;
3177+ let b = vector_unsigned_int ( [ 5 , 6 , 7 , 8 ] ) ;
3178+ let d = unsafe { vec_find_any_eq_cc ( a, b, & mut c) } ;
3179+ assert_eq ! ( c, 3 ) ;
3180+ assert_eq ! ( d. as_array( ) , & [ 0 , 0 , 0 , 0 ] ) ;
3181+ }
3182+
3183+ #[ simd_test( enable = "vector" ) ]
3184+ fn test_vec_find_any_ne_cc ( ) {
3185+ let mut c = 0i32 ;
3186+
3187+ let a = vector_unsigned_int ( [ 1 , 2 , 3 , 4 ] ) ;
3188+ let b = vector_unsigned_int ( [ 5 , 3 , 7 , 8 ] ) ;
3189+
3190+ let d = unsafe { vec_find_any_ne_cc ( a, b, & mut c) } ;
3191+ assert_eq ! ( c, 1 ) ;
3192+ assert_eq ! ( d. as_array( ) , & [ -1 , -1 , 0 , -1 ] ) ;
3193+
3194+ let a = vector_unsigned_int ( [ 1 , 2 , 3 , 4 ] ) ;
3195+ let b = vector_unsigned_int ( [ 1 , 2 , 3 , 4 ] ) ;
3196+ let d = unsafe { vec_find_any_ne_cc ( a, b, & mut c) } ;
3197+ assert_eq ! ( c, 3 ) ;
3198+ assert_eq ! ( d. as_array( ) , & [ 0 , 0 , 0 , 0 ] ) ;
3199+ }
30433200}
0 commit comments