Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New ARM intrinsic generator #1693

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,16 @@ resolver = "1"
members = [
"crates/*",
"examples"
"crates/stdarch-verify",
"crates/core_arch",
"crates/std_detect",
"crates/stdarch-gen-loongarch",
"crates/stdarch-gen2",
"crates/intrinsic-test",
"examples/"
Jamesbarford marked this conversation as resolved.
Show resolved Hide resolved
]
exclude = [
"crates/wasm-assert-instr-tests"
]

[profile.release]
Expand Down
38,112 changes: 15,891 additions & 22,221 deletions crates/core_arch/src/aarch64/neon/generated.rs

Large diffs are not rendered by default.

78,508 changes: 40,729 additions & 37,779 deletions crates/core_arch/src/arm_shared/neon/generated.rs

Large diffs are not rendered by default.

170 changes: 170 additions & 0 deletions crates/core_arch/src/arm_shared/neon/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,94 @@ use crate::{core_arch::simd::*, hint::unreachable_unchecked, intrinsics::simd::*
#[cfg(test)]
use stdarch_test::assert_instr;

#[unstable(feature = "stdarch_internal", issue = "none")]
Jamesbarford marked this conversation as resolved.
Show resolved Hide resolved
pub(crate) trait AsUnsigned {
type Unsigned: ?Sized;
unsafe fn as_unsigned(self) -> Self::Unsigned;
Jamesbarford marked this conversation as resolved.
Show resolved Hide resolved
}

#[unstable(feature = "stdarch_internal", issue = "none")]
pub(crate) trait AsSigned {
type Signed: ?Sized;
unsafe fn as_signed(self) -> Self::Signed;
}

macro_rules! impl_sign_conversions {
($(($signed:ty, $unsigned:ty))*) => ($(
#[cfg_attr(
not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
#[cfg_attr(
target_arch = "arm",
unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800")
)]
Jamesbarford marked this conversation as resolved.
Show resolved Hide resolved
impl AsUnsigned for $signed {
type Unsigned = $unsigned;

#[inline]
unsafe fn as_unsigned(self) -> $unsigned {
crate::mem::transmute(self)
}
}

#[cfg_attr(
not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
#[cfg_attr(
target_arch = "arm",
unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800")
)]
impl AsSigned for $unsigned {
type Signed = $signed;

#[inline]
unsafe fn as_signed(self) -> $signed {
crate::mem::transmute(self)
}
}
)*)
}

macro_rules! impl_sign_conversions_neon {
($(($signed:ty, $unsigned:ty))*) => ($(
#[cfg_attr(
not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
#[cfg_attr(
target_arch = "arm",
unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800")
)]
impl AsUnsigned for $signed {
type Unsigned = $unsigned;

#[inline]
unsafe fn as_unsigned(self) -> $unsigned {
crate::mem::transmute(self)
}
}

#[cfg_attr(
not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
#[cfg_attr(
target_arch = "arm",
unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800")
)]
impl AsSigned for $unsigned {
type Signed = $signed;

#[inline]
unsafe fn as_signed(self) -> $signed {
crate::mem::transmute(self)
}
}
)*)
}

pub(crate) type p8 = u8;
pub(crate) type p16 = u16;
pub(crate) type p64 = u64;
Expand Down Expand Up @@ -1033,6 +1121,88 @@ pub struct poly64x2x4_t(
pub poly64x2_t,
);

impl_sign_conversions! {
(i8, u8)
(i16, u16)
(i32, u32)
(i64, u64)
(*const i8, *const u8)
(*const i16, *const u16)
(*const i32, *const u32)
(*const i64, *const u64)
(*mut i8, *mut u8)
(*mut i16, *mut u16)
(*mut i32, *mut u32)
(*mut i64, *mut u64)
(int16x4_t, uint16x4_t)
(int16x8_t, uint16x8_t)
(int32x2_t, uint32x2_t)
(int32x4_t, uint32x4_t)
(int64x1_t, uint64x1_t)
(int64x2_t, uint64x2_t)
(int8x16_t, uint8x16_t)
(int8x8_t, uint8x8_t)
(uint16x4_t, int16x4_t)
(uint16x8_t, int16x8_t)
(uint32x2_t, int32x2_t)
(uint32x4_t, int32x4_t)
(uint64x1_t, int64x1_t)
(uint64x2_t, int64x2_t)
(uint8x16_t, int8x16_t)
(uint8x8_t, int8x8_t)
}

impl_sign_conversions_neon! {
(int16x4x2_t, uint16x4x2_t)
(int16x4x3_t, uint16x4x3_t)
(int16x4x4_t, uint16x4x4_t)
(int16x8x2_t, uint16x8x2_t)
(int16x8x3_t, uint16x8x3_t)
(int16x8x4_t, uint16x8x4_t)
(int32x2x2_t, uint32x2x2_t)
(int32x2x3_t, uint32x2x3_t)
(int32x2x4_t, uint32x2x4_t)
(int32x4x2_t, uint32x4x2_t)
(int32x4x3_t, uint32x4x3_t)
(int32x4x4_t, uint32x4x4_t)
(int64x1x2_t, uint64x1x2_t)
(int64x1x3_t, uint64x1x3_t)
(int64x1x4_t, uint64x1x4_t)
(int64x2x2_t, uint64x2x2_t)
(int64x2x3_t, uint64x2x3_t)
(int64x2x4_t, uint64x2x4_t)
(int8x16x2_t, uint8x16x2_t)
(int8x16x3_t, uint8x16x3_t)
(int8x16x4_t, uint8x16x4_t)
(int8x8x2_t, uint8x8x2_t)
(int8x8x3_t, uint8x8x3_t)
(int8x8x4_t, uint8x8x4_t)
(uint16x4x2_t, int16x4x2_t)
(uint16x4x3_t, int16x4x3_t)
(uint16x4x4_t, int16x4x4_t)
(uint16x8x2_t, int16x8x2_t)
(uint16x8x3_t, int16x8x3_t)
(uint16x8x4_t, int16x8x4_t)
(uint32x2x2_t, int32x2x2_t)
(uint32x2x3_t, int32x2x3_t)
(uint32x2x4_t, int32x2x4_t)
(uint32x4x2_t, int32x4x2_t)
(uint32x4x3_t, int32x4x3_t)
(uint32x4x4_t, int32x4x4_t)
(uint64x1x2_t, int64x1x2_t)
(uint64x1x3_t, int64x1x3_t)
(uint64x1x4_t, int64x1x4_t)
(uint64x2x2_t, int64x2x2_t)
(uint64x2x3_t, int64x2x3_t)
(uint64x2x4_t, int64x2x4_t)
(uint8x16x2_t, int8x16x2_t)
(uint8x16x3_t, int8x16x3_t)
(uint8x16x4_t, int8x16x4_t)
(uint8x8x2_t, int8x8x2_t)
(uint8x8x3_t, int8x8x3_t)
(uint8x8x4_t, int8x8x4_t)
}

#[allow(improper_ctypes)]
extern "unadjusted" {
// absolute value (64-bit)
Expand Down
9 changes: 0 additions & 9 deletions crates/stdarch-gen-arm/Cargo.toml

This file was deleted.

11 changes: 0 additions & 11 deletions crates/stdarch-gen-arm/README.md

This file was deleted.

Loading
Loading