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

move to array simd #1422

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all 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
178 changes: 89 additions & 89 deletions crates/core_arch/src/aarch64/neon/generated.rs

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions crates/core_arch/src/aarch64/neon/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ use stdarch_test::assert_instr;
types! {
/// ARM-specific 64-bit wide vector of one packed `f64`.
#[stable(feature = "neon_intrinsics", since = "1.59.0")]
pub struct float64x1_t(f64); // FIXME: check this!
pub struct float64x1_t([f64; 1]); // FIXME: check this!
/// ARM-specific 128-bit wide vector of two packed `f64`.
#[stable(feature = "neon_intrinsics", since = "1.59.0")]
pub struct float64x2_t(f64, f64);
pub struct float64x2_t([f64; 2]);
}

/// ARM-specific type containing two `float64x1_t` vectors.
Expand Down Expand Up @@ -1980,7 +1980,7 @@ pub unsafe fn vdup_n_p64(value: p64) -> poly64x1_t {
#[cfg_attr(test, assert_instr(nop))]
#[stable(feature = "neon_intrinsics", since = "1.59.0")]
pub unsafe fn vdup_n_f64(value: f64) -> float64x1_t {
float64x1_t(value)
float64x1_t([value])
}

/// Duplicate vector element to vector or scalar
Expand All @@ -1998,7 +1998,7 @@ pub unsafe fn vdupq_n_p64(value: p64) -> poly64x2_t {
#[cfg_attr(test, assert_instr(dup))]
#[stable(feature = "neon_intrinsics", since = "1.59.0")]
pub unsafe fn vdupq_n_f64(value: f64) -> float64x2_t {
float64x2_t(value, value)
float64x2_t([value, value])
}

/// Duplicate vector element to vector or scalar
Expand Down
4 changes: 2 additions & 2 deletions crates/core_arch/src/arm/dsp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ use crate::mem::transmute;

types! {
/// ARM-specific 32-bit wide vector of two packed `i16`.
pub struct int16x2_t(i16, i16);
pub struct int16x2_t([i16; 2]);
/// ARM-specific 32-bit wide vector of two packed `u16`.
pub struct uint16x2_t(u16, u16);
pub struct uint16x2_t([u16; 2]);
}

extern "unadjusted" {
Expand Down
4 changes: 2 additions & 2 deletions crates/core_arch/src/arm/simd32.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ use crate::{core_arch::arm::dsp::int16x2_t, mem::transmute};

types! {
/// ARM-specific 32-bit wide vector of four packed `i8`.
pub struct int8x4_t(i8, i8, i8, i8);
pub struct int8x4_t([i8; 4]);
/// ARM-specific 32-bit wide vector of four packed `u8`.
pub struct uint8x4_t(u8, u8, u8, u8);
pub struct uint8x4_t([u8; 4]);
}

macro_rules! dsp_call {
Expand Down
588 changes: 294 additions & 294 deletions crates/core_arch/src/arm_shared/neon/generated.rs

Large diffs are not rendered by default.

75 changes: 28 additions & 47 deletions crates/core_arch/src/arm_shared/neon/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,90 +19,81 @@ pub(crate) type p128 = u128;
types! {
/// ARM-specific 64-bit wide vector of eight packed `i8`.
#[cfg_attr(not(target_arch = "arm"), stable(feature = "neon_intrinsics", since = "1.59.0"))]
pub struct int8x8_t(pub(crate) i8, pub(crate) i8, pub(crate) i8, pub(crate) i8, pub(crate) i8, pub(crate) i8, pub(crate) i8, pub(crate) i8);
pub struct int8x8_t(pub(crate) [i8; 8]);
/// ARM-specific 64-bit wide vector of eight packed `u8`.
#[cfg_attr(not(target_arch = "arm"), stable(feature = "neon_intrinsics", since = "1.59.0"))]
pub struct uint8x8_t(pub(crate) u8, pub(crate) u8, pub(crate) u8, pub(crate) u8, pub(crate) u8, pub(crate) u8, pub(crate) u8, pub(crate) u8);
pub struct uint8x8_t(pub(crate) [u8; 8]);
/// ARM-specific 64-bit wide polynomial vector of eight packed `p8`.
#[cfg_attr(not(target_arch = "arm"), stable(feature = "neon_intrinsics", since = "1.59.0"))]
pub struct poly8x8_t(pub(crate) p8, pub(crate) p8, pub(crate) p8, pub(crate) p8, pub(crate) p8, pub(crate) p8, pub(crate) p8, pub(crate) p8);
pub struct poly8x8_t(pub(crate) [p8; 8]);
/// ARM-specific 64-bit wide vector of four packed `i16`.
#[cfg_attr(not(target_arch = "arm"), stable(feature = "neon_intrinsics", since = "1.59.0"))]
pub struct int16x4_t(pub(crate) i16, pub(crate) i16, pub(crate) i16, pub(crate) i16);
pub struct int16x4_t(pub(crate) [i16; 4]);
/// ARM-specific 64-bit wide vector of four packed `u16`.
#[cfg_attr(not(target_arch = "arm"), stable(feature = "neon_intrinsics", since = "1.59.0"))]
pub struct uint16x4_t(pub(crate) u16, pub(crate) u16, pub(crate) u16, pub(crate) u16);
pub struct uint16x4_t(pub(crate) [u16; 4]);
// FIXME: ARM-specific 64-bit wide vector of four packed `f16`.
// pub struct float16x4_t(f16, f16, f16, f16);
/// ARM-specific 64-bit wide vector of four packed `p16`.
#[cfg_attr(not(target_arch = "arm"), stable(feature = "neon_intrinsics", since = "1.59.0"))]
pub struct poly16x4_t(pub(crate) p16, pub(crate) p16, pub(crate) p16, pub(crate) p16);
pub struct poly16x4_t(pub(crate) [p16; 4]);
/// ARM-specific 64-bit wide vector of two packed `i32`.
#[cfg_attr(not(target_arch = "arm"), stable(feature = "neon_intrinsics", since = "1.59.0"))]
pub struct int32x2_t(pub(crate) i32, pub(crate) i32);
pub struct int32x2_t(pub(crate) [i32; 2]);
/// ARM-specific 64-bit wide vector of two packed `u32`.
#[cfg_attr(not(target_arch = "arm"), stable(feature = "neon_intrinsics", since = "1.59.0"))]
pub struct uint32x2_t(pub(crate) u32, pub(crate) u32);
pub struct uint32x2_t(pub(crate) [u32; 2]);
/// ARM-specific 64-bit wide vector of two packed `f32`.
#[cfg_attr(not(target_arch = "arm"), stable(feature = "neon_intrinsics", since = "1.59.0"))]
pub struct float32x2_t(pub(crate) f32, pub(crate) f32);
pub struct float32x2_t(pub(crate) [f32; 2]);
/// ARM-specific 64-bit wide vector of one packed `i64`.
#[cfg_attr(not(target_arch = "arm"), stable(feature = "neon_intrinsics", since = "1.59.0"))]
pub struct int64x1_t(pub(crate) i64);
pub struct int64x1_t(pub(crate) [i64; 1]);
/// ARM-specific 64-bit wide vector of one packed `u64`.
#[cfg_attr(not(target_arch = "arm"), stable(feature = "neon_intrinsics", since = "1.59.0"))]
pub struct uint64x1_t(pub(crate) u64);
pub struct uint64x1_t(pub(crate) [u64; 1]);
/// ARM-specific 64-bit wide vector of one packed `p64`.
#[cfg_attr(not(target_arch = "arm"), stable(feature = "neon_intrinsics", since = "1.59.0"))]
pub struct poly64x1_t(pub(crate) p64);
pub struct poly64x1_t(pub(crate) [p64; 1]);

/// ARM-specific 128-bit wide vector of sixteen packed `i8`.
#[cfg_attr(not(target_arch = "arm"), stable(feature = "neon_intrinsics", since = "1.59.0"))]
pub struct int8x16_t(
pub(crate) i8, pub(crate) i8, pub(crate) i8, pub(crate) i8, pub(crate) i8, pub(crate) i8 , pub(crate) i8, pub(crate) i8,
pub(crate) i8, pub(crate) i8, pub(crate) i8, pub(crate) i8, pub(crate) i8, pub(crate) i8 , pub(crate) i8, pub(crate) i8,
);
pub struct int8x16_t(pub(crate) [i8; 16]);
/// ARM-specific 128-bit wide vector of sixteen packed `u8`.
#[cfg_attr(not(target_arch = "arm"), stable(feature = "neon_intrinsics", since = "1.59.0"))]
pub struct uint8x16_t(
pub(crate) u8, pub(crate) u8 , pub(crate) u8, pub(crate) u8, pub(crate) u8, pub(crate) u8 , pub(crate) u8, pub(crate) u8,
pub(crate) u8, pub(crate) u8 , pub(crate) u8, pub(crate) u8, pub(crate) u8, pub(crate) u8 , pub(crate) u8, pub(crate) u8,
);
pub struct uint8x16_t(pub(crate) [u8; 16]);
/// ARM-specific 128-bit wide vector of sixteen packed `p8`.
#[cfg_attr(not(target_arch = "arm"), stable(feature = "neon_intrinsics", since = "1.59.0"))]
pub struct poly8x16_t(
pub(crate) p8, pub(crate) p8, pub(crate) p8, pub(crate) p8, pub(crate) p8, pub(crate) p8, pub(crate) p8, pub(crate) p8,
pub(crate) p8, pub(crate) p8, pub(crate) p8, pub(crate) p8, pub(crate) p8, pub(crate) p8, pub(crate) p8, pub(crate) p8,
);
pub struct poly8x16_t(pub(crate) [p8; 16]);
/// ARM-specific 128-bit wide vector of eight packed `i16`.
#[cfg_attr(not(target_arch = "arm"), stable(feature = "neon_intrinsics", since = "1.59.0"))]
pub struct int16x8_t(pub(crate) i16, pub(crate) i16, pub(crate) i16, pub(crate) i16, pub(crate) i16, pub(crate) i16, pub(crate) i16, pub(crate) i16);
pub struct int16x8_t(pub(crate) [i16; 8]);
/// ARM-specific 128-bit wide vector of eight packed `u16`.
#[cfg_attr(not(target_arch = "arm"), stable(feature = "neon_intrinsics", since = "1.59.0"))]
pub struct uint16x8_t(pub(crate) u16, pub(crate) u16, pub(crate) u16, pub(crate) u16, pub(crate) u16, pub(crate) u16, pub(crate) u16, pub(crate) u16);
pub struct uint16x8_t(pub(crate) [u16; 8]);
// FIXME: ARM-specific 128-bit wide vector of eight packed `f16`.
// pub struct float16x8_t(f16, f16, f16, f16, f16, f16, f16);
/// ARM-specific 128-bit wide vector of eight packed `p16`.
#[cfg_attr(not(target_arch = "arm"), stable(feature = "neon_intrinsics", since = "1.59.0"))]
pub struct poly16x8_t(pub(crate) p16, pub(crate) p16, pub(crate) p16, pub(crate) p16, pub(crate) p16, pub(crate) p16, pub(crate) p16, pub(crate) p16);
pub struct poly16x8_t(pub(crate) [p16; 8]);
/// ARM-specific 128-bit wide vector of four packed `i32`.
#[cfg_attr(not(target_arch = "arm"), stable(feature = "neon_intrinsics", since = "1.59.0"))]
pub struct int32x4_t(pub(crate) i32, pub(crate) i32, pub(crate) i32, pub(crate) i32);
pub struct int32x4_t(pub(crate) [i32; 4]);
/// ARM-specific 128-bit wide vector of four packed `u32`.
#[cfg_attr(not(target_arch = "arm"), stable(feature = "neon_intrinsics", since = "1.59.0"))]
pub struct uint32x4_t(pub(crate) u32, pub(crate) u32, pub(crate) u32, pub(crate) u32);
pub struct uint32x4_t(pub(crate) [u32; 4]);
/// ARM-specific 128-bit wide vector of four packed `f32`.
#[cfg_attr(not(target_arch = "arm"), stable(feature = "neon_intrinsics", since = "1.59.0"))]
pub struct float32x4_t(pub(crate) f32, pub(crate) f32, pub(crate) f32, pub(crate) f32);
pub struct float32x4_t(pub(crate) [f32; 4]);
/// ARM-specific 128-bit wide vector of two packed `i64`.
#[cfg_attr(not(target_arch = "arm"), stable(feature = "neon_intrinsics", since = "1.59.0"))]
pub struct int64x2_t(pub(crate) i64, pub(crate) i64);
pub struct int64x2_t(pub(crate) [i64; 2]);
/// ARM-specific 128-bit wide vector of two packed `u64`.
#[cfg_attr(not(target_arch = "arm"), stable(feature = "neon_intrinsics", since = "1.59.0"))]
pub struct uint64x2_t(pub(crate) u64, pub(crate) u64);
pub struct uint64x2_t(pub(crate) [u64; 2]);
/// ARM-specific 128-bit wide vector of two packed `p64`.
#[cfg_attr(not(target_arch = "arm"), stable(feature = "neon_intrinsics", since = "1.59.0"))]
pub struct poly64x2_t(pub(crate) p64, pub(crate) p64);
pub struct poly64x2_t(pub(crate) [p64; 2]);
}

/// ARM-specific type containing two `int8x8_t` vectors.
Expand Down Expand Up @@ -738,12 +729,7 @@ pub struct poly64x1x3_t(pub poly64x1_t, pub poly64x1_t, pub poly64x1_t);
not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub struct poly64x1x4_t(
pub poly64x1_t,
pub poly64x1_t,
pub poly64x1_t,
pub poly64x1_t,
);
pub struct poly64x1x4_t(pub [poly64x1_t; 4]);

/// ARM-specific type containing four `poly64x2_t` vectors.
#[repr(C)]
Expand All @@ -752,28 +738,23 @@ pub struct poly64x1x4_t(
not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub struct poly64x2x2_t(pub poly64x2_t, pub poly64x2_t);
pub struct poly64x2x2_t(pub [poly64x2_t; 2]);
/// ARM-specific type containing four `poly64x2_t` vectors.
#[repr(C)]
#[derive(Copy, Clone, Debug)]
#[cfg_attr(
not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub struct poly64x2x3_t(pub poly64x2_t, pub poly64x2_t, pub poly64x2_t);
pub struct poly64x2x3_t(pub [poly64x2_t; 3]);
/// ARM-specific type containing four `poly64x2_t` vectors.
#[repr(C)]
#[derive(Copy, Clone, Debug)]
#[cfg_attr(
not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub struct poly64x2x4_t(
pub poly64x2_t,
pub poly64x2_t,
pub poly64x2_t,
pub poly64x2_t,
);
pub struct poly64x2x4_t(pub [poly64x2_t; 4]);

#[allow(improper_ctypes)]
extern "unadjusted" {
Expand Down
4 changes: 2 additions & 2 deletions crates/core_arch/src/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,14 @@ macro_rules! static_assert_simm_bits {
macro_rules! types {
($(
$(#[$doc:meta])*
pub struct $name:ident($($fields:tt)*);
pub struct $name:ident($( $field:tt )+);
)*) => ($(
$(#[$doc])*
#[derive(Copy, Clone, Debug)]
#[allow(non_camel_case_types)]
#[repr(simd)]
#[allow(clippy::missing_inline_in_public_items)]
pub struct $name($($fields)*);
pub struct $name($( $field )+);
)*)
}

Expand Down
42 changes: 10 additions & 32 deletions crates/core_arch/src/mips/msa.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,56 +12,34 @@ use crate::mem;

types! {
// / MIPS-specific 128-bit wide vector of 16 packed `i8`.
pub struct v16i8(
i8, i8, i8, i8, i8, i8, i8, i8,
i8, i8, i8, i8, i8, i8, i8, i8,
);
pub struct v16i8([i8; 16]);

// / MIPS-specific 128-bit wide vector of 8 packed `i16`.
pub struct v8i16(
i16, i16, i16, i16, i16, i16, i16, i16,
);
pub struct v8i16([i16; 8]);

// / MIPS-specific 128-bit wide vector of 4 packed `i32`.
pub struct v4i32(
i32, i32, i32, i32,
);
pub struct v4i32([i32; 4]);

// / MIPS-specific 128-bit wide vector of 2 packed `i64`.
pub struct v2i64(
i64, i64,
);
pub struct v2i64([i64; 2]);

// / MIPS-specific 128-bit wide vector of 16 packed `u8`.
pub struct v16u8(
u8, u8, u8, u8, u8, u8, u8, u8,
u8, u8, u8, u8, u8, u8, u8, u8,
);
pub struct v16u8([u8; 16]);

// / MIPS-specific 128-bit wide vector of 8 packed `u16`.
pub struct v8u16(
u16, u16, u16, u16, u16, u16, u16, u16,
);
pub struct v8u16([u16; 8]);

// / MIPS-specific 128-bit wide vector of 4 packed `u32`.
pub struct v4u32(
u32, u32, u32, u32,
);
pub struct v4u32([u32; 4]);

// / MIPS-specific 128-bit wide vector of 2 packed `u64`.
pub struct v2u64(
u64, u64,
);
pub struct v2u64([u64; 2]);

// / MIPS-specific 128-bit wide vector of 4 packed `f32`.
pub struct v4f32(
f32, f32, f32, f32,
);
pub struct v4f32([f32; 4]);

// / MIPS-specific 128-bit wide vector of 2 packed `f64`.
pub struct v2f64(
f64, f64,
);
pub struct v2f64([f64; 2]);
}

#[allow(improper_ctypes)]
Expand Down
23 changes: 10 additions & 13 deletions crates/core_arch/src/powerpc/altivec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,30 +23,27 @@ use stdarch_test::assert_instr;

types! {
/// PowerPC-specific 128-bit wide vector of sixteen packed `i8`
pub struct vector_signed_char(i8, i8, i8, i8, i8, i8, i8, i8,
i8, i8, i8, i8, i8, i8, i8, i8);
pub struct vector_signed_char([i8; 16]);
/// PowerPC-specific 128-bit wide vector of sixteen packed `u8`
pub struct vector_unsigned_char(u8, u8, u8, u8, u8, u8, u8, u8,
u8, u8, u8, u8, u8, u8, u8, u8);
pub struct vector_unsigned_char([u8; 16]);

/// PowerPC-specific 128-bit wide vector mask of sixteen packed elements
pub struct vector_bool_char(i8, i8, i8, i8, i8, i8, i8, i8,
i8, i8, i8, i8, i8, i8, i8, i8);
pub struct vector_bool_char([i8; 16]);
/// PowerPC-specific 128-bit wide vector of eight packed `i16`
pub struct vector_signed_short(i16, i16, i16, i16, i16, i16, i16, i16);
pub struct vector_signed_short([i16; 8]);
/// PowerPC-specific 128-bit wide vector of eight packed `u16`
pub struct vector_unsigned_short(u16, u16, u16, u16, u16, u16, u16, u16);
pub struct vector_unsigned_short([u16; 8]);
/// PowerPC-specific 128-bit wide vector mask of eight packed elements
pub struct vector_bool_short(i16, i16, i16, i16, i16, i16, i16, i16);
pub struct vector_bool_short([i16; 8]);
// pub struct vector_pixel(???);
/// PowerPC-specific 128-bit wide vector of four packed `i32`
pub struct vector_signed_int(i32, i32, i32, i32);
pub struct vector_signed_int([i32; 4]);
/// PowerPC-specific 128-bit wide vector of four packed `u32`
pub struct vector_unsigned_int(u32, u32, u32, u32);
pub struct vector_unsigned_int([u32; 4]);
/// PowerPC-specific 128-bit wide vector mask of four packed elements
pub struct vector_bool_int(i32, i32, i32, i32);
pub struct vector_bool_int([i32; 4]);
/// PowerPC-specific 128-bit wide vector of four packed `f32`
pub struct vector_float(f32, f32, f32, f32);
pub struct vector_float([f32; 4]);
}

#[allow(improper_ctypes)]
Expand Down
8 changes: 4 additions & 4 deletions crates/core_arch/src/powerpc/vsx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ use crate::mem::transmute;
types! {
// pub struct vector_Float16 = f16x8;
/// PowerPC-specific 128-bit wide vector of two packed `i64`
pub struct vector_signed_long(i64, i64);
pub struct vector_signed_long([i64; 2]);
/// PowerPC-specific 128-bit wide vector of two packed `u64`
pub struct vector_unsigned_long(u64, u64);
pub struct vector_unsigned_long([u64; 2]);
/// PowerPC-specific 128-bit wide vector mask of two `i64`
pub struct vector_bool_long(i64, i64);
pub struct vector_bool_long([i64; 2]);
/// PowerPC-specific 128-bit wide vector of two packed `f64`
pub struct vector_double(f64, f64);
pub struct vector_double([f64; 2]);
// pub struct vector_signed_long_long = vector_signed_long;
// pub struct vector_unsigned_long_long = vector_unsigned_long;
// pub struct vector_bool_long_long = vector_bool_long;
Expand Down
Loading