@@ -209,6 +209,9 @@ extern "C" {
209
209
210
210
#[ link_name = "llvm.ceil.v4f32" ]
211
211
fn vceil ( a : vector_float ) -> vector_float ;
212
+
213
+ #[ link_name = "llvm.ppc.altivec.vcmpbfp" ]
214
+ fn vcmpbfp ( a : vector_float , b : vector_float ) -> vector_signed_int ;
212
215
}
213
216
214
217
macro_rules! s_t_l {
@@ -365,6 +368,8 @@ mod sealed {
365
368
}
366
369
}
367
370
371
+ test_impl ! { vec_vcmpbfp( a: vector_float, b: vector_float) -> vector_signed_int [ vcmpbfp, vcmpbfp] }
372
+
368
373
test_impl ! { vec_vceil( a: vector_float) -> vector_float [ vceil, vrfip / xvrspip ] }
369
374
370
375
test_impl ! { vec_vavgsb( a: vector_signed_char, b: vector_signed_char) -> vector_signed_char [ vavgsb, vavgsb ] }
@@ -1284,7 +1289,14 @@ mod sealed {
1284
1289
vector_mladd ! { vector_signed_short, vector_signed_short, vector_signed_short }
1285
1290
}
1286
1291
1287
- /// Vector ceil.
1292
+ /// Vector cmpb.
1293
+ #[ inline]
1294
+ #[ target_feature( enable = "altivec" ) ]
1295
+ pub unsafe fn vec_cmpb ( a : vector_float , b : vector_float ) -> vector_signed_int {
1296
+ sealed:: vec_vcmpbfp ( a, b)
1297
+ }
1298
+
1299
+ /// Vector cmpb.
1288
1300
#[ inline]
1289
1301
#[ target_feature( enable = "altivec" ) ]
1290
1302
pub unsafe fn vec_ceil ( a : vector_float ) -> vector_float {
@@ -1625,6 +1637,20 @@ mod tests {
1625
1637
}
1626
1638
}
1627
1639
1640
+ #[ simd_test( enable = "altivec" ) ]
1641
+ unsafe fn test_vec_cmpb ( ) {
1642
+ let a: vector_float = transmute ( f32x4:: new ( 0.1 , 0.5 , 0.6 , 0.9 ) ) ;
1643
+ let b: vector_float = transmute ( f32x4:: new ( -0.1 , 0.5 , -0.6 , 0.9 ) ) ;
1644
+ let d = i32x4:: new (
1645
+ -0b10000000000000000000000000000000 ,
1646
+ 0 ,
1647
+ -0b10000000000000000000000000000000 ,
1648
+ 0 ,
1649
+ ) ;
1650
+
1651
+ assert_eq ! ( d, transmute( vec_cmpb( a, b) ) ) ;
1652
+ }
1653
+
1628
1654
#[ simd_test( enable = "altivec" ) ]
1629
1655
unsafe fn test_vec_ceil ( ) {
1630
1656
let a: vector_float = transmute ( f32x4:: new ( 0.1 , 0.5 , 0.6 , 0.9 ) ) ;
0 commit comments