2 // Checks if the correct registers are being used to pass arguments
3 // when the sysv64 ABI is specified.
10 #[cfg(target_arch = "x86_64")]
11 pub extern "sysv64" fn all_the_registers(rdi: i64, rsi: i64, rdx: i64,
12 rcx: i64, r8 : i64, r9 : i64,
13 xmm0: f32, xmm1: f32, xmm2: f32,
14 xmm3: f32, xmm4: f32, xmm5: f32,
15 xmm6: f32, xmm7: f32) -> i64 {
22 assert_eq!(xmm0, 1.0f32);
23 assert_eq!(xmm1, 2.0f32);
24 assert_eq!(xmm2, 4.0f32);
25 assert_eq!(xmm3, 8.0f32);
26 assert_eq!(xmm4, 16.0f32);
27 assert_eq!(xmm5, 32.0f32);
28 assert_eq!(xmm6, 64.0f32);
29 assert_eq!(xmm7, 128.0f32);
33 // this struct contains 8 i64's, while only 6 can be passed in registers.
34 #[cfg(target_arch = "x86_64")]
35 #[derive(PartialEq, Eq, Debug)]
36 pub struct LargeStruct(i64, i64, i64, i64, i64, i64, i64, i64);
38 #[cfg(target_arch = "x86_64")]
40 #[allow(improper_ctypes_definitions)]
41 pub extern "sysv64" fn large_struct_by_val(mut foo: LargeStruct) -> LargeStruct {
53 #[cfg(target_arch = "x86_64")]
65 "mov eax, 0x3F800000",
67 "mov eax, 0x40000000",
69 "mov eax, 0x40800000",
71 "mov eax, 0x41000000",
73 "mov eax, 0x41800000",
75 "mov eax, 0x42000000",
77 "mov eax, 0x42800000",
79 "mov eax, 0x43000000",
82 sym all_the_registers,
84 clobber_abi("sysv64"),
87 assert_eq!(result, 42);
90 large_struct_by_val(LargeStruct(1, 2, 3, 4, 5, 6, 7, 8)),
91 LargeStruct(1, 4, 9, 16, 25, 36, 49, 64)
95 #[cfg(not(target_arch = "x86_64"))]