Skip to content

Commit 4013077

Browse files
make fastcall-inreg and riscv64-lp64-lp64f-lp64d-abi tests able to run on any host platform (with the right llvm components)
1 parent ae87700 commit 4013077

File tree

2 files changed

+21
-56
lines changed

2 files changed

+21
-56
lines changed

src/test/codegen/fastcall-inreg.rs

+9-44
Original file line numberDiff line numberDiff line change
@@ -2,52 +2,17 @@
22
// as "inreg" like the C/C++ compilers for the platforms.
33
// x86 only.
44

5-
// ignore-aarch64
6-
// ignore-aarch64_be
7-
// ignore-arm
8-
// ignore-armeb
9-
// ignore-avr
10-
// ignore-bpfel
11-
// ignore-bpfeb
12-
// ignore-hexagon
13-
// ignore-mips
14-
// ignore-mips64
15-
// ignore-msp430
16-
// ignore-powerpc64
17-
// ignore-powerpc64le
18-
// ignore-powerpc
19-
// ignore-r600
20-
// ignore-riscv64
21-
// ignore-amdgcn
22-
// ignore-sparc
23-
// ignore-sparc64
24-
// ignore-sparcv9
25-
// ignore-sparcel
26-
// ignore-s390x
27-
// ignore-tce
28-
// ignore-thumb
29-
// ignore-thumbeb
30-
// ignore-x86_64
31-
// ignore-xcore
32-
// ignore-nvptx
33-
// ignore-nvptx64
34-
// ignore-le32
35-
// ignore-le64
36-
// ignore-amdil
37-
// ignore-amdil64
38-
// ignore-hsail
39-
// ignore-hsail64
40-
// ignore-spir
41-
// ignore-spir64
42-
// ignore-kalimba
43-
// ignore-shave
44-
// ignore-wasm32
45-
// ignore-wasm64
46-
// ignore-emscripten
47-
48-
// compile-flags: -C no-prepopulate-passes
5+
// compile-flags: --target i686-unknown-linux-gnu -C no-prepopulate-passes
6+
// needs-llvm-components: x86
497

508
#![crate_type = "lib"]
9+
#![no_core]
10+
#![feature(no_core, lang_items)]
11+
12+
#[lang = "sized"]
13+
trait Sized {}
14+
#[lang = "copy"]
15+
trait Copy {}
5116

5217
pub mod tests {
5318
// CHECK: @f1(i32 inreg %_1, i32 inreg %_2, i32 %_3)

src/test/codegen/riscv-abi/riscv64-lp64-lp64f-lp64d-abi.rs

+12-12
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
1-
//
2-
// compile-flags: -C no-prepopulate-passes
3-
// only-riscv64
4-
// only-linux
1+
// compile-flags: --target riscv64gc-unknown-linux-gnu -C no-prepopulate-passes
2+
// needs-llvm-components: riscv
3+
54
#![crate_type = "lib"]
5+
#![no_core]
6+
#![feature(no_core, lang_items)]
67
#![allow(improper_ctypes)]
78

9+
#[lang = "sized"]
10+
trait Sized {}
11+
#[lang = "copy"]
12+
trait Copy {}
13+
814
// CHECK: define void @f_void()
915
#[no_mangle]
1016
pub extern "C" fn f_void() {}
@@ -70,8 +76,6 @@ pub struct Tiny {
7076
// CHECK: define void @f_agg_tiny(i64 %0)
7177
#[no_mangle]
7278
pub extern "C" fn f_agg_tiny(mut e: Tiny) {
73-
e.a += e.b;
74-
e.c += e.d;
7579
}
7680

7781
// CHECK: define i64 @f_agg_tiny_ret()
@@ -89,14 +93,12 @@ pub struct Small {
8993
// CHECK: define void @f_agg_small([2 x i64] %0)
9094
#[no_mangle]
9195
pub extern "C" fn f_agg_small(mut x: Small) {
92-
x.a += unsafe { *x.b };
93-
x.b = &mut x.a;
9496
}
9597

9698
// CHECK: define [2 x i64] @f_agg_small_ret()
9799
#[no_mangle]
98100
pub extern "C" fn f_agg_small_ret() -> Small {
99-
Small { a: 1, b: core::ptr::null_mut() }
101+
Small { a: 1, b: 0 as *mut _ }
100102
}
101103

102104
#[repr(C)]
@@ -107,7 +109,6 @@ pub struct SmallAligned {
107109
// CHECK: define void @f_agg_small_aligned(i128 %0)
108110
#[no_mangle]
109111
pub extern "C" fn f_agg_small_aligned(mut x: SmallAligned) {
110-
x.a += x.a;
111112
}
112113

113114
#[repr(C)]
@@ -121,7 +122,6 @@ pub struct Large {
121122
// CHECK: define void @f_agg_large(%Large* {{.*}}%x)
122123
#[no_mangle]
123124
pub extern "C" fn f_agg_large(mut x: Large) {
124-
x.a = x.b + x.c + x.d;
125125
}
126126

127127
// CHECK: define void @f_agg_large_ret(%Large* {{.*}}sret{{.*}}, i32 signext %i, i8 signext %j)
@@ -172,7 +172,7 @@ pub unsafe extern "C" fn f_va_caller() {
172172
4.0f64,
173173
5.0f64,
174174
Tiny { a: 1, b: 2, c: 3, d: 4 },
175-
Small { a: 10, b: core::ptr::null_mut() },
175+
Small { a: 10, b: 0 as *mut _ },
176176
SmallAligned { a: 11 },
177177
Large { a: 12, b: 13, c: 14, d: 15 },
178178
);

0 commit comments

Comments
 (0)