summaryrefslogtreecommitdiffstats
path: root/llvm/test/CodeGen/Mips/GlobalISel/llvm-ir/branch.ll
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/test/CodeGen/Mips/GlobalISel/llvm-ir/branch.ll')
-rw-r--r--llvm/test/CodeGen/Mips/GlobalISel/llvm-ir/branch.ll58
1 files changed, 58 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/Mips/GlobalISel/llvm-ir/branch.ll b/llvm/test/CodeGen/Mips/GlobalISel/llvm-ir/branch.ll
new file mode 100644
index 00000000000..0a503931d89
--- /dev/null
+++ b/llvm/test/CodeGen/Mips/GlobalISel/llvm-ir/branch.ll
@@ -0,0 +1,58 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
+; RUN: llc -O0 -mtriple=mipsel-linux-gnu -global-isel -verify-machineinstrs %s -o -| FileCheck %s -check-prefixes=MIPS32
+define i32 @Unconditional_branch(i32 %a, i32 %b) {
+; MIPS32-LABEL: Unconditional_branch:
+; MIPS32: # %bb.0: # %entry
+; MIPS32-NEXT: addiu $sp, $sp, -8
+; MIPS32-NEXT: .cfi_def_cfa_offset 8
+; MIPS32-NEXT: sw $4, 4($sp) # 4-byte Folded Spill
+; MIPS32-NEXT: j $BB0_2
+; MIPS32-NEXT: nop
+; MIPS32-NEXT: $BB0_1: # %end
+; MIPS32-NEXT: lw $2, 4($sp) # 4-byte Folded Reload
+; MIPS32-NEXT: addiu $sp, $sp, 8
+; MIPS32-NEXT: jr $ra
+; MIPS32-NEXT: nop
+; MIPS32-NEXT: $BB0_2: # %block
+; MIPS32-NEXT: j $BB0_1
+; MIPS32-NEXT: nop
+entry:
+ br label %block
+ ret i32 %b
+end:
+ ret i32 %a
+block:
+ br label %end
+}
+
+define i32 @Conditional_branch(i1 %cond, i32 %a, i32 %b) {
+; MIPS32-LABEL: Conditional_branch:
+; MIPS32: # %bb.0:
+; MIPS32-NEXT: addiu $sp, $sp, -8
+; MIPS32-NEXT: .cfi_def_cfa_offset 8
+; MIPS32-NEXT: lui $1, 0
+; MIPS32-NEXT: ori $1, $1, 1
+; MIPS32-NEXT: and $1, $4, $1
+; MIPS32-NEXT: sw $5, 4($sp) # 4-byte Folded Spill
+; MIPS32-NEXT: sw $6, 0($sp) # 4-byte Folded Spill
+; MIPS32-NEXT: bnez $1, $BB1_2
+; MIPS32-NEXT: nop
+; MIPS32-NEXT: # %bb.1:
+; MIPS32-NEXT: j $BB1_3
+; MIPS32-NEXT: nop
+; MIPS32-NEXT: $BB1_2: # %if.then
+; MIPS32-NEXT: lw $2, 4($sp) # 4-byte Folded Reload
+; MIPS32-NEXT: addiu $sp, $sp, 8
+; MIPS32-NEXT: jr $ra
+; MIPS32-NEXT: nop
+; MIPS32-NEXT: $BB1_3: # %if.else
+; MIPS32-NEXT: lw $2, 0($sp) # 4-byte Folded Reload
+; MIPS32-NEXT: addiu $sp, $sp, 8
+; MIPS32-NEXT: jr $ra
+; MIPS32-NEXT: nop
+ br i1 %cond, label %if.then, label %if.else
+if.then:
+ ret i32 %a
+if.else:
+ ret i32 %b
+}
OpenPOWER on IntegriCloud