]> git.lizzy.rs Git - rust.git/blob - compiler/rustc_codegen_gcc/patches/0024-core-Disable-portable-simd-test.patch
Auto merge of #97730 - flip1995:clippyup, r=Manishearth
[rust.git] / compiler / rustc_codegen_gcc / patches / 0024-core-Disable-portable-simd-test.patch
1 From b1ae000f6da1abd3b8e9b80c40bc11c89b8ae93c Mon Sep 17 00:00:00 2001
2 From: bjorn3 <bjorn3@users.noreply.github.com>
3 Date: Thu, 30 Dec 2021 16:54:40 +0100
4 Subject: [PATCH] [core] Disable portable-simd test
5
6 ---
7  library/core/tests/lib.rs | 1 -
8  1 file changed, 1 deletion(-)
9
10 diff --git a/library/core/src/lib.rs b/library/core/src/lib.rs
11 index aa1ad93..95fbf55 100644
12 --- a/library/core/src/lib.rs
13 +++ b/library/core/src/lib.rs
14 @@ -398,23 +398,4 @@ pub mod arch {
15      }
16  }
17  
18 -// Pull in the `core_simd` crate directly into libcore. The contents of
19 -// `core_simd` are in a different repository: rust-lang/portable-simd.
20 -//
21 -// `core_simd` depends on libcore, but the contents of this module are
22 -// set up in such a way that directly pulling it here works such that the
23 -// crate uses this crate as its libcore.
24 -#[path = "../../portable-simd/crates/core_simd/src/mod.rs"]
25 -#[allow(missing_debug_implementations, dead_code, unsafe_op_in_unsafe_fn, unused_unsafe)]
26 -#[allow(rustdoc::bare_urls)]
27 -#[unstable(feature = "portable_simd", issue = "86656")]
28 -mod core_simd;
29 -
30 -#[doc = include_str!("../../portable-simd/crates/core_simd/src/core_simd_docs.md")]
31 -#[unstable(feature = "portable_simd", issue = "86656")]
32 -pub mod simd {
33 -    #[unstable(feature = "portable_simd", issue = "86656")]
34 -    pub use crate::core_simd::simd::*;
35 -}
36 -
37  include!("primitive_docs.rs");
38 diff --git a/library/core/src/slice/mod.rs b/library/core/src/slice/mod.rs
39 index cd38c3a..ad632dc 100644
40 --- a/library/core/src/slice/mod.rs
41 +++ b/library/core/src/slice/mod.rs
42 @@ -17,6 +17,5 @@ use crate::ptr;
43  use crate::result::Result;
44  use crate::result::Result::{Err, Ok};
45 -use crate::simd::{self, Simd};
46  use crate::slice;
47  
48  #[unstable(
49 @@ -3475,121 +3474,6 @@ impl<T> [T] {
50          }
51      }
52  
53 -    /// Split a slice into a prefix, a middle of aligned SIMD types, and a suffix.
54 -    ///
55 -    /// This is a safe wrapper around [`slice::align_to`], so has the same weak
56 -    /// postconditions as that method.  You're only assured that
57 -    /// `self.len() == prefix.len() + middle.len() * LANES + suffix.len()`.
58 -    ///
59 -    /// Notably, all of the following are possible:
60 -    /// - `prefix.len() >= LANES`.
61 -    /// - `middle.is_empty()` despite `self.len() >= 3 * LANES`.
62 -    /// - `suffix.len() >= LANES`.
63 -    ///
64 -    /// That said, this is a safe method, so if you're only writing safe code,
65 -    /// then this can at most cause incorrect logic, not unsoundness.
66 -    ///
67 -    /// # Panics
68 -    ///
69 -    /// This will panic if the size of the SIMD type is different from
70 -    /// `LANES` times that of the scalar.
71 -    ///
72 -    /// At the time of writing, the trait restrictions on `Simd<T, LANES>` keeps
73 -    /// that from ever happening, as only power-of-two numbers of lanes are
74 -    /// supported.  It's possible that, in the future, those restrictions might
75 -    /// be lifted in a way that would make it possible to see panics from this
76 -    /// method for something like `LANES == 3`.
77 -    ///
78 -    /// # Examples
79 -    ///
80 -    /// ```
81 -    /// #![feature(portable_simd)]
82 -    ///
83 -    /// let short = &[1, 2, 3];
84 -    /// let (prefix, middle, suffix) = short.as_simd::<4>();
85 -    /// assert_eq!(middle, []); // Not enough elements for anything in the middle
86 -    ///
87 -    /// // They might be split in any possible way between prefix and suffix
88 -    /// let it = prefix.iter().chain(suffix).copied();
89 -    /// assert_eq!(it.collect::<Vec<_>>(), vec![1, 2, 3]);
90 -    ///
91 -    /// fn basic_simd_sum(x: &[f32]) -> f32 {
92 -    ///     use std::ops::Add;
93 -    ///     use std::simd::f32x4;
94 -    ///     let (prefix, middle, suffix) = x.as_simd();
95 -    ///     let sums = f32x4::from_array([
96 -    ///         prefix.iter().copied().sum(),
97 -    ///         0.0,
98 -    ///         0.0,
99 -    ///         suffix.iter().copied().sum(),
100 -    ///     ]);
101 -    ///     let sums = middle.iter().copied().fold(sums, f32x4::add);
102 -    ///     sums.reduce_sum()
103 -    /// }
104 -    ///
105 -    /// let numbers: Vec<f32> = (1..101).map(|x| x as _).collect();
106 -    /// assert_eq!(basic_simd_sum(&numbers[1..99]), 4949.0);
107 -    /// ```
108 -    #[unstable(feature = "portable_simd", issue = "86656")]
109 -    pub fn as_simd<const LANES: usize>(&self) -> (&[T], &[Simd<T, LANES>], &[T])
110 -    where
111 -        Simd<T, LANES>: AsRef<[T; LANES]>,
112 -        T: simd::SimdElement,
113 -        simd::LaneCount<LANES>: simd::SupportedLaneCount,
114 -    {
115 -        // These are expected to always match, as vector types are laid out like
116 -        // arrays per <https://llvm.org/docs/LangRef.html#vector-type>, but we
117 -        // might as well double-check since it'll optimize away anyhow.
118 -        assert_eq!(mem::size_of::<Simd<T, LANES>>(), mem::size_of::<[T; LANES]>());
119 -
120 -        // SAFETY: The simd types have the same layout as arrays, just with
121 -        // potentially-higher alignment, so the de-facto transmutes are sound.
122 -        unsafe { self.align_to() }
123 -    }
124 -
125 -    /// Split a slice into a prefix, a middle of aligned SIMD types, and a suffix.
126 -    ///
127 -    /// This is a safe wrapper around [`slice::align_to_mut`], so has the same weak
128 -    /// postconditions as that method.  You're only assured that
129 -    /// `self.len() == prefix.len() + middle.len() * LANES + suffix.len()`.
130 -    ///
131 -    /// Notably, all of the following are possible:
132 -    /// - `prefix.len() >= LANES`.
133 -    /// - `middle.is_empty()` despite `self.len() >= 3 * LANES`.
134 -    /// - `suffix.len() >= LANES`.
135 -    ///
136 -    /// That said, this is a safe method, so if you're only writing safe code,
137 -    /// then this can at most cause incorrect logic, not unsoundness.
138 -    ///
139 -    /// This is the mutable version of [`slice::as_simd`]; see that for examples.
140 -    ///
141 -    /// # Panics
142 -    ///
143 -    /// This will panic if the size of the SIMD type is different from
144 -    /// `LANES` times that of the scalar.
145 -    ///
146 -    /// At the time of writing, the trait restrictions on `Simd<T, LANES>` keeps
147 -    /// that from ever happening, as only power-of-two numbers of lanes are
148 -    /// supported.  It's possible that, in the future, those restrictions might
149 -    /// be lifted in a way that would make it possible to see panics from this
150 -    /// method for something like `LANES == 3`.
151 -    #[unstable(feature = "portable_simd", issue = "86656")]
152 -    pub fn as_simd_mut<const LANES: usize>(&mut self) -> (&mut [T], &mut [Simd<T, LANES>], &mut [T])
153 -    where
154 -        Simd<T, LANES>: AsMut<[T; LANES]>,
155 -        T: simd::SimdElement,
156 -        simd::LaneCount<LANES>: simd::SupportedLaneCount,
157 -    {
158 -        // These are expected to always match, as vector types are laid out like
159 -        // arrays per <https://llvm.org/docs/LangRef.html#vector-type>, but we
160 -        // might as well double-check since it'll optimize away anyhow.
161 -        assert_eq!(mem::size_of::<Simd<T, LANES>>(), mem::size_of::<[T; LANES]>());
162 -
163 -        // SAFETY: The simd types have the same layout as arrays, just with
164 -        // potentially-higher alignment, so the de-facto transmutes are sound.
165 -        unsafe { self.align_to_mut() }
166 -    }
167 -
168      /// Checks if the elements of this slice are sorted.
169      ///
170      /// That is, for each element `a` and its following element `b`, `a <= b` must hold. If the
171 diff --git a/library/core/tests/lib.rs b/library/core/tests/lib.rs
172 index 06c7be0..359e2e7 100644
173 --- a/library/core/tests/lib.rs
174 +++ b/library/core/tests/lib.rs
175 @@ -75,7 +75,6 @@
176  #![feature(never_type)]
177  #![feature(unwrap_infallible)]
178  #![feature(result_into_ok_or_err)]
179 -#![feature(portable_simd)]
180  #![feature(ptr_metadata)]
181  #![feature(once_cell)]
182  #![feature(option_result_contains)]
183 @@ -127,7 +126,6 @@ mod pin;
184  mod pin_macro;
185  mod ptr;
186  mod result;
187 -mod simd;
188  mod slice;
189  mod str;
190  mod str_lossy;
191 diff --git a/library/std/src/lib.rs b/library/std/src/lib.rs
192 index 5dc586d..b6fc48f 100644
193 --- a/library/std/src/lib.rs
194 +++ b/library/std/src/lib.rs
195 @@ -312,6 +312,5 @@
196  #![feature(panic_can_unwind)]
197  #![feature(panic_unwind)]
198  #![feature(platform_intrinsics)]
199 -#![feature(portable_simd)]
200  #![feature(prelude_import)]
201  #![feature(ptr_as_uninit)]
202 @@ -508,23 +508,6 @@ pub mod time;
203  #[unstable(feature = "once_cell", issue = "74465")]
204  pub mod lazy;
205  
206 -// Pull in `std_float` crate  into libstd. The contents of
207 -// `std_float` are in a different repository: rust-lang/portable-simd.
208 -#[path = "../../portable-simd/crates/std_float/src/lib.rs"]
209 -#[allow(missing_debug_implementations, dead_code, unsafe_op_in_unsafe_fn, unused_unsafe)]
210 -#[allow(rustdoc::bare_urls)]
211 -#[unstable(feature = "portable_simd", issue = "86656")]
212 -mod std_float;
213 -
214 -#[doc = include_str!("../../portable-simd/crates/core_simd/src/core_simd_docs.md")]
215 -#[unstable(feature = "portable_simd", issue = "86656")]
216 -pub mod simd {
217 -    #[doc(inline)]
218 -    pub use crate::std_float::StdFloat;
219 -    #[doc(inline)]
220 -    pub use core::simd::*;
221 -}
222 -
223  #[stable(feature = "futures_api", since = "1.36.0")]
224  pub mod task {
225      //! Types and Traits for working with asynchronous tasks.
226 --
227 2.26.2.7.g19db9cfb68
228