[llvm] 6ba0b9f - [X86][SLM] Fix PBLENDVB uops and throughput
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 3 03:32:44 PDT 2021
Author: Simon Pilgrim
Date: 2021-09-03T11:31:29+01:00
New Revision: 6ba0b9f68ac9b3a058a2e98e5c4d1e039eff662f
URL: https://github.com/llvm/llvm-project/commit/6ba0b9f68ac9b3a058a2e98e5c4d1e039eff662f
DIFF: https://github.com/llvm/llvm-project/commit/6ba0b9f68ac9b3a058a2e98e5c4d1e039eff662f.diff
LOG: [X86][SLM] Fix PBLENDVB uops and throughput
SLM PBLENDVB is just as bad as BLENDVPD/PS - so model it as such, fixing the rr vs rm uops diff as well. The Intel AoM appears to have a copy+paste typo with PBLENDW, it doesn't match Agner or InstLatX64.
Noticed while investigating some of the weird discrepancies reported by the D103695 helper script (SLM had much better vector shift throughputs than it should).
Added:
Modified:
llvm/lib/Target/X86/X86ScheduleSLM.td
llvm/test/tools/llvm-mca/X86/SLM/resources-sse41.s
Removed:
################################################################################
diff --git a/llvm/lib/Target/X86/X86ScheduleSLM.td b/llvm/lib/Target/X86/X86ScheduleSLM.td
index da48a9b888886..2e58b1cb4249e 100644
--- a/llvm/lib/Target/X86/X86ScheduleSLM.td
+++ b/llvm/lib/Target/X86/X86ScheduleSLM.td
@@ -62,7 +62,7 @@ def : ReadAdvance<ReadInt2Fpu, 0>;
multiclass SLMWriteResPair<X86FoldableSchedWrite SchedRW,
list<ProcResourceKind> ExePorts,
int Lat, list<int> Res = [1], int UOps = 1,
- int LoadLat = 3> {
+ int LoadLat = 3, int LoadUOps = 0> {
// Register variant is using a single cycle on ExePort.
def : WriteRes<SchedRW, ExePorts> {
let Latency = Lat;
@@ -75,7 +75,7 @@ multiclass SLMWriteResPair<X86FoldableSchedWrite SchedRW,
def : WriteRes<SchedRW.Folded, !listconcat([SLM_MEC_RSV], ExePorts)> {
let Latency = !add(Lat, LoadLat);
let ResourceCycles = !listconcat([1], Res);
- let NumMicroOps = UOps;
+ let NumMicroOps = !add(UOps, LoadUOps);
}
}
@@ -280,7 +280,7 @@ defm : X86WriteResPairUnsupported<WriteFVarShuffleZ>;
defm : SLMWriteResPair<WriteFBlend, [SLM_FPC_RSV0], 1>;
defm : X86WriteResPairUnsupported<WriteFBlendY>;
defm : X86WriteResPairUnsupported<WriteFBlendZ>;
-defm : SLMWriteResPair<WriteFVarBlend, [SLM_FPC_RSV0], 4, [4], 3>;
+defm : SLMWriteResPair<WriteFVarBlend, [SLM_FPC_RSV0], 4, [4], 2, 3, 1>;
defm : X86WriteResPairUnsupported<WriteFVarBlendY>;
defm : X86WriteResPairUnsupported<WriteFVarBlendZ>;
defm : X86WriteResPairUnsupported<WriteFShuffle256>;
@@ -391,7 +391,7 @@ defm : X86WriteResPairUnsupported<WriteVarShuffleZ>;
defm : SLMWriteResPair<WriteBlend, [SLM_FPC_RSV0], 1>;
defm : SLMWriteResPair<WriteBlendY, [SLM_FPC_RSV0], 1>;
defm : X86WriteResPairUnsupported<WriteBlendZ>;
-defm : SLMWriteResPair<WriteVarBlend, [SLM_FPC_RSV0], 1>;
+defm : SLMWriteResPair<WriteVarBlend, [SLM_FPC_RSV0], 4, [4], 2, 3, 1>;
defm : X86WriteResPairUnsupported<WriteVarBlendY>;
defm : X86WriteResPairUnsupported<WriteVarBlendZ>;
defm : SLMWriteResPair<WriteMPSAD, [SLM_FPC_RSV0], 7>;
diff --git a/llvm/test/tools/llvm-mca/X86/SLM/resources-sse41.s b/llvm/test/tools/llvm-mca/X86/SLM/resources-sse41.s
index 7fbf75b627dea..2bcebead6181a 100644
--- a/llvm/test/tools/llvm-mca/X86/SLM/resources-sse41.s
+++ b/llvm/test/tools/llvm-mca/X86/SLM/resources-sse41.s
@@ -159,9 +159,9 @@ roundss $1, (%rax), %xmm2
# CHECK-NEXT: 1 4 1.00 * blendpd $11, (%rax), %xmm2
# CHECK-NEXT: 1 1 1.00 blendps $11, %xmm0, %xmm2
# CHECK-NEXT: 1 4 1.00 * blendps $11, (%rax), %xmm2
-# CHECK-NEXT: 3 4 4.00 blendvpd %xmm0, %xmm0, %xmm2
+# CHECK-NEXT: 2 4 4.00 blendvpd %xmm0, %xmm0, %xmm2
# CHECK-NEXT: 3 7 4.00 * blendvpd %xmm0, (%rax), %xmm2
-# CHECK-NEXT: 3 4 4.00 blendvps %xmm0, %xmm0, %xmm2
+# CHECK-NEXT: 2 4 4.00 blendvps %xmm0, %xmm0, %xmm2
# CHECK-NEXT: 3 7 4.00 * blendvps %xmm0, (%rax), %xmm2
# CHECK-NEXT: 1 3 1.00 dppd $22, %xmm0, %xmm2
# CHECK-NEXT: 1 6 1.00 * dppd $22, (%rax), %xmm2
@@ -176,8 +176,8 @@ roundss $1, (%rax), %xmm2
# CHECK-NEXT: 1 10 1.00 * mpsadbw $1, (%rax), %xmm2
# CHECK-NEXT: 1 1 1.00 packusdw %xmm0, %xmm2
# CHECK-NEXT: 1 4 1.00 * packusdw (%rax), %xmm2
-# CHECK-NEXT: 1 1 1.00 pblendvb %xmm0, %xmm0, %xmm2
-# CHECK-NEXT: 1 4 1.00 * pblendvb %xmm0, (%rax), %xmm2
+# CHECK-NEXT: 2 4 4.00 pblendvb %xmm0, %xmm0, %xmm2
+# CHECK-NEXT: 3 7 4.00 * pblendvb %xmm0, (%rax), %xmm2
# CHECK-NEXT: 1 1 1.00 pblendw $11, %xmm0, %xmm2
# CHECK-NEXT: 1 4 1.00 * pblendw $11, (%rax), %xmm2
# CHECK-NEXT: 2 4 2.00 pcmpeqq %xmm0, %xmm2
@@ -264,7 +264,7 @@ roundss $1, (%rax), %xmm2
# CHECK: Resource pressure per iteration:
# CHECK-NEXT: [0] [1] [2] [3] [4] [5] [6] [7]
-# CHECK-NEXT: - - - 90.00 25.00 - - 54.00
+# CHECK-NEXT: - - - 96.00 25.00 - - 54.00
# CHECK: Resource pressure by instruction:
# CHECK-NEXT: [0] [1] [2] [3] [4] [5] [6] [7] Instructions:
@@ -289,8 +289,8 @@ roundss $1, (%rax), %xmm2
# CHECK-NEXT: - - - 1.00 - - - 1.00 mpsadbw $1, (%rax), %xmm2
# CHECK-NEXT: - - - 1.00 - - - - packusdw %xmm0, %xmm2
# CHECK-NEXT: - - - 1.00 - - - 1.00 packusdw (%rax), %xmm2
-# CHECK-NEXT: - - - 1.00 - - - - pblendvb %xmm0, %xmm0, %xmm2
-# CHECK-NEXT: - - - 1.00 - - - 1.00 pblendvb %xmm0, (%rax), %xmm2
+# CHECK-NEXT: - - - 4.00 - - - - pblendvb %xmm0, %xmm0, %xmm2
+# CHECK-NEXT: - - - 4.00 - - - 1.00 pblendvb %xmm0, (%rax), %xmm2
# CHECK-NEXT: - - - 1.00 - - - - pblendw $11, %xmm0, %xmm2
# CHECK-NEXT: - - - 1.00 - - - 1.00 pblendw $11, (%rax), %xmm2
# CHECK-NEXT: - - - 2.00 2.00 - - - pcmpeqq %xmm0, %xmm2
More information about the llvm-commits
mailing list