diff options
| author | Felix S. Klock II <pnkfelix@pnkfx.org> | 2022-08-19 16:15:15 -0400 |
|---|---|---|
| committer | Felix S. Klock II <pnkfelix@pnkfx.org> | 2022-08-19 16:15:15 -0400 |
| commit | 59cc718e76faee1f844040d60615bacc6bad8643 (patch) | |
| tree | 7fd8f9669bf3e6e413ad9d60b567bc8f4dc2ab06 /src/test/codegen | |
| parent | 9bf3d5a82b689484b12bc5cc053d10f632ea6095 (diff) | |
| download | rust-59cc718e76faee1f844040d60615bacc6bad8643.tar.gz rust-59cc718e76faee1f844040d60615bacc6bad8643.zip | |
Update codegen tests to accommodate the potential presence/absence of the
extension operation depending on target architecture.
Diffstat (limited to 'src/test/codegen')
| -rw-r--r-- | src/test/codegen/abi-repr-ext.rs | 46 | ||||
| -rw-r--r-- | src/test/codegen/pic-relocation-model.rs | 5 |
2 files changed, 48 insertions, 3 deletions
diff --git a/src/test/codegen/abi-repr-ext.rs b/src/test/codegen/abi-repr-ext.rs index 2b34eaf9417..23ade3c7216 100644 --- a/src/test/codegen/abi-repr-ext.rs +++ b/src/test/codegen/abi-repr-ext.rs @@ -1,6 +1,32 @@ // 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)] pub enum Type { @@ -8,7 +34,23 @@ pub enum Type { 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] pub extern "C" fn test() -> Type { Type::Type1 diff --git a/src/test/codegen/pic-relocation-model.rs b/src/test/codegen/pic-relocation-model.rs index 6e1d5a6c3f2..9b378ecb4e5 100644 --- a/src/test/codegen/pic-relocation-model.rs +++ b/src/test/codegen/pic-relocation-model.rs @@ -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;} // CHECK: !{i32 7, !"PIC Level", i32 2} |
