Skip to content

Commit 9c794a5

Browse files
lu-zeroAmanieu
authored andcommitted
Add vec_slv and vec_srv
1 parent e2959af commit 9c794a5

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

crates/core_arch/src/powerpc/altivec.rs

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,11 @@ extern "C" {
352352
fn vsr(a: vector_signed_int, b: vector_signed_int) -> vector_signed_int;
353353
#[link_name = "llvm.ppc.altivec.sro"]
354354
fn vsro(a: vector_signed_int, b: vector_signed_int) -> vector_signed_int;
355+
356+
#[link_name = "llvm.ppc.altivec.slv"]
357+
fn vslv(a: vector_unsigned_char, b: vector_unsigned_char) -> vector_unsigned_char;
358+
#[link_name = "llvm.ppc.altivec.srv"]
359+
fn vsrv(a: vector_unsigned_char, b: vector_unsigned_char) -> vector_unsigned_char;
355360
}
356361

357362
macro_rules! s_t_l {
@@ -3137,6 +3142,42 @@ where
31373142
a.vec_sro(b)
31383143
}
31393144

3145+
/// Vector Shift Left Variable
3146+
///
3147+
/// ## Result value
3148+
/// Let v be a 17-byte vector formed from a in bytes `[0:15]` and a zero byte in element 16.
3149+
/// Then each byte element i of r is determined as follows. The start bit sb is
3150+
/// obtained from bits 5:7 of byte element i of b. Then the contents of bits sb:sb+7 of the
3151+
/// halfword in byte elements i:i+1 of v are placed into byte element i of r.
3152+
///
3153+
/// ## Endian considerations
3154+
/// All bit and byte element numbers are specified in big-endian order. This intrinsic is not
3155+
/// endian-neutral.
3156+
#[inline]
3157+
#[target_feature(enable = "power9-altivec")]
3158+
#[unstable(feature = "stdarch_powerpc", issue = "111145")]
3159+
pub unsafe fn vec_slv(a: vector_unsigned_char, b: vector_unsigned_char) -> vector_unsigned_char {
3160+
vslv(a, b)
3161+
}
3162+
3163+
/// Vector Shift Right Variable
3164+
///
3165+
/// ## Result value
3166+
/// Let v be a 17-byte vector formed from a zero byte in element 0 and the elements of
3167+
/// a in bytes `[1:16]`. Then each byte element i of r is determined as follows. The start bit sb is
3168+
/// obtained from bits 5:7 of byte element i of b. Then the contents of bits (8 – sb):(15 – sb) of
3169+
/// the halfword in byte elements i:i+1 of v are placed into byte element i of r.
3170+
///
3171+
/// ## Endian considerations
3172+
/// All bit and byte element numbers are specified in big-endian order. This intrinsic is not
3173+
/// endian-neutral.
3174+
#[inline]
3175+
#[target_feature(enable = "power9-altivec")]
3176+
#[unstable(feature = "stdarch_powerpc", issue = "111145")]
3177+
pub unsafe fn vec_srv(a: vector_unsigned_char, b: vector_unsigned_char) -> vector_unsigned_char {
3178+
vsrv(a, b)
3179+
}
3180+
31403181
/// Vector Load Indexed.
31413182
#[inline]
31423183
#[target_feature(enable = "altivec")]

0 commit comments

Comments
 (0)