]> git.lizzy.rs Git - rust.git/blob - tests/codegen/fastcall-inreg.rs
Auto merge of #106503 - cjgillot:remap-nofilter, r=oli-obk
[rust.git] / tests / codegen / fastcall-inreg.rs
1 // Checks if the "fastcall" calling convention marks function arguments
2 // as "inreg" like the C/C++ compilers for the platforms.
3 // x86 only.
4
5 // compile-flags: --target i686-unknown-linux-gnu -O -C no-prepopulate-passes
6 // needs-llvm-components: x86
7
8 #![crate_type = "lib"]
9 #![no_core]
10 #![feature(no_core, lang_items)]
11
12 #[lang = "sized"]
13 trait Sized {}
14 #[lang = "copy"]
15 trait Copy {}
16
17 pub mod tests {
18     // CHECK: @f1(i32 inreg noundef %_1, i32 inreg noundef %_2, i32 noundef %_3)
19     #[no_mangle]
20     pub extern "fastcall" fn f1(_: i32, _: i32, _: i32) {}
21
22     // CHECK: @f2({{i32\*|ptr}} inreg noundef %_1, {{i32\*|ptr}} inreg noundef %_2, {{i32\*|ptr}} noundef %_3)
23     #[no_mangle]
24     pub extern "fastcall" fn f2(_: *const i32, _: *const i32, _: *const i32) {}
25
26     // CHECK: @f3(float noundef %_1, i32 inreg noundef %_2, i32 inreg noundef %_3, i32 noundef %_4)
27     #[no_mangle]
28     pub extern "fastcall" fn f3(_: f32, _: i32, _: i32, _: i32) {}
29
30     // CHECK: @f4(i32 inreg noundef %_1, float noundef %_2, i32 inreg noundef %_3, i32 noundef %_4)
31     #[no_mangle]
32     pub extern "fastcall" fn f4(_: i32, _: f32, _: i32, _: i32) {}
33
34     // CHECK: @f5(i64 noundef %_1, i32 noundef %_2)
35     #[no_mangle]
36     pub extern "fastcall" fn f5(_: i64, _: i32) {}
37
38     // CHECK: @f6(i1 inreg noundef zeroext %_1, i32 inreg noundef %_2, i32 noundef %_3)
39     #[no_mangle]
40     pub extern "fastcall" fn f6(_: bool, _: i32, _: i32) {}
41 }