@@ -525,10 +525,10 @@ mod hw {
525525 } else {
526526 asm ! (
527527 // Dummy `cpuid(0)` to serialize instruction execution.
528- "xor eax, eax" ,
528+ "xor % eax, % eax" , // Intel syntax: "xor eax, eax"
529529 "cpuid" ,
530530
531- "mov ecx, {rdpmc_ecx:e}" ,
531+ "mov {rdpmc_ecx:e}, % ecx" , // Intel syntax: "mov ecx, {rdpmc_ecx:e}"
532532 "rdpmc" ,
533533 rdpmc_ecx = in( reg) reg_idx,
534534 out( "eax" ) lo,
@@ -539,6 +539,12 @@ mod hw {
539539 out( "ecx" ) _,
540540
541541 options( nostack) ,
542+
543+ // HACK(eddyb) LLVM 9 and older do not support modifiers
544+ // in Intel syntax inline asm; whenever Rust minimum LLVM
545+ // version becomes LLVM 10, remove and replace above
546+ // instructions with Intel syntax version (from comments).
547+ options( att_syntax) ,
542548 ) ;
543549 }
544550 }
@@ -556,14 +562,14 @@ mod hw {
556562 unsafe {
557563 asm ! (
558564 // Dummy `cpuid(0)` to serialize instruction execution.
559- "xor eax, eax" ,
565+ "xor % eax, % eax" , // Intel syntax: "xor eax, eax"
560566 "cpuid" ,
561567
562- "mov ecx, {a_rdpmc_ecx:e}" ,
568+ "mov {a_rdpmc_ecx:e}, % ecx" , // Intel syntax: "mov ecx, {a_rdpmc_ecx:e}"
563569 "rdpmc" ,
564- "mov {a_rdpmc_eax:e}, eax" ,
565- "mov {a_rdpmc_edx:e}, edx" ,
566- "mov ecx, {b_rdpmc_ecx:e}" ,
570+ "mov %eax, {a_rdpmc_eax:e}" , // Intel syntax: "mov {a_rdpmc_eax:e}, eax"
571+ "mov %edx, {a_rdpmc_edx:e}" , // Intel syntax: "mov {a_rdpmc_edx:e}, edx"
572+ "mov {b_rdpmc_ecx:e}, % ecx" , // Intel syntax: "mov ecx, {b_rdpmc_ecx:e}"
567573 "rdpmc" ,
568574 a_rdpmc_ecx = in( reg) a_reg_idx,
569575 a_rdpmc_eax = out( reg) a_lo,
@@ -577,6 +583,12 @@ mod hw {
577583 out( "ecx" ) _,
578584
579585 options( nostack) ,
586+
587+ // HACK(eddyb) LLVM 9 and older do not support modifiers
588+ // in Intel syntax inline asm; whenever Rust minimum LLVM
589+ // version becomes LLVM 10, remove and replace above
590+ // instructions with Intel syntax version (from comments).
591+ options( att_syntax) ,
580592 ) ;
581593 }
582594 (
@@ -786,10 +798,17 @@ mod hw {
786798 let mut _tmp: u64 = 0 ;
787799 unsafe {
788800 asm ! (
789- "lock xadd qword ptr [{atomic}], {tmp}" ,
801+ // Intel syntax: "lock xadd [{atomic}], {tmp}"
802+ "lock xadd {tmp}, ({atomic})" ,
790803
791804 atomic = in( reg) & mut atomic,
792805 tmp = inout( reg) _tmp,
806+
807+ // HACK(eddyb) LLVM 9 and older do not support modifiers
808+ // in Intel syntax inline asm; whenever Rust minimum LLVM
809+ // version becomes LLVM 10, remove and replace above
810+ // instructions with Intel syntax version (from comments).
811+ options( att_syntax) ,
793812 ) ;
794813 }
795814
0 commit comments