@@ -360,12 +360,24 @@ unsafe extern "C" {
360360 #[ link_name = "llvm.ppc.altivec.srv" ]
361361 fn vsrv ( a : vector_unsigned_char , b : vector_unsigned_char ) -> vector_unsigned_char ;
362362
363- #[ link_name = "llvm.ppc.altivec.vrlb" ]
364- fn vrlb ( a : vector_signed_char , b : vector_unsigned_char ) -> vector_signed_char ;
365- #[ link_name = "llvm.ppc.altivec.vrlh" ]
366- fn vrlh ( a : vector_signed_short , b : vector_unsigned_short ) -> vector_signed_short ;
367- #[ link_name = "llvm.ppc.altivec.vrlw" ]
368- fn vrlw ( a : vector_signed_int , c : vector_unsigned_int ) -> vector_signed_int ;
363+ #[ link_name = "llvm.fshl.v16i8" ]
364+ fn fshlb (
365+ a : vector_unsigned_char ,
366+ b : vector_unsigned_char ,
367+ c : vector_unsigned_char ,
368+ ) -> vector_unsigned_char ;
369+ #[ link_name = "llvm.fshl.v8i16" ]
370+ fn fshlh (
371+ a : vector_unsigned_short ,
372+ b : vector_unsigned_short ,
373+ c : vector_unsigned_short ,
374+ ) -> vector_unsigned_short ;
375+ #[ link_name = "llvm.fshl.v4i32" ]
376+ fn fshlw (
377+ a : vector_unsigned_int ,
378+ b : vector_unsigned_int ,
379+ c : vector_unsigned_int ,
380+ ) -> vector_unsigned_int ;
369381
370382 #[ link_name = "llvm.nearbyint.v4f32" ]
371383 fn vrfin ( a : vector_float ) -> vector_float ;
@@ -3180,6 +3192,21 @@ mod sealed {
31803192 impl_vec_cntlz ! { vec_vcntlzw( vector_signed_int) }
31813193 impl_vec_cntlz ! { vec_vcntlzw( vector_unsigned_int) }
31823194
3195+ macro_rules! impl_vrl {
3196+ ( $fun: ident $intr: ident $ty: ident) => {
3197+ #[ inline]
3198+ #[ target_feature( enable = "altivec" ) ]
3199+ #[ cfg_attr( test, assert_instr( $fun) ) ]
3200+ unsafe fn $fun( a: t_t_l!( $ty) , b: t_t_l!( $ty) ) -> t_t_l!( $ty) {
3201+ transmute( $intr( transmute( a) , transmute( a) , transmute( b) ) )
3202+ }
3203+ } ;
3204+ }
3205+
3206+ impl_vrl ! { vrlb fshlb u8 }
3207+ impl_vrl ! { vrlh fshlh u16 }
3208+ impl_vrl ! { vrlw fshlw u32 }
3209+
31833210 #[ unstable( feature = "stdarch_powerpc" , issue = "111145" ) ]
31843211 pub trait VectorRl {
31853212 type Shift ;
@@ -3200,16 +3227,12 @@ mod sealed {
32003227 } ;
32013228 }
32023229
3203- test_impl ! { vec_vrlb( a: vector_signed_char, b: vector_unsigned_char) -> vector_signed_char [ vrlb, vrlb] }
3204- test_impl ! { vec_vrlh( a: vector_signed_short, b: vector_unsigned_short) -> vector_signed_short [ vrlh, vrlh] }
3205- test_impl ! { vec_vrlw( a: vector_signed_int, b: vector_unsigned_int) -> vector_signed_int [ vrlw, vrlw] }
3206-
3207- impl_vec_rl ! { vec_vrlb( vector_signed_char) }
3208- impl_vec_rl ! { vec_vrlh( vector_signed_short) }
3209- impl_vec_rl ! { vec_vrlw( vector_signed_int) }
3210- impl_vec_rl ! { vec_vrlb( vector_unsigned_char) }
3211- impl_vec_rl ! { vec_vrlh( vector_unsigned_short) }
3212- impl_vec_rl ! { vec_vrlw( vector_unsigned_int) }
3230+ impl_vec_rl ! { vrlb( vector_signed_char) }
3231+ impl_vec_rl ! { vrlh( vector_signed_short) }
3232+ impl_vec_rl ! { vrlw( vector_signed_int) }
3233+ impl_vec_rl ! { vrlb( vector_unsigned_char) }
3234+ impl_vec_rl ! { vrlh( vector_unsigned_short) }
3235+ impl_vec_rl ! { vrlw( vector_unsigned_int) }
32133236
32143237 #[ unstable( feature = "stdarch_powerpc" , issue = "111145" ) ]
32153238 pub trait VectorRound {
@@ -6660,4 +6683,10 @@ mod tests {
66606683 assert_eq ! ( v4, v) ;
66616684 assert_eq ! ( v8, v) ;
66626685 }
6686+
6687+ test_vec_2 ! { test_vec_rl, vec_rl, u32x4,
6688+ [ 0x12345678 , 0x9ABCDEF0 , 0x0F0F0F0F , 0x12345678 ] ,
6689+ [ 4 , 8 , 12 , 68 ] ,
6690+ [ 0x23456781 , 0xBCDEF09A , 0xF0F0F0F0 , 0x23456781 ]
6691+ }
66636692}
0 commit comments