Update codegen tests to accommodate the potential presence/absence of the
extension operation depending on target architecture.
This commit is contained in:
parent
9bf3d5a82b
commit
59cc718e76
2 changed files with 48 additions and 3 deletions
|
@ -1,6 +1,32 @@
|
||||||
// compile-flags: -O
|
// compile-flags: -O
|
||||||
|
|
||||||
#![crate_type="lib"]
|
// revisions:x86_64 i686 aarch64-apple aarch64-windows aarch64-linux arm riscv
|
||||||
|
|
||||||
|
//[x86_64] compile-flags: --target x86_64-unknown-uefi
|
||||||
|
//[x86_64] needs-llvm-components: x86
|
||||||
|
//[i686] compile-flags: --target i686-unknown-linux-musl
|
||||||
|
//[i686] needs-llvm-components: x86
|
||||||
|
//[aarch64-windows] compile-flags: --target aarch64-pc-windows-msvc
|
||||||
|
//[aarch64-windows] needs-llvm-components: aarch64
|
||||||
|
//[aarch64-linux] compile-flags: --target aarch64-unknown-linux-gnu
|
||||||
|
//[aarch64-linux] needs-llvm-components: aarch64
|
||||||
|
//[aarch64-apple] compile-flags: --target aarch64-apple-darwin
|
||||||
|
//[aarch64-apple] needs-llvm-components: aarch64
|
||||||
|
//[arm] compile-flags: --target armv7r-none-eabi
|
||||||
|
//[arm] needs-llvm-components: arm
|
||||||
|
//[riscv] compile-flags: --target riscv64gc-unknown-none-elf
|
||||||
|
//[riscv] needs-llvm-components: riscv
|
||||||
|
|
||||||
|
// See bottom of file for a corresponding C source file that is meant to yield
|
||||||
|
// equivalent declarations.
|
||||||
|
#![feature(no_core, lang_items)]
|
||||||
|
#![crate_type = "lib"]
|
||||||
|
#![no_std]
|
||||||
|
#![no_core]
|
||||||
|
|
||||||
|
#[lang="sized"] trait Sized { }
|
||||||
|
#[lang="freeze"] trait Freeze { }
|
||||||
|
#[lang="copy"] trait Copy { }
|
||||||
|
|
||||||
#[repr(i8)]
|
#[repr(i8)]
|
||||||
pub enum Type {
|
pub enum Type {
|
||||||
|
@ -8,7 +34,23 @@ pub enum Type {
|
||||||
Type2 = 1
|
Type2 = 1
|
||||||
}
|
}
|
||||||
|
|
||||||
// CHECK: define{{( dso_local)?}} noundef signext i8 @test()
|
// To accommodate rust#97800, one might consider writing the below as:
|
||||||
|
//
|
||||||
|
// `define{{( dso_local)?}} noundef{{( signext)?}} i8 @test()`
|
||||||
|
//
|
||||||
|
// but based on rust#80556, it seems important to actually check for the
|
||||||
|
// presence of the `signext` for those targets where we expect it.
|
||||||
|
|
||||||
|
// CHECK: define{{( dso_local)?}} noundef
|
||||||
|
// x86_64-SAME: signext
|
||||||
|
// aarch64-apple-SAME: signext
|
||||||
|
// aarch64-windows-NOT: signext
|
||||||
|
// aarch64-linux-NOT: signext
|
||||||
|
// arm-SAME: signext
|
||||||
|
// riscv-SAME: signext
|
||||||
|
// CHECK-SAME: i8 @test()
|
||||||
|
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn test() -> Type {
|
pub extern "C" fn test() -> Type {
|
||||||
Type::Type1
|
Type::Type1
|
||||||
|
|
|
@ -10,7 +10,10 @@ pub fn call_foreign_fn() -> u8 {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// CHECK: declare zeroext i8 @foreign_fn()
|
// (Allow but do not require `zeroext` here, because it is not worth effort to
|
||||||
|
// spell out which targets have it and which ones do not; see rust#97800.)
|
||||||
|
|
||||||
|
// CHECK: declare{{( zeroext)?}} i8 @foreign_fn()
|
||||||
extern "C" {fn foreign_fn() -> u8;}
|
extern "C" {fn foreign_fn() -> u8;}
|
||||||
|
|
||||||
// CHECK: !{i32 7, !"PIC Level", i32 2}
|
// CHECK: !{i32 7, !"PIC Level", i32 2}
|
||||||
|
|
Loading…
Add table
Reference in a new issue