Merge pull request #130 from bjorn3/rustup

Rustup to rustc 1.61.0-nightly (4b043faba 2022-02-24)
This commit is contained in:
antoyo 2022-02-25 09:12:31 -05:00 committed by GitHub
commit ddbbded08f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 238 additions and 26 deletions

View File

@ -7,18 +7,230 @@ Subject: [PATCH] [core] Disable portable-simd test
library/core/tests/lib.rs | 1 -
1 file changed, 1 deletion(-)
diff --git a/library/core/src/lib.rs b/library/core/src/lib.rs
index aa1ad93..95fbf55 100644
--- a/library/core/src/lib.rs
+++ b/library/core/src/lib.rs
@@ -398,25 +398,4 @@ pub mod arch {
}
}
-// Pull in the `core_simd` crate directly into libcore. The contents of
-// `core_simd` are in a different repository: rust-lang/portable-simd.
-//
-// `core_simd` depends on libcore, but the contents of this module are
-// set up in such a way that directly pulling it here works such that the
-// crate uses this crate as its libcore.
-#[path = "../../portable-simd/crates/core_simd/src/mod.rs"]
-#[allow(missing_debug_implementations, dead_code, unsafe_op_in_unsafe_fn, unused_unsafe)]
-#[allow(rustdoc::bare_urls)]
-#[unstable(feature = "portable_simd", issue = "86656")]
-#[cfg(not(all(miri, doctest)))] // Miri does not support all SIMD intrinsics
-mod core_simd;
-
-#[doc = include_str!("../../portable-simd/crates/core_simd/src/core_simd_docs.md")]
-#[unstable(feature = "portable_simd", issue = "86656")]
-#[cfg(not(all(miri, doctest)))] // Miri does not support all SIMD intrinsics
-pub mod simd {
- #[unstable(feature = "portable_simd", issue = "86656")]
- pub use crate::core_simd::simd::*;
-}
-
include!("primitive_docs.rs");
diff --git a/library/core/src/slice/mod.rs b/library/core/src/slice/mod.rs
index cd38c3a..ad632dc 100644
--- a/library/core/src/slice/mod.rs
+++ b/library/core/src/slice/mod.rs
@@ -17,7 +17,6 @@ use crate::ptr;
use crate::result::Result;
use crate::result::Result::{Err, Ok};
#[cfg(not(miri))] // Miri does not support all SIMD intrinsics
-use crate::simd::{self, Simd};
use crate::slice;
#[unstable(
@@ -3475,123 +3474,6 @@ impl<T> [T] {
}
}
- /// Split a slice into a prefix, a middle of aligned SIMD types, and a suffix.
- ///
- /// This is a safe wrapper around [`slice::align_to`], so has the same weak
- /// postconditions as that method. You're only assured that
- /// `self.len() == prefix.len() + middle.len() * LANES + suffix.len()`.
- ///
- /// Notably, all of the following are possible:
- /// - `prefix.len() >= LANES`.
- /// - `middle.is_empty()` despite `self.len() >= 3 * LANES`.
- /// - `suffix.len() >= LANES`.
- ///
- /// That said, this is a safe method, so if you're only writing safe code,
- /// then this can at most cause incorrect logic, not unsoundness.
- ///
- /// # Panics
- ///
- /// This will panic if the size of the SIMD type is different from
- /// `LANES` times that of the scalar.
- ///
- /// At the time of writing, the trait restrictions on `Simd<T, LANES>` keeps
- /// that from ever happening, as only power-of-two numbers of lanes are
- /// supported. It's possible that, in the future, those restrictions might
- /// be lifted in a way that would make it possible to see panics from this
- /// method for something like `LANES == 3`.
- ///
- /// # Examples
- ///
- /// ```
- /// #![feature(portable_simd)]
- ///
- /// let short = &[1, 2, 3];
- /// let (prefix, middle, suffix) = short.as_simd::<4>();
- /// assert_eq!(middle, []); // Not enough elements for anything in the middle
- ///
- /// // They might be split in any possible way between prefix and suffix
- /// let it = prefix.iter().chain(suffix).copied();
- /// assert_eq!(it.collect::<Vec<_>>(), vec![1, 2, 3]);
- ///
- /// fn basic_simd_sum(x: &[f32]) -> f32 {
- /// use std::ops::Add;
- /// use std::simd::f32x4;
- /// let (prefix, middle, suffix) = x.as_simd();
- /// let sums = f32x4::from_array([
- /// prefix.iter().copied().sum(),
- /// 0.0,
- /// 0.0,
- /// suffix.iter().copied().sum(),
- /// ]);
- /// let sums = middle.iter().copied().fold(sums, f32x4::add);
- /// sums.horizontal_sum()
- /// }
- ///
- /// let numbers: Vec<f32> = (1..101).map(|x| x as _).collect();
- /// assert_eq!(basic_simd_sum(&numbers[1..99]), 4949.0);
- /// ```
- #[unstable(feature = "portable_simd", issue = "86656")]
- #[cfg(not(miri))] // Miri does not support all SIMD intrinsics
- pub fn as_simd<const LANES: usize>(&self) -> (&[T], &[Simd<T, LANES>], &[T])
- where
- Simd<T, LANES>: AsRef<[T; LANES]>,
- T: simd::SimdElement,
- simd::LaneCount<LANES>: simd::SupportedLaneCount,
- {
- // These are expected to always match, as vector types are laid out like
- // arrays per <https://llvm.org/docs/LangRef.html#vector-type>, but we
- // might as well double-check since it'll optimize away anyhow.
- assert_eq!(mem::size_of::<Simd<T, LANES>>(), mem::size_of::<[T; LANES]>());
-
- // SAFETY: The simd types have the same layout as arrays, just with
- // potentially-higher alignment, so the de-facto transmutes are sound.
- unsafe { self.align_to() }
- }
-
- /// Split a slice into a prefix, a middle of aligned SIMD types, and a suffix.
- ///
- /// This is a safe wrapper around [`slice::align_to_mut`], so has the same weak
- /// postconditions as that method. You're only assured that
- /// `self.len() == prefix.len() + middle.len() * LANES + suffix.len()`.
- ///
- /// Notably, all of the following are possible:
- /// - `prefix.len() >= LANES`.
- /// - `middle.is_empty()` despite `self.len() >= 3 * LANES`.
- /// - `suffix.len() >= LANES`.
- ///
- /// That said, this is a safe method, so if you're only writing safe code,
- /// then this can at most cause incorrect logic, not unsoundness.
- ///
- /// This is the mutable version of [`slice::as_simd`]; see that for examples.
- ///
- /// # Panics
- ///
- /// This will panic if the size of the SIMD type is different from
- /// `LANES` times that of the scalar.
- ///
- /// At the time of writing, the trait restrictions on `Simd<T, LANES>` keeps
- /// that from ever happening, as only power-of-two numbers of lanes are
- /// supported. It's possible that, in the future, those restrictions might
- /// be lifted in a way that would make it possible to see panics from this
- /// method for something like `LANES == 3`.
- #[unstable(feature = "portable_simd", issue = "86656")]
- #[cfg(not(miri))] // Miri does not support all SIMD intrinsics
- pub fn as_simd_mut<const LANES: usize>(&mut self) -> (&mut [T], &mut [Simd<T, LANES>], &mut [T])
- where
- Simd<T, LANES>: AsMut<[T; LANES]>,
- T: simd::SimdElement,
- simd::LaneCount<LANES>: simd::SupportedLaneCount,
- {
- // These are expected to always match, as vector types are laid out like
- // arrays per <https://llvm.org/docs/LangRef.html#vector-type>, but we
- // might as well double-check since it'll optimize away anyhow.
- assert_eq!(mem::size_of::<Simd<T, LANES>>(), mem::size_of::<[T; LANES]>());
-
- // SAFETY: The simd types have the same layout as arrays, just with
- // potentially-higher alignment, so the de-facto transmutes are sound.
- unsafe { self.align_to_mut() }
- }
-
/// Checks if the elements of this slice are sorted.
///
/// That is, for each element `a` and its following element `b`, `a <= b` must hold. If the
diff --git a/library/core/tests/lib.rs b/library/core/tests/lib.rs
index ec70034..7cd9e21 100644
index 06c7be0..359e2e7 100644
--- a/library/core/tests/lib.rs
+++ b/library/core/tests/lib.rs
@@ -121,7 +121,6 @@ mod pattern;
mod pin;
@@ -75,7 +75,6 @@
#![feature(never_type)]
#![feature(unwrap_infallible)]
#![feature(result_into_ok_or_err)]
-#![feature(portable_simd)]
#![feature(ptr_metadata)]
#![feature(once_cell)]
#![feature(option_result_contains)]
@@ -127,7 +126,6 @@ mod pin;
mod pin_macro;
mod ptr;
mod result;
-mod simd;
mod slice;
mod str;
mod str_lossy;
--
diff --git a/library/std/src/lib.rs b/library/std/src/lib.rs
index 5dc586d..b6fc48f 100644
--- a/library/std/src/lib.rs
+++ b/library/std/src/lib.rs
@@ -312,7 +312,6 @@
#![feature(panic_can_unwind)]
#![feature(panic_unwind)]
#![feature(platform_intrinsics)]
-#![feature(portable_simd)]
#![feature(prelude_import)]
#![feature(ptr_as_uninit)]
#![feature(ptr_internals)]
@@ -508,25 +508,6 @@ pub mod time;
#[unstable(feature = "once_cell", issue = "74465")]
pub mod lazy;
-// Pull in `std_float` crate into libstd. The contents of
-// `std_float` are in a different repository: rust-lang/portable-simd.
-#[path = "../../portable-simd/crates/std_float/src/lib.rs"]
-#[allow(missing_debug_implementations, dead_code, unsafe_op_in_unsafe_fn, unused_unsafe)]
-#[allow(rustdoc::bare_urls)]
-#[unstable(feature = "portable_simd", issue = "86656")]
-#[cfg(not(all(miri, doctest)))] // Miri does not support all SIMD intrinsics
-mod std_float;
-
-#[cfg(not(all(miri, doctest)))] // Miri does not support all SIMD intrinsics
-#[doc = include_str!("../../portable-simd/crates/core_simd/src/core_simd_docs.md")]
-#[unstable(feature = "portable_simd", issue = "86656")]
-pub mod simd {
- #[doc(inline)]
- pub use crate::std_float::StdFloat;
- #[doc(inline)]
- pub use core::simd::*;
-}
-
#[stable(feature = "futures_api", since = "1.36.0")]
pub mod task {
//! Types and Traits for working with asynchronous tasks.
--
2.26.2.7.g19db9cfb68

View File

@ -1,3 +1,3 @@
[toolchain]
channel = "nightly-2022-01-30"
channel = "nightly-2022-02-25"
components = ["rust-src", "rustc-dev", "llvm-tools-preview"]

View File

@ -113,9 +113,6 @@ impl<'a> ArchiveBuilder<'a> for ArArchiveBuilder<'a> {
Ok(())
}
fn update_symbols(&mut self) {
}
fn build(mut self) {
use std::process::Command;

View File

@ -390,11 +390,6 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> {
bx
}
fn build_sibling_block(&mut self, name: &str) -> Self {
let block = self.append_sibling_block(name);
Self::build(self.cx, block)
}
fn llbb(&self) -> Block<'gcc> {
self.block.expect("block")
}
@ -409,6 +404,11 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> {
func.new_block(name)
}
fn switch_to_block(&mut self, block: Self::BasicBlock) {
*self.cx.current_block.borrow_mut() = Some(block);
self.block = Some(block);
}
fn ret_void(&mut self) {
self.llbb().end_with_void_return(None)
}
@ -747,28 +747,31 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> {
let start = dest.project_index(&mut self, zero).llval;
let end = dest.project_index(&mut self, count).llval;
let mut header_bx = self.build_sibling_block("repeat_loop_header");
let mut body_bx = self.build_sibling_block("repeat_loop_body");
let next_bx = self.build_sibling_block("repeat_loop_next");
let header_bb = self.append_sibling_block("repeat_loop_header");
let body_bb = self.append_sibling_block("repeat_loop_body");
let next_bb = self.append_sibling_block("repeat_loop_next");
let ptr_type = start.get_type();
let current = self.llbb().get_function().new_local(None, ptr_type, "loop_var");
let current_val = current.to_rvalue();
self.assign(current, start);
self.br(header_bx.llbb());
self.br(header_bb);
let keep_going = header_bx.icmp(IntPredicate::IntNE, current_val, end);
header_bx.cond_br(keep_going, body_bx.llbb(), next_bx.llbb());
self.switch_to_block(header_bb);
let keep_going = self.icmp(IntPredicate::IntNE, current_val, end);
self.cond_br(keep_going, body_bb, next_bb);
self.switch_to_block(body_bb);
let align = dest.align.restrict_for_offset(dest.layout.field(self.cx(), 0).size);
cg_elem.val.store(&mut body_bx, PlaceRef::new_sized_aligned(current_val, cg_elem.layout, align));
cg_elem.val.store(&mut self, PlaceRef::new_sized_aligned(current_val, cg_elem.layout, align));
let next = body_bx.inbounds_gep(self.backend_type(cg_elem.layout), current.to_rvalue(), &[self.const_usize(1)]);
body_bx.llbb().add_assignment(None, current, next);
body_bx.br(header_bx.llbb());
let next = self.inbounds_gep(self.backend_type(cg_elem.layout), current.to_rvalue(), &[self.const_usize(1)]);
self.llbb().add_assignment(None, current, next);
self.br(header_bb);
next_bx
self.switch_to_block(next_bb);
self
}
fn range_metadata(&mut self, _load: RValue<'gcc>, _range: WrappingRange) {

View File

@ -149,7 +149,7 @@ impl<'gcc, 'tcx> StaticMethods for CodegenCx<'gcc, 'tcx> {
// TODO(antoyo): set link section.
}
if attrs.flags.contains(CodegenFnAttrFlags::USED) {
if attrs.flags.contains(CodegenFnAttrFlags::USED) || attrs.flags.contains(CodegenFnAttrFlags::USED_LINKER) {
self.add_used_global(global.to_rvalue());
}
}

View File

@ -52,7 +52,7 @@ pub fn uncached_gcc_type<'gcc, 'tcx>(cx: &CodegenCx<'gcc, 'tcx>, layout: TyAndLa
ty::Adt(..) | ty::Closure(..) | ty::Foreign(..) | ty::Generator(..) | ty::Str
if !cx.sess().fewer_names() =>
{
let mut name = with_no_trimmed_paths(|| layout.ty.to_string());
let mut name = with_no_trimmed_paths!(layout.ty.to_string());
if let (&ty::Adt(def, _), &Variants::Single { index }) =
(layout.ty.kind(), &layout.variants)
{