summaryrefslogtreecommitdiffstats
path: root/llvm/test/CodeGen/ARM/call-tc.ll
diff options
context:
space:
mode:
authorSjoerd Meijer <sjoerd.meijer@arm.com>2016-12-15 09:38:59 +0000
committerSjoerd Meijer <sjoerd.meijer@arm.com>2016-12-15 09:38:59 +0000
commit96e10b5a9e89e1575630212908259b177af8d748 (patch)
tree0f7286049536d4b5955843f275fd5da9f8922656 /llvm/test/CodeGen/ARM/call-tc.ll
parent4b028e2ee112a7b22c7b246f8d74d727fb87a6b9 (diff)
downloadbcm5719-llvm-96e10b5a9e89e1575630212908259b177af8d748.tar.gz
bcm5719-llvm-96e10b5a9e89e1575630212908259b177af8d748.zip
[Thumb] Teach ISel how to lower compares of AND bitmasks efficiently
This is essentially a recommit of r285893, but with a correctness fix. The problem of the original commit was that this: bic r5, r7, #31 cbz r5, .LBB2_10 got rewritten into: lsrs r5, r7, #5 beq .LBB2_10 The result in destination register r5 is not the same and this is incorrect when r5 is not dead. So this fix includes checking the uses of the AND destination register. And also, compared to the original commit, some regression tests didn't need changing anymore because of this extra check. For completeness, this was the original commit message: For the common pattern (CMPZ (AND x, #bitmask), #0), we can do some more efficient instruction selection if the bitmask is one consecutive sequence of set bits (32 - clz(bm) - ctz(bm) == popcount(bm)). 1) If the bitmask touches the LSB, then we can remove all the upper bits and set the flags by doing one LSLS. 2) If the bitmask touches the MSB, then we can remove all the lower bits and set the flags with one LSRS. 3) If the bitmask has popcount == 1 (only one set bit), we can shift that bit into the sign bit with one LSLS and change the condition query from NE/EQ to MI/PL (we could also implement this by shifting into the carry bit and branching on BCC/BCS). 4) Otherwise, we can emit a sequence of LSLS+LSRS to remove the upper and lower zero bits of the mask. 1-3 require only one 16-bit instruction and can elide the CMP. 4 requires two 16-bit instructions but can elide the CMP and doesn't require materializing a complex immediate, so is also a win. Differential Revision: https://reviews.llvm.org/D27761 llvm-svn: 289794
Diffstat (limited to 'llvm/test/CodeGen/ARM/call-tc.ll')
-rw-r--r--llvm/test/CodeGen/ARM/call-tc.ll2
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/test/CodeGen/ARM/call-tc.ll b/llvm/test/CodeGen/ARM/call-tc.ll
index 2277a585336..c5cfb9def33 100644
--- a/llvm/test/CodeGen/ARM/call-tc.ll
+++ b/llvm/test/CodeGen/ARM/call-tc.ll
@@ -120,7 +120,7 @@ if.end: ; preds = %entry
br i1 %tobool2, label %if.end5, label %if.then3
if.then3: ; preds = %if.end
-; CHECKT2D: bne.w _b
+; CHECKT2D: bmi.w _b
%call4 = tail call i32 @b(i32 %x) nounwind
br label %return
OpenPOWER on IntegriCloud