[PATCH] D49912: [X86] MCA tests for XCHG* and CMPXCHG* instructions

Simon Pilgrim via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 2 07:53:52 PDT 2018


RKSimon added inline comments.


================
Comment at: test/tools/llvm-mca/X86/Atom/resources-x86_64.s:230
+cmpxchgq %rax, %rbx
+cmpxchgq %rax, (%rbx)
+
----------------
avt77 wrote:
> RKSimon wrote:
> > Don't use AL/AX/EAX/RAX as explicit ops - they are implicitly referenced by in the instruction 
> It seems it deos not work:
> 
> <stdin>:225:1: error: too few operands for instruction
> cmpxchgb %bl
> ^
> <stdin>:226:10: error: invalid operand for instruction
> cmpxchgb (%rbx)
>          ^~~~~~
> <stdin>:228:1: error: too few operands for instruction
> cmpxchgw %bx
> ^
> <stdin>:229:10: error: invalid operand for instruction
> cmpxchgw (%rbx)
>          ^~~~~~
> <stdin>:231:1: error: too few operands for instruction
> cmpxchgl %ebx
> ^
> <stdin>:232:10: error: invalid operand for instruction
> cmpxchgl (%ebx)
>          ^~~~~~
> <stdin>:234:1: error: too few operands for instruction
> cmpxchgq %rbx
> ^
> <stdin>:235:10: error: invalid operand for instruction
> cmpxchgq (%rbx)
>          ^~~~~~
No, I mean the instruction implicitly uses the RAX register - use different registers to make the instruction more realistic.

APM V3:
> Compares the value in the AL, AX, EAX, or RAX register with the value in a register or a memory location (first operand). If the two values are equal, the instruction copies the value in the second operand to the first operand and sets the ZF flag in the rFLAGS register to 1. Otherwise, it copies the value in the first operand to the AL, AX, EAX, or RAX register and clears the ZF flag to 0.




================
Comment at: test/tools/llvm-mca/X86/Atom/resources-x86_64.s:232
+cmpxchgl %eax, %ebx
+cmpxchgl %ecx, (%ebx)
+
----------------
This triple is 64-bit - use 64-bit pointers (%rbx).


================
Comment at: test/tools/llvm-mca/X86/Atom/resources-x86_64.s:799
+xaddl %ebx, %ecx
+xaddl %eax, (%ebx)
+
----------------
This triple is 64-bit - use 64-bit pointers (%rbx).


https://reviews.llvm.org/D49912





More information about the llvm-commits mailing list