@@ -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 }
@@ -1295,6 +1305,95 @@ mod sealed {
1295
1305
vector_float,
1296
1306
vector_double
1297
1307
}
1308
+
1309
+ #[ unstable( feature = "stdarch_s390x" , issue = "135681" ) ]
1310
+ pub trait VectorSumU128 {
1311
+ unsafe fn vec_sum_u128 ( self , other : Self ) -> vector_unsigned_char ;
1312
+ }
1313
+
1314
+ #[ inline]
1315
+ #[ target_feature( enable = "vector" ) ]
1316
+ #[ cfg_attr( test, assert_instr( vsumqf) ) ]
1317
+ pub unsafe fn vec_vsumqf ( a : vector_unsigned_int , b : vector_unsigned_int ) -> u128 {
1318
+ transmute ( vsumqf ( a, b) )
1319
+ }
1320
+
1321
+ #[ inline]
1322
+ #[ target_feature( enable = "vector" ) ]
1323
+ #[ cfg_attr( test, assert_instr( vsumqg) ) ]
1324
+ pub unsafe fn vec_vsumqg ( a : vector_unsigned_long_long , b : vector_unsigned_long_long ) -> u128 {
1325
+ transmute ( vsumqg ( a, b) )
1326
+ }
1327
+
1328
+ #[ unstable( feature = "stdarch_s390x" , issue = "135681" ) ]
1329
+ impl VectorSumU128 for vector_unsigned_int {
1330
+ #[ inline]
1331
+ #[ target_feature( enable = "vector" ) ]
1332
+ unsafe fn vec_sum_u128 ( self , other : Self ) -> vector_unsigned_char {
1333
+ transmute ( vec_vsumqf ( self , other) )
1334
+ }
1335
+ }
1336
+
1337
+ #[ unstable( feature = "stdarch_s390x" , issue = "135681" ) ]
1338
+ impl VectorSumU128 for vector_unsigned_long_long {
1339
+ #[ inline]
1340
+ #[ target_feature( enable = "vector" ) ]
1341
+ unsafe fn vec_sum_u128 ( self , other : Self ) -> vector_unsigned_char {
1342
+ transmute ( vec_vsumqg ( self , other) )
1343
+ }
1344
+ }
1345
+
1346
+ #[ unstable( feature = "stdarch_s390x" , issue = "135681" ) ]
1347
+ pub trait VectorSum2 {
1348
+ unsafe fn vec_sum2 ( self , other : Self ) -> vector_unsigned_long_long ;
1349
+ }
1350
+
1351
+ test_impl ! { vec_vsumgh ( a: vector_unsigned_short, b: vector_unsigned_short) -> vector_unsigned_long_long [ vsumgh, vsumgh] }
1352
+ test_impl ! { vec_vsumgf ( a: vector_unsigned_int, b: vector_unsigned_int) -> vector_unsigned_long_long [ vsumgf, vsumgf] }
1353
+
1354
+ #[ unstable( feature = "stdarch_s390x" , issue = "135681" ) ]
1355
+ impl VectorSum2 for vector_unsigned_short {
1356
+ #[ inline]
1357
+ #[ target_feature( enable = "vector" ) ]
1358
+ unsafe fn vec_sum2 ( self , other : Self ) -> vector_unsigned_long_long {
1359
+ vec_vsumgh ( self , other)
1360
+ }
1361
+ }
1362
+
1363
+ #[ unstable( feature = "stdarch_s390x" , issue = "135681" ) ]
1364
+ impl VectorSum2 for vector_unsigned_int {
1365
+ #[ inline]
1366
+ #[ target_feature( enable = "vector" ) ]
1367
+ unsafe fn vec_sum2 ( self , other : Self ) -> vector_unsigned_long_long {
1368
+ vec_vsumgf ( self , other)
1369
+ }
1370
+ }
1371
+
1372
+ #[ unstable( feature = "stdarch_s390x" , issue = "135681" ) ]
1373
+ pub trait VectorSum4 {
1374
+ unsafe fn vec_sum4 ( self , other : Self ) -> vector_unsigned_int ;
1375
+ }
1376
+
1377
+ test_impl ! { vec_vsumb ( a: vector_unsigned_char, b: vector_unsigned_char) -> vector_unsigned_int [ vsumb, vsumb] }
1378
+ test_impl ! { vec_vsumh ( a: vector_unsigned_short, b: vector_unsigned_short) -> vector_unsigned_int [ vsumh, vsumh] }
1379
+
1380
+ #[ unstable( feature = "stdarch_s390x" , issue = "135681" ) ]
1381
+ impl VectorSum4 for vector_unsigned_char {
1382
+ #[ inline]
1383
+ #[ target_feature( enable = "vector" ) ]
1384
+ unsafe fn vec_sum4 ( self , other : Self ) -> vector_unsigned_int {
1385
+ vec_vsumb ( self , other)
1386
+ }
1387
+ }
1388
+
1389
+ #[ unstable( feature = "stdarch_s390x" , issue = "135681" ) ]
1390
+ impl VectorSum4 for vector_unsigned_short {
1391
+ #[ inline]
1392
+ #[ target_feature( enable = "vector" ) ]
1393
+ unsafe fn vec_sum4 ( self , other : Self ) -> vector_unsigned_int {
1394
+ vec_vsumh ( self , other)
1395
+ }
1396
+ }
1298
1397
}
1299
1398
1300
1399
/// Vector element-wise addition.
@@ -1855,6 +1954,39 @@ pub unsafe fn vec_perm<T: sealed::VectorPerm>(a: T, b: T, c: vector_unsigned_cha
1855
1954
a. vec_perm ( b, c)
1856
1955
}
1857
1956
1957
+ /// Vector Sum Across Quadword
1958
+ ///
1959
+ /// Returns a vector containing the results of performing a sum across all the elements in each of the quadword of vector a,
1960
+ /// and the rightmost word or doubleword element of the b. The result is an unsigned 128-bit integer.
1961
+ #[ inline]
1962
+ #[ target_feature( enable = "vector" ) ]
1963
+ #[ unstable( feature = "stdarch_s390x" , issue = "135681" ) ]
1964
+ pub unsafe fn vec_sum_u128 < T : sealed:: VectorSumU128 > ( a : T , b : T ) -> vector_unsigned_char {
1965
+ a. vec_sum_u128 ( b)
1966
+ }
1967
+
1968
+ /// Vector Sum Across Doubleword
1969
+ ///
1970
+ /// Returns a vector containing the results of performing a sum across all the elements in each of the doubleword of vector a,
1971
+ /// and the rightmost sub-element of the corresponding doubleword of b.
1972
+ #[ inline]
1973
+ #[ target_feature( enable = "vector" ) ]
1974
+ #[ unstable( feature = "stdarch_s390x" , issue = "135681" ) ]
1975
+ pub unsafe fn vec_sum2 < T : sealed:: VectorSum2 > ( a : T , b : T ) -> vector_unsigned_long_long {
1976
+ a. vec_sum2 ( b)
1977
+ }
1978
+
1979
+ /// Vector Sum Across Word
1980
+ ///
1981
+ /// Returns a vector containing the results of performing a sum across all the elements in each of the word of vector a,
1982
+ /// and the rightmost sub-element of the corresponding word of b.
1983
+ #[ inline]
1984
+ #[ target_feature( enable = "vector" ) ]
1985
+ #[ unstable( feature = "stdarch_s390x" , issue = "135681" ) ]
1986
+ pub unsafe fn vec_sum4 < T : sealed:: VectorSum4 > ( a : T , b : T ) -> vector_unsigned_int {
1987
+ a. vec_sum4 ( b)
1988
+ }
1989
+
1858
1990
#[ cfg( test) ]
1859
1991
mod tests {
1860
1992
use super :: * ;
0 commit comments