1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-26 04:32:44 +01:00

[X86][SLM] Fix vector PSHUFB + variable shift resource/throughputs

Match whats documented in the Intel AOM (+Agner) - PSHUFB xmm is really slow, and mmx/xmm vector shifts are half rate.

Noticed while working to get the cost tables to more closely match llvm-mca analysis, in this case for shifts and truncations.
This commit is contained in:
Simon Pilgrim 2021-05-26 11:07:22 +01:00
parent dc7c658d73
commit 6128b86b1d
4 changed files with 77 additions and 76 deletions

View File

@ -321,9 +321,9 @@ def : WriteRes<WriteVecMoveY, [SLM_FPC_RSV01]>;
def : WriteRes<WriteVecMoveToGpr, [SLM_IEC_RSV01]>;
def : WriteRes<WriteVecMoveFromGpr, [SLM_IEC_RSV01]>;
defm : SLMWriteResPair<WriteVecShift, [SLM_FPC_RSV0], 1>;
defm : SLMWriteResPair<WriteVecShiftX, [SLM_FPC_RSV0], 1>;
defm : SLMWriteResPair<WriteVecShiftY, [SLM_FPC_RSV0], 1>;
defm : SLMWriteResPair<WriteVecShift, [SLM_FPC_RSV0], 2, [2], 2>;
defm : SLMWriteResPair<WriteVecShiftX, [SLM_FPC_RSV0], 2, [2], 2>;
defm : SLMWriteResPair<WriteVecShiftY, [SLM_FPC_RSV0], 2, [2], 2>;
defm : X86WriteResPairUnsupported<WriteVecShiftZ>;
defm : SLMWriteResPair<WriteVecShiftImm, [SLM_FPC_RSV0], 1>;
defm : SLMWriteResPair<WriteVecShiftImmX,[SLM_FPC_RSV0], 1>;
@ -354,8 +354,8 @@ defm : SLMWriteResPair<WriteShuffleY, [SLM_FPC_RSV0], 1>;
defm : X86WriteResPairUnsupported<WriteShuffleZ>;
defm : SLMWriteResPair<WriteShuffleX, [SLM_FPC_RSV0], 1>;
defm : SLMWriteResPair<WriteVarShuffle, [SLM_FPC_RSV0], 1>;
defm : SLMWriteResPair<WriteVarShuffleX, [SLM_FPC_RSV0], 1>;
defm : SLMWriteResPair<WriteVarShuffleY, [SLM_FPC_RSV0], 1>;
defm : SLMWriteResPair<WriteVarShuffleX, [SLM_FPC_RSV0], 5, [5], 4>;
defm : SLMWriteResPair<WriteVarShuffleY, [SLM_FPC_RSV0], 5, [5], 4>;
defm : X86WriteResPairUnsupported<WriteVarShuffleZ>;
defm : SLMWriteResPair<WriteBlend, [SLM_FPC_RSV0], 1>;
defm : SLMWriteResPair<WriteBlendY, [SLM_FPC_RSV0], 1>;
@ -397,6 +397,7 @@ defm : SLMWriteResPair<WritePCmpIStrM, [SLM_FPC_RSV0], 13, [13]>;
// Packed Compare Explicit Length Strings, Return Mask
defm : SLMWriteResPair<WritePCmpEStrM, [SLM_FPC_RSV0], 17, [17]>;
// Packed Compare Implicit Length Strings, Return Index
defm : SLMWriteResPair<WritePCmpIStrI, [SLM_FPC_RSV0], 17, [17]>;

View File

@ -218,29 +218,29 @@ pxor (%rax), %mm2
# CHECK-NEXT: 1 1 0.50 por %mm0, %mm2
# CHECK-NEXT: 1 4 1.00 * por (%rax), %mm2
# CHECK-NEXT: 1 1 1.00 pslld $1, %mm2
# CHECK-NEXT: 1 1 1.00 pslld %mm0, %mm2
# CHECK-NEXT: 1 4 1.00 * pslld (%rax), %mm2
# CHECK-NEXT: 2 2 2.00 pslld %mm0, %mm2
# CHECK-NEXT: 2 5 2.00 * pslld (%rax), %mm2
# CHECK-NEXT: 1 1 1.00 psllq $1, %mm2
# CHECK-NEXT: 1 1 1.00 psllq %mm0, %mm2
# CHECK-NEXT: 1 4 1.00 * psllq (%rax), %mm2
# CHECK-NEXT: 2 2 2.00 psllq %mm0, %mm2
# CHECK-NEXT: 2 5 2.00 * psllq (%rax), %mm2
# CHECK-NEXT: 1 1 1.00 psllw $1, %mm2
# CHECK-NEXT: 1 1 1.00 psllw %mm0, %mm2
# CHECK-NEXT: 1 4 1.00 * psllw (%rax), %mm2
# CHECK-NEXT: 2 2 2.00 psllw %mm0, %mm2
# CHECK-NEXT: 2 5 2.00 * psllw (%rax), %mm2
# CHECK-NEXT: 1 1 1.00 psrad $1, %mm2
# CHECK-NEXT: 1 1 1.00 psrad %mm0, %mm2
# CHECK-NEXT: 1 4 1.00 * psrad (%rax), %mm2
# CHECK-NEXT: 2 2 2.00 psrad %mm0, %mm2
# CHECK-NEXT: 2 5 2.00 * psrad (%rax), %mm2
# CHECK-NEXT: 1 1 1.00 psraw $1, %mm2
# CHECK-NEXT: 1 1 1.00 psraw %mm0, %mm2
# CHECK-NEXT: 1 4 1.00 * psraw (%rax), %mm2
# CHECK-NEXT: 2 2 2.00 psraw %mm0, %mm2
# CHECK-NEXT: 2 5 2.00 * psraw (%rax), %mm2
# CHECK-NEXT: 1 1 1.00 psrld $1, %mm2
# CHECK-NEXT: 1 1 1.00 psrld %mm0, %mm2
# CHECK-NEXT: 1 4 1.00 * psrld (%rax), %mm2
# CHECK-NEXT: 2 2 2.00 psrld %mm0, %mm2
# CHECK-NEXT: 2 5 2.00 * psrld (%rax), %mm2
# CHECK-NEXT: 1 1 1.00 psrlq $1, %mm2
# CHECK-NEXT: 1 1 1.00 psrlq %mm0, %mm2
# CHECK-NEXT: 1 4 1.00 * psrlq (%rax), %mm2
# CHECK-NEXT: 2 2 2.00 psrlq %mm0, %mm2
# CHECK-NEXT: 2 5 2.00 * psrlq (%rax), %mm2
# CHECK-NEXT: 1 1 1.00 psrlw $1, %mm2
# CHECK-NEXT: 1 1 1.00 psrlw %mm0, %mm2
# CHECK-NEXT: 1 4 1.00 * psrlw (%rax), %mm2
# CHECK-NEXT: 2 2 2.00 psrlw %mm0, %mm2
# CHECK-NEXT: 2 5 2.00 * psrlw (%rax), %mm2
# CHECK-NEXT: 1 1 0.50 psubb %mm0, %mm2
# CHECK-NEXT: 1 4 1.00 * psubb (%rax), %mm2
# CHECK-NEXT: 1 1 0.50 psubd %mm0, %mm2
@ -282,7 +282,7 @@ pxor (%rax), %mm2
# CHECK: Resource pressure per iteration:
# CHECK-NEXT: [0] [1] [2] [3] [4] [5] [6] [7]
# CHECK-NEXT: - - - 77.00 29.00 2.00 2.00 48.00
# CHECK-NEXT: - - - 93.00 29.00 2.00 2.00 48.00
# CHECK: Resource pressure by instruction:
# CHECK-NEXT: [0] [1] [2] [3] [4] [5] [6] [7] Instructions:
@ -340,29 +340,29 @@ pxor (%rax), %mm2
# CHECK-NEXT: - - - 0.50 0.50 - - - por %mm0, %mm2
# CHECK-NEXT: - - - 0.50 0.50 - - 1.00 por (%rax), %mm2
# CHECK-NEXT: - - - 1.00 - - - - pslld $1, %mm2
# CHECK-NEXT: - - - 1.00 - - - - pslld %mm0, %mm2
# CHECK-NEXT: - - - 1.00 - - - 1.00 pslld (%rax), %mm2
# CHECK-NEXT: - - - 2.00 - - - - pslld %mm0, %mm2
# CHECK-NEXT: - - - 2.00 - - - 1.00 pslld (%rax), %mm2
# CHECK-NEXT: - - - 1.00 - - - - psllq $1, %mm2
# CHECK-NEXT: - - - 1.00 - - - - psllq %mm0, %mm2
# CHECK-NEXT: - - - 1.00 - - - 1.00 psllq (%rax), %mm2
# CHECK-NEXT: - - - 2.00 - - - - psllq %mm0, %mm2
# CHECK-NEXT: - - - 2.00 - - - 1.00 psllq (%rax), %mm2
# CHECK-NEXT: - - - 1.00 - - - - psllw $1, %mm2
# CHECK-NEXT: - - - 1.00 - - - - psllw %mm0, %mm2
# CHECK-NEXT: - - - 1.00 - - - 1.00 psllw (%rax), %mm2
# CHECK-NEXT: - - - 2.00 - - - - psllw %mm0, %mm2
# CHECK-NEXT: - - - 2.00 - - - 1.00 psllw (%rax), %mm2
# CHECK-NEXT: - - - 1.00 - - - - psrad $1, %mm2
# CHECK-NEXT: - - - 1.00 - - - - psrad %mm0, %mm2
# CHECK-NEXT: - - - 1.00 - - - 1.00 psrad (%rax), %mm2
# CHECK-NEXT: - - - 2.00 - - - - psrad %mm0, %mm2
# CHECK-NEXT: - - - 2.00 - - - 1.00 psrad (%rax), %mm2
# CHECK-NEXT: - - - 1.00 - - - - psraw $1, %mm2
# CHECK-NEXT: - - - 1.00 - - - - psraw %mm0, %mm2
# CHECK-NEXT: - - - 1.00 - - - 1.00 psraw (%rax), %mm2
# CHECK-NEXT: - - - 2.00 - - - - psraw %mm0, %mm2
# CHECK-NEXT: - - - 2.00 - - - 1.00 psraw (%rax), %mm2
# CHECK-NEXT: - - - 1.00 - - - - psrld $1, %mm2
# CHECK-NEXT: - - - 1.00 - - - - psrld %mm0, %mm2
# CHECK-NEXT: - - - 1.00 - - - 1.00 psrld (%rax), %mm2
# CHECK-NEXT: - - - 2.00 - - - - psrld %mm0, %mm2
# CHECK-NEXT: - - - 2.00 - - - 1.00 psrld (%rax), %mm2
# CHECK-NEXT: - - - 1.00 - - - - psrlq $1, %mm2
# CHECK-NEXT: - - - 1.00 - - - - psrlq %mm0, %mm2
# CHECK-NEXT: - - - 1.00 - - - 1.00 psrlq (%rax), %mm2
# CHECK-NEXT: - - - 2.00 - - - - psrlq %mm0, %mm2
# CHECK-NEXT: - - - 2.00 - - - 1.00 psrlq (%rax), %mm2
# CHECK-NEXT: - - - 1.00 - - - - psrlw $1, %mm2
# CHECK-NEXT: - - - 1.00 - - - - psrlw %mm0, %mm2
# CHECK-NEXT: - - - 1.00 - - - 1.00 psrlw (%rax), %mm2
# CHECK-NEXT: - - - 2.00 - - - - psrlw %mm0, %mm2
# CHECK-NEXT: - - - 2.00 - - - 1.00 psrlw (%rax), %mm2
# CHECK-NEXT: - - - 0.50 0.50 - - - psubb %mm0, %mm2
# CHECK-NEXT: - - - 0.50 0.50 - - 1.00 psubb (%rax), %mm2
# CHECK-NEXT: - - - 0.50 0.50 - - - psubd %mm0, %mm2

View File

@ -595,31 +595,31 @@ xorpd (%rax), %xmm2
# CHECK-NEXT: 1 1 1.00 pshuflw $1, %xmm0, %xmm2
# CHECK-NEXT: 1 4 1.00 * pshuflw $1, (%rax), %xmm2
# CHECK-NEXT: 1 1 1.00 pslld $1, %xmm2
# CHECK-NEXT: 1 1 1.00 pslld %xmm0, %xmm2
# CHECK-NEXT: 1 4 1.00 * pslld (%rax), %xmm2
# CHECK-NEXT: 2 2 2.00 pslld %xmm0, %xmm2
# CHECK-NEXT: 2 5 2.00 * pslld (%rax), %xmm2
# CHECK-NEXT: 1 1 1.00 pslldq $1, %xmm2
# CHECK-NEXT: 1 1 1.00 psllq $1, %xmm2
# CHECK-NEXT: 1 1 1.00 psllq %xmm0, %xmm2
# CHECK-NEXT: 1 4 1.00 * psllq (%rax), %xmm2
# CHECK-NEXT: 2 2 2.00 psllq %xmm0, %xmm2
# CHECK-NEXT: 2 5 2.00 * psllq (%rax), %xmm2
# CHECK-NEXT: 1 1 1.00 psllw $1, %xmm2
# CHECK-NEXT: 1 1 1.00 psllw %xmm0, %xmm2
# CHECK-NEXT: 1 4 1.00 * psllw (%rax), %xmm2
# CHECK-NEXT: 2 2 2.00 psllw %xmm0, %xmm2
# CHECK-NEXT: 2 5 2.00 * psllw (%rax), %xmm2
# CHECK-NEXT: 1 1 1.00 psrad $1, %xmm2
# CHECK-NEXT: 1 1 1.00 psrad %xmm0, %xmm2
# CHECK-NEXT: 1 4 1.00 * psrad (%rax), %xmm2
# CHECK-NEXT: 2 2 2.00 psrad %xmm0, %xmm2
# CHECK-NEXT: 2 5 2.00 * psrad (%rax), %xmm2
# CHECK-NEXT: 1 1 1.00 psraw $1, %xmm2
# CHECK-NEXT: 1 1 1.00 psraw %xmm0, %xmm2
# CHECK-NEXT: 1 4 1.00 * psraw (%rax), %xmm2
# CHECK-NEXT: 2 2 2.00 psraw %xmm0, %xmm2
# CHECK-NEXT: 2 5 2.00 * psraw (%rax), %xmm2
# CHECK-NEXT: 1 1 1.00 psrld $1, %xmm2
# CHECK-NEXT: 1 1 1.00 psrld %xmm0, %xmm2
# CHECK-NEXT: 1 4 1.00 * psrld (%rax), %xmm2
# CHECK-NEXT: 2 2 2.00 psrld %xmm0, %xmm2
# CHECK-NEXT: 2 5 2.00 * psrld (%rax), %xmm2
# CHECK-NEXT: 1 1 1.00 psrldq $1, %xmm2
# CHECK-NEXT: 1 1 1.00 psrlq $1, %xmm2
# CHECK-NEXT: 1 1 1.00 psrlq %xmm0, %xmm2
# CHECK-NEXT: 1 4 1.00 * psrlq (%rax), %xmm2
# CHECK-NEXT: 2 2 2.00 psrlq %xmm0, %xmm2
# CHECK-NEXT: 2 5 2.00 * psrlq (%rax), %xmm2
# CHECK-NEXT: 1 1 1.00 psrlw $1, %xmm2
# CHECK-NEXT: 1 1 1.00 psrlw %xmm0, %xmm2
# CHECK-NEXT: 1 4 1.00 * psrlw (%rax), %xmm2
# CHECK-NEXT: 2 2 2.00 psrlw %xmm0, %xmm2
# CHECK-NEXT: 2 5 2.00 * psrlw (%rax), %xmm2
# CHECK-NEXT: 1 1 0.50 psubb %xmm0, %xmm2
# CHECK-NEXT: 1 4 1.00 * psubb (%rax), %xmm2
# CHECK-NEXT: 1 1 0.50 psubd %xmm0, %xmm2
@ -687,7 +687,7 @@ xorpd (%rax), %xmm2
# CHECK: Resource pressure per iteration:
# CHECK-NEXT: [0] [1] [2] [3] [4] [5] [6] [7]
# CHECK-NEXT: - 412.00 12.00 158.50 96.50 3.00 3.00 134.00
# CHECK-NEXT: - 412.00 12.00 174.50 96.50 3.00 3.00 134.00
# CHECK: Resource pressure by instruction:
# CHECK-NEXT: [0] [1] [2] [3] [4] [5] [6] [7] Instructions:
@ -879,31 +879,31 @@ xorpd (%rax), %xmm2
# CHECK-NEXT: - - - 1.00 - - - - pshuflw $1, %xmm0, %xmm2
# CHECK-NEXT: - - - 1.00 - - - 1.00 pshuflw $1, (%rax), %xmm2
# CHECK-NEXT: - - - 1.00 - - - - pslld $1, %xmm2
# CHECK-NEXT: - - - 1.00 - - - - pslld %xmm0, %xmm2
# CHECK-NEXT: - - - 1.00 - - - 1.00 pslld (%rax), %xmm2
# CHECK-NEXT: - - - 2.00 - - - - pslld %xmm0, %xmm2
# CHECK-NEXT: - - - 2.00 - - - 1.00 pslld (%rax), %xmm2
# CHECK-NEXT: - - - 1.00 - - - - pslldq $1, %xmm2
# CHECK-NEXT: - - - 1.00 - - - - psllq $1, %xmm2
# CHECK-NEXT: - - - 1.00 - - - - psllq %xmm0, %xmm2
# CHECK-NEXT: - - - 1.00 - - - 1.00 psllq (%rax), %xmm2
# CHECK-NEXT: - - - 2.00 - - - - psllq %xmm0, %xmm2
# CHECK-NEXT: - - - 2.00 - - - 1.00 psllq (%rax), %xmm2
# CHECK-NEXT: - - - 1.00 - - - - psllw $1, %xmm2
# CHECK-NEXT: - - - 1.00 - - - - psllw %xmm0, %xmm2
# CHECK-NEXT: - - - 1.00 - - - 1.00 psllw (%rax), %xmm2
# CHECK-NEXT: - - - 2.00 - - - - psllw %xmm0, %xmm2
# CHECK-NEXT: - - - 2.00 - - - 1.00 psllw (%rax), %xmm2
# CHECK-NEXT: - - - 1.00 - - - - psrad $1, %xmm2
# CHECK-NEXT: - - - 1.00 - - - - psrad %xmm0, %xmm2
# CHECK-NEXT: - - - 1.00 - - - 1.00 psrad (%rax), %xmm2
# CHECK-NEXT: - - - 2.00 - - - - psrad %xmm0, %xmm2
# CHECK-NEXT: - - - 2.00 - - - 1.00 psrad (%rax), %xmm2
# CHECK-NEXT: - - - 1.00 - - - - psraw $1, %xmm2
# CHECK-NEXT: - - - 1.00 - - - - psraw %xmm0, %xmm2
# CHECK-NEXT: - - - 1.00 - - - 1.00 psraw (%rax), %xmm2
# CHECK-NEXT: - - - 2.00 - - - - psraw %xmm0, %xmm2
# CHECK-NEXT: - - - 2.00 - - - 1.00 psraw (%rax), %xmm2
# CHECK-NEXT: - - - 1.00 - - - - psrld $1, %xmm2
# CHECK-NEXT: - - - 1.00 - - - - psrld %xmm0, %xmm2
# CHECK-NEXT: - - - 1.00 - - - 1.00 psrld (%rax), %xmm2
# CHECK-NEXT: - - - 2.00 - - - - psrld %xmm0, %xmm2
# CHECK-NEXT: - - - 2.00 - - - 1.00 psrld (%rax), %xmm2
# CHECK-NEXT: - - - 1.00 - - - - psrldq $1, %xmm2
# CHECK-NEXT: - - - 1.00 - - - - psrlq $1, %xmm2
# CHECK-NEXT: - - - 1.00 - - - - psrlq %xmm0, %xmm2
# CHECK-NEXT: - - - 1.00 - - - 1.00 psrlq (%rax), %xmm2
# CHECK-NEXT: - - - 2.00 - - - - psrlq %xmm0, %xmm2
# CHECK-NEXT: - - - 2.00 - - - 1.00 psrlq (%rax), %xmm2
# CHECK-NEXT: - - - 1.00 - - - - psrlw $1, %xmm2
# CHECK-NEXT: - - - 1.00 - - - - psrlw %xmm0, %xmm2
# CHECK-NEXT: - - - 1.00 - - - 1.00 psrlw (%rax), %xmm2
# CHECK-NEXT: - - - 2.00 - - - - psrlw %xmm0, %xmm2
# CHECK-NEXT: - - - 2.00 - - - 1.00 psrlw (%rax), %xmm2
# CHECK-NEXT: - - - 0.50 0.50 - - - psubb %xmm0, %xmm2
# CHECK-NEXT: - - - 0.50 0.50 - - 1.00 psubb (%rax), %xmm2
# CHECK-NEXT: - - - 0.50 0.50 - - - psubd %xmm0, %xmm2

View File

@ -156,8 +156,8 @@ psignw (%rax), %xmm2
# CHECK-NEXT: 1 7 1.00 * pmulhrsw (%rax), %xmm2
# CHECK-NEXT: 1 1 1.00 pshufb %mm0, %mm2
# CHECK-NEXT: 1 4 1.00 * pshufb (%rax), %mm2
# CHECK-NEXT: 1 1 1.00 pshufb %xmm0, %xmm2
# CHECK-NEXT: 1 4 1.00 * pshufb (%rax), %xmm2
# CHECK-NEXT: 4 5 5.00 pshufb %xmm0, %xmm2
# CHECK-NEXT: 4 8 5.00 * pshufb (%rax), %xmm2
# CHECK-NEXT: 1 1 0.50 psignb %mm0, %mm2
# CHECK-NEXT: 1 4 1.00 * psignb (%rax), %mm2
# CHECK-NEXT: 1 1 0.50 psignb %xmm0, %xmm2
@ -183,7 +183,7 @@ psignw (%rax), %xmm2
# CHECK: Resource pressure per iteration:
# CHECK-NEXT: [0] [1] [2] [3] [4] [5] [6] [7]
# CHECK-NEXT: - - - 40.00 24.00 - - 32.00
# CHECK-NEXT: - - - 48.00 24.00 - - 32.00
# CHECK: Resource pressure by instruction:
# CHECK-NEXT: [0] [1] [2] [3] [4] [5] [6] [7] Instructions:
@ -237,8 +237,8 @@ psignw (%rax), %xmm2
# CHECK-NEXT: - - - 1.00 - - - 1.00 pmulhrsw (%rax), %xmm2
# CHECK-NEXT: - - - 1.00 - - - - pshufb %mm0, %mm2
# CHECK-NEXT: - - - 1.00 - - - 1.00 pshufb (%rax), %mm2
# CHECK-NEXT: - - - 1.00 - - - - pshufb %xmm0, %xmm2
# CHECK-NEXT: - - - 1.00 - - - 1.00 pshufb (%rax), %xmm2
# CHECK-NEXT: - - - 5.00 - - - - pshufb %xmm0, %xmm2
# CHECK-NEXT: - - - 5.00 - - - 1.00 pshufb (%rax), %xmm2
# CHECK-NEXT: - - - 0.50 0.50 - - - psignb %mm0, %mm2
# CHECK-NEXT: - - - 0.50 0.50 - - 1.00 psignb (%rax), %mm2
# CHECK-NEXT: - - - 0.50 0.50 - - - psignb %xmm0, %xmm2