@@ -360,12 +360,24 @@ unsafe extern "C" {
360
360
#[ link_name = "llvm.ppc.altivec.srv" ]
361
361
fn vsrv ( a : vector_unsigned_char , b : vector_unsigned_char ) -> vector_unsigned_char ;
362
362
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 ;
369
381
370
382
#[ link_name = "llvm.nearbyint.v4f32" ]
371
383
fn vrfin ( a : vector_float ) -> vector_float ;
@@ -3180,6 +3192,21 @@ mod sealed {
3180
3192
impl_vec_cntlz ! { vec_vcntlzw( vector_signed_int) }
3181
3193
impl_vec_cntlz ! { vec_vcntlzw( vector_unsigned_int) }
3182
3194
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
+
3183
3210
#[ unstable( feature = "stdarch_powerpc" , issue = "111145" ) ]
3184
3211
pub trait VectorRl {
3185
3212
type Shift ;
@@ -3200,16 +3227,12 @@ mod sealed {
3200
3227
} ;
3201
3228
}
3202
3229
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) }
3213
3236
3214
3237
#[ unstable( feature = "stdarch_powerpc" , issue = "111145" ) ]
3215
3238
pub trait VectorRound {
@@ -6660,4 +6683,10 @@ mod tests {
6660
6683
assert_eq ! ( v4, v) ;
6661
6684
assert_eq ! ( v8, v) ;
6662
6685
}
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
+ }
6663
6692
}
0 commit comments