@@ -391,6 +391,9 @@ extern "C" {
391
391
fn vrlh ( a : vector_signed_short , b : vector_unsigned_short ) -> vector_signed_short ;
392
392
#[ link_name = "llvm.ppc.altivec.vrlw" ]
393
393
fn vrlw ( a : vector_signed_int , c : vector_unsigned_int ) -> vector_signed_int ;
394
+
395
+ #[ link_name = "llvm.ppc.altivec.vrfin" ]
396
+ fn vrfin ( a : vector_float ) -> vector_float ;
394
397
}
395
398
396
399
macro_rules! s_t_l {
@@ -3185,6 +3188,22 @@ mod sealed {
3185
3188
impl_vec_rl ! { vec_vrlb( vector_unsigned_char) }
3186
3189
impl_vec_rl ! { vec_vrlh( vector_unsigned_short) }
3187
3190
impl_vec_rl ! { vec_vrlw( vector_unsigned_int) }
3191
+
3192
+ #[ unstable( feature = "stdarch_powerpc" , issue = "111145" ) ]
3193
+ pub trait VectorRound {
3194
+ unsafe fn vec_round ( self ) -> Self ;
3195
+ }
3196
+
3197
+ test_impl ! { vec_vrfin( a: vector_float) -> vector_float [ vrfin, vrfin] }
3198
+
3199
+ #[ unstable( feature = "stdarch_powerpc" , issue = "111145" ) ]
3200
+ impl VectorRound for vector_float {
3201
+ #[ inline]
3202
+ #[ target_feature( enable = "altivec" ) ]
3203
+ unsafe fn vec_round ( self ) -> Self {
3204
+ vec_vrfin ( self )
3205
+ }
3206
+ }
3188
3207
}
3189
3208
3190
3209
/// Vector Merge Low
@@ -3792,6 +3811,27 @@ where
3792
3811
a. vec_rl ( b)
3793
3812
}
3794
3813
3814
+ /// Vector Round
3815
+ ///
3816
+ /// ## Purpose
3817
+ /// Returns a vector containing the rounded values of the corresponding elements of the
3818
+ /// source vector.
3819
+ ///
3820
+ /// ## Result value
3821
+ /// Each element of r contains the value of the corresponding element of a, rounded
3822
+ /// to the nearest representable floating-point integer, using IEEE round-to-nearest
3823
+ /// rounding.
3824
+ /// The current floating-point rounding mode is ignored.
3825
+ #[ inline]
3826
+ #[ target_feature( enable = "altivec" ) ]
3827
+ #[ unstable( feature = "stdarch_powerpc" , issue = "111145" ) ]
3828
+ pub unsafe fn vec_round < T > ( a : T ) -> T
3829
+ where
3830
+ T : sealed:: VectorRound ,
3831
+ {
3832
+ a. vec_round ( )
3833
+ }
3834
+
3795
3835
/// Vector Splat
3796
3836
#[ inline]
3797
3837
#[ target_feature( enable = "altivec" ) ]
0 commit comments