aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Target/X86/X86Instr64bit.td
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2010-01-12 04:42:54 +0000
committerDan Gohman <gohman@apple.com>2010-01-12 04:42:54 +0000
commitf1b4d26e674a067b9f5c8622ad79c95d1e094046 (patch)
tree9e5cdb840f6f18c73ab488d004741303da6bf396 /lib/Target/X86/X86Instr64bit.td
parent21c14e3649b3e2a70ac36ebb148f17648f10a2a9 (diff)
downloadexternal_llvm-f1b4d26e674a067b9f5c8622ad79c95d1e094046.zip
external_llvm-f1b4d26e674a067b9f5c8622ad79c95d1e094046.tar.gz
external_llvm-f1b4d26e674a067b9f5c8622ad79c95d1e094046.tar.bz2
Reapply the MOV64r0 patch, with a fix: MOV64r0 clobbers EFLAGS.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93229 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/X86/X86Instr64bit.td')
-rw-r--r--lib/Target/X86/X86Instr64bit.td22
1 files changed, 13 insertions, 9 deletions
diff --git a/lib/Target/X86/X86Instr64bit.td b/lib/Target/X86/X86Instr64bit.td
index 7077cf9..d67a482 100644
--- a/lib/Target/X86/X86Instr64bit.td
+++ b/lib/Target/X86/X86Instr64bit.td
@@ -1598,17 +1598,21 @@ def SLDT64m : RI<0x00, MRM0m, (outs i16mem:$dst), (ins),
// Alias Instructions
//===----------------------------------------------------------------------===//
-// Alias instructions that map movr0 to xor. Use xorl instead of xorq; it's
-// equivalent due to implicit zero-extending, and it sometimes has a smaller
-// encoding.
+// We want to rewrite MOV64r0 in terms of MOV32r0, because it's sometimes a
+// smaller encoding, but doing so at isel time interferes with rematerialization
+// in the current register allocator. For now, this is rewritten when the
+// instruction is lowered to an MCInst.
// FIXME: AddedComplexity gives this a higher priority than MOV64ri32. Remove
// when we have a better way to specify isel priority.
-let AddedComplexity = 1 in
-def : Pat<(i64 0),
- (SUBREG_TO_REG (i64 0), (MOV32r0), x86_subreg_32bit)>;
-
-
-// Materialize i64 constant where top 32-bits are zero.
+let Defs = [EFLAGS],
+ AddedComplexity = 1, isReMaterializable = 1, isAsCheapAsAMove = 1 in
+def MOV64r0 : I<0x31, MRMInitReg, (outs GR64:$dst), (ins),
+ "",
+ [(set GR64:$dst, 0)]>;
+
+// Materialize i64 constant where top 32-bits are zero. This could theoretically
+// use MOV32ri with a SUBREG_TO_REG to represent the zero-extension, however
+// that would make it more difficult to rematerialize.
let AddedComplexity = 1, isReMaterializable = 1, isAsCheapAsAMove = 1 in
def MOV64ri64i32 : Ii32<0xB8, AddRegFrm, (outs GR64:$dst), (ins i64i32imm:$src),
"", [(set GR64:$dst, i64immZExt32:$src)]>;