Skip to content

Commit 5b58bae

Browse files
lu-zeroAmanieu
authored andcommitted
Add vec_sra
1 parent f5a65e7 commit 5b58bae

File tree

1 file changed

+26
-0
lines changed
  • library/stdarch/crates/core_arch/src/powerpc

1 file changed

+26
-0
lines changed

library/stdarch/crates/core_arch/src/powerpc/altivec.rs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,13 @@ extern "C" {
340340
fn vsl(a: vector_signed_int, b: vector_signed_int) -> vector_signed_int;
341341
#[link_name = "llvm.ppc.altivec.slo"]
342342
fn vslo(a: vector_signed_int, b: vector_signed_int) -> vector_signed_int;
343+
344+
#[link_name = "llvm.ppc.altivec.srab"]
345+
fn vsrab(a: vector_signed_char, b: vector_unsigned_char) -> vector_signed_char;
346+
#[link_name = "llvm.ppc.altivec.srah"]
347+
fn vsrah(a: vector_signed_short, b: vector_unsigned_short) -> vector_signed_short;
348+
#[link_name = "llvm.ppc.altivec.sraw"]
349+
fn vsraw(a: vector_signed_int, b: vector_unsigned_int) -> vector_signed_int;
343350
}
344351

345352
macro_rules! s_t_l {
@@ -2704,6 +2711,14 @@ mod sealed {
27042711

27052712
impl_vec_shift! { [VectorSr vec_sr] (vsrb, vsrh, vsrw) }
27062713

2714+
#[unstable(feature = "stdarch_powerpc", issue = "111145")]
2715+
pub trait VectorSra<Other> {
2716+
type Result;
2717+
unsafe fn vec_sra(self, b: Other) -> Self::Result;
2718+
}
2719+
2720+
impl_vec_shift! { [VectorSra vec_sra] (vsrab, vsrah, vsraw) }
2721+
27072722
#[unstable(feature = "stdarch_powerpc", issue = "111145")]
27082723
pub trait VectorSld {
27092724
unsafe fn vec_sld<const UIMM4: i32>(self, b: Self) -> Self;
@@ -2986,6 +3001,17 @@ where
29863001
a.vec_sr(b)
29873002
}
29883003

3004+
/// Vector Shift Right Algebraic
3005+
#[inline]
3006+
#[target_feature(enable = "altivec")]
3007+
#[unstable(feature = "stdarch_powerpc", issue = "111145")]
3008+
pub unsafe fn vec_sra<T, U>(a: T, b: U) -> <T as sealed::VectorSra<U>>::Result
3009+
where
3010+
T: sealed::VectorSra<U>,
3011+
{
3012+
a.vec_sra(b)
3013+
}
3014+
29893015
/// Vector Shift Left Double
29903016
///
29913017
/// ## Endian considerations

0 commit comments

Comments
 (0)