Skip to content

Commit

Permalink
[X86] Fix PSHUFB port usage on Skylake/Icelake
Browse files Browse the repository at this point in the history
MMX PSHUFB has an additional Port0 dependency (as do most MMX instructions) - confirmed with uops.info
  • Loading branch information
RKSimon committed Nov 20, 2024
1 parent af0e0de commit d0522f4
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion llvm/lib/Target/X86/X86SchedIceLake.td
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ defm : ICXWriteResPair<WriteShuffle, [ICXPort5], 1, [1], 1, 5>; // Vector shuf
defm : ICXWriteResPair<WriteShuffleX, [ICXPort15], 1, [1], 1, 6>;
defm : ICXWriteResPair<WriteShuffleY, [ICXPort15], 1, [1], 1, 7>;
defm : ICXWriteResPair<WriteShuffleZ, [ICXPort5], 1, [1], 1, 7>;
defm : ICXWriteResPair<WriteVarShuffle, [ICXPort5], 1, [1], 1, 5>; // Vector variable shuffles.
defm : ICXWriteResPair<WriteVarShuffle, [ICXPort0,ICXPort5], 1, [1,1], 2, 5>; // Vector variable shuffles.
defm : ICXWriteResPair<WriteVarShuffleX, [ICXPort15], 1, [1], 1, 6>;
defm : ICXWriteResPair<WriteVarShuffleY, [ICXPort15], 1, [1], 1, 7>;
defm : ICXWriteResPair<WriteVarShuffleZ, [ICXPort5], 1, [1], 1, 7>;
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/Target/X86/X86SchedSkylakeClient.td
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ defm : SKLWriteResPair<WriteShuffle, [SKLPort5], 1, [1], 1, 5>; // Vector shuff
defm : SKLWriteResPair<WriteShuffleX, [SKLPort5], 1, [1], 1, 6>;
defm : SKLWriteResPair<WriteShuffleY, [SKLPort5], 1, [1], 1, 7>;
defm : X86WriteResPairUnsupported<WriteShuffleZ>;
defm : SKLWriteResPair<WriteVarShuffle, [SKLPort5], 1, [1], 1, 5>; // Vector shuffles.
defm : SKLWriteResPair<WriteVarShuffle, [SKLPort0,SKLPort5], 1, [1,1], 2, 5>; // Vector shuffles.
defm : SKLWriteResPair<WriteVarShuffleX, [SKLPort5], 1, [1], 1, 6>;
defm : SKLWriteResPair<WriteVarShuffleY, [SKLPort5], 1, [1], 1, 7>;
defm : X86WriteResPairUnsupported<WriteVarShuffleZ>;
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/Target/X86/X86SchedSkylakeServer.td
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ defm : SKXWriteResPair<WriteShuffle, [SKXPort5], 1, [1], 1, 5>; // Vector shuff
defm : SKXWriteResPair<WriteShuffleX, [SKXPort5], 1, [1], 1, 6>;
defm : SKXWriteResPair<WriteShuffleY, [SKXPort5], 1, [1], 1, 7>;
defm : SKXWriteResPair<WriteShuffleZ, [SKXPort5], 1, [1], 1, 7>;
defm : SKXWriteResPair<WriteVarShuffle, [SKXPort5], 1, [1], 1, 5>; // Vector variable shuffles.
defm : SKXWriteResPair<WriteVarShuffle, [SKXPort0,SKXPort5], 1, [1,1], 2, 5>; // Vector variable shuffles.
defm : SKXWriteResPair<WriteVarShuffleX, [SKXPort5], 1, [1], 1, 6>;
defm : SKXWriteResPair<WriteVarShuffleY, [SKXPort5], 1, [1], 1, 7>;
defm : SKXWriteResPair<WriteVarShuffleZ, [SKXPort5], 1, [1], 1, 7>;
Expand Down
10 changes: 5 additions & 5 deletions llvm/test/tools/llvm-mca/X86/IceLakeServer/resources-ssse3.s
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,8 @@ psignw (%rax), %xmm2
# CHECK-NEXT: 2 10 1.00 * pmulhrsw (%rax), %mm2
# CHECK-NEXT: 1 5 0.50 pmulhrsw %xmm0, %xmm2
# CHECK-NEXT: 2 11 0.50 * pmulhrsw (%rax), %xmm2
# CHECK-NEXT: 1 1 1.00 pshufb %mm0, %mm2
# CHECK-NEXT: 2 6 1.00 * pshufb (%rax), %mm2
# CHECK-NEXT: 2 1 1.00 pshufb %mm0, %mm2
# CHECK-NEXT: 3 6 1.00 * pshufb (%rax), %mm2
# CHECK-NEXT: 1 1 0.50 pshufb %xmm0, %xmm2
# CHECK-NEXT: 2 7 0.50 * pshufb (%rax), %xmm2
# CHECK-NEXT: 1 1 0.50 psignb %mm0, %mm2
Expand Down Expand Up @@ -187,7 +187,7 @@ psignw (%rax), %xmm2

# CHECK: Resource pressure per iteration:
# CHECK-NEXT: [0] [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11]
# CHECK-NEXT: - - 30.67 25.67 16.00 16.00 - 55.67 - - - -
# CHECK-NEXT: - - 32.67 25.67 16.00 16.00 - 55.67 - - - -

# CHECK: Resource pressure by instruction:
# CHECK-NEXT: [0] [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] Instructions:
Expand Down Expand Up @@ -239,8 +239,8 @@ psignw (%rax), %xmm2
# CHECK-NEXT: - - 1.00 - 0.50 0.50 - - - - - - pmulhrsw (%rax), %mm2
# CHECK-NEXT: - - 0.50 0.50 - - - - - - - - pmulhrsw %xmm0, %xmm2
# CHECK-NEXT: - - 0.50 0.50 0.50 0.50 - - - - - - pmulhrsw (%rax), %xmm2
# CHECK-NEXT: - - - - - - - 1.00 - - - - pshufb %mm0, %mm2
# CHECK-NEXT: - - - - 0.50 0.50 - 1.00 - - - - pshufb (%rax), %mm2
# CHECK-NEXT: - - 1.00 - - - - 1.00 - - - - pshufb %mm0, %mm2
# CHECK-NEXT: - - 1.00 - 0.50 0.50 - 1.00 - - - - pshufb (%rax), %mm2
# CHECK-NEXT: - - - 0.50 - - - 0.50 - - - - pshufb %xmm0, %xmm2
# CHECK-NEXT: - - - 0.50 0.50 0.50 - 0.50 - - - - pshufb (%rax), %xmm2
# CHECK-NEXT: - - 0.50 - - - - 0.50 - - - - psignb %mm0, %mm2
Expand Down
10 changes: 5 additions & 5 deletions llvm/test/tools/llvm-mca/X86/SkylakeClient/resources-ssse3.s
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,8 @@ psignw (%rax), %xmm2
# CHECK-NEXT: 2 10 1.00 * pmulhrsw (%rax), %mm2
# CHECK-NEXT: 1 5 0.50 pmulhrsw %xmm0, %xmm2
# CHECK-NEXT: 2 11 0.50 * pmulhrsw (%rax), %xmm2
# CHECK-NEXT: 1 1 1.00 pshufb %mm0, %mm2
# CHECK-NEXT: 2 6 1.00 * pshufb (%rax), %mm2
# CHECK-NEXT: 2 1 1.00 pshufb %mm0, %mm2
# CHECK-NEXT: 3 6 1.00 * pshufb (%rax), %mm2
# CHECK-NEXT: 1 1 1.00 pshufb %xmm0, %xmm2
# CHECK-NEXT: 2 7 1.00 * pshufb (%rax), %xmm2
# CHECK-NEXT: 1 1 0.50 psignb %mm0, %mm2
Expand Down Expand Up @@ -185,7 +185,7 @@ psignw (%rax), %xmm2

# CHECK: Resource pressure per iteration:
# CHECK-NEXT: [0] [1] [2] [3] [4] [5] [6] [7] [8] [9]
# CHECK-NEXT: - - 30.67 12.67 16.00 16.00 - 68.67 - -
# CHECK-NEXT: - - 32.67 12.67 16.00 16.00 - 68.67 - -

# CHECK: Resource pressure by instruction:
# CHECK-NEXT: [0] [1] [2] [3] [4] [5] [6] [7] [8] [9] Instructions:
Expand Down Expand Up @@ -237,8 +237,8 @@ psignw (%rax), %xmm2
# CHECK-NEXT: - - 1.00 - 0.50 0.50 - - - - pmulhrsw (%rax), %mm2
# CHECK-NEXT: - - 0.50 0.50 - - - - - - pmulhrsw %xmm0, %xmm2
# CHECK-NEXT: - - 0.50 0.50 0.50 0.50 - - - - pmulhrsw (%rax), %xmm2
# CHECK-NEXT: - - - - - - - 1.00 - - pshufb %mm0, %mm2
# CHECK-NEXT: - - - - 0.50 0.50 - 1.00 - - pshufb (%rax), %mm2
# CHECK-NEXT: - - 1.00 - - - - 1.00 - - pshufb %mm0, %mm2
# CHECK-NEXT: - - 1.00 - 0.50 0.50 - 1.00 - - pshufb (%rax), %mm2
# CHECK-NEXT: - - - - - - - 1.00 - - pshufb %xmm0, %xmm2
# CHECK-NEXT: - - - - 0.50 0.50 - 1.00 - - pshufb (%rax), %xmm2
# CHECK-NEXT: - - 0.50 - - - - 0.50 - - psignb %mm0, %mm2
Expand Down
10 changes: 5 additions & 5 deletions llvm/test/tools/llvm-mca/X86/SkylakeServer/resources-ssse3.s
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,8 @@ psignw (%rax), %xmm2
# CHECK-NEXT: 2 10 1.00 * pmulhrsw (%rax), %mm2
# CHECK-NEXT: 1 5 0.50 pmulhrsw %xmm0, %xmm2
# CHECK-NEXT: 2 11 0.50 * pmulhrsw (%rax), %xmm2
# CHECK-NEXT: 1 1 1.00 pshufb %mm0, %mm2
# CHECK-NEXT: 2 6 1.00 * pshufb (%rax), %mm2
# CHECK-NEXT: 2 1 1.00 pshufb %mm0, %mm2
# CHECK-NEXT: 3 6 1.00 * pshufb (%rax), %mm2
# CHECK-NEXT: 1 1 1.00 pshufb %xmm0, %xmm2
# CHECK-NEXT: 2 7 1.00 * pshufb (%rax), %xmm2
# CHECK-NEXT: 1 1 0.50 psignb %mm0, %mm2
Expand Down Expand Up @@ -185,7 +185,7 @@ psignw (%rax), %xmm2

# CHECK: Resource pressure per iteration:
# CHECK-NEXT: [0] [1] [2] [3] [4] [5] [6] [7] [8] [9]
# CHECK-NEXT: - - 30.67 12.67 16.00 16.00 - 68.67 - -
# CHECK-NEXT: - - 32.67 12.67 16.00 16.00 - 68.67 - -

# CHECK: Resource pressure by instruction:
# CHECK-NEXT: [0] [1] [2] [3] [4] [5] [6] [7] [8] [9] Instructions:
Expand Down Expand Up @@ -237,8 +237,8 @@ psignw (%rax), %xmm2
# CHECK-NEXT: - - 1.00 - 0.50 0.50 - - - - pmulhrsw (%rax), %mm2
# CHECK-NEXT: - - 0.50 0.50 - - - - - - pmulhrsw %xmm0, %xmm2
# CHECK-NEXT: - - 0.50 0.50 0.50 0.50 - - - - pmulhrsw (%rax), %xmm2
# CHECK-NEXT: - - - - - - - 1.00 - - pshufb %mm0, %mm2
# CHECK-NEXT: - - - - 0.50 0.50 - 1.00 - - pshufb (%rax), %mm2
# CHECK-NEXT: - - 1.00 - - - - 1.00 - - pshufb %mm0, %mm2
# CHECK-NEXT: - - 1.00 - 0.50 0.50 - 1.00 - - pshufb (%rax), %mm2
# CHECK-NEXT: - - - - - - - 1.00 - - pshufb %xmm0, %xmm2
# CHECK-NEXT: - - - - 0.50 0.50 - 1.00 - - pshufb (%rax), %xmm2
# CHECK-NEXT: - - 0.50 - - - - 0.50 - - psignb %mm0, %mm2
Expand Down

0 comments on commit d0522f4

Please sign in to comment.