@@ -102,6 +102,16 @@ unsafe extern "unadjusted" {
102
102
#[ link_name = "llvm.s390.verimg" ] fn verimg ( a : vector_signed_long_long , b : vector_signed_long_long , c : vector_signed_long_long , d : i32 ) -> vector_signed_long_long ;
103
103
104
104
#[ link_name = "llvm.s390.vperm" ] fn vperm ( a : vector_signed_char , b : vector_signed_char , c : vector_unsigned_char ) -> vector_signed_char ;
105
+
106
+ #[ link_name = "llvm.s390.vsumb" ] fn vsumb ( a : vector_unsigned_char , b : vector_unsigned_char ) -> vector_unsigned_int ;
107
+ #[ link_name = "llvm.s390.vsumh" ] fn vsumh ( a : vector_unsigned_short , b : vector_unsigned_short ) -> vector_unsigned_int ;
108
+
109
+ #[ link_name = "llvm.s390.vsumgh" ] fn vsumgh ( a : vector_unsigned_short , b : vector_unsigned_short ) -> vector_unsigned_long_long ;
110
+ #[ link_name = "llvm.s390.vsumgf" ] fn vsumgf ( a : vector_unsigned_int , b : vector_unsigned_int ) -> vector_unsigned_long_long ;
111
+
112
+ #[ link_name = "llvm.s390.vsumqf" ] fn vsumqf ( a : vector_unsigned_int , b : vector_unsigned_int ) -> u128 ;
113
+ #[ link_name = "llvm.s390.vsumqg" ] fn vsumqg ( a : vector_unsigned_long_long , b : vector_unsigned_long_long ) -> u128 ;
114
+
105
115
}
106
116
107
117
impl_from ! { i8x16, u8x16, i16x8, u16x8, i32x4, u32x4, i64x2, u64x2, f32x4, f64x2 }
@@ -1299,6 +1309,95 @@ mod sealed {
1299
1309
vector_float,
1300
1310
vector_double
1301
1311
}
1312
+
1313
+ #[ unstable( feature = "stdarch_s390x" , issue = "135681" ) ]
1314
+ pub trait VectorSumU128 {
1315
+ unsafe fn vec_sum_u128 ( self , other : Self ) -> vector_unsigned_char ;
1316
+ }
1317
+
1318
+ #[ inline]
1319
+ #[ target_feature( enable = "vector" ) ]
1320
+ #[ cfg_attr( test, assert_instr( vsumqf) ) ]
1321
+ pub unsafe fn vec_vsumqf ( a : vector_unsigned_int , b : vector_unsigned_int ) -> u128 {
1322
+ transmute ( vsumqf ( a, b) )
1323
+ }
1324
+
1325
+ #[ inline]
1326
+ #[ target_feature( enable = "vector" ) ]
1327
+ #[ cfg_attr( test, assert_instr( vsumqg) ) ]
1328
+ pub unsafe fn vec_vsumqg ( a : vector_unsigned_long_long , b : vector_unsigned_long_long ) -> u128 {
1329
+ transmute ( vsumqg ( a, b) )
1330
+ }
1331
+
1332
+ #[ unstable( feature = "stdarch_s390x" , issue = "135681" ) ]
1333
+ impl VectorSumU128 for vector_unsigned_int {
1334
+ #[ inline]
1335
+ #[ target_feature( enable = "vector" ) ]
1336
+ unsafe fn vec_sum_u128 ( self , other : Self ) -> vector_unsigned_char {
1337
+ transmute ( vec_vsumqf ( self , other) )
1338
+ }
1339
+ }
1340
+
1341
+ #[ unstable( feature = "stdarch_s390x" , issue = "135681" ) ]
1342
+ impl VectorSumU128 for vector_unsigned_long_long {
1343
+ #[ inline]
1344
+ #[ target_feature( enable = "vector" ) ]
1345
+ unsafe fn vec_sum_u128 ( self , other : Self ) -> vector_unsigned_char {
1346
+ transmute ( vec_vsumqg ( self , other) )
1347
+ }
1348
+ }
1349
+
1350
+ #[ unstable( feature = "stdarch_s390x" , issue = "135681" ) ]
1351
+ pub trait VectorSum2 {
1352
+ unsafe fn vec_sum2 ( self , other : Self ) -> vector_unsigned_long_long ;
1353
+ }
1354
+
1355
+ test_impl ! { vec_vsumgh ( a: vector_unsigned_short, b: vector_unsigned_short) -> vector_unsigned_long_long [ vsumgh, vsumgh] }
1356
+ test_impl ! { vec_vsumgf ( a: vector_unsigned_int, b: vector_unsigned_int) -> vector_unsigned_long_long [ vsumgf, vsumgf] }
1357
+
1358
+ #[ unstable( feature = "stdarch_s390x" , issue = "135681" ) ]
1359
+ impl VectorSum2 for vector_unsigned_short {
1360
+ #[ inline]
1361
+ #[ target_feature( enable = "vector" ) ]
1362
+ unsafe fn vec_sum2 ( self , other : Self ) -> vector_unsigned_long_long {
1363
+ vec_vsumgh ( self , other)
1364
+ }
1365
+ }
1366
+
1367
+ #[ unstable( feature = "stdarch_s390x" , issue = "135681" ) ]
1368
+ impl VectorSum2 for vector_unsigned_int {
1369
+ #[ inline]
1370
+ #[ target_feature( enable = "vector" ) ]
1371
+ unsafe fn vec_sum2 ( self , other : Self ) -> vector_unsigned_long_long {
1372
+ vec_vsumgf ( self , other)
1373
+ }
1374
+ }
1375
+
1376
+ #[ unstable( feature = "stdarch_s390x" , issue = "135681" ) ]
1377
+ pub trait VectorSum4 {
1378
+ unsafe fn vec_sum4 ( self , other : Self ) -> vector_unsigned_int ;
1379
+ }
1380
+
1381
+ test_impl ! { vec_vsumb ( a: vector_unsigned_char, b: vector_unsigned_char) -> vector_unsigned_int [ vsumb, vsumb] }
1382
+ test_impl ! { vec_vsumh ( a: vector_unsigned_short, b: vector_unsigned_short) -> vector_unsigned_int [ vsumh, vsumh] }
1383
+
1384
+ #[ unstable( feature = "stdarch_s390x" , issue = "135681" ) ]
1385
+ impl VectorSum4 for vector_unsigned_char {
1386
+ #[ inline]
1387
+ #[ target_feature( enable = "vector" ) ]
1388
+ unsafe fn vec_sum4 ( self , other : Self ) -> vector_unsigned_int {
1389
+ vec_vsumb ( self , other)
1390
+ }
1391
+ }
1392
+
1393
+ #[ unstable( feature = "stdarch_s390x" , issue = "135681" ) ]
1394
+ impl VectorSum4 for vector_unsigned_short {
1395
+ #[ inline]
1396
+ #[ target_feature( enable = "vector" ) ]
1397
+ unsafe fn vec_sum4 ( self , other : Self ) -> vector_unsigned_int {
1398
+ vec_vsumh ( self , other)
1399
+ }
1400
+ }
1302
1401
}
1303
1402
1304
1403
/// Vector element-wise addition.
@@ -1859,6 +1958,39 @@ pub unsafe fn vec_perm<T: sealed::VectorPerm>(a: T, b: T, c: vector_unsigned_cha
1859
1958
a. vec_perm ( b, c)
1860
1959
}
1861
1960
1961
+ /// Vector Sum Across Quadword
1962
+ ///
1963
+ /// Returns a vector containing the results of performing a sum across all the elements in each of the quadword of vector a,
1964
+ /// and the rightmost word or doubleword element of the b. The result is an unsigned 128-bit integer.
1965
+ #[ inline]
1966
+ #[ target_feature( enable = "vector" ) ]
1967
+ #[ unstable( feature = "stdarch_s390x" , issue = "135681" ) ]
1968
+ pub unsafe fn vec_sum_u128 < T : sealed:: VectorSumU128 > ( a : T , b : T ) -> vector_unsigned_char {
1969
+ a. vec_sum_u128 ( b)
1970
+ }
1971
+
1972
+ /// Vector Sum Across Doubleword
1973
+ ///
1974
+ /// Returns a vector containing the results of performing a sum across all the elements in each of the doubleword of vector a,
1975
+ /// and the rightmost sub-element of the corresponding doubleword of b.
1976
+ #[ inline]
1977
+ #[ target_feature( enable = "vector" ) ]
1978
+ #[ unstable( feature = "stdarch_s390x" , issue = "135681" ) ]
1979
+ pub unsafe fn vec_sum2 < T : sealed:: VectorSum2 > ( a : T , b : T ) -> vector_unsigned_long_long {
1980
+ a. vec_sum2 ( b)
1981
+ }
1982
+
1983
+ /// Vector Sum Across Word
1984
+ ///
1985
+ /// Returns a vector containing the results of performing a sum across all the elements in each of the word of vector a,
1986
+ /// and the rightmost sub-element of the corresponding word of b.
1987
+ #[ inline]
1988
+ #[ target_feature( enable = "vector" ) ]
1989
+ #[ unstable( feature = "stdarch_s390x" , issue = "135681" ) ]
1990
+ pub unsafe fn vec_sum4 < T : sealed:: VectorSum4 > ( a : T , b : T ) -> vector_unsigned_int {
1991
+ a. vec_sum4 ( b)
1992
+ }
1993
+
1862
1994
#[ cfg( test) ]
1863
1995
mod tests {
1864
1996
use super :: * ;
0 commit comments