[llvm-commits] [llvm] r129845 - /llvm/trunk/lib/Target/X86/X86InstrInfo.td

Nick Lewycky nicholas at mxc.ca
Tue Apr 19 20:19:42 PDT 2011


Author: nicholas
Date: Tue Apr 19 22:19:42 2011
New Revision: 129845

URL: http://llvm.org/viewvc/llvm-project?rev=129845&view=rev
Log:
This should always be signed chars, so use int8_t. This fixes a miscompile when
llvm is built with unsigned chars where an immediate such as 0xff would be zero
extended to 64-bits, turning "cmp $0xff,%eax" into
"cmp $0xffffffffffffffff,%eax".

Modified:
    llvm/trunk/lib/Target/X86/X86InstrInfo.td

Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrInfo.td?rev=129845&r1=129844&r2=129845&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86InstrInfo.td (original)
+++ llvm/trunk/lib/Target/X86/X86InstrInfo.td Tue Apr 19 22:19:42 2011
@@ -482,9 +482,9 @@
 def X86_COND_S   : PatLeaf<(i8 15)>;
 
 let FastIselShouldIgnore = 1 in { // FastIsel should ignore all simm8 instrs.
-  def i16immSExt8  : ImmLeaf<i16, [{ return Imm == (char)Imm; }]>;
-  def i32immSExt8  : ImmLeaf<i32, [{ return Imm == (char)Imm; }]>;
-  def i64immSExt8  : ImmLeaf<i64, [{ return Imm == (char)Imm; }]>;
+  def i16immSExt8  : ImmLeaf<i16, [{ return Imm == (int8_t)Imm; }]>;
+  def i32immSExt8  : ImmLeaf<i32, [{ return Imm == (int8_t)Imm; }]>;
+  def i64immSExt8  : ImmLeaf<i64, [{ return Imm == (int8_t)Imm; }]>;
 }
 
 def i64immSExt32 : ImmLeaf<i64, [{ return Imm == (int32_t)Imm; }]>;





More information about the llvm-commits mailing list