From 264b1ffee2834abccdb31d0e5bc7151fd1270620 Mon Sep 17 00:00:00 2001 From: Scott McMurray Date: Wed, 7 Aug 2024 00:49:51 -0700 Subject: [PATCH] Move entirely to array-based SIMD See MCP#621 This tries to make as few changes as possible -- it keeps the `new` functions taking all the parameters, for example. --- crates/core_arch/src/aarch64/neon/mod.rs | 20 +- crates/core_arch/src/arm/dsp.rs | 5 +- crates/core_arch/src/arm/neon.rs | 100 +++-- crates/core_arch/src/arm/simd32.rs | 5 +- .../src/arm_shared/neon/generated.rs | 74 ++-- crates/core_arch/src/arm_shared/neon/mod.rs | 304 ++++++-------- .../core_arch/src/loongarch64/lasx/types.rs | 36 +- crates/core_arch/src/loongarch64/lsx/types.rs | 20 +- crates/core_arch/src/macros.rs | 19 +- crates/core_arch/src/mips/msa.rs | 392 +++++++++--------- crates/core_arch/src/powerpc/altivec.rs | 23 +- crates/core_arch/src/powerpc/vsx.rs | 8 +- crates/core_arch/src/simd.rs | 172 ++++---- crates/core_arch/src/wasm32/simd128.rs | 2 +- crates/core_arch/src/x86/avx.rs | 6 +- crates/core_arch/src/x86/avx512bf16.rs | 34 +- crates/core_arch/src/x86/avx512fp16.rs | 22 +- crates/core_arch/src/x86/avxneconvert.rs | 28 +- crates/core_arch/src/x86/mod.rs | 50 +-- crates/core_arch/src/x86/sse.rs | 14 +- crates/core_arch/src/x86/sse2.rs | 6 +- crates/stdarch-gen-arm/src/main.rs | 8 +- 22 files changed, 635 insertions(+), 713 deletions(-) diff --git a/crates/core_arch/src/aarch64/neon/mod.rs b/crates/core_arch/src/aarch64/neon/mod.rs index 456a346e7a..c5522cc2cb 100644 --- a/crates/core_arch/src/aarch64/neon/mod.rs +++ b/crates/core_arch/src/aarch64/neon/mod.rs @@ -23,10 +23,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(1 x f64); // 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(2 x f64); } /// ARM-specific type containing two `float64x1_t` vectors. @@ -1061,7 +1061,7 @@ pub unsafe fn vabsq_s64(a: int64x2_t) -> int64x2_t { #[cfg_attr(test, assert_instr(bsl))] #[stable(feature = "neon_intrinsics", since = "1.59.0")] pub unsafe fn vbsl_f64(a: uint64x1_t, b: float64x1_t, c: float64x1_t) -> float64x1_t { - let not = int64x1_t(-1); + let not = int64x1_t::splat(-1); transmute(simd_or( simd_and(a, transmute(b)), simd_and(simd_xor(a, transmute(not)), transmute(c)), @@ -1073,7 +1073,7 @@ pub unsafe fn vbsl_f64(a: uint64x1_t, b: float64x1_t, c: float64x1_t) -> float64 #[cfg_attr(test, assert_instr(bsl))] #[stable(feature = "neon_intrinsics", since = "1.59.0")] pub unsafe fn vbsl_p64(a: poly64x1_t, b: poly64x1_t, c: poly64x1_t) -> poly64x1_t { - let not = int64x1_t(-1); + let not = int64x1_t::splat(-1); simd_or(simd_and(a, b), simd_and(simd_xor(a, transmute(not)), c)) } /// Bitwise Select. (128-bit) @@ -1082,7 +1082,7 @@ pub unsafe fn vbsl_p64(a: poly64x1_t, b: poly64x1_t, c: poly64x1_t) -> poly64x1_ #[cfg_attr(test, assert_instr(bsl))] #[stable(feature = "neon_intrinsics", since = "1.59.0")] pub unsafe fn vbslq_f64(a: uint64x2_t, b: float64x2_t, c: float64x2_t) -> float64x2_t { - let not = int64x2_t(-1, -1); + let not = int64x2_t::splat(-1); transmute(simd_or( simd_and(a, transmute(b)), simd_and(simd_xor(a, transmute(not)), transmute(c)), @@ -1094,7 +1094,7 @@ pub unsafe fn vbslq_f64(a: uint64x2_t, b: float64x2_t, c: float64x2_t) -> float6 #[cfg_attr(test, assert_instr(bsl))] #[stable(feature = "neon_intrinsics", since = "1.59.0")] pub unsafe fn vbslq_p64(a: poly64x2_t, b: poly64x2_t, c: poly64x2_t) -> poly64x2_t { - let not = int64x2_t(-1, -1); + let not = int64x2_t::splat(-1); simd_or(simd_and(a, b), simd_and(simd_xor(a, transmute(not)), c)) } @@ -1976,7 +1976,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::splat(value) } /// Duplicate vector element to vector or scalar @@ -1994,7 +1994,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::splat(value) } /// Duplicate vector element to vector or scalar @@ -2040,7 +2040,7 @@ pub unsafe fn vmovq_n_f64(value: f64) -> float64x2_t { #[cfg_attr(all(test, target_env = "msvc"), assert_instr(dup))] #[stable(feature = "neon_intrinsics", since = "1.59.0")] pub unsafe fn vget_high_f64(a: float64x2_t) -> float64x1_t { - float64x1_t(simd_extract!(a, 1)) + float64x1_t([simd_extract!(a, 1)]) } /// Duplicate vector element to vector or scalar @@ -2058,7 +2058,7 @@ pub unsafe fn vget_high_p64(a: poly64x2_t) -> poly64x1_t { #[cfg_attr(test, assert_instr(nop))] #[stable(feature = "neon_intrinsics", since = "1.59.0")] pub unsafe fn vget_low_f64(a: float64x2_t) -> float64x1_t { - float64x1_t(simd_extract!(a, 0)) + float64x1_t([simd_extract!(a, 0)]) } /// Duplicate vector element to vector or scalar diff --git a/crates/core_arch/src/arm/dsp.rs b/crates/core_arch/src/arm/dsp.rs index 6d9c0138a1..15af41cff1 100644 --- a/crates/core_arch/src/arm/dsp.rs +++ b/crates/core_arch/src/arm/dsp.rs @@ -23,15 +23,16 @@ #[cfg(test)] use stdarch_test::assert_instr; +use crate::intrinsics::simd::simd_shuffle; use crate::mem::transmute; types! { /// ARM-specific 32-bit wide vector of two packed `i16`. #[unstable(feature = "stdarch_arm_dsp", issue = "117237")] - pub struct int16x2_t(i16, i16); + pub struct int16x2_t(2 x i16); /// ARM-specific 32-bit wide vector of two packed `u16`. #[unstable(feature = "stdarch_arm_dsp", issue = "117237")] - pub struct uint16x2_t(u16, u16); + pub struct uint16x2_t(2 x u16); } extern "unadjusted" { diff --git a/crates/core_arch/src/arm/neon.rs b/crates/core_arch/src/arm/neon.rs index b0a4f3706b..ff67812365 100644 --- a/crates/core_arch/src/arm/neon.rs +++ b/crates/core_arch/src/arm/neon.rs @@ -844,7 +844,7 @@ pub unsafe fn vtbx4_p8(a: poly8x8_t, b: poly8x8x4_t, c: uint8x8_t) -> poly8x8_t pub unsafe fn vsli_n_s8(a: int8x8_t, b: int8x8_t) -> int8x8_t { static_assert_uimm_bits!(N, 3); let n = N as i8; - vshiftins_v8i8(a, b, int8x8_t(n, n, n, n, n, n, n, n)) + vshiftins_v8i8(a, b, int8x8_t::splat(n)) } /// Shift Left and Insert (immediate) #[inline] @@ -855,11 +855,7 @@ pub unsafe fn vsli_n_s8(a: int8x8_t, b: int8x8_t) -> int8x8_t { pub unsafe fn vsliq_n_s8(a: int8x16_t, b: int8x16_t) -> int8x16_t { static_assert_uimm_bits!(N, 3); let n = N as i8; - vshiftins_v16i8( - a, - b, - int8x16_t(n, n, n, n, n, n, n, n, n, n, n, n, n, n, n, n), - ) + vshiftins_v16i8(a, b, int8x16_t::splat(n)) } /// Shift Left and Insert (immediate) #[inline] @@ -870,7 +866,7 @@ pub unsafe fn vsliq_n_s8(a: int8x16_t, b: int8x16_t) -> int8x16_t pub unsafe fn vsli_n_s16(a: int16x4_t, b: int16x4_t) -> int16x4_t { static_assert_uimm_bits!(N, 4); let n = N as i16; - vshiftins_v4i16(a, b, int16x4_t(n, n, n, n)) + vshiftins_v4i16(a, b, int16x4_t::splat(n)) } /// Shift Left and Insert (immediate) #[inline] @@ -881,7 +877,7 @@ pub unsafe fn vsli_n_s16(a: int16x4_t, b: int16x4_t) -> int16x4_t pub unsafe fn vsliq_n_s16(a: int16x8_t, b: int16x8_t) -> int16x8_t { static_assert_uimm_bits!(N, 4); let n = N as i16; - vshiftins_v8i16(a, b, int16x8_t(n, n, n, n, n, n, n, n)) + vshiftins_v8i16(a, b, int16x8_t::splat(n)) } /// Shift Left and Insert (immediate) #[inline] @@ -891,7 +887,7 @@ pub unsafe fn vsliq_n_s16(a: int16x8_t, b: int16x8_t) -> int16x8_t #[unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800")] pub unsafe fn vsli_n_s32(a: int32x2_t, b: int32x2_t) -> int32x2_t { static_assert!(N >= 0 && N <= 31); - vshiftins_v2i32(a, b, int32x2_t(N, N)) + vshiftins_v2i32(a, b, int32x2_t::splat(N)) } /// Shift Left and Insert (immediate) #[inline] @@ -901,7 +897,7 @@ pub unsafe fn vsli_n_s32(a: int32x2_t, b: int32x2_t) -> int32x2_t #[unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800")] pub unsafe fn vsliq_n_s32(a: int32x4_t, b: int32x4_t) -> int32x4_t { static_assert!(N >= 0 && N <= 31); - vshiftins_v4i32(a, b, int32x4_t(N, N, N, N)) + vshiftins_v4i32(a, b, int32x4_t::splat(N)) } /// Shift Left and Insert (immediate) #[inline] @@ -911,7 +907,7 @@ pub unsafe fn vsliq_n_s32(a: int32x4_t, b: int32x4_t) -> int32x4_t #[unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800")] pub unsafe fn vsli_n_s64(a: int64x1_t, b: int64x1_t) -> int64x1_t { static_assert!(0 <= N && N <= 63); - vshiftins_v1i64(a, b, int64x1_t(N as i64)) + vshiftins_v1i64(a, b, int64x1_t::splat(N as i64)) } /// Shift Left and Insert (immediate) #[inline] @@ -921,7 +917,7 @@ pub unsafe fn vsli_n_s64(a: int64x1_t, b: int64x1_t) -> int64x1_t #[unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800")] pub unsafe fn vsliq_n_s64(a: int64x2_t, b: int64x2_t) -> int64x2_t { static_assert!(0 <= N && N <= 63); - vshiftins_v2i64(a, b, int64x2_t(N as i64, N as i64)) + vshiftins_v2i64(a, b, int64x2_t::splat(N as i64)) } /// Shift Left and Insert (immediate) #[inline] @@ -935,7 +931,7 @@ pub unsafe fn vsli_n_u8(a: uint8x8_t, b: uint8x8_t) -> uint8x8_t { transmute(vshiftins_v8i8( transmute(a), transmute(b), - int8x8_t(n, n, n, n, n, n, n, n), + int8x8_t::splat(n), )) } /// Shift Left and Insert (immediate) @@ -950,7 +946,7 @@ pub unsafe fn vsliq_n_u8(a: uint8x16_t, b: uint8x16_t) -> uint8x16 transmute(vshiftins_v16i8( transmute(a), transmute(b), - int8x16_t(n, n, n, n, n, n, n, n, n, n, n, n, n, n, n, n), + int8x16_t::splat(n), )) } /// Shift Left and Insert (immediate) @@ -965,7 +961,7 @@ pub unsafe fn vsli_n_u16(a: uint16x4_t, b: uint16x4_t) -> uint16x4 transmute(vshiftins_v4i16( transmute(a), transmute(b), - int16x4_t(n, n, n, n), + int16x4_t::splat(n), )) } /// Shift Left and Insert (immediate) @@ -980,7 +976,7 @@ pub unsafe fn vsliq_n_u16(a: uint16x8_t, b: uint16x8_t) -> uint16x transmute(vshiftins_v8i16( transmute(a), transmute(b), - int16x8_t(n, n, n, n, n, n, n, n), + int16x8_t::splat(n), )) } /// Shift Left and Insert (immediate) @@ -991,7 +987,11 @@ pub unsafe fn vsliq_n_u16(a: uint16x8_t, b: uint16x8_t) -> uint16x #[unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800")] pub unsafe fn vsli_n_u32(a: uint32x2_t, b: uint32x2_t) -> uint32x2_t { static_assert!(N >= 0 && N <= 31); - transmute(vshiftins_v2i32(transmute(a), transmute(b), int32x2_t(N, N))) + transmute(vshiftins_v2i32( + transmute(a), + transmute(b), + int32x2_t::splat(N), + )) } /// Shift Left and Insert (immediate) #[inline] @@ -1004,7 +1004,7 @@ pub unsafe fn vsliq_n_u32(a: uint32x4_t, b: uint32x4_t) -> uint32x transmute(vshiftins_v4i32( transmute(a), transmute(b), - int32x4_t(N, N, N, N), + int32x4_t::splat(N), )) } /// Shift Left and Insert (immediate) @@ -1018,7 +1018,7 @@ pub unsafe fn vsli_n_u64(a: uint64x1_t, b: uint64x1_t) -> uint64x1 transmute(vshiftins_v1i64( transmute(a), transmute(b), - int64x1_t(N as i64), + int64x1_t::splat(N as i64), )) } /// Shift Left and Insert (immediate) @@ -1032,7 +1032,7 @@ pub unsafe fn vsliq_n_u64(a: uint64x2_t, b: uint64x2_t) -> uint64x transmute(vshiftins_v2i64( transmute(a), transmute(b), - int64x2_t(N as i64, N as i64), + int64x2_t::splat(N as i64), )) } /// Shift Left and Insert (immediate) @@ -1047,7 +1047,7 @@ pub unsafe fn vsli_n_p8(a: poly8x8_t, b: poly8x8_t) -> poly8x8_t { transmute(vshiftins_v8i8( transmute(a), transmute(b), - int8x8_t(n, n, n, n, n, n, n, n), + int8x8_t::splat(n), )) } /// Shift Left and Insert (immediate) @@ -1062,7 +1062,7 @@ pub unsafe fn vsliq_n_p8(a: poly8x16_t, b: poly8x16_t) -> poly8x16 transmute(vshiftins_v16i8( transmute(a), transmute(b), - int8x16_t(n, n, n, n, n, n, n, n, n, n, n, n, n, n, n, n), + int8x16_t::splat(n), )) } /// Shift Left and Insert (immediate) @@ -1077,7 +1077,7 @@ pub unsafe fn vsli_n_p16(a: poly16x4_t, b: poly16x4_t) -> poly16x4 transmute(vshiftins_v4i16( transmute(a), transmute(b), - int16x4_t(n, n, n, n), + int16x4_t::splat(n), )) } @@ -1093,7 +1093,7 @@ pub unsafe fn vsliq_n_p16(a: poly16x8_t, b: poly16x8_t) -> poly16x transmute(vshiftins_v8i16( transmute(a), transmute(b), - int16x8_t(n, n, n, n, n, n, n, n), + int16x8_t::splat(n), )) } @@ -1110,7 +1110,7 @@ pub unsafe fn vsli_n_p64(a: poly64x1_t, b: poly64x1_t) -> poly64x1 transmute(vshiftins_v1i64( transmute(a), transmute(b), - int64x1_t(N as i64), + int64x1_t::splat(N as i64), )) } @@ -1127,7 +1127,7 @@ pub unsafe fn vsliq_n_p64(a: poly64x2_t, b: poly64x2_t) -> poly64x transmute(vshiftins_v2i64( transmute(a), transmute(b), - int64x2_t(N as i64, N as i64), + int64x2_t::splat(N as i64), )) } /// Shift Right and Insert (immediate) @@ -1139,7 +1139,7 @@ pub unsafe fn vsliq_n_p64(a: poly64x2_t, b: poly64x2_t) -> poly64x pub unsafe fn vsri_n_s8(a: int8x8_t, b: int8x8_t) -> int8x8_t { static_assert!(1 <= N && N <= 8); let n = -N as i8; - vshiftins_v8i8(a, b, int8x8_t(n, n, n, n, n, n, n, n)) + vshiftins_v8i8(a, b, int8x8_t::splat(n)) } /// Shift Right and Insert (immediate) #[inline] @@ -1150,11 +1150,7 @@ pub unsafe fn vsri_n_s8(a: int8x8_t, b: int8x8_t) -> int8x8_t { pub unsafe fn vsriq_n_s8(a: int8x16_t, b: int8x16_t) -> int8x16_t { static_assert!(1 <= N && N <= 8); let n = -N as i8; - vshiftins_v16i8( - a, - b, - int8x16_t(n, n, n, n, n, n, n, n, n, n, n, n, n, n, n, n), - ) + vshiftins_v16i8(a, b, int8x16_t::splat(n)) } /// Shift Right and Insert (immediate) #[inline] @@ -1165,7 +1161,7 @@ pub unsafe fn vsriq_n_s8(a: int8x16_t, b: int8x16_t) -> int8x16_t pub unsafe fn vsri_n_s16(a: int16x4_t, b: int16x4_t) -> int16x4_t { static_assert!(1 <= N && N <= 16); let n = -N as i16; - vshiftins_v4i16(a, b, int16x4_t(n, n, n, n)) + vshiftins_v4i16(a, b, int16x4_t::splat(n)) } /// Shift Right and Insert (immediate) #[inline] @@ -1176,7 +1172,7 @@ pub unsafe fn vsri_n_s16(a: int16x4_t, b: int16x4_t) -> int16x4_t pub unsafe fn vsriq_n_s16(a: int16x8_t, b: int16x8_t) -> int16x8_t { static_assert!(1 <= N && N <= 16); let n = -N as i16; - vshiftins_v8i16(a, b, int16x8_t(n, n, n, n, n, n, n, n)) + vshiftins_v8i16(a, b, int16x8_t::splat(n)) } /// Shift Right and Insert (immediate) #[inline] @@ -1186,7 +1182,7 @@ pub unsafe fn vsriq_n_s16(a: int16x8_t, b: int16x8_t) -> int16x8_t #[unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800")] pub unsafe fn vsri_n_s32(a: int32x2_t, b: int32x2_t) -> int32x2_t { static_assert!(1 <= N && N <= 32); - vshiftins_v2i32(a, b, int32x2_t(-N, -N)) + vshiftins_v2i32(a, b, int32x2_t::splat(-N)) } /// Shift Right and Insert (immediate) #[inline] @@ -1196,7 +1192,7 @@ pub unsafe fn vsri_n_s32(a: int32x2_t, b: int32x2_t) -> int32x2_t #[unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800")] pub unsafe fn vsriq_n_s32(a: int32x4_t, b: int32x4_t) -> int32x4_t { static_assert!(1 <= N && N <= 32); - vshiftins_v4i32(a, b, int32x4_t(-N, -N, -N, -N)) + vshiftins_v4i32(a, b, int32x4_t::splat(-N)) } /// Shift Right and Insert (immediate) #[inline] @@ -1206,7 +1202,7 @@ pub unsafe fn vsriq_n_s32(a: int32x4_t, b: int32x4_t) -> int32x4_t #[unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800")] pub unsafe fn vsri_n_s64(a: int64x1_t, b: int64x1_t) -> int64x1_t { static_assert!(1 <= N && N <= 64); - vshiftins_v1i64(a, b, int64x1_t(-N as i64)) + vshiftins_v1i64(a, b, int64x1_t::splat(-N as i64)) } /// Shift Right and Insert (immediate) #[inline] @@ -1216,7 +1212,7 @@ pub unsafe fn vsri_n_s64(a: int64x1_t, b: int64x1_t) -> int64x1_t #[unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800")] pub unsafe fn vsriq_n_s64(a: int64x2_t, b: int64x2_t) -> int64x2_t { static_assert!(1 <= N && N <= 64); - vshiftins_v2i64(a, b, int64x2_t(-N as i64, -N as i64)) + vshiftins_v2i64(a, b, int64x2_t::splat(-N as i64)) } /// Shift Right and Insert (immediate) #[inline] @@ -1230,7 +1226,7 @@ pub unsafe fn vsri_n_u8(a: uint8x8_t, b: uint8x8_t) -> uint8x8_t { transmute(vshiftins_v8i8( transmute(a), transmute(b), - int8x8_t(n, n, n, n, n, n, n, n), + int8x8_t::splat(n), )) } /// Shift Right and Insert (immediate) @@ -1245,7 +1241,7 @@ pub unsafe fn vsriq_n_u8(a: uint8x16_t, b: uint8x16_t) -> uint8x16 transmute(vshiftins_v16i8( transmute(a), transmute(b), - int8x16_t(n, n, n, n, n, n, n, n, n, n, n, n, n, n, n, n), + int8x16_t::splat(n), )) } /// Shift Right and Insert (immediate) @@ -1260,7 +1256,7 @@ pub unsafe fn vsri_n_u16(a: uint16x4_t, b: uint16x4_t) -> uint16x4 transmute(vshiftins_v4i16( transmute(a), transmute(b), - int16x4_t(n, n, n, n), + int16x4_t::splat(n), )) } /// Shift Right and Insert (immediate) @@ -1275,7 +1271,7 @@ pub unsafe fn vsriq_n_u16(a: uint16x8_t, b: uint16x8_t) -> uint16x transmute(vshiftins_v8i16( transmute(a), transmute(b), - int16x8_t(n, n, n, n, n, n, n, n), + int16x8_t::splat(n), )) } /// Shift Right and Insert (immediate) @@ -1289,7 +1285,7 @@ pub unsafe fn vsri_n_u32(a: uint32x2_t, b: uint32x2_t) -> uint32x2 transmute(vshiftins_v2i32( transmute(a), transmute(b), - int32x2_t(-N, -N), + int32x2_t::splat(-N), )) } /// Shift Right and Insert (immediate) @@ -1303,7 +1299,7 @@ pub unsafe fn vsriq_n_u32(a: uint32x4_t, b: uint32x4_t) -> uint32x transmute(vshiftins_v4i32( transmute(a), transmute(b), - int32x4_t(-N, -N, -N, -N), + int32x4_t::splat(-N), )) } /// Shift Right and Insert (immediate) @@ -1317,7 +1313,7 @@ pub unsafe fn vsri_n_u64(a: uint64x1_t, b: uint64x1_t) -> uint64x1 transmute(vshiftins_v1i64( transmute(a), transmute(b), - int64x1_t(-N as i64), + int64x1_t::splat(-N as i64), )) } /// Shift Right and Insert (immediate) @@ -1331,7 +1327,7 @@ pub unsafe fn vsriq_n_u64(a: uint64x2_t, b: uint64x2_t) -> uint64x transmute(vshiftins_v2i64( transmute(a), transmute(b), - int64x2_t(-N as i64, -N as i64), + int64x2_t::splat(-N as i64), )) } /// Shift Right and Insert (immediate) @@ -1346,7 +1342,7 @@ pub unsafe fn vsri_n_p8(a: poly8x8_t, b: poly8x8_t) -> poly8x8_t { transmute(vshiftins_v8i8( transmute(a), transmute(b), - int8x8_t(n, n, n, n, n, n, n, n), + int8x8_t::splat(n), )) } /// Shift Right and Insert (immediate) @@ -1361,7 +1357,7 @@ pub unsafe fn vsriq_n_p8(a: poly8x16_t, b: poly8x16_t) -> poly8x16 transmute(vshiftins_v16i8( transmute(a), transmute(b), - int8x16_t(n, n, n, n, n, n, n, n, n, n, n, n, n, n, n, n), + int8x16_t::splat(n), )) } /// Shift Right and Insert (immediate) @@ -1376,7 +1372,7 @@ pub unsafe fn vsri_n_p16(a: poly16x4_t, b: poly16x4_t) -> poly16x4 transmute(vshiftins_v4i16( transmute(a), transmute(b), - int16x4_t(n, n, n, n), + int16x4_t::splat(n), )) } /// Shift Right and Insert (immediate) @@ -1391,7 +1387,7 @@ pub unsafe fn vsriq_n_p16(a: poly16x8_t, b: poly16x8_t) -> poly16x transmute(vshiftins_v8i16( transmute(a), transmute(b), - int16x8_t(n, n, n, n, n, n, n, n), + int16x8_t::splat(n), )) } @@ -1408,7 +1404,7 @@ pub unsafe fn vsri_n_p64(a: poly64x1_t, b: poly64x1_t) -> poly64x1 transmute(vshiftins_v1i64( transmute(a), transmute(b), - int64x1_t(-N as i64), + int64x1_t::splat(-N as i64), )) } @@ -1425,7 +1421,7 @@ pub unsafe fn vsriq_n_p64(a: poly64x2_t, b: poly64x2_t) -> poly64x transmute(vshiftins_v2i64( transmute(a), transmute(b), - int64x2_t(-N as i64, -N as i64), + int64x2_t::splat(-N as i64), )) } diff --git a/crates/core_arch/src/arm/simd32.rs b/crates/core_arch/src/arm/simd32.rs index e81ad02a91..5057d91a23 100644 --- a/crates/core_arch/src/arm/simd32.rs +++ b/crates/core_arch/src/arm/simd32.rs @@ -65,15 +65,16 @@ #[cfg(test)] use stdarch_test::assert_instr; +use crate::intrinsics::simd::simd_shuffle; use crate::{core_arch::arm::dsp::int16x2_t, mem::transmute}; types! { /// ARM-specific 32-bit wide vector of four packed `i8`. #[unstable(feature = "stdarch_arm_dsp", issue = "117237")] - pub struct int8x4_t(i8, i8, i8, i8); + pub struct int8x4_t(4 x i8); /// ARM-specific 32-bit wide vector of four packed `u8`. #[unstable(feature = "stdarch_arm_dsp", issue = "117237")] - pub struct uint8x4_t(u8, u8, u8, u8); + pub struct uint8x4_t(4 x u8); } macro_rules! dsp_call { diff --git a/crates/core_arch/src/arm_shared/neon/generated.rs b/crates/core_arch/src/arm_shared/neon/generated.rs index 8b46d35d7a..aa4c30b6cd 100644 --- a/crates/core_arch/src/arm_shared/neon/generated.rs +++ b/crates/core_arch/src/arm_shared/neon/generated.rs @@ -21990,7 +21990,7 @@ pub unsafe fn vqrshrn_n_s16(a: int16x8_t) -> int8x8_t { #[cfg_attr(target_arch = "arm", link_name = "llvm.arm.neon.vqrshiftns.v8i8")] fn vqrshrn_n_s16_(a: int16x8_t, n: int16x8_t) -> int8x8_t; } -vqrshrn_n_s16_(a, int16x8_t(-N as i16, -N as i16, -N as i16, -N as i16, -N as i16, -N as i16, -N as i16, -N as i16)) +vqrshrn_n_s16_(a, int16x8_t([-N as i16, -N as i16, -N as i16, -N as i16, -N as i16, -N as i16, -N as i16, -N as i16])) } /// Signed saturating rounded shift right narrow @@ -22028,7 +22028,7 @@ pub unsafe fn vqrshrn_n_s32(a: int32x4_t) -> int16x4_t { #[cfg_attr(target_arch = "arm", link_name = "llvm.arm.neon.vqrshiftns.v4i16")] fn vqrshrn_n_s32_(a: int32x4_t, n: int32x4_t) -> int16x4_t; } -vqrshrn_n_s32_(a, int32x4_t(-N as i32, -N as i32, -N as i32, -N as i32)) +vqrshrn_n_s32_(a, int32x4_t([-N as i32, -N as i32, -N as i32, -N as i32])) } /// Signed saturating rounded shift right narrow @@ -22066,7 +22066,7 @@ pub unsafe fn vqrshrn_n_s64(a: int64x2_t) -> int32x2_t { #[cfg_attr(target_arch = "arm", link_name = "llvm.arm.neon.vqrshiftns.v2i32")] fn vqrshrn_n_s64_(a: int64x2_t, n: int64x2_t) -> int32x2_t; } -vqrshrn_n_s64_(a, int64x2_t(-N as i64, -N as i64)) +vqrshrn_n_s64_(a, int64x2_t([-N as i64, -N as i64])) } /// Signed saturating rounded shift right narrow @@ -22104,7 +22104,7 @@ pub unsafe fn vqrshrn_n_u16(a: uint16x8_t) -> uint8x8_t { #[cfg_attr(target_arch = "arm", link_name = "llvm.arm.neon.vqrshiftnu.v8i8")] fn vqrshrn_n_u16_(a: uint16x8_t, n: uint16x8_t) -> uint8x8_t; } -vqrshrn_n_u16_(a, uint16x8_t(-N as u16, -N as u16, -N as u16, -N as u16, -N as u16, -N as u16, -N as u16, -N as u16)) +vqrshrn_n_u16_(a, uint16x8_t([-N as u16, -N as u16, -N as u16, -N as u16, -N as u16, -N as u16, -N as u16, -N as u16])) } /// Unsigned signed saturating rounded shift right narrow @@ -22142,7 +22142,7 @@ pub unsafe fn vqrshrn_n_u32(a: uint32x4_t) -> uint16x4_t { #[cfg_attr(target_arch = "arm", link_name = "llvm.arm.neon.vqrshiftnu.v4i16")] fn vqrshrn_n_u32_(a: uint32x4_t, n: uint32x4_t) -> uint16x4_t; } -vqrshrn_n_u32_(a, uint32x4_t(-N as u32, -N as u32, -N as u32, -N as u32)) +vqrshrn_n_u32_(a, uint32x4_t([-N as u32, -N as u32, -N as u32, -N as u32])) } /// Unsigned signed saturating rounded shift right narrow @@ -22180,7 +22180,7 @@ pub unsafe fn vqrshrn_n_u64(a: uint64x2_t) -> uint32x2_t { #[cfg_attr(target_arch = "arm", link_name = "llvm.arm.neon.vqrshiftnu.v2i32")] fn vqrshrn_n_u64_(a: uint64x2_t, n: uint64x2_t) -> uint32x2_t; } -vqrshrn_n_u64_(a, uint64x2_t(-N as u64, -N as u64)) +vqrshrn_n_u64_(a, uint64x2_t([-N as u64, -N as u64])) } /// Unsigned signed saturating rounded shift right narrow @@ -22218,7 +22218,7 @@ pub unsafe fn vqrshrun_n_s16(a: int16x8_t) -> uint8x8_t { #[cfg_attr(target_arch = "arm", link_name = "llvm.arm.neon.vqrshiftnsu.v8i8")] fn vqrshrun_n_s16_(a: int16x8_t, n: int16x8_t) -> uint8x8_t; } -vqrshrun_n_s16_(a, int16x8_t(-N as i16, -N as i16, -N as i16, -N as i16, -N as i16, -N as i16, -N as i16, -N as i16)) +vqrshrun_n_s16_(a, int16x8_t([-N as i16, -N as i16, -N as i16, -N as i16, -N as i16, -N as i16, -N as i16, -N as i16])) } /// Signed saturating rounded shift right unsigned narrow @@ -22256,7 +22256,7 @@ pub unsafe fn vqrshrun_n_s32(a: int32x4_t) -> uint16x4_t { #[cfg_attr(target_arch = "arm", link_name = "llvm.arm.neon.vqrshiftnsu.v4i16")] fn vqrshrun_n_s32_(a: int32x4_t, n: int32x4_t) -> uint16x4_t; } -vqrshrun_n_s32_(a, int32x4_t(-N as i32, -N as i32, -N as i32, -N as i32)) +vqrshrun_n_s32_(a, int32x4_t([-N as i32, -N as i32, -N as i32, -N as i32])) } /// Signed saturating rounded shift right unsigned narrow @@ -22294,7 +22294,7 @@ pub unsafe fn vqrshrun_n_s64(a: int64x2_t) -> uint32x2_t { #[cfg_attr(target_arch = "arm", link_name = "llvm.arm.neon.vqrshiftnsu.v2i32")] fn vqrshrun_n_s64_(a: int64x2_t, n: int64x2_t) -> uint32x2_t; } -vqrshrun_n_s64_(a, int64x2_t(-N as i64, -N as i64)) +vqrshrun_n_s64_(a, int64x2_t([-N as i64, -N as i64])) } /// Signed saturating rounded shift right unsigned narrow @@ -22908,7 +22908,7 @@ pub unsafe fn vqshlu_n_s8(a: int8x8_t) -> uint8x8_t { #[cfg_attr(target_arch = "arm", link_name = "llvm.arm.neon.vqshiftsu.v8i8")] fn vqshlu_n_s8_(a: int8x8_t, n: int8x8_t) -> uint8x8_t; } -vqshlu_n_s8_(a, int8x8_t(N as i8, N as i8, N as i8, N as i8, N as i8, N as i8, N as i8, N as i8)) +vqshlu_n_s8_(a, int8x8_t([N as i8, N as i8, N as i8, N as i8, N as i8, N as i8, N as i8, N as i8])) } /// Signed saturating shift left unsigned @@ -22927,7 +22927,7 @@ pub unsafe fn vqshlu_n_s8(a: int8x8_t) -> uint8x8_t { #[cfg_attr(any(target_arch = "aarch64", target_arch = "arm64ec"), link_name = "llvm.aarch64.neon.sqshlu.v8i8")] fn vqshlu_n_s8_(a: int8x8_t, n: int8x8_t) -> uint8x8_t; } -vqshlu_n_s8_(a, int8x8_t(N as i8, N as i8, N as i8, N as i8, N as i8, N as i8, N as i8, N as i8)) +vqshlu_n_s8_(a, int8x8_t([N as i8, N as i8, N as i8, N as i8, N as i8, N as i8, N as i8, N as i8])) } /// Signed saturating shift left unsigned @@ -22946,7 +22946,7 @@ pub unsafe fn vqshlu_n_s16(a: int16x4_t) -> uint16x4_t { #[cfg_attr(target_arch = "arm", link_name = "llvm.arm.neon.vqshiftsu.v4i16")] fn vqshlu_n_s16_(a: int16x4_t, n: int16x4_t) -> uint16x4_t; } -vqshlu_n_s16_(a, int16x4_t(N as i16, N as i16, N as i16, N as i16)) +vqshlu_n_s16_(a, int16x4_t([N as i16, N as i16, N as i16, N as i16])) } /// Signed saturating shift left unsigned @@ -22965,7 +22965,7 @@ pub unsafe fn vqshlu_n_s16(a: int16x4_t) -> uint16x4_t { #[cfg_attr(any(target_arch = "aarch64", target_arch = "arm64ec"), link_name = "llvm.aarch64.neon.sqshlu.v4i16")] fn vqshlu_n_s16_(a: int16x4_t, n: int16x4_t) -> uint16x4_t; } -vqshlu_n_s16_(a, int16x4_t(N as i16, N as i16, N as i16, N as i16)) +vqshlu_n_s16_(a, int16x4_t([N as i16, N as i16, N as i16, N as i16])) } /// Signed saturating shift left unsigned @@ -22984,7 +22984,7 @@ pub unsafe fn vqshlu_n_s32(a: int32x2_t) -> uint32x2_t { #[cfg_attr(target_arch = "arm", link_name = "llvm.arm.neon.vqshiftsu.v2i32")] fn vqshlu_n_s32_(a: int32x2_t, n: int32x2_t) -> uint32x2_t; } -vqshlu_n_s32_(a, int32x2_t(N as i32, N as i32)) +vqshlu_n_s32_(a, int32x2_t([N as i32, N as i32])) } /// Signed saturating shift left unsigned @@ -23003,7 +23003,7 @@ pub unsafe fn vqshlu_n_s32(a: int32x2_t) -> uint32x2_t { #[cfg_attr(any(target_arch = "aarch64", target_arch = "arm64ec"), link_name = "llvm.aarch64.neon.sqshlu.v2i32")] fn vqshlu_n_s32_(a: int32x2_t, n: int32x2_t) -> uint32x2_t; } -vqshlu_n_s32_(a, int32x2_t(N as i32, N as i32)) +vqshlu_n_s32_(a, int32x2_t([N as i32, N as i32])) } /// Signed saturating shift left unsigned @@ -23022,7 +23022,7 @@ pub unsafe fn vqshlu_n_s64(a: int64x1_t) -> uint64x1_t { #[cfg_attr(target_arch = "arm", link_name = "llvm.arm.neon.vqshiftsu.v1i64")] fn vqshlu_n_s64_(a: int64x1_t, n: int64x1_t) -> uint64x1_t; } -vqshlu_n_s64_(a, int64x1_t(N as i64)) +vqshlu_n_s64_(a, int64x1_t([N as i64])) } /// Signed saturating shift left unsigned @@ -23041,7 +23041,7 @@ pub unsafe fn vqshlu_n_s64(a: int64x1_t) -> uint64x1_t { #[cfg_attr(any(target_arch = "aarch64", target_arch = "arm64ec"), link_name = "llvm.aarch64.neon.sqshlu.v1i64")] fn vqshlu_n_s64_(a: int64x1_t, n: int64x1_t) -> uint64x1_t; } -vqshlu_n_s64_(a, int64x1_t(N as i64)) +vqshlu_n_s64_(a, int64x1_t([N as i64])) } /// Signed saturating shift left unsigned @@ -23060,7 +23060,7 @@ pub unsafe fn vqshluq_n_s8(a: int8x16_t) -> uint8x16_t { #[cfg_attr(target_arch = "arm", link_name = "llvm.arm.neon.vqshiftsu.v16i8")] fn vqshluq_n_s8_(a: int8x16_t, n: int8x16_t) -> uint8x16_t; } -vqshluq_n_s8_(a, int8x16_t(N as i8, N as i8, N as i8, N as i8, N as i8, N as i8, N as i8, N as i8, N as i8, N as i8, N as i8, N as i8, N as i8, N as i8, N as i8, N as i8)) +vqshluq_n_s8_(a, int8x16_t([N as i8, N as i8, N as i8, N as i8, N as i8, N as i8, N as i8, N as i8, N as i8, N as i8, N as i8, N as i8, N as i8, N as i8, N as i8, N as i8])) } /// Signed saturating shift left unsigned @@ -23079,7 +23079,7 @@ pub unsafe fn vqshluq_n_s8(a: int8x16_t) -> uint8x16_t { #[cfg_attr(any(target_arch = "aarch64", target_arch = "arm64ec"), link_name = "llvm.aarch64.neon.sqshlu.v16i8")] fn vqshluq_n_s8_(a: int8x16_t, n: int8x16_t) -> uint8x16_t; } -vqshluq_n_s8_(a, int8x16_t(N as i8, N as i8, N as i8, N as i8, N as i8, N as i8, N as i8, N as i8, N as i8, N as i8, N as i8, N as i8, N as i8, N as i8, N as i8, N as i8)) +vqshluq_n_s8_(a, int8x16_t([N as i8, N as i8, N as i8, N as i8, N as i8, N as i8, N as i8, N as i8, N as i8, N as i8, N as i8, N as i8, N as i8, N as i8, N as i8, N as i8])) } /// Signed saturating shift left unsigned @@ -23098,7 +23098,7 @@ pub unsafe fn vqshluq_n_s16(a: int16x8_t) -> uint16x8_t { #[cfg_attr(target_arch = "arm", link_name = "llvm.arm.neon.vqshiftsu.v8i16")] fn vqshluq_n_s16_(a: int16x8_t, n: int16x8_t) -> uint16x8_t; } -vqshluq_n_s16_(a, int16x8_t(N as i16, N as i16, N as i16, N as i16, N as i16, N as i16, N as i16, N as i16)) +vqshluq_n_s16_(a, int16x8_t([N as i16, N as i16, N as i16, N as i16, N as i16, N as i16, N as i16, N as i16])) } /// Signed saturating shift left unsigned @@ -23117,7 +23117,7 @@ pub unsafe fn vqshluq_n_s16(a: int16x8_t) -> uint16x8_t { #[cfg_attr(any(target_arch = "aarch64", target_arch = "arm64ec"), link_name = "llvm.aarch64.neon.sqshlu.v8i16")] fn vqshluq_n_s16_(a: int16x8_t, n: int16x8_t) -> uint16x8_t; } -vqshluq_n_s16_(a, int16x8_t(N as i16, N as i16, N as i16, N as i16, N as i16, N as i16, N as i16, N as i16)) +vqshluq_n_s16_(a, int16x8_t([N as i16, N as i16, N as i16, N as i16, N as i16, N as i16, N as i16, N as i16])) } /// Signed saturating shift left unsigned @@ -23136,7 +23136,7 @@ pub unsafe fn vqshluq_n_s32(a: int32x4_t) -> uint32x4_t { #[cfg_attr(target_arch = "arm", link_name = "llvm.arm.neon.vqshiftsu.v4i32")] fn vqshluq_n_s32_(a: int32x4_t, n: int32x4_t) -> uint32x4_t; } -vqshluq_n_s32_(a, int32x4_t(N as i32, N as i32, N as i32, N as i32)) +vqshluq_n_s32_(a, int32x4_t([N as i32, N as i32, N as i32, N as i32])) } /// Signed saturating shift left unsigned @@ -23155,7 +23155,7 @@ pub unsafe fn vqshluq_n_s32(a: int32x4_t) -> uint32x4_t { #[cfg_attr(any(target_arch = "aarch64", target_arch = "arm64ec"), link_name = "llvm.aarch64.neon.sqshlu.v4i32")] fn vqshluq_n_s32_(a: int32x4_t, n: int32x4_t) -> uint32x4_t; } -vqshluq_n_s32_(a, int32x4_t(N as i32, N as i32, N as i32, N as i32)) +vqshluq_n_s32_(a, int32x4_t([N as i32, N as i32, N as i32, N as i32])) } /// Signed saturating shift left unsigned @@ -23174,7 +23174,7 @@ pub unsafe fn vqshluq_n_s64(a: int64x2_t) -> uint64x2_t { #[cfg_attr(target_arch = "arm", link_name = "llvm.arm.neon.vqshiftsu.v2i64")] fn vqshluq_n_s64_(a: int64x2_t, n: int64x2_t) -> uint64x2_t; } -vqshluq_n_s64_(a, int64x2_t(N as i64, N as i64)) +vqshluq_n_s64_(a, int64x2_t([N as i64, N as i64])) } /// Signed saturating shift left unsigned @@ -23193,7 +23193,7 @@ pub unsafe fn vqshluq_n_s64(a: int64x2_t) -> uint64x2_t { #[cfg_attr(any(target_arch = "aarch64", target_arch = "arm64ec"), link_name = "llvm.aarch64.neon.sqshlu.v2i64")] fn vqshluq_n_s64_(a: int64x2_t, n: int64x2_t) -> uint64x2_t; } -vqshluq_n_s64_(a, int64x2_t(N as i64, N as i64)) +vqshluq_n_s64_(a, int64x2_t([N as i64, N as i64])) } /// Signed saturating shift right narrow @@ -23212,7 +23212,7 @@ pub unsafe fn vqshrn_n_s16(a: int16x8_t) -> int8x8_t { #[cfg_attr(target_arch = "arm", link_name = "llvm.arm.neon.vqshiftns.v8i8")] fn vqshrn_n_s16_(a: int16x8_t, n: int16x8_t) -> int8x8_t; } -vqshrn_n_s16_(a, int16x8_t(-N as i16, -N as i16, -N as i16, -N as i16, -N as i16, -N as i16, -N as i16, -N as i16)) +vqshrn_n_s16_(a, int16x8_t([-N as i16, -N as i16, -N as i16, -N as i16, -N as i16, -N as i16, -N as i16, -N as i16])) } /// Signed saturating shift right narrow @@ -23250,7 +23250,7 @@ pub unsafe fn vqshrn_n_s32(a: int32x4_t) -> int16x4_t { #[cfg_attr(target_arch = "arm", link_name = "llvm.arm.neon.vqshiftns.v4i16")] fn vqshrn_n_s32_(a: int32x4_t, n: int32x4_t) -> int16x4_t; } -vqshrn_n_s32_(a, int32x4_t(-N as i32, -N as i32, -N as i32, -N as i32)) +vqshrn_n_s32_(a, int32x4_t([-N as i32, -N as i32, -N as i32, -N as i32])) } /// Signed saturating shift right narrow @@ -23288,7 +23288,7 @@ pub unsafe fn vqshrn_n_s64(a: int64x2_t) -> int32x2_t { #[cfg_attr(target_arch = "arm", link_name = "llvm.arm.neon.vqshiftns.v2i32")] fn vqshrn_n_s64_(a: int64x2_t, n: int64x2_t) -> int32x2_t; } -vqshrn_n_s64_(a, int64x2_t(-N as i64, -N as i64)) +vqshrn_n_s64_(a, int64x2_t([-N as i64, -N as i64])) } /// Signed saturating shift right narrow @@ -23326,7 +23326,7 @@ pub unsafe fn vqshrn_n_u16(a: uint16x8_t) -> uint8x8_t { #[cfg_attr(target_arch = "arm", link_name = "llvm.arm.neon.vqshiftnu.v8i8")] fn vqshrn_n_u16_(a: uint16x8_t, n: uint16x8_t) -> uint8x8_t; } -vqshrn_n_u16_(a, uint16x8_t(-N as u16, -N as u16, -N as u16, -N as u16, -N as u16, -N as u16, -N as u16, -N as u16)) +vqshrn_n_u16_(a, uint16x8_t([-N as u16, -N as u16, -N as u16, -N as u16, -N as u16, -N as u16, -N as u16, -N as u16])) } /// Unsigned saturating shift right narrow @@ -23364,7 +23364,7 @@ pub unsafe fn vqshrn_n_u32(a: uint32x4_t) -> uint16x4_t { #[cfg_attr(target_arch = "arm", link_name = "llvm.arm.neon.vqshiftnu.v4i16")] fn vqshrn_n_u32_(a: uint32x4_t, n: uint32x4_t) -> uint16x4_t; } -vqshrn_n_u32_(a, uint32x4_t(-N as u32, -N as u32, -N as u32, -N as u32)) +vqshrn_n_u32_(a, uint32x4_t([-N as u32, -N as u32, -N as u32, -N as u32])) } /// Unsigned saturating shift right narrow @@ -23402,7 +23402,7 @@ pub unsafe fn vqshrn_n_u64(a: uint64x2_t) -> uint32x2_t { #[cfg_attr(target_arch = "arm", link_name = "llvm.arm.neon.vqshiftnu.v2i32")] fn vqshrn_n_u64_(a: uint64x2_t, n: uint64x2_t) -> uint32x2_t; } -vqshrn_n_u64_(a, uint64x2_t(-N as u64, -N as u64)) +vqshrn_n_u64_(a, uint64x2_t([-N as u64, -N as u64])) } /// Unsigned saturating shift right narrow @@ -23440,7 +23440,7 @@ pub unsafe fn vqshrun_n_s16(a: int16x8_t) -> uint8x8_t { #[cfg_attr(target_arch = "arm", link_name = "llvm.arm.neon.vqshiftnsu.v8i8")] fn vqshrun_n_s16_(a: int16x8_t, n: int16x8_t) -> uint8x8_t; } -vqshrun_n_s16_(a, int16x8_t(-N as i16, -N as i16, -N as i16, -N as i16, -N as i16, -N as i16, -N as i16, -N as i16)) +vqshrun_n_s16_(a, int16x8_t([-N as i16, -N as i16, -N as i16, -N as i16, -N as i16, -N as i16, -N as i16, -N as i16])) } /// Signed saturating shift right unsigned narrow @@ -23478,7 +23478,7 @@ pub unsafe fn vqshrun_n_s32(a: int32x4_t) -> uint16x4_t { #[cfg_attr(target_arch = "arm", link_name = "llvm.arm.neon.vqshiftnsu.v4i16")] fn vqshrun_n_s32_(a: int32x4_t, n: int32x4_t) -> uint16x4_t; } -vqshrun_n_s32_(a, int32x4_t(-N as i32, -N as i32, -N as i32, -N as i32)) +vqshrun_n_s32_(a, int32x4_t([-N as i32, -N as i32, -N as i32, -N as i32])) } /// Signed saturating shift right unsigned narrow @@ -23516,7 +23516,7 @@ pub unsafe fn vqshrun_n_s64(a: int64x2_t) -> uint32x2_t { #[cfg_attr(target_arch = "arm", link_name = "llvm.arm.neon.vqshiftnsu.v2i32")] fn vqshrun_n_s64_(a: int64x2_t, n: int64x2_t) -> uint32x2_t; } -vqshrun_n_s64_(a, int64x2_t(-N as i64, -N as i64)) +vqshrun_n_s64_(a, int64x2_t([-N as i64, -N as i64])) } /// Signed saturating shift right unsigned narrow @@ -28234,7 +28234,7 @@ pub unsafe fn vrshrn_n_s16(a: int16x8_t) -> int8x8_t { #[cfg_attr(target_arch = "arm", link_name = "llvm.arm.neon.vrshiftn.v8i8")] fn vrshrn_n_s16_(a: int16x8_t, n: int16x8_t) -> int8x8_t; } -vrshrn_n_s16_(a, int16x8_t(-N as i16, -N as i16, -N as i16, -N as i16, -N as i16, -N as i16, -N as i16, -N as i16)) +vrshrn_n_s16_(a, int16x8_t([-N as i16, -N as i16, -N as i16, -N as i16, -N as i16, -N as i16, -N as i16, -N as i16])) } /// Rounding shift right narrow @@ -28272,7 +28272,7 @@ pub unsafe fn vrshrn_n_s32(a: int32x4_t) -> int16x4_t { #[cfg_attr(target_arch = "arm", link_name = "llvm.arm.neon.vrshiftn.v4i16")] fn vrshrn_n_s32_(a: int32x4_t, n: int32x4_t) -> int16x4_t; } -vrshrn_n_s32_(a, int32x4_t(-N as i32, -N as i32, -N as i32, -N as i32)) +vrshrn_n_s32_(a, int32x4_t([-N as i32, -N as i32, -N as i32, -N as i32])) } /// Rounding shift right narrow @@ -28310,7 +28310,7 @@ pub unsafe fn vrshrn_n_s64(a: int64x2_t) -> int32x2_t { #[cfg_attr(target_arch = "arm", link_name = "llvm.arm.neon.vrshiftn.v2i32")] fn vrshrn_n_s64_(a: int64x2_t, n: int64x2_t) -> int32x2_t; } -vrshrn_n_s64_(a, int64x2_t(-N as i64, -N as i64)) +vrshrn_n_s64_(a, int64x2_t([-N as i64, -N as i64])) } /// Rounding shift right narrow diff --git a/crates/core_arch/src/arm_shared/neon/mod.rs b/crates/core_arch/src/arm_shared/neon/mod.rs index fd686c3409..dca8a53f35 100644 --- a/crates/core_arch/src/arm_shared/neon/mod.rs +++ b/crates/core_arch/src/arm_shared/neon/mod.rs @@ -20,113 +20,104 @@ 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"))] #[cfg_attr(target_arch = "arm", unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800"))] - 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(8 x pub(crate) i8); /// ARM-specific 64-bit wide vector of eight packed `u8`. #[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"))] - 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(8 x pub(crate) u8); /// 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"))] #[cfg_attr(target_arch = "arm", unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800"))] - 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(8 x pub(crate) p8); /// ARM-specific 64-bit wide vector of four packed `i16`. #[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"))] - pub struct int16x4_t(pub(crate) i16, pub(crate) i16, pub(crate) i16, pub(crate) i16); + pub struct int16x4_t(4 x pub(crate) i16); /// ARM-specific 64-bit wide vector of four packed `u16`. #[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"))] - pub struct uint16x4_t(pub(crate) u16, pub(crate) u16, pub(crate) u16, pub(crate) u16); + pub struct uint16x4_t(4 x pub(crate) u16); // 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"))] #[cfg_attr(target_arch = "arm", unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800"))] - pub struct poly16x4_t(pub(crate) p16, pub(crate) p16, pub(crate) p16, pub(crate) p16); + pub struct poly16x4_t(4 x pub(crate) p16); /// ARM-specific 64-bit wide vector of two packed `i32`. #[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"))] - pub struct int32x2_t(pub(crate) i32, pub(crate) i32); + pub struct int32x2_t(2 x pub(crate) i32); /// ARM-specific 64-bit wide vector of two packed `u32`. #[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"))] - pub struct uint32x2_t(pub(crate) u32, pub(crate) u32); + pub struct uint32x2_t(2 x pub(crate) u32); /// ARM-specific 64-bit wide vector of two packed `f32`. #[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"))] - pub struct float32x2_t(pub(crate) f32, pub(crate) f32); + pub struct float32x2_t(2 x pub(crate) f32); /// ARM-specific 64-bit wide vector of one packed `i64`. #[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"))] - pub struct int64x1_t(pub(crate) i64); + pub struct int64x1_t(1 x pub(crate) i64); /// ARM-specific 64-bit wide vector of one packed `u64`. #[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"))] - pub struct uint64x1_t(pub(crate) u64); + pub struct uint64x1_t(1 x pub(crate) u64); /// ARM-specific 64-bit wide vector of one packed `p64`. #[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"))] - pub struct poly64x1_t(pub(crate) p64); + pub struct poly64x1_t(1 x pub(crate) p64); /// ARM-specific 128-bit wide vector of sixteen packed `i8`. #[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"))] - 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(16 x pub(crate) i8); /// ARM-specific 128-bit wide vector of sixteen packed `u8`. #[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"))] - 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(16 x pub(crate) u8); /// ARM-specific 128-bit wide vector of sixteen packed `p8`. #[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"))] - 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(16 x pub(crate) p8); /// ARM-specific 128-bit wide vector of eight packed `i16`. #[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"))] - 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(8 x pub(crate) i16); /// ARM-specific 128-bit wide vector of eight packed `u16`. #[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"))] - 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(8 x pub(crate) u16); // 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"))] #[cfg_attr(target_arch = "arm", unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800"))] - 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(8 x pub(crate) p16); /// ARM-specific 128-bit wide vector of four packed `i32`. #[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"))] - pub struct int32x4_t(pub(crate) i32, pub(crate) i32, pub(crate) i32, pub(crate) i32); + pub struct int32x4_t(4 x pub(crate) i32); /// ARM-specific 128-bit wide vector of four packed `u32`. #[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"))] - pub struct uint32x4_t(pub(crate) u32, pub(crate) u32, pub(crate) u32, pub(crate) u32); + pub struct uint32x4_t(4 x pub(crate) u32); /// ARM-specific 128-bit wide vector of four packed `f32`. #[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"))] - pub struct float32x4_t(pub(crate) f32, pub(crate) f32, pub(crate) f32, pub(crate) f32); + pub struct float32x4_t(4 x pub(crate) f32); /// ARM-specific 128-bit wide vector of two packed `i64`. #[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"))] - pub struct int64x2_t(pub(crate) i64, pub(crate) i64); + pub struct int64x2_t(2 x pub(crate) i64); /// ARM-specific 128-bit wide vector of two packed `u64`. #[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"))] - pub struct uint64x2_t(pub(crate) u64, pub(crate) u64); + pub struct uint64x2_t(2 x pub(crate) u64); /// ARM-specific 128-bit wide vector of two packed `p64`. #[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"))] - pub struct poly64x2_t(pub(crate) p64, pub(crate) p64); + pub struct poly64x2_t(2 x pub(crate) p64); } /// ARM-specific type containing two `int8x8_t` vectors. @@ -3868,7 +3859,7 @@ pub unsafe fn vaddw_high_u32(a: uint64x2_t, b: uint32x4_t) -> uint64x2_t { unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub unsafe fn vaddhn_s16(a: int16x8_t, b: int16x8_t) -> int8x8_t { - simd_cast(simd_shr(simd_add(a, b), int16x8_t(8, 8, 8, 8, 8, 8, 8, 8))) + simd_cast(simd_shr(simd_add(a, b), int16x8_t::splat(8))) } /// Add returning High Narrow. @@ -3889,7 +3880,7 @@ pub unsafe fn vaddhn_s16(a: int16x8_t, b: int16x8_t) -> int8x8_t { unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub unsafe fn vaddhn_s32(a: int32x4_t, b: int32x4_t) -> int16x4_t { - simd_cast(simd_shr(simd_add(a, b), int32x4_t(16, 16, 16, 16))) + simd_cast(simd_shr(simd_add(a, b), int32x4_t::splat(16))) } /// Add returning High Narrow. @@ -3910,7 +3901,7 @@ pub unsafe fn vaddhn_s32(a: int32x4_t, b: int32x4_t) -> int16x4_t { unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub unsafe fn vaddhn_s64(a: int64x2_t, b: int64x2_t) -> int32x2_t { - simd_cast(simd_shr(simd_add(a, b), int64x2_t(32, 32))) + simd_cast(simd_shr(simd_add(a, b), int64x2_t::splat(32))) } /// Add returning High Narrow. @@ -3931,7 +3922,7 @@ pub unsafe fn vaddhn_s64(a: int64x2_t, b: int64x2_t) -> int32x2_t { unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub unsafe fn vaddhn_u16(a: uint16x8_t, b: uint16x8_t) -> uint8x8_t { - simd_cast(simd_shr(simd_add(a, b), uint16x8_t(8, 8, 8, 8, 8, 8, 8, 8))) + simd_cast(simd_shr(simd_add(a, b), uint16x8_t::splat(8))) } /// Add returning High Narrow. @@ -3952,7 +3943,7 @@ pub unsafe fn vaddhn_u16(a: uint16x8_t, b: uint16x8_t) -> uint8x8_t { unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub unsafe fn vaddhn_u32(a: uint32x4_t, b: uint32x4_t) -> uint16x4_t { - simd_cast(simd_shr(simd_add(a, b), uint32x4_t(16, 16, 16, 16))) + simd_cast(simd_shr(simd_add(a, b), uint32x4_t::splat(16))) } /// Add returning High Narrow. @@ -3973,7 +3964,7 @@ pub unsafe fn vaddhn_u32(a: uint32x4_t, b: uint32x4_t) -> uint16x4_t { unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub unsafe fn vaddhn_u64(a: uint64x2_t, b: uint64x2_t) -> uint32x2_t { - simd_cast(simd_shr(simd_add(a, b), uint64x2_t(32, 32))) + simd_cast(simd_shr(simd_add(a, b), uint64x2_t::splat(32))) } /// Add returning High Narrow (high half). @@ -3994,7 +3985,7 @@ pub unsafe fn vaddhn_u64(a: uint64x2_t, b: uint64x2_t) -> uint32x2_t { unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub unsafe fn vaddhn_high_s16(r: int8x8_t, a: int16x8_t, b: int16x8_t) -> int8x16_t { - let x = simd_cast(simd_shr(simd_add(a, b), int16x8_t(8, 8, 8, 8, 8, 8, 8, 8))); + let x = simd_cast(simd_shr(simd_add(a, b), int16x8_t::splat(8))); simd_shuffle!(r, x, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]) } @@ -4016,7 +4007,7 @@ pub unsafe fn vaddhn_high_s16(r: int8x8_t, a: int16x8_t, b: int16x8_t) -> int8x1 unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub unsafe fn vaddhn_high_s32(r: int16x4_t, a: int32x4_t, b: int32x4_t) -> int16x8_t { - let x = simd_cast(simd_shr(simd_add(a, b), int32x4_t(16, 16, 16, 16))); + let x = simd_cast(simd_shr(simd_add(a, b), int32x4_t::splat(16))); simd_shuffle!(r, x, [0, 1, 2, 3, 4, 5, 6, 7]) } @@ -4038,7 +4029,7 @@ pub unsafe fn vaddhn_high_s32(r: int16x4_t, a: int32x4_t, b: int32x4_t) -> int16 unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub unsafe fn vaddhn_high_s64(r: int32x2_t, a: int64x2_t, b: int64x2_t) -> int32x4_t { - let x = simd_cast(simd_shr(simd_add(a, b), int64x2_t(32, 32))); + let x = simd_cast(simd_shr(simd_add(a, b), int64x2_t::splat(32))); simd_shuffle!(r, x, [0, 1, 2, 3]) } @@ -4060,7 +4051,7 @@ pub unsafe fn vaddhn_high_s64(r: int32x2_t, a: int64x2_t, b: int64x2_t) -> int32 unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub unsafe fn vaddhn_high_u16(r: uint8x8_t, a: uint16x8_t, b: uint16x8_t) -> uint8x16_t { - let x = simd_cast(simd_shr(simd_add(a, b), uint16x8_t(8, 8, 8, 8, 8, 8, 8, 8))); + let x = simd_cast(simd_shr(simd_add(a, b), uint16x8_t::splat(8))); simd_shuffle!(r, x, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]) } @@ -4082,7 +4073,7 @@ pub unsafe fn vaddhn_high_u16(r: uint8x8_t, a: uint16x8_t, b: uint16x8_t) -> uin unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub unsafe fn vaddhn_high_u32(r: uint16x4_t, a: uint32x4_t, b: uint32x4_t) -> uint16x8_t { - let x = simd_cast(simd_shr(simd_add(a, b), uint32x4_t(16, 16, 16, 16))); + let x = simd_cast(simd_shr(simd_add(a, b), uint32x4_t::splat(16))); simd_shuffle!(r, x, [0, 1, 2, 3, 4, 5, 6, 7]) } @@ -4104,7 +4095,7 @@ pub unsafe fn vaddhn_high_u32(r: uint16x4_t, a: uint32x4_t, b: uint32x4_t) -> ui unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub unsafe fn vaddhn_high_u64(r: uint32x2_t, a: uint64x2_t, b: uint64x2_t) -> uint32x4_t { - let x = simd_cast(simd_shr(simd_add(a, b), uint64x2_t(32, 32))); + let x = simd_cast(simd_shr(simd_add(a, b), uint64x2_t::splat(32))); simd_shuffle!(r, x, [0, 1, 2, 3]) } @@ -4888,7 +4879,7 @@ pub unsafe fn vmovl_u32(a: uint32x2_t) -> uint64x2_t { unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub unsafe fn vmvn_s8(a: int8x8_t) -> int8x8_t { - let b = int8x8_t(-1, -1, -1, -1, -1, -1, -1, -1); + let b = int8x8_t::splat(-1); simd_xor(a, b) } @@ -4910,9 +4901,7 @@ pub unsafe fn vmvn_s8(a: int8x8_t) -> int8x8_t { unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub unsafe fn vmvnq_s8(a: int8x16_t) -> int8x16_t { - let b = int8x16_t( - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - ); + let b = int8x16_t::splat(-1); simd_xor(a, b) } @@ -4934,7 +4923,7 @@ pub unsafe fn vmvnq_s8(a: int8x16_t) -> int8x16_t { unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub unsafe fn vmvn_s16(a: int16x4_t) -> int16x4_t { - let b = int16x4_t(-1, -1, -1, -1); + let b = int16x4_t::splat(-1); simd_xor(a, b) } @@ -4956,7 +4945,7 @@ pub unsafe fn vmvn_s16(a: int16x4_t) -> int16x4_t { unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub unsafe fn vmvnq_s16(a: int16x8_t) -> int16x8_t { - let b = int16x8_t(-1, -1, -1, -1, -1, -1, -1, -1); + let b = int16x8_t::splat(-1); simd_xor(a, b) } @@ -4978,7 +4967,7 @@ pub unsafe fn vmvnq_s16(a: int16x8_t) -> int16x8_t { unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub unsafe fn vmvn_s32(a: int32x2_t) -> int32x2_t { - let b = int32x2_t(-1, -1); + let b = int32x2_t::splat(-1); simd_xor(a, b) } @@ -5000,7 +4989,7 @@ pub unsafe fn vmvn_s32(a: int32x2_t) -> int32x2_t { unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub unsafe fn vmvnq_s32(a: int32x4_t) -> int32x4_t { - let b = int32x4_t(-1, -1, -1, -1); + let b = int32x4_t::splat(-1); simd_xor(a, b) } @@ -5022,7 +5011,7 @@ pub unsafe fn vmvnq_s32(a: int32x4_t) -> int32x4_t { unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub unsafe fn vmvn_u8(a: uint8x8_t) -> uint8x8_t { - let b = uint8x8_t(255, 255, 255, 255, 255, 255, 255, 255); + let b = uint8x8_t::splat(255); simd_xor(a, b) } @@ -5044,9 +5033,7 @@ pub unsafe fn vmvn_u8(a: uint8x8_t) -> uint8x8_t { unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub unsafe fn vmvnq_u8(a: uint8x16_t) -> uint8x16_t { - let b = uint8x16_t( - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - ); + let b = uint8x16_t::splat(255); simd_xor(a, b) } @@ -5068,7 +5055,7 @@ pub unsafe fn vmvnq_u8(a: uint8x16_t) -> uint8x16_t { unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub unsafe fn vmvn_u16(a: uint16x4_t) -> uint16x4_t { - let b = uint16x4_t(65_535, 65_535, 65_535, 65_535); + let b = uint16x4_t::splat(65_535); simd_xor(a, b) } @@ -5090,9 +5077,7 @@ pub unsafe fn vmvn_u16(a: uint16x4_t) -> uint16x4_t { unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub unsafe fn vmvnq_u16(a: uint16x8_t) -> uint16x8_t { - let b = uint16x8_t( - 65_535, 65_535, 65_535, 65_535, 65_535, 65_535, 65_535, 65_535, - ); + let b = uint16x8_t::splat(65_535); simd_xor(a, b) } @@ -5114,7 +5099,7 @@ pub unsafe fn vmvnq_u16(a: uint16x8_t) -> uint16x8_t { unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub unsafe fn vmvn_u32(a: uint32x2_t) -> uint32x2_t { - let b = uint32x2_t(4_294_967_295, 4_294_967_295); + let b = uint32x2_t::splat(4_294_967_295); simd_xor(a, b) } @@ -5136,7 +5121,7 @@ pub unsafe fn vmvn_u32(a: uint32x2_t) -> uint32x2_t { unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub unsafe fn vmvnq_u32(a: uint32x4_t) -> uint32x4_t { - let b = uint32x4_t(4_294_967_295, 4_294_967_295, 4_294_967_295, 4_294_967_295); + let b = uint32x4_t::splat(4_294_967_295); simd_xor(a, b) } @@ -5158,7 +5143,7 @@ pub unsafe fn vmvnq_u32(a: uint32x4_t) -> uint32x4_t { unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub unsafe fn vmvn_p8(a: poly8x8_t) -> poly8x8_t { - let b = poly8x8_t(255, 255, 255, 255, 255, 255, 255, 255); + let b = poly8x8_t::splat(255); simd_xor(a, b) } @@ -5180,9 +5165,7 @@ pub unsafe fn vmvn_p8(a: poly8x8_t) -> poly8x8_t { unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub unsafe fn vmvnq_p8(a: poly8x16_t) -> poly8x16_t { - let b = poly8x16_t( - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - ); + let b = poly8x16_t::splat(255); simd_xor(a, b) } @@ -5204,7 +5187,7 @@ pub unsafe fn vmvnq_p8(a: poly8x16_t) -> poly8x16_t { unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub unsafe fn vbic_s8(a: int8x8_t, b: int8x8_t) -> int8x8_t { - let c = int8x8_t(-1, -1, -1, -1, -1, -1, -1, -1); + let c = int8x8_t::splat(-1); simd_and(simd_xor(b, c), a) } @@ -5226,9 +5209,7 @@ pub unsafe fn vbic_s8(a: int8x8_t, b: int8x8_t) -> int8x8_t { unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub unsafe fn vbicq_s8(a: int8x16_t, b: int8x16_t) -> int8x16_t { - let c = int8x16_t( - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - ); + let c = int8x16_t::splat(-1); simd_and(simd_xor(b, c), a) } @@ -5250,7 +5231,7 @@ pub unsafe fn vbicq_s8(a: int8x16_t, b: int8x16_t) -> int8x16_t { unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub unsafe fn vbic_s16(a: int16x4_t, b: int16x4_t) -> int16x4_t { - let c = int16x4_t(-1, -1, -1, -1); + let c = int16x4_t::splat(-1); simd_and(simd_xor(b, c), a) } @@ -5272,7 +5253,7 @@ pub unsafe fn vbic_s16(a: int16x4_t, b: int16x4_t) -> int16x4_t { unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub unsafe fn vbicq_s16(a: int16x8_t, b: int16x8_t) -> int16x8_t { - let c = int16x8_t(-1, -1, -1, -1, -1, -1, -1, -1); + let c = int16x8_t::splat(-1); simd_and(simd_xor(b, c), a) } @@ -5294,7 +5275,7 @@ pub unsafe fn vbicq_s16(a: int16x8_t, b: int16x8_t) -> int16x8_t { unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub unsafe fn vbic_s32(a: int32x2_t, b: int32x2_t) -> int32x2_t { - let c = int32x2_t(-1, -1); + let c = int32x2_t::splat(-1); simd_and(simd_xor(b, c), a) } @@ -5316,7 +5297,7 @@ pub unsafe fn vbic_s32(a: int32x2_t, b: int32x2_t) -> int32x2_t { unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub unsafe fn vbicq_s32(a: int32x4_t, b: int32x4_t) -> int32x4_t { - let c = int32x4_t(-1, -1, -1, -1); + let c = int32x4_t::splat(-1); simd_and(simd_xor(b, c), a) } @@ -5338,7 +5319,7 @@ pub unsafe fn vbicq_s32(a: int32x4_t, b: int32x4_t) -> int32x4_t { unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub unsafe fn vbic_s64(a: int64x1_t, b: int64x1_t) -> int64x1_t { - let c = int64x1_t(-1); + let c = int64x1_t::splat(-1); simd_and(simd_xor(b, c), a) } @@ -5360,7 +5341,7 @@ pub unsafe fn vbic_s64(a: int64x1_t, b: int64x1_t) -> int64x1_t { unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub unsafe fn vbicq_s64(a: int64x2_t, b: int64x2_t) -> int64x2_t { - let c = int64x2_t(-1, -1); + let c = int64x2_t::splat(-1); simd_and(simd_xor(b, c), a) } @@ -5382,7 +5363,7 @@ pub unsafe fn vbicq_s64(a: int64x2_t, b: int64x2_t) -> int64x2_t { unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub unsafe fn vbic_u8(a: uint8x8_t, b: uint8x8_t) -> uint8x8_t { - let c = int8x8_t(-1, -1, -1, -1, -1, -1, -1, -1); + let c = int8x8_t::splat(-1); simd_and(simd_xor(b, transmute(c)), a) } @@ -5404,9 +5385,7 @@ pub unsafe fn vbic_u8(a: uint8x8_t, b: uint8x8_t) -> uint8x8_t { unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub unsafe fn vbicq_u8(a: uint8x16_t, b: uint8x16_t) -> uint8x16_t { - let c = int8x16_t( - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - ); + let c = int8x16_t::splat(-1); simd_and(simd_xor(b, transmute(c)), a) } @@ -5428,7 +5407,7 @@ pub unsafe fn vbicq_u8(a: uint8x16_t, b: uint8x16_t) -> uint8x16_t { unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub unsafe fn vbic_u16(a: uint16x4_t, b: uint16x4_t) -> uint16x4_t { - let c = int16x4_t(-1, -1, -1, -1); + let c = int16x4_t::splat(-1); simd_and(simd_xor(b, transmute(c)), a) } @@ -5450,7 +5429,7 @@ pub unsafe fn vbic_u16(a: uint16x4_t, b: uint16x4_t) -> uint16x4_t { unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub unsafe fn vbicq_u16(a: uint16x8_t, b: uint16x8_t) -> uint16x8_t { - let c = int16x8_t(-1, -1, -1, -1, -1, -1, -1, -1); + let c = int16x8_t::splat(-1); simd_and(simd_xor(b, transmute(c)), a) } @@ -5472,7 +5451,7 @@ pub unsafe fn vbicq_u16(a: uint16x8_t, b: uint16x8_t) -> uint16x8_t { unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub unsafe fn vbic_u32(a: uint32x2_t, b: uint32x2_t) -> uint32x2_t { - let c = int32x2_t(-1, -1); + let c = int32x2_t::splat(-1); simd_and(simd_xor(b, transmute(c)), a) } @@ -5494,7 +5473,7 @@ pub unsafe fn vbic_u32(a: uint32x2_t, b: uint32x2_t) -> uint32x2_t { unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub unsafe fn vbicq_u32(a: uint32x4_t, b: uint32x4_t) -> uint32x4_t { - let c = int32x4_t(-1, -1, -1, -1); + let c = int32x4_t::splat(-1); simd_and(simd_xor(b, transmute(c)), a) } @@ -5516,7 +5495,7 @@ pub unsafe fn vbicq_u32(a: uint32x4_t, b: uint32x4_t) -> uint32x4_t { unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub unsafe fn vbic_u64(a: uint64x1_t, b: uint64x1_t) -> uint64x1_t { - let c = int64x1_t(-1); + let c = int64x1_t::splat(-1); simd_and(simd_xor(b, transmute(c)), a) } @@ -5538,7 +5517,7 @@ pub unsafe fn vbic_u64(a: uint64x1_t, b: uint64x1_t) -> uint64x1_t { unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub unsafe fn vbicq_u64(a: uint64x2_t, b: uint64x2_t) -> uint64x2_t { - let c = int64x2_t(-1, -1); + let c = int64x2_t::splat(-1); simd_and(simd_xor(b, transmute(c)), a) } @@ -5564,7 +5543,7 @@ pub unsafe fn vbicq_u64(a: uint64x2_t, b: uint64x2_t) -> uint64x2_t { unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub unsafe fn vbsl_s8(a: uint8x8_t, b: int8x8_t, c: int8x8_t) -> int8x8_t { - let not = int8x8_t(-1, -1, -1, -1, -1, -1, -1, -1); + let not = int8x8_t::splat(-1); transmute(simd_or( simd_and(a, transmute(b)), simd_and(simd_xor(a, transmute(not)), transmute(c)), @@ -5589,7 +5568,7 @@ pub unsafe fn vbsl_s8(a: uint8x8_t, b: int8x8_t, c: int8x8_t) -> int8x8_t { unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub unsafe fn vbsl_s16(a: uint16x4_t, b: int16x4_t, c: int16x4_t) -> int16x4_t { - let not = int16x4_t(-1, -1, -1, -1); + let not = int16x4_t::splat(-1); transmute(simd_or( simd_and(a, transmute(b)), simd_and(simd_xor(a, transmute(not)), transmute(c)), @@ -5614,7 +5593,7 @@ pub unsafe fn vbsl_s16(a: uint16x4_t, b: int16x4_t, c: int16x4_t) -> int16x4_t { unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub unsafe fn vbsl_s32(a: uint32x2_t, b: int32x2_t, c: int32x2_t) -> int32x2_t { - let not = int32x2_t(-1, -1); + let not = int32x2_t::splat(-1); transmute(simd_or( simd_and(a, transmute(b)), simd_and(simd_xor(a, transmute(not)), transmute(c)), @@ -5639,7 +5618,7 @@ pub unsafe fn vbsl_s32(a: uint32x2_t, b: int32x2_t, c: int32x2_t) -> int32x2_t { unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub unsafe fn vbsl_s64(a: uint64x1_t, b: int64x1_t, c: int64x1_t) -> int64x1_t { - let not = int64x1_t(-1); + let not = int64x1_t::splat(-1); transmute(simd_or( simd_and(a, transmute(b)), simd_and(simd_xor(a, transmute(not)), transmute(c)), @@ -5664,7 +5643,7 @@ pub unsafe fn vbsl_s64(a: uint64x1_t, b: int64x1_t, c: int64x1_t) -> int64x1_t { unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub unsafe fn vbsl_u8(a: uint8x8_t, b: uint8x8_t, c: uint8x8_t) -> uint8x8_t { - let not = int8x8_t(-1, -1, -1, -1, -1, -1, -1, -1); + let not = int8x8_t::splat(-1); simd_or(simd_and(a, b), simd_and(simd_xor(a, transmute(not)), c)) } @@ -5686,7 +5665,7 @@ pub unsafe fn vbsl_u8(a: uint8x8_t, b: uint8x8_t, c: uint8x8_t) -> uint8x8_t { unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub unsafe fn vbsl_u16(a: uint16x4_t, b: uint16x4_t, c: uint16x4_t) -> uint16x4_t { - let not = int16x4_t(-1, -1, -1, -1); + let not = int16x4_t::splat(-1); simd_or(simd_and(a, b), simd_and(simd_xor(a, transmute(not)), c)) } @@ -5708,7 +5687,7 @@ pub unsafe fn vbsl_u16(a: uint16x4_t, b: uint16x4_t, c: uint16x4_t) -> uint16x4_ unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub unsafe fn vbsl_u32(a: uint32x2_t, b: uint32x2_t, c: uint32x2_t) -> uint32x2_t { - let not = int32x2_t(-1, -1); + let not = int32x2_t::splat(-1); simd_or(simd_and(a, b), simd_and(simd_xor(a, transmute(not)), c)) } @@ -5730,7 +5709,7 @@ pub unsafe fn vbsl_u32(a: uint32x2_t, b: uint32x2_t, c: uint32x2_t) -> uint32x2_ unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub unsafe fn vbsl_u64(a: uint64x1_t, b: uint64x1_t, c: uint64x1_t) -> uint64x1_t { - let not = int64x1_t(-1); + let not = int64x1_t::splat(-1); simd_or(simd_and(a, b), simd_and(simd_xor(a, transmute(not)), c)) } @@ -5752,7 +5731,7 @@ pub unsafe fn vbsl_u64(a: uint64x1_t, b: uint64x1_t, c: uint64x1_t) -> uint64x1_ unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub unsafe fn vbsl_f32(a: uint32x2_t, b: float32x2_t, c: float32x2_t) -> float32x2_t { - let not = int32x2_t(-1, -1); + let not = int32x2_t::splat(-1); transmute(simd_or( simd_and(a, transmute(b)), simd_and(simd_xor(a, transmute(not)), transmute(c)), @@ -5777,7 +5756,7 @@ pub unsafe fn vbsl_f32(a: uint32x2_t, b: float32x2_t, c: float32x2_t) -> float32 unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub unsafe fn vbsl_p8(a: uint8x8_t, b: poly8x8_t, c: poly8x8_t) -> poly8x8_t { - let not = int8x8_t(-1, -1, -1, -1, -1, -1, -1, -1); + let not = int8x8_t::splat(-1); transmute(simd_or( simd_and(a, transmute(b)), simd_and(simd_xor(a, transmute(not)), transmute(c)), @@ -5802,7 +5781,7 @@ pub unsafe fn vbsl_p8(a: uint8x8_t, b: poly8x8_t, c: poly8x8_t) -> poly8x8_t { unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub unsafe fn vbsl_p16(a: uint16x4_t, b: poly16x4_t, c: poly16x4_t) -> poly16x4_t { - let not = int16x4_t(-1, -1, -1, -1); + let not = int16x4_t::splat(-1); transmute(simd_or( simd_and(a, transmute(b)), simd_and(simd_xor(a, transmute(not)), transmute(c)), @@ -5827,9 +5806,7 @@ pub unsafe fn vbsl_p16(a: uint16x4_t, b: poly16x4_t, c: poly16x4_t) -> poly16x4_ unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub unsafe fn vbslq_s8(a: uint8x16_t, b: int8x16_t, c: int8x16_t) -> int8x16_t { - let not = int8x16_t( - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - ); + let not = int8x16_t::splat(-1); transmute(simd_or( simd_and(a, transmute(b)), simd_and(simd_xor(a, transmute(not)), transmute(c)), @@ -5854,7 +5831,7 @@ pub unsafe fn vbslq_s8(a: uint8x16_t, b: int8x16_t, c: int8x16_t) -> int8x16_t { unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub unsafe fn vbslq_s16(a: uint16x8_t, b: int16x8_t, c: int16x8_t) -> int16x8_t { - let not = int16x8_t(-1, -1, -1, -1, -1, -1, -1, -1); + let not = int16x8_t::splat(-1); transmute(simd_or( simd_and(a, transmute(b)), simd_and(simd_xor(a, transmute(not)), transmute(c)), @@ -5879,7 +5856,7 @@ pub unsafe fn vbslq_s16(a: uint16x8_t, b: int16x8_t, c: int16x8_t) -> int16x8_t unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub unsafe fn vbslq_s32(a: uint32x4_t, b: int32x4_t, c: int32x4_t) -> int32x4_t { - let not = int32x4_t(-1, -1, -1, -1); + let not = int32x4_t::splat(-1); transmute(simd_or( simd_and(a, transmute(b)), simd_and(simd_xor(a, transmute(not)), transmute(c)), @@ -5904,7 +5881,7 @@ pub unsafe fn vbslq_s32(a: uint32x4_t, b: int32x4_t, c: int32x4_t) -> int32x4_t unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub unsafe fn vbslq_s64(a: uint64x2_t, b: int64x2_t, c: int64x2_t) -> int64x2_t { - let not = int64x2_t(-1, -1); + let not = int64x2_t::splat(-1); transmute(simd_or( simd_and(a, transmute(b)), simd_and(simd_xor(a, transmute(not)), transmute(c)), @@ -5929,9 +5906,7 @@ pub unsafe fn vbslq_s64(a: uint64x2_t, b: int64x2_t, c: int64x2_t) -> int64x2_t unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub unsafe fn vbslq_u8(a: uint8x16_t, b: uint8x16_t, c: uint8x16_t) -> uint8x16_t { - let not = int8x16_t( - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - ); + let not = int8x16_t::splat(-1); simd_or(simd_and(a, b), simd_and(simd_xor(a, transmute(not)), c)) } @@ -5953,7 +5928,7 @@ pub unsafe fn vbslq_u8(a: uint8x16_t, b: uint8x16_t, c: uint8x16_t) -> uint8x16_ unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub unsafe fn vbslq_u16(a: uint16x8_t, b: uint16x8_t, c: uint16x8_t) -> uint16x8_t { - let not = int16x8_t(-1, -1, -1, -1, -1, -1, -1, -1); + let not = int16x8_t::splat(-1); simd_or(simd_and(a, b), simd_and(simd_xor(a, transmute(not)), c)) } @@ -5975,7 +5950,7 @@ pub unsafe fn vbslq_u16(a: uint16x8_t, b: uint16x8_t, c: uint16x8_t) -> uint16x8 unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub unsafe fn vbslq_u32(a: uint32x4_t, b: uint32x4_t, c: uint32x4_t) -> uint32x4_t { - let not = int32x4_t(-1, -1, -1, -1); + let not = int32x4_t::splat(-1); simd_or(simd_and(a, b), simd_and(simd_xor(a, transmute(not)), c)) } @@ -5997,7 +5972,7 @@ pub unsafe fn vbslq_u32(a: uint32x4_t, b: uint32x4_t, c: uint32x4_t) -> uint32x4 unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub unsafe fn vbslq_u64(a: uint64x2_t, b: uint64x2_t, c: uint64x2_t) -> uint64x2_t { - let not = int64x2_t(-1, -1); + let not = int64x2_t::splat(-1); simd_or(simd_and(a, b), simd_and(simd_xor(a, transmute(not)), c)) } @@ -6019,9 +5994,7 @@ pub unsafe fn vbslq_u64(a: uint64x2_t, b: uint64x2_t, c: uint64x2_t) -> uint64x2 unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub unsafe fn vbslq_p8(a: uint8x16_t, b: poly8x16_t, c: poly8x16_t) -> poly8x16_t { - let not = int8x16_t( - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - ); + let not = int8x16_t::splat(-1); transmute(simd_or( simd_and(a, transmute(b)), simd_and(simd_xor(a, transmute(not)), transmute(c)), @@ -6046,7 +6019,7 @@ pub unsafe fn vbslq_p8(a: uint8x16_t, b: poly8x16_t, c: poly8x16_t) -> poly8x16_ unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub unsafe fn vbslq_p16(a: uint16x8_t, b: poly16x8_t, c: poly16x8_t) -> poly16x8_t { - let not = int16x8_t(-1, -1, -1, -1, -1, -1, -1, -1); + let not = int16x8_t::splat(-1); transmute(simd_or( simd_and(a, transmute(b)), simd_and(simd_xor(a, transmute(not)), transmute(c)), @@ -6071,7 +6044,7 @@ pub unsafe fn vbslq_p16(a: uint16x8_t, b: poly16x8_t, c: poly16x8_t) -> poly16x8 unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub unsafe fn vbslq_f32(a: uint32x4_t, b: float32x4_t, c: float32x4_t) -> float32x4_t { - let not = int32x4_t(-1, -1, -1, -1); + let not = int32x4_t::splat(-1); transmute(simd_or( simd_and(a, transmute(b)), simd_and(simd_xor(a, transmute(not)), transmute(c)), @@ -6096,7 +6069,7 @@ pub unsafe fn vbslq_f32(a: uint32x4_t, b: float32x4_t, c: float32x4_t) -> float3 unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub unsafe fn vorn_s8(a: int8x8_t, b: int8x8_t) -> int8x8_t { - let c = int8x8_t(-1, -1, -1, -1, -1, -1, -1, -1); + let c = int8x8_t::splat(-1); simd_or(simd_xor(b, c), a) } @@ -6118,9 +6091,7 @@ pub unsafe fn vorn_s8(a: int8x8_t, b: int8x8_t) -> int8x8_t { unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub unsafe fn vornq_s8(a: int8x16_t, b: int8x16_t) -> int8x16_t { - let c = int8x16_t( - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - ); + let c = int8x16_t::splat(-1); simd_or(simd_xor(b, c), a) } @@ -6142,7 +6113,7 @@ pub unsafe fn vornq_s8(a: int8x16_t, b: int8x16_t) -> int8x16_t { unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub unsafe fn vorn_s16(a: int16x4_t, b: int16x4_t) -> int16x4_t { - let c = int16x4_t(-1, -1, -1, -1); + let c = int16x4_t::splat(-1); simd_or(simd_xor(b, c), a) } @@ -6164,7 +6135,7 @@ pub unsafe fn vorn_s16(a: int16x4_t, b: int16x4_t) -> int16x4_t { unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub unsafe fn vornq_s16(a: int16x8_t, b: int16x8_t) -> int16x8_t { - let c = int16x8_t(-1, -1, -1, -1, -1, -1, -1, -1); + let c = int16x8_t::splat(-1); simd_or(simd_xor(b, c), a) } @@ -6186,7 +6157,7 @@ pub unsafe fn vornq_s16(a: int16x8_t, b: int16x8_t) -> int16x8_t { unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub unsafe fn vorn_s32(a: int32x2_t, b: int32x2_t) -> int32x2_t { - let c = int32x2_t(-1, -1); + let c = int32x2_t::splat(-1); simd_or(simd_xor(b, c), a) } @@ -6208,7 +6179,7 @@ pub unsafe fn vorn_s32(a: int32x2_t, b: int32x2_t) -> int32x2_t { unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub unsafe fn vornq_s32(a: int32x4_t, b: int32x4_t) -> int32x4_t { - let c = int32x4_t(-1, -1, -1, -1); + let c = int32x4_t::splat(-1); simd_or(simd_xor(b, c), a) } @@ -6230,7 +6201,7 @@ pub unsafe fn vornq_s32(a: int32x4_t, b: int32x4_t) -> int32x4_t { unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub unsafe fn vorn_s64(a: int64x1_t, b: int64x1_t) -> int64x1_t { - let c = int64x1_t(-1); + let c = int64x1_t::splat(-1); simd_or(simd_xor(b, c), a) } @@ -6252,7 +6223,7 @@ pub unsafe fn vorn_s64(a: int64x1_t, b: int64x1_t) -> int64x1_t { unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub unsafe fn vornq_s64(a: int64x2_t, b: int64x2_t) -> int64x2_t { - let c = int64x2_t(-1, -1); + let c = int64x2_t::splat(-1); simd_or(simd_xor(b, c), a) } @@ -6274,7 +6245,7 @@ pub unsafe fn vornq_s64(a: int64x2_t, b: int64x2_t) -> int64x2_t { unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub unsafe fn vorn_u8(a: uint8x8_t, b: uint8x8_t) -> uint8x8_t { - let c = int8x8_t(-1, -1, -1, -1, -1, -1, -1, -1); + let c = int8x8_t::splat(-1); simd_or(simd_xor(b, transmute(c)), a) } @@ -6296,9 +6267,7 @@ pub unsafe fn vorn_u8(a: uint8x8_t, b: uint8x8_t) -> uint8x8_t { unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub unsafe fn vornq_u8(a: uint8x16_t, b: uint8x16_t) -> uint8x16_t { - let c = int8x16_t( - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - ); + let c = int8x16_t::splat(-1); simd_or(simd_xor(b, transmute(c)), a) } @@ -6320,7 +6289,7 @@ pub unsafe fn vornq_u8(a: uint8x16_t, b: uint8x16_t) -> uint8x16_t { unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub unsafe fn vorn_u16(a: uint16x4_t, b: uint16x4_t) -> uint16x4_t { - let c = int16x4_t(-1, -1, -1, -1); + let c = int16x4_t::splat(-1); simd_or(simd_xor(b, transmute(c)), a) } @@ -6342,7 +6311,7 @@ pub unsafe fn vorn_u16(a: uint16x4_t, b: uint16x4_t) -> uint16x4_t { unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub unsafe fn vornq_u16(a: uint16x8_t, b: uint16x8_t) -> uint16x8_t { - let c = int16x8_t(-1, -1, -1, -1, -1, -1, -1, -1); + let c = int16x8_t::splat(-1); simd_or(simd_xor(b, transmute(c)), a) } @@ -6364,7 +6333,7 @@ pub unsafe fn vornq_u16(a: uint16x8_t, b: uint16x8_t) -> uint16x8_t { unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub unsafe fn vorn_u32(a: uint32x2_t, b: uint32x2_t) -> uint32x2_t { - let c = int32x2_t(-1, -1); + let c = int32x2_t::splat(-1); simd_or(simd_xor(b, transmute(c)), a) } @@ -6386,7 +6355,7 @@ pub unsafe fn vorn_u32(a: uint32x2_t, b: uint32x2_t) -> uint32x2_t { unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub unsafe fn vornq_u32(a: uint32x4_t, b: uint32x4_t) -> uint32x4_t { - let c = int32x4_t(-1, -1, -1, -1); + let c = int32x4_t::splat(-1); simd_or(simd_xor(b, transmute(c)), a) } @@ -6408,7 +6377,7 @@ pub unsafe fn vornq_u32(a: uint32x4_t, b: uint32x4_t) -> uint32x4_t { unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub unsafe fn vorn_u64(a: uint64x1_t, b: uint64x1_t) -> uint64x1_t { - let c = int64x1_t(-1); + let c = int64x1_t::splat(-1); simd_or(simd_xor(b, transmute(c)), a) } @@ -6430,7 +6399,7 @@ pub unsafe fn vorn_u64(a: uint64x1_t, b: uint64x1_t) -> uint64x1_t { unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub unsafe fn vornq_u64(a: uint64x2_t, b: uint64x2_t) -> uint64x2_t { - let c = int64x2_t(-1, -1); + let c = int64x2_t::splat(-1); simd_or(simd_xor(b, transmute(c)), a) } @@ -7265,7 +7234,7 @@ pub unsafe fn vget_high_s32(a: int32x4_t) -> int32x2_t { unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub unsafe fn vget_high_s64(a: int64x2_t) -> int64x1_t { - int64x1_t(simd_extract!(a, 1)) + int64x1_t([simd_extract!(a, 1)]) } /// Duplicate vector element to vector or scalar @@ -7349,7 +7318,7 @@ pub unsafe fn vget_high_u32(a: uint32x4_t) -> uint32x2_t { unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub unsafe fn vget_high_u64(a: uint64x2_t) -> uint64x1_t { - uint64x1_t(simd_extract!(a, 1)) + uint64x1_t([simd_extract!(a, 1)]) } /// Duplicate vector element to vector or scalar @@ -7480,7 +7449,7 @@ pub unsafe fn vget_low_s32(a: int32x4_t) -> int32x2_t { unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub unsafe fn vget_low_s64(a: int64x2_t) -> int64x1_t { - int64x1_t(simd_extract!(a, 0)) + int64x1_t([simd_extract!(a, 0)]) } /// Duplicate vector element to vector or scalar @@ -7548,7 +7517,7 @@ pub unsafe fn vget_low_u32(a: uint32x4_t) -> uint32x2_t { unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub unsafe fn vget_low_u64(a: uint64x2_t) -> uint64x1_t { - uint64x1_t(simd_extract!(a, 0)) + uint64x1_t([simd_extract!(a, 0)]) } /// Duplicate vector element to vector or scalar @@ -7620,10 +7589,7 @@ pub unsafe fn vget_low_f32(a: float32x4_t) -> float32x2_t { unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub unsafe fn vdupq_n_s8(value: i8) -> int8x16_t { - int8x16_t( - value, value, value, value, value, value, value, value, value, value, value, value, value, - value, value, value, - ) + int8x16_t::splat(value) } /// Duplicate vector element to vector or scalar @@ -7644,7 +7610,7 @@ pub unsafe fn vdupq_n_s8(value: i8) -> int8x16_t { unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub unsafe fn vdupq_n_s16(value: i16) -> int16x8_t { - int16x8_t(value, value, value, value, value, value, value, value) + int16x8_t::splat(value) } /// Duplicate vector element to vector or scalar @@ -7665,7 +7631,7 @@ pub unsafe fn vdupq_n_s16(value: i16) -> int16x8_t { unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub unsafe fn vdupq_n_s32(value: i32) -> int32x4_t { - int32x4_t(value, value, value, value) + int32x4_t::splat(value) } /// Duplicate vector element to vector or scalar @@ -7686,7 +7652,7 @@ pub unsafe fn vdupq_n_s32(value: i32) -> int32x4_t { unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub unsafe fn vdupq_n_s64(value: i64) -> int64x2_t { - int64x2_t(value, value) + int64x2_t::splat(value) } /// Duplicate vector element to vector or scalar @@ -7707,10 +7673,7 @@ pub unsafe fn vdupq_n_s64(value: i64) -> int64x2_t { unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub unsafe fn vdupq_n_u8(value: u8) -> uint8x16_t { - uint8x16_t( - value, value, value, value, value, value, value, value, value, value, value, value, value, - value, value, value, - ) + uint8x16_t::splat(value) } /// Duplicate vector element to vector or scalar @@ -7731,7 +7694,7 @@ pub unsafe fn vdupq_n_u8(value: u8) -> uint8x16_t { unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub unsafe fn vdupq_n_u16(value: u16) -> uint16x8_t { - uint16x8_t(value, value, value, value, value, value, value, value) + uint16x8_t::splat(value) } /// Duplicate vector element to vector or scalar @@ -7752,7 +7715,7 @@ pub unsafe fn vdupq_n_u16(value: u16) -> uint16x8_t { unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub unsafe fn vdupq_n_u32(value: u32) -> uint32x4_t { - uint32x4_t(value, value, value, value) + uint32x4_t::splat(value) } /// Duplicate vector element to vector or scalar @@ -7773,7 +7736,7 @@ pub unsafe fn vdupq_n_u32(value: u32) -> uint32x4_t { unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub unsafe fn vdupq_n_u64(value: u64) -> uint64x2_t { - uint64x2_t(value, value) + uint64x2_t::splat(value) } /// Duplicate vector element to vector or scalar @@ -7794,10 +7757,7 @@ pub unsafe fn vdupq_n_u64(value: u64) -> uint64x2_t { unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub unsafe fn vdupq_n_p8(value: p8) -> poly8x16_t { - poly8x16_t( - value, value, value, value, value, value, value, value, value, value, value, value, value, - value, value, value, - ) + poly8x16_t::splat(value) } /// Duplicate vector element to vector or scalar @@ -7818,7 +7778,7 @@ pub unsafe fn vdupq_n_p8(value: p8) -> poly8x16_t { unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub unsafe fn vdupq_n_p16(value: p16) -> poly16x8_t { - poly16x8_t(value, value, value, value, value, value, value, value) + poly16x8_t::splat(value) } /// Duplicate vector element to vector or scalar @@ -7839,7 +7799,7 @@ pub unsafe fn vdupq_n_p16(value: p16) -> poly16x8_t { unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub unsafe fn vdupq_n_f32(value: f32) -> float32x4_t { - float32x4_t(value, value, value, value) + float32x4_t::splat(value) } /// Duplicate vector element to vector or scalar @@ -7859,7 +7819,7 @@ pub unsafe fn vdupq_n_f32(value: f32) -> float32x4_t { stable(feature = "neon_intrinsics", since = "1.59.0") )] unsafe fn vdupq_n_f32_vfp4(value: f32) -> float32x4_t { - float32x4_t(value, value, value, value) + float32x4_t::splat(value) } /// Duplicate vector element to vector or scalar @@ -7880,7 +7840,7 @@ unsafe fn vdupq_n_f32_vfp4(value: f32) -> float32x4_t { unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub unsafe fn vdup_n_s8(value: i8) -> int8x8_t { - int8x8_t(value, value, value, value, value, value, value, value) + int8x8_t::splat(value) } /// Duplicate vector element to vector or scalar @@ -7901,7 +7861,7 @@ pub unsafe fn vdup_n_s8(value: i8) -> int8x8_t { unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub unsafe fn vdup_n_s16(value: i16) -> int16x4_t { - int16x4_t(value, value, value, value) + int16x4_t::splat(value) } /// Duplicate vector element to vector or scalar @@ -7922,7 +7882,7 @@ pub unsafe fn vdup_n_s16(value: i16) -> int16x4_t { unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub unsafe fn vdup_n_s32(value: i32) -> int32x2_t { - int32x2_t(value, value) + int32x2_t::splat(value) } /// Duplicate vector element to vector or scalar @@ -7943,7 +7903,7 @@ pub unsafe fn vdup_n_s32(value: i32) -> int32x2_t { unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub unsafe fn vdup_n_s64(value: i64) -> int64x1_t { - int64x1_t(value) + int64x1_t::splat(value) } /// Duplicate vector element to vector or scalar @@ -7964,7 +7924,7 @@ pub unsafe fn vdup_n_s64(value: i64) -> int64x1_t { unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub unsafe fn vdup_n_u8(value: u8) -> uint8x8_t { - uint8x8_t(value, value, value, value, value, value, value, value) + uint8x8_t::splat(value) } /// Duplicate vector element to vector or scalar @@ -7985,7 +7945,7 @@ pub unsafe fn vdup_n_u8(value: u8) -> uint8x8_t { unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub unsafe fn vdup_n_u16(value: u16) -> uint16x4_t { - uint16x4_t(value, value, value, value) + uint16x4_t::splat(value) } /// Duplicate vector element to vector or scalar @@ -8006,7 +7966,7 @@ pub unsafe fn vdup_n_u16(value: u16) -> uint16x4_t { unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub unsafe fn vdup_n_u32(value: u32) -> uint32x2_t { - uint32x2_t(value, value) + uint32x2_t::splat(value) } /// Duplicate vector element to vector or scalar @@ -8027,7 +7987,7 @@ pub unsafe fn vdup_n_u32(value: u32) -> uint32x2_t { unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub unsafe fn vdup_n_u64(value: u64) -> uint64x1_t { - uint64x1_t(value) + uint64x1_t::splat(value) } /// Duplicate vector element to vector or scalar @@ -8048,7 +8008,7 @@ pub unsafe fn vdup_n_u64(value: u64) -> uint64x1_t { unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub unsafe fn vdup_n_p8(value: p8) -> poly8x8_t { - poly8x8_t(value, value, value, value, value, value, value, value) + poly8x8_t::splat(value) } /// Duplicate vector element to vector or scalar @@ -8069,7 +8029,7 @@ pub unsafe fn vdup_n_p8(value: p8) -> poly8x8_t { unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub unsafe fn vdup_n_p16(value: p16) -> poly16x4_t { - poly16x4_t(value, value, value, value) + poly16x4_t::splat(value) } /// Duplicate vector element to vector or scalar @@ -8090,7 +8050,7 @@ pub unsafe fn vdup_n_p16(value: p16) -> poly16x4_t { unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub unsafe fn vdup_n_f32(value: f32) -> float32x2_t { - float32x2_t(value, value) + float32x2_t::splat(value) } /// Duplicate vector element to vector or scalar @@ -8110,7 +8070,7 @@ pub unsafe fn vdup_n_f32(value: f32) -> float32x2_t { stable(feature = "neon_intrinsics", since = "1.59.0") )] unsafe fn vdup_n_f32_vfp4(value: f32) -> float32x2_t { - float32x2_t(value, value) + float32x2_t::splat(value) } /// Load SIMD&FP register (immediate offset) diff --git a/crates/core_arch/src/loongarch64/lasx/types.rs b/crates/core_arch/src/loongarch64/lasx/types.rs index c584d61f52..e3016dcffb 100644 --- a/crates/core_arch/src/loongarch64/lasx/types.rs +++ b/crates/core_arch/src/loongarch64/lasx/types.rs @@ -1,57 +1,41 @@ types! { /// LOONGARCH-specific 256-bit wide vector of 32 packed `i8`. #[unstable(feature = "stdarch_loongarch", issue = "117427")] - pub struct v32i8( - 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(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 v32i8(32 x pub(crate) i8); /// LOONGARCH-specific 256-bit wide vector of 16 packed `i16`. #[unstable(feature = "stdarch_loongarch", issue = "117427")] - pub struct v16i16( - 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(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 v16i16(16 x pub(crate) i16); /// LOONGARCH-specific 256-bit wide vector of 8 packed `i32`. #[unstable(feature = "stdarch_loongarch", issue = "117427")] - pub struct v8i32(pub(crate) i32, pub(crate) i32, pub(crate) i32, pub(crate) i32, pub(crate) i32, pub(crate) i32, pub(crate) i32, pub(crate) i32); + pub struct v8i32(8 x pub(crate) i32); /// LOONGARCH-specific 256-bit wide vector of 4 packed `i64`. #[unstable(feature = "stdarch_loongarch", issue = "117427")] - pub struct v4i64(pub(crate) i64, pub(crate) i64, pub(crate) i64, pub(crate) i64); + pub struct v4i64(4 x pub(crate) i64); /// LOONGARCH-specific 256-bit wide vector of 32 packed `u8`. #[unstable(feature = "stdarch_loongarch", issue = "117427")] - pub struct v32u8( - 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(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 v32u8(32 x pub(crate) u8); /// LOONGARCH-specific 256-bit wide vector of 16 packed `u16`. #[unstable(feature = "stdarch_loongarch", issue = "117427")] - pub struct v16u16( - 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(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 v16u16(16 x pub(crate) u16); /// LOONGARCH-specific 256-bit wide vector of 8 packed `u32`. #[unstable(feature = "stdarch_loongarch", issue = "117427")] - pub struct v8u32(pub(crate) u32, pub(crate) u32, pub(crate) u32, pub(crate) u32, pub(crate) u32, pub(crate) u32, pub(crate) u32, pub(crate) u32); + pub struct v8u32(8 x pub(crate) u32); /// LOONGARCH-specific 256-bit wide vector of 4 packed `u64`. #[unstable(feature = "stdarch_loongarch", issue = "117427")] - pub struct v4u64(pub(crate) u64, pub(crate) u64, pub(crate) u64, pub(crate) u64); + pub struct v4u64(4 x pub(crate) u64); /// LOONGARCH-specific 128-bit wide vector of 8 packed `f32`. #[unstable(feature = "stdarch_loongarch", issue = "117427")] - pub struct v8f32(pub(crate) f32, pub(crate) f32, pub(crate) f32, pub(crate) f32, pub(crate) f32, pub(crate) f32, pub(crate) f32, pub(crate) f32); + pub struct v8f32(8 x pub(crate) f32); /// LOONGARCH-specific 256-bit wide vector of 4 packed `f64`. #[unstable(feature = "stdarch_loongarch", issue = "117427")] - pub struct v4f64(pub(crate) f64, pub(crate) f64, pub(crate) f64, pub(crate) f64); + pub struct v4f64(4 x pub(crate) f64); } diff --git a/crates/core_arch/src/loongarch64/lsx/types.rs b/crates/core_arch/src/loongarch64/lsx/types.rs index 1c92b0a6c8..4eb99744d2 100644 --- a/crates/core_arch/src/loongarch64/lsx/types.rs +++ b/crates/core_arch/src/loongarch64/lsx/types.rs @@ -1,41 +1,41 @@ types! { /// LOONGARCH-specific 128-bit wide vector of 16 packed `i8`. #[unstable(feature = "stdarch_loongarch", issue = "117427")] - pub struct v16i8(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 v16i8(16 x pub(crate) i8); /// LOONGARCH-specific 128-bit wide vector of 8 packed `i16`. #[unstable(feature = "stdarch_loongarch", issue = "117427")] - pub struct v8i16(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 v8i16(8 x pub(crate) i16); /// LOONGARCH-specific 128-bit wide vector of 4 packed `i32`. #[unstable(feature = "stdarch_loongarch", issue = "117427")] - pub struct v4i32(pub(crate) i32, pub(crate) i32, pub(crate) i32, pub(crate) i32); + pub struct v4i32(4 x pub(crate) i32); /// LOONGARCH-specific 128-bit wide vector of 2 packed `i64`. #[unstable(feature = "stdarch_loongarch", issue = "117427")] - pub struct v2i64(pub(crate) i64, pub(crate) i64); + pub struct v2i64(2 x pub(crate) i64); /// LOONGARCH-specific 128-bit wide vector of 16 packed `u8`. #[unstable(feature = "stdarch_loongarch", issue = "117427")] - pub struct v16u8(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 v16u8(16 x pub(crate) u8); /// LOONGARCH-specific 128-bit wide vector of 8 packed `u16`. #[unstable(feature = "stdarch_loongarch", issue = "117427")] - pub struct v8u16(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 v8u16(8 x pub(crate) u16); /// LOONGARCH-specific 128-bit wide vector of 4 packed `u32`. #[unstable(feature = "stdarch_loongarch", issue = "117427")] - pub struct v4u32(pub(crate) u32, pub(crate) u32, pub(crate) u32, pub(crate) u32); + pub struct v4u32(4 x pub(crate) u32); /// LOONGARCH-specific 128-bit wide vector of 2 packed `u64`. #[unstable(feature = "stdarch_loongarch", issue = "117427")] - pub struct v2u64(pub(crate) u64, pub(crate) u64); + pub struct v2u64(2 x pub(crate) u64); /// LOONGARCH-specific 128-bit wide vector of 4 packed `f32`. #[unstable(feature = "stdarch_loongarch", issue = "117427")] - pub struct v4f32(pub(crate) f32, pub(crate) f32, pub(crate) f32, pub(crate) f32); + pub struct v4f32(4 x pub(crate) f32); /// LOONGARCH-specific 128-bit wide vector of 2 packed `f64`. #[unstable(feature = "stdarch_loongarch", issue = "117427")] - pub struct v2f64(pub(crate) f64, pub(crate) f64); + pub struct v2f64(2 x pub(crate) f64); } diff --git a/crates/core_arch/src/macros.rs b/crates/core_arch/src/macros.rs index 5fc6a548bf..ead03c1f3d 100644 --- a/crates/core_arch/src/macros.rs +++ b/crates/core_arch/src/macros.rs @@ -52,14 +52,29 @@ macro_rules! static_assert_simm_bits { macro_rules! types { ($( $(#[$doc:meta])* - pub struct $name:ident($($fields:tt)*); + pub struct $name:ident($len:literal x $v:vis $elem_type:ty); )*) => ($( $(#[$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($v [$elem_type; $len]); + + impl $name { + /// Using `my_simd([x; N])` seemingly fails tests, + /// so use this internal helper for it instead. + #[inline(always)] + $v fn splat(value: $elem_type) -> $name { + #[derive(Copy, Clone)] + #[repr(simd)] + struct JustOne([$elem_type; 1]); + let one = JustOne([value]); + // SAFETY: 0 is always in-bounds because we're shuffling + // a simd type with exactly one element. + unsafe { simd_shuffle!(one, one, [0; $len]) } + } + } )*) } diff --git a/crates/core_arch/src/mips/msa.rs b/crates/core_arch/src/mips/msa.rs index 2e39f671d6..3b517977d2 100644 --- a/crates/core_arch/src/mips/msa.rs +++ b/crates/core_arch/src/mips/msa.rs @@ -13,65 +13,43 @@ use crate::mem; types! { /// MIPS-specific 128-bit wide vector of 16 packed `i8`. #[unstable(feature = "stdarch_mips", issue = "111198")] - pub struct v16i8( - i8, i8, i8, i8, i8, i8, i8, i8, - i8, i8, i8, i8, i8, i8, i8, i8, - ); + pub struct v16i8(16 x i8); /// MIPS-specific 128-bit wide vector of 8 packed `i16`. #[unstable(feature = "stdarch_mips", issue = "111198")] - pub struct v8i16( - i16, i16, i16, i16, i16, i16, i16, i16, - ); + pub struct v8i16(8 x i16); /// MIPS-specific 128-bit wide vector of 4 packed `i32`. #[unstable(feature = "stdarch_mips", issue = "111198")] - pub struct v4i32( - i32, i32, i32, i32, - ); + pub struct v4i32(4 x i32); /// MIPS-specific 128-bit wide vector of 2 packed `i64`. #[unstable(feature = "stdarch_mips", issue = "111198")] - pub struct v2i64( - i64, i64, - ); + pub struct v2i64(2 x i64); /// MIPS-specific 128-bit wide vector of 16 packed `u8`. #[unstable(feature = "stdarch_mips", issue = "111198")] - pub struct v16u8( - u8, u8, u8, u8, u8, u8, u8, u8, - u8, u8, u8, u8, u8, u8, u8, u8, - ); + pub struct v16u8(16 x u8); /// MIPS-specific 128-bit wide vector of 8 packed `u16`. #[unstable(feature = "stdarch_mips", issue = "111198")] - pub struct v8u16( - u16, u16, u16, u16, u16, u16, u16, u16, - ); + pub struct v8u16(8 x u16); /// MIPS-specific 128-bit wide vector of 4 packed `u32`. #[unstable(feature = "stdarch_mips", issue = "111198")] - pub struct v4u32( - u32, u32, u32, u32, - ); + pub struct v4u32(4 x u32); /// MIPS-specific 128-bit wide vector of 2 packed `u64`. #[unstable(feature = "stdarch_mips", issue = "111198")] - pub struct v2u64( - u64, u64, - ); + pub struct v2u64(2 x u64); // / MIPS-specific 128-bit wide vector of 4 packed `f32`. #[unstable(feature = "stdarch_mips", issue = "111198")] - pub struct v4f32( - f32, f32, f32, f32, - ); + pub struct v4f32(4 x f32); /// MIPS-specific 128-bit wide vector of 2 packed `f64`. #[unstable(feature = "stdarch_mips", issue = "111198")] - pub struct v2f64( - f64, f64, - ); + pub struct v2f64(2 x f64); } #[allow(improper_ctypes)] @@ -9239,8 +9217,8 @@ mod tests { #[rustfmt::skip] let r = i8x16::new( 5, 5, 5, 5, - 5, 5, 5, 5, - 5, 5, 5, 5, + 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5 ); @@ -9313,9 +9291,9 @@ mod tests { ); #[rustfmt::skip] let r = i8x16::new( - 104, 127, 102, 127, - 104, 127, 102, 127, - 104, 127, 102, 127, + 104, 127, 102, 127, + 104, 127, 102, 127, + 104, 127, 102, 127, 104, 127, 102, 127 ); @@ -9329,7 +9307,7 @@ mod tests { unsafe fn test_msa_adds_a_h() { #[rustfmt::skip] let a = i16x8::new( - 100, i16::MAX, 100, i16::MAX, + 100, i16::MAX, 100, i16::MAX, 100, i16::MAX, 100, i16::MAX ); #[rustfmt::skip] @@ -9394,9 +9372,9 @@ mod tests { ); #[rustfmt::skip] let r = i8x16::new( - 96, i8::MIN, 98, i8::MAX, - 96, i8::MIN, 98, i8::MAX, - 96, i8::MIN, 98, i8::MAX, + 96, i8::MIN, 98, i8::MAX, + 96, i8::MIN, 98, i8::MAX, + 96, i8::MIN, 98, i8::MAX, 96, i8::MIN, 98, i8::MAX ); @@ -9410,14 +9388,14 @@ mod tests { unsafe fn test_msa_adds_s_h() { #[rustfmt::skip] let a = i16x8::new( - 100, i16::MIN, 100, i16::MAX, + 100, i16::MIN, 100, i16::MAX, 100, i16::MIN, 100, i16::MAX ); #[rustfmt::skip] let b = i16x8::new(-4, -3, -2, 1, -4, -3, -2, 1); #[rustfmt::skip] let r = i16x8::new( - 96, i16::MIN, 98, i16::MAX, + 96, i16::MIN, 98, i16::MAX, 96, i16::MIN, 98, i16::MAX ); @@ -9475,9 +9453,9 @@ mod tests { ); #[rustfmt::skip] let r = u8x16::new( - 104, u8::MAX, 102, u8::MAX, - 104, u8::MAX, 102, u8::MAX, - 104, u8::MAX, 102, u8::MAX, + 104, u8::MAX, 102, u8::MAX, + 104, u8::MAX, 102, u8::MAX, + 104, u8::MAX, 102, u8::MAX, 104, u8::MAX, 102, u8::MAX ); @@ -9491,14 +9469,14 @@ mod tests { unsafe fn test_msa_adds_u_h() { #[rustfmt::skip] let a = u16x8::new( - 100, u16::MAX, 100, u16::MAX, + 100, u16::MAX, 100, u16::MAX, 100, u16::MAX, 100, u16::MAX ); #[rustfmt::skip] let b = u16x8::new(4, 3, 2, 1, 4, 3, 2, 1); #[rustfmt::skip] let r = u16x8::new( - 104, u16::MAX, 102, u16::MAX, + 104, u16::MAX, 102, u16::MAX, 104, u16::MAX, 102, u16::MAX ); @@ -9556,9 +9534,9 @@ mod tests { ); #[rustfmt::skip] let r = i8x16::new( - 96, 125, 98, -29, - 96, 125, 98, -29, - 96, 125, 98, -29, + 96, 125, 98, -29, + 96, 125, 98, -29, + 96, 125, 98, -29, 96, 125, 98, -29 ); @@ -9572,7 +9550,7 @@ mod tests { unsafe fn test_msa_addv_h() { #[rustfmt::skip] let a = i16x8::new( - 100, i16::MIN, 100, i16::MAX, + 100, i16::MIN, 100, i16::MAX, 100, i16::MIN, 100, i16::MAX ); #[rustfmt::skip] @@ -9627,9 +9605,9 @@ mod tests { ); #[rustfmt::skip] let r = i8x16::new( - 103, -126, 103, -126, - 103, -126, 103, -126, - 103, -126, 103, -126, + 103, -126, 103, -126, + 103, -126, 103, -126, + 103, -126, 103, -126, 103, -126, 103, -126 ); @@ -9640,12 +9618,12 @@ mod tests { unsafe fn test_msa_addvi_h() { #[rustfmt::skip] let a = i16x8::new( - i16::MAX, 3276, -100, -127, + i16::MAX, 3276, -100, -127, i16::MAX, 3276, -100, -127 ); #[rustfmt::skip] let r = i16x8::new( - -32766, 3279, -97, -124, + -32766, 3279, -97, -124, -32766, 3279, -97, -124 ); @@ -9690,9 +9668,9 @@ mod tests { ); #[rustfmt::skip] let r = u8x16::new( - 4, 3, 0, 100, - 4, 3, 0, 100, - 4, 3, 0, 100, + 4, 3, 0, 100, + 4, 3, 0, 100, + 4, 3, 0, 100, 4, 3, 0, 100 ); @@ -9713,9 +9691,9 @@ mod tests { ); #[rustfmt::skip] let r = u8x16::new( - 4, 5, 4, 5, - 4, 5, 4, 5, - 4, 5, 4, 5, + 4, 5, 4, 5, + 4, 5, 4, 5, + 4, 5, 4, 5, 4, 5, 4, 5 ); @@ -9740,9 +9718,9 @@ mod tests { ); #[rustfmt::skip] let r = i8x16::new( - 5, 5, 5, 5, - 5, 5, 5, 5, - 5, 5, 5, 5, + 5, 5, 5, 5, + 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5 ); @@ -9815,9 +9793,9 @@ mod tests { ); #[rustfmt::skip] let r = u8x16::new( - 5, 5, 5, 5, - 5, 5, 5, 5, - 5, 5, 5, 5, + 5, 5, 5, 5, + 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5 ); @@ -9890,9 +9868,9 @@ mod tests { ); #[rustfmt::skip] let r = i8x16::new( - 2, -5, 2, -7, - 2, -5, 2, -7, - 2, -5, 2, -7, + 2, -5, 2, -7, + 2, -5, 2, -7, + 2, -5, 2, -7, 2, -5, 2, -7 ); @@ -9965,9 +9943,9 @@ mod tests { ); #[rustfmt::skip] let r = u8x16::new( - 3, 4, 5, 6, - 3, 4, 5, 6, - 3, 4, 5, 6, + 3, 4, 5, 6, + 3, 4, 5, 6, + 3, 4, 5, 6, 3, 4, 5, 6 ); @@ -10040,9 +10018,9 @@ mod tests { ); #[rustfmt::skip] let r = i8x16::new( - -3, 3, -2, -6, - -3, 3, -2, -6, - -3, 3, -2, -6, + -3, 3, -2, -6, + -3, 3, -2, -6, + -3, 3, -2, -6, -3, 3, -2, -6 ); @@ -10115,9 +10093,9 @@ mod tests { ); #[rustfmt::skip] let r = u8x16::new( - 4, 5, 6, 7, - 4, 5, 6, 7, - 4, 5, 6, 7, + 4, 5, 6, 7, + 4, 5, 6, 7, + 4, 5, 6, 7, 4, 5, 6, 7 ); @@ -10190,9 +10168,9 @@ mod tests { ); #[rustfmt::skip] let r = u8x16::new( - 191, 27, 54, 1, - 191, 27, 54, 1, - 191, 27, 54, 1, + 191, 27, 54, 1, + 191, 27, 54, 1, + 191, 27, 54, 1, 191, 27, 54, 1 ); @@ -10258,9 +10236,9 @@ mod tests { ); #[rustfmt::skip] let r = u8x16::new( - 247, 147, 55, 1, - 247, 147, 55, 1, - 247, 147, 55, 1, + 247, 147, 55, 1, + 247, 147, 55, 1, + 247, 147, 55, 1, 247, 147, 55, 1 ); @@ -10322,9 +10300,9 @@ mod tests { ); #[rustfmt::skip] let r = u8x16::new( - 63, 11, 11, 1, - 63, 11, 11, 1, - 63, 11, 11, 1, + 63, 11, 11, 1, + 63, 11, 11, 1, + 63, 11, 11, 1, 63, 11, 11, 1 ); @@ -10342,22 +10320,22 @@ mod tests { unsafe fn test_msa_binsl_h() { #[rustfmt::skip] let a = u16x8::new( - 32767, 16384, 8192, 4096, + 32767, 16384, 8192, 4096, 32767, 16384, 8192, 4096 ); #[rustfmt::skip] let b = u16x8::new( - 21656, 5273, 7081, 2985, + 21656, 5273, 7081, 2985, 21656, 5273, 7081, 2985 ); #[rustfmt::skip] let c = u16x8::new( - 3, 7, 9, 13, + 3, 7, 9, 13, 15, 17, 21, 23 ); #[rustfmt::skip] let r = u16x8::new( - 24575, 5120, 7040, 2984, + 24575, 5120, 7040, 2984, 21656, 0, 6144, 2816 ); @@ -10431,9 +10409,9 @@ mod tests { ); #[rustfmt::skip] let r = u8x16::new( - 7, 7, 11, 9, - 7, 7, 11, 9, - 7, 7, 11, 9, + 7, 7, 11, 9, + 7, 7, 11, 9, + 7, 7, 11, 9, 7, 7, 11, 9 ); @@ -10447,17 +10425,17 @@ mod tests { unsafe fn test_msa_binsli_h() { #[rustfmt::skip] let a = u16x8::new( - 32767, 16384, 8192, 4096, + 32767, 16384, 8192, 4096, 32767, 16384, 8192, 4096 ); #[rustfmt::skip] let b = u16x8::new( - 21656, 5273, 7081, 2985, + 21656, 5273, 7081, 2985, 21656, 5273, 7081, 2985 ); #[rustfmt::skip] let r = u16x8::new( - 21659, 5272, 7080, 2984, + 21659, 5272, 7080, 2984, 21659, 5272, 7080, 2984 ); @@ -10522,9 +10500,9 @@ mod tests { ); #[rustfmt::skip] let r = u8x16::new( - 254, 151, 8, 1, - 254, 151, 8, 1, - 254, 151, 8, 1, + 254, 151, 8, 1, + 254, 151, 8, 1, + 254, 151, 8, 1, 254, 151, 8, 1 ); @@ -10542,22 +10520,22 @@ mod tests { unsafe fn test_msa_binsr_h() { #[rustfmt::skip] let a = u16x8::new( - 32767, 16384, 8192, 4096, + 32767, 16384, 8192, 4096, 32767, 16384, 8192, 4096 ); #[rustfmt::skip] let b = u16x8::new( - 21656, 5273, 7081, 2985, + 21656, 5273, 7081, 2985, 21656, 5273, 7081, 2985 ); #[rustfmt::skip] let c = u16x8::new( - 3, 7, 9, 13, + 3, 7, 9, 13, 15, 17, 21, 23 ); #[rustfmt::skip] let r = u16x8::new( - 32760, 16537, 9129, 2985, + 32760, 16537, 9129, 2985, 21656, 16385, 8233, 4265 ); @@ -10631,9 +10609,9 @@ mod tests { ); #[rustfmt::skip] let r = u8x16::new( - 198, 135, 8, 9, - 198, 135, 8, 9, - 198, 135, 8, 9, + 198, 135, 8, 9, + 198, 135, 8, 9, + 198, 135, 8, 9, 198, 135, 8, 9 ); @@ -10647,17 +10625,17 @@ mod tests { unsafe fn test_msa_binsri_h() { #[rustfmt::skip] let a = u16x8::new( - 32767, 16384, 8192, 4096, + 32767, 16384, 8192, 4096, 32767, 16384, 8192, 4096 ); #[rustfmt::skip] let b = u16x8::new( - 21656, 5273, 7081, 2985, + 21656, 5273, 7081, 2985, 21656, 5273, 7081, 2985 ); #[rustfmt::skip] let r = u16x8::new( - 21656, 21657, 7081, 2985, + 21656, 21657, 7081, 2985, 21656, 21657, 7081, 2985 ); @@ -10722,9 +10700,9 @@ mod tests { ); #[rustfmt::skip] let r = u8x16::new( - 254, 159, 48, 1, - 254, 159, 48, 1, - 254, 159, 48, 1, + 254, 159, 48, 1, + 254, 159, 48, 1, + 254, 159, 48, 1, 254, 159, 48, 1 ); @@ -10756,9 +10734,9 @@ mod tests { ); #[rustfmt::skip] let r = u8x16::new( - 249, 159, 51, 7, - 249, 159, 51, 7, - 249, 159, 51, 7, + 249, 159, 51, 7, + 249, 159, 51, 7, + 249, 159, 51, 7, 249, 159, 51, 7 ); @@ -10793,9 +10771,9 @@ mod tests { ); #[rustfmt::skip] let r = u8x16::new( - 7, 3, 15, 9, - 7, 3, 15, 9, - 7, 3, 15, 9, + 7, 3, 15, 9, + 7, 3, 15, 9, + 7, 3, 15, 9, 7, 3, 15, 9 ); @@ -10827,9 +10805,9 @@ mod tests { ); #[rustfmt::skip] let r = u8x16::new( - 7, 251, 159, 49, - 7, 251, 159, 49, - 7, 251, 159, 49, + 7, 251, 159, 49, + 7, 251, 159, 49, + 7, 251, 159, 49, 7, 251, 159, 49 ); @@ -10857,9 +10835,9 @@ mod tests { ); #[rustfmt::skip] let r = u8x16::new( - 191, 27, 54, 3, - 191, 27, 54, 3, - 191, 27, 54, 3, + 191, 27, 54, 3, + 191, 27, 54, 3, + 191, 27, 54, 3, 191, 27, 54, 3 ); @@ -10925,9 +10903,9 @@ mod tests { ); #[rustfmt::skip] let r = u8x16::new( - 34, 116, 111, 239, - 34, 116, 111, 239, - 34, 116, 111, 239, + 34, 116, 111, 239, + 34, 116, 111, 239, + 34, 116, 111, 239, 34, 116, 111, 239 ); @@ -10943,7 +10921,7 @@ mod tests { ); #[rustfmt::skip] let r = u16x8::new( - 30719, 1228, 2148, 2175, + 30719, 1228, 2148, 2175, 30719, 1228, 2148, 2175 ); @@ -11054,9 +11032,9 @@ mod tests { ); #[rustfmt::skip] let r = u8x16::new( - 7, 3, 15, 9, - 7, 3, 15, 9, - 7, 3, 15, 9, + 7, 3, 15, 9, + 7, 3, 15, 9, + 7, 3, 15, 9, 7, 3, 15, 9 ); @@ -11088,9 +11066,9 @@ mod tests { ); #[rustfmt::skip] let r = u8x16::new( - 121, 29, 57, 9, - 121, 29, 57, 9, - 121, 29, 57, 9, + 121, 29, 57, 9, + 121, 29, 57, 9, + 121, 29, 57, 9, 121, 29, 57, 9 ); @@ -11118,9 +11096,9 @@ mod tests { ); #[rustfmt::skip] let r = u8x16::new( - 255, 155, 55, 3, - 255, 155, 55, 3, - 255, 155, 55, 3, + 255, 155, 55, 3, + 255, 155, 55, 3, + 255, 155, 55, 3, 255, 155, 55, 3 ); @@ -11186,9 +11164,9 @@ mod tests { ); #[rustfmt::skip] let r = u8x16::new( - 255, 159, 55, 5, - 255, 159, 55, 5, - 255, 159, 55, 5, + 255, 159, 55, 5, + 255, 159, 55, 5, + 255, 159, 55, 5, 255, 159, 55, 5 ); @@ -11298,9 +11276,9 @@ mod tests { ); #[rustfmt::skip] let r = i8x16::new( - -1, 0, -1, -1, - -1, 0, -1, -1, - -1, 0, -1, -1, + -1, 0, -1, -1, + -1, 0, -1, -1, + -1, 0, -1, -1, -1, 0, -1, -1 ); @@ -11437,9 +11415,9 @@ mod tests { ); #[rustfmt::skip] let r = i8x16::new( - -1, 0, -1, 0, - -1, 0, -1, 0, - -1, 0, -1, 0, + -1, 0, -1, 0, + -1, 0, -1, 0, + -1, 0, -1, 0, -1, 0, -1, 0 ); @@ -11523,12 +11501,12 @@ mod tests { unsafe fn test_msa_cle_u_h() { #[rustfmt::skip] let a = u16x8::new( - u16::MAX, 155, 55, 2, + u16::MAX, 155, 55, 2, u16::MAX, 155, 55, 2 ); #[rustfmt::skip] let b = u16x8::new( - u16::MAX, 155, 56, 1, + u16::MAX, 155, 56, 1, u16::MAX, 155, 56, 1 ); #[rustfmt::skip] @@ -11632,9 +11610,9 @@ mod tests { ); #[rustfmt::skip] let r = i8x16::new( - -1, 0, 0, 0, - -1, 0, 0, 0, - -1, 0, 0, 0, + -1, 0, 0, 0, + -1, 0, 0, 0, + -1, 0, 0, 0, -1, 0, 0, 0 ); @@ -11692,9 +11670,9 @@ mod tests { ); #[rustfmt::skip] let r = i8x16::new( - -1, 0, -1, 0, - -1, 0, -1, 0, - -1, 0, -1, 0, + -1, 0, -1, 0, + -1, 0, -1, 0, + -1, 0, -1, 0, -1, 0, -1, 0 ); @@ -11767,9 +11745,9 @@ mod tests { ); #[rustfmt::skip] let r = i8x16::new( - 0, 0, -1, 0, - 0, 0, -1, 0, - 0, 0, -1, 0, + 0, 0, -1, 0, + 0, 0, -1, 0, + 0, 0, -1, 0, 0, 0, -1, 0 ); @@ -11835,9 +11813,9 @@ mod tests { ); #[rustfmt::skip] let r = i8x16::new( - 0, -1, 0, 0, - 0, -1, 0, 0, - 0, -1, 0, 0, + 0, -1, 0, 0, + 0, -1, 0, 0, + 0, -1, 0, 0, 0, -1, 0, 0 ); @@ -12051,9 +12029,9 @@ mod tests { ); #[rustfmt::skip] let r = i8x16::new( - 6, 3, 2, 2, - 6, 3, 2, 2, - 6, 3, 2, 2, + 6, 3, 2, 2, + 6, 3, 2, 2, + 6, 3, 2, 2, 6, 3, 2, 2 ); @@ -12126,9 +12104,9 @@ mod tests { ); #[rustfmt::skip] let r = u8x16::new( - 6, 3, 2, 2, - 6, 3, 2, 2, - 6, 3, 2, 2, + 6, 3, 2, 2, + 6, 3, 2, 2, + 6, 3, 2, 2, 6, 3, 2, 2 ); @@ -12539,14 +12517,14 @@ mod tests { 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, - 1, 2, 3, 4 + 1, 2, 3, 4 ); #[rustfmt::skip] let c = u8x16::new( 6, 7, 8, 9, 6, 7, 8, 9, 6, 7, 8, 9, - 6, 7, 8, 9 + 6, 7, 8, 9 ); #[rustfmt::skip] let r = i16x8::new(-19, -62, -17, -64, -21, -58, -23, -56); @@ -13043,7 +13021,7 @@ mod tests { let b = f64x2::new(1235689784512.1, 2147483649998.5); #[rustfmt::skip] let r = f32x4::new( - 1235689800000.0, 2147483600000.0, + 1235689800000.0, 2147483600000.0, 2000005.5, 2.3 ); @@ -13197,7 +13175,7 @@ mod tests { let a = i16x8::new(12, 26, 34, 48, 11, 25, 33, 47); #[rustfmt::skip] let r = f32x4::new( - 0.00036621094, 0.00079345703, + 0.00036621094, 0.00079345703, 0.0010375977, 0.0014648438 ); @@ -13210,7 +13188,7 @@ mod tests { let a = i32x4::new(1111, 2555, 3333, 475); #[rustfmt::skip] let r = f64x2::new( - 0.0000005173496901988983, + 0.0000005173496901988983, 0.0000011897645890712738 ); @@ -13534,7 +13512,7 @@ mod tests { let a = f32x4::new(2.6, -2.7, 1.3, -1.7); #[rustfmt::skip] let r = f32x4::new( - 0.3846154, -0.37037036, + 0.3846154, -0.37037036, 0.7692308, -0.58823526 ); @@ -13557,7 +13535,7 @@ mod tests { let a = f32x4::new(2.6, 2.7, 1.3, 1.7); #[rustfmt::skip] let r = f32x4::new( - 0.6201737, 0.6085806, + 0.6201737, 0.6085806, 0.87705797, 0.766965 ); @@ -14784,9 +14762,9 @@ mod tests { let p = &mut a[4] as *mut _ as *mut u8; #[rustfmt::skip] let r = i8x16::new( - 13, 14, 15, 16, - 17, 18, 19, 20, - 21, 22, 23, 24, + 13, 14, 15, 16, + 17, 18, 19, 20, + 21, 22, 23, 24, 25, 26, 27, 28 ); @@ -14797,7 +14775,7 @@ mod tests { unsafe fn test_msa_ld_h() { #[rustfmt::skip] let mut a : [i16; 16] = [ - 0, 1, 2, 3, 4, 5, 6, 7, + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 ]; let p = &mut a[4] as *mut _ as *mut u8; @@ -15963,7 +15941,7 @@ mod tests { ); #[rustfmt::skip] let b = i16x8::new( - 1025, 1025, 1025, 1025, + 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025 ); #[rustfmt::skip] @@ -17082,7 +17060,7 @@ mod tests { #[rustfmt::skip] let a = i16x8::new( 1, 2, 3, 4, - 1, 2, 3, 4 + 1, 2, 3, 4 ); #[rustfmt::skip] let r = i16x8::new(4, 8, 12, 16, 4, 8, 12, 16); @@ -17324,7 +17302,7 @@ mod tests { unsafe fn test_msa_srai_h() { #[rustfmt::skip] let a = i16x8::new( - i16::MAX, 125, 55, 1, + i16::MAX, 125, 55, 1, i16::MAX, 125, 55, 1 ); #[rustfmt::skip] @@ -17396,7 +17374,7 @@ mod tests { ); #[rustfmt::skip] let r = i16x8::new( - -2048, -2048, -2048, -2048, + -2048, -2048, -2048, -2048, 75, 13, 3, 1 ); @@ -17579,8 +17557,8 @@ mod tests { #[rustfmt::skip] let r = i8x16::new( 6, 12, 25, 31, - 6, 12, 25, 31, - 6, 12, 25, 31, + 6, 12, 25, 31, + 6, 12, 25, 31, 6, 12, 25, 31 ); @@ -17714,9 +17692,9 @@ mod tests { ); #[rustfmt::skip] let r = i8x16::new( - 6, 13, 25, 32, - 6, 13, 25, 32, - 6, 13, 25, 32, + 6, 13, 25, 32, + 6, 13, 25, 32, + 6, 13, 25, 32, 6, 13, 25, 32 ); @@ -17759,9 +17737,9 @@ mod tests { unsafe fn test_msa_st_b() { #[rustfmt::skip] let a = i8x16::new( - 13, 14, 15, 16, - 17, 18, 19, 20, - 21, 22, 23, 24, + 13, 14, 15, 16, + 17, 18, 19, 20, + 21, 22, 23, 24, 25, 26, 27, 28 ); #[rustfmt::skip] @@ -17773,9 +17751,9 @@ mod tests { ]; #[rustfmt::skip] let r : [i8; 16] = [ - 13, 14, 15, 16, - 17, 18, 19, 20, - 21, 22, 23, 24, + 13, 14, 15, 16, + 17, 18, 19, 20, + 21, 22, 23, 24, 25, 26, 27, 28 ]; __msa_st_b(mem::transmute(a), arr.as_mut_ptr() as *mut u8, 0); @@ -17930,7 +17908,7 @@ mod tests { unsafe fn test_msa_subs_u_h() { #[rustfmt::skip] let a = u16x8::new( - u16::MAX, 2, 3, 4, + u16::MAX, 2, 3, 4, u16::MAX, 2, 3, 4 ); #[rustfmt::skip] @@ -18086,7 +18064,7 @@ mod tests { unsafe fn test_msa_subsuu_s_h() { #[rustfmt::skip] let a = u16x8::new( - u16::MAX, 2, 3, + u16::MAX, 2, 3, 4, u16::MAX, 2, 3, 4 ); #[rustfmt::skip] @@ -18289,9 +18267,9 @@ mod tests { ); #[rustfmt::skip] let r = i8x16::new( - 3, 2, 1, 4, - 3, 2, 1, 4, - 3, 2, 1, 4, + 3, 2, 1, 4, + 3, 2, 1, 4, + 3, 2, 1, 4, 3, 2, 1, 4 ); @@ -18394,9 +18372,9 @@ mod tests { ); #[rustfmt::skip] let r = u8x16::new( - 17, 13, 13, 9, - 9, 13, 13, 1, - 1, 13, 13, 9, + 17, 13, 13, 9, + 9, 13, 13, 1, + 1, 13, 13, 9, 9, 13, 13, 17 ); @@ -18417,9 +18395,9 @@ mod tests { ); #[rustfmt::skip] let r = u8x16::new( - 5, 6, 7, 0, - 1, 2, 3, 12, - 13, 14, 15, 8, + 5, 6, 7, 0, + 1, 2, 3, 12, + 13, 14, 15, 8, 9, 10, 11, 20 ); diff --git a/crates/core_arch/src/powerpc/altivec.rs b/crates/core_arch/src/powerpc/altivec.rs index 29cdc41017..281e835b36 100644 --- a/crates/core_arch/src/powerpc/altivec.rs +++ b/crates/core_arch/src/powerpc/altivec.rs @@ -23,39 +23,36 @@ use super::macros::*; types! { /// PowerPC-specific 128-bit wide vector of sixteen packed `i8` #[unstable(feature = "stdarch_powerpc", issue = "111145")] - 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(16 x i8); /// PowerPC-specific 128-bit wide vector of sixteen packed `u8` #[unstable(feature = "stdarch_powerpc", issue = "111145")] - 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(16 x u8); /// PowerPC-specific 128-bit wide vector mask of sixteen packed elements #[unstable(feature = "stdarch_powerpc", issue = "111145")] - 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(16 x i8); /// PowerPC-specific 128-bit wide vector of eight packed `i16` #[unstable(feature = "stdarch_powerpc", issue = "111145")] - pub struct vector_signed_short(i16, i16, i16, i16, i16, i16, i16, i16); + pub struct vector_signed_short(8 x i16); /// PowerPC-specific 128-bit wide vector of eight packed `u16` #[unstable(feature = "stdarch_powerpc", issue = "111145")] - pub struct vector_unsigned_short(u16, u16, u16, u16, u16, u16, u16, u16); + pub struct vector_unsigned_short(8 x u16); /// PowerPC-specific 128-bit wide vector mask of eight packed elements #[unstable(feature = "stdarch_powerpc", issue = "111145")] - pub struct vector_bool_short(i16, i16, i16, i16, i16, i16, i16, i16); + pub struct vector_bool_short(8 x i16); // pub struct vector_pixel(???); /// PowerPC-specific 128-bit wide vector of four packed `i32` #[unstable(feature = "stdarch_powerpc", issue = "111145")] - pub struct vector_signed_int(i32, i32, i32, i32); + pub struct vector_signed_int(4 x i32); /// PowerPC-specific 128-bit wide vector of four packed `u32` #[unstable(feature = "stdarch_powerpc", issue = "111145")] - pub struct vector_unsigned_int(u32, u32, u32, u32); + pub struct vector_unsigned_int(4 x u32); /// PowerPC-specific 128-bit wide vector mask of four packed elements #[unstable(feature = "stdarch_powerpc", issue = "111145")] - pub struct vector_bool_int(i32, i32, i32, i32); + pub struct vector_bool_int(4 x i32); /// PowerPC-specific 128-bit wide vector of four packed `f32` #[unstable(feature = "stdarch_powerpc", issue = "111145")] - pub struct vector_float(f32, f32, f32, f32); + pub struct vector_float(4 x f32); } #[allow(improper_ctypes)] diff --git a/crates/core_arch/src/powerpc/vsx.rs b/crates/core_arch/src/powerpc/vsx.rs index 99871077b7..8a3d83a4ec 100644 --- a/crates/core_arch/src/powerpc/vsx.rs +++ b/crates/core_arch/src/powerpc/vsx.rs @@ -20,16 +20,16 @@ types! { // pub struct vector_Float16 = f16x8; /// PowerPC-specific 128-bit wide vector of two packed `i64` #[unstable(feature = "stdarch_powerpc", issue = "111145")] - pub struct vector_signed_long(i64, i64); + pub struct vector_signed_long(2 x i64); /// PowerPC-specific 128-bit wide vector of two packed `u64` #[unstable(feature = "stdarch_powerpc", issue = "111145")] - pub struct vector_unsigned_long(u64, u64); + pub struct vector_unsigned_long(2 x u64); /// PowerPC-specific 128-bit wide vector mask of two `i64` #[unstable(feature = "stdarch_powerpc", issue = "111145")] - pub struct vector_bool_long(i64, i64); + pub struct vector_bool_long(2 x i64); /// PowerPC-specific 128-bit wide vector of two packed `f64` #[unstable(feature = "stdarch_powerpc", issue = "111145")] - pub struct vector_double(f64, f64); + pub struct vector_double(2 x f64); // 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; diff --git a/crates/core_arch/src/simd.rs b/crates/core_arch/src/simd.rs index 6697472622..81494a9b8b 100644 --- a/crates/core_arch/src/simd.rs +++ b/crates/core_arch/src/simd.rs @@ -2,24 +2,30 @@ #![allow(non_camel_case_types)] +use crate::intrinsics::simd::simd_shuffle; + macro_rules! simd_ty { - ($id:ident [$ety:ident]: $($elem_name:ident),*) => { + ($id:ident [$elem_type:ty ; $len:literal]: $($param_name:ident),*) => { #[repr(simd)] #[derive(Copy, Clone, Debug, PartialEq)] - pub(crate) struct $id { $(pub $elem_name: $ety),* } + pub(crate) struct $id([$elem_type; $len]); #[allow(clippy::use_self)] impl $id { #[inline(always)] - pub(crate) const fn new($($elem_name: $ety),*) -> Self { - $id { $($elem_name),* } + pub(crate) const fn new($($param_name: $elem_type),*) -> Self { + $id([$($param_name),*]) } // FIXME: Workaround rust@60637 #[inline(always)] - pub(crate) const fn splat(value: $ety) -> Self { - $id { $( - $elem_name: value - ),* } + pub(crate) fn splat(value: $elem_type) -> Self { + #[derive(Copy, Clone)] + #[repr(simd)] + struct JustOne([$elem_type; 1]); + let one = JustOne([value]); + // SAFETY: 0 is always in-bounds because we're shuffling + // a simd type with exactly one element. + unsafe { simd_shuffle!(one, one, [0; $len]) } } /// Extract the element at position `index`. @@ -27,12 +33,10 @@ macro_rules! simd_ty { /// Use for testing only. // FIXME: Workaround rust@60637 #[inline(always)] - pub(crate) fn extract(self, index: usize) -> $ety { - // Here we assume that there is no padding. - let len = crate::mem::size_of::() / crate::mem::size_of::<$ety>(); - assert!(index < len); + pub(crate) fn extract(self, index: usize) -> $elem_type { + assert!(index < $len); // Now that we know this is in-bounds, use pointer arithmetic to access the right element. - let self_ptr = &self as *const Self as *const $ety; + let self_ptr = &self as *const Self as *const $elem_type; unsafe { self_ptr.add(index).read() } @@ -42,29 +46,33 @@ macro_rules! simd_ty { } macro_rules! simd_m_ty { - ($id:ident [$ety:ident]: $($elem_name:ident),*) => { + ($id:ident [$elem_type:ident ; $len:literal]: $($param_name:ident),*) => { #[repr(simd)] #[derive(Copy, Clone, Debug, PartialEq)] - pub(crate) struct $id { $(pub $elem_name: $ety),* } + pub(crate) struct $id([$elem_type; $len]); #[allow(clippy::use_self)] impl $id { #[inline(always)] - const fn bool_to_internal(x: bool) -> $ety { - [0 as $ety, !(0 as $ety)][x as usize] + const fn bool_to_internal(x: bool) -> $elem_type { + [0 as $elem_type, !(0 as $elem_type)][x as usize] } #[inline(always)] - pub(crate) const fn new($($elem_name: bool),*) -> Self { - $id { $($elem_name: Self::bool_to_internal($elem_name)),* } + pub(crate) const fn new($($param_name: bool),*) -> Self { + $id([$(Self::bool_to_internal($param_name)),*]) } // FIXME: Workaround rust@60637 #[inline(always)] - pub(crate) const fn splat(value: bool) -> Self { - $id { $( - $elem_name: Self::bool_to_internal(value) - ),* } + pub(crate) fn splat(value: bool) -> Self { + #[derive(Copy, Clone)] + #[repr(simd)] + struct JustOne([$elem_type; 1]); + let one = JustOne([Self::bool_to_internal(value)]); + // SAFETY: 0 is always in-bounds because we're shuffling + // a simd type with exactly one element. + unsafe { simd_shuffle!(one, one, [0; $len]) } } } } @@ -72,21 +80,21 @@ macro_rules! simd_m_ty { // 16-bit wide types: -simd_ty!(u8x2[u8]: x0, x1); -simd_ty!(i8x2[i8]: x0, x1); +simd_ty!(u8x2[u8;2]: x0, x1); +simd_ty!(i8x2[i8;2]: x0, x1); // 32-bit wide types: -simd_ty!(u8x4[u8]: x0, x1, x2, x3); -simd_ty!(u16x2[u16]: x0, x1); +simd_ty!(u8x4[u8;4]: x0, x1, x2, x3); +simd_ty!(u16x2[u16;2]: x0, x1); -simd_ty!(i8x4[i8]: x0, x1, x2, x3); -simd_ty!(i16x2[i16]: x0, x1); +simd_ty!(i8x4[i8;4]: x0, x1, x2, x3); +simd_ty!(i16x2[i16;2]: x0, x1); // 64-bit wide types: simd_ty!( - u8x8[u8]: + u8x8[u8;8]: x0, x1, x2, @@ -96,12 +104,12 @@ simd_ty!( x6, x7 ); -simd_ty!(u16x4[u16]: x0, x1, x2, x3); -simd_ty!(u32x2[u32]: x0, x1); -simd_ty!(u64x1[u64]: x1); +simd_ty!(u16x4[u16;4]: x0, x1, x2, x3); +simd_ty!(u32x2[u32;2]: x0, x1); +simd_ty!(u64x1[u64;1]: x1); simd_ty!( - i8x8[i8]: + i8x8[i8;8]: x0, x1, x2, @@ -111,17 +119,17 @@ simd_ty!( x6, x7 ); -simd_ty!(i16x4[i16]: x0, x1, x2, x3); -simd_ty!(i32x2[i32]: x0, x1); -simd_ty!(i64x1[i64]: x1); +simd_ty!(i16x4[i16;4]: x0, x1, x2, x3); +simd_ty!(i32x2[i32;2]: x0, x1); +simd_ty!(i64x1[i64;1]: x1); -simd_ty!(f32x2[f32]: x0, x1); -simd_ty!(f64x1[f64]: x1); +simd_ty!(f32x2[f32;2]: x0, x1); +simd_ty!(f64x1[f64;1]: x1); // 128-bit wide types: simd_ty!( - u8x16[u8]: + u8x16[u8;16]: x0, x1, x2, @@ -140,7 +148,7 @@ simd_ty!( x15 ); simd_ty!( - u16x8[u16]: + u16x8[u16;8]: x0, x1, x2, @@ -150,11 +158,11 @@ simd_ty!( x6, x7 ); -simd_ty!(u32x4[u32]: x0, x1, x2, x3); -simd_ty!(u64x2[u64]: x0, x1); +simd_ty!(u32x4[u32;4]: x0, x1, x2, x3); +simd_ty!(u64x2[u64;2]: x0, x1); simd_ty!( - i8x16[i8]: + i8x16[i8;16]: x0, x1, x2, @@ -173,7 +181,7 @@ simd_ty!( x15 ); simd_ty!( - i16x8[i16]: + i16x8[i16;8]: x0, x1, x2, @@ -183,11 +191,11 @@ simd_ty!( x6, x7 ); -simd_ty!(i32x4[i32]: x0, x1, x2, x3); -simd_ty!(i64x2[i64]: x0, x1); +simd_ty!(i32x4[i32;4]: x0, x1, x2, x3); +simd_ty!(i64x2[i64;2]: x0, x1); simd_ty!( - f16x8[f16]: + f16x8[f16;8]: x0, x1, x2, @@ -197,11 +205,11 @@ simd_ty!( x6, x7 ); -simd_ty!(f32x4[f32]: x0, x1, x2, x3); -simd_ty!(f64x2[f64]: x0, x1); +simd_ty!(f32x4[f32;4]: x0, x1, x2, x3); +simd_ty!(f64x2[f64;2]: x0, x1); simd_m_ty!( - m8x16[i8]: + m8x16[i8;16]: x0, x1, x2, @@ -220,7 +228,7 @@ simd_m_ty!( x15 ); simd_m_ty!( - m16x8[i16]: + m16x8[i16;8]: x0, x1, x2, @@ -230,13 +238,13 @@ simd_m_ty!( x6, x7 ); -simd_m_ty!(m32x4[i32]: x0, x1, x2, x3); -simd_m_ty!(m64x2[i64]: x0, x1); +simd_m_ty!(m32x4[i32;4]: x0, x1, x2, x3); +simd_m_ty!(m64x2[i64;2]: x0, x1); // 256-bit wide types: simd_ty!( - u8x32[u8]: + u8x32[u8;32]: x0, x1, x2, @@ -271,7 +279,7 @@ simd_ty!( x31 ); simd_ty!( - u16x16[u16]: + u16x16[u16;16]: x0, x1, x2, @@ -290,7 +298,7 @@ simd_ty!( x15 ); simd_ty!( - u32x8[u32]: + u32x8[u32;8]: x0, x1, x2, @@ -300,10 +308,10 @@ simd_ty!( x6, x7 ); -simd_ty!(u64x4[u64]: x0, x1, x2, x3); +simd_ty!(u64x4[u64;4]: x0, x1, x2, x3); simd_ty!( - i8x32[i8]: + i8x32[i8;32]: x0, x1, x2, @@ -338,7 +346,7 @@ simd_ty!( x31 ); simd_ty!( - i16x16[i16]: + i16x16[i16;16]: x0, x1, x2, @@ -357,7 +365,7 @@ simd_ty!( x15 ); simd_ty!( - i32x8[i32]: + i32x8[i32;8]: x0, x1, x2, @@ -367,10 +375,10 @@ simd_ty!( x6, x7 ); -simd_ty!(i64x4[i64]: x0, x1, x2, x3); +simd_ty!(i64x4[i64;4]: x0, x1, x2, x3); simd_ty!( - f16x16[f16]: + f16x16[f16;16]: x0, x1, x2, @@ -389,7 +397,7 @@ simd_ty!( x15 ); simd_ty!( - f32x8[f32]: + f32x8[f32;8]: x0, x1, x2, @@ -399,10 +407,10 @@ simd_ty!( x6, x7 ); -simd_ty!(f64x4[f64]: x0, x1, x2, x3); +simd_ty!(f64x4[f64;4]: x0, x1, x2, x3); simd_m_ty!( - m8x32[i8]: + m8x32[i8;32]: x0, x1, x2, @@ -437,7 +445,7 @@ simd_m_ty!( x31 ); simd_m_ty!( - m16x16[i16]: + m16x16[i16;16]: x0, x1, x2, @@ -456,7 +464,7 @@ simd_m_ty!( x15 ); simd_m_ty!( - m32x8[i32]: + m32x8[i32;8]: x0, x1, x2, @@ -471,7 +479,7 @@ simd_m_ty!( // 512-bit wide types: simd_ty!( - i8x64[i8]: + i8x64[i8;64]: x0, x1, x2, @@ -539,7 +547,7 @@ simd_ty!( ); simd_ty!( - u8x64[u8]: + u8x64[u8;64]: x0, x1, x2, @@ -607,7 +615,7 @@ simd_ty!( ); simd_ty!( - i16x32[i16]: + i16x32[i16;32]: x0, x1, x2, @@ -643,7 +651,7 @@ simd_ty!( ); simd_ty!( - u16x32[u16]: + u16x32[u16;32]: x0, x1, x2, @@ -679,7 +687,7 @@ simd_ty!( ); simd_ty!( - i32x16[i32]: + i32x16[i32;16]: x0, x1, x2, @@ -699,7 +707,7 @@ simd_ty!( ); simd_ty!( - u32x16[u32]: + u32x16[u32;16]: x0, x1, x2, @@ -719,7 +727,7 @@ simd_ty!( ); simd_ty!( - f16x32[f16]: + f16x32[f16;32]: x0, x1, x2, @@ -754,7 +762,7 @@ simd_ty!( x31 ); simd_ty!( - f32x16[f32]: + f32x16[f32;16]: x0, x1, x2, @@ -774,7 +782,7 @@ simd_ty!( ); simd_ty!( - i64x8[i64]: + i64x8[i64;8]: x0, x1, x2, @@ -786,7 +794,7 @@ simd_ty!( ); simd_ty!( - u64x8[u64]: + u64x8[u64;8]: x0, x1, x2, @@ -798,7 +806,7 @@ simd_ty!( ); simd_ty!( - f64x8[f64]: + f64x8[f64;8]: x0, x1, x2, @@ -811,7 +819,7 @@ simd_ty!( // 1024-bit wide types: simd_ty!( - u16x64[u16]: + u16x64[u16;64]: x0, x1, x2, @@ -878,7 +886,7 @@ simd_ty!( x63 ); simd_ty!( - i32x32[i32]: + i32x32[i32;32]: x0, x1, x2, @@ -913,7 +921,7 @@ simd_ty!( x31 ); simd_ty!( - u32x32[u32]: + u32x32[u32;32]: x0, x1, x2, diff --git a/crates/core_arch/src/wasm32/simd128.rs b/crates/core_arch/src/wasm32/simd128.rs index 42d1d64157..91433f8aae 100644 --- a/crates/core_arch/src/wasm32/simd128.rs +++ b/crates/core_arch/src/wasm32/simd128.rs @@ -34,7 +34,7 @@ types! { /// functions in this module. // N.B., internals here are arbitrary. #[stable(feature = "wasm_simd", since = "1.54.0")] - pub struct v128(i32, i32, i32, i32); + pub struct v128(4 x i32); } macro_rules! conversions { diff --git a/crates/core_arch/src/x86/avx.rs b/crates/core_arch/src/x86/avx.rs index 51265b0380..b4a721e967 100644 --- a/crates/core_arch/src/x86/avx.rs +++ b/crates/core_arch/src/x86/avx.rs @@ -2350,7 +2350,7 @@ pub unsafe fn _mm256_set_epi64x(a: i64, b: i64, c: i64, d: i64) -> __m256i { // This intrinsic has no corresponding instruction. #[stable(feature = "simd_x86", since = "1.27.0")] pub unsafe fn _mm256_setr_pd(a: f64, b: f64, c: f64, d: f64) -> __m256d { - __m256d(a, b, c, d) + __m256d([a, b, c, d]) } /// Sets packed single-precision (32-bit) floating-point elements in returned @@ -2371,7 +2371,7 @@ pub unsafe fn _mm256_setr_ps( g: f32, h: f32, ) -> __m256 { - __m256(a, b, c, d, e, f, g, h) + __m256([a, b, c, d, e, f, g, h]) } /// Sets packed 8-bit integers in returned vector with the supplied values in @@ -2808,7 +2808,7 @@ pub unsafe fn _mm256_undefined_pd() -> __m256d { // This intrinsic has no corresponding instruction. #[stable(feature = "simd_x86", since = "1.27.0")] pub unsafe fn _mm256_undefined_si256() -> __m256i { - __m256i(0, 0, 0, 0) + __m256i([0, 0, 0, 0]) } /// Sets packed __m256 returned vector with the supplied values. diff --git a/crates/core_arch/src/x86/avx512bf16.rs b/crates/core_arch/src/x86/avx512bf16.rs index 7d99809353..c70950b358 100644 --- a/crates/core_arch/src/x86/avx512bf16.rs +++ b/crates/core_arch/src/x86/avx512bf16.rs @@ -115,7 +115,7 @@ pub unsafe fn _mm256_maskz_cvtne2ps_pbh(k: __mmask16, a: __m256, b: __m256) -> _ } /// Convert packed single-precision (32-bit) floating-point elements in two 512-bit vectors -/// a and b to packed BF16 (16-bit) floating-point elements, and store the results in a +/// a and b to packed BF16 (16-bit) floating-point elements, and store the results in a /// 512-bit wide vector. /// [Intel's documentation](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#expand=1769,1651,1654,1657&avx512techs=AVX512_BF16&text=_mm512_cvtne2ps_pbh) #[inline] @@ -1807,10 +1807,10 @@ mod tests { #[simd_test(enable = "avx512bf16")] unsafe fn test_mm512_cvtpbh_ps() { - let a = __m256bh( + let a = __m256bh([ BF16_ONE, BF16_TWO, BF16_THREE, BF16_FOUR, BF16_FIVE, BF16_SIX, BF16_SEVEN, BF16_EIGHT, BF16_ONE, BF16_TWO, BF16_THREE, BF16_FOUR, BF16_FIVE, BF16_SIX, BF16_SEVEN, BF16_EIGHT, - ); + ]); let r = _mm512_cvtpbh_ps(a); let e = _mm512_setr_ps( 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, @@ -1820,10 +1820,10 @@ mod tests { #[simd_test(enable = "avx512bf16")] unsafe fn test_mm512_mask_cvtpbh_ps() { - let a = __m256bh( + let a = __m256bh([ BF16_ONE, BF16_TWO, BF16_THREE, BF16_FOUR, BF16_FIVE, BF16_SIX, BF16_SEVEN, BF16_EIGHT, BF16_ONE, BF16_TWO, BF16_THREE, BF16_FOUR, BF16_FIVE, BF16_SIX, BF16_SEVEN, BF16_EIGHT, - ); + ]); let src = _mm512_setr_ps( 9., 10., 11., 12., 13., 14., 15., 16., 9., 10., 11., 12., 13., 14., 15., 16., ); @@ -1837,10 +1837,10 @@ mod tests { #[simd_test(enable = "avx512bf16")] unsafe fn test_mm512_maskz_cvtpbh_ps() { - let a = __m256bh( + let a = __m256bh([ BF16_ONE, BF16_TWO, BF16_THREE, BF16_FOUR, BF16_FIVE, BF16_SIX, BF16_SEVEN, BF16_EIGHT, BF16_ONE, BF16_TWO, BF16_THREE, BF16_FOUR, BF16_FIVE, BF16_SIX, BF16_SEVEN, BF16_EIGHT, - ); + ]); let k = 0b1010_1010_1010_1010; let r = _mm512_maskz_cvtpbh_ps(k, a); let e = _mm512_setr_ps( @@ -1851,9 +1851,9 @@ mod tests { #[simd_test(enable = "avx512bf16,avx512vl")] unsafe fn test_mm256_cvtpbh_ps() { - let a = __m128bh( + let a = __m128bh([ BF16_ONE, BF16_TWO, BF16_THREE, BF16_FOUR, BF16_FIVE, BF16_SIX, BF16_SEVEN, BF16_EIGHT, - ); + ]); let r = _mm256_cvtpbh_ps(a); let e = _mm256_setr_ps(1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0); assert_eq_m256(r, e); @@ -1861,9 +1861,9 @@ mod tests { #[simd_test(enable = "avx512bf16,avx512vl")] unsafe fn test_mm256_mask_cvtpbh_ps() { - let a = __m128bh( + let a = __m128bh([ BF16_ONE, BF16_TWO, BF16_THREE, BF16_FOUR, BF16_FIVE, BF16_SIX, BF16_SEVEN, BF16_EIGHT, - ); + ]); let src = _mm256_setr_ps(9., 10., 11., 12., 13., 14., 15., 16.); let k = 0b1010_1010; let r = _mm256_mask_cvtpbh_ps(src, k, a); @@ -1873,9 +1873,9 @@ mod tests { #[simd_test(enable = "avx512bf16,avx512vl")] unsafe fn test_mm256_maskz_cvtpbh_ps() { - let a = __m128bh( + let a = __m128bh([ BF16_ONE, BF16_TWO, BF16_THREE, BF16_FOUR, BF16_FIVE, BF16_SIX, BF16_SEVEN, BF16_EIGHT, - ); + ]); let k = 0b1010_1010; let r = _mm256_maskz_cvtpbh_ps(k, a); let e = _mm256_setr_ps(0., 2., 0., 4., 0., 6., 0., 8.); @@ -1884,7 +1884,7 @@ mod tests { #[simd_test(enable = "avx512bf16,avx512vl")] unsafe fn test_mm_cvtpbh_ps() { - let a = __m128bh(BF16_ONE, BF16_TWO, BF16_THREE, BF16_FOUR, 0, 0, 0, 0); + let a = __m128bh([BF16_ONE, BF16_TWO, BF16_THREE, BF16_FOUR, 0, 0, 0, 0]); let r = _mm_cvtpbh_ps(a); let e = _mm_setr_ps(1.0, 2.0, 3.0, 4.0); assert_eq_m128(r, e); @@ -1892,7 +1892,7 @@ mod tests { #[simd_test(enable = "avx512bf16,avx512vl")] unsafe fn test_mm_mask_cvtpbh_ps() { - let a = __m128bh(BF16_ONE, BF16_TWO, BF16_THREE, BF16_FOUR, 0, 0, 0, 0); + let a = __m128bh([BF16_ONE, BF16_TWO, BF16_THREE, BF16_FOUR, 0, 0, 0, 0]); let src = _mm_setr_ps(9., 10., 11., 12.); let k = 0b1010; let r = _mm_mask_cvtpbh_ps(src, k, a); @@ -1902,7 +1902,7 @@ mod tests { #[simd_test(enable = "avx512bf16,avx512vl")] unsafe fn test_mm_maskz_cvtpbh_ps() { - let a = __m128bh(BF16_ONE, BF16_TWO, BF16_THREE, BF16_FOUR, 0, 0, 0, 0); + let a = __m128bh([BF16_ONE, BF16_TWO, BF16_THREE, BF16_FOUR, 0, 0, 0, 0]); let k = 0b1010; let r = _mm_maskz_cvtpbh_ps(k, a); let e = _mm_setr_ps(0., 2., 0., 4.); @@ -1926,7 +1926,7 @@ mod tests { #[simd_test(enable = "avx512bf16,avx512vl")] unsafe fn test_mm_mask_cvtneps_pbh() { let a = _mm_setr_ps(1.0, 2.0, 3.0, 4.0); - let src = __m128bh(5, 6, 7, 8, !0, !0, !0, !0); + let src = __m128bh([5, 6, 7, 8, !0, !0, !0, !0]); let k = 0b1010; let r: u16x4 = transmute_copy(&_mm_mask_cvtneps_pbh(src, k, a)); let e = u16x4::new(5, BF16_TWO, 7, BF16_FOUR); diff --git a/crates/core_arch/src/x86/avx512fp16.rs b/crates/core_arch/src/x86/avx512fp16.rs index 7897dd970c..d11276889b 100644 --- a/crates/core_arch/src/x86/avx512fp16.rs +++ b/crates/core_arch/src/x86/avx512fp16.rs @@ -19,7 +19,7 @@ pub unsafe fn _mm_set_ph( e1: f16, e0: f16, ) -> __m128h { - __m128h(e0, e1, e2, e3, e4, e5, e6, e7) + __m128h([e0, e1, e2, e3, e4, e5, e6, e7]) } /// Set packed half-precision (16-bit) floating-point elements in dst with the supplied values. @@ -46,9 +46,9 @@ pub unsafe fn _mm256_set_ph( e1: f16, e0: f16, ) -> __m256h { - __m256h( + __m256h([ e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, - ) + ]) } /// Set packed half-precision (16-bit) floating-point elements in dst with the supplied values. @@ -91,10 +91,10 @@ pub unsafe fn _mm512_set_ph( e1: f16, e0: f16, ) -> __m512h { - __m512h( + __m512h([ e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, - ) + ]) } /// Copy half-precision (16-bit) floating-point elements from a to the lower element of dst and zero @@ -105,7 +105,7 @@ pub unsafe fn _mm512_set_ph( #[target_feature(enable = "avx512fp16")] #[unstable(feature = "stdarch_x86_avx512_f16", issue = "127213")] pub unsafe fn _mm_set_sh(a: f16) -> __m128h { - __m128h(a, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0) + __m128h([a, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]) } /// Broadcast the half-precision (16-bit) floating-point value a to all elements of dst. @@ -154,7 +154,7 @@ pub unsafe fn _mm_setr_ph( e6: f16, e7: f16, ) -> __m128h { - __m128h(e0, e1, e2, e3, e4, e5, e6, e7) + __m128h([e0, e1, e2, e3, e4, e5, e6, e7]) } /// Set packed half-precision (16-bit) floating-point elements in dst with the supplied values in reverse order. @@ -181,9 +181,9 @@ pub unsafe fn _mm256_setr_ph( e14: f16, e15: f16, ) -> __m256h { - __m256h( + __m256h([ e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, - ) + ]) } /// Set packed half-precision (16-bit) floating-point elements in dst with the supplied values in reverse order. @@ -226,10 +226,10 @@ pub unsafe fn _mm512_setr_ph( e30: f16, e31: f16, ) -> __m512h { - __m512h( + __m512h([ e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, - ) + ]) } /// Return vector of type __m128h with all elements set to zero. diff --git a/crates/core_arch/src/x86/avxneconvert.rs b/crates/core_arch/src/x86/avxneconvert.rs index 185e059d61..9d243d5438 100644 --- a/crates/core_arch/src/x86/avxneconvert.rs +++ b/crates/core_arch/src/x86/avxneconvert.rs @@ -313,9 +313,9 @@ mod tests { #[simd_test(enable = "avxneconvert")] unsafe fn test_mm_cvtneebf16_ps() { - let a = __m128bh( + let a = __m128bh([ BF16_ONE, BF16_TWO, BF16_THREE, BF16_FOUR, BF16_FIVE, BF16_SIX, BF16_SEVEN, BF16_EIGHT, - ); + ]); let r = _mm_cvtneebf16_ps(addr_of!(a)); let e = _mm_setr_ps(1., 3., 5., 7.); assert_eq_m128(r, e); @@ -323,10 +323,10 @@ mod tests { #[simd_test(enable = "avxneconvert")] unsafe fn test_mm256_cvtneebf16_ps() { - let a = __m256bh( + let a = __m256bh([ BF16_ONE, BF16_TWO, BF16_THREE, BF16_FOUR, BF16_FIVE, BF16_SIX, BF16_SEVEN, BF16_EIGHT, BF16_ONE, BF16_TWO, BF16_THREE, BF16_FOUR, BF16_FIVE, BF16_SIX, BF16_SEVEN, BF16_EIGHT, - ); + ]); let r = _mm256_cvtneebf16_ps(addr_of!(a)); let e = _mm256_setr_ps(1., 3., 5., 7., 1., 3., 5., 7.); assert_eq_m256(r, e); @@ -334,7 +334,7 @@ mod tests { #[simd_test(enable = "avxneconvert")] unsafe fn test_mm_cvtneeph_ps() { - let a = __m128h(1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0); + let a = __m128h([1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0]); let r = _mm_cvtneeph_ps(addr_of!(a)); let e = _mm_setr_ps(1., 3., 5., 7.); assert_eq_m128(r, e); @@ -342,9 +342,9 @@ mod tests { #[simd_test(enable = "avxneconvert")] unsafe fn test_mm256_cvtneeph_ps() { - let a = __m256h( + let a = __m256h([ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0, - ); + ]); let r = _mm256_cvtneeph_ps(addr_of!(a)); let e = _mm256_setr_ps(1., 3., 5., 7., 9., 11., 13., 15.); assert_eq_m256(r, e); @@ -352,9 +352,9 @@ mod tests { #[simd_test(enable = "avxneconvert")] unsafe fn test_mm_cvtneobf16_ps() { - let a = __m128bh( + let a = __m128bh([ BF16_ONE, BF16_TWO, BF16_THREE, BF16_FOUR, BF16_FIVE, BF16_SIX, BF16_SEVEN, BF16_EIGHT, - ); + ]); let r = _mm_cvtneobf16_ps(addr_of!(a)); let e = _mm_setr_ps(2., 4., 6., 8.); assert_eq_m128(r, e); @@ -362,10 +362,10 @@ mod tests { #[simd_test(enable = "avxneconvert")] unsafe fn test_mm256_cvtneobf16_ps() { - let a = __m256bh( + let a = __m256bh([ BF16_ONE, BF16_TWO, BF16_THREE, BF16_FOUR, BF16_FIVE, BF16_SIX, BF16_SEVEN, BF16_EIGHT, BF16_ONE, BF16_TWO, BF16_THREE, BF16_FOUR, BF16_FIVE, BF16_SIX, BF16_SEVEN, BF16_EIGHT, - ); + ]); let r = _mm256_cvtneobf16_ps(addr_of!(a)); let e = _mm256_setr_ps(2., 4., 6., 8., 2., 4., 6., 8.); assert_eq_m256(r, e); @@ -373,7 +373,7 @@ mod tests { #[simd_test(enable = "avxneconvert")] unsafe fn test_mm_cvtneoph_ps() { - let a = __m128h(1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0); + let a = __m128h([1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0]); let r = _mm_cvtneoph_ps(addr_of!(a)); let e = _mm_setr_ps(2., 4., 6., 8.); assert_eq_m128(r, e); @@ -381,9 +381,9 @@ mod tests { #[simd_test(enable = "avxneconvert")] unsafe fn test_mm256_cvtneoph_ps() { - let a = __m256h( + let a = __m256h([ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0, - ); + ]); let r = _mm256_cvtneoph_ps(addr_of!(a)); let e = _mm256_setr_ps(2., 4., 6., 8., 10., 12., 14., 16.); assert_eq_m256(r, e); diff --git a/crates/core_arch/src/x86/mod.rs b/crates/core_arch/src/x86/mod.rs index 6f10d828dd..1e625a54b8 100644 --- a/crates/core_arch/src/x86/mod.rs +++ b/crates/core_arch/src/x86/mod.rs @@ -1,5 +1,6 @@ //! `x86` and `x86_64` intrinsics. +use crate::intrinsics::simd::simd_shuffle; #[allow(unused_imports)] use crate::marker::Sized; use crate::mem::transmute; @@ -50,7 +51,7 @@ types! { /// # } /// ``` #[stable(feature = "simd_x86", since = "1.27.0")] - pub struct __m128i(i64, i64); + pub struct __m128i(2 x i64); /// 128-bit wide set of four `f32` types, x86-specific /// @@ -87,7 +88,7 @@ types! { /// # } /// ``` #[stable(feature = "simd_x86", since = "1.27.0")] - pub struct __m128(f32, f32, f32, f32); + pub struct __m128(4 x f32); /// 128-bit wide set of two `f64` types, x86-specific /// @@ -124,7 +125,7 @@ types! { /// # } /// ``` #[stable(feature = "simd_x86", since = "1.27.0")] - pub struct __m128d(f64, f64); + pub struct __m128d(2 x f64); /// 256-bit wide integer vector type, x86-specific /// @@ -165,7 +166,7 @@ types! { /// # } /// ``` #[stable(feature = "simd_x86", since = "1.27.0")] - pub struct __m256i(i64, i64, i64, i64); + pub struct __m256i(4 x i64); /// 256-bit wide set of eight `f32` types, x86-specific /// @@ -202,7 +203,7 @@ types! { /// # } /// ``` #[stable(feature = "simd_x86", since = "1.27.0")] - pub struct __m256(f32, f32, f32, f32, f32, f32, f32, f32); + pub struct __m256(8 x f32); /// 256-bit wide set of four `f64` types, x86-specific /// @@ -239,7 +240,7 @@ types! { /// # } /// ``` #[stable(feature = "simd_x86", since = "1.27.0")] - pub struct __m256d(f64, f64, f64, f64); + pub struct __m256d(4 x f64); /// 512-bit wide integer vector type, x86-specific /// @@ -261,7 +262,7 @@ types! { /// Note that this means that an instance of `__m512i` typically just means /// a "bag of bits" which is left up to interpretation at the point of use. #[stable(feature = "simd_avx512_types", since = "1.72.0")] - pub struct __m512i(i64, i64, i64, i64, i64, i64, i64, i64); + pub struct __m512i(8 x i64); /// 512-bit wide set of sixteen `f32` types, x86-specific /// @@ -279,10 +280,7 @@ types! { /// suffixed with "ps" (or otherwise contain "ps"). Not to be confused with /// "pd" which is used for `__m512d`. #[stable(feature = "simd_avx512_types", since = "1.72.0")] - pub struct __m512( - f32, f32, f32, f32, f32, f32, f32, f32, - f32, f32, f32, f32, f32, f32, f32, f32, - ); + pub struct __m512(16 x f32); /// 512-bit wide set of eight `f64` types, x86-specific /// @@ -300,7 +298,7 @@ types! { /// suffixed with "pd" (or otherwise contain "pd"). Not to be confused with /// "ps" which is used for `__m512`. #[stable(feature = "simd_avx512_types", since = "1.72.0")] - pub struct __m512d(f64, f64, f64, f64, f64, f64, f64, f64); + pub struct __m512d(8 x f64); /// 128-bit wide set of eight `u16` types, x86-specific /// @@ -308,7 +306,7 @@ types! { /// eight packed `u16` instances. Its purpose is for bf16 related intrinsic /// implementations. #[unstable(feature = "stdarch_x86_avx512", issue = "111137")] - pub struct __m128bh(u16, u16, u16, u16, u16, u16, u16, u16); + pub struct __m128bh(8 x u16); /// 256-bit wide set of 16 `u16` types, x86-specific /// @@ -317,10 +315,7 @@ types! { /// 16 packed `u16` instances. Its purpose is for bf16 related intrinsic /// implementations. #[unstable(feature = "stdarch_x86_avx512", issue = "111137")] - pub struct __m256bh( - u16, u16, u16, u16, u16, u16, u16, u16, - u16, u16, u16, u16, u16, u16, u16, u16 - ); + pub struct __m256bh(16 x u16); /// 512-bit wide set of 32 `u16` types, x86-specific /// @@ -329,12 +324,7 @@ types! { /// 32 packed `u16` instances. Its purpose is for bf16 related intrinsic /// implementations. #[unstable(feature = "stdarch_x86_avx512", issue = "111137")] - pub struct __m512bh( - u16, u16, u16, u16, u16, u16, u16, u16, - u16, u16, u16, u16, u16, u16, u16, u16, - u16, u16, u16, u16, u16, u16, u16, u16, - u16, u16, u16, u16, u16, u16, u16, u16 - ); + pub struct __m512bh(32 x u16); /// 128-bit wide set of 8 `f16` types, x86-specific /// @@ -343,7 +333,7 @@ types! { /// 8 packed `f16` instances. its purpose is for f16 related intrinsic /// implementations. #[unstable(feature = "stdarch_x86_avx512_f16", issue = "127213")] - pub struct __m128h(f16, f16, f16, f16, f16, f16, f16, f16); + pub struct __m128h(8 x f16); /// 256-bit wide set of 16 `f16` types, x86-specific /// @@ -352,10 +342,7 @@ types! { /// 16 packed `f16` instances. its purpose is for f16 related intrinsic /// implementations. #[unstable(feature = "stdarch_x86_avx512_f16", issue = "127213")] - pub struct __m256h( - f16, f16, f16, f16, f16, f16, f16, f16, - f16, f16, f16, f16, f16, f16, f16, f16 - ); + pub struct __m256h(16 x f16); /// 512-bit wide set of 32 `f16` types, x86-specific /// @@ -364,12 +351,7 @@ types! { /// 32 packed `f16` instances. its purpose is for f16 related intrinsic /// implementations. #[unstable(feature = "stdarch_x86_avx512_f16", issue = "127213")] - pub struct __m512h( - f16, f16, f16, f16, f16, f16, f16, f16, - f16, f16, f16, f16, f16, f16, f16, f16, - f16, f16, f16, f16, f16, f16, f16, f16, - f16, f16, f16, f16, f16, f16, f16, f16 - ); + pub struct __m512h(32 x f16); } /// The BFloat16 type used in AVX-512 intrinsics. diff --git a/crates/core_arch/src/x86/sse.rs b/crates/core_arch/src/x86/sse.rs index ea6e685acb..42bd1da2a0 100644 --- a/crates/core_arch/src/x86/sse.rs +++ b/crates/core_arch/src/x86/sse.rs @@ -893,7 +893,7 @@ pub unsafe fn _mm_cvt_si2ss(a: __m128, b: i32) -> __m128 { #[cfg_attr(test, assert_instr(movss))] #[stable(feature = "simd_x86", since = "1.27.0")] pub unsafe fn _mm_set_ss(a: f32) -> __m128 { - __m128(a, 0.0, 0.0, 0.0) + __m128([a, 0.0, 0.0, 0.0]) } /// Construct a `__m128` with all element set to `a`. @@ -904,7 +904,7 @@ pub unsafe fn _mm_set_ss(a: f32) -> __m128 { #[cfg_attr(test, assert_instr(shufps))] #[stable(feature = "simd_x86", since = "1.27.0")] pub unsafe fn _mm_set1_ps(a: f32) -> __m128 { - __m128(a, a, a, a) + __m128([a, a, a, a]) } /// Alias for [`_mm_set1_ps`](fn._mm_set1_ps.html) @@ -942,7 +942,7 @@ pub unsafe fn _mm_set_ps1(a: f32) -> __m128 { #[cfg_attr(test, assert_instr(unpcklps))] #[stable(feature = "simd_x86", since = "1.27.0")] pub unsafe fn _mm_set_ps(a: f32, b: f32, c: f32, d: f32) -> __m128 { - __m128(d, c, b, a) + __m128([d, c, b, a]) } /// Construct a `__m128` from four floating point values lowest to highest. @@ -968,7 +968,7 @@ pub unsafe fn _mm_set_ps(a: f32, b: f32, c: f32, d: f32) -> __m128 { )] #[stable(feature = "simd_x86", since = "1.27.0")] pub unsafe fn _mm_setr_ps(a: f32, b: f32, c: f32, d: f32) -> __m128 { - __m128(a, b, c, d) + __m128([a, b, c, d]) } /// Construct a `__m128` with all elements initialized to zero. @@ -979,7 +979,7 @@ pub unsafe fn _mm_setr_ps(a: f32, b: f32, c: f32, d: f32) -> __m128 { #[cfg_attr(test, assert_instr(xorps))] #[stable(feature = "simd_x86", since = "1.27.0")] pub unsafe fn _mm_setzero_ps() -> __m128 { - __m128(0.0, 0.0, 0.0, 0.0) + __m128([0.0, 0.0, 0.0, 0.0]) } /// A utility function for creating masks to use with Intel shuffle and @@ -1100,7 +1100,7 @@ pub unsafe fn _mm_movemask_ps(a: __m128) -> i32 { #[cfg_attr(test, assert_instr(movss))] #[stable(feature = "simd_x86", since = "1.27.0")] pub unsafe fn _mm_load_ss(p: *const f32) -> __m128 { - __m128(*p, 0.0, 0.0, 0.0) + __m128([*p, 0.0, 0.0, 0.0]) } /// Construct a `__m128` by duplicating the value read from `p` into all @@ -1116,7 +1116,7 @@ pub unsafe fn _mm_load_ss(p: *const f32) -> __m128 { #[stable(feature = "simd_x86", since = "1.27.0")] pub unsafe fn _mm_load1_ps(p: *const f32) -> __m128 { let a = *p; - __m128(a, a, a, a) + __m128([a, a, a, a]) } /// Alias for [`_mm_load1_ps`](fn._mm_load1_ps.html) diff --git a/crates/core_arch/src/x86/sse2.rs b/crates/core_arch/src/x86/sse2.rs index 223a12f63c..58a999a88d 100644 --- a/crates/core_arch/src/x86/sse2.rs +++ b/crates/core_arch/src/x86/sse2.rs @@ -2424,7 +2424,7 @@ pub unsafe fn _mm_set_pd1(a: f64) -> __m128d { #[target_feature(enable = "sse2")] #[stable(feature = "simd_x86", since = "1.27.0")] pub unsafe fn _mm_set_pd(a: f64, b: f64) -> __m128d { - __m128d(b, a) + __m128d([b, a]) } /// Sets packed double-precision (64-bit) floating-point elements in the return @@ -2902,7 +2902,7 @@ pub unsafe fn _mm_castsi128_ps(a: __m128i) -> __m128 { #[target_feature(enable = "sse2")] #[stable(feature = "simd_x86", since = "1.27.0")] pub unsafe fn _mm_undefined_pd() -> __m128d { - __m128d(0.0, 0.0) + __m128d([0.0, 0.0]) } /// Returns vector of type __m128i with indeterminate elements. @@ -2914,7 +2914,7 @@ pub unsafe fn _mm_undefined_pd() -> __m128d { #[target_feature(enable = "sse2")] #[stable(feature = "simd_x86", since = "1.27.0")] pub unsafe fn _mm_undefined_si128() -> __m128i { - __m128i(0, 0) + __m128i([0, 0]) } /// The resulting `__m128d` element is composed by the low-order values of diff --git a/crates/stdarch-gen-arm/src/main.rs b/crates/stdarch-gen-arm/src/main.rs index 362777fc9b..57164b1ffe 100644 --- a/crates/stdarch-gen-arm/src/main.rs +++ b/crates/stdarch-gen-arm/src/main.rs @@ -2393,14 +2393,14 @@ fn gen_arm( } else { let const_arm = const_arm.replace("ttn", &type_to_native_type(in_t[1])); let mut cnt = String::from(in_t[1]); - cnt.push('('); + cnt.push_str("(["); for i in 0..type_len(in_t[1]) { if i != 0 { cnt.push_str(", "); } cnt.push_str(&const_arm); } - cnt.push(')'); + cnt.push_str("])"); cnt }; match para_num { @@ -2467,14 +2467,14 @@ fn gen_arm( } else if const_aarch64.contains("dup-in_len-N as ttn") { let const_aarch64 = format!("N as {}", type_to_native_type(in_t[1])); let mut cnt = String::from(in_t[1]); - cnt.push('('); + cnt.push_str("(["); for i in 0..type_len(in_t[1]) { if i != 0 { cnt.push_str(", "); } cnt.push_str(&const_aarch64); } - cnt.push(')'); + cnt.push_str("])"); format!("{current_fn}(a, {cnt})") } else { match para_num {