-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
rust_for_linux: -Zregparm=<N> commandline flag for X86 (#116972)
- Loading branch information
Showing
9 changed files
with
115 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// Checks how `regparm` flag works with different calling conventions: | ||
// marks function arguments as "inreg" like the C/C++ compilers for the platforms. | ||
// x86 only. | ||
|
||
//@ compile-flags: --target i686-unknown-linux-gnu -Zregparm=3 -O -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 { | ||
// regparm doesn't work for "fastcall" calling conv (only 2 inregs) | ||
// CHECK: @f1(i32 inreg noundef %_1, i32 inreg noundef %_2, i32 noundef %_3) | ||
#[no_mangle] | ||
pub extern "fastcall" fn f1(_: i32, _: i32, _: i32) {} | ||
|
||
// regparm doesn't work for "Rust" calling conv | ||
// CHECK: @f2(i32 noundef %_1, i32 noundef %_2, i32 noundef %_3) | ||
#[no_mangle] | ||
pub extern "Rust" fn f2(_: i32, _: i32, _: i32) {} | ||
|
||
// CHECK: @f3(i32 inreg noundef %_1, i32 inreg noundef %_2, i32 inreg noundef %_3) | ||
#[no_mangle] | ||
pub extern "C" fn f3(_: i32, _: i32, _: i32) {} | ||
|
||
// CHECK: @f4(i32 inreg noundef %_1, i32 inreg noundef %_2, i32 inreg noundef %_3) | ||
#[no_mangle] | ||
pub extern "cdecl" fn f4(_: i32, _: i32, _: i32) {} | ||
|
||
// CHECK: @f5(i32 inreg noundef %_1, i32 inreg noundef %_2, i32 inreg noundef %_3) | ||
#[no_mangle] | ||
pub extern "stdcall" fn f5(_: i32, _: i32, _: i32) {} | ||
|
||
// regparm doesn't work for thiscall | ||
// CHECK: @f6(i32 noundef %_1, i32 noundef %_2, i32 noundef %_3) | ||
#[no_mangle] | ||
pub extern "thiscall" fn f6(_: i32, _: i32, _: i32) {} | ||
} |