Merge pull request #1992 from folkertdev/remove-impl-neg
remove `impl Neg` on s390x/powerpc vector types
This commit is contained in:
commit
0d802f5078
4 changed files with 91 additions and 42 deletions
|
|
@ -364,15 +364,46 @@ unsafe extern "C" {
|
|||
fn vrfin(a: vector_float) -> vector_float;
|
||||
}
|
||||
|
||||
impl_neg! { i8x16 : 0 }
|
||||
impl_neg! { i16x8 : 0 }
|
||||
impl_neg! { i32x4 : 0 }
|
||||
impl_neg! { f32x4 : 0f32 }
|
||||
|
||||
#[macro_use]
|
||||
mod sealed {
|
||||
use super::*;
|
||||
|
||||
#[unstable(feature = "stdarch_powerpc", issue = "111145")]
|
||||
pub trait VectorNeg {
|
||||
unsafe fn vec_neg(self) -> Self;
|
||||
}
|
||||
|
||||
macro_rules! impl_neg {
|
||||
($($v:ty)*) => {
|
||||
$(
|
||||
#[unstable(feature = "stdarch_powerpc", issue = "111145")]
|
||||
impl VectorNeg for $v {
|
||||
#[inline]
|
||||
#[target_feature(enable = "altivec")]
|
||||
unsafe fn vec_neg(self) -> Self {
|
||||
simd_neg(self)
|
||||
}
|
||||
}
|
||||
)*
|
||||
}
|
||||
}
|
||||
|
||||
impl_neg! {
|
||||
vector_signed_char
|
||||
vector_unsigned_char
|
||||
vector_bool_char
|
||||
|
||||
vector_signed_short
|
||||
vector_unsigned_short
|
||||
vector_bool_short
|
||||
|
||||
vector_signed_int
|
||||
vector_unsigned_int
|
||||
vector_bool_int
|
||||
|
||||
vector_float
|
||||
}
|
||||
|
||||
#[unstable(feature = "stdarch_powerpc", issue = "111145")]
|
||||
pub trait VectorInsert {
|
||||
type Scalar;
|
||||
|
|
@ -1378,7 +1409,7 @@ mod sealed {
|
|||
#[inline]
|
||||
#[target_feature(enable = "altivec")]
|
||||
unsafe fn $name(v: s_t_l!($ty)) -> s_t_l!($ty) {
|
||||
v.vec_max(-v)
|
||||
v.vec_max(simd_neg(v))
|
||||
}
|
||||
|
||||
impl_vec_trait! { [VectorAbs vec_abs] $name (s_t_l!($ty)) }
|
||||
|
|
@ -4030,6 +4061,14 @@ pub unsafe fn vec_mfvscr() -> vector_unsigned_short {
|
|||
mfvscr()
|
||||
}
|
||||
|
||||
/// Vector Negate
|
||||
#[inline]
|
||||
#[target_feature(enable = "altivec")]
|
||||
#[unstable(feature = "stdarch_powerpc", issue = "111145")]
|
||||
pub unsafe fn vec_neg<T: sealed::VectorNeg>(a: T) -> T {
|
||||
a.vec_neg()
|
||||
}
|
||||
|
||||
/// Vector add.
|
||||
#[inline]
|
||||
#[target_feature(enable = "altivec")]
|
||||
|
|
|
|||
|
|
@ -274,20 +274,6 @@ macro_rules! t_b {
|
|||
};
|
||||
}
|
||||
|
||||
macro_rules! impl_neg {
|
||||
($s: ident : $zero: expr) => {
|
||||
#[unstable(feature = "stdarch_powerpc", issue = "111145")]
|
||||
impl crate::ops::Neg for s_t_l!($s) {
|
||||
type Output = s_t_l!($s);
|
||||
#[inline]
|
||||
fn neg(self) -> Self::Output {
|
||||
unsafe { simd_neg(self) }
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
pub(crate) use impl_neg;
|
||||
pub(crate) use impl_vec_trait;
|
||||
pub(crate) use s_t_l;
|
||||
pub(crate) use t_b;
|
||||
|
|
|
|||
|
|
@ -431,20 +431,6 @@ macro_rules! t_b {
|
|||
};
|
||||
}
|
||||
|
||||
macro_rules! impl_neg {
|
||||
($s: ident : $zero: expr) => {
|
||||
#[unstable(feature = "stdarch_s390x", issue = "135681")]
|
||||
impl crate::ops::Neg for s_t_l!($s) {
|
||||
type Output = s_t_l!($s);
|
||||
#[inline]
|
||||
fn neg(self) -> Self::Output {
|
||||
unsafe { simd_neg(self) }
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
pub(crate) use impl_neg;
|
||||
pub(crate) use impl_vec_trait;
|
||||
pub(crate) use l_t_t;
|
||||
pub(crate) use s_t_l;
|
||||
|
|
|
|||
|
|
@ -283,13 +283,6 @@ unsafe extern "unadjusted" {
|
|||
#[link_name = "llvm.s390.vfenezfs"] fn vfenezfs(a: i32x4, b: i32x4) -> PackedTuple<i32x4, i32>;
|
||||
}
|
||||
|
||||
impl_neg! { i8x16 : 0 }
|
||||
impl_neg! { i16x8 : 0 }
|
||||
impl_neg! { i32x4 : 0 }
|
||||
impl_neg! { i64x2 : 0 }
|
||||
impl_neg! { f32x4 : 0f32 }
|
||||
impl_neg! { f64x2 : 0f64 }
|
||||
|
||||
#[repr(simd)]
|
||||
struct ShuffleMask<const N: usize>([u32; N]);
|
||||
|
||||
|
|
@ -437,6 +430,43 @@ enum FindImm {
|
|||
mod sealed {
|
||||
use super::*;
|
||||
|
||||
#[unstable(feature = "stdarch_s390x", issue = "135681")]
|
||||
pub trait VectorNeg {
|
||||
unsafe fn vec_neg(self) -> Self;
|
||||
}
|
||||
|
||||
macro_rules! impl_neg {
|
||||
($($v:ty)*) => {
|
||||
$(
|
||||
#[unstable(feature = "stdarch_s390x", issue = "135681")]
|
||||
impl VectorNeg for $v {
|
||||
#[inline]
|
||||
#[target_feature(enable = "vector")]
|
||||
unsafe fn vec_neg(self) -> Self {
|
||||
simd_neg(self)
|
||||
}
|
||||
}
|
||||
)*
|
||||
}
|
||||
}
|
||||
|
||||
impl_neg! {
|
||||
vector_signed_char
|
||||
vector_unsigned_char
|
||||
|
||||
vector_signed_short
|
||||
vector_unsigned_short
|
||||
|
||||
vector_signed_int
|
||||
vector_unsigned_int
|
||||
|
||||
vector_signed_long_long
|
||||
vector_unsigned_long_long
|
||||
|
||||
vector_float
|
||||
vector_double
|
||||
}
|
||||
|
||||
#[unstable(feature = "stdarch_s390x", issue = "135681")]
|
||||
pub trait VectorAdd<Other> {
|
||||
type Result;
|
||||
|
|
@ -759,7 +789,7 @@ mod sealed {
|
|||
#[inline]
|
||||
#[target_feature(enable = "vector")]
|
||||
unsafe fn $name(v: s_t_l!($ty)) -> s_t_l!($ty) {
|
||||
v.vec_max(-v)
|
||||
v.vec_max(simd_neg(v))
|
||||
}
|
||||
|
||||
impl_vec_trait! { [VectorAbs vec_abs] $name (s_t_l!($ty)) }
|
||||
|
|
@ -4053,6 +4083,14 @@ unsafe fn __lcbb<const BLOCK_BOUNDARY: u16>(ptr: *const u8) -> u32 {
|
|||
lcbb(ptr, const { validate_block_boundary(BLOCK_BOUNDARY) })
|
||||
}
|
||||
|
||||
/// Vector Negate
|
||||
#[inline]
|
||||
#[target_feature(enable = "vector")]
|
||||
#[unstable(feature = "stdarch_s390x", issue = "135681")]
|
||||
pub unsafe fn vec_neg<T: sealed::VectorNeg>(a: T) -> T {
|
||||
a.vec_neg()
|
||||
}
|
||||
|
||||
/// Vector Add
|
||||
#[inline]
|
||||
#[target_feature(enable = "vector")]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue