[llvm] 2819009 - [X86] AMD Zen 3: _REV variants of zero-cycles moves are also zero-cycles (PR50261)
Roman Lebedev via llvm-commits
llvm-commits at lists.llvm.org
Fri May 7 08:29:25 PDT 2021
Author: Roman Lebedev
Date: 2021-05-07T18:27:40+03:00
New Revision: 2819009b5aa9725aebba63e8722e31943a7fb36f
URL: https://github.com/llvm/llvm-project/commit/2819009b5aa9725aebba63e8722e31943a7fb36f
DIFF: https://github.com/llvm/llvm-project/commit/2819009b5aa9725aebba63e8722e31943a7fb36f.diff
LOG: [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.
Added:
Modified:
llvm/lib/Target/X86/X86ScheduleZnver3.td
llvm/test/tools/llvm-mca/X86/Znver3/reg-move-elimination-avx-xmm.s
llvm/test/tools/llvm-mca/X86/Znver3/reg-move-elimination-avx-ymm.s
Removed:
################################################################################
diff --git a/llvm/lib/Target/X86/X86ScheduleZnver3.td b/llvm/lib/Target/X86/X86ScheduleZnver3.td
index 2c7e16c05c11..e0ee4dadcb60 100644
--- a/llvm/lib/Target/X86/X86ScheduleZnver3.td
+++ b/llvm/lib/Target/X86/X86ScheduleZnver3.td
@@ -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 >
]>;
diff --git a/llvm/test/tools/llvm-mca/X86/Znver3/reg-move-elimination-avx-xmm.s b/llvm/test/tools/llvm-mca/X86/Znver3/reg-move-elimination-avx-xmm.s
index 0d85f84e6f4f..7afa80cb0c9a 100644
--- a/llvm/test/tools/llvm-mca/X86/Znver3/reg-move-elimination-avx-xmm.s
+++ b/llvm/test/tools/llvm-mca/X86/Znver3/reg-move-elimination-avx-xmm.s
@@ -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
diff --git a/llvm/test/tools/llvm-mca/X86/Znver3/reg-move-elimination-avx-ymm.s b/llvm/test/tools/llvm-mca/X86/Znver3/reg-move-elimination-avx-ymm.s
index 48994191e7fd..8b81d55ca5db 100644
--- a/llvm/test/tools/llvm-mca/X86/Znver3/reg-move-elimination-avx-ymm.s
+++ b/llvm/test/tools/llvm-mca/X86/Znver3/reg-move-elimination-avx-ymm.s
@@ -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
More information about the llvm-commits
mailing list