Keep Debug the same

This ended up way more annoying than expected, because I needed to refactor the `types!` macro to separate out the stability attributes to put those on the `Debug` impl without also copying all the `#[doc]`s.  But I like how it came out in the end, reducing duplication in the macro invocations.

But without it all the C-consistency tests fail.
This commit is contained in:
Scott McMurray 2024-08-07 12:34:14 -07:00 committed by Amanieu d'Antras
parent 1bf1eff5cc
commit 4f02e2f8a9
14 changed files with 94 additions and 121 deletions

View file

@ -21,11 +21,11 @@ use crate::{
use stdarch_test::assert_instr;
types! {
#![stable(feature = "neon_intrinsics", since = "1.59.0")]
/// ARM-specific 64-bit wide vector of one packed `f64`.
#[stable(feature = "neon_intrinsics", since = "1.59.0")]
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(2 x f64);
}

View file

@ -27,11 +27,11 @@ use crate::intrinsics::simd::simd_shuffle;
use crate::mem::transmute;
types! {
#![unstable(feature = "stdarch_arm_dsp", issue = "117237")]
/// ARM-specific 32-bit wide vector of two packed `i16`.
#[unstable(feature = "stdarch_arm_dsp", issue = "117237")]
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(2 x u16);
}

View file

@ -69,11 +69,11 @@ use crate::intrinsics::simd::simd_shuffle;
use crate::{core_arch::arm::dsp::int16x2_t, mem::transmute};
types! {
#![unstable(feature = "stdarch_arm_dsp", issue = "117237")]
/// ARM-specific 32-bit wide vector of four packed `i8`.
#[unstable(feature = "stdarch_arm_dsp", issue = "117237")]
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(4 x u8);
}

View file

@ -17,106 +17,61 @@ pub(crate) type p64 = u64;
pub(crate) type p128 = u128;
types! {
#![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"))]
/// 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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(2 x pub(crate) p64);
}

View file

@ -14,6 +14,7 @@
core_intrinsics,
intrinsics,
no_core,
fmt_helpers_for_derive,
rustc_attrs,
staged_api,
doc_cfg,
@ -88,4 +89,4 @@ pub mod arch {
}
#[allow(unused_imports)]
use core::{convert, ffi, hint, intrinsics, marker, mem, ops, ptr, sync};
use core::{array, convert, ffi, fmt, hint, intrinsics, marker, mem, ops, ptr, sync};

View file

@ -1,41 +1,33 @@
types! {
#![unstable(feature = "stdarch_loongarch", issue = "117427")]
/// LOONGARCH-specific 256-bit wide vector of 32 packed `i8`.
#[unstable(feature = "stdarch_loongarch", issue = "117427")]
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(16 x pub(crate) i16);
/// LOONGARCH-specific 256-bit wide vector of 8 packed `i32`.
#[unstable(feature = "stdarch_loongarch", issue = "117427")]
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(4 x pub(crate) i64);
/// LOONGARCH-specific 256-bit wide vector of 32 packed `u8`.
#[unstable(feature = "stdarch_loongarch", issue = "117427")]
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(16 x pub(crate) u16);
/// LOONGARCH-specific 256-bit wide vector of 8 packed `u32`.
#[unstable(feature = "stdarch_loongarch", issue = "117427")]
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(4 x pub(crate) u64);
/// LOONGARCH-specific 128-bit wide vector of 8 packed `f32`.
#[unstable(feature = "stdarch_loongarch", issue = "117427")]
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(4 x pub(crate) f64);
}

View file

@ -1,41 +1,33 @@
types! {
#![unstable(feature = "stdarch_loongarch", issue = "117427")]
/// LOONGARCH-specific 128-bit wide vector of 16 packed `i8`.
#[unstable(feature = "stdarch_loongarch", issue = "117427")]
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(8 x pub(crate) i16);
/// LOONGARCH-specific 128-bit wide vector of 4 packed `i32`.
#[unstable(feature = "stdarch_loongarch", issue = "117427")]
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(2 x pub(crate) i64);
/// LOONGARCH-specific 128-bit wide vector of 16 packed `u8`.
#[unstable(feature = "stdarch_loongarch", issue = "117427")]
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(8 x pub(crate) u16);
/// LOONGARCH-specific 128-bit wide vector of 4 packed `u32`.
#[unstable(feature = "stdarch_loongarch", issue = "117427")]
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(2 x pub(crate) u64);
/// LOONGARCH-specific 128-bit wide vector of 4 packed `f32`.
#[unstable(feature = "stdarch_loongarch", issue = "117427")]
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(2 x pub(crate) f64);
}

View file

@ -50,12 +50,40 @@ macro_rules! static_assert_simm_bits {
#[allow(unused)]
macro_rules! types {
($(
$(#[$doc:meta])*
pub struct $name:ident($len:literal x $v:vis $elem_type:ty);
)*) => ($(
(
#![$stability_first:meta]
$(
#![$stability_more:meta]
)*
$(
$(#[$doc:meta])*
$(stability: [$stability_already: meta])*
pub struct $name:ident($len:literal x $v:vis $elem_type:ty);
)*
) => (types! {
$(
#![$stability_more]
)*
$(
$(#[$doc])*
$(stability: [$stability_already])*
stability: [$stability_first]
pub struct $name($len x $v $elem_type);
)*
});
(
$(
$(#[$doc:meta])*
$(stability: [$stability: meta])+
pub struct $name:ident($len:literal x $v:vis $elem_type:ty);
)*
) => ($(
$(#[$doc])*
#[derive(Copy, Clone, Debug)]
$(#[$stability])+
#[derive(Copy, Clone)]
#[allow(non_camel_case_types)]
#[repr(simd)]
#[allow(clippy::missing_inline_in_public_items)]
@ -75,7 +103,15 @@ macro_rules! types {
unsafe { simd_shuffle!(one, one, [0; $len]) }
}
}
)*)
$(#[$stability])+
impl crate::fmt::Debug for $name {
#[inline]
fn fmt(&self, f: &mut crate::fmt::Formatter<'_>) -> crate::fmt::Result {
crate::core_arch::simd::debug_simd_finish(f, stringify!($name), self.0)
}
}
)*);
}
#[allow(unused)]

View file

@ -11,44 +11,36 @@ use stdarch_test::assert_instr;
use crate::mem;
types! {
#![unstable(feature = "stdarch_mips", issue = "111198")]
/// MIPS-specific 128-bit wide vector of 16 packed `i8`.
#[unstable(feature = "stdarch_mips", issue = "111198")]
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(8 x i16);
/// MIPS-specific 128-bit wide vector of 4 packed `i32`.
#[unstable(feature = "stdarch_mips", issue = "111198")]
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(2 x i64);
/// MIPS-specific 128-bit wide vector of 16 packed `u8`.
#[unstable(feature = "stdarch_mips", issue = "111198")]
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(8 x u16);
/// MIPS-specific 128-bit wide vector of 4 packed `u32`.
#[unstable(feature = "stdarch_mips", issue = "111198")]
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(2 x u64);
// / MIPS-specific 128-bit wide vector of 4 packed `f32`.
#[unstable(feature = "stdarch_mips", issue = "111198")]
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(2 x f64);
}

View file

@ -21,37 +21,29 @@ use stdarch_test::assert_instr;
use super::macros::*;
types! {
#![unstable(feature = "stdarch_powerpc", issue = "111145")]
/// PowerPC-specific 128-bit wide vector of sixteen packed `i8`
#[unstable(feature = "stdarch_powerpc", issue = "111145")]
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(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(16 x i8);
/// PowerPC-specific 128-bit wide vector of eight packed `i16`
#[unstable(feature = "stdarch_powerpc", issue = "111145")]
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(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(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(4 x i32);
/// PowerPC-specific 128-bit wide vector of four packed `u32`
#[unstable(feature = "stdarch_powerpc", issue = "111145")]
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(4 x i32);
/// PowerPC-specific 128-bit wide vector of four packed `f32`
#[unstable(feature = "stdarch_powerpc", issue = "111145")]
pub struct vector_float(4 x f32);
}

View file

@ -17,18 +17,16 @@ use stdarch_test::assert_instr;
use crate::mem::transmute;
types! {
#![unstable(feature = "stdarch_powerpc", issue = "111145")]
// 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(2 x i64);
/// PowerPC-specific 128-bit wide vector of two packed `u64`
#[unstable(feature = "stdarch_powerpc", issue = "111145")]
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(2 x i64);
/// PowerPC-specific 128-bit wide vector of two packed `f64`
#[unstable(feature = "stdarch_powerpc", issue = "111145")]
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;

View file

@ -955,3 +955,18 @@ simd_ty!(
x30,
x31
);
/// Used to continue `Debug`ging SIMD types as `MySimd(1, 2, 3, 4)`, as they
/// were before moving to array-based simd.
#[inline]
pub(crate) fn debug_simd_finish<T: crate::fmt::Debug, const N: usize>(
formatter: &mut crate::fmt::Formatter<'_>,
type_name: &str,
array: [T; N],
) -> crate::fmt::Result {
crate::fmt::Formatter::debug_tuple_fields_finish(
formatter,
type_name,
&crate::array::from_fn::<&dyn crate::fmt::Debug, N, _>(|i| &array[i])
)
}

View file

@ -12,6 +12,8 @@ use crate::{core_arch::simd, intrinsics::simd::*, marker::Sized, mem, ptr};
use stdarch_test::assert_instr;
types! {
#![stable(feature = "wasm_simd", since = "1.54.0")]
/// WASM-specific 128-bit wide SIMD vector type.
///
/// This type corresponds to the `v128` type in the [WebAssembly SIMD
@ -33,7 +35,6 @@ types! {
/// type in WebAssembly. Operations on `v128` can only be performed with the
/// functions in this module.
// N.B., internals here are arbitrary.
#[stable(feature = "wasm_simd", since = "1.54.0")]
pub struct v128(4 x i32);
}

View file

@ -9,6 +9,8 @@ use crate::mem::transmute;
mod macros;
types! {
#![stable(feature = "simd_x86", since = "1.27.0")]
/// 128-bit wide integer vector type, x86-specific
///
/// This type is the same as the `__m128i` type defined by Intel,
@ -50,7 +52,6 @@ types! {
/// # if is_x86_feature_detected!("sse2") { unsafe { foo() } }
/// # }
/// ```
#[stable(feature = "simd_x86", since = "1.27.0")]
pub struct __m128i(2 x i64);
/// 128-bit wide set of four `f32` types, x86-specific
@ -87,7 +88,6 @@ types! {
/// # if is_x86_feature_detected!("sse") { unsafe { foo() } }
/// # }
/// ```
#[stable(feature = "simd_x86", since = "1.27.0")]
pub struct __m128(4 x f32);
/// 128-bit wide set of two `f64` types, x86-specific
@ -124,7 +124,6 @@ types! {
/// # if is_x86_feature_detected!("sse") { unsafe { foo() } }
/// # }
/// ```
#[stable(feature = "simd_x86", since = "1.27.0")]
pub struct __m128d(2 x f64);
/// 256-bit wide integer vector type, x86-specific
@ -165,7 +164,6 @@ types! {
/// # if is_x86_feature_detected!("avx") { unsafe { foo() } }
/// # }
/// ```
#[stable(feature = "simd_x86", since = "1.27.0")]
pub struct __m256i(4 x i64);
/// 256-bit wide set of eight `f32` types, x86-specific
@ -202,7 +200,6 @@ types! {
/// # if is_x86_feature_detected!("avx") { unsafe { foo() } }
/// # }
/// ```
#[stable(feature = "simd_x86", since = "1.27.0")]
pub struct __m256(8 x f32);
/// 256-bit wide set of four `f64` types, x86-specific
@ -239,8 +236,11 @@ types! {
/// # if is_x86_feature_detected!("avx") { unsafe { foo() } }
/// # }
/// ```
#[stable(feature = "simd_x86", since = "1.27.0")]
pub struct __m256d(4 x f64);
}
types! {
#![stable(feature = "simd_avx512_types", since = "1.72.0")]
/// 512-bit wide integer vector type, x86-specific
///
@ -261,7 +261,6 @@ 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(8 x i64);
/// 512-bit wide set of sixteen `f32` types, x86-specific
@ -279,7 +278,6 @@ types! {
/// Most intrinsics using `__m512` are prefixed with `_mm512_` and are
/// 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(16 x f32);
/// 512-bit wide set of eight `f64` types, x86-specific
@ -297,15 +295,17 @@ types! {
/// Most intrinsics using `__m512d` are prefixed with `_mm512_` and are
/// 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(8 x f64);
}
types! {
#![unstable(feature = "stdarch_x86_avx512", issue = "111137")]
/// 128-bit wide set of eight `u16` types, x86-specific
///
/// This type is representing a 128-bit SIMD register which internally is consisted of
/// eight packed `u16` instances. Its purpose is for bf16 related intrinsic
/// implementations.
#[unstable(feature = "stdarch_x86_avx512", issue = "111137")]
pub struct __m128bh(8 x u16);
/// 256-bit wide set of 16 `u16` types, x86-specific
@ -314,7 +314,6 @@ types! {
/// representing a 256-bit SIMD register which internally is consisted of
/// 16 packed `u16` instances. Its purpose is for bf16 related intrinsic
/// implementations.
#[unstable(feature = "stdarch_x86_avx512", issue = "111137")]
pub struct __m256bh(16 x u16);
/// 512-bit wide set of 32 `u16` types, x86-specific
@ -323,8 +322,11 @@ types! {
/// representing a 512-bit SIMD register which internally is consisted of
/// 32 packed `u16` instances. Its purpose is for bf16 related intrinsic
/// implementations.
#[unstable(feature = "stdarch_x86_avx512", issue = "111137")]
pub struct __m512bh(32 x u16);
}
types! {
#![unstable(feature = "stdarch_x86_avx512_f16", issue = "127213")]
/// 128-bit wide set of 8 `f16` types, x86-specific
///
@ -332,7 +334,6 @@ types! {
/// representing a 128-bit SIMD register which internally is consisted of
/// 8 packed `f16` instances. its purpose is for f16 related intrinsic
/// implementations.
#[unstable(feature = "stdarch_x86_avx512_f16", issue = "127213")]
pub struct __m128h(8 x f16);
/// 256-bit wide set of 16 `f16` types, x86-specific
@ -341,7 +342,6 @@ types! {
/// representing a 256-bit SIMD register which internally is consisted of
/// 16 packed `f16` instances. its purpose is for f16 related intrinsic
/// implementations.
#[unstable(feature = "stdarch_x86_avx512_f16", issue = "127213")]
pub struct __m256h(16 x f16);
/// 512-bit wide set of 32 `f16` types, x86-specific
@ -350,7 +350,6 @@ types! {
/// representing a 512-bit SIMD register which internally is consisted of
/// 32 packed `f16` instances. its purpose is for f16 related intrinsic
/// implementations.
#[unstable(feature = "stdarch_x86_avx512_f16", issue = "127213")]
pub struct __m512h(32 x f16);
}