summaryrefslogtreecommitdiff
path: root/llvm/lib/Target/X86/X86InstrMMX.td
diff options
context:
space:
mode:
authorSimon Pilgrim <llvm-dev@redking.me.uk>2018-01-15 22:32:40 +0000
committerSimon Pilgrim <llvm-dev@redking.me.uk>2018-01-15 22:32:40 +0000
commit3babf659472ae7b68a4ecf8199ac9914b174b027 (patch)
treea44e69ffce80deca1cc3ed8e21f1afc3ca52bbc8 /llvm/lib/Target/X86/X86InstrMMX.td
parent8c744a44e8a02401dd456c00cfb9b5ea9fb3ecfa (diff)
[X86][MMX] Add support for MMX zero vector creation
As mentioned on PR35869, (and came up recently on D41517) we don't create a MMX zero register via the PXOR but instead perform a spill to stack from a XMM zero register. This patch adds support for direct MMX zero vector creation and should make it easier to add better constant vector creation in the future as well. Differential Revision: https://reviews.llvm.org/D41908
Diffstat (limited to 'llvm/lib/Target/X86/X86InstrMMX.td')
-rw-r--r--llvm/lib/Target/X86/X86InstrMMX.td14
1 files changed, 13 insertions, 1 deletions
diff --git a/llvm/lib/Target/X86/X86InstrMMX.td b/llvm/lib/Target/X86/X86InstrMMX.td
index 18be0a54483..1a1f64e3a0b 100644
--- a/llvm/lib/Target/X86/X86InstrMMX.td
+++ b/llvm/lib/Target/X86/X86InstrMMX.td
@@ -90,6 +90,15 @@ def MMX_CVT_PS_ITINS : OpndItins<
>;
}
+// Alias instruction that maps zero vector to pxor mmx.
+// This is expanded by ExpandPostRAPseudos to an pxor.
+// We set canFoldAsLoad because this can be converted to a constant-pool
+// load of an all-zeros value if folding it would be beneficial.
+let isReMaterializable = 1, isAsCheapAsAMove = 1, canFoldAsLoad = 1,
+ isPseudo = 1, SchedRW = [WriteZero] in {
+def MMX_SET0 : I<0, Pseudo, (outs VR64:$dst), (ins), "", []>;
+}
+
let Constraints = "$src1 = $dst" in {
// MMXI_binop_rm_int - Simple MMX binary operator based on intrinsic.
// When this is cleaned up, remove the FIXME from X86RecognizableInstr.cpp.
@@ -235,9 +244,12 @@ let Predicates = [HasMMX] in {
let AddedComplexity = 15 in
def : Pat<(x86mmx (MMX_X86movw2d GR32:$src)),
(MMX_MOVD64rr GR32:$src)>;
- let AddedComplexity = 20 in
+ let AddedComplexity = 20 in {
+ def : Pat<(x86mmx (MMX_X86movw2d (i32 0))),
+ (MMX_SET0)>;
def : Pat<(x86mmx (MMX_X86movw2d (loadi32 addr:$src))),
(MMX_MOVD64rm addr:$src)>;
+ }
}
let mayStore = 1 in