From 0d9da88d181a0f030a3d258f0e89c651d3ba7cbf Mon Sep 17 00:00:00 2001 From: Clement Courbet Date: Mon, 18 Jun 2018 06:48:22 +0000 Subject: [PATCH] [X86] Fix NOOP sched overrides on BDW/HSW/SKL. Summary: Noop certainly does not use resources. Reviewers: RKSimon, craig.topper, andreadb Subscribers: gbedwell, llvm-commits, gchatelet Differential Revision: https://reviews.llvm.org/D48028 llvm-svn: 334927 --- llvm/lib/Target/X86/X86SchedBroadwell.td | 3 +- llvm/lib/Target/X86/X86SchedHaswell.td | 3 +- llvm/lib/Target/X86/X86SchedSkylakeClient.td | 3 +- llvm/test/CodeGen/X86/schedule-x86_64.ll | 14 ++++----- llvm/test/CodeGen/X86/sse-schedule.ll | 4 +-- .../llvm-mca/X86/Broadwell/resources-x86_64.s | 16 +++++----- .../llvm-mca/X86/Haswell/resources-x86_64.s | 16 +++++----- .../X86/SkylakeClient/resources-x86_64.s | 30 +++++++++---------- 8 files changed, 43 insertions(+), 46 deletions(-) diff --git a/llvm/lib/Target/X86/X86SchedBroadwell.td b/llvm/lib/Target/X86/X86SchedBroadwell.td index b8f1856dc60e..4e307180909c 100755 --- a/llvm/lib/Target/X86/X86SchedBroadwell.td +++ b/llvm/lib/Target/X86/X86SchedBroadwell.td @@ -625,8 +625,7 @@ def BWWriteResGroup9 : SchedWriteRes<[BWPort0156]> { let ResourceCycles = [1]; } def: InstRW<[BWWriteResGroup9], (instrs LAHF, SAHF)>; // TODO: This doesnt match Agner's data -def: InstRW<[BWWriteResGroup9], (instregex "NOOP", - "SGDT64m", +def: InstRW<[BWWriteResGroup9], (instregex "SGDT64m", "SIDT64m", "SMSW16m", "STRm", diff --git a/llvm/lib/Target/X86/X86SchedHaswell.td b/llvm/lib/Target/X86/X86SchedHaswell.td index 73273f0e9d1d..2c0520f3cc04 100644 --- a/llvm/lib/Target/X86/X86SchedHaswell.td +++ b/llvm/lib/Target/X86/X86SchedHaswell.td @@ -913,8 +913,7 @@ def HWWriteResGroup10 : SchedWriteRes<[HWPort0156]> { def: InstRW<[HWWriteResGroup10], (instrs CBW, CWDE, CDQE, CMC, STC)>; def: InstRW<[HWWriteResGroup10], (instrs LAHF, SAHF)>; // TODO: This doesn't match Agner's data -def: InstRW<[HWWriteResGroup10], (instregex "NOOP", - "SGDT64m", +def: InstRW<[HWWriteResGroup10], (instregex "SGDT64m", "SIDT64m", "SMSW16m", "STRm", diff --git a/llvm/lib/Target/X86/X86SchedSkylakeClient.td b/llvm/lib/Target/X86/X86SchedSkylakeClient.td index 952db0507997..ea0d146acee2 100644 --- a/llvm/lib/Target/X86/X86SchedSkylakeClient.td +++ b/llvm/lib/Target/X86/X86SchedSkylakeClient.td @@ -630,8 +630,7 @@ def SKLWriteResGroup10 : SchedWriteRes<[SKLPort0156]> { def: InstRW<[SKLWriteResGroup10], (instrs CBW, CWDE, CDQE, CMC, STC)>; def: InstRW<[SKLWriteResGroup10], (instrs LAHF, SAHF)>; // TODO: This doesn't match Agner's data -def: InstRW<[SKLWriteResGroup10], (instregex "NOOP", - "SGDT64m", +def: InstRW<[SKLWriteResGroup10], (instregex "SGDT64m", "SIDT64m", "SMSW16m", "STRm", diff --git a/llvm/test/CodeGen/X86/schedule-x86_64.ll b/llvm/test/CodeGen/X86/schedule-x86_64.ll index 3eb4cb15478e..fca6b4545a31 100644 --- a/llvm/test/CodeGen/X86/schedule-x86_64.ll +++ b/llvm/test/CodeGen/X86/schedule-x86_64.ll @@ -8363,13 +8363,13 @@ define void @test_nop(i16 %a0, i32 %a1, i64 %a2, i16 *%p0, i32 *%p1, i64 *%p2) o ; SKYLAKE-LABEL: test_nop: ; SKYLAKE: # %bb.0: ; SKYLAKE-NEXT: #APP -; SKYLAKE-NEXT: nop # sched: [1:0.25] -; SKYLAKE-NEXT: nopw %di # sched: [1:0.25] -; SKYLAKE-NEXT: nopw (%rcx) # sched: [1:0.25] -; SKYLAKE-NEXT: nopl %esi # sched: [1:0.25] -; SKYLAKE-NEXT: nopl (%r8) # sched: [1:0.25] -; SKYLAKE-NEXT: nopq %rdx # sched: [1:0.25] -; SKYLAKE-NEXT: nopq (%r9) # sched: [1:0.25] +; SKYLAKE-NEXT: nop # sched: [1:0.17] +; SKYLAKE-NEXT: nopw %di # sched: [1:0.17] +; SKYLAKE-NEXT: nopw (%rcx) # sched: [1:0.17] +; SKYLAKE-NEXT: nopl %esi # sched: [1:0.17] +; SKYLAKE-NEXT: nopl (%r8) # sched: [1:0.17] +; SKYLAKE-NEXT: nopq %rdx # sched: [1:0.17] +; SKYLAKE-NEXT: nopq (%r9) # sched: [1:0.17] ; SKYLAKE-NEXT: #NO_APP ; SKYLAKE-NEXT: retq # sched: [7:1.00] ; diff --git a/llvm/test/CodeGen/X86/sse-schedule.ll b/llvm/test/CodeGen/X86/sse-schedule.ll index f18d0934198b..4378117b79c2 100644 --- a/llvm/test/CodeGen/X86/sse-schedule.ll +++ b/llvm/test/CodeGen/X86/sse-schedule.ll @@ -6194,7 +6194,7 @@ define <4 x float> @test_fnop() nounwind { ; SKYLAKE-SSE-LABEL: test_fnop: ; SKYLAKE-SSE: # %bb.0: ; SKYLAKE-SSE-NEXT: #APP -; SKYLAKE-SSE-NEXT: nop # sched: [1:0.25] +; SKYLAKE-SSE-NEXT: nop # sched: [1:0.17] ; SKYLAKE-SSE-NEXT: #NO_APP ; SKYLAKE-SSE-NEXT: xorps %xmm0, %xmm0 # sched: [1:0.33] ; SKYLAKE-SSE-NEXT: retq # sched: [7:1.00] @@ -6202,7 +6202,7 @@ define <4 x float> @test_fnop() nounwind { ; SKYLAKE-LABEL: test_fnop: ; SKYLAKE: # %bb.0: ; SKYLAKE-NEXT: #APP -; SKYLAKE-NEXT: nop # sched: [1:0.25] +; SKYLAKE-NEXT: nop # sched: [1:0.17] ; SKYLAKE-NEXT: #NO_APP ; SKYLAKE-NEXT: vxorps %xmm0, %xmm0, %xmm0 # sched: [1:0.33] ; SKYLAKE-NEXT: retq # sched: [7:1.00] diff --git a/llvm/test/tools/llvm-mca/X86/Broadwell/resources-x86_64.s b/llvm/test/tools/llvm-mca/X86/Broadwell/resources-x86_64.s index f699701e1ef6..0cc3521dde32 100644 --- a/llvm/test/tools/llvm-mca/X86/Broadwell/resources-x86_64.s +++ b/llvm/test/tools/llvm-mca/X86/Broadwell/resources-x86_64.s @@ -1164,7 +1164,7 @@ xorq (%rax), %rdi # CHECK: Resource pressure per iteration: # CHECK-NEXT: [0] [1] [2] [3] [4] [5] [6] [7] [8] [9] -# CHECK-NEXT: 50.00 - 363.75 244.25 202.00 202.00 167.00 149.75 329.25 69.00 +# CHECK-NEXT: 50.00 - 362.00 242.50 202.00 202.00 167.00 148.00 327.50 69.00 # CHECK: Resource pressure by instruction: # CHECK-NEXT: [0] [1] [2] [3] [4] [5] [6] [7] [8] [9] Instructions: @@ -1381,13 +1381,13 @@ xorq (%rax), %rdi # CHECK-NEXT: - - 0.25 0.25 0.83 0.83 1.00 0.25 0.25 0.33 negl (%rax) # CHECK-NEXT: - - 0.25 0.25 - - - 0.25 0.25 - negq %rcx # CHECK-NEXT: - - 0.25 0.25 0.83 0.83 1.00 0.25 0.25 0.33 negq (%r10) -# CHECK-NEXT: - - 0.25 0.25 - - - 0.25 0.25 - nop -# CHECK-NEXT: - - 0.25 0.25 - - - 0.25 0.25 - nopw %di -# CHECK-NEXT: - - 0.25 0.25 - - - 0.25 0.25 - nopw (%rcx) -# CHECK-NEXT: - - 0.25 0.25 - - - 0.25 0.25 - nopl %esi -# CHECK-NEXT: - - 0.25 0.25 - - - 0.25 0.25 - nopl (%r8) -# CHECK-NEXT: - - 0.25 0.25 - - - 0.25 0.25 - nopq %rdx -# CHECK-NEXT: - - 0.25 0.25 - - - 0.25 0.25 - nopq (%r9) +# CHECK-NEXT: - - - - - - - - - - nop +# CHECK-NEXT: - - - - - - - - - - nopw %di +# CHECK-NEXT: - - - - - - - - - - nopw (%rcx) +# CHECK-NEXT: - - - - - - - - - - nopl %esi +# CHECK-NEXT: - - - - - - - - - - nopl (%r8) +# CHECK-NEXT: - - - - - - - - - - nopq %rdx +# CHECK-NEXT: - - - - - - - - - - nopq (%r9) # CHECK-NEXT: - - 0.25 0.25 - - - 0.25 0.25 - notb %dil # CHECK-NEXT: - - 0.25 0.25 0.83 0.83 1.00 0.25 0.25 0.33 notb (%r8) # CHECK-NEXT: - - 0.25 0.25 - - - 0.25 0.25 - notw %si diff --git a/llvm/test/tools/llvm-mca/X86/Haswell/resources-x86_64.s b/llvm/test/tools/llvm-mca/X86/Haswell/resources-x86_64.s index 3c55d96eada0..667904cdb007 100644 --- a/llvm/test/tools/llvm-mca/X86/Haswell/resources-x86_64.s +++ b/llvm/test/tools/llvm-mca/X86/Haswell/resources-x86_64.s @@ -1164,7 +1164,7 @@ xorq (%rax), %rdi # CHECK: Resource pressure per iteration: # CHECK-NEXT: [0] [1] [2] [3] [4] [5] [6] [7] [8] [9] -# CHECK-NEXT: 80.00 - 414.75 265.25 193.00 193.00 158.00 172.75 409.25 66.00 +# CHECK-NEXT: 80.00 - 413.00 263.50 193.00 193.00 158.00 171.00 407.50 66.00 # CHECK: Resource pressure by instruction: # CHECK-NEXT: [0] [1] [2] [3] [4] [5] [6] [7] [8] [9] Instructions: @@ -1381,13 +1381,13 @@ xorq (%rax), %rdi # CHECK-NEXT: - - 0.25 0.25 0.83 0.83 1.00 0.25 0.25 0.33 negl (%rax) # CHECK-NEXT: - - 0.25 0.25 - - - 0.25 0.25 - negq %rcx # CHECK-NEXT: - - 0.25 0.25 0.83 0.83 1.00 0.25 0.25 0.33 negq (%r10) -# CHECK-NEXT: - - 0.25 0.25 - - - 0.25 0.25 - nop -# CHECK-NEXT: - - 0.25 0.25 - - - 0.25 0.25 - nopw %di -# CHECK-NEXT: - - 0.25 0.25 - - - 0.25 0.25 - nopw (%rcx) -# CHECK-NEXT: - - 0.25 0.25 - - - 0.25 0.25 - nopl %esi -# CHECK-NEXT: - - 0.25 0.25 - - - 0.25 0.25 - nopl (%r8) -# CHECK-NEXT: - - 0.25 0.25 - - - 0.25 0.25 - nopq %rdx -# CHECK-NEXT: - - 0.25 0.25 - - - 0.25 0.25 - nopq (%r9) +# CHECK-NEXT: - - - - - - - - - - nop +# CHECK-NEXT: - - - - - - - - - - nopw %di +# CHECK-NEXT: - - - - - - - - - - nopw (%rcx) +# CHECK-NEXT: - - - - - - - - - - nopl %esi +# CHECK-NEXT: - - - - - - - - - - nopl (%r8) +# CHECK-NEXT: - - - - - - - - - - nopq %rdx +# CHECK-NEXT: - - - - - - - - - - nopq (%r9) # CHECK-NEXT: - - 0.25 0.25 - - - 0.25 0.25 - notb %dil # CHECK-NEXT: - - 0.25 0.25 0.83 0.83 1.00 0.25 0.25 0.33 notb (%r8) # CHECK-NEXT: - - 0.25 0.25 - - - 0.25 0.25 - notw %si diff --git a/llvm/test/tools/llvm-mca/X86/SkylakeClient/resources-x86_64.s b/llvm/test/tools/llvm-mca/X86/SkylakeClient/resources-x86_64.s index 09027dca465a..03caa3ecb11c 100644 --- a/llvm/test/tools/llvm-mca/X86/SkylakeClient/resources-x86_64.s +++ b/llvm/test/tools/llvm-mca/X86/SkylakeClient/resources-x86_64.s @@ -822,13 +822,13 @@ xorq (%rax), %rdi # CHECK-NEXT: 3 7 1.00 * * negl (%rax) # CHECK-NEXT: 1 1 0.25 negq %rcx # CHECK-NEXT: 3 7 1.00 * * negq (%r10) -# CHECK-NEXT: 1 1 0.25 nop -# CHECK-NEXT: 1 1 0.25 nopw %di -# CHECK-NEXT: 1 1 0.25 nopw (%rcx) -# CHECK-NEXT: 1 1 0.25 nopl %esi -# CHECK-NEXT: 1 1 0.25 nopl (%r8) -# CHECK-NEXT: 1 1 0.25 nopq %rdx -# CHECK-NEXT: 1 1 0.25 nopq (%r9) +# CHECK-NEXT: 1 1 0.17 nop +# CHECK-NEXT: 1 1 0.17 nopw %di +# CHECK-NEXT: 1 1 0.17 nopw (%rcx) +# CHECK-NEXT: 1 1 0.17 nopl %esi +# CHECK-NEXT: 1 1 0.17 nopl (%r8) +# CHECK-NEXT: 1 1 0.17 nopq %rdx +# CHECK-NEXT: 1 1 0.17 nopq (%r9) # CHECK-NEXT: 1 1 0.25 notb %dil # CHECK-NEXT: 3 7 1.00 * * notb (%r8) # CHECK-NEXT: 1 1 0.25 notw %si @@ -1164,7 +1164,7 @@ xorq (%rax), %rdi # CHECK: Resource pressure per iteration: # CHECK-NEXT: [0] [1] [2] [3] [4] [5] [6] [7] [8] [9] -# CHECK-NEXT: 60.00 - 431.25 225.25 202.00 202.00 167.00 185.75 415.75 69.00 +# CHECK-NEXT: 60.00 - 429.50 223.50 202.00 202.00 167.00 184.00 414.00 69.00 # CHECK: Resource pressure by instruction: # CHECK-NEXT: [0] [1] [2] [3] [4] [5] [6] [7] [8] [9] Instructions: @@ -1381,13 +1381,13 @@ xorq (%rax), %rdi # CHECK-NEXT: - - 0.25 0.25 0.83 0.83 1.00 0.25 0.25 0.33 negl (%rax) # CHECK-NEXT: - - 0.25 0.25 - - - 0.25 0.25 - negq %rcx # CHECK-NEXT: - - 0.25 0.25 0.83 0.83 1.00 0.25 0.25 0.33 negq (%r10) -# CHECK-NEXT: - - 0.25 0.25 - - - 0.25 0.25 - nop -# CHECK-NEXT: - - 0.25 0.25 - - - 0.25 0.25 - nopw %di -# CHECK-NEXT: - - 0.25 0.25 - - - 0.25 0.25 - nopw (%rcx) -# CHECK-NEXT: - - 0.25 0.25 - - - 0.25 0.25 - nopl %esi -# CHECK-NEXT: - - 0.25 0.25 - - - 0.25 0.25 - nopl (%r8) -# CHECK-NEXT: - - 0.25 0.25 - - - 0.25 0.25 - nopq %rdx -# CHECK-NEXT: - - 0.25 0.25 - - - 0.25 0.25 - nopq (%r9) +# CHECK-NEXT: - - - - - - - - - - nop +# CHECK-NEXT: - - - - - - - - - - nopw %di +# CHECK-NEXT: - - - - - - - - - - nopw (%rcx) +# CHECK-NEXT: - - - - - - - - - - nopl %esi +# CHECK-NEXT: - - - - - - - - - - nopl (%r8) +# CHECK-NEXT: - - - - - - - - - - nopq %rdx +# CHECK-NEXT: - - - - - - - - - - nopq (%r9) # CHECK-NEXT: - - 0.25 0.25 - - - 0.25 0.25 - notb %dil # CHECK-NEXT: - - 0.25 0.25 0.83 0.83 1.00 0.25 0.25 0.33 notb (%r8) # CHECK-NEXT: - - 0.25 0.25 - - - 0.25 0.25 - notw %si