From e480e1ffdbdf44274e3f2d0771d73ada48c9dda9 Mon Sep 17 00:00:00 2001 From: Hanif Ariffin Date: Sat, 19 Apr 2025 18:11:33 +0800 Subject: [PATCH] Forgot to add the stubs Signed-off-by: Hanif Ariffin --- tests/assembly/rust-abi-arg-attr.rs | 43 ++------------------- tests/assembly/simd-intrinsic-gather.rs | 3 -- tests/assembly/simd-intrinsic-mask-load.rs | 3 -- tests/auxiliary/minicore.rs | 44 +++++++++++++++++++++- 4 files changed, 46 insertions(+), 47 deletions(-) diff --git a/tests/assembly/rust-abi-arg-attr.rs b/tests/assembly/rust-abi-arg-attr.rs index 5b5eeb29f0f41..5b241cb84dd68 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 @@ -14,46 +15,8 @@ #![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-intrinsic-gather.rs b/tests/assembly/simd-intrinsic-gather.rs index bcab0ba1cc09b..665858eb14747 100644 --- a/tests/assembly/simd-intrinsic-gather.rs +++ b/tests/assembly/simd-intrinsic-gather.rs @@ -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..1994928a0b1b7 100644 --- a/tests/assembly/simd-intrinsic-mask-load.rs +++ b/tests/assembly/simd-intrinsic-mask-load.rs @@ -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/auxiliary/minicore.rs b/tests/auxiliary/minicore.rs index 03aa847650823..492b7666ca245 100644 --- a/tests/auxiliary/minicore.rs +++ b/tests/auxiliary/minicore.rs @@ -26,7 +26,8 @@ f16, f128, asm_experimental_arch, - unboxed_closures + unboxed_closures, + intrinsics )] #![allow(unused, improper_ctypes_definitions, internal_features)] #![no_std] @@ -191,3 +192,44 @@ impl<'a, 'b: 'a, T: ?Sized + Unsize, U: ?Sized> CoerceUnsized<&'a U> for &'b trait Drop { fn drop(&mut self); } + +#[lang = "neg"] +trait Neg: Sized { + type Output; + + fn neg(self) -> Self::Output; +} + +// Macro to implement Neg for a list of primitive numeric types +macro_rules! impl_neg_trait { + ( $($ty:ty),* $(,)? ) => { + $( + impl Neg for $ty { + type Output = $ty; + + fn neg(self) -> Self::Output { + -self + } + } + )* + } +} + +impl_neg_trait!(isize, i8, i16, i32, i64, i128,); + +#[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_gather(values: V, mask: M, pointer: P) -> V; + +#[rustc_intrinsic] +pub unsafe fn simd_masked_load(mask: M, pointer: P, values: T) -> T;