@@ -206,6 +206,9 @@ extern "C" {
206
206
fn vavguh ( a : vector_unsigned_short , b : vector_unsigned_short ) -> vector_unsigned_short ;
207
207
#[ link_name = "llvm.ppc.altivec.vavguw" ]
208
208
fn vavguw ( a : vector_unsigned_int , b : vector_unsigned_int ) -> vector_unsigned_int ;
209
+
210
+ #[ link_name = "llvm.ceil.v4f32" ]
211
+ fn vceil ( a : vector_float ) -> vector_float ;
209
212
}
210
213
211
214
macro_rules! s_t_l {
@@ -287,7 +290,7 @@ mod sealed {
287
290
#[ target_feature( enable = "altivec" ) ]
288
291
#[ cfg_attr( all( test, not( target_feature="vsx" ) ) , assert_instr( $instr_altivec) ) ]
289
292
#[ cfg_attr( all( test, target_feature="vsx" ) , assert_instr( $instr_vsx) ) ]
290
- unsafe fn $fun ( $( $v : $ty) ,* ) -> $r {
293
+ pub unsafe fn $fun ( $( $v : $ty) ,* ) -> $r {
291
294
$call ( $( $v) ,* )
292
295
}
293
296
}
@@ -362,6 +365,8 @@ mod sealed {
362
365
}
363
366
}
364
367
368
+ test_impl ! { vec_vceil( a: vector_float) -> vector_float [ vceil, vrfip / xvrspip ] }
369
+
365
370
test_impl ! { vec_vavgsb( a: vector_signed_char, b: vector_signed_char) -> vector_signed_char [ vavgsb, vavgsb ] }
366
371
test_impl ! { vec_vavgsh( a: vector_signed_short, b: vector_signed_short) -> vector_signed_short [ vavgsh, vavgsh ] }
367
372
test_impl ! { vec_vavgsw( a: vector_signed_int, b: vector_signed_int) -> vector_signed_int [ vavgsw, vavgsw ] }
@@ -1279,6 +1284,13 @@ mod sealed {
1279
1284
vector_mladd ! { vector_signed_short, vector_signed_short, vector_signed_short }
1280
1285
}
1281
1286
1287
+ /// Vector ceil.
1288
+ #[ inline]
1289
+ #[ target_feature( enable = "altivec" ) ]
1290
+ pub unsafe fn vec_ceil ( a : vector_float ) -> vector_float {
1291
+ sealed:: vec_vceil ( a)
1292
+ }
1293
+
1282
1294
/// Vector avg.
1283
1295
#[ inline]
1284
1296
#[ target_feature( enable = "altivec" ) ]
@@ -1613,6 +1625,14 @@ mod tests {
1613
1625
}
1614
1626
}
1615
1627
1628
+ #[ simd_test( enable = "altivec" ) ]
1629
+ unsafe fn test_vec_ceil ( ) {
1630
+ let a: vector_float = transmute ( f32x4:: new ( 0.1 , 0.5 , 0.6 , 0.9 ) ) ;
1631
+ let d = f32x4:: new ( 1.0 , 1.0 , 1.0 , 1.0 ) ;
1632
+
1633
+ assert_eq ! ( d, transmute( vec_ceil( a) ) ) ;
1634
+ }
1635
+
1616
1636
test_vec_2 ! { test_vec_andc, vec_andc, i32x4,
1617
1637
[ 0b11001100 , 0b11001100 , 0b11001100 , 0b11001100 ] ,
1618
1638
[ 0b00110011 , 0b11110011 , 0b00001100 , 0b10000000 ] ,
0 commit comments