[llvm] 10cdad4 - [X86] Fix SLM uops/resources counts for XADD/XCHG reg-reg instructions
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Sat Jan 14 10:44:15 PST 2023
Author: Simon Pilgrim
Date: 2023-01-14T18:34:18Z
New Revision: 10cdad4065d7d3b53be3e0f03a2d71951c2bacd6
URL: https://github.com/llvm/llvm-project/commit/10cdad4065d7d3b53be3e0f03a2d71951c2bacd6
DIFF: https://github.com/llvm/llvm-project/commit/10cdad4065d7d3b53be3e0f03a2d71951c2bacd6.diff
LOG: [X86] Fix SLM uops/resources counts for XADD/XCHG reg-reg instructions
The RMW instructions still need addressing, probably with a new 'WriteXCHGRMW' scheduler class.
Based off llvm-exegesis captures, confirmed with Agner + uops.info
Added:
Modified:
llvm/lib/Target/X86/X86ScheduleSLM.td
llvm/test/tools/llvm-mca/X86/SLM/resources-x86_64.s
Removed:
################################################################################
diff --git a/llvm/lib/Target/X86/X86ScheduleSLM.td b/llvm/lib/Target/X86/X86ScheduleSLM.td
index c59853bd71041..ff50c6dfc621a 100644
--- a/llvm/lib/Target/X86/X86ScheduleSLM.td
+++ b/llvm/lib/Target/X86/X86ScheduleSLM.td
@@ -119,7 +119,7 @@ defm : X86WriteRes<WriteBSWAP32, [SLM_IEC_RSV01], 1, [1], 1>;
defm : X86WriteRes<WriteBSWAP64, [SLM_IEC_RSV01], 1, [1], 1>;
defm : X86WriteRes<WriteCMPXCHG, [SLM_IEC_RSV01], 6, [6], 5>;
defm : X86WriteRes<WriteCMPXCHGRMW, [SLM_IEC_RSV01, SLM_MEC_RSV], 10, [6, 2], 8>;
-defm : X86WriteRes<WriteXCHG, [SLM_IEC_RSV01], 1, [1], 1>;
+defm : X86WriteRes<WriteXCHG, [SLM_IEC_RSV01], 3, [3], 3>;
defm : SLMWriteResPair<WriteShift, [SLM_IEC_RSV0], 1>;
defm : SLMWriteResPair<WriteShiftCL, [SLM_IEC_RSV0], 1>;
diff --git a/llvm/test/tools/llvm-mca/X86/SLM/resources-x86_64.s b/llvm/test/tools/llvm-mca/X86/SLM/resources-x86_64.s
index 15441afaf7b82..c65d7fa4f7439 100644
--- a/llvm/test/tools/llvm-mca/X86/SLM/resources-x86_64.s
+++ b/llvm/test/tools/llvm-mca/X86/SLM/resources-x86_64.s
@@ -1878,31 +1878,31 @@ xorq (%rax), %rdi
# CHECK-NEXT: 1 4 1.00 * testq %rsi, (%rax)
# CHECK-NEXT: 1 100 1.00 * U ud2
# CHECK-NEXT: 1 100 1.00 U wrmsr
-# CHECK-NEXT: 1 1 0.50 xaddb %bl, %cl
+# CHECK-NEXT: 3 3 1.50 xaddb %bl, %cl
# CHECK-NEXT: 1 4 2.00 * * xaddb %bl, (%rcx)
# CHECK-NEXT: 1 4 2.00 * * lock xaddb %bl, (%rcx)
-# CHECK-NEXT: 1 1 0.50 xaddw %bx, %cx
+# CHECK-NEXT: 3 3 1.50 xaddw %bx, %cx
# CHECK-NEXT: 1 4 2.00 * * xaddw %ax, (%rbx)
# CHECK-NEXT: 1 4 2.00 * * lock xaddw %ax, (%rbx)
-# CHECK-NEXT: 1 1 0.50 xaddl %ebx, %ecx
+# CHECK-NEXT: 3 3 1.50 xaddl %ebx, %ecx
# CHECK-NEXT: 1 4 2.00 * * xaddl %eax, (%rbx)
# CHECK-NEXT: 1 4 2.00 * * lock xaddl %eax, (%rbx)
-# CHECK-NEXT: 1 1 0.50 xaddq %rbx, %rcx
+# CHECK-NEXT: 3 3 1.50 xaddq %rbx, %rcx
# CHECK-NEXT: 1 4 2.00 * * xaddq %rax, (%rbx)
# CHECK-NEXT: 1 4 2.00 * * lock xaddq %rax, (%rbx)
-# CHECK-NEXT: 1 1 0.50 xchgb %bl, %cl
+# CHECK-NEXT: 3 3 1.50 xchgb %bl, %cl
# CHECK-NEXT: 1 4 2.00 * * xchgb %bl, (%rbx)
# CHECK-NEXT: 1 4 2.00 * * lock xchgb %bl, (%rbx)
-# CHECK-NEXT: 1 1 0.50 xchgw %bx, %ax
-# CHECK-NEXT: 1 1 0.50 xchgw %bx, %cx
+# CHECK-NEXT: 3 3 1.50 xchgw %bx, %ax
+# CHECK-NEXT: 3 3 1.50 xchgw %bx, %cx
# CHECK-NEXT: 1 4 2.00 * * xchgw %ax, (%rbx)
# CHECK-NEXT: 1 4 2.00 * * lock xchgw %ax, (%rbx)
-# CHECK-NEXT: 1 1 0.50 xchgl %ebx, %eax
-# CHECK-NEXT: 1 1 0.50 xchgl %ebx, %ecx
+# CHECK-NEXT: 3 3 1.50 xchgl %ebx, %eax
+# CHECK-NEXT: 3 3 1.50 xchgl %ebx, %ecx
# CHECK-NEXT: 1 4 2.00 * * xchgl %eax, (%rbx)
# CHECK-NEXT: 1 4 2.00 * * lock xchgl %eax, (%rbx)
-# CHECK-NEXT: 1 1 0.50 xchgq %rbx, %rax
-# CHECK-NEXT: 1 1 0.50 xchgq %rbx, %rcx
+# CHECK-NEXT: 3 3 1.50 xchgq %rbx, %rax
+# CHECK-NEXT: 3 3 1.50 xchgq %rbx, %rcx
# CHECK-NEXT: 1 4 2.00 * * xchgq %rax, (%rbx)
# CHECK-NEXT: 1 4 2.00 * * lock xchgq %rax, (%rbx)
# CHECK-NEXT: 1 3 1.00 * xlatb
@@ -1960,7 +1960,7 @@ xorq (%rax), %rdi
# CHECK: Resource pressure per iteration:
# CHECK-NEXT: [0] [1] [2] [3] [4] [5] [6] [7]
-# CHECK-NEXT: 400.00 - - 49.00 - 684.50 625.50 835.00
+# CHECK-NEXT: 400.00 - - 49.00 - 695.50 636.50 835.00
# CHECK: Resource pressure by instruction:
# CHECK-NEXT: [0] [1] [2] [3] [4] [5] [6] [7] Instructions:
@@ -2808,31 +2808,31 @@ xorq (%rax), %rdi
# CHECK-NEXT: - - - - - 0.50 0.50 1.00 testq %rsi, (%rax)
# CHECK-NEXT: - - - 1.00 - - - - ud2
# CHECK-NEXT: - - - 1.00 - - - - wrmsr
-# CHECK-NEXT: - - - - - 0.50 0.50 - xaddb %bl, %cl
+# CHECK-NEXT: - - - - - 1.50 1.50 - xaddb %bl, %cl
# CHECK-NEXT: - - - - - 0.50 0.50 2.00 xaddb %bl, (%rcx)
# CHECK-NEXT: - - - - - 0.50 0.50 2.00 lock xaddb %bl, (%rcx)
-# CHECK-NEXT: - - - - - 0.50 0.50 - xaddw %bx, %cx
+# CHECK-NEXT: - - - - - 1.50 1.50 - xaddw %bx, %cx
# CHECK-NEXT: - - - - - 0.50 0.50 2.00 xaddw %ax, (%rbx)
# CHECK-NEXT: - - - - - 0.50 0.50 2.00 lock xaddw %ax, (%rbx)
-# CHECK-NEXT: - - - - - 0.50 0.50 - xaddl %ebx, %ecx
+# CHECK-NEXT: - - - - - 1.50 1.50 - xaddl %ebx, %ecx
# CHECK-NEXT: - - - - - 0.50 0.50 2.00 xaddl %eax, (%rbx)
# CHECK-NEXT: - - - - - 0.50 0.50 2.00 lock xaddl %eax, (%rbx)
-# CHECK-NEXT: - - - - - 0.50 0.50 - xaddq %rbx, %rcx
+# CHECK-NEXT: - - - - - 1.50 1.50 - xaddq %rbx, %rcx
# CHECK-NEXT: - - - - - 0.50 0.50 2.00 xaddq %rax, (%rbx)
# CHECK-NEXT: - - - - - 0.50 0.50 2.00 lock xaddq %rax, (%rbx)
-# CHECK-NEXT: - - - - - 0.50 0.50 - xchgb %bl, %cl
+# CHECK-NEXT: - - - - - 1.50 1.50 - xchgb %bl, %cl
# CHECK-NEXT: - - - - - 0.50 0.50 2.00 xchgb %bl, (%rbx)
# CHECK-NEXT: - - - - - 0.50 0.50 2.00 lock xchgb %bl, (%rbx)
-# CHECK-NEXT: - - - - - 0.50 0.50 - xchgw %bx, %ax
-# CHECK-NEXT: - - - - - 0.50 0.50 - xchgw %bx, %cx
+# CHECK-NEXT: - - - - - 1.50 1.50 - xchgw %bx, %ax
+# CHECK-NEXT: - - - - - 1.50 1.50 - xchgw %bx, %cx
# CHECK-NEXT: - - - - - 0.50 0.50 2.00 xchgw %ax, (%rbx)
# CHECK-NEXT: - - - - - 0.50 0.50 2.00 lock xchgw %ax, (%rbx)
-# CHECK-NEXT: - - - - - 0.50 0.50 - xchgl %ebx, %eax
-# CHECK-NEXT: - - - - - 0.50 0.50 - xchgl %ebx, %ecx
+# CHECK-NEXT: - - - - - 1.50 1.50 - xchgl %ebx, %eax
+# CHECK-NEXT: - - - - - 1.50 1.50 - xchgl %ebx, %ecx
# CHECK-NEXT: - - - - - 0.50 0.50 2.00 xchgl %eax, (%rbx)
# CHECK-NEXT: - - - - - 0.50 0.50 2.00 lock xchgl %eax, (%rbx)
-# CHECK-NEXT: - - - - - 0.50 0.50 - xchgq %rbx, %rax
-# CHECK-NEXT: - - - - - 0.50 0.50 - xchgq %rbx, %rcx
+# CHECK-NEXT: - - - - - 1.50 1.50 - xchgq %rbx, %rax
+# CHECK-NEXT: - - - - - 1.50 1.50 - xchgq %rbx, %rcx
# CHECK-NEXT: - - - - - 0.50 0.50 2.00 xchgq %rax, (%rbx)
# CHECK-NEXT: - - - - - 0.50 0.50 2.00 lock xchgq %rax, (%rbx)
# CHECK-NEXT: - - - - - - - 1.00 xlatb
More information about the llvm-commits
mailing list