forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of rust-lang#95223 - Dylan-DPC:rollup-idpb7ka, r=Dylan-DPC
Rollup of 6 pull requests Successful merges: - rust-lang#91608 (Fold aarch64 feature +fp into +neon) - rust-lang#92955 (add perf side effect docs to `Iterator::cloned()`) - rust-lang#94713 (Add u16::is_utf16_surrogate) - rust-lang#95212 (Replace `this.clone()` with `this.create_snapshot_for_diagnostic()`) - rust-lang#95219 (Modernize `alloc-no-oom-handling` test) - rust-lang#95222 (interpret/validity: improve clarity) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
- Loading branch information
Showing
16 changed files
with
206 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
-include ../tools.mk | ||
|
||
all: | ||
$(RUSTC) --edition=2018 --crate-type=rlib ../../../../library/alloc/src/lib.rs --cfg feature=\"external_crate\" --cfg no_global_oom_handling | ||
$(RUSTC) --edition=2021 --crate-type=rlib ../../../../library/alloc/src/lib.rs --cfg no_global_oom_handling |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// only-aarch64 | ||
// run-pass | ||
#![allow(dead_code)] | ||
use std::arch::*; | ||
use std::arch::aarch64::*; | ||
|
||
// Smoke test to verify aarch64 code that enables NEON compiles. | ||
fn main() { | ||
let _zero = if is_aarch64_feature_detected!("neon") { | ||
unsafe { | ||
let zeros = zero_vector(); | ||
vgetq_lane_u8::<1>(zeros) | ||
} | ||
} else { | ||
0 | ||
}; | ||
} | ||
|
||
|
||
#[target_feature(enable = "neon")] | ||
unsafe fn zero_vector() -> uint8x16_t { | ||
vmovq_n_u8(0) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
// revisions: aarch64-neon aarch64-sve2 | ||
// [aarch64-neon] compile-flags: -Ctarget-feature=+neon --target=aarch64-unknown-linux-gnu | ||
// [aarch64-neon] needs-llvm-components: aarch64 | ||
// [aarch64-sve2] compile-flags: -Ctarget-feature=-neon,+sve2 --target=aarch64-unknown-linux-gnu | ||
// [aarch64-sve2] needs-llvm-components: aarch64 | ||
// build-pass | ||
#![no_core] | ||
#![crate_type = "rlib"] | ||
#![feature(intrinsics, rustc_attrs, no_core, lang_items, staged_api)] | ||
#![stable(feature = "test", since = "1.0.0")] | ||
|
||
// Tests vetting "feature hierarchies" in the cases where we impose them. | ||
|
||
// Supporting minimal rust core code | ||
#[lang = "sized"] | ||
trait Sized {} | ||
#[lang = "copy"] | ||
trait Copy {} | ||
impl Copy for bool {} | ||
|
||
extern "rust-intrinsic" { | ||
#[rustc_const_stable(feature = "test", since = "1.0.0")] | ||
fn unreachable() -> !; | ||
} | ||
|
||
#[rustc_builtin_macro] | ||
macro_rules! cfg { | ||
($($cfg:tt)*) => {}; | ||
} | ||
|
||
// Test code | ||
const fn do_or_die(cond: bool) { | ||
if cond { | ||
} else { | ||
unsafe { unreachable() } | ||
} | ||
} | ||
|
||
macro_rules! assert { | ||
($x:expr $(,)?) => { | ||
const _: () = do_or_die($x); | ||
}; | ||
} | ||
|
||
|
||
#[cfg(aarch64_neon)] | ||
fn check_neon_not_sve2() { | ||
// This checks that a normal aarch64 target doesn't suddenly jump up the feature hierarchy. | ||
assert!(cfg!(target_feature = "neon")); | ||
assert!(cfg!(not(target_feature = "sve2"))); | ||
} | ||
|
||
#[cfg(aarch64_sve2)] | ||
fn check_sve2_includes_neon() { | ||
// This checks that aarch64's sve2 includes neon | ||
assert!(cfg!(target_feature = "neon")); | ||
assert!(cfg!(target_feature = "sve2")); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
// revisions: aarch64 x86-64 | ||
// [aarch64] compile-flags: -Ctarget-feature=+neon,+fp16,+fhm --target=aarch64-unknown-linux-gnu | ||
// [aarch64] needs-llvm-components: aarch64 | ||
// [x86-64] compile-flags: -Ctarget-feature=+sse4.2,+rdrand --target=x86_64-unknown-linux-gnu | ||
// [x86-64] needs-llvm-components: x86 | ||
// build-pass | ||
#![no_core] | ||
#![crate_type = "rlib"] | ||
#![feature(intrinsics, rustc_attrs, no_core, lang_items, staged_api)] | ||
#![stable(feature = "test", since = "1.0.0")] | ||
|
||
// Supporting minimal rust core code | ||
#[lang = "sized"] | ||
trait Sized {} | ||
#[lang = "copy"] | ||
trait Copy {} | ||
impl Copy for bool {} | ||
|
||
extern "rust-intrinsic" { | ||
#[rustc_const_stable(feature = "test", since = "1.0.0")] | ||
fn unreachable() -> !; | ||
} | ||
|
||
#[rustc_builtin_macro] | ||
macro_rules! cfg { | ||
($($cfg:tt)*) => {}; | ||
} | ||
|
||
// Test code | ||
const fn do_or_die(cond: bool) { | ||
if cond { | ||
} else { | ||
unsafe { unreachable() } | ||
} | ||
} | ||
|
||
macro_rules! assert { | ||
($x:expr $(,)?) => { | ||
const _: () = do_or_die($x); | ||
}; | ||
} | ||
|
||
|
||
#[cfg(target_arch = "aarch64")] | ||
fn check_aarch64() { | ||
// This checks that the rustc feature name is used, not the LLVM feature. | ||
assert!(cfg!(target_feature = "neon")); | ||
assert!(cfg!(not(target_feature = "fp-armv8"))); | ||
assert!(cfg!(target_feature = "fhm")); | ||
assert!(cfg!(not(target_feature = "fp16fml"))); | ||
assert!(cfg!(target_feature = "fp16")); | ||
assert!(cfg!(not(target_feature = "fullfp16"))); | ||
} | ||
|
||
#[cfg(target_arch = "x86_64")] | ||
fn check_x86_64() { | ||
// This checks that the rustc feature name is used, not the LLVM feature. | ||
assert!(cfg!(target_feature = "rdrand")); | ||
assert!(cfg!(not(target_feature = "rdrnd"))); | ||
|
||
// Likewise: We enable LLVM's crc32 feature with SSE4.2, but Rust says it's just SSE4.2 | ||
assert!(cfg!(target_feature = "sse4.2")); | ||
assert!(cfg!(not(target_feature = "crc32"))); | ||
} |