Skip to content

Commit dee4c16

Browse files
lu-zeroAmanieu
authored andcommitted
Add vec_orc
1 parent 72a8921 commit dee4c16

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

crates/core_arch/src/powerpc/altivec.rs

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1295,6 +1295,24 @@ mod sealed {
12951295

12961296
impl_vec_trait! { [VectorAndc vec_andc]+ 2b (andc) }
12971297

1298+
#[inline]
1299+
#[target_feature(enable = "altivec")]
1300+
#[cfg_attr(all(test, not(target_feature = "vsx")), assert_instr(vorc))]
1301+
#[cfg_attr(all(test, target_feature = "vsx"), assert_instr(xxlorc))]
1302+
unsafe fn orc(a: vector_signed_char, b: vector_signed_char) -> vector_signed_char {
1303+
let a = transmute(a);
1304+
let b = transmute(b);
1305+
transmute(simd_or(simd_xor(u8x16::splat(0xff), b), a))
1306+
}
1307+
1308+
#[unstable(feature = "stdarch_powerpc", issue = "111145")]
1309+
pub trait VectorOrc<Other> {
1310+
type Result;
1311+
unsafe fn vec_orc(self, b: Other) -> Self::Result;
1312+
}
1313+
1314+
impl_vec_trait! { [VectorOrc vec_orc]+ 2b (orc) }
1315+
12981316
test_impl! { vec_vand(a: vector_signed_char, b: vector_signed_char) -> vector_signed_char [ simd_and, vand / xxland ] }
12991317

13001318
#[unstable(feature = "stdarch_powerpc", issue = "111145")]
@@ -3703,6 +3721,23 @@ where
37033721
a.vec_andc(b)
37043722
}
37053723

3724+
/// Vector OR with Complement
3725+
///
3726+
/// ## Purpose
3727+
/// Performs a bitwise OR of the first vector with the bitwise-complemented second vector.
3728+
///
3729+
/// ## Result value
3730+
/// r is the bitwise OR of a and the bitwise complement of b.
3731+
#[inline]
3732+
#[target_feature(enable = "altivec")]
3733+
#[unstable(feature = "stdarch_powerpc", issue = "111145")]
3734+
pub unsafe fn vec_orc<T, U>(a: T, b: U) -> <T as sealed::VectorOrc<U>>::Result
3735+
where
3736+
T: sealed::VectorOrc<U>,
3737+
{
3738+
a.vec_orc(b)
3739+
}
3740+
37063741
/// Vector and.
37073742
#[inline]
37083743
#[target_feature(enable = "altivec")]

0 commit comments

Comments
 (0)