Skip to content

Commit

Permalink
inline-asm: Update for new style
Browse files Browse the repository at this point in the history
rust-lang/rust#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.
  • Loading branch information
joshtriplett committed Jun 20, 2020
1 parent a4e773c commit bf2fa74
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions posts/inside-rust/2020-06-08-new-inline-asm.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit bf2fa74

Please sign in to comment.