Skip to content

Commit 72a8921

Browse files
lu-zeroAmanieu
authored andcommitted
Simplify vec_andc implementation
1 parent 7463dc7 commit 72a8921

File tree

2 files changed

+5
-26
lines changed

2 files changed

+5
-26
lines changed

crates/core_arch/src/powerpc/altivec.rs

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1293,31 +1293,7 @@ mod sealed {
12931293
unsafe fn vec_andc(self, b: Other) -> Self::Result;
12941294
}
12951295

1296-
macro_rules! impl_vec_andc {
1297-
(($a:ty, $b:ty) -> $r:ty) => {
1298-
#[unstable(feature = "stdarch_powerpc", issue = "111145")]
1299-
impl VectorAndc<$b> for $a {
1300-
type Result = $r;
1301-
#[inline]
1302-
#[target_feature(enable = "altivec")]
1303-
unsafe fn vec_andc(self, b: $b) -> Self::Result {
1304-
transmute(andc(transmute(self), transmute(b)))
1305-
}
1306-
}
1307-
};
1308-
(($a:ty, ~$b:ty) -> $r:ty) => {
1309-
impl_vec_andc! { ($a, $a) -> $r }
1310-
impl_vec_andc! { ($a, $b) -> $r }
1311-
impl_vec_andc! { ($b, $a) -> $r }
1312-
};
1313-
}
1314-
1315-
impl_vec_andc! { (vector_unsigned_char, ~vector_bool_char) -> vector_unsigned_char }
1316-
impl_vec_andc! { (vector_signed_char, ~vector_bool_char) -> vector_signed_char }
1317-
impl_vec_andc! { (vector_unsigned_short, ~vector_bool_short) -> vector_unsigned_short }
1318-
impl_vec_andc! { (vector_signed_short, ~vector_bool_short) -> vector_signed_short }
1319-
impl_vec_andc! { (vector_unsigned_int, ~vector_bool_int) -> vector_unsigned_int }
1320-
impl_vec_andc! { (vector_signed_int, ~vector_bool_int) -> vector_signed_int }
1296+
impl_vec_trait! { [VectorAndc vec_andc]+ 2b (andc) }
13211297

13221298
test_impl! { vec_vand(a: vector_signed_char, b: vector_signed_char) -> vector_signed_char [ simd_and, vand / xxland ] }
13231299

crates/core_arch/src/powerpc/macros.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,10 @@ macro_rules! impl_vec_trait {
124124
impl_vec_trait!{ [$Trait $m]+ $w (vector_bool_int, vector_bool_int) -> vector_bool_int }
125125
impl_vec_trait!{ [$Trait $m]+ $w (vector_unsigned_int, vector_unsigned_int) -> vector_unsigned_int }
126126
impl_vec_trait!{ [$Trait $m]+ $w (vector_signed_int, vector_signed_int) -> vector_signed_int }
127-
}
127+
};
128+
([$Trait:ident $m:ident]+ 2b ($fn:ident)) => {
129+
impl_vec_trait!{ [$Trait $m]+ 2b ($fn, $fn, $fn) }
130+
};
128131
}
129132

130133
macro_rules! s_t_l {

0 commit comments

Comments
 (0)