1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
3 ; Test that blez/ bgez are selected.
4 ; RUN: llc -mtriple=mipsel-mti-linux-gnu < %s | FileCheck %s --check-prefix=MIPS32
5 ; RUN: llc -mtriple=mips64el-mti-linux-gnu < %s | FileCheck %s --check-prefix=MIPS64
6 ; RUN: llc -mtriple=mipsel-mti-linux-gnu -mattr=+micromips < %s | FileCheck %s --check-prefix=MM
8 define void @test_blez(i32 %a) {
9 ; MIPS32-LABEL: test_blez:
10 ; MIPS32: # %bb.0: # %entry
11 ; MIPS32-NEXT: blez $4, $BB0_2
13 ; MIPS32-NEXT: # %bb.1: # %if.then
14 ; MIPS32-NEXT: addiu $sp, $sp, -24
15 ; MIPS32-NEXT: .cfi_def_cfa_offset 24
16 ; MIPS32-NEXT: sw $ra, 20($sp) # 4-byte Folded Spill
17 ; MIPS32-NEXT: .cfi_offset 31, -4
18 ; MIPS32-NEXT: jal foo1
20 ; MIPS32-NEXT: lw $ra, 20($sp) # 4-byte Folded Reload
21 ; MIPS32-NEXT: addiu $sp, $sp, 24
22 ; MIPS32-NEXT: $BB0_2: # %if.end
26 ; MIPS64-LABEL: test_blez:
27 ; MIPS64: # %bb.0: # %entry
28 ; MIPS64-NEXT: sll $1, $4, 0
29 ; MIPS64-NEXT: blez $1, .LBB0_2
31 ; MIPS64-NEXT: # %bb.1: # %if.then
32 ; MIPS64-NEXT: daddiu $sp, $sp, -16
33 ; MIPS64-NEXT: .cfi_def_cfa_offset 16
34 ; MIPS64-NEXT: sd $ra, 8($sp) # 8-byte Folded Spill
35 ; MIPS64-NEXT: .cfi_offset 31, -8
36 ; MIPS64-NEXT: jal foo1
38 ; MIPS64-NEXT: ld $ra, 8($sp) # 8-byte Folded Reload
39 ; MIPS64-NEXT: daddiu $sp, $sp, 16
40 ; MIPS64-NEXT: .LBB0_2: # %if.end
44 ; MM-LABEL: test_blez:
45 ; MM: # %bb.0: # %entry
46 ; MM-NEXT: blez $4, $BB0_3
48 ; MM-NEXT: # %bb.1: # %entry
51 ; MM-NEXT: $BB0_2: # %if.then
52 ; MM-NEXT: addiu $sp, $sp, -24
53 ; MM-NEXT: .cfi_def_cfa_offset 24
54 ; MM-NEXT: sw $ra, 20($sp) # 4-byte Folded Spill
55 ; MM-NEXT: .cfi_offset 31, -4
58 ; MM-NEXT: lw $ra, 20($sp) # 4-byte Folded Reload
59 ; MM-NEXT: addiu $sp, $sp, 24
60 ; MM-NEXT: $BB0_3: # %if.end
63 %cmp = icmp sgt i32 %a, 0
64 br i1 %cmp, label %if.then, label %if.end
67 tail call void @foo1()
76 define void @test_bgez(i32 %a) {
77 ; MIPS32-LABEL: test_bgez:
78 ; MIPS32: # %bb.0: # %entry
79 ; MIPS32-NEXT: bltz $4, $BB1_2
81 ; MIPS32-NEXT: # %bb.1: # %if.end
84 ; MIPS32-NEXT: $BB1_2: # %if.then
85 ; MIPS32-NEXT: addiu $sp, $sp, -24
86 ; MIPS32-NEXT: .cfi_def_cfa_offset 24
87 ; MIPS32-NEXT: sw $ra, 20($sp) # 4-byte Folded Spill
88 ; MIPS32-NEXT: .cfi_offset 31, -4
89 ; MIPS32-NEXT: jal foo1
91 ; MIPS32-NEXT: lw $ra, 20($sp) # 4-byte Folded Reload
93 ; MIPS32-NEXT: addiu $sp, $sp, 24
95 ; MIPS64-LABEL: test_bgez:
96 ; MIPS64: # %bb.0: # %entry
97 ; MIPS64-NEXT: sll $1, $4, 0
98 ; MIPS64-NEXT: bltz $1, .LBB1_2
100 ; MIPS64-NEXT: # %bb.1: # %if.end
101 ; MIPS64-NEXT: jr $ra
103 ; MIPS64-NEXT: .LBB1_2: # %if.then
104 ; MIPS64-NEXT: daddiu $sp, $sp, -16
105 ; MIPS64-NEXT: .cfi_def_cfa_offset 16
106 ; MIPS64-NEXT: sd $ra, 8($sp) # 8-byte Folded Spill
107 ; MIPS64-NEXT: .cfi_offset 31, -8
108 ; MIPS64-NEXT: jal foo1
110 ; MIPS64-NEXT: ld $ra, 8($sp) # 8-byte Folded Reload
111 ; MIPS64-NEXT: jr $ra
112 ; MIPS64-NEXT: daddiu $sp, $sp, 16
114 ; MM-LABEL: test_bgez:
115 ; MM: # %bb.0: # %entry
116 ; MM-NEXT: bgez $4, $BB1_2
118 ; MM-NEXT: # %bb.1: # %entry
121 ; MM-NEXT: $BB1_2: # %if.end
123 ; MM-NEXT: $BB1_3: # %if.then
124 ; MM-NEXT: addiu $sp, $sp, -24
125 ; MM-NEXT: .cfi_def_cfa_offset 24
126 ; MM-NEXT: sw $ra, 20($sp) # 4-byte Folded Spill
127 ; MM-NEXT: .cfi_offset 31, -4
130 ; MM-NEXT: lw $ra, 20($sp) # 4-byte Folded Reload
132 ; MM-NEXT: addiu $sp, $sp, 24
134 %cmp = icmp slt i32 %a, 0
135 br i1 %cmp, label %if.then, label %if.end
138 tail call void @foo1()