summaryrefslogtreecommitdiff
path: root/test/CodeGen/PowerPC/opt-cmp-inst-cr0-live.ll
diff options
context:
space:
mode:
Diffstat (limited to 'test/CodeGen/PowerPC/opt-cmp-inst-cr0-live.ll')
-rw-r--r--test/CodeGen/PowerPC/opt-cmp-inst-cr0-live.ll33
1 files changed, 33 insertions, 0 deletions
diff --git a/test/CodeGen/PowerPC/opt-cmp-inst-cr0-live.ll b/test/CodeGen/PowerPC/opt-cmp-inst-cr0-live.ll
index 64d02c5b9632f..2aeb0e1f71f91 100644
--- a/test/CodeGen/PowerPC/opt-cmp-inst-cr0-live.ll
+++ b/test/CodeGen/PowerPC/opt-cmp-inst-cr0-live.ll
@@ -1,5 +1,6 @@
; RUN: llc -verify-machineinstrs -print-before=peephole-opt -print-after=peephole-opt -mtriple=powerpc64-unknown-linux-gnu -o /dev/null 2>&1 < %s | FileCheck %s
+; CHECK-LABEL: fn1
define signext i32 @fn1(i32 %baz) {
%1 = mul nsw i32 %baz, 208
%2 = zext i32 %1 to i64
@@ -21,3 +22,35 @@ foo:
bar:
ret i32 0
}
+
+; CHECK-LABEL: fn2
+define signext i32 @fn2(i64 %a, i64 %b) {
+; CHECK: OR8o {{[^, ]+}}, {{[^, ]+}}, %CR0<imp-def>;
+; CHECK: [[CREG:[^, ]+]]<def> = COPY %CR0
+; CHECK: BCC 12, [[CREG]]<kill>
+ %1 = or i64 %b, %a
+ %2 = icmp sgt i64 %1, -1
+ br i1 %2, label %foo, label %bar
+
+foo:
+ ret i32 1
+
+bar:
+ ret i32 0
+}
+
+; CHECK-LABEL: fn3
+define signext i32 @fn3(i32 %a) {
+; CHECK: ANDIo {{[^, ]+}}, 10, %CR0<imp-def>;
+; CHECK: [[CREG:[^, ]+]]<def> = COPY %CR0
+; CHECK: BCC 76, [[CREG]]<kill>
+ %1 = and i32 %a, 10
+ %2 = icmp ne i32 %1, 0
+ br i1 %2, label %foo, label %bar
+
+foo:
+ ret i32 1
+
+bar:
+ ret i32 0
+}