Skip to content

Commit b88b4b3

Browse files
author
Paul Kernfeld
committed
Migrate asm! to llvm_asm!
Replace uses of asm! with llvm_asm!, add the llvm_asm feature [Tracking Issue for LLVM-style inline assembly](rust-lang/rust#70173) `cargo test` now passes for me with rustc 1.45.0-nightly (9310e3bd4 2020-05-21)
1 parent a414fbe commit b88b4b3

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

src/detail/x86_64_unix.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ mod asm_impl {
1616
/// prefetch data
1717
#[inline]
1818
pub unsafe extern "C" fn prefetch(data: *const usize) {
19-
asm!(
19+
llvm_asm!(
2020
"prefetcht1 $0"
2121
: // no output
2222
: "m"(*data)
@@ -28,7 +28,7 @@ mod asm_impl {
2828
#[naked]
2929
#[inline(never)]
3030
pub unsafe extern "C" fn bootstrap_green_task() {
31-
asm!(
31+
llvm_asm!(
3232
"
3333
mov %r12, %rdi // setup the function arg
3434
mov %r13, %rsi // setup the function arg
@@ -46,7 +46,7 @@ mod asm_impl {
4646
#[inline(never)]
4747
pub unsafe extern "C" fn swap_registers(out_regs: *mut Registers, in_regs: *const Registers) {
4848
// The first argument is in %rdi, and the second one is in %rsi
49-
asm!(
49+
llvm_asm!(
5050
""
5151
:
5252
: "{rdi}"(out_regs), "{rsi}"(in_regs)
@@ -58,7 +58,7 @@ mod asm_impl {
5858
#[naked]
5959
unsafe extern "C" fn _swap_reg() {
6060
// Save registers
61-
asm!(
61+
llvm_asm!(
6262
"
6363
mov %rbx, (0*8)(%rdi)
6464
mov %rsp, (1*8)(%rdi)

src/detail/x86_64_windows.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ mod asm_impl {
2222
/// prefetch data
2323
#[inline]
2424
pub unsafe extern "C" fn prefetch_asm(data: *const usize) {
25-
asm!(
25+
llvm_asm!(
2626
"prefetcht1 $0"
2727
: // no output
2828
: "m"(*data)
@@ -34,7 +34,7 @@ mod asm_impl {
3434
#[naked]
3535
#[inline(never)]
3636
pub unsafe extern "C" fn bootstrap_green_task() {
37-
asm!(
37+
llvm_asm!(
3838
"
3939
mov %r12, %rcx // setup the function arg
4040
mov %r13, %rdx // setup the function arg
@@ -52,7 +52,7 @@ mod asm_impl {
5252
#[inline(never)]
5353
pub unsafe extern "C" fn swap_registers(out_regs: *mut Registers, in_regs: *const Registers) {
5454
// The first argument is in %rcx, and the second one is in %rdx
55-
asm!(
55+
llvm_asm!(
5656
""
5757
:
5858
: "{rcx}"(out_regs), "{rdx}"(in_regs)
@@ -64,7 +64,7 @@ mod asm_impl {
6464
#[naked]
6565
unsafe extern "C" fn _swap_reg() {
6666
// Save registers
67-
asm!(
67+
llvm_asm!(
6868
"
6969
mov %rbx, (0*8)(%rcx)
7070
mov %rsp, (1*8)(%rcx)

src/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
//!
55
66
#![cfg_attr(nightly, feature(asm))]
7+
#![cfg_attr(nightly, feature(llvm_asm))]
78
#![cfg_attr(nightly, feature(repr_simd))]
89
#![cfg_attr(nightly, feature(core_intrinsics))]
910
#![cfg_attr(nightly, feature(naked_functions))]

0 commit comments

Comments
 (0)