[PATCH] D122241: [X86] Fold MMX_MOVD64from64rr + store to MMX_MOVQ64mr instead of MMX_MOVD64from64mr.
Craig Topper via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 22 10:46:49 PDT 2022
craig.topper created this revision.
craig.topper added reviewers: skan, pengfei, RKSimon.
Herald added subscribers: StephenFan, hiraditya.
Herald added a project: All.
craig.topper requested review of this revision.
Herald added a project: LLVM.
MMX_MOVD64from64rr moves an MMX register to a 64-bit GPR.
MMX_MOVD64from64mr is the memory version of moving a MMX register to a
64-bit GPR. It requires the REX.W bit to be set. There are no isel
patterns that use this instruction.
MMX_MOVQ64mr is the MMX register store instruction. It doesn't
require a REX.W prefix. This makes it one byte shorter to encode
than MMX_MOVD64from64mr in many cases.
Both store instructions output the same mnemonic string. The assembler
would choose MMX_MOVQ64mr if it was to parse the output. Which is
another reason using it is the correct thing to do.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D122241
Files:
llvm/lib/Target/X86/X86InstrFoldTables.cpp
llvm/test/CodeGen/X86/stack-folding-mmx.ll
Index: llvm/test/CodeGen/X86/stack-folding-mmx.ll
===================================================================
--- llvm/test/CodeGen/X86/stack-folding-mmx.ll
+++ llvm/test/CodeGen/X86/stack-folding-mmx.ll
@@ -140,7 +140,7 @@
; CHECK-NEXT: pushq %r12
; CHECK-NEXT: pushq %rbx
; CHECK-NEXT: paddb %mm0, %mm0
-; CHECK-NEXT: movq %mm0, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Folded Spill
+; CHECK-NEXT: movq %mm0, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
; CHECK-NEXT: #APP
; CHECK-NEXT: nop
; CHECK-NEXT: #NO_APP
Index: llvm/lib/Target/X86/X86InstrFoldTables.cpp
===================================================================
--- llvm/lib/Target/X86/X86InstrFoldTables.cpp
+++ llvm/lib/Target/X86/X86InstrFoldTables.cpp
@@ -292,7 +292,7 @@
{ X86::JMP32r_NT, X86::JMP32m_NT, TB_FOLDED_LOAD },
{ X86::JMP64r, X86::JMP64m, TB_FOLDED_LOAD },
{ X86::JMP64r_NT, X86::JMP64m_NT, TB_FOLDED_LOAD },
- { X86::MMX_MOVD64from64rr, X86::MMX_MOVD64from64mr, TB_FOLDED_STORE | TB_NO_REVERSE },
+ { X86::MMX_MOVD64from64rr, X86::MMX_MOVQ64mr, TB_FOLDED_STORE | TB_NO_REVERSE },
{ X86::MMX_MOVD64grr, X86::MMX_MOVD64mr, TB_FOLDED_STORE | TB_NO_REVERSE },
{ X86::MOV16ri, X86::MOV16mi, TB_FOLDED_STORE },
{ X86::MOV16rr, X86::MOV16mr, TB_FOLDED_STORE },
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D122241.417337.patch
Type: text/x-patch
Size: 1426 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220322/475dc846/attachment.bin>
More information about the llvm-commits
mailing list