1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-25 20:23:11 +01:00

[X86] AMD Zen 3: _REV variants of zero-cycles moves are also zero-cycles (PR50261)

Sometimes disassembler picks _REV variants of instructions
over the plain ones, which in this case exposed an issue
that the _REV variants aren't being modelled as optimizable moves.
This commit is contained in:
Roman Lebedev 2021-05-07 18:22:01 +03:00
parent 2eec1309e5
commit 37c9dcd0cf
3 changed files with 92 additions and 82 deletions

View File

@ -1464,7 +1464,8 @@ defm : Zn3WriteResYMM<WriteVecMoveY, [], 0, [], 1>;
def : IsOptimizableRegisterMove<[
InstructionEquivalenceClass<[
// GPR variants.
MOV32rr, MOV64rr,
MOV32rr, MOV32rr_REV,
MOV64rr, MOV64rr_REV,
// FIXME: MOVSXD32rr, but it is only supported in disassembler.
// FIXME: XCHG32rr/XCHG64rr after MCA is fixed
@ -1472,19 +1473,28 @@ def : IsOptimizableRegisterMove<[
// MMX moves are *NOT* eliminated.
// SSE variants.
MOVAPSrr, MOVUPSrr,
MOVAPDrr, MOVUPDrr,
MOVDQArr, MOVDQUrr,
MOVAPSrr, MOVAPSrr_REV,
MOVUPSrr, MOVUPSrr_REV,
MOVAPDrr, MOVAPDrr_REV,
MOVUPDrr, MOVUPDrr_REV,
MOVDQArr, MOVDQArr_REV,
MOVDQUrr, MOVDQUrr_REV,
// AVX variants.
VMOVAPSrr, VMOVUPSrr,
VMOVAPDrr, VMOVUPDrr,
VMOVDQArr, VMOVDQUrr,
VMOVAPSrr, VMOVAPSrr_REV,
VMOVUPSrr, VMOVUPSrr_REV,
VMOVAPDrr, VMOVAPDrr_REV,
VMOVUPDrr, VMOVUPDrr_REV,
VMOVDQArr, VMOVDQArr_REV,
VMOVDQUrr, VMOVDQUrr_REV,
// AVX YMM variants.
VMOVAPSYrr, VMOVUPSYrr,
VMOVAPDYrr, VMOVUPDYrr,
VMOVDQAYrr, VMOVDQUYrr
VMOVAPSYrr, VMOVAPSYrr_REV,
VMOVUPSYrr, VMOVUPSYrr_REV,
VMOVAPDYrr, VMOVAPDYrr_REV,
VMOVUPDYrr, VMOVUPDYrr_REV,
VMOVDQAYrr, VMOVDQAYrr_REV,
VMOVDQUYrr, VMOVDQUYrr_REV,
], TruePred >
]>;

View File

@ -154,15 +154,15 @@ vmovdqu %xmm15, %xmm0
# CHECK-NEXT: 1 0 0.17 vmovaps %xmm15, %xmm0
# CHECK: Register File statistics:
# CHECK-NEXT: Total number of mappings created: 1000
# CHECK-NEXT: Max number of mappings used: 1
# CHECK-NEXT: Total number of mappings created: 0
# CHECK-NEXT: Max number of mappings used: 0
# CHECK: * Register File #1 -- Zn3FpPRF:
# CHECK-NEXT: Number of physical registers: 160
# CHECK-NEXT: Total number of mappings created: 1000
# CHECK-NEXT: Max number of mappings used: 1
# CHECK-NEXT: Number of optimizable moves: 15000
# CHECK-NEXT: Number of moves eliminated: 15000 (100.0%)
# CHECK-NEXT: Total number of mappings created: 0
# CHECK-NEXT: Max number of mappings used: 0
# CHECK-NEXT: Number of optimizable moves: 16000
# CHECK-NEXT: Number of moves eliminated: 16000 (100.0%)
# CHECK-NEXT: Number of zero moves: 0 (0.0%)
# CHECK-NEXT: Max moves eliminated per cycle: 6
@ -448,15 +448,15 @@ vmovdqu %xmm15, %xmm0
# CHECK-NEXT: 1 0 0.17 vmovups %xmm15, %xmm0
# CHECK: Register File statistics:
# CHECK-NEXT: Total number of mappings created: 1000
# CHECK-NEXT: Max number of mappings used: 1
# CHECK-NEXT: Total number of mappings created: 0
# CHECK-NEXT: Max number of mappings used: 0
# CHECK: * Register File #1 -- Zn3FpPRF:
# CHECK-NEXT: Number of physical registers: 160
# CHECK-NEXT: Total number of mappings created: 1000
# CHECK-NEXT: Max number of mappings used: 1
# CHECK-NEXT: Number of optimizable moves: 15000
# CHECK-NEXT: Number of moves eliminated: 15000 (100.0%)
# CHECK-NEXT: Total number of mappings created: 0
# CHECK-NEXT: Max number of mappings used: 0
# CHECK-NEXT: Number of optimizable moves: 16000
# CHECK-NEXT: Number of moves eliminated: 16000 (100.0%)
# CHECK-NEXT: Number of zero moves: 0 (0.0%)
# CHECK-NEXT: Max moves eliminated per cycle: 6
@ -742,15 +742,15 @@ vmovdqu %xmm15, %xmm0
# CHECK-NEXT: 1 0 0.17 vmovapd %xmm15, %xmm0
# CHECK: Register File statistics:
# CHECK-NEXT: Total number of mappings created: 1000
# CHECK-NEXT: Max number of mappings used: 1
# CHECK-NEXT: Total number of mappings created: 0
# CHECK-NEXT: Max number of mappings used: 0
# CHECK: * Register File #1 -- Zn3FpPRF:
# CHECK-NEXT: Number of physical registers: 160
# CHECK-NEXT: Total number of mappings created: 1000
# CHECK-NEXT: Max number of mappings used: 1
# CHECK-NEXT: Number of optimizable moves: 15000
# CHECK-NEXT: Number of moves eliminated: 15000 (100.0%)
# CHECK-NEXT: Total number of mappings created: 0
# CHECK-NEXT: Max number of mappings used: 0
# CHECK-NEXT: Number of optimizable moves: 16000
# CHECK-NEXT: Number of moves eliminated: 16000 (100.0%)
# CHECK-NEXT: Number of zero moves: 0 (0.0%)
# CHECK-NEXT: Max moves eliminated per cycle: 6
@ -1036,15 +1036,15 @@ vmovdqu %xmm15, %xmm0
# CHECK-NEXT: 1 0 0.17 vmovupd %xmm15, %xmm0
# CHECK: Register File statistics:
# CHECK-NEXT: Total number of mappings created: 1000
# CHECK-NEXT: Max number of mappings used: 1
# CHECK-NEXT: Total number of mappings created: 0
# CHECK-NEXT: Max number of mappings used: 0
# CHECK: * Register File #1 -- Zn3FpPRF:
# CHECK-NEXT: Number of physical registers: 160
# CHECK-NEXT: Total number of mappings created: 1000
# CHECK-NEXT: Max number of mappings used: 1
# CHECK-NEXT: Number of optimizable moves: 15000
# CHECK-NEXT: Number of moves eliminated: 15000 (100.0%)
# CHECK-NEXT: Total number of mappings created: 0
# CHECK-NEXT: Max number of mappings used: 0
# CHECK-NEXT: Number of optimizable moves: 16000
# CHECK-NEXT: Number of moves eliminated: 16000 (100.0%)
# CHECK-NEXT: Number of zero moves: 0 (0.0%)
# CHECK-NEXT: Max moves eliminated per cycle: 6
@ -1330,15 +1330,15 @@ vmovdqu %xmm15, %xmm0
# CHECK-NEXT: 1 0 0.17 vmovdqa %xmm15, %xmm0
# CHECK: Register File statistics:
# CHECK-NEXT: Total number of mappings created: 1000
# CHECK-NEXT: Max number of mappings used: 1
# CHECK-NEXT: Total number of mappings created: 0
# CHECK-NEXT: Max number of mappings used: 0
# CHECK: * Register File #1 -- Zn3FpPRF:
# CHECK-NEXT: Number of physical registers: 160
# CHECK-NEXT: Total number of mappings created: 1000
# CHECK-NEXT: Max number of mappings used: 1
# CHECK-NEXT: Number of optimizable moves: 15000
# CHECK-NEXT: Number of moves eliminated: 15000 (100.0%)
# CHECK-NEXT: Total number of mappings created: 0
# CHECK-NEXT: Max number of mappings used: 0
# CHECK-NEXT: Number of optimizable moves: 16000
# CHECK-NEXT: Number of moves eliminated: 16000 (100.0%)
# CHECK-NEXT: Number of zero moves: 0 (0.0%)
# CHECK-NEXT: Max moves eliminated per cycle: 6
@ -1624,15 +1624,15 @@ vmovdqu %xmm15, %xmm0
# CHECK-NEXT: 1 0 0.17 vmovdqu %xmm15, %xmm0
# CHECK: Register File statistics:
# CHECK-NEXT: Total number of mappings created: 1000
# CHECK-NEXT: Max number of mappings used: 1
# CHECK-NEXT: Total number of mappings created: 0
# CHECK-NEXT: Max number of mappings used: 0
# CHECK: * Register File #1 -- Zn3FpPRF:
# CHECK-NEXT: Number of physical registers: 160
# CHECK-NEXT: Total number of mappings created: 1000
# CHECK-NEXT: Max number of mappings used: 1
# CHECK-NEXT: Number of optimizable moves: 15000
# CHECK-NEXT: Number of moves eliminated: 15000 (100.0%)
# CHECK-NEXT: Total number of mappings created: 0
# CHECK-NEXT: Max number of mappings used: 0
# CHECK-NEXT: Number of optimizable moves: 16000
# CHECK-NEXT: Number of moves eliminated: 16000 (100.0%)
# CHECK-NEXT: Number of zero moves: 0 (0.0%)
# CHECK-NEXT: Max moves eliminated per cycle: 6

View File

@ -154,15 +154,15 @@ vmovdqu %ymm15, %ymm0
# CHECK-NEXT: 1 0 0.17 vmovaps %ymm15, %ymm0
# CHECK: Register File statistics:
# CHECK-NEXT: Total number of mappings created: 1000
# CHECK-NEXT: Max number of mappings used: 1
# CHECK-NEXT: Total number of mappings created: 0
# CHECK-NEXT: Max number of mappings used: 0
# CHECK: * Register File #1 -- Zn3FpPRF:
# CHECK-NEXT: Number of physical registers: 160
# CHECK-NEXT: Total number of mappings created: 1000
# CHECK-NEXT: Max number of mappings used: 1
# CHECK-NEXT: Number of optimizable moves: 15000
# CHECK-NEXT: Number of moves eliminated: 15000 (100.0%)
# CHECK-NEXT: Total number of mappings created: 0
# CHECK-NEXT: Max number of mappings used: 0
# CHECK-NEXT: Number of optimizable moves: 16000
# CHECK-NEXT: Number of moves eliminated: 16000 (100.0%)
# CHECK-NEXT: Number of zero moves: 0 (0.0%)
# CHECK-NEXT: Max moves eliminated per cycle: 6
@ -448,15 +448,15 @@ vmovdqu %ymm15, %ymm0
# CHECK-NEXT: 1 0 0.17 vmovups %ymm15, %ymm0
# CHECK: Register File statistics:
# CHECK-NEXT: Total number of mappings created: 1000
# CHECK-NEXT: Max number of mappings used: 1
# CHECK-NEXT: Total number of mappings created: 0
# CHECK-NEXT: Max number of mappings used: 0
# CHECK: * Register File #1 -- Zn3FpPRF:
# CHECK-NEXT: Number of physical registers: 160
# CHECK-NEXT: Total number of mappings created: 1000
# CHECK-NEXT: Max number of mappings used: 1
# CHECK-NEXT: Number of optimizable moves: 15000
# CHECK-NEXT: Number of moves eliminated: 15000 (100.0%)
# CHECK-NEXT: Total number of mappings created: 0
# CHECK-NEXT: Max number of mappings used: 0
# CHECK-NEXT: Number of optimizable moves: 16000
# CHECK-NEXT: Number of moves eliminated: 16000 (100.0%)
# CHECK-NEXT: Number of zero moves: 0 (0.0%)
# CHECK-NEXT: Max moves eliminated per cycle: 6
@ -742,15 +742,15 @@ vmovdqu %ymm15, %ymm0
# CHECK-NEXT: 1 0 0.17 vmovapd %ymm15, %ymm0
# CHECK: Register File statistics:
# CHECK-NEXT: Total number of mappings created: 1000
# CHECK-NEXT: Max number of mappings used: 1
# CHECK-NEXT: Total number of mappings created: 0
# CHECK-NEXT: Max number of mappings used: 0
# CHECK: * Register File #1 -- Zn3FpPRF:
# CHECK-NEXT: Number of physical registers: 160
# CHECK-NEXT: Total number of mappings created: 1000
# CHECK-NEXT: Max number of mappings used: 1
# CHECK-NEXT: Number of optimizable moves: 15000
# CHECK-NEXT: Number of moves eliminated: 15000 (100.0%)
# CHECK-NEXT: Total number of mappings created: 0
# CHECK-NEXT: Max number of mappings used: 0
# CHECK-NEXT: Number of optimizable moves: 16000
# CHECK-NEXT: Number of moves eliminated: 16000 (100.0%)
# CHECK-NEXT: Number of zero moves: 0 (0.0%)
# CHECK-NEXT: Max moves eliminated per cycle: 6
@ -1036,15 +1036,15 @@ vmovdqu %ymm15, %ymm0
# CHECK-NEXT: 1 0 0.17 vmovupd %ymm15, %ymm0
# CHECK: Register File statistics:
# CHECK-NEXT: Total number of mappings created: 1000
# CHECK-NEXT: Max number of mappings used: 1
# CHECK-NEXT: Total number of mappings created: 0
# CHECK-NEXT: Max number of mappings used: 0
# CHECK: * Register File #1 -- Zn3FpPRF:
# CHECK-NEXT: Number of physical registers: 160
# CHECK-NEXT: Total number of mappings created: 1000
# CHECK-NEXT: Max number of mappings used: 1
# CHECK-NEXT: Number of optimizable moves: 15000
# CHECK-NEXT: Number of moves eliminated: 15000 (100.0%)
# CHECK-NEXT: Total number of mappings created: 0
# CHECK-NEXT: Max number of mappings used: 0
# CHECK-NEXT: Number of optimizable moves: 16000
# CHECK-NEXT: Number of moves eliminated: 16000 (100.0%)
# CHECK-NEXT: Number of zero moves: 0 (0.0%)
# CHECK-NEXT: Max moves eliminated per cycle: 6
@ -1330,15 +1330,15 @@ vmovdqu %ymm15, %ymm0
# CHECK-NEXT: 1 0 0.17 vmovdqa %ymm15, %ymm0
# CHECK: Register File statistics:
# CHECK-NEXT: Total number of mappings created: 1000
# CHECK-NEXT: Max number of mappings used: 1
# CHECK-NEXT: Total number of mappings created: 0
# CHECK-NEXT: Max number of mappings used: 0
# CHECK: * Register File #1 -- Zn3FpPRF:
# CHECK-NEXT: Number of physical registers: 160
# CHECK-NEXT: Total number of mappings created: 1000
# CHECK-NEXT: Max number of mappings used: 1
# CHECK-NEXT: Number of optimizable moves: 15000
# CHECK-NEXT: Number of moves eliminated: 15000 (100.0%)
# CHECK-NEXT: Total number of mappings created: 0
# CHECK-NEXT: Max number of mappings used: 0
# CHECK-NEXT: Number of optimizable moves: 16000
# CHECK-NEXT: Number of moves eliminated: 16000 (100.0%)
# CHECK-NEXT: Number of zero moves: 0 (0.0%)
# CHECK-NEXT: Max moves eliminated per cycle: 6
@ -1624,15 +1624,15 @@ vmovdqu %ymm15, %ymm0
# CHECK-NEXT: 1 0 0.17 vmovdqu %ymm15, %ymm0
# CHECK: Register File statistics:
# CHECK-NEXT: Total number of mappings created: 1000
# CHECK-NEXT: Max number of mappings used: 1
# CHECK-NEXT: Total number of mappings created: 0
# CHECK-NEXT: Max number of mappings used: 0
# CHECK: * Register File #1 -- Zn3FpPRF:
# CHECK-NEXT: Number of physical registers: 160
# CHECK-NEXT: Total number of mappings created: 1000
# CHECK-NEXT: Max number of mappings used: 1
# CHECK-NEXT: Number of optimizable moves: 15000
# CHECK-NEXT: Number of moves eliminated: 15000 (100.0%)
# CHECK-NEXT: Total number of mappings created: 0
# CHECK-NEXT: Max number of mappings used: 0
# CHECK-NEXT: Number of optimizable moves: 16000
# CHECK-NEXT: Number of moves eliminated: 16000 (100.0%)
# CHECK-NEXT: Number of zero moves: 0 (0.0%)
# CHECK-NEXT: Max moves eliminated per cycle: 6