Add vec_orc

This commit is contained in:
Luca Barbato 2024-05-06 11:59:18 +00:00 committed by Amanieu d'Antras
parent f91e5fd6b2
commit 0a5325a16c

View file

@ -1295,6 +1295,24 @@ mod sealed {
impl_vec_trait! { [VectorAndc vec_andc]+ 2b (andc) }
#[inline]
#[target_feature(enable = "altivec")]
#[cfg_attr(all(test, not(target_feature = "vsx")), assert_instr(vorc))]
#[cfg_attr(all(test, target_feature = "vsx"), assert_instr(xxlorc))]
unsafe fn orc(a: vector_signed_char, b: vector_signed_char) -> vector_signed_char {
let a = transmute(a);
let b = transmute(b);
transmute(simd_or(simd_xor(u8x16::splat(0xff), b), a))
}
#[unstable(feature = "stdarch_powerpc", issue = "111145")]
pub trait VectorOrc<Other> {
type Result;
unsafe fn vec_orc(self, b: Other) -> Self::Result;
}
impl_vec_trait! { [VectorOrc vec_orc]+ 2b (orc) }
test_impl! { vec_vand(a: vector_signed_char, b: vector_signed_char) -> vector_signed_char [ simd_and, vand / xxland ] }
#[unstable(feature = "stdarch_powerpc", issue = "111145")]
@ -3703,6 +3721,23 @@ where
a.vec_andc(b)
}
/// Vector OR with Complement
///
/// ## Purpose
/// Performs a bitwise OR of the first vector with the bitwise-complemented second vector.
///
/// ## Result value
/// r is the bitwise OR of a and the bitwise complement of b.
#[inline]
#[target_feature(enable = "altivec")]
#[unstable(feature = "stdarch_powerpc", issue = "111145")]
pub unsafe fn vec_orc<T, U>(a: T, b: U) -> <T as sealed::VectorOrc<U>>::Result
where
T: sealed::VectorOrc<U>,
{
a.vec_orc(b)
}
/// Vector and.
#[inline]
#[target_feature(enable = "altivec")]