diff --git a/tests/assembly/rust-abi-arg-attr.rs b/tests/assembly/rust-abi-arg-attr.rs index 5b5eeb29f0f41..6fbc9c1ce6f0f 100644 --- a/tests/assembly/rust-abi-arg-attr.rs +++ b/tests/assembly/rust-abi-arg-attr.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ assembly-output: emit-asm //@ revisions: riscv64 riscv64-zbb loongarch64 //@ compile-flags: -C opt-level=3 @@ -9,51 +10,13 @@ //@ [loongarch64] compile-flags: --target loongarch64-unknown-linux-gnu //@ [loongarch64] needs-llvm-components: loongarch -#![feature(no_core, lang_items, intrinsics, rustc_attrs)] +#![feature(no_core, lang_items, rustc_attrs)] #![crate_type = "lib"] #![no_std] #![no_core] -// FIXME: Migrate these code after PR #130693 is landed. -// vvvvv core - -#[lang = "sized"] -trait Sized {} - -#[lang = "copy"] -trait Copy {} - -impl Copy for i8 {} -impl Copy for u32 {} -impl Copy for i32 {} - -#[lang = "neg"] -trait Neg { - type Output; - - fn neg(self) -> Self::Output; -} - -impl Neg for i8 { - type Output = i8; - - fn neg(self) -> Self::Output { - -self - } -} - -#[lang = "Ordering"] -#[repr(i8)] -enum Ordering { - Less = -1, - Equal = 0, - Greater = 1, -} - -#[rustc_intrinsic] -fn three_way_compare(lhs: T, rhs: T) -> Ordering; - -// ^^^^^ core +extern crate minicore; +use minicore::*; // Reimplementation of function `{integer}::max`. macro_rules! max { diff --git a/tests/assembly/simd-bitmask.rs b/tests/assembly/simd-bitmask.rs index d3e20f6ae1a8e..cc7e4aa015ca2 100644 --- a/tests/assembly/simd-bitmask.rs +++ b/tests/assembly/simd-bitmask.rs @@ -13,7 +13,7 @@ //@ assembly-output: emit-asm //@ compile-flags: --crate-type=lib -Copt-level=3 -C panic=abort -#![feature(no_core, lang_items, repr_simd, intrinsics)] +#![feature(no_core, lang_items, repr_simd)] #![no_core] #![allow(non_camel_case_types)] @@ -35,9 +35,6 @@ pub struct m64x2([i64; 2]); #[repr(simd)] pub struct m64x4([i64; 4]); -#[rustc_intrinsic] -unsafe fn simd_bitmask(mask: V) -> B; - // CHECK-LABEL: bitmask_m8x16 #[no_mangle] pub unsafe extern "C" fn bitmask_m8x16(mask: m8x16) -> u16 { diff --git a/tests/assembly/simd-intrinsic-gather.rs b/tests/assembly/simd-intrinsic-gather.rs index bcab0ba1cc09b..e656d44df9d4c 100644 --- a/tests/assembly/simd-intrinsic-gather.rs +++ b/tests/assembly/simd-intrinsic-gather.rs @@ -6,7 +6,7 @@ //@ assembly-output: emit-asm //@ compile-flags: --crate-type=lib -Copt-level=3 -C panic=abort -#![feature(no_core, lang_items, repr_simd, intrinsics)] +#![feature(no_core, lang_items, repr_simd)] #![no_core] #![allow(non_camel_case_types)] @@ -22,9 +22,6 @@ pub struct m64x4([i64; 4]); #[repr(simd)] pub struct pf64x4([*const f64; 4]); -#[rustc_intrinsic] -unsafe fn simd_gather(values: V, mask: M, pointer: P) -> V; - // CHECK-LABEL: gather_f64x4 #[no_mangle] pub unsafe extern "C" fn gather_f64x4(mask: m64x4, ptrs: pf64x4) -> f64x4 { diff --git a/tests/assembly/simd-intrinsic-mask-load.rs b/tests/assembly/simd-intrinsic-mask-load.rs index d3f3453a780a4..ee34d928055c7 100644 --- a/tests/assembly/simd-intrinsic-mask-load.rs +++ b/tests/assembly/simd-intrinsic-mask-load.rs @@ -9,7 +9,7 @@ //@ assembly-output: emit-asm //@ compile-flags: --crate-type=lib -Copt-level=3 -C panic=abort -#![feature(no_core, lang_items, repr_simd, intrinsics)] +#![feature(no_core, lang_items, repr_simd)] #![no_core] #![allow(non_camel_case_types)] @@ -34,9 +34,6 @@ pub struct f64x4([f64; 4]); #[repr(simd)] pub struct m64x4([i64; 4]); -#[rustc_intrinsic] -unsafe fn simd_masked_load(mask: M, pointer: P, values: T) -> T; - // CHECK-LABEL: load_i8x16 #[no_mangle] pub unsafe extern "C" fn load_i8x16(mask: m8x16, pointer: *const i8) -> i8x16 { diff --git a/tests/assembly/simd-intrinsic-mask-reduce.rs b/tests/assembly/simd-intrinsic-mask-reduce.rs index 8b15ed0a254c6..427282445afc8 100644 --- a/tests/assembly/simd-intrinsic-mask-reduce.rs +++ b/tests/assembly/simd-intrinsic-mask-reduce.rs @@ -10,7 +10,7 @@ //@ assembly-output: emit-asm //@ compile-flags: --crate-type=lib -Copt-level=3 -C panic=abort -#![feature(no_core, lang_items, repr_simd, intrinsics)] +#![feature(no_core, lang_items, repr_simd)] #![no_core] #![allow(non_camel_case_types)] @@ -20,11 +20,6 @@ use minicore::*; #[repr(simd)] pub struct mask8x16([i8; 16]); -#[rustc_intrinsic] -unsafe fn simd_reduce_all(x: T) -> bool; -#[rustc_intrinsic] -unsafe fn simd_reduce_any(x: T) -> bool; - // CHECK-LABEL: mask_reduce_all: #[no_mangle] pub unsafe extern "C" fn mask_reduce_all(m: mask8x16) -> bool { diff --git a/tests/assembly/simd-intrinsic-mask-store.rs b/tests/assembly/simd-intrinsic-mask-store.rs index 001762e5060db..3430709ae7c32 100644 --- a/tests/assembly/simd-intrinsic-mask-store.rs +++ b/tests/assembly/simd-intrinsic-mask-store.rs @@ -9,7 +9,7 @@ //@ assembly-output: emit-asm //@ compile-flags: --crate-type=lib -Copt-level=3 -C panic=abort -#![feature(no_core, lang_items, repr_simd, intrinsics)] +#![feature(no_core, lang_items, repr_simd)] #![no_core] #![allow(non_camel_case_types)] @@ -34,9 +34,6 @@ pub struct f64x4([f64; 4]); #[repr(simd)] pub struct m64x4([i64; 4]); -#[rustc_intrinsic] -unsafe fn simd_masked_store(mask: M, pointer: P, values: T); - // CHECK-LABEL: store_i8x16 #[no_mangle] pub unsafe extern "C" fn store_i8x16(mask: m8x16, pointer: *mut i8, value: i8x16) { diff --git a/tests/assembly/simd-intrinsic-scatter.rs b/tests/assembly/simd-intrinsic-scatter.rs index d77dfad3546d8..8be36cec9f2cd 100644 --- a/tests/assembly/simd-intrinsic-scatter.rs +++ b/tests/assembly/simd-intrinsic-scatter.rs @@ -6,7 +6,7 @@ //@ assembly-output: emit-asm //@ compile-flags: --crate-type=lib -Copt-level=3 -C panic=abort -#![feature(no_core, lang_items, repr_simd, intrinsics)] +#![feature(no_core, lang_items, repr_simd)] #![no_core] #![allow(non_camel_case_types)] @@ -22,9 +22,6 @@ pub struct m64x4([i64; 4]); #[repr(simd)] pub struct pf64x4([*mut f64; 4]); -#[rustc_intrinsic] -unsafe fn simd_scatter(values: V, pointer: P, mask: M); - // CHECK-LABEL: scatter_f64x4 #[no_mangle] pub unsafe extern "C" fn scatter_f64x4(values: f64x4, ptrs: pf64x4, mask: m64x4) { diff --git a/tests/assembly/simd-intrinsic-select.rs b/tests/assembly/simd-intrinsic-select.rs index e7c7b0db0d5e3..844411cafc764 100644 --- a/tests/assembly/simd-intrinsic-select.rs +++ b/tests/assembly/simd-intrinsic-select.rs @@ -11,7 +11,7 @@ //@ assembly-output: emit-asm //@ compile-flags: --crate-type=lib -Copt-level=3 -C panic=abort -#![feature(no_core, lang_items, repr_simd, intrinsics)] +#![feature(no_core, lang_items, repr_simd)] #![no_core] #![allow(non_camel_case_types)] @@ -48,9 +48,6 @@ pub struct f64x8([f64; 8]); #[repr(simd)] pub struct m64x8([i64; 8]); -#[rustc_intrinsic] -unsafe fn simd_select(mask: M, a: V, b: V) -> V; - // CHECK-LABEL: select_i8x16 #[no_mangle] pub unsafe extern "C" fn select_i8x16(mask: m8x16, a: i8x16, b: i8x16) -> i8x16 { diff --git a/tests/auxiliary/minicore.rs b/tests/auxiliary/minicore.rs index 941c4abed4679..dc812fb35feb9 100644 --- a/tests/auxiliary/minicore.rs +++ b/tests/auxiliary/minicore.rs @@ -25,7 +25,8 @@ f16, f128, asm_experimental_arch, - unboxed_closures + unboxed_closures, + intrinsics )] #![allow(unused, improper_ctypes_definitions, internal_features)] #![no_std] @@ -190,3 +191,59 @@ impl<'a, 'b: 'a, T: ?Sized + Unsize, U: ?Sized> CoerceUnsized<&'a U> for &'b trait Drop { fn drop(&mut self); } + +#[lang = "panic"] +pub fn panic(_msg: &'static str) {} + +#[lang = "panic_const_neg_overflow"] +pub fn panic_const_neg_overflow() {} + +#[lang = "neg"] +trait Neg { + type Output; + + fn neg(self) -> Self::Output; +} + +impl Neg for i8 { + type Output = i8; + + fn neg(self) -> Self::Output { + -self + } +} + +#[lang = "Ordering"] +#[repr(i8)] +pub enum Ordering { + Less = -1, + Equal = 0, + Greater = 1, +} + +#[rustc_intrinsic] +pub fn three_way_compare(lhs: T, rhs: T) -> Ordering; + +#[rustc_intrinsic] +pub unsafe fn simd_bitmask(mask: V) -> B; + +#[rustc_intrinsic] +pub unsafe fn simd_gather(values: V, mask: M, pointer: P) -> V; + +#[rustc_intrinsic] +pub unsafe fn simd_masked_load(mask: M, pointer: P, values: T) -> T; + +#[rustc_intrinsic] +pub unsafe fn simd_reduce_all(x: T) -> bool; + +#[rustc_intrinsic] +pub unsafe fn simd_reduce_any(x: T) -> bool; + +#[rustc_intrinsic] +pub unsafe fn simd_masked_store(mask: M, pointer: P, values: T); + +#[rustc_intrinsic] +pub unsafe fn simd_scatter(values: V, pointer: P, mask: M); + +#[rustc_intrinsic] +pub unsafe fn simd_select(mask: M, a: V, b: V) -> V;