From 0797d4905a2cabd928cf0ffdf80690f4e6c89845 Mon Sep 17 00:00:00 2001 From: Nate Begeman Date: Wed, 20 Oct 2004 21:55:41 +0000 Subject: [PATCH] Don't clear or sign extend bool->int. This fires a few dozen times on the test suite git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17147 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/PowerPC/PPC32ISelSimple.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/lib/Target/PowerPC/PPC32ISelSimple.cpp b/lib/Target/PowerPC/PPC32ISelSimple.cpp index b0f56da4a7e..3adce5d83d5 100644 --- a/lib/Target/PowerPC/PPC32ISelSimple.cpp +++ b/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) { -- 2.34.1