summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-02-23 06:09:57 +0000
committerChris Lattner <sabre@nondot.org>2010-02-23 06:09:57 +0000
commitbe5ad7dce2e20275a1c4f2d7240d1bf495b9f418 (patch)
treed63ba01f8299af17f025e96f14d8f77bdae28448 /lib
parent53d09bd0099e2ac400ad5ddcb928ad0d524fbe5c (diff)
downloadllvm-be5ad7dce2e20275a1c4f2d7240d1bf495b9f418.tar.gz
llvm-be5ad7dce2e20275a1c4f2d7240d1bf495b9f418.tar.bz2
llvm-be5ad7dce2e20275a1c4f2d7240d1bf495b9f418.tar.xz
fix a type mismatch in this pattern, where we were using an i64 imm in a
place where an i32 imm was required, the old isel just got lucky. This fixes CodeGen/X86/x86-64-and-mask.ll git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96894 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Target/X86/X86Instr64bit.td8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/Target/X86/X86Instr64bit.td b/lib/Target/X86/X86Instr64bit.td
index 4ea3739629..ebaff10fb0 100644
--- a/lib/Target/X86/X86Instr64bit.td
+++ b/lib/Target/X86/X86Instr64bit.td
@@ -65,12 +65,18 @@ def i64immSExt8 : PatLeaf<(i64 imm), [{
return (int64_t)N->getZExtValue() == (int8_t)N->getZExtValue();
}]>;
+def GetLo32XForm : SDNodeXForm<imm, [{
+ // Transformation function: get the low 32 bits.
+ return getI32Imm((unsigned)N->getZExtValue());
+}]>;
+
def i64immSExt32 : PatLeaf<(i64 imm), [{
// i64immSExt32 predicate - True if the 64-bit immediate fits in a 32-bit
// sign extended field.
return (int64_t)N->getZExtValue() == (int32_t)N->getZExtValue();
}]>;
+
def i64immZExt32 : PatLeaf<(i64 imm), [{
// i64immZExt32 predicate - True if the 64-bit immediate fits in a 32-bit
// unsignedsign extended field.
@@ -1981,7 +1987,7 @@ def : Pat<(and GR64:$src, i64immZExt32:$imm),
(i64 0),
(AND32ri
(EXTRACT_SUBREG GR64:$src, x86_subreg_32bit),
- imm:$imm),
+ (i32 (GetLo32XForm imm:$imm))),
x86_subreg_32bit)>;
// r & (2^32-1) ==> movz