Skip to content

Commit

Permalink
make fastcall-inreg and riscv64-lp64-lp64f-lp64d-abi tests able to ru…
Browse files Browse the repository at this point in the history
…n on any host platform (with the right llvm components)
  • Loading branch information
erikdesjardins committed Feb 12, 2022
1 parent ae87700 commit 4013077
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 56 deletions.
53 changes: 9 additions & 44 deletions src/test/codegen/fastcall-inreg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,52 +2,17 @@
// as "inreg" like the C/C++ compilers for the platforms.
// x86 only.

// ignore-aarch64
// ignore-aarch64_be
// ignore-arm
// ignore-armeb
// ignore-avr
// ignore-bpfel
// ignore-bpfeb
// ignore-hexagon
// ignore-mips
// ignore-mips64
// ignore-msp430
// ignore-powerpc64
// ignore-powerpc64le
// ignore-powerpc
// ignore-r600
// ignore-riscv64
// ignore-amdgcn
// ignore-sparc
// ignore-sparc64
// ignore-sparcv9
// ignore-sparcel
// ignore-s390x
// ignore-tce
// ignore-thumb
// ignore-thumbeb
// ignore-x86_64
// ignore-xcore
// ignore-nvptx
// ignore-nvptx64
// ignore-le32
// ignore-le64
// ignore-amdil
// ignore-amdil64
// ignore-hsail
// ignore-hsail64
// ignore-spir
// ignore-spir64
// ignore-kalimba
// ignore-shave
// ignore-wasm32
// ignore-wasm64
// ignore-emscripten

// compile-flags: -C no-prepopulate-passes
// compile-flags: --target i686-unknown-linux-gnu -C no-prepopulate-passes
// needs-llvm-components: x86

#![crate_type = "lib"]
#![no_core]
#![feature(no_core, lang_items)]

#[lang = "sized"]
trait Sized {}
#[lang = "copy"]
trait Copy {}

pub mod tests {
// CHECK: @f1(i32 inreg %_1, i32 inreg %_2, i32 %_3)
Expand Down
24 changes: 12 additions & 12 deletions src/test/codegen/riscv-abi/riscv64-lp64-lp64f-lp64d-abi.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
//
// compile-flags: -C no-prepopulate-passes
// only-riscv64
// only-linux
// compile-flags: --target riscv64gc-unknown-linux-gnu -C no-prepopulate-passes
// needs-llvm-components: riscv

#![crate_type = "lib"]
#![no_core]
#![feature(no_core, lang_items)]
#![allow(improper_ctypes)]

#[lang = "sized"]
trait Sized {}
#[lang = "copy"]
trait Copy {}

// CHECK: define void @f_void()
#[no_mangle]
pub extern "C" fn f_void() {}
Expand Down Expand Up @@ -70,8 +76,6 @@ pub struct Tiny {
// CHECK: define void @f_agg_tiny(i64 %0)
#[no_mangle]
pub extern "C" fn f_agg_tiny(mut e: Tiny) {
e.a += e.b;
e.c += e.d;
}

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

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

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

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

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

0 comments on commit 4013077

Please sign in to comment.