summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp
diff options
context:
space:
mode:
authorNate Begeman <natebegeman@mac.com>2004-10-20 21:55:41 +0000
committerNate Begeman <natebegeman@mac.com>2004-10-20 21:55:41 +0000
commit86b5f8075c1db4fddcfd427c46f716fc4cb0f8df (patch)
treefde323960c6f7a3f5aba29937ef4abf03e6375a7 /llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp
parentc9d8b4d45c58ab6576a42694bcc047c44a3f0104 (diff)
downloadbcm5719-llvm-86b5f8075c1db4fddcfd427c46f716fc4cb0f8df.tar.gz
bcm5719-llvm-86b5f8075c1db4fddcfd427c46f716fc4cb0f8df.zip
Don't clear or sign extend bool->int. This fires a few dozen times on the test suite
llvm-svn: 17147
Diffstat (limited to 'llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp')
-rw-r--r--llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp b/llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp
index b0f56da4a7e..3adce5d83d5 100644
--- a/llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp
+++ b/llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp
@@ -3048,6 +3048,23 @@ void PPC32ISel::emitCastOperation(MachineBasicBlock *MBB,
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) {
OpenPOWER on IntegriCloud