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