Skip to content

Commit 59cc718

Browse files
committed
Update codegen tests to accommodate the potential presence/absence of the
extension operation depending on target architecture.
1 parent 9bf3d5a commit 59cc718

File tree

2 files changed

+48
-3
lines changed

2 files changed

+48
-3
lines changed

src/test/codegen/abi-repr-ext.rs

+44-2
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,56 @@
11
// compile-flags: -O
22

3-
#![crate_type="lib"]
3+
// revisions:x86_64 i686 aarch64-apple aarch64-windows aarch64-linux arm riscv
4+
5+
//[x86_64] compile-flags: --target x86_64-unknown-uefi
6+
//[x86_64] needs-llvm-components: x86
7+
//[i686] compile-flags: --target i686-unknown-linux-musl
8+
//[i686] needs-llvm-components: x86
9+
//[aarch64-windows] compile-flags: --target aarch64-pc-windows-msvc
10+
//[aarch64-windows] needs-llvm-components: aarch64
11+
//[aarch64-linux] compile-flags: --target aarch64-unknown-linux-gnu
12+
//[aarch64-linux] needs-llvm-components: aarch64
13+
//[aarch64-apple] compile-flags: --target aarch64-apple-darwin
14+
//[aarch64-apple] needs-llvm-components: aarch64
15+
//[arm] compile-flags: --target armv7r-none-eabi
16+
//[arm] needs-llvm-components: arm
17+
//[riscv] compile-flags: --target riscv64gc-unknown-none-elf
18+
//[riscv] needs-llvm-components: riscv
19+
20+
// See bottom of file for a corresponding C source file that is meant to yield
21+
// equivalent declarations.
22+
#![feature(no_core, lang_items)]
23+
#![crate_type = "lib"]
24+
#![no_std]
25+
#![no_core]
26+
27+
#[lang="sized"] trait Sized { }
28+
#[lang="freeze"] trait Freeze { }
29+
#[lang="copy"] trait Copy { }
430

531
#[repr(i8)]
632
pub enum Type {
733
Type1 = 0,
834
Type2 = 1
935
}
1036

11-
// CHECK: define{{( dso_local)?}} noundef signext i8 @test()
37+
// To accommodate rust#97800, one might consider writing the below as:
38+
//
39+
// `define{{( dso_local)?}} noundef{{( signext)?}} i8 @test()`
40+
//
41+
// but based on rust#80556, it seems important to actually check for the
42+
// presence of the `signext` for those targets where we expect it.
43+
44+
// CHECK: define{{( dso_local)?}} noundef
45+
// x86_64-SAME: signext
46+
// aarch64-apple-SAME: signext
47+
// aarch64-windows-NOT: signext
48+
// aarch64-linux-NOT: signext
49+
// arm-SAME: signext
50+
// riscv-SAME: signext
51+
// CHECK-SAME: i8 @test()
52+
53+
1254
#[no_mangle]
1355
pub extern "C" fn test() -> Type {
1456
Type::Type1

src/test/codegen/pic-relocation-model.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@ pub fn call_foreign_fn() -> u8 {
1010
}
1111
}
1212

13-
// CHECK: declare zeroext i8 @foreign_fn()
13+
// (Allow but do not require `zeroext` here, because it is not worth effort to
14+
// spell out which targets have it and which ones do not; see rust#97800.)
15+
16+
// CHECK: declare{{( zeroext)?}} i8 @foreign_fn()
1417
extern "C" {fn foreign_fn() -> u8;}
1518

1619
// CHECK: !{i32 7, !"PIC Level", i32 2}

0 commit comments

Comments
 (0)