make fastcall-inreg and riscv64-lp64-lp64f-lp64d-abi tests able to run on any host platform (with the right llvm components)

This commit is contained in:
Erik Desjardins 2022-02-12 12:28:19 -05:00
parent ae877003ec
commit 401307759a
2 changed files with 21 additions and 56 deletions

View file

@ -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)

View file

@ -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() {}
@ -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()
@ -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)]
@ -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)]
@ -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)
@ -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 },
);