@@ -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 }
@@ -1394,6 +1403,22 @@ mod sealed {
1394
1403
vec_vsumh ( self , other)
1395
1404
}
1396
1405
}
1406
+
1407
+ #[ unstable( feature = "stdarch_s390x" , issue = "135681" ) ]
1408
+ pub trait VectorSubc < Other > {
1409
+ type Result ;
1410
+ unsafe fn vec_subc ( self , b : Other ) -> Self :: Result ;
1411
+ }
1412
+
1413
+ test_impl ! { vec_vscbib ( a: vector_unsigned_char, b: vector_unsigned_char) -> vector_unsigned_char [ vscbib, vscbib] }
1414
+ test_impl ! { vec_vscbih ( a: vector_unsigned_short, b: vector_unsigned_short) -> vector_unsigned_short [ vscbih, vscbih] }
1415
+ test_impl ! { vec_vscbif ( a: vector_unsigned_int, b: vector_unsigned_int) -> vector_unsigned_int [ vscbif, vscbif] }
1416
+ test_impl ! { vec_vscbig ( a: vector_unsigned_long_long, b: vector_unsigned_long_long) -> vector_unsigned_long_long [ vscbig, vscbig] }
1417
+
1418
+ impl_vec_trait ! { [ VectorSubc vec_subc] vec_vscbib ( vector_unsigned_char, vector_unsigned_char) -> vector_unsigned_char }
1419
+ impl_vec_trait ! { [ VectorSubc vec_subc] vec_vscbih ( vector_unsigned_short, vector_unsigned_short) -> vector_unsigned_short }
1420
+ impl_vec_trait ! { [ VectorSubc vec_subc] vec_vscbif ( vector_unsigned_int, vector_unsigned_int) -> vector_unsigned_int }
1421
+ impl_vec_trait ! { [ VectorSubc vec_subc] vec_vscbig ( vector_unsigned_long_long, vector_unsigned_long_long) -> vector_unsigned_long_long }
1397
1422
}
1398
1423
1399
1424
/// Vector element-wise addition.
@@ -1987,6 +2012,93 @@ pub unsafe fn vec_sum4<T: sealed::VectorSum4>(a: T, b: T) -> vector_unsigned_int
1987
2012
a. vec_sum4 ( b)
1988
2013
}
1989
2014
2015
+ /// Vector Subtract unsigned 128-bits
2016
+ ///
2017
+ /// Subtracts unsigned quadword values.
2018
+ ///
2019
+ /// This function operates on the vectors as 128-bit unsigned integers. It returns low 128 bits of a - b.
2020
+ #[ inline]
2021
+ #[ target_feature( enable = "vector" ) ]
2022
+ #[ unstable( feature = "stdarch_s390x" , issue = "135681" ) ]
2023
+ #[ cfg_attr( test, assert_instr( vsq) ) ]
2024
+ pub unsafe fn vec_sub_u128 (
2025
+ a : vector_unsigned_char ,
2026
+ b : vector_unsigned_char ,
2027
+ ) -> vector_unsigned_char {
2028
+ let a: u128 = transmute ( a) ;
2029
+ let b: u128 = transmute ( b) ;
2030
+
2031
+ transmute ( a. wrapping_sub ( b) )
2032
+ }
2033
+
2034
+ /// Vector Subtract Carryout
2035
+ ///
2036
+ /// Returns a vector containing the borrow produced by subtracting each of corresponding elements of b from a.
2037
+ ///
2038
+ /// On each resulting element, the value is 0 if a borrow occurred, or 1 if no borrow occurred.
2039
+ #[ inline]
2040
+ #[ target_feature( enable = "vector" ) ]
2041
+ #[ unstable( feature = "stdarch_s390x" , issue = "135681" ) ]
2042
+ pub unsafe fn vec_subc < T , U > ( a : T , b : U ) -> <T as sealed:: VectorSubc < U > >:: Result
2043
+ where
2044
+ T : sealed:: VectorSubc < U > ,
2045
+ {
2046
+ a. vec_subc ( b)
2047
+ }
2048
+
2049
+ /// Gets the carry bit of the 128-bit subtraction of two quadword values.
2050
+ /// 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.
2051
+ /// If no borrow occurred, the bit 127 of d is 1; otherwise it is set to 0. All other bits of d are 0.
2052
+ #[ inline]
2053
+ #[ target_feature( enable = "vector" ) ]
2054
+ #[ unstable( feature = "stdarch_s390x" , issue = "135681" ) ]
2055
+ #[ cfg_attr( test, assert_instr( vscbiq) ) ]
2056
+ pub unsafe fn vec_subc_u128 (
2057
+ a : vector_unsigned_char ,
2058
+ b : vector_unsigned_char ,
2059
+ ) -> vector_unsigned_char {
2060
+ transmute ( vscbiq ( transmute ( a) , transmute ( b) ) )
2061
+ }
2062
+
2063
+ /// Subtracts unsigned quadword values with carry bit from a previous operation.
2064
+ ///
2065
+ /// This function operates on the vectors as 128-bit unsigned integers. It returns a vector containing the result of subtracting of b from a,
2066
+ /// and the carryout bit from a previous operation.
2067
+ ///
2068
+ /// Note: Only the borrow indication bit (127-bit) of c is used, and the other bits are ignored.
2069
+ #[ inline]
2070
+ #[ target_feature( enable = "vector" ) ]
2071
+ #[ unstable( feature = "stdarch_s390x" , issue = "135681" ) ]
2072
+ #[ cfg_attr( test, assert_instr( vsbiq) ) ]
2073
+ pub unsafe fn vec_sube_u128 (
2074
+ a : vector_unsigned_char ,
2075
+ b : vector_unsigned_char ,
2076
+ c : vector_unsigned_char ,
2077
+ ) -> vector_unsigned_char {
2078
+ transmute ( vsbiq ( transmute ( a) , transmute ( b) , transmute ( c) ) )
2079
+ }
2080
+
2081
+ /// Vector Subtract with Carryout, Carryout
2082
+ ///
2083
+ /// Gets the carry bit of the 128-bit subtraction of two quadword values with carry bit from the previous operation.
2084
+ ///
2085
+ /// It returns a vector containing the carryout produced from the result of subtracting of b from a,
2086
+ /// and the carryout bit from a previous operation. If no borrow occurred, the 127-bit of d is 1, otherwise 0.
2087
+ /// All other bits of d are 0.
2088
+ ///
2089
+ /// Note: Only the borrow indication bit (127-bit) of c is used, and the other bits are ignored.
2090
+ #[ inline]
2091
+ #[ target_feature( enable = "vector" ) ]
2092
+ #[ unstable( feature = "stdarch_s390x" , issue = "135681" ) ]
2093
+ #[ cfg_attr( test, assert_instr( vsbcbiq) ) ]
2094
+ pub unsafe fn vec_subec_u128 (
2095
+ a : vector_unsigned_char ,
2096
+ b : vector_unsigned_char ,
2097
+ c : vector_unsigned_char ,
2098
+ ) -> vector_unsigned_char {
2099
+ transmute ( vsbcbiq ( transmute ( a) , transmute ( b) , transmute ( c) ) )
2100
+ }
2101
+
1990
2102
#[ cfg( test) ]
1991
2103
mod tests {
1992
2104
use super :: * ;
0 commit comments