[llvm-commits] CVS: llvm/lib/Target/X86/InstSelectSimple.cpp

Chris Lattner lattner at cs.uiuc.edu
Fri Dec 13 05:33:00 PST 2002


Changes in directory llvm/lib/Target/X86:

InstSelectSimple.cpp updated: 1.62 -> 1.63

---
Log message:

Implement cast bool to X


---
Diffs of the changes:

Index: llvm/lib/Target/X86/InstSelectSimple.cpp
diff -u llvm/lib/Target/X86/InstSelectSimple.cpp:1.62 llvm/lib/Target/X86/InstSelectSimple.cpp:1.63
--- llvm/lib/Target/X86/InstSelectSimple.cpp:1.62	Fri Dec 13 05:22:48 2002
+++ llvm/lib/Target/X86/InstSelectSimple.cpp	Fri Dec 13 05:31:59 2002
@@ -854,7 +854,7 @@
   // 4) cast {int, uint, ptr} to {short, ushort}
   //    cast {int, uint, ptr} to {sbyte, ubyte}
   //    cast {short, ushort} to {sbyte, ubyte}
-  //
+
   // 1) Implement casts to bool by using compare on the operand followed
   // by set if not zero on the result.
   if (targetType == Type::BoolTy)
@@ -863,10 +863,11 @@
       BuildMI (BB, X86::SETNEr, 1, destReg);
       return;
     }
+
   // 2) Implement casts between values of the same type class (as determined
   // by getClass) by using a register-to-register move.
-  unsigned int srcClass = getClass (sourceType);
-  unsigned int targClass = getClass (targetType);
+  unsigned srcClass = sourceType == Type::BoolTy ? cByte : getClass(sourceType);
+  unsigned targClass = getClass (targetType);
   static const unsigned regRegMove[] = {
     X86::MOVrr8, X86::MOVrr16, X86::MOVrr32
   };





More information about the llvm-commits mailing list