summaryrefslogtreecommitdiffstats
path: root/llvm/test/CodeGen/PowerPC
diff options
context:
space:
mode:
authorNemanja Ivanovic <nemanja.i.ibm@gmail.com>2018-05-02 23:55:23 +0000
committerNemanja Ivanovic <nemanja.i.ibm@gmail.com>2018-05-02 23:55:23 +0000
commit01e2e79abf0a69d4e041a87463ccd0afc27b603a (patch)
tree65779c2b4913591b6424a1ae4f7a071353b23a22 /llvm/test/CodeGen/PowerPC
parent1f6277eb4d905ac46df120e1a059fc67790ca62c (diff)
downloadbcm5719-llvm-01e2e79abf0a69d4e041a87463ccd0afc27b603a.tar.gz
bcm5719-llvm-01e2e79abf0a69d4e041a87463ccd0afc27b603a.zip
[PowerPC] Implement isMaskAndCmp0FoldingBeneficial
Sinking the and closer to a compare against zero is beneficial on PPC as it allows us to emit record-form instructions. In the future, we may expand this to a larger set of operations that feed compares against zero since PPC has lots of record-form instructions. Differential revision: https://reviews.llvm.org/D46060 llvm-svn: 331416
Diffstat (limited to 'llvm/test/CodeGen/PowerPC')
-rw-r--r--llvm/test/CodeGen/PowerPC/test-and-cmp-folding.ll53
1 files changed, 53 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/PowerPC/test-and-cmp-folding.ll b/llvm/test/CodeGen/PowerPC/test-and-cmp-folding.ll
new file mode 100644
index 00000000000..b4a3f28facd
--- /dev/null
+++ b/llvm/test/CodeGen/PowerPC/test-and-cmp-folding.ll
@@ -0,0 +1,53 @@
+; RUN: llc < %s -mtriple=powerpc64le-unknown-unknown -mcpu=pwr8 \
+; RUN: -verify-machineinstrs | FileCheck %s
+declare void @free()
+
+define dso_local fastcc void @test2() {
+; CHECK-LABEL: test2
+entry:
+ switch i16 undef, label %sw.default [
+ i16 10, label %sw.bb52
+ i16 134, label %sw.bb54
+ ]
+
+sw.default: ; preds = %entry
+ unreachable
+
+
+sw.bb52: ; preds = %entry, %entry, %entry, %entry, %entry, %entry
+ br i1 undef, label %if.then14.i, label %sw.epilog.i642
+
+if.then14.i: ; preds = %sw.bb52
+ %call39.i = call i64 @test() #3
+ %and.i126.i = and i64 %call39.i, 1
+ br i1 undef, label %dummy.exit.i, label %if.then.i.i.i636
+
+if.then.i.i.i636: ; preds = %if.then14.i
+ %0 = load i8*, i8** undef, align 8
+ call void @free() #3
+ br label %dummy.exit.i
+
+dummy.exit.i: ; preds = %if.then.i.i.i636, %if.then14.i
+; CHECK: # %dummy.exit.i
+; CHECK-NEXT: andi.
+; CHECK-NEXT: bc 12
+ %cond82.i = icmp eq i64 %and.i126.i, 0
+ br i1 %cond82.i, label %if.end50.i, label %dummy.exit
+
+if.end50.i: ; preds = %dummy.exit.i
+ unreachable
+
+sw.epilog.i642: ; preds = %sw.bb52
+ unreachable
+
+dummy.exit: ; preds = %dummy.exit.i
+ unreachable
+
+sw.bb54: ; preds = %entry, %entry
+ call fastcc void @test3()
+ unreachable
+}
+
+declare dso_local fastcc void @test3()
+
+declare i64 @test()
OpenPOWER on IntegriCloud