Skip to content

Commit 87b1178

Browse files
lu-zeroAmanieu
authored andcommitted
Add vec_sll
1 parent f024407 commit 87b1178

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

crates/core_arch/src/powerpc/altivec.rs

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,9 @@ extern "C" {
335335

336336
#[link_name = "llvm.ppc.altivec.vlogefp"]
337337
fn vlogefp(a: vector_float) -> vector_float;
338+
339+
#[link_name = "llvm.ppc.altivec.sll"]
340+
fn vsl(a: vector_signed_int, b: vector_signed_int) -> vector_signed_int;
338341
}
339342

340343
macro_rules! s_t_l {
@@ -2822,6 +2825,25 @@ mod sealed {
28222825
impl_vec_sld! { vector_bool_short, vector_signed_short, vector_unsigned_short }
28232826
impl_vec_sld! { vector_bool_int, vector_signed_int, vector_unsigned_int }
28242827
impl_vec_sld! { vector_float }
2828+
2829+
macro_rules! impl_vec_sll {
2830+
([$Trait:ident $m:ident] ($f:ident)) => {
2831+
impl_vec_trait!{ [$Trait $m]+ $f (vector_unsigned_char, vector_unsigned_char) -> vector_unsigned_char }
2832+
impl_vec_trait!{ [$Trait $m]+ $f (vector_signed_char, vector_unsigned_char) -> vector_signed_char }
2833+
impl_vec_trait!{ [$Trait $m]+ $f (vector_unsigned_short, vector_unsigned_char) -> vector_unsigned_short }
2834+
impl_vec_trait!{ [$Trait $m]+ $f (vector_signed_short, vector_unsigned_char) -> vector_signed_short }
2835+
impl_vec_trait!{ [$Trait $m]+ $f (vector_unsigned_int, vector_unsigned_char) -> vector_unsigned_int }
2836+
impl_vec_trait!{ [$Trait $m]+ $f (vector_signed_int, vector_unsigned_char) -> vector_signed_int }
2837+
};
2838+
}
2839+
2840+
#[unstable(feature = "stdarch_powerpc", issue = "111145")]
2841+
pub trait VectorSll<Other> {
2842+
type Result;
2843+
unsafe fn vec_sll(self, b: Other) -> Self::Result;
2844+
}
2845+
2846+
impl_vec_sll! { [VectorSll vec_sll] (vsl) }
28252847
}
28262848

28272849
/// Vector Merge Low
@@ -2954,6 +2976,21 @@ where
29542976
a.vec_sldw::<UIMM2>(b)
29552977
}
29562978

2979+
/// Vector Shift Left Long
2980+
///
2981+
/// ## Endian considerations
2982+
/// This intrinsic is not endian-neutral, so uses of vec_sll in big-endian
2983+
/// code must be rewritten for little-endian targets.
2984+
#[inline]
2985+
#[target_feature(enable = "altivec")]
2986+
#[unstable(feature = "stdarch_powerpc", issue = "111145")]
2987+
pub unsafe fn vec_sll<T, U>(a: T, b: U) -> <T as sealed::VectorSll<U>>::Result
2988+
where
2989+
T: sealed::VectorSll<U>,
2990+
{
2991+
a.vec_sll(b)
2992+
}
2993+
29572994
/// Vector Load Indexed.
29582995
#[inline]
29592996
#[target_feature(enable = "altivec")]

0 commit comments

Comments
 (0)