@@ -1087,6 +1087,43 @@ mod sealed {
1087
1087
transmute ( transmute :: < _ , vector_signed_long_long > ( self ) . vec_reve ( ) )
1088
1088
}
1089
1089
}
1090
+
1091
+ #[ unstable( feature = "stdarch_s390x" , issue = "135681" ) ]
1092
+ pub trait VectorRevb {
1093
+ unsafe fn vec_revb ( self ) -> Self ;
1094
+ }
1095
+
1096
+ test_impl ! { bswapb ( a: vector_signed_char) -> vector_signed_char [ simd_bswap, _] }
1097
+ test_impl ! { bswaph ( a: vector_signed_short) -> vector_signed_short [ simd_bswap, vperm] }
1098
+ test_impl ! { bswapf ( a: vector_signed_int) -> vector_signed_int [ simd_bswap, vperm] }
1099
+ test_impl ! { bswapg ( a: vector_signed_long_long) -> vector_signed_long_long [ simd_bswap, vperm] }
1100
+
1101
+ impl_vec_trait ! { [ VectorRevb vec_revb] + bswapb ( vector_unsigned_char) }
1102
+ impl_vec_trait ! { [ VectorRevb vec_revb] + bswapb ( vector_signed_char) }
1103
+ impl_vec_trait ! { [ VectorRevb vec_revb] + bswaph ( vector_unsigned_short) }
1104
+ impl_vec_trait ! { [ VectorRevb vec_revb] + bswaph ( vector_signed_short) }
1105
+ impl_vec_trait ! { [ VectorRevb vec_revb] + bswapf ( vector_unsigned_int) }
1106
+ impl_vec_trait ! { [ VectorRevb vec_revb] + bswapf ( vector_signed_int) }
1107
+ impl_vec_trait ! { [ VectorRevb vec_revb] + bswapg ( vector_unsigned_long_long) }
1108
+ impl_vec_trait ! { [ VectorRevb vec_revb] + bswapg ( vector_signed_long_long) }
1109
+
1110
+ #[ unstable( feature = "stdarch_s390x" , issue = "135681" ) ]
1111
+ impl VectorRevb for vector_float {
1112
+ #[ inline]
1113
+ #[ target_feature( enable = "vector" ) ]
1114
+ unsafe fn vec_revb ( self ) -> Self {
1115
+ transmute ( transmute :: < _ , vector_signed_int > ( self ) . vec_revb ( ) )
1116
+ }
1117
+ }
1118
+
1119
+ #[ unstable( feature = "stdarch_s390x" , issue = "135681" ) ]
1120
+ impl VectorRevb for vector_double {
1121
+ #[ inline]
1122
+ #[ target_feature( enable = "vector" ) ]
1123
+ unsafe fn vec_revb ( self ) -> Self {
1124
+ transmute ( transmute :: < _ , vector_signed_long_long > ( self ) . vec_revb ( ) )
1125
+ }
1126
+ }
1090
1127
}
1091
1128
1092
1129
/// Vector element-wise addition.
@@ -1558,6 +1595,17 @@ where
1558
1595
a. vec_reve ( )
1559
1596
}
1560
1597
1598
+ /// Returns a vector where each vector element contains the corresponding byte-reversed vector element of the input vector.
1599
+ #[ inline]
1600
+ #[ target_feature( enable = "vector" ) ]
1601
+ #[ unstable( feature = "stdarch_s390x" , issue = "135681" ) ]
1602
+ pub unsafe fn vec_revb < T > ( a : T ) -> T
1603
+ where
1604
+ T : sealed:: VectorRevb ,
1605
+ {
1606
+ a. vec_revb ( )
1607
+ }
1608
+
1561
1609
#[ cfg( test) ]
1562
1610
mod tests {
1563
1611
use super :: * ;
@@ -1913,4 +1961,9 @@ mod tests {
1913
1961
[ 0.1 , 0.5 , 0.6 , 0.9 ] ,
1914
1962
[ 0.9 , 0.6 , 0.5 , 0.1 ]
1915
1963
}
1964
+
1965
+ test_vec_1 ! { test_vec_revb_u32, vec_revb, u32x4,
1966
+ [ 0xAABBCCDD , 0xEEFF0011 , 0x22334455 , 0x66778899 ] ,
1967
+ [ 0xDDCCBBAA , 0x1100FFEE , 0x55443322 , 0x99887766 ]
1968
+ }
1916
1969
}
0 commit comments