@@ -391,6 +391,9 @@ extern "C" {
391391 fn vrlh ( a : vector_signed_short , b : vector_unsigned_short ) -> vector_signed_short ;
392392 #[ link_name = "llvm.ppc.altivec.vrlw" ]
393393 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 ;
394397}
395398
396399macro_rules! s_t_l {
@@ -3185,6 +3188,22 @@ mod sealed {
31853188 impl_vec_rl ! { vec_vrlb( vector_unsigned_char) }
31863189 impl_vec_rl ! { vec_vrlh( vector_unsigned_short) }
31873190 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+ }
31883207}
31893208
31903209/// Vector Merge Low
@@ -3792,6 +3811,27 @@ where
37923811 a. vec_rl ( b)
37933812}
37943813
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+
37953835/// Vector Splat
37963836#[ inline]
37973837#[ target_feature( enable = "altivec" ) ]
0 commit comments