Simplify vec_andc implementation
This commit is contained in:
parent
509d5efe2b
commit
f91e5fd6b2
2 changed files with 5 additions and 26 deletions
|
|
@ -1293,31 +1293,7 @@ mod sealed {
|
|||
unsafe fn vec_andc(self, b: Other) -> Self::Result;
|
||||
}
|
||||
|
||||
macro_rules! impl_vec_andc {
|
||||
(($a:ty, $b:ty) -> $r:ty) => {
|
||||
#[unstable(feature = "stdarch_powerpc", issue = "111145")]
|
||||
impl VectorAndc<$b> for $a {
|
||||
type Result = $r;
|
||||
#[inline]
|
||||
#[target_feature(enable = "altivec")]
|
||||
unsafe fn vec_andc(self, b: $b) -> Self::Result {
|
||||
transmute(andc(transmute(self), transmute(b)))
|
||||
}
|
||||
}
|
||||
};
|
||||
(($a:ty, ~$b:ty) -> $r:ty) => {
|
||||
impl_vec_andc! { ($a, $a) -> $r }
|
||||
impl_vec_andc! { ($a, $b) -> $r }
|
||||
impl_vec_andc! { ($b, $a) -> $r }
|
||||
};
|
||||
}
|
||||
|
||||
impl_vec_andc! { (vector_unsigned_char, ~vector_bool_char) -> vector_unsigned_char }
|
||||
impl_vec_andc! { (vector_signed_char, ~vector_bool_char) -> vector_signed_char }
|
||||
impl_vec_andc! { (vector_unsigned_short, ~vector_bool_short) -> vector_unsigned_short }
|
||||
impl_vec_andc! { (vector_signed_short, ~vector_bool_short) -> vector_signed_short }
|
||||
impl_vec_andc! { (vector_unsigned_int, ~vector_bool_int) -> vector_unsigned_int }
|
||||
impl_vec_andc! { (vector_signed_int, ~vector_bool_int) -> vector_signed_int }
|
||||
impl_vec_trait! { [VectorAndc vec_andc]+ 2b (andc) }
|
||||
|
||||
test_impl! { vec_vand(a: vector_signed_char, b: vector_signed_char) -> vector_signed_char [ simd_and, vand / xxland ] }
|
||||
|
||||
|
|
|
|||
|
|
@ -124,7 +124,10 @@ macro_rules! impl_vec_trait {
|
|||
impl_vec_trait!{ [$Trait $m]+ $w (vector_bool_int, vector_bool_int) -> vector_bool_int }
|
||||
impl_vec_trait!{ [$Trait $m]+ $w (vector_unsigned_int, vector_unsigned_int) -> vector_unsigned_int }
|
||||
impl_vec_trait!{ [$Trait $m]+ $w (vector_signed_int, vector_signed_int) -> vector_signed_int }
|
||||
}
|
||||
};
|
||||
([$Trait:ident $m:ident]+ 2b ($fn:ident)) => {
|
||||
impl_vec_trait!{ [$Trait $m]+ 2b ($fn, $fn, $fn) }
|
||||
};
|
||||
}
|
||||
|
||||
macro_rules! s_t_l {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue