Skip to content

Commit

Permalink
[X86] Fix scalar load latencies for WriteLoad scheduler class
Browse files Browse the repository at this point in the history
Atom was missing a load latency value (so was defaulting to 1cy)

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
  • Loading branch information
RKSimon committed Nov 6, 2022
1 parent 0e9dfff commit 244331a
Show file tree
Hide file tree
Showing 20 changed files with 40 additions and 40 deletions.
2 changes: 1 addition & 1 deletion llvm/lib/Target/X86/X86ScheduleAtom.td
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ defm : X86WriteRes<WriteSHDmrcl,[AtomPort01], 4, [4], 1>;
// Loads, stores, and moves, not folded with other operations.
////////////////////////////////////////////////////////////////////////////////

def : WriteRes<WriteLoad, [AtomPort0]>;
def : WriteRes<WriteLoad, [AtomPort0]> { let Latency = 3; }
def : WriteRes<WriteStore, [AtomPort0]>;
def : WriteRes<WriteStoreNT, [AtomPort0]>;
def : WriteRes<WriteMove, [AtomPort01]>;
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/Target/X86/X86ScheduleZnver1.td
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/Target/X86/X86ScheduleZnver2.td
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
8 changes: 4 additions & 4 deletions llvm/test/tools/llvm-mca/X86/Atom/resources-sse1.s
Original file line number Diff line number Diff line change
Expand Up @@ -282,10 +282,10 @@ xorps (%rax), %xmm2
# CHECK-NEXT: 1 3 3.00 pmovmskb %mm0, %ecx
# CHECK-NEXT: 1 4 1.00 pmulhuw %mm0, %mm2
# CHECK-NEXT: 1 4 1.00 * pmulhuw (%rax), %mm2
# CHECK-NEXT: 1 1 1.00 * * prefetcht0 (%rax)
# CHECK-NEXT: 1 1 1.00 * * prefetcht1 (%rax)
# CHECK-NEXT: 1 1 1.00 * * prefetcht2 (%rax)
# CHECK-NEXT: 1 1 1.00 * * prefetchnta (%rax)
# CHECK-NEXT: 1 3 1.00 * * prefetcht0 (%rax)
# CHECK-NEXT: 1 3 1.00 * * prefetcht1 (%rax)
# CHECK-NEXT: 1 3 1.00 * * prefetcht2 (%rax)
# CHECK-NEXT: 1 3 1.00 * * prefetchnta (%rax)
# CHECK-NEXT: 1 4 1.00 psadbw %mm0, %mm2
# CHECK-NEXT: 1 4 1.00 * psadbw (%rax), %mm2
# CHECK-NEXT: 1 1 1.00 pshufw $1, %mm0, %mm2
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/tools/llvm-mca/X86/Atom/resources-sse2.s
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ xorpd (%rax), %xmm2
# CHECK-NEXT: 1 1 1.00 * andnpd (%rax), %xmm2
# CHECK-NEXT: 1 1 0.50 andpd %xmm0, %xmm2
# CHECK-NEXT: 1 1 1.00 * andpd (%rax), %xmm2
# CHECK-NEXT: 1 1 1.00 * * U clflush (%rax)
# CHECK-NEXT: 1 3 1.00 * * U clflush (%rax)
# CHECK-NEXT: 3 6 5.00 cmpeqpd %xmm0, %xmm2
# CHECK-NEXT: 4 7 6.00 * cmpeqpd (%rax), %xmm2
# CHECK-NEXT: 1 5 1.00 cmpeqsd %xmm0, %xmm2
Expand Down
4 changes: 2 additions & 2 deletions llvm/test/tools/llvm-mca/X86/Atom/resources-x87.s
Original file line number Diff line number Diff line change
Expand Up @@ -276,8 +276,8 @@ fyl2xp1
# CHECK-NEXT: 1 2 1.00 * U fisttpl (%ecx)
# CHECK-NEXT: 1 2 1.00 * U fisttpll (%eax)
# CHECK-NEXT: 1 1 1.00 U fld %st(0)
# CHECK-NEXT: 1 1 1.00 * U flds (%edx)
# CHECK-NEXT: 1 1 1.00 * U fldl (%ecx)
# CHECK-NEXT: 1 3 1.00 * U flds (%edx)
# CHECK-NEXT: 1 3 1.00 * U fldl (%ecx)
# CHECK-NEXT: 1 4 2.00 * U fldt (%eax)
# CHECK-NEXT: 1 5 2.50 * U fldcw (%eax)
# CHECK-NEXT: 1 100 0.50 * U fldenv (%eax)
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/tools/llvm-mca/X86/Znver1/resources-clflushopt.s
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/tools/llvm-mca/X86/Znver1/resources-clzero.s
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions llvm/test/tools/llvm-mca/X86/Znver1/resources-prefetchw.s
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions llvm/test/tools/llvm-mca/X86/Znver1/resources-sse1.s
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/tools/llvm-mca/X86/Znver1/resources-sse2.s
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions llvm/test/tools/llvm-mca/X86/Znver1/resources-x86_64.s
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions llvm/test/tools/llvm-mca/X86/Znver1/resources-x87.s
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/tools/llvm-mca/X86/Znver2/resources-clflushopt.s
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/tools/llvm-mca/X86/Znver2/resources-clzero.s
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions llvm/test/tools/llvm-mca/X86/Znver2/resources-prefetchw.s
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions llvm/test/tools/llvm-mca/X86/Znver2/resources-sse1.s
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/tools/llvm-mca/X86/Znver2/resources-sse2.s
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions llvm/test/tools/llvm-mca/X86/Znver2/resources-x86_64.s
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions llvm/test/tools/llvm-mca/X86/Znver2/resources-x87.s
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 244331a

Please sign in to comment.