[llvm] 7cae0da - [X86][Atom] Fix BSR/BSF uops + port usage
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Sat Oct 2 11:10:25 PDT 2021
Author: Simon Pilgrim
Date: 2021-10-02T19:09:44+01:00
New Revision: 7cae0daee6300f04f181a770dcbf7b6268ed9407
URL: https://github.com/llvm/llvm-project/commit/7cae0daee6300f04f181a770dcbf7b6268ed9407
DIFF: https://github.com/llvm/llvm-project/commit/7cae0daee6300f04f181a770dcbf7b6268ed9407.diff
LOG: [X86][Atom] Fix BSR/BSF uops + port usage
Both ports are required for BitScan ops. Update the uops counts + port usage based off the most recent llvm-exegesis captures (PR36895) and what Intel AoM / Agner reports as well.
Added:
Modified:
llvm/lib/Target/X86/X86ScheduleAtom.td
llvm/test/tools/llvm-mca/X86/Atom/resources-x86_64.s
Removed:
################################################################################
diff --git a/llvm/lib/Target/X86/X86ScheduleAtom.td b/llvm/lib/Target/X86/X86ScheduleAtom.td
index 9f41b45140dba..97dcef4ed380e 100644
--- a/llvm/lib/Target/X86/X86ScheduleAtom.td
+++ b/llvm/lib/Target/X86/X86ScheduleAtom.td
@@ -139,8 +139,8 @@ defm : X86WriteRes<WriteBitTestSet, [AtomPort1], 1, [1], 1>;
def : WriteRes<WriteLEA, [AtomPort1]>;
// Bit counts.
-defm : AtomWriteResPair<WriteBSF, [AtomPort01], [AtomPort01], 16, 16, [16], [16]>;
-defm : AtomWriteResPair<WriteBSR, [AtomPort01], [AtomPort01], 16, 16, [16], [16]>;
+defm : AtomWriteResPair<WriteBSF, [AtomPort0,AtomPort1], [AtomPort0,AtomPort1], 16, 16, [16,16], [16,16], 10, 10>;
+defm : AtomWriteResPair<WriteBSR, [AtomPort0,AtomPort1], [AtomPort0,AtomPort1], 16, 16, [16,16], [16,16], 10, 10>;
defm : X86WriteResPairUnsupported<WritePOPCNT>;
defm : X86WriteResPairUnsupported<WriteLZCNT>;
defm : X86WriteResPairUnsupported<WriteTZCNT>;
diff --git a/llvm/test/tools/llvm-mca/X86/Atom/resources-x86_64.s b/llvm/test/tools/llvm-mca/X86/Atom/resources-x86_64.s
index cad85f14a0014..8a65c75e6e98e 100644
--- a/llvm/test/tools/llvm-mca/X86/Atom/resources-x86_64.s
+++ b/llvm/test/tools/llvm-mca/X86/Atom/resources-x86_64.s
@@ -1169,18 +1169,18 @@ xorq (%rax), %rdi
# CHECK-NEXT: 1 1 1.00 * * andq %rsi, (%rax)
# CHECK-NEXT: 1 1 1.00 * * lock andq %rsi, (%rax)
# CHECK-NEXT: 1 1 1.00 * andq (%rax), %rdi
-# CHECK-NEXT: 1 16 8.00 bsfw %si, %di
-# CHECK-NEXT: 1 16 8.00 bsrw %si, %di
-# CHECK-NEXT: 1 16 8.00 * bsfw (%rax), %di
-# CHECK-NEXT: 1 16 8.00 * bsrw (%rax), %di
-# CHECK-NEXT: 1 16 8.00 bsfl %esi, %edi
-# CHECK-NEXT: 1 16 8.00 bsrl %esi, %edi
-# CHECK-NEXT: 1 16 8.00 * bsfl (%rax), %edi
-# CHECK-NEXT: 1 16 8.00 * bsrl (%rax), %edi
-# CHECK-NEXT: 1 16 8.00 bsfq %rsi, %rdi
-# CHECK-NEXT: 1 16 8.00 bsrq %rsi, %rdi
-# CHECK-NEXT: 1 16 8.00 * bsfq (%rax), %rdi
-# CHECK-NEXT: 1 16 8.00 * bsrq (%rax), %rdi
+# CHECK-NEXT: 10 16 16.00 bsfw %si, %di
+# CHECK-NEXT: 10 16 16.00 bsrw %si, %di
+# CHECK-NEXT: 10 16 16.00 * bsfw (%rax), %di
+# CHECK-NEXT: 10 16 16.00 * bsrw (%rax), %di
+# CHECK-NEXT: 10 16 16.00 bsfl %esi, %edi
+# CHECK-NEXT: 10 16 16.00 bsrl %esi, %edi
+# CHECK-NEXT: 10 16 16.00 * bsfl (%rax), %edi
+# CHECK-NEXT: 10 16 16.00 * bsrl (%rax), %edi
+# CHECK-NEXT: 10 16 16.00 bsfq %rsi, %rdi
+# CHECK-NEXT: 10 16 16.00 bsrq %rsi, %rdi
+# CHECK-NEXT: 10 16 16.00 * bsfq (%rax), %rdi
+# CHECK-NEXT: 10 16 16.00 * bsrq (%rax), %rdi
# CHECK-NEXT: 1 1 1.00 bswapl %eax
# CHECK-NEXT: 1 1 1.00 bswapq %rax
# CHECK-NEXT: 1 1 1.00 btw %si, %di
@@ -1947,7 +1947,7 @@ xorq (%rax), %rdi
# CHECK: Resource pressure per iteration:
# CHECK-NEXT: [0] [1]
-# CHECK-NEXT: 3616.50 3163.50
+# CHECK-NEXT: 3712.50 3259.50
# CHECK: Resource pressure by instruction:
# CHECK-NEXT: [0] [1] Instructions:
@@ -2090,18 +2090,18 @@ xorq (%rax), %rdi
# CHECK-NEXT: 1.00 - andq %rsi, (%rax)
# CHECK-NEXT: 1.00 - lock andq %rsi, (%rax)
# CHECK-NEXT: 1.00 - andq (%rax), %rdi
-# CHECK-NEXT: 8.00 8.00 bsfw %si, %di
-# CHECK-NEXT: 8.00 8.00 bsrw %si, %di
-# CHECK-NEXT: 8.00 8.00 bsfw (%rax), %di
-# CHECK-NEXT: 8.00 8.00 bsrw (%rax), %di
-# CHECK-NEXT: 8.00 8.00 bsfl %esi, %edi
-# CHECK-NEXT: 8.00 8.00 bsrl %esi, %edi
-# CHECK-NEXT: 8.00 8.00 bsfl (%rax), %edi
-# CHECK-NEXT: 8.00 8.00 bsrl (%rax), %edi
-# CHECK-NEXT: 8.00 8.00 bsfq %rsi, %rdi
-# CHECK-NEXT: 8.00 8.00 bsrq %rsi, %rdi
-# CHECK-NEXT: 8.00 8.00 bsfq (%rax), %rdi
-# CHECK-NEXT: 8.00 8.00 bsrq (%rax), %rdi
+# CHECK-NEXT: 16.00 16.00 bsfw %si, %di
+# CHECK-NEXT: 16.00 16.00 bsrw %si, %di
+# CHECK-NEXT: 16.00 16.00 bsfw (%rax), %di
+# CHECK-NEXT: 16.00 16.00 bsrw (%rax), %di
+# CHECK-NEXT: 16.00 16.00 bsfl %esi, %edi
+# CHECK-NEXT: 16.00 16.00 bsrl %esi, %edi
+# CHECK-NEXT: 16.00 16.00 bsfl (%rax), %edi
+# CHECK-NEXT: 16.00 16.00 bsrl (%rax), %edi
+# CHECK-NEXT: 16.00 16.00 bsfq %rsi, %rdi
+# CHECK-NEXT: 16.00 16.00 bsrq %rsi, %rdi
+# CHECK-NEXT: 16.00 16.00 bsfq (%rax), %rdi
+# CHECK-NEXT: 16.00 16.00 bsrq (%rax), %rdi
# CHECK-NEXT: 1.00 - bswapl %eax
# CHECK-NEXT: 1.00 - bswapq %rax
# CHECK-NEXT: - 1.00 btw %si, %di
More information about the llvm-commits
mailing list