Skip to content

Commit 98afa6e

Browse files
committed
counters: use AT&T inline asm syntax for older LLVM.
Rust minimum LLVM version still do not support Intel syntax inline asm
1 parent 1d904b7 commit 98afa6e

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

measureme/src/counters.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -805,10 +805,18 @@ mod hw {
805805
let mut _tmp: u64 = 0;
806806
unsafe {
807807
asm!(
808-
"lock xadd qword ptr [{atomic}], {tmp}",
808+
// Intel syntax: "lock xadd [{atomic}], {tmp}"
809+
"lock xadd {tmp}, ({atomic})",
809810

810811
atomic = in(reg) &mut atomic,
811812
tmp = inout(reg) _tmp,
813+
814+
// Older versions of LLVM do not support modifiers in
815+
// Intel syntax inline asm; whenever Rust minimum LLVM
816+
// version supports Intel syntax inline asm, remove
817+
// and replace above instructions with Intel syntax
818+
// version (from comments).
819+
options(att_syntax),
812820
);
813821
}
814822

0 commit comments

Comments
 (0)