@@ -525,10 +525,10 @@ mod hw {
525
525
} else {
526
526
asm ! (
527
527
// Dummy `cpuid(0)` to serialize instruction execution.
528
- "xor eax, eax" ,
528
+ "xor % eax, % eax" , // Intel syntax: "xor eax, eax"
529
529
"cpuid" ,
530
530
531
- "mov ecx, {rdpmc_ecx:e}" ,
531
+ "mov {rdpmc_ecx:e}, % ecx" , // Intel syntax: "mov ecx, {rdpmc_ecx:e}"
532
532
"rdpmc" ,
533
533
rdpmc_ecx = in( reg) reg_idx,
534
534
out( "eax" ) lo,
@@ -539,6 +539,12 @@ mod hw {
539
539
out( "ecx" ) _,
540
540
541
541
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) ,
542
548
) ;
543
549
}
544
550
}
@@ -556,14 +562,14 @@ mod hw {
556
562
unsafe {
557
563
asm ! (
558
564
// Dummy `cpuid(0)` to serialize instruction execution.
559
- "xor eax, eax" ,
565
+ "xor % eax, % eax" , // Intel syntax: "xor eax, eax"
560
566
"cpuid" ,
561
567
562
- "mov ecx, {a_rdpmc_ecx:e}" ,
568
+ "mov {a_rdpmc_ecx:e}, % ecx" , // Intel syntax: "mov ecx, {a_rdpmc_ecx:e}"
563
569
"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}"
567
573
"rdpmc" ,
568
574
a_rdpmc_ecx = in( reg) a_reg_idx,
569
575
a_rdpmc_eax = out( reg) a_lo,
@@ -577,6 +583,12 @@ mod hw {
577
583
out( "ecx" ) _,
578
584
579
585
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) ,
580
592
) ;
581
593
}
582
594
(
@@ -786,10 +798,17 @@ mod hw {
786
798
let mut _tmp: u64 = 0 ;
787
799
unsafe {
788
800
asm ! (
789
- "lock xadd qword ptr [{atomic}], {tmp}" ,
801
+ // Intel syntax: "lock xadd [{atomic}], {tmp}"
802
+ "lock xadd {tmp}, ({atomic})" ,
790
803
791
804
atomic = in( reg) & mut atomic,
792
805
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) ,
793
812
) ;
794
813
}
795
814
0 commit comments