[llvm-commits] CVS: llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp

Nate Begeman natebegeman at mac.com
Wed Oct 20 14:55:52 PDT 2004



Changes in directory llvm/lib/Target/PowerPC:

PPC32ISelSimple.cpp updated: 1.94 -> 1.95
---
Log message:

Don't clear or sign extend bool->int.  This fires a few dozen times on the test suite

---
Diffs of the changes:  (+17 -0)

Index: llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp
diff -u llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp:1.94 llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp:1.95
--- llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp:1.94	Sun Oct 17 00:19:20 2004
+++ llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp	Wed Oct 20 16:55:41 2004
@@ -3048,6 +3048,23 @@
   unsigned DestClass = getClassB(DestTy);
   unsigned SrcReg = getReg(Src, MBB, IP);
 
+  // Implement casts from bool to integer types as a move operation
+  if (SrcTy == Type::BoolTy) {
+    switch (DestClass) {
+    case cByte:
+    case cShort:
+    case cInt:
+      BuildMI(*MBB, IP, PPC::OR, 2, DestReg).addReg(SrcReg).addReg(SrcReg);
+      return;
+    case cLong:
+      BuildMI(*MBB, IP, PPC::LI, 1, DestReg).addImm(0);
+      BuildMI(*MBB, IP, PPC::OR, 2, DestReg+1).addReg(SrcReg).addReg(SrcReg);
+      return;
+    default:
+      break;
+    }
+  }
+
   // Implement casts to bool by using compare on the operand followed by set if
   // not zero on the result.
   if (DestTy == Type::BoolTy) {






More information about the llvm-commits mailing list