Skip to content

Commit cc20dd4

Browse files
committed
Migrate abi-sysv64 abi-sysv64-register-usage test to asm!
1 parent 0b31525 commit cc20dd4

File tree

1 file changed

+30
-32
lines changed

1 file changed

+30
-32
lines changed

src/test/ui/abi/abi-sysv64-register-usage.rs

+30-32
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@
55
// ignore-android
66
// ignore-arm
77
// ignore-aarch64
8-
9-
#![feature(llvm_asm)]
10-
#![allow(deprecated)] // llvm_asm!
8+
#![feature(asm_sym)]
119

1210
#[cfg(target_arch = "x86_64")]
1311
pub extern "sysv64" fn all_the_registers(rdi: i64, rsi: i64, rdx: i64,
@@ -54,37 +52,37 @@ pub extern "sysv64" fn large_struct_by_val(mut foo: LargeStruct) -> LargeStruct
5452

5553
#[cfg(target_arch = "x86_64")]
5654
pub fn main() {
55+
use std::arch::asm;
56+
5757
let result: i64;
5858
unsafe {
59-
llvm_asm!("mov rdi, 1;
60-
mov rsi, 2;
61-
mov rdx, 3;
62-
mov rcx, 4;
63-
mov r8, 5;
64-
mov r9, 6;
65-
mov eax, 0x3F800000;
66-
movd xmm0, eax;
67-
mov eax, 0x40000000;
68-
movd xmm1, eax;
69-
mov eax, 0x40800000;
70-
movd xmm2, eax;
71-
mov eax, 0x41000000;
72-
movd xmm3, eax;
73-
mov eax, 0x41800000;
74-
movd xmm4, eax;
75-
mov eax, 0x42000000;
76-
movd xmm5, eax;
77-
mov eax, 0x42800000;
78-
movd xmm6, eax;
79-
mov eax, 0x43000000;
80-
movd xmm7, eax;
81-
call r10
82-
"
83-
: "={rax}"(result)
84-
: "{r10}"(all_the_registers as usize)
85-
: "rdi", "rsi", "rdx", "rcx", "r8", "r9", "r11", "cc", "memory"
86-
: "intel", "alignstack"
87-
)
59+
asm!("mov rdi, 1",
60+
"mov rsi, 2",
61+
"mov rdx, 3",
62+
"mov rcx, 4",
63+
"mov r8, 5",
64+
"mov r9, 6",
65+
"mov eax, 0x3F800000",
66+
"movd xmm0, eax",
67+
"mov eax, 0x40000000",
68+
"movd xmm1, eax",
69+
"mov eax, 0x40800000",
70+
"movd xmm2, eax",
71+
"mov eax, 0x41000000",
72+
"movd xmm3, eax",
73+
"mov eax, 0x41800000",
74+
"movd xmm4, eax",
75+
"mov eax, 0x42000000",
76+
"movd xmm5, eax",
77+
"mov eax, 0x42800000",
78+
"movd xmm6, eax",
79+
"mov eax, 0x43000000",
80+
"movd xmm7, eax",
81+
"call {0}",
82+
sym all_the_registers,
83+
out("rax") result,
84+
clobber_abi("sysv64"),
85+
);
8886
}
8987
assert_eq!(result, 42);
9088

0 commit comments

Comments
 (0)