@@ -1045,31 +1045,47 @@ pub unsafe fn vabsq_s64(a: int64x2_t) -> int64x2_t {
1045
1045
#[ cfg_attr( test, assert_instr( bsl) ) ]
1046
1046
#[ stable( feature = "neon_intrinsics" , since = "1.59.0" ) ]
1047
1047
pub unsafe fn vbsl_f64 ( a : uint64x1_t , b : float64x1_t , c : float64x1_t ) -> float64x1_t {
1048
- simd_select ( transmute :: < _ , int64x1_t > ( a) , b, c)
1048
+ let not = int64x1_t ( -1 ) ;
1049
+ transmute ( simd_or (
1050
+ simd_and ( a, transmute ( b) ) ,
1051
+ simd_and ( simd_xor ( a, transmute ( not) ) , transmute ( c) ) ,
1052
+ ) )
1049
1053
}
1050
1054
/// Bitwise Select.
1051
1055
#[ inline]
1052
1056
#[ target_feature( enable = "neon" ) ]
1053
1057
#[ cfg_attr( test, assert_instr( bsl) ) ]
1054
1058
#[ stable( feature = "neon_intrinsics" , since = "1.59.0" ) ]
1055
1059
pub unsafe fn vbsl_p64 ( a : poly64x1_t , b : poly64x1_t , c : poly64x1_t ) -> poly64x1_t {
1056
- simd_select ( transmute :: < _ , int64x1_t > ( a) , b, c)
1060
+ let not = int64x1_t ( -1 ) ;
1061
+ transmute ( simd_or (
1062
+ simd_and ( a, transmute ( b) ) ,
1063
+ simd_and ( simd_xor ( a, transmute ( not) ) , transmute ( c) ) ,
1064
+ ) )
1057
1065
}
1058
1066
/// Bitwise Select. (128-bit)
1059
1067
#[ inline]
1060
1068
#[ target_feature( enable = "neon" ) ]
1061
1069
#[ cfg_attr( test, assert_instr( bsl) ) ]
1062
1070
#[ stable( feature = "neon_intrinsics" , since = "1.59.0" ) ]
1063
1071
pub unsafe fn vbslq_f64 ( a : uint64x2_t , b : float64x2_t , c : float64x2_t ) -> float64x2_t {
1064
- simd_select ( transmute :: < _ , int64x2_t > ( a) , b, c)
1072
+ let not = int64x2_t ( -1 , -1 ) ;
1073
+ transmute ( simd_or (
1074
+ simd_and ( a, transmute ( b) ) ,
1075
+ simd_and ( simd_xor ( a, transmute ( not) ) , transmute ( c) ) ,
1076
+ ) )
1065
1077
}
1066
1078
/// Bitwise Select. (128-bit)
1067
1079
#[ inline]
1068
1080
#[ target_feature( enable = "neon" ) ]
1069
1081
#[ cfg_attr( test, assert_instr( bsl) ) ]
1070
1082
#[ stable( feature = "neon_intrinsics" , since = "1.59.0" ) ]
1071
1083
pub unsafe fn vbslq_p64 ( a : poly64x2_t , b : poly64x2_t , c : poly64x2_t ) -> poly64x2_t {
1072
- simd_select ( transmute :: < _ , int64x2_t > ( a) , b, c)
1084
+ let not = int64x2_t ( -1 , -1 ) ;
1085
+ transmute ( simd_or (
1086
+ simd_and ( a, transmute ( b) ) ,
1087
+ simd_and ( simd_xor ( a, transmute ( not) ) , transmute ( c) ) ,
1088
+ ) )
1073
1089
}
1074
1090
1075
1091
/// Signed saturating Accumulate of Unsigned value.
@@ -5136,37 +5152,37 @@ mod tests {
5136
5152
5137
5153
#[ simd_test( enable = "neon" ) ]
5138
5154
unsafe fn test_vbsl_f64 ( ) {
5139
- let a = u64x1:: new ( u64 :: MAX ) ;
5140
- let b = f64x1:: new ( f64 :: MAX ) ;
5141
- let c = f64x1:: new ( f64 :: MIN ) ;
5142
- let e = f64x1:: new ( f64 :: MAX ) ;
5155
+ let a = u64x1:: new ( 0x8000000000000000 ) ;
5156
+ let b = f64x1:: new ( - 1.23f64 ) ;
5157
+ let c = f64x1:: new ( 2.34f64 ) ;
5158
+ let e = f64x1:: new ( - 2.34f64 ) ;
5143
5159
let r: f64x1 = transmute ( vbsl_f64 ( transmute ( a) , transmute ( b) , transmute ( c) ) ) ;
5144
5160
assert_eq ! ( r, e) ;
5145
5161
}
5146
5162
#[ simd_test( enable = "neon" ) ]
5147
5163
unsafe fn test_vbsl_p64 ( ) {
5148
- let a = u64x1:: new ( u64 :: MAX ) ;
5164
+ let a = u64x1:: new ( 1 ) ;
5149
5165
let b = u64x1:: new ( u64:: MAX ) ;
5150
5166
let c = u64x1:: new ( u64:: MIN ) ;
5151
- let e = u64x1:: new ( u64 :: MAX ) ;
5167
+ let e = u64x1:: new ( 1 ) ;
5152
5168
let r: u64x1 = transmute ( vbsl_p64 ( transmute ( a) , transmute ( b) , transmute ( c) ) ) ;
5153
5169
assert_eq ! ( r, e) ;
5154
5170
}
5155
5171
#[ simd_test( enable = "neon" ) ]
5156
5172
unsafe fn test_vbslq_f64 ( ) {
5157
- let a = u64x2:: new ( u64 :: MAX , 0 ) ;
5158
- let b = f64x2:: new ( f64:: MAX , f64 :: MAX ) ;
5159
- let c = f64x2:: new ( f64:: MIN , f64 :: MIN ) ;
5160
- let e = f64x2:: new ( f64:: MAX , f64 :: MIN ) ;
5173
+ let a = u64x2:: new ( 1 , 0x8000000000000000 ) ;
5174
+ let b = f64x2:: new ( f64:: MAX , - 1.23f64 ) ;
5175
+ let c = f64x2:: new ( f64:: MIN , 2.34f64 ) ;
5176
+ let e = f64x2:: new ( f64:: MIN , - 2.34f64 ) ;
5161
5177
let r: f64x2 = transmute ( vbslq_f64 ( transmute ( a) , transmute ( b) , transmute ( c) ) ) ;
5162
5178
assert_eq ! ( r, e) ;
5163
5179
}
5164
5180
#[ simd_test( enable = "neon" ) ]
5165
5181
unsafe fn test_vbslq_p64 ( ) {
5166
- let a = u64x2:: new ( u64:: MAX , 0 ) ;
5182
+ let a = u64x2:: new ( u64:: MAX , 1 ) ;
5167
5183
let b = u64x2:: new ( u64:: MAX , u64:: MAX ) ;
5168
5184
let c = u64x2:: new ( u64:: MIN , u64:: MIN ) ;
5169
- let e = u64x2:: new ( u64:: MAX , u64 :: MIN ) ;
5185
+ let e = u64x2:: new ( u64:: MAX , 1 ) ;
5170
5186
let r: u64x2 = transmute ( vbslq_p64 ( transmute ( a) , transmute ( b) , transmute ( c) ) ) ;
5171
5187
assert_eq ! ( r, e) ;
5172
5188
}
0 commit comments