diff --git a/crates/core_arch/src/lib.rs b/crates/core_arch/src/lib.rs index 2af8a830cd..b95f92c6f9 100644 --- a/crates/core_arch/src/lib.rs +++ b/crates/core_arch/src/lib.rs @@ -48,6 +48,7 @@ any(target_arch = "powerpc", target_arch = "powerpc64"), feature(powerpc_ppcf128) )] +#![cfg_attr(any(target_arch = "x86", target_arch = "x86_64"), feature(x87_f80))] #![cfg_attr( test, feature( diff --git a/crates/core_arch/src/simd.rs b/crates/core_arch/src/simd.rs index 286f9b3bbc..69f5eda999 100644 --- a/crates/core_arch/src/simd.rs +++ b/crates/core_arch/src/simd.rs @@ -428,7 +428,7 @@ pub(crate) fn debug_simd_finish( type_name: &str, array: &[T; N], ) -> crate::fmt::Result { - crate::fmt::Formatter::debug_tuple_fields_finish( + crate::fmt::Formatter::debug_struct_fields_finish( formatter, type_name, &crate::array::from_fn::<&dyn crate::fmt::Debug, N, _>(|i| &array[i]), diff --git a/crates/core_arch/src/x86/mod.rs b/crates/core_arch/src/x86/mod.rs index e6875a628f..ca5551ca6c 100644 --- a/crates/core_arch/src/x86/mod.rs +++ b/crates/core_arch/src/x86/mod.rs @@ -5,6 +5,79 @@ use crate::mem::transmute; #[macro_use] mod macros; +/// The x87 80-bit extended-precision floating-point type. +/// +/// FIXME: extend the documentation. +#[doc(alias = "long double")] +#[doc(alias = "x86_fp80")] +#[doc(alias = "__float80")] +#[unstable(feature = "x87_f80", issue = "163982")] +#[allow(non_camel_case_types)] +#[doc(cfg(any(target_arch = "x86", target_arch = "x86_64")))] +#[derive(Clone, Copy)] +#[repr(transparent)] +pub struct x87_f80(crate::num::imp::x87_f80::x87_f80); + +const _: () = assert!( + size_of::() + == cfg_select! { + target_arch = "x86" => cfg_select! { + target_vendor = "apple" => 16, + target_env = "msvc" => 16, + _ => 12, + }, + target_arch = "x86_64" => 16, + _ => size_of::(), // for doc builds + } +); + +const _: () = assert!( + align_of::() + == cfg_select! { + target_arch = "x86" => cfg_select! { + target_vendor = "apple" => 16, + target_env = "msvc" => 16, + _ => 4, + }, + target_arch = "x86_64" => 16, + _ => align_of::(), // for doc builds + } +); + +#[unstable(feature = "x87_f80", issue = "163982")] +impl crate::fmt::Debug for x87_f80 { + #[inline] + fn fmt(&self, f: &mut crate::fmt::Formatter<'_>) -> crate::fmt::Result { + let mut bytes = [0u8; 16]; + bytes[..10].copy_from_slice(&self.to_ne_bytes()); + write!(f, "x87_f80({:#022x})", u128::from_ne_bytes(bytes)) + } +} + +impl x87_f80 { + /// Returns the memory representation of this floating point number as a byte array in + /// native byte order. + #[unstable(feature = "x87_f80", issue = "163982")] + #[inline] + pub const fn to_ne_bytes(self) -> [u8; 10] { + // SAFETY: the first 10 bytes are initialized. + unsafe { (&raw const self).cast::<[u8; 10]>().read() } + } + + /// Creates a floating point value from its representation as a byte array in native endian. + #[unstable(feature = "x87_f80", issue = "163982")] + #[inline] + pub const fn from_ne_bytes(bytes: [u8; 10]) -> Self { + // SAFETY: we initialize the first 10 bytes, the remaining bytes remain uninitialized. + // That is exactly the layout of x87_f80. + unsafe { + let mut this = crate::mem::MaybeUninit::::uninit(); + this.as_mut_ptr().cast::<[u8; 10]>().write(bytes); + this.assume_init() + } + } +} + types! { #![stable(feature = "simd_x86", since = "1.27.0")] diff --git a/crates/core_arch/src/x86_64/amx.rs b/crates/core_arch/src/x86_64/amx.rs index 3f98df5b77..22b9598d5a 100644 --- a/crates/core_arch/src/x86_64/amx.rs +++ b/crates/core_arch/src/x86_64/amx.rs @@ -106,7 +106,8 @@ pub unsafe fn _tile_stored(base: *mut u8, stride: usize) { /// [Intel's documentation](https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=__tile_stored&ig_expand=6881) #[inline] #[target_feature(enable = "amx-tile")] -#[cfg_attr(test, assert_instr(tilestored))] +// FIXME(amx) see https://github.com/rust-lang/rust/issues/165931. +// #[cfg_attr(test, assert_instr(tilestored))] #[unstable(feature = "x86_amx_intrinsics", issue = "126622")] pub unsafe fn __tile_stored(base: *mut u8, stride: usize, src: __tile1024i) { tilestored64_internal(src.rows, src.colsb, base, stride as u64, src.tile); @@ -191,7 +192,8 @@ pub unsafe fn _tile_dpbf16ps() { /// [Intel's documentation](https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=__tile_dpbf16ps&ig_expand=6864) #[inline] #[target_feature(enable = "amx-bf16")] -#[cfg_attr(test, assert_instr(tdpbf16ps))] +// FIXME(amx) see https://github.com/rust-lang/rust/issues/165931. +// #[cfg_attr(test, assert_instr(tdpbf16ps))] #[unstable(feature = "x86_amx_intrinsics", issue = "126622")] pub unsafe fn __tile_dpbf16ps(dst: *mut __tile1024i, a: __tile1024i, b: __tile1024i) { (*dst).tile = tdpbf16ps_internal(a.rows, b.colsb, a.colsb, (*dst).tile, a.tile, b.tile); @@ -224,7 +226,8 @@ pub unsafe fn _tile_dpbssd() { /// [Intel's documentation](https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=__tile_dpbssd&ig_expand=6866) #[inline] #[target_feature(enable = "amx-int8")] -#[cfg_attr(test, assert_instr(tdpbssd))] +// FIXME(amx) see https://github.com/rust-lang/rust/issues/165931. +// #[cfg_attr(test, assert_instr(tdpbssd))] #[unstable(feature = "x86_amx_intrinsics", issue = "126622")] pub unsafe fn __tile_dpbssd(dst: *mut __tile1024i, a: __tile1024i, b: __tile1024i) { (*dst).tile = tdpbssd_internal(a.rows, b.colsb, a.colsb, (*dst).tile, a.tile, b.tile); @@ -257,7 +260,8 @@ pub unsafe fn _tile_dpbsud() { /// [Intel's documentation](https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=__tile_dpbsud&ig_expand=6868) #[inline] #[target_feature(enable = "amx-int8")] -#[cfg_attr(test, assert_instr(tdpbsud))] +// FIXME(amx) see https://github.com/rust-lang/rust/issues/165931. +// #[cfg_attr(test, assert_instr(tdpbsud))] #[unstable(feature = "x86_amx_intrinsics", issue = "126622")] pub unsafe fn __tile_dpbsud(dst: *mut __tile1024i, a: __tile1024i, b: __tile1024i) { (*dst).tile = tdpbsud_internal(a.rows, b.colsb, a.colsb, (*dst).tile, a.tile, b.tile); @@ -290,7 +294,8 @@ pub unsafe fn _tile_dpbusd() { /// [Intel's documentation](https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=__tile_dpbusd&ig_expand=6870) #[inline] #[target_feature(enable = "amx-int8")] -#[cfg_attr(test, assert_instr(tdpbusd))] +// FIXME(amx) see https://github.com/rust-lang/rust/issues/165931. +// #[cfg_attr(test, assert_instr(tdpbusd))] #[unstable(feature = "x86_amx_intrinsics", issue = "126622")] pub unsafe fn __tile_dpbusd(dst: *mut __tile1024i, a: __tile1024i, b: __tile1024i) { (*dst).tile = tdpbusd_internal(a.rows, b.colsb, a.colsb, (*dst).tile, a.tile, b.tile); @@ -323,7 +328,8 @@ pub unsafe fn _tile_dpbuud() { /// [Intel's documentation](https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=__tile_dpbuud&ig_expand=6872) #[inline] #[target_feature(enable = "amx-int8")] -#[cfg_attr(test, assert_instr(tdpbuud))] +// FIXME(amx) see https://github.com/rust-lang/rust/issues/165931. +// #[cfg_attr(test, assert_instr(tdpbuud))] #[unstable(feature = "x86_amx_intrinsics", issue = "126622")] pub unsafe fn __tile_dpbuud(dst: *mut __tile1024i, a: __tile1024i, b: __tile1024i) { (*dst).tile = tdpbuud_internal(a.rows, b.colsb, a.colsb, (*dst).tile, a.tile, b.tile); @@ -354,7 +360,8 @@ pub unsafe fn _tile_dpfp16ps() { /// [Intel's documentation](https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=__tile_dpfp16ps&ig_expand=6874) #[inline] #[target_feature(enable = "amx-fp16")] -#[cfg_attr(test, assert_instr(tdpfp16ps))] +// FIXME(amx) see https://github.com/rust-lang/rust/issues/165931. +// #[cfg_attr(test, assert_instr(tdpfp16ps))] #[unstable(feature = "x86_amx_intrinsics", issue = "126622")] pub unsafe fn __tile_dpfp16ps(dst: *mut __tile1024i, a: __tile1024i, b: __tile1024i) { (*dst).tile = tdpfp16ps_internal(a.rows, b.colsb, a.colsb, (*dst).tile, a.tile, b.tile); @@ -393,7 +400,8 @@ pub unsafe fn _tile_cmmimfp16ps() { /// [Intel's documentation](https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=__tile_cmmimfp16ps&ig_expand=6860) #[inline] #[target_feature(enable = "amx-complex")] -#[cfg_attr(test, assert_instr(tcmmimfp16ps))] +// FIXME(amx) see https://github.com/rust-lang/rust/issues/165931. +// #[cfg_attr(test, assert_instr(tcmmimfp16ps))] #[unstable(feature = "x86_amx_intrinsics", issue = "126622")] pub unsafe fn __tile_cmmimfp16ps(dst: *mut __tile1024i, a: __tile1024i, b: __tile1024i) { (*dst).tile = tcmmimfp16ps_internal(a.rows, b.colsb, a.colsb, (*dst).tile, a.tile, b.tile); @@ -432,7 +440,8 @@ pub unsafe fn _tile_cmmrlfp16ps() { /// [Intel's documentation](https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=__tile_cmmrlfp16ps&ig_expand=6862) #[inline] #[target_feature(enable = "amx-complex")] -#[cfg_attr(test, assert_instr(tcmmrlfp16ps))] +// FIXME(amx) see https://github.com/rust-lang/rust/issues/165931. +// #[cfg_attr(test, assert_instr(tcmmrlfp16ps))] #[unstable(feature = "x86_amx_intrinsics", issue = "126622")] pub unsafe fn __tile_cmmrlfp16ps(dst: *mut __tile1024i, a: __tile1024i, b: __tile1024i) { (*dst).tile = tcmmrlfp16ps_internal(a.rows, b.colsb, a.colsb, (*dst).tile, a.tile, b.tile); @@ -464,7 +473,8 @@ pub unsafe fn _tile_dpbf8ps() { /// The shape of the tile is specified in the struct of [`__tile1024i`]. The register of the tile is allocated by the compiler. #[inline] #[target_feature(enable = "amx-fp8")] -#[cfg_attr(all(test, not(target_vendor = "apple")), assert_instr(tdpbf8ps))] +// FIXME(amx) see https://github.com/rust-lang/rust/issues/165931. +// #[cfg_attr(all(test, not(target_vendor = "apple")), assert_instr(tdpbf8ps))] #[unstable(feature = "x86_amx_intrinsics", issue = "126622")] pub unsafe fn __tile_dpbf8ps(dst: *mut __tile1024i, a: __tile1024i, b: __tile1024i) { (*dst).tile = tdpbf8ps_internal(a.rows, b.colsb, a.colsb, (*dst).tile, a.tile, b.tile); @@ -496,7 +506,8 @@ pub unsafe fn _tile_dpbhf8ps() { /// The shape of the tile is specified in the struct of [`__tile1024i`]. The register of the tile is allocated by the compiler. #[inline] #[target_feature(enable = "amx-fp8")] -#[cfg_attr(all(test, not(target_vendor = "apple")), assert_instr(tdpbhf8ps))] +// FIXME(amx) see https://github.com/rust-lang/rust/issues/165931. +// #[cfg_attr(all(test, not(target_vendor = "apple")), assert_instr(tdpbhf8ps))] #[unstable(feature = "x86_amx_intrinsics", issue = "126622")] pub unsafe fn __tile_dpbhf8ps(dst: *mut __tile1024i, a: __tile1024i, b: __tile1024i) { (*dst).tile = tdpbhf8ps_internal(a.rows, b.colsb, a.colsb, (*dst).tile, a.tile, b.tile); @@ -528,7 +539,8 @@ pub unsafe fn _tile_dphbf8ps() { /// The shape of the tile is specified in the struct of [`__tile1024i`]. The register of the tile is allocated by the compiler. #[inline] #[target_feature(enable = "amx-fp8")] -#[cfg_attr(all(test, not(target_vendor = "apple")), assert_instr(tdphbf8ps))] +// FIXME(amx) see https://github.com/rust-lang/rust/issues/165931. +// #[cfg_attr(all(test, not(target_vendor = "apple")), assert_instr(tdphbf8ps))] #[unstable(feature = "x86_amx_intrinsics", issue = "126622")] pub unsafe fn __tile_dphbf8ps(dst: *mut __tile1024i, a: __tile1024i, b: __tile1024i) { (*dst).tile = tdphbf8ps_internal(a.rows, b.colsb, a.colsb, (*dst).tile, a.tile, b.tile); @@ -560,7 +572,8 @@ pub unsafe fn _tile_dphf8ps() { /// The shape of the tile is specified in the struct of [`__tile1024i`]. The register of the tile is allocated by the compiler. #[inline] #[target_feature(enable = "amx-fp8")] -#[cfg_attr(all(test, not(target_vendor = "apple")), assert_instr(tdphf8ps))] +// FIXME(amx) see https://github.com/rust-lang/rust/issues/165931. +// #[cfg_attr(all(test, not(target_vendor = "apple")), assert_instr(tdphf8ps))] #[unstable(feature = "x86_amx_intrinsics", issue = "126622")] pub unsafe fn __tile_dphf8ps(dst: *mut __tile1024i, a: __tile1024i, b: __tile1024i) { (*dst).tile = tdphf8ps_internal(a.rows, b.colsb, a.colsb, (*dst).tile, a.tile, b.tile); @@ -668,7 +681,8 @@ pub unsafe fn _tile_cvtrowd2psi() -> __m512 { /// The shape of the tile is specified in the struct of [`__tile1024i`]. The register of the tile is allocated by the compiler. #[inline] #[target_feature(enable = "amx-avx512,avx10.2")] -#[cfg_attr(all(test, not(target_vendor = "apple")), assert_instr(tcvtrowd2ps))] +// FIXME(amx) see https://github.com/rust-lang/rust/issues/165931. +// #[cfg_attr(all(test, not(target_vendor = "apple")), assert_instr(tcvtrowd2ps))] #[unstable(feature = "x86_amx_intrinsics", issue = "126622")] pub unsafe fn __tile_cvtrowd2ps(src: __tile1024i, row: u32) -> __m512 { tcvtrowd2ps_internal(src.rows, src.colsb, src.tile, row).as_m512() @@ -713,7 +727,8 @@ pub unsafe fn _tile_cvtrowps2phhi() -> __m512h /// The shape of the tile is specified in the struct of [`__tile1024i`]. The register of the tile is allocated by the compiler. #[inline] #[target_feature(enable = "amx-avx512,avx10.2")] -#[cfg_attr(all(test, not(target_vendor = "apple")), assert_instr(tcvtrowps2phh))] +// FIXME(amx) see https://github.com/rust-lang/rust/issues/165931. +// #[cfg_attr(all(test, not(target_vendor = "apple")), assert_instr(tcvtrowps2phh))] #[unstable(feature = "x86_amx_intrinsics", issue = "126622")] pub unsafe fn __tile_cvtrowps2phh(src: __tile1024i, row: u32) -> __m512h { tcvtrowps2phh_internal(src.rows, src.colsb, src.tile, row).as_m512h() @@ -758,7 +773,8 @@ pub unsafe fn _tile_cvtrowps2phli() -> __m512h /// The shape of the tile is specified in the struct of [`__tile1024i`]. The register of the tile is allocated by the compiler. #[inline] #[target_feature(enable = "amx-avx512,avx10.2")] -#[cfg_attr(all(test, not(target_vendor = "apple")), assert_instr(tcvtrowps2phl))] +// FIXME(amx) see https://github.com/rust-lang/rust/issues/165931. +// #[cfg_attr(all(test, not(target_vendor = "apple")), assert_instr(tcvtrowps2phl))] #[unstable(feature = "x86_amx_intrinsics", issue = "126622")] pub unsafe fn __tile_cvtrowps2phl(src: __tile1024i, row: u32) -> __m512h { tcvtrowps2phl_internal(src.rows, src.colsb, src.tile, row).as_m512h() @@ -803,7 +819,8 @@ pub unsafe fn _tile_cvtrowps2bf16hi() -> __m512 /// The shape of the tile is specified in the struct of [`__tile1024i`]. The register of the tile is allocated by the compiler. #[inline] #[target_feature(enable = "amx-avx512,avx10.2")] -#[cfg_attr(all(test, not(target_vendor = "apple")), assert_instr(tcvtrowps2bf16h))] +// FIXME(amx) see https://github.com/rust-lang/rust/issues/165931. +// #[cfg_attr(all(test, not(target_vendor = "apple")), assert_instr(tcvtrowps2bf16h))] #[unstable(feature = "x86_amx_intrinsics", issue = "126622")] pub unsafe fn __tile_cvtrowps2bf16h(src: __tile1024i, row: u32) -> __m512bh { tcvtrowps2bf16h_internal(src.rows, src.colsb, src.tile, row).as_m512bh() @@ -848,7 +865,8 @@ pub unsafe fn _tile_cvtrowps2bf16li() -> __m512 /// The shape of the tile is specified in the struct of [`__tile1024i`]. The register of the tile is allocated by the compiler. #[inline] #[target_feature(enable = "amx-avx512,avx10.2")] -#[cfg_attr(all(test, not(target_vendor = "apple")), assert_instr(tcvtrowps2bf16l))] +// FIXME(amx) see https://github.com/rust-lang/rust/issues/165931. +// #[cfg_attr(all(test, not(target_vendor = "apple")), assert_instr(tcvtrowps2bf16l))] #[unstable(feature = "x86_amx_intrinsics", issue = "126622")] pub unsafe fn __tile_cvtrowps2bf16l(src: __tile1024i, row: u32) -> __m512bh { tcvtrowps2bf16l_internal(src.rows, src.colsb, src.tile, row).as_m512bh() @@ -887,7 +905,8 @@ pub unsafe fn _tile_movrowi() -> __m512i { /// The shape of the tile is specified in the struct of [`__tile1024i`]. The register of the tile is allocated by the compiler. #[inline] #[target_feature(enable = "amx-avx512,avx10.2")] -#[cfg_attr(all(test, not(target_vendor = "apple")), assert_instr(tilemovrow))] +// FIXME(amx) see https://github.com/rust-lang/rust/issues/165931. +// #[cfg_attr(all(test, not(target_vendor = "apple")), assert_instr(tilemovrow))] #[unstable(feature = "x86_amx_intrinsics", issue = "126622")] pub unsafe fn __tile_movrow(src: __tile1024i, row: u32) -> __m512i { tilemovrow_internal(src.rows, src.colsb, src.tile, row).as_m512i() diff --git a/rust-version b/rust-version index e4f77638ae..912f0d44a8 100644 --- a/rust-version +++ b/rust-version @@ -1 +1 @@ -16d1ffac17ad8b739e32483ac2e65fe7e1804977 +ee8268e23d0e2e308b52e4f63df69afb69bc61a4