From bf2fa747c4e73bb9dac5bf17c21cfa66599497b0 Mon Sep 17 00:00:00 2001 From: Josh Triplett Date: Fri, 19 Jun 2020 20:52:29 -0700 Subject: [PATCH] inline-asm: Update for new style https://github.com/rust-lang/rust/pull/73364 implemented support for providing multiple lines of assembly as separate arguments to `asm!`; update the blog post to use that new syntax, so that people who find it will use that style as an example. --- .../inside-rust/2020-06-08-new-inline-asm.md | 21 +++++++++---------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/posts/inside-rust/2020-06-08-new-inline-asm.md b/posts/inside-rust/2020-06-08-new-inline-asm.md index 252962876..183ad9186 100644 --- a/posts/inside-rust/2020-06-08-new-inline-asm.md +++ b/posts/inside-rust/2020-06-08-new-inline-asm.md @@ -94,17 +94,16 @@ fn main() { for value in 0..=1024u64 { let popcnt; unsafe { - asm!(" - popcnt {popcnt}, {v} - 2: - blsi rax, {v} - jz 1f - xor {v}, rax - tzcnt rax, rax - stosb - jmp 2b - 1: - ", + asm!( + " popcnt {popcnt}, {v}", + "2:", + " blsi rax, {v}", + " jz 1f", + " xor {v}, rax", + " tzcnt rax, rax", + " stosb", + " jmp 2b", + "1:", v = inout(reg) value => _, popcnt = out(reg) popcnt, out("rax") _, // scratch