aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNate Begeman <natebegeman@mac.com>2004-09-29 03:45:33 +0000
committerNate Begeman <natebegeman@mac.com>2004-09-29 03:45:33 +0000
commit1b99fd3e8a352c078d52f8648273cc6d1d5cd884 (patch)
treea4bfe29e3655bf90930e968066a565ce1f61ef9a
parent1df468ea9bb3887021946ed9e49ef26064628f9d (diff)
downloadexternal_llvm-1b99fd3e8a352c078d52f8648273cc6d1d5cd884.zip
external_llvm-1b99fd3e8a352c078d52f8648273cc6d1d5cd884.tar.gz
external_llvm-1b99fd3e8a352c078d52f8648273cc6d1d5cd884.tar.bz2
improve Type::BoolTy codegen by eliminating unnecessary clears and sign extends
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16578 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Target/PowerPC/PPC32ISelSimple.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/Target/PowerPC/PPC32ISelSimple.cpp b/lib/Target/PowerPC/PPC32ISelSimple.cpp
index afb96f7..9f1229a 100644
--- a/lib/Target/PowerPC/PPC32ISelSimple.cpp
+++ b/lib/Target/PowerPC/PPC32ISelSimple.cpp
@@ -993,6 +993,11 @@ unsigned PPC32ISel::ExtendOrClear(MachineBasicBlock *MBB,
unsigned Reg = getReg(Op0, MBB, IP);
unsigned Class = getClassB(CompTy);
+ // Since we know that boolean values will be either zero or one, we don't
+ // have to extend or clear them.
+ if (CompTy == Type::BoolTy)
+ return Reg;
+
// Before we do a comparison or SetCC, we have to make sure that we truncate
// the source registers appropriately.
if (Class == cByte) {
@@ -1374,7 +1379,9 @@ void PPC32ISel::promote32(unsigned targetReg, const ValueRecord &VR) {
switch (getClassB(Ty)) {
case cByte:
// Extend value into target register (8->32)
- if (isUnsigned)
+ if (Ty == Type::BoolTy)
+ BuildMI(BB, PPC::OR, 2, targetReg).addReg(Reg).addReg(Reg);
+ else if (isUnsigned)
BuildMI(BB, PPC::RLWINM, 4, targetReg).addReg(Reg).addZImm(0)
.addZImm(24).addZImm(31);
else