Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(240)

Unified Diff: tests_lit/llvm2ice_tests/cond-branch.ll

Issue 1993773004: [Subzero][MIPS32] Addition of bool folding machinery and implementation of conditional branches (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Added tests for eq and ne branches and corrected branch target label emission Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« src/IceTargetLoweringMIPS32.cpp ('K') | « src/IceTargetLoweringMIPS32.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests_lit/llvm2ice_tests/cond-branch.ll
diff --git a/tests_lit/llvm2ice_tests/cond-branch.ll b/tests_lit/llvm2ice_tests/cond-branch.ll
new file mode 100644
index 0000000000000000000000000000000000000000..ead063e9e6c8aff2498a85390ae0066cbb9f072c
--- /dev/null
+++ b/tests_lit/llvm2ice_tests/cond-branch.ll
@@ -0,0 +1,135 @@
+; Tests for conditional branch instructions
+
+; RUN: %if --need=allow_dump --need=target_MIPS32 --command %p2i --filetype=asm \
John 2016/05/19 14:59:59 80-col
Jim Stichnoth 2016/05/19 15:03:41 80-col
+; RUN: --target mips32 -i %s --args -O2 --skip-unimplemented \
+; RUN: -allow-externally-defined-symbols \
+; RUN: | %if --need=allow_dump --need=target_MIPS32 --command FileCheck %s \
+; RUN: --check-prefix=MIPS32
+
+define internal i32 @cond_br_eq(i32 %arg1, i32 %arg2) {
+entry:
+ %cmp1 = icmp eq i32 %arg1, %arg2
+ br i1 %cmp1, label %branch1, label %branch2
+branch1:
+ ret i32 1
+branch2:
+ ret i32 2
+}
+; MIPS32-LABEL: cond_br_eq
+; MIPS32: bne $a0, $a1, .Lcond_br_eq$branch2
Jim Stichnoth 2016/05/19 15:03:41 I think you also need tests where branch folding i
+
+define internal i32 @cond_br_ne(i32 %arg1, i32 %arg2) {
+entry:
+ %cmp1 = icmp ne i32 %arg1, %arg2
+ br i1 %cmp1, label %branch1, label %branch2
+branch1:
+ ret i32 1
+branch2:
+ ret i32 2
+}
+; MIPS32-LABEL: cond_br_ne
+; MIPS32: beq $a0, $a1, .Lcond_br_ne$branch2
+
+define internal i32 @cond_br_slt(i32 %arg1, i32 %arg2) {
+entry:
+ %cmp1 = icmp slt i32 %arg1, %arg2
+ br i1 %cmp1, label %branch1, label %branch2
+branch1:
+ ret i32 1
+branch2:
+ ret i32 2
+}
+; MIPS32-LABEL: cond_br_slt
+; MIPS32: slt $a0, $a0, $a1
+; MIPS32: beqz $a0, .Lcond_br_slt$branch2
+
+define internal i32 @cond_br_sle(i32 %arg1, i32 %arg2) {
+entry:
+ %cmp1 = icmp sle i32 %arg1, %arg2
+ br i1 %cmp1, label %branch1, label %branch2
+branch1:
+ ret i32 1
+branch2:
+ ret i32 2
+}
+; MIPS32-LABEL: cond_br_sle
+; MIPS32: slt $a1, $a1, $a0
+; MIPS32: bnez $a1, .Lcond_br_sle$branch2
+
+define internal i32 @cond_br_sgt(i32 %arg1, i32 %arg2) {
+entry:
+ %cmp1 = icmp sgt i32 %arg1, %arg2
+ br i1 %cmp1, label %branch1, label %branch2
+branch1:
+ ret i32 1
+branch2:
+ ret i32 2
+}
+; MIPS32-LABEL: cond_br_sgt
+; MIPS32: slt $a1, $a1, $a0
+; MIPS32: beqz $a1, .Lcond_br_sgt$branch2
+
+define internal i32 @cond_br_sge(i32 %arg1, i32 %arg2) {
+entry:
+ %cmp1 = icmp sge i32 %arg1, %arg2
+ br i1 %cmp1, label %branch1, label %branch2
+branch1:
+ ret i32 1
+branch2:
+ ret i32 2
+}
+; MIPS32-LABEL: cond_br_sge
+; MIPS32: slt $a0, $a0, $a1
+; MIPS32: bnez $a0, .Lcond_br_sge$branch2
+
+define internal i32 @cond_br_ugt(i32 %arg1, i32 %arg2) {
+entry:
+ %cmp1 = icmp ugt i32 %arg1, %arg2
+ br i1 %cmp1, label %branch1, label %branch2
+branch1:
+ ret i32 1
+branch2:
+ ret i32 2
+}
+; MIPS32-LABEL: cond_br_ugt
+; MIPS32: sltu $a1, $a1, $a0
+; MIPS32: beqz $a1, .Lcond_br_ugt$branch2
+
+define internal i32 @cond_br_uge(i32 %arg1, i32 %arg2) {
+entry:
+ %cmp1 = icmp uge i32 %arg1, %arg2
+ br i1 %cmp1, label %branch1, label %branch2
+branch1:
+ ret i32 1
+branch2:
+ ret i32 2
+}
+; MIPS32-LABEL: cond_br_uge
+; MIPS32: sltu $a0, $a0, $a1
+; MIPS32: bnez $a0, .Lcond_br_uge$branch2
+
+define internal i32 @cond_br_ult(i32 %arg1, i32 %arg2) {
+entry:
+ %cmp1 = icmp ult i32 %arg1, %arg2
+ br i1 %cmp1, label %branch1, label %branch2
+branch1:
+ ret i32 1
+branch2:
+ ret i32 2
+}
+; MIPS32-LABEL: cond_br_ult
+; MIPS32: sltu $a0, $a0, $a1
+; MIPS32: beqz $a0, .Lcond_br_ult$branch2
+
+define internal i32 @cond_br_ule(i32 %arg1, i32 %arg2) {
+entry:
+ %cmp1 = icmp ule i32 %arg1, %arg2
+ br i1 %cmp1, label %branch1, label %branch2
+branch1:
+ ret i32 1
+branch2:
+ ret i32 2
+}
+; MIPS32-LABEL: cond_br_ule
+; MIPS32: sltu $a1, $a1, $a0
+; MIPS32: bnez $a1, .Lcond_br_ule$branch2
« src/IceTargetLoweringMIPS32.cpp ('K') | « src/IceTargetLoweringMIPS32.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698