2 // Checks if the correct registers are being used to pass arguments
3 // when the sysv64 ABI is specified.
11 #[cfg(target_arch = "x86_64")]
12 pub extern "sysv64" fn all_the_registers(rdi: i64, rsi: i64, rdx: i64,
13 rcx: i64, r8 : i64, r9 : i64,
14 xmm0: f32, xmm1: f32, xmm2: f32,
15 xmm3: f32, xmm4: f32, xmm5: f32,
16 xmm6: f32, xmm7: f32) -> i64 {
23 assert_eq!(xmm0, 1.0f32);
24 assert_eq!(xmm1, 2.0f32);
25 assert_eq!(xmm2, 4.0f32);
26 assert_eq!(xmm3, 8.0f32);
27 assert_eq!(xmm4, 16.0f32);
28 assert_eq!(xmm5, 32.0f32);
29 assert_eq!(xmm6, 64.0f32);
30 assert_eq!(xmm7, 128.0f32);
34 // this struct contains 8 i64's, while only 6 can be passed in registers.
35 #[cfg(target_arch = "x86_64")]
36 #[derive(PartialEq, Eq, Debug)]
37 pub struct LargeStruct(i64, i64, i64, i64, i64, i64, i64, i64);
39 #[cfg(target_arch = "x86_64")]
41 pub extern "sysv64" fn large_struct_by_val(mut foo: LargeStruct) -> LargeStruct {
53 #[cfg(target_arch = "x86_64")]
82 : "{r10}"(all_the_registers as usize)
83 : "rdi", "rsi", "rdx", "rcx", "r8", "r9", "r11", "cc", "memory"
84 : "intel", "alignstack"
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"))]