]> git.lizzy.rs Git - rust.git/blob - src/test/codegen/fastcall-inreg.rs
Merge branch 'refactor-select' of https://github.com/aravind-pg/rust into update...
[rust.git] / src / test / codegen / fastcall-inreg.rs
1 // Copyright 2016 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
4 //
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
10
11 // Checks if the "fastcall" calling convention marks function arguments
12 // as "inreg" like the C/C++ compilers for the platforms.
13 // x86 only.
14
15 // ignore-aarch64
16 // ignore-aarch64_be
17 // ignore-arm
18 // ignore-armeb
19 // ignore-avr
20 // ignore-bpfel
21 // ignore-bpfeb
22 // ignore-hexagon
23 // ignore-mips
24 // ignore-mipsel
25 // ignore-mips64
26 // ignore-mips64el
27 // ignore-msp430
28 // ignore-powerpc
29 // ignore-r600
30 // ignore-amdgcn
31 // ignore-sparc
32 // ignore-sparcv9
33 // ignore-sparcel
34 // ignore-s390x
35 // ignore-tce
36 // ignore-thumb
37 // ignore-thumbeb
38 // ignore-x86_64
39 // ignore-xcore
40 // ignore-nvptx
41 // ignore-nvptx64
42 // ignore-le32
43 // ignore-le64
44 // ignore-amdil
45 // ignore-amdil64
46 // ignore-hsail
47 // ignore-hsail64
48 // ignore-spir
49 // ignore-spir64
50 // ignore-kalimba
51 // ignore-shave
52 // ignore-wasm32
53 // ignore-wasm64
54 // ignore-emscripten
55
56 // compile-flags: -C no-prepopulate-passes
57
58 #![crate_type = "lib"]
59
60 pub mod tests {
61     // CHECK: @f1(i32 inreg %arg0, i32 inreg %arg1, i32 %arg2)
62     #[no_mangle]
63     pub extern "fastcall" fn f1(_: i32, _: i32, _: i32) {}
64
65     // CHECK: @f2(i32* inreg %arg0, i32* inreg %arg1, i32* %arg2)
66     #[no_mangle]
67     pub extern "fastcall" fn f2(_: *const i32, _: *const i32, _: *const i32) {}
68
69     // CHECK: @f3(float %arg0, i32 inreg %arg1, i32 inreg %arg2, i32 %arg3)
70     #[no_mangle]
71     pub extern "fastcall" fn f3(_: f32, _: i32, _: i32, _: i32) {}
72
73     // CHECK: @f4(i32 inreg %arg0, float %arg1, i32 inreg %arg2, i32 %arg3)
74     #[no_mangle]
75     pub extern "fastcall" fn f4(_: i32, _: f32, _: i32, _: i32) {}
76
77     // CHECK: @f5(i64 %arg0, i32 %arg1)
78     #[no_mangle]
79     pub extern "fastcall" fn f5(_: i64, _: i32) {}
80
81     // CHECK: @f6(i1 inreg zeroext %arg0, i32 inreg %arg1, i32 %arg2)
82     #[no_mangle]
83     pub extern "fastcall" fn f6(_: bool, _: i32, _: i32) {}
84 }