aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Target/ARM/Thumb2ITBlockPass.cpp
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2009-08-15 07:59:10 +0000
committerEvan Cheng <evan.cheng@apple.com>2009-08-15 07:59:10 +0000
commitbc9b754091ea281e769e487f396b40f6675b9edb (patch)
tree7184d0f8f2aebfdb1aaa860e27656d9146d2e379 /lib/Target/ARM/Thumb2ITBlockPass.cpp
parentad27d77fc07d9d77419d45c056be7685cc32b5a9 (diff)
downloadexternal_llvm-bc9b754091ea281e769e487f396b40f6675b9edb.zip
external_llvm-bc9b754091ea281e769e487f396b40f6675b9edb.tar.gz
external_llvm-bc9b754091ea281e769e487f396b40f6675b9edb.tar.bz2
Turn on if-conversion for thumb2.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79084 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/ARM/Thumb2ITBlockPass.cpp')
-rw-r--r--lib/Target/ARM/Thumb2ITBlockPass.cpp20
1 files changed, 8 insertions, 12 deletions
diff --git a/lib/Target/ARM/Thumb2ITBlockPass.cpp b/lib/Target/ARM/Thumb2ITBlockPass.cpp
index da7228b..e74a526 100644
--- a/lib/Target/ARM/Thumb2ITBlockPass.cpp
+++ b/lib/Target/ARM/Thumb2ITBlockPass.cpp
@@ -66,23 +66,19 @@ bool Thumb2ITBlockPass::InsertITBlocks(MachineBasicBlock &MBB) {
.addImm(CC);
++MBBI;
- // Finalize IT mask. If the following instruction is not predicated or it's
- // predicated on a condition that's not the same or the opposite of CC, then
- // the mask is 0x8.
+ // Finalize IT mask.
ARMCC::CondCodes OCC = ARMCC::getOppositeCondition(CC);
- unsigned Mask = 0x8;
- while (MBBI != E || (Mask & 1)) {
+ unsigned Mask = 0, Pos = 3;
+ while (MBBI != E && Pos) {
ARMCC::CondCodes NCC = getPredicate(&*MBBI, TII);
- if (NCC == CC) {
- Mask >>= 1;
- Mask |= 0x8;
- } else if (NCC == OCC) {
- Mask >>= 1;
- } else {
+ if (NCC == OCC) {
+ Mask |= (1 << Pos);
+ } else if (NCC != CC)
break;
- }
+ --Pos;
++MBBI;
}
+ Mask |= (1 << Pos);
MIB.addImm(Mask);
Modified = true;
++NumITs;