[llvm] 08fe55b - [X86] Fix scalar load latencies for WriteLoad scheduler class
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Sun Nov 6 06:04:54 PST 2022
Author: Simon Pilgrim
Date: 2022-11-06T14:03:59Z
New Revision: 08fe55b346cbb3a5126757ca5995ed22771d0326
URL: https://github.com/llvm/llvm-project/commit/08fe55b346cbb3a5126757ca5995ed22771d0326
DIFF: https://github.com/llvm/llvm-project/commit/08fe55b346cbb3a5126757ca5995ed22771d0326.diff
LOG: [X86] Fix scalar load latencies for WriteLoad scheduler class
Znver1/Znver2 were using vector load latency values (which is what WriteFLoad*/WriteVecLoad* are for) instead of the scalar load latency value
TBH I'm not sure clflush/clzero/prefetch ops should be tagged as WriteLoad but at least this makes us more consistent
Added:
Modified:
llvm/lib/Target/X86/X86ScheduleZnver1.td
llvm/lib/Target/X86/X86ScheduleZnver2.td
llvm/test/tools/llvm-mca/X86/Znver1/resources-clflushopt.s
llvm/test/tools/llvm-mca/X86/Znver1/resources-clzero.s
llvm/test/tools/llvm-mca/X86/Znver1/resources-prefetchw.s
llvm/test/tools/llvm-mca/X86/Znver1/resources-sse1.s
llvm/test/tools/llvm-mca/X86/Znver1/resources-sse2.s
llvm/test/tools/llvm-mca/X86/Znver1/resources-x86_64.s
llvm/test/tools/llvm-mca/X86/Znver1/resources-x87.s
llvm/test/tools/llvm-mca/X86/Znver2/resources-clflushopt.s
llvm/test/tools/llvm-mca/X86/Znver2/resources-clzero.s
llvm/test/tools/llvm-mca/X86/Znver2/resources-prefetchw.s
llvm/test/tools/llvm-mca/X86/Znver2/resources-sse1.s
llvm/test/tools/llvm-mca/X86/Znver2/resources-sse2.s
llvm/test/tools/llvm-mca/X86/Znver2/resources-x86_64.s
llvm/test/tools/llvm-mca/X86/Znver2/resources-x87.s
Removed:
################################################################################
diff --git a/llvm/lib/Target/X86/X86ScheduleZnver1.td b/llvm/lib/Target/X86/X86ScheduleZnver1.td
index 78b32953cdf80..d6ea83b52257d 100644
--- a/llvm/lib/Target/X86/X86ScheduleZnver1.td
+++ b/llvm/lib/Target/X86/X86ScheduleZnver1.td
@@ -177,7 +177,7 @@ def : WriteRes<WriteRMW, [ZnAGU]>;
def : WriteRes<WriteStore, [ZnAGU]>;
def : WriteRes<WriteStoreNT, [ZnAGU]>;
def : WriteRes<WriteMove, [ZnALU]>;
-def : WriteRes<WriteLoad, [ZnAGU]> { let Latency = 8; }
+def : WriteRes<WriteLoad, [ZnAGU]> { let Latency = 4; }
// Model the effect of clobbering the read-write mask operand of the GATHER operation.
// Does not cost anything by itself, only has latency, matching that of the WriteLoad,
diff --git a/llvm/lib/Target/X86/X86ScheduleZnver2.td b/llvm/lib/Target/X86/X86ScheduleZnver2.td
index d6b0d2dd191a1..9ebedb76b9e37 100644
--- a/llvm/lib/Target/X86/X86ScheduleZnver2.td
+++ b/llvm/lib/Target/X86/X86ScheduleZnver2.td
@@ -176,7 +176,7 @@ def : WriteRes<WriteRMW, [Zn2AGU]>;
def : WriteRes<WriteStore, [Zn2AGU]>;
def : WriteRes<WriteStoreNT, [Zn2AGU]>;
def : WriteRes<WriteMove, [Zn2ALU]>;
-def : WriteRes<WriteLoad, [Zn2AGU]> { let Latency = 8; }
+def : WriteRes<WriteLoad, [Zn2AGU]> { let Latency = 4; }
// Model the effect of clobbering the read-write mask operand of the GATHER operation.
// Does not cost anything by itself, only has latency, matching that of the WriteLoad,
diff --git a/llvm/test/tools/llvm-mca/X86/Znver1/resources-clflushopt.s b/llvm/test/tools/llvm-mca/X86/Znver1/resources-clflushopt.s
index 733aec155ec49..4c16bafb6377d 100644
--- a/llvm/test/tools/llvm-mca/X86/Znver1/resources-clflushopt.s
+++ b/llvm/test/tools/llvm-mca/X86/Znver1/resources-clflushopt.s
@@ -12,7 +12,7 @@ clflushopt (%rax)
# CHECK-NEXT: [6]: HasSideEffects (U)
# CHECK: [1] [2] [3] [4] [5] [6] Instructions:
-# CHECK-NEXT: 1 8 0.50 * * U clflushopt (%rax)
+# CHECK-NEXT: 1 4 0.50 * * U clflushopt (%rax)
# CHECK: Resources:
# CHECK-NEXT: [0] - ZnAGU0
diff --git a/llvm/test/tools/llvm-mca/X86/Znver1/resources-clzero.s b/llvm/test/tools/llvm-mca/X86/Znver1/resources-clzero.s
index 420942130645b..70502433eefc7 100644
--- a/llvm/test/tools/llvm-mca/X86/Znver1/resources-clzero.s
+++ b/llvm/test/tools/llvm-mca/X86/Znver1/resources-clzero.s
@@ -12,7 +12,7 @@ clzero
# CHECK-NEXT: [6]: HasSideEffects (U)
# CHECK: [1] [2] [3] [4] [5] [6] Instructions:
-# CHECK-NEXT: 1 8 0.50 U clzero
+# CHECK-NEXT: 1 4 0.50 U clzero
# CHECK: Resources:
# CHECK-NEXT: [0] - ZnAGU0
diff --git a/llvm/test/tools/llvm-mca/X86/Znver1/resources-prefetchw.s b/llvm/test/tools/llvm-mca/X86/Znver1/resources-prefetchw.s
index 47a52fb06385a..7f5ec3104f09d 100644
--- a/llvm/test/tools/llvm-mca/X86/Znver1/resources-prefetchw.s
+++ b/llvm/test/tools/llvm-mca/X86/Znver1/resources-prefetchw.s
@@ -13,8 +13,8 @@ prefetchw (%rax)
# CHECK-NEXT: [6]: HasSideEffects (U)
# CHECK: [1] [2] [3] [4] [5] [6] Instructions:
-# CHECK-NEXT: 1 8 0.50 * * prefetch (%rax)
-# CHECK-NEXT: 1 8 0.50 * * prefetchw (%rax)
+# CHECK-NEXT: 1 4 0.50 * * prefetch (%rax)
+# CHECK-NEXT: 1 4 0.50 * * prefetchw (%rax)
# CHECK: Resources:
# CHECK-NEXT: [0] - ZnAGU0
diff --git a/llvm/test/tools/llvm-mca/X86/Znver1/resources-sse1.s b/llvm/test/tools/llvm-mca/X86/Znver1/resources-sse1.s
index 5616e648f4314..3bf248b044b85 100644
--- a/llvm/test/tools/llvm-mca/X86/Znver1/resources-sse1.s
+++ b/llvm/test/tools/llvm-mca/X86/Znver1/resources-sse1.s
@@ -282,10 +282,10 @@ xorps (%rax), %xmm2
# CHECK-NEXT: 1 1 1.00 pmovmskb %mm0, %ecx
# CHECK-NEXT: 1 4 1.00 pmulhuw %mm0, %mm2
# CHECK-NEXT: 1 11 1.00 * pmulhuw (%rax), %mm2
-# CHECK-NEXT: 1 8 0.50 * * prefetcht0 (%rax)
-# CHECK-NEXT: 1 8 0.50 * * prefetcht1 (%rax)
-# CHECK-NEXT: 1 8 0.50 * * prefetcht2 (%rax)
-# CHECK-NEXT: 1 8 0.50 * * prefetchnta (%rax)
+# CHECK-NEXT: 1 4 0.50 * * prefetcht0 (%rax)
+# CHECK-NEXT: 1 4 0.50 * * prefetcht1 (%rax)
+# CHECK-NEXT: 1 4 0.50 * * prefetcht2 (%rax)
+# CHECK-NEXT: 1 4 0.50 * * prefetchnta (%rax)
# CHECK-NEXT: 1 3 1.00 psadbw %mm0, %mm2
# CHECK-NEXT: 1 10 1.00 * psadbw (%rax), %mm2
# CHECK-NEXT: 1 1 0.50 pshufw $1, %mm0, %mm2
diff --git a/llvm/test/tools/llvm-mca/X86/Znver1/resources-sse2.s b/llvm/test/tools/llvm-mca/X86/Znver1/resources-sse2.s
index 1db51b7b65147..c6bfe9a12137b 100644
--- a/llvm/test/tools/llvm-mca/X86/Znver1/resources-sse2.s
+++ b/llvm/test/tools/llvm-mca/X86/Znver1/resources-sse2.s
@@ -415,7 +415,7 @@ xorpd (%rax), %xmm2
# CHECK-NEXT: 1 8 0.50 * andnpd (%rax), %xmm2
# CHECK-NEXT: 1 1 0.25 andpd %xmm0, %xmm2
# CHECK-NEXT: 1 8 0.50 * andpd (%rax), %xmm2
-# CHECK-NEXT: 1 8 0.50 * * U clflush (%rax)
+# CHECK-NEXT: 1 4 0.50 * * U clflush (%rax)
# CHECK-NEXT: 1 1 0.50 cmpeqpd %xmm0, %xmm2
# CHECK-NEXT: 1 8 0.50 * cmpeqpd (%rax), %xmm2
# CHECK-NEXT: 1 1 0.50 cmpeqsd %xmm0, %xmm2
diff --git a/llvm/test/tools/llvm-mca/X86/Znver1/resources-x86_64.s b/llvm/test/tools/llvm-mca/X86/Znver1/resources-x86_64.s
index b190803318a10..7eadac52bfb3a 100644
--- a/llvm/test/tools/llvm-mca/X86/Znver1/resources-x86_64.s
+++ b/llvm/test/tools/llvm-mca/X86/Znver1/resources-x86_64.s
@@ -1400,16 +1400,16 @@ xorq (%rax), %rdi
# CHECK-NEXT: 2 5 0.50 * movzbw (%rax), %di
# CHECK-NEXT: 1 1 0.25 movsbl %al, %edi
# CHECK-NEXT: 1 1 0.25 movzbl %al, %edi
-# CHECK-NEXT: 1 8 0.50 * movsbl (%rax), %edi
-# CHECK-NEXT: 1 8 0.50 * movzbl (%rax), %edi
+# CHECK-NEXT: 1 4 0.50 * movsbl (%rax), %edi
+# CHECK-NEXT: 1 4 0.50 * movzbl (%rax), %edi
# CHECK-NEXT: 1 1 0.25 movsbq %al, %rdi
# CHECK-NEXT: 1 1 0.25 movzbq %al, %rdi
# CHECK-NEXT: 2 5 0.50 * movsbq (%rax), %rdi
# CHECK-NEXT: 2 5 0.50 * movzbq (%rax), %rdi
# CHECK-NEXT: 1 1 0.25 movswl %ax, %edi
# CHECK-NEXT: 1 1 0.25 movzwl %ax, %edi
-# CHECK-NEXT: 1 8 0.50 * movswl (%rax), %edi
-# CHECK-NEXT: 1 8 0.50 * movzwl (%rax), %edi
+# CHECK-NEXT: 1 4 0.50 * movswl (%rax), %edi
+# CHECK-NEXT: 1 4 0.50 * movzwl (%rax), %edi
# CHECK-NEXT: 1 1 0.25 movswq %ax, %rdi
# CHECK-NEXT: 1 1 0.25 movzwq %ax, %rdi
# CHECK-NEXT: 2 5 0.50 * movswq (%rax), %rdi
diff --git a/llvm/test/tools/llvm-mca/X86/Znver1/resources-x87.s b/llvm/test/tools/llvm-mca/X86/Znver1/resources-x87.s
index 0c26a40849d62..6cfa018e6dbca 100644
--- a/llvm/test/tools/llvm-mca/X86/Znver1/resources-x87.s
+++ b/llvm/test/tools/llvm-mca/X86/Znver1/resources-x87.s
@@ -276,8 +276,8 @@ fyl2xp1
# CHECK-NEXT: 1 12 0.50 * U fisttpl (%ecx)
# CHECK-NEXT: 1 12 0.50 * U fisttpll (%eax)
# CHECK-NEXT: 1 1 0.50 U fld %st(0)
-# CHECK-NEXT: 1 8 0.50 * U flds (%edx)
-# CHECK-NEXT: 1 8 0.50 * U fldl (%ecx)
+# CHECK-NEXT: 1 4 0.50 * U flds (%edx)
+# CHECK-NEXT: 1 4 0.50 * U fldl (%ecx)
# CHECK-NEXT: 2 1 0.50 * U fldt (%eax)
# CHECK-NEXT: 1 100 0.25 * U fldcw (%eax)
# CHECK-NEXT: 1 100 0.25 * U fldenv (%eax)
diff --git a/llvm/test/tools/llvm-mca/X86/Znver2/resources-clflushopt.s b/llvm/test/tools/llvm-mca/X86/Znver2/resources-clflushopt.s
index 461c0109254e1..671381f78a953 100644
--- a/llvm/test/tools/llvm-mca/X86/Znver2/resources-clflushopt.s
+++ b/llvm/test/tools/llvm-mca/X86/Znver2/resources-clflushopt.s
@@ -12,7 +12,7 @@ clflushopt (%rax)
# CHECK-NEXT: [6]: HasSideEffects (U)
# CHECK: [1] [2] [3] [4] [5] [6] Instructions:
-# CHECK-NEXT: 1 8 0.33 * * U clflushopt (%rax)
+# CHECK-NEXT: 1 4 0.33 * * U clflushopt (%rax)
# CHECK: Resources:
# CHECK-NEXT: [0] - Zn2AGU0
diff --git a/llvm/test/tools/llvm-mca/X86/Znver2/resources-clzero.s b/llvm/test/tools/llvm-mca/X86/Znver2/resources-clzero.s
index 83de8d3a691d6..12c4f757551b1 100644
--- a/llvm/test/tools/llvm-mca/X86/Znver2/resources-clzero.s
+++ b/llvm/test/tools/llvm-mca/X86/Znver2/resources-clzero.s
@@ -12,7 +12,7 @@ clzero
# CHECK-NEXT: [6]: HasSideEffects (U)
# CHECK: [1] [2] [3] [4] [5] [6] Instructions:
-# CHECK-NEXT: 1 8 0.33 U clzero
+# CHECK-NEXT: 1 4 0.33 U clzero
# CHECK: Resources:
# CHECK-NEXT: [0] - Zn2AGU0
diff --git a/llvm/test/tools/llvm-mca/X86/Znver2/resources-prefetchw.s b/llvm/test/tools/llvm-mca/X86/Znver2/resources-prefetchw.s
index 2e240b3af8e83..b405f4c29e0f0 100644
--- a/llvm/test/tools/llvm-mca/X86/Znver2/resources-prefetchw.s
+++ b/llvm/test/tools/llvm-mca/X86/Znver2/resources-prefetchw.s
@@ -13,8 +13,8 @@ prefetchw (%rax)
# CHECK-NEXT: [6]: HasSideEffects (U)
# CHECK: [1] [2] [3] [4] [5] [6] Instructions:
-# CHECK-NEXT: 1 8 0.33 * * prefetch (%rax)
-# CHECK-NEXT: 1 8 0.33 * * prefetchw (%rax)
+# CHECK-NEXT: 1 4 0.33 * * prefetch (%rax)
+# CHECK-NEXT: 1 4 0.33 * * prefetchw (%rax)
# CHECK: Resources:
# CHECK-NEXT: [0] - Zn2AGU0
diff --git a/llvm/test/tools/llvm-mca/X86/Znver2/resources-sse1.s b/llvm/test/tools/llvm-mca/X86/Znver2/resources-sse1.s
index 030b6521d628e..64c3ae95ba0d4 100644
--- a/llvm/test/tools/llvm-mca/X86/Znver2/resources-sse1.s
+++ b/llvm/test/tools/llvm-mca/X86/Znver2/resources-sse1.s
@@ -282,10 +282,10 @@ xorps (%rax), %xmm2
# CHECK-NEXT: 1 1 1.00 pmovmskb %mm0, %ecx
# CHECK-NEXT: 1 4 1.00 pmulhuw %mm0, %mm2
# CHECK-NEXT: 1 11 1.00 * pmulhuw (%rax), %mm2
-# CHECK-NEXT: 1 8 0.33 * * prefetcht0 (%rax)
-# CHECK-NEXT: 1 8 0.33 * * prefetcht1 (%rax)
-# CHECK-NEXT: 1 8 0.33 * * prefetcht2 (%rax)
-# CHECK-NEXT: 1 8 0.33 * * prefetchnta (%rax)
+# CHECK-NEXT: 1 4 0.33 * * prefetcht0 (%rax)
+# CHECK-NEXT: 1 4 0.33 * * prefetcht1 (%rax)
+# CHECK-NEXT: 1 4 0.33 * * prefetcht2 (%rax)
+# CHECK-NEXT: 1 4 0.33 * * prefetchnta (%rax)
# CHECK-NEXT: 1 3 1.00 psadbw %mm0, %mm2
# CHECK-NEXT: 1 10 1.00 * psadbw (%rax), %mm2
# CHECK-NEXT: 1 1 0.50 pshufw $1, %mm0, %mm2
diff --git a/llvm/test/tools/llvm-mca/X86/Znver2/resources-sse2.s b/llvm/test/tools/llvm-mca/X86/Znver2/resources-sse2.s
index a0535cfa0d02d..9a465802f8b17 100644
--- a/llvm/test/tools/llvm-mca/X86/Znver2/resources-sse2.s
+++ b/llvm/test/tools/llvm-mca/X86/Znver2/resources-sse2.s
@@ -415,7 +415,7 @@ xorpd (%rax), %xmm2
# CHECK-NEXT: 1 8 0.33 * andnpd (%rax), %xmm2
# CHECK-NEXT: 1 1 0.25 andpd %xmm0, %xmm2
# CHECK-NEXT: 1 8 0.33 * andpd (%rax), %xmm2
-# CHECK-NEXT: 1 8 0.33 * * U clflush (%rax)
+# CHECK-NEXT: 1 4 0.33 * * U clflush (%rax)
# CHECK-NEXT: 1 1 0.50 cmpeqpd %xmm0, %xmm2
# CHECK-NEXT: 1 8 0.50 * cmpeqpd (%rax), %xmm2
# CHECK-NEXT: 1 1 0.50 cmpeqsd %xmm0, %xmm2
diff --git a/llvm/test/tools/llvm-mca/X86/Znver2/resources-x86_64.s b/llvm/test/tools/llvm-mca/X86/Znver2/resources-x86_64.s
index 7ccf6efb43e36..3cd41c176ce04 100644
--- a/llvm/test/tools/llvm-mca/X86/Znver2/resources-x86_64.s
+++ b/llvm/test/tools/llvm-mca/X86/Znver2/resources-x86_64.s
@@ -1202,16 +1202,16 @@ xorq (%rax), %rdi
# CHECK-NEXT: 2 5 0.33 * movzbw (%rax), %di
# CHECK-NEXT: 1 1 0.25 movsbl %al, %edi
# CHECK-NEXT: 1 1 0.25 movzbl %al, %edi
-# CHECK-NEXT: 1 8 0.33 * movsbl (%rax), %edi
-# CHECK-NEXT: 1 8 0.33 * movzbl (%rax), %edi
+# CHECK-NEXT: 1 4 0.33 * movsbl (%rax), %edi
+# CHECK-NEXT: 1 4 0.33 * movzbl (%rax), %edi
# CHECK-NEXT: 1 1 0.25 movsbq %al, %rdi
# CHECK-NEXT: 1 1 0.25 movzbq %al, %rdi
# CHECK-NEXT: 2 5 0.33 * movsbq (%rax), %rdi
# CHECK-NEXT: 2 5 0.33 * movzbq (%rax), %rdi
# CHECK-NEXT: 1 1 0.25 movswl %ax, %edi
# CHECK-NEXT: 1 1 0.25 movzwl %ax, %edi
-# CHECK-NEXT: 1 8 0.33 * movswl (%rax), %edi
-# CHECK-NEXT: 1 8 0.33 * movzwl (%rax), %edi
+# CHECK-NEXT: 1 4 0.33 * movswl (%rax), %edi
+# CHECK-NEXT: 1 4 0.33 * movzwl (%rax), %edi
# CHECK-NEXT: 1 1 0.25 movswq %ax, %rdi
# CHECK-NEXT: 1 1 0.25 movzwq %ax, %rdi
# CHECK-NEXT: 2 5 0.33 * movswq (%rax), %rdi
diff --git a/llvm/test/tools/llvm-mca/X86/Znver2/resources-x87.s b/llvm/test/tools/llvm-mca/X86/Znver2/resources-x87.s
index be542ecb2debc..1987176040002 100644
--- a/llvm/test/tools/llvm-mca/X86/Znver2/resources-x87.s
+++ b/llvm/test/tools/llvm-mca/X86/Znver2/resources-x87.s
@@ -276,8 +276,8 @@ fyl2xp1
# CHECK-NEXT: 1 12 0.50 * U fisttpl (%ecx)
# CHECK-NEXT: 1 12 0.50 * U fisttpll (%eax)
# CHECK-NEXT: 1 1 0.50 U fld %st(0)
-# CHECK-NEXT: 1 8 0.33 * U flds (%edx)
-# CHECK-NEXT: 1 8 0.33 * U fldl (%ecx)
+# CHECK-NEXT: 1 4 0.33 * U flds (%edx)
+# CHECK-NEXT: 1 4 0.33 * U fldl (%ecx)
# CHECK-NEXT: 2 1 0.50 * U fldt (%eax)
# CHECK-NEXT: 1 100 0.25 * U fldcw (%eax)
# CHECK-NEXT: 1 100 0.25 * U fldenv (%eax)
More information about the llvm-commits
mailing list