@@ -112,6 +112,15 @@ unsafe extern "unadjusted" {
112
112
#[ link_name = "llvm.s390.vsumqf" ] fn vsumqf ( a : vector_unsigned_int , b : vector_unsigned_int ) -> u128 ;
113
113
#[ link_name = "llvm.s390.vsumqg" ] fn vsumqg ( a : vector_unsigned_long_long , b : vector_unsigned_long_long ) -> u128 ;
114
114
115
+ #[ link_name = "llvm.s390.vscbiq" ] fn vscbiq ( a : u128 , b : u128 ) -> u128 ;
116
+ #[ link_name = "llvm.s390.vsbiq" ] fn vsbiq ( a : u128 , b : u128 , c : u128 ) -> u128 ;
117
+ #[ link_name = "llvm.s390.vsbcbiq" ] fn vsbcbiq ( a : u128 , b : u128 , c : u128 ) -> u128 ;
118
+
119
+ #[ link_name = "llvm.s390.vscbib" ] fn vscbib ( a : vector_unsigned_char , b : vector_unsigned_char ) -> vector_unsigned_char ;
120
+ #[ link_name = "llvm.s390.vscbih" ] fn vscbih ( a : vector_unsigned_short , b : vector_unsigned_short ) -> vector_unsigned_short ;
121
+ #[ link_name = "llvm.s390.vscbif" ] fn vscbif ( a : vector_unsigned_int , b : vector_unsigned_int ) -> vector_unsigned_int ;
122
+ #[ link_name = "llvm.s390.vscbig" ] fn vscbig ( a : vector_unsigned_long_long , b : vector_unsigned_long_long ) -> vector_unsigned_long_long ;
123
+
115
124
}
116
125
117
126
impl_from ! { i8x16, u8x16, i16x8, u16x8, i32x4, u32x4, i64x2, u64x2, f32x4, f64x2 }
@@ -1398,6 +1407,22 @@ mod sealed {
1398
1407
vec_vsumh ( self , other)
1399
1408
}
1400
1409
}
1410
+
1411
+ #[ unstable( feature = "stdarch_s390x" , issue = "135681" ) ]
1412
+ pub trait VectorSubc < Other > {
1413
+ type Result ;
1414
+ unsafe fn vec_subc ( self , b : Other ) -> Self :: Result ;
1415
+ }
1416
+
1417
+ test_impl ! { vec_vscbib ( a: vector_unsigned_char, b: vector_unsigned_char) -> vector_unsigned_char [ vscbib, vscbib] }
1418
+ test_impl ! { vec_vscbih ( a: vector_unsigned_short, b: vector_unsigned_short) -> vector_unsigned_short [ vscbih, vscbih] }
1419
+ test_impl ! { vec_vscbif ( a: vector_unsigned_int, b: vector_unsigned_int) -> vector_unsigned_int [ vscbif, vscbif] }
1420
+ test_impl ! { vec_vscbig ( a: vector_unsigned_long_long, b: vector_unsigned_long_long) -> vector_unsigned_long_long [ vscbig, vscbig] }
1421
+
1422
+ impl_vec_trait ! { [ VectorSubc vec_subc] vec_vscbib ( vector_unsigned_char, vector_unsigned_char) -> vector_unsigned_char }
1423
+ impl_vec_trait ! { [ VectorSubc vec_subc] vec_vscbih ( vector_unsigned_short, vector_unsigned_short) -> vector_unsigned_short }
1424
+ impl_vec_trait ! { [ VectorSubc vec_subc] vec_vscbif ( vector_unsigned_int, vector_unsigned_int) -> vector_unsigned_int }
1425
+ impl_vec_trait ! { [ VectorSubc vec_subc] vec_vscbig ( vector_unsigned_long_long, vector_unsigned_long_long) -> vector_unsigned_long_long }
1401
1426
}
1402
1427
1403
1428
/// Vector element-wise addition.
@@ -1991,6 +2016,93 @@ pub unsafe fn vec_sum4<T: sealed::VectorSum4>(a: T, b: T) -> vector_unsigned_int
1991
2016
a. vec_sum4 ( b)
1992
2017
}
1993
2018
2019
+ /// Vector Subtract unsigned 128-bits
2020
+ ///
2021
+ /// Subtracts unsigned quadword values.
2022
+ ///
2023
+ /// This function operates on the vectors as 128-bit unsigned integers. It returns low 128 bits of a - b.
2024
+ #[ inline]
2025
+ #[ target_feature( enable = "vector" ) ]
2026
+ #[ unstable( feature = "stdarch_s390x" , issue = "135681" ) ]
2027
+ #[ cfg_attr( test, assert_instr( vsq) ) ]
2028
+ pub unsafe fn vec_sub_u128 (
2029
+ a : vector_unsigned_char ,
2030
+ b : vector_unsigned_char ,
2031
+ ) -> vector_unsigned_char {
2032
+ let a: u128 = transmute ( a) ;
2033
+ let b: u128 = transmute ( b) ;
2034
+
2035
+ transmute ( a. wrapping_sub ( b) )
2036
+ }
2037
+
2038
+ /// Vector Subtract Carryout
2039
+ ///
2040
+ /// Returns a vector containing the borrow produced by subtracting each of corresponding elements of b from a.
2041
+ ///
2042
+ /// On each resulting element, the value is 0 if a borrow occurred, or 1 if no borrow occurred.
2043
+ #[ inline]
2044
+ #[ target_feature( enable = "vector" ) ]
2045
+ #[ unstable( feature = "stdarch_s390x" , issue = "135681" ) ]
2046
+ pub unsafe fn vec_subc < T , U > ( a : T , b : U ) -> <T as sealed:: VectorSubc < U > >:: Result
2047
+ where
2048
+ T : sealed:: VectorSubc < U > ,
2049
+ {
2050
+ a. vec_subc ( b)
2051
+ }
2052
+
2053
+ /// Gets the carry bit of the 128-bit subtraction of two quadword values.
2054
+ /// This function operates on the vectors as 128-bit unsigned integers. It returns a vector containing the borrow produced by subtracting b from a, as unsigned 128-bits integers.
2055
+ /// If no borrow occurred, the bit 127 of d is 1; otherwise it is set to 0. All other bits of d are 0.
2056
+ #[ inline]
2057
+ #[ target_feature( enable = "vector" ) ]
2058
+ #[ unstable( feature = "stdarch_s390x" , issue = "135681" ) ]
2059
+ #[ cfg_attr( test, assert_instr( vscbiq) ) ]
2060
+ pub unsafe fn vec_subc_u128 (
2061
+ a : vector_unsigned_char ,
2062
+ b : vector_unsigned_char ,
2063
+ ) -> vector_unsigned_char {
2064
+ transmute ( vscbiq ( transmute ( a) , transmute ( b) ) )
2065
+ }
2066
+
2067
+ /// Subtracts unsigned quadword values with carry bit from a previous operation.
2068
+ ///
2069
+ /// This function operates on the vectors as 128-bit unsigned integers. It returns a vector containing the result of subtracting of b from a,
2070
+ /// and the carryout bit from a previous operation.
2071
+ ///
2072
+ /// Note: Only the borrow indication bit (127-bit) of c is used, and the other bits are ignored.
2073
+ #[ inline]
2074
+ #[ target_feature( enable = "vector" ) ]
2075
+ #[ unstable( feature = "stdarch_s390x" , issue = "135681" ) ]
2076
+ #[ cfg_attr( test, assert_instr( vsbiq) ) ]
2077
+ pub unsafe fn vec_sube_u128 (
2078
+ a : vector_unsigned_char ,
2079
+ b : vector_unsigned_char ,
2080
+ c : vector_unsigned_char ,
2081
+ ) -> vector_unsigned_char {
2082
+ transmute ( vsbiq ( transmute ( a) , transmute ( b) , transmute ( c) ) )
2083
+ }
2084
+
2085
+ /// Vector Subtract with Carryout, Carryout
2086
+ ///
2087
+ /// Gets the carry bit of the 128-bit subtraction of two quadword values with carry bit from the previous operation.
2088
+ ///
2089
+ /// It returns a vector containing the carryout produced from the result of subtracting of b from a,
2090
+ /// and the carryout bit from a previous operation. If no borrow occurred, the 127-bit of d is 1, otherwise 0.
2091
+ /// All other bits of d are 0.
2092
+ ///
2093
+ /// Note: Only the borrow indication bit (127-bit) of c is used, and the other bits are ignored.
2094
+ #[ inline]
2095
+ #[ target_feature( enable = "vector" ) ]
2096
+ #[ unstable( feature = "stdarch_s390x" , issue = "135681" ) ]
2097
+ #[ cfg_attr( test, assert_instr( vsbcbiq) ) ]
2098
+ pub unsafe fn vec_subec_u128 (
2099
+ a : vector_unsigned_char ,
2100
+ b : vector_unsigned_char ,
2101
+ c : vector_unsigned_char ,
2102
+ ) -> vector_unsigned_char {
2103
+ transmute ( vsbcbiq ( transmute ( a) , transmute ( b) , transmute ( c) ) )
2104
+ }
2105
+
1994
2106
#[ cfg( test) ]
1995
2107
mod tests {
1996
2108
use super :: * ;
0 commit comments