Skip to content

Commit c07eb4c

Browse files
lu-zeroAmanieu
authored andcommitted
Add vec_subc
1 parent d31aa6e commit c07eb4c

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

crates/core_arch/src/powerpc/altivec.rs

+34
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,9 @@ extern "C" {
213213
#[link_name = "llvm.ppc.altivec.vsubuws"]
214214
fn vsubuws(a: vector_unsigned_int, b: vector_unsigned_int) -> vector_unsigned_int;
215215

216+
#[link_name = "llvm.ppc.altivec.vsubcuw"]
217+
fn vsubcuw(a: vector_unsigned_int, b: vector_unsigned_int) -> vector_unsigned_int;
218+
216219
#[link_name = "llvm.ppc.altivec.vaddcuw"]
217220
fn vaddcuw(a: vector_unsigned_int, b: vector_unsigned_int) -> vector_unsigned_int;
218221

@@ -1686,6 +1689,17 @@ mod sealed {
16861689
impl_vec_trait! { [VectorSub vec_sub] ~(simd_sub, simd_sub, simd_sub, simd_sub, simd_sub, simd_sub) }
16871690
impl_vec_trait! { [VectorSub vec_sub] simd_sub(vector_float, vector_float) -> vector_float }
16881691

1692+
test_impl! { vec_vsubcuw (a: vector_unsigned_int, b: vector_unsigned_int) -> vector_unsigned_int [vsubcuw, vsubcuw] }
1693+
1694+
#[unstable(feature = "stdarch_powerpc", issue = "111145")]
1695+
pub trait VectorSubc<Other> {
1696+
type Result;
1697+
unsafe fn vec_subc(self, b: Other) -> Self::Result;
1698+
}
1699+
1700+
impl_vec_trait! {[VectorSubc vec_subc]+ vec_vsubcuw(vector_unsigned_int, vector_unsigned_int) -> vector_unsigned_int }
1701+
impl_vec_trait! {[VectorSubc vec_subc]+ vec_vsubcuw(vector_signed_int, vector_signed_int) -> vector_signed_int }
1702+
16891703
test_impl! { vec_vminsb (a: vector_signed_char, b: vector_signed_char) -> vector_signed_char [vminsb, vminsb] }
16901704
test_impl! { vec_vminsh (a: vector_signed_short, b: vector_signed_short) -> vector_signed_short [vminsh, vminsh] }
16911705
test_impl! { vec_vminsw (a: vector_signed_int, b: vector_signed_int) -> vector_signed_int [vminsw, vminsw] }
@@ -3872,6 +3886,26 @@ where
38723886
a.vec_sub(b)
38733887
}
38743888

3889+
/// Vector Subtract Carryout
3890+
///
3891+
/// ## Purpose
3892+
/// Returns a vector wherein each element contains the carry produced by subtracting the
3893+
/// corresponding elements of the two source vectors.
3894+
///
3895+
/// ## Result value
3896+
/// The value of each element of r is the complement of the carry produced by subtract- ing the
3897+
/// value of the corresponding element of b from the value of the corresponding element of a. The
3898+
/// value is 0 if a borrow occurred, or 1 if no borrow occurred.
3899+
#[inline]
3900+
#[target_feature(enable = "altivec")]
3901+
#[unstable(feature = "stdarch_powerpc", issue = "111145")]
3902+
pub unsafe fn vec_subc<T, U>(a: T, b: U) -> <T as sealed::VectorSubc<U>>::Result
3903+
where
3904+
T: sealed::VectorSubc<U>,
3905+
{
3906+
a.vec_subc(b)
3907+
}
3908+
38753909
/// Vector subs.
38763910
#[inline]
38773911
#[target_feature(enable = "altivec")]

0 commit comments

Comments
 (0)