@@ -331,9 +331,21 @@ mod sealed {
331
331
impl_vec_trait!{ [ $Trait $m] $sh ( vector_signed_short, ~vector_bool_short) -> vector_signed_short }
332
332
impl_vec_trait!{ [ $Trait $m] $uw ( vector_unsigned_int, ~vector_bool_int) -> vector_unsigned_int }
333
333
impl_vec_trait!{ [ $Trait $m] $sw ( vector_signed_int, ~vector_bool_int) -> vector_signed_int }
334
+ } ;
335
+ ( [ $Trait: ident $m: ident] ~( $fn: ident) ) => {
336
+ impl_vec_trait!{ [ $Trait $m] ~( $fn, $fn, $fn, $fn, $fn, $fn) }
334
337
}
335
338
}
336
339
340
+ test_impl ! { vec_vand( a: vector_signed_char, b: vector_signed_char) -> vector_signed_char [ simd_and, vand / xxland ] }
341
+
342
+ pub trait VectorAnd < Other > {
343
+ type Result ;
344
+ unsafe fn vec_and ( self , b : Other ) -> Self :: Result ;
345
+ }
346
+
347
+ impl_vec_trait ! { [ VectorAnd vec_and] ~( simd_and) }
348
+
337
349
test_impl ! { vec_vaddsbs( a: vector_signed_char, b: vector_signed_char) -> vector_signed_char [ vaddsbs, vaddsbs ] }
338
350
test_impl ! { vec_vaddshs( a: vector_signed_short, b: vector_signed_short) -> vector_signed_short [ vaddshs, vaddshs ] }
339
351
test_impl ! { vec_vaddsws( a: vector_signed_int, b: vector_signed_int) -> vector_signed_int [ vaddsws, vaddsws ] }
@@ -1190,6 +1202,16 @@ mod sealed {
1190
1202
vector_mladd ! { vector_signed_short, vector_signed_short, vector_signed_short }
1191
1203
}
1192
1204
1205
+ /// Vector and.
1206
+ #[ inline]
1207
+ #[ target_feature( enable = "altivec" ) ]
1208
+ pub unsafe fn vec_and < T , U > ( a : T , b : U ) -> <T as sealed:: VectorAnd < U > >:: Result
1209
+ where
1210
+ T : sealed:: VectorAnd < U > ,
1211
+ {
1212
+ a. vec_and ( b)
1213
+ }
1214
+
1193
1215
/// Vector adds.
1194
1216
#[ inline]
1195
1217
#[ target_feature( enable = "altivec" ) ]
@@ -1494,6 +1516,11 @@ mod tests {
1494
1516
}
1495
1517
}
1496
1518
1519
+ test_vec_2 ! { test_vec_and, vec_and, i32x4,
1520
+ [ 0b11001100 , 0b11001100 , 0b11001100 , 0b11001100 ] ,
1521
+ [ 0b00110011 , 0b11110011 , 0b00001100 , 0b00000000 ] ,
1522
+ [ 0b00000000 , 0b11000000 , 0b00001100 , 0b00000000 ] }
1523
+
1497
1524
macro_rules! test_vec_adds {
1498
1525
{ $name: ident, $ty: ident, [ $( $a: expr) ,+] , [ $( $b: expr) ,+] , [ $( $d: expr) ,+] } => {
1499
1526
test_vec_2! { $name, vec_adds, $ty, [ $( $a) ,+] , [ $( $b) ,+] , [ $( $d) ,+] }
0 commit comments