Skip to content

Commit c0082f9

Browse files
committed
tests: use minicore for tests/assembly
1 parent 444a627 commit c0082f9

9 files changed

+63
-72
lines changed

tests/assembly/rust-abi-arg-attr.rs

Lines changed: 4 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//@ add-core-stubs
12
//@ assembly-output: emit-asm
23
//@ revisions: riscv64 riscv64-zbb loongarch64
34
//@ compile-flags: -C opt-level=3
@@ -9,51 +10,13 @@
910
//@ [loongarch64] compile-flags: --target loongarch64-unknown-linux-gnu
1011
//@ [loongarch64] needs-llvm-components: loongarch
1112

12-
#![feature(no_core, lang_items, intrinsics, rustc_attrs)]
13+
#![feature(no_core, lang_items, rustc_attrs)]
1314
#![crate_type = "lib"]
1415
#![no_std]
1516
#![no_core]
1617

17-
// FIXME: Migrate these code after PR #130693 is landed.
18-
// vvvvv core
19-
20-
#[lang = "sized"]
21-
trait Sized {}
22-
23-
#[lang = "copy"]
24-
trait Copy {}
25-
26-
impl Copy for i8 {}
27-
impl Copy for u32 {}
28-
impl Copy for i32 {}
29-
30-
#[lang = "neg"]
31-
trait Neg {
32-
type Output;
33-
34-
fn neg(self) -> Self::Output;
35-
}
36-
37-
impl Neg for i8 {
38-
type Output = i8;
39-
40-
fn neg(self) -> Self::Output {
41-
-self
42-
}
43-
}
44-
45-
#[lang = "Ordering"]
46-
#[repr(i8)]
47-
enum Ordering {
48-
Less = -1,
49-
Equal = 0,
50-
Greater = 1,
51-
}
52-
53-
#[rustc_intrinsic]
54-
fn three_way_compare<T: Copy>(lhs: T, rhs: T) -> Ordering;
55-
56-
// ^^^^^ core
18+
extern crate minicore;
19+
use minicore::*;
5720

5821
// Reimplementation of function `{integer}::max`.
5922
macro_rules! max {

tests/assembly/simd-bitmask.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
//@ assembly-output: emit-asm
1414
//@ compile-flags: --crate-type=lib -Copt-level=3 -C panic=abort
1515

16-
#![feature(no_core, lang_items, repr_simd, intrinsics)]
16+
#![feature(no_core, lang_items, repr_simd)]
1717
#![no_core]
1818
#![allow(non_camel_case_types)]
1919

@@ -35,9 +35,6 @@ pub struct m64x2([i64; 2]);
3535
#[repr(simd)]
3636
pub struct m64x4([i64; 4]);
3737

38-
#[rustc_intrinsic]
39-
unsafe fn simd_bitmask<V, B>(mask: V) -> B;
40-
4138
// CHECK-LABEL: bitmask_m8x16
4239
#[no_mangle]
4340
pub unsafe extern "C" fn bitmask_m8x16(mask: m8x16) -> u16 {

tests/assembly/simd-intrinsic-gather.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
//@ assembly-output: emit-asm
77
//@ compile-flags: --crate-type=lib -Copt-level=3 -C panic=abort
88

9-
#![feature(no_core, lang_items, repr_simd, intrinsics)]
9+
#![feature(no_core, lang_items, repr_simd)]
1010
#![no_core]
1111
#![allow(non_camel_case_types)]
1212

@@ -22,9 +22,6 @@ pub struct m64x4([i64; 4]);
2222
#[repr(simd)]
2323
pub struct pf64x4([*const f64; 4]);
2424

25-
#[rustc_intrinsic]
26-
unsafe fn simd_gather<V, M, P>(values: V, mask: M, pointer: P) -> V;
27-
2825
// CHECK-LABEL: gather_f64x4
2926
#[no_mangle]
3027
pub unsafe extern "C" fn gather_f64x4(mask: m64x4, ptrs: pf64x4) -> f64x4 {

tests/assembly/simd-intrinsic-mask-load.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
//@ assembly-output: emit-asm
1010
//@ compile-flags: --crate-type=lib -Copt-level=3 -C panic=abort
1111

12-
#![feature(no_core, lang_items, repr_simd, intrinsics)]
12+
#![feature(no_core, lang_items, repr_simd)]
1313
#![no_core]
1414
#![allow(non_camel_case_types)]
1515

@@ -34,9 +34,6 @@ pub struct f64x4([f64; 4]);
3434
#[repr(simd)]
3535
pub struct m64x4([i64; 4]);
3636

37-
#[rustc_intrinsic]
38-
unsafe fn simd_masked_load<M, P, T>(mask: M, pointer: P, values: T) -> T;
39-
4037
// CHECK-LABEL: load_i8x16
4138
#[no_mangle]
4239
pub unsafe extern "C" fn load_i8x16(mask: m8x16, pointer: *const i8) -> i8x16 {

tests/assembly/simd-intrinsic-mask-reduce.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
//@ assembly-output: emit-asm
1111
//@ compile-flags: --crate-type=lib -Copt-level=3 -C panic=abort
1212

13-
#![feature(no_core, lang_items, repr_simd, intrinsics)]
13+
#![feature(no_core, lang_items, repr_simd)]
1414
#![no_core]
1515
#![allow(non_camel_case_types)]
1616

@@ -20,11 +20,6 @@ use minicore::*;
2020
#[repr(simd)]
2121
pub struct mask8x16([i8; 16]);
2222

23-
#[rustc_intrinsic]
24-
unsafe fn simd_reduce_all<T>(x: T) -> bool;
25-
#[rustc_intrinsic]
26-
unsafe fn simd_reduce_any<T>(x: T) -> bool;
27-
2823
// CHECK-LABEL: mask_reduce_all:
2924
#[no_mangle]
3025
pub unsafe extern "C" fn mask_reduce_all(m: mask8x16) -> bool {

tests/assembly/simd-intrinsic-mask-store.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
//@ assembly-output: emit-asm
1010
//@ compile-flags: --crate-type=lib -Copt-level=3 -C panic=abort
1111

12-
#![feature(no_core, lang_items, repr_simd, intrinsics)]
12+
#![feature(no_core, lang_items, repr_simd)]
1313
#![no_core]
1414
#![allow(non_camel_case_types)]
1515

@@ -34,9 +34,6 @@ pub struct f64x4([f64; 4]);
3434
#[repr(simd)]
3535
pub struct m64x4([i64; 4]);
3636

37-
#[rustc_intrinsic]
38-
unsafe fn simd_masked_store<M, P, T>(mask: M, pointer: P, values: T);
39-
4037
// CHECK-LABEL: store_i8x16
4138
#[no_mangle]
4239
pub unsafe extern "C" fn store_i8x16(mask: m8x16, pointer: *mut i8, value: i8x16) {

tests/assembly/simd-intrinsic-scatter.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
//@ assembly-output: emit-asm
77
//@ compile-flags: --crate-type=lib -Copt-level=3 -C panic=abort
88

9-
#![feature(no_core, lang_items, repr_simd, intrinsics)]
9+
#![feature(no_core, lang_items, repr_simd)]
1010
#![no_core]
1111
#![allow(non_camel_case_types)]
1212

@@ -22,9 +22,6 @@ pub struct m64x4([i64; 4]);
2222
#[repr(simd)]
2323
pub struct pf64x4([*mut f64; 4]);
2424

25-
#[rustc_intrinsic]
26-
unsafe fn simd_scatter<V, P, M>(values: V, pointer: P, mask: M);
27-
2825
// CHECK-LABEL: scatter_f64x4
2926
#[no_mangle]
3027
pub unsafe extern "C" fn scatter_f64x4(values: f64x4, ptrs: pf64x4, mask: m64x4) {

tests/assembly/simd-intrinsic-select.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
//@ assembly-output: emit-asm
1212
//@ compile-flags: --crate-type=lib -Copt-level=3 -C panic=abort
1313

14-
#![feature(no_core, lang_items, repr_simd, intrinsics)]
14+
#![feature(no_core, lang_items, repr_simd)]
1515
#![no_core]
1616
#![allow(non_camel_case_types)]
1717

@@ -48,9 +48,6 @@ pub struct f64x8([f64; 8]);
4848
#[repr(simd)]
4949
pub struct m64x8([i64; 8]);
5050

51-
#[rustc_intrinsic]
52-
unsafe fn simd_select<M, V>(mask: M, a: V, b: V) -> V;
53-
5451
// CHECK-LABEL: select_i8x16
5552
#[no_mangle]
5653
pub unsafe extern "C" fn select_i8x16(mask: m8x16, a: i8x16, b: i8x16) -> i8x16 {

tests/auxiliary/minicore.rs

Lines changed: 52 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@
2525
f16,
2626
f128,
2727
asm_experimental_arch,
28-
unboxed_closures
28+
unboxed_closures,
29+
intrinsics
2930
)]
3031
#![allow(unused, improper_ctypes_definitions, internal_features)]
3132
#![no_std]
@@ -190,3 +191,53 @@ impl<'a, 'b: 'a, T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<&'a U> for &'b
190191
trait Drop {
191192
fn drop(&mut self);
192193
}
194+
195+
#[lang = "neg"]
196+
trait Neg {
197+
type Output;
198+
199+
fn neg(self) -> Self::Output;
200+
}
201+
202+
impl Neg for i8 {
203+
type Output = i8;
204+
205+
fn neg(self) -> Self::Output {
206+
-self
207+
}
208+
}
209+
210+
#[lang = "Ordering"]
211+
#[repr(i8)]
212+
pub enum Ordering {
213+
Less = -1,
214+
Equal = 0,
215+
Greater = 1,
216+
}
217+
218+
#[rustc_intrinsic]
219+
pub fn three_way_compare<T: Copy>(lhs: T, rhs: T) -> Ordering;
220+
221+
#[rustc_intrinsic]
222+
pub unsafe fn simd_bitmask<V, B>(mask: V) -> B;
223+
224+
#[rustc_intrinsic]
225+
pub unsafe fn simd_gather<V, M, P>(values: V, mask: M, pointer: P) -> V;
226+
227+
#[rustc_intrinsic]
228+
pub unsafe fn simd_masked_load<M, P, T>(mask: M, pointer: P, values: T) -> T;
229+
230+
#[rustc_intrinsic]
231+
pub unsafe fn simd_reduce_all<T>(x: T) -> bool;
232+
233+
#[rustc_intrinsic]
234+
pub unsafe fn simd_reduce_any<T>(x: T) -> bool;
235+
236+
#[rustc_intrinsic]
237+
pub unsafe fn simd_masked_store<M, P, T>(mask: M, pointer: P, values: T);
238+
239+
#[rustc_intrinsic]
240+
pub unsafe fn simd_scatter<V, P, M>(values: V, pointer: P, mask: M);
241+
242+
#[rustc_intrinsic]
243+
pub unsafe fn simd_select<M, V>(mask: M, a: V, b: V) -> V;

0 commit comments

Comments
 (0)