diff options
| author | bors <bors@rust-lang.org> | 2022-03-23 03:31:20 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2022-03-23 03:31:20 +0000 |
| commit | 7b0bf9efc939341b48c6e9a335dee8a280085100 (patch) | |
| tree | 8daa45d4c70bfbd9213d6a04908ff8eb43f130df /src/test | |
| parent | 2b50739b4978936750a0c8de404ff184e49114f9 (diff) | |
| parent | 2f24923ab3f38e33a2ad98618852e0089d63ba7d (diff) | |
| download | rust-7b0bf9efc939341b48c6e9a335dee8a280085100.tar.gz rust-7b0bf9efc939341b48c6e9a335dee8a280085100.zip | |
Auto merge of #95223 - Dylan-DPC:rollup-idpb7ka, r=Dylan-DPC
Rollup of 6 pull requests Successful merges: - #91608 (Fold aarch64 feature +fp into +neon) - #92955 (add perf side effect docs to `Iterator::cloned()`) - #94713 (Add u16::is_utf16_surrogate) - #95212 (Replace `this.clone()` with `this.create_snapshot_for_diagnostic()`) - #95219 (Modernize `alloc-no-oom-handling` test) - #95222 (interpret/validity: improve clarity) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/run-make-fulldeps/alloc-no-oom-handling/Makefile | 2 | ||||
| -rw-r--r-- | src/test/run-make-fulldeps/simd-ffi/Makefile | 2 | ||||
| -rw-r--r-- | src/test/ui/asm/aarch64/bad-reg.rs | 2 | ||||
| -rw-r--r-- | src/test/ui/target-feature/aarch64-neon-works.rs | 23 | ||||
| -rw-r--r-- | src/test/ui/target-feature/feature-hierarchy.rs | 58 | ||||
| -rw-r--r-- | src/test/ui/target-feature/no-llvm-leaks.rs | 64 |
6 files changed, 148 insertions, 3 deletions
diff --git a/src/test/run-make-fulldeps/alloc-no-oom-handling/Makefile b/src/test/run-make-fulldeps/alloc-no-oom-handling/Makefile index c68ae40eb94..6e25eb7e459 100644 --- a/src/test/run-make-fulldeps/alloc-no-oom-handling/Makefile +++ b/src/test/run-make-fulldeps/alloc-no-oom-handling/Makefile @@ -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 diff --git a/src/test/run-make-fulldeps/simd-ffi/Makefile b/src/test/run-make-fulldeps/simd-ffi/Makefile index 38f2fcd18c5..e9c974a0137 100644 --- a/src/test/run-make-fulldeps/simd-ffi/Makefile +++ b/src/test/run-make-fulldeps/simd-ffi/Makefile @@ -41,7 +41,7 @@ define MK_TARGETS # now. $(1): simd.rs $$(RUSTC) --target=$(1) --emit=llvm-ir,asm simd.rs \ - -C target-feature='+fp,+neon,+sse2' -C extra-filename=-$(1) + -C target-feature='+neon,+sse2' -C extra-filename=-$(1) endef $(foreach targetxxx,$(TARGETS),$(eval $(call MK_TARGETS,$(targetxxx)))) diff --git a/src/test/ui/asm/aarch64/bad-reg.rs b/src/test/ui/asm/aarch64/bad-reg.rs index 8619b3960a6..1a314101916 100644 --- a/src/test/ui/asm/aarch64/bad-reg.rs +++ b/src/test/ui/asm/aarch64/bad-reg.rs @@ -1,5 +1,5 @@ // only-aarch64 -// compile-flags: -C target-feature=+fp +// compile-flags: -C target-feature=+neon #![feature(asm_const, asm_sym)] diff --git a/src/test/ui/target-feature/aarch64-neon-works.rs b/src/test/ui/target-feature/aarch64-neon-works.rs new file mode 100644 index 00000000000..3878806fd02 --- /dev/null +++ b/src/test/ui/target-feature/aarch64-neon-works.rs @@ -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) +} diff --git a/src/test/ui/target-feature/feature-hierarchy.rs b/src/test/ui/target-feature/feature-hierarchy.rs new file mode 100644 index 00000000000..5fbd5e8a28d --- /dev/null +++ b/src/test/ui/target-feature/feature-hierarchy.rs @@ -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")); +} diff --git a/src/test/ui/target-feature/no-llvm-leaks.rs b/src/test/ui/target-feature/no-llvm-leaks.rs new file mode 100644 index 00000000000..5a71b2166c3 --- /dev/null +++ b/src/test/ui/target-feature/no-llvm-leaks.rs @@ -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"))); +} |
