blez_bgez.ll
4.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; Test that blez/ bgez are selected.
; RUN: llc -mtriple=mipsel-mti-linux-gnu < %s | FileCheck %s --check-prefix=MIPS32
; RUN: llc -mtriple=mips64el-mti-linux-gnu < %s | FileCheck %s --check-prefix=MIPS64
; RUN: llc -mtriple=mipsel-mti-linux-gnu -mattr=+micromips < %s | FileCheck %s --check-prefix=MM
define void @test_blez(i32 %a) {
; MIPS32-LABEL: test_blez:
; MIPS32: # %bb.0: # %entry
; MIPS32-NEXT: blez $4, $BB0_2
; MIPS32-NEXT: nop
; MIPS32-NEXT: # %bb.1: # %if.then
; MIPS32-NEXT: addiu $sp, $sp, -24
; MIPS32-NEXT: .cfi_def_cfa_offset 24
; MIPS32-NEXT: sw $ra, 20($sp) # 4-byte Folded Spill
; MIPS32-NEXT: .cfi_offset 31, -4
; MIPS32-NEXT: jal foo1
; MIPS32-NEXT: nop
; MIPS32-NEXT: lw $ra, 20($sp) # 4-byte Folded Reload
; MIPS32-NEXT: addiu $sp, $sp, 24
; MIPS32-NEXT: $BB0_2: # %if.end
; MIPS32-NEXT: jr $ra
; MIPS32-NEXT: nop
;
; MIPS64-LABEL: test_blez:
; MIPS64: # %bb.0: # %entry
; MIPS64-NEXT: sll $1, $4, 0
; MIPS64-NEXT: blez $1, .LBB0_2
; MIPS64-NEXT: nop
; MIPS64-NEXT: # %bb.1: # %if.then
; MIPS64-NEXT: daddiu $sp, $sp, -16
; MIPS64-NEXT: .cfi_def_cfa_offset 16
; MIPS64-NEXT: sd $ra, 8($sp) # 8-byte Folded Spill
; MIPS64-NEXT: .cfi_offset 31, -8
; MIPS64-NEXT: jal foo1
; MIPS64-NEXT: nop
; MIPS64-NEXT: ld $ra, 8($sp) # 8-byte Folded Reload
; MIPS64-NEXT: daddiu $sp, $sp, 16
; MIPS64-NEXT: .LBB0_2: # %if.end
; MIPS64-NEXT: jr $ra
; MIPS64-NEXT: nop
;
; MM-LABEL: test_blez:
; MM: # %bb.0: # %entry
; MM-NEXT: blez $4, $BB0_3
; MM-NEXT: nop
; MM-NEXT: # %bb.1: # %entry
; MM-NEXT: j $BB0_2
; MM-NEXT: nop
; MM-NEXT: $BB0_2: # %if.then
; MM-NEXT: addiu $sp, $sp, -24
; MM-NEXT: .cfi_def_cfa_offset 24
; MM-NEXT: sw $ra, 20($sp) # 4-byte Folded Spill
; MM-NEXT: .cfi_offset 31, -4
; MM-NEXT: jal foo1
; MM-NEXT: nop
; MM-NEXT: lw $ra, 20($sp) # 4-byte Folded Reload
; MM-NEXT: addiu $sp, $sp, 24
; MM-NEXT: $BB0_3: # %if.end
; MM-NEXT: jrc $ra
entry:
%cmp = icmp sgt i32 %a, 0
br i1 %cmp, label %if.then, label %if.end
if.then:
tail call void @foo1()
br label %if.end
if.end:
ret void
}
declare void @foo1()
define void @test_bgez(i32 %a) {
; MIPS32-LABEL: test_bgez:
; MIPS32: # %bb.0: # %entry
; MIPS32-NEXT: bltz $4, $BB1_2
; MIPS32-NEXT: nop
; MIPS32-NEXT: # %bb.1: # %if.end
; MIPS32-NEXT: jr $ra
; MIPS32-NEXT: nop
; MIPS32-NEXT: $BB1_2: # %if.then
; MIPS32-NEXT: addiu $sp, $sp, -24
; MIPS32-NEXT: .cfi_def_cfa_offset 24
; MIPS32-NEXT: sw $ra, 20($sp) # 4-byte Folded Spill
; MIPS32-NEXT: .cfi_offset 31, -4
; MIPS32-NEXT: jal foo1
; MIPS32-NEXT: nop
; MIPS32-NEXT: lw $ra, 20($sp) # 4-byte Folded Reload
; MIPS32-NEXT: jr $ra
; MIPS32-NEXT: addiu $sp, $sp, 24
;
; MIPS64-LABEL: test_bgez:
; MIPS64: # %bb.0: # %entry
; MIPS64-NEXT: sll $1, $4, 0
; MIPS64-NEXT: bltz $1, .LBB1_2
; MIPS64-NEXT: nop
; MIPS64-NEXT: # %bb.1: # %if.end
; MIPS64-NEXT: jr $ra
; MIPS64-NEXT: nop
; MIPS64-NEXT: .LBB1_2: # %if.then
; MIPS64-NEXT: daddiu $sp, $sp, -16
; MIPS64-NEXT: .cfi_def_cfa_offset 16
; MIPS64-NEXT: sd $ra, 8($sp) # 8-byte Folded Spill
; MIPS64-NEXT: .cfi_offset 31, -8
; MIPS64-NEXT: jal foo1
; MIPS64-NEXT: nop
; MIPS64-NEXT: ld $ra, 8($sp) # 8-byte Folded Reload
; MIPS64-NEXT: jr $ra
; MIPS64-NEXT: daddiu $sp, $sp, 16
;
; MM-LABEL: test_bgez:
; MM: # %bb.0: # %entry
; MM-NEXT: bgez $4, $BB1_2
; MM-NEXT: nop
; MM-NEXT: # %bb.1: # %entry
; MM-NEXT: j $BB1_3
; MM-NEXT: nop
; MM-NEXT: $BB1_2: # %if.end
; MM-NEXT: jrc $ra
; MM-NEXT: $BB1_3: # %if.then
; MM-NEXT: addiu $sp, $sp, -24
; MM-NEXT: .cfi_def_cfa_offset 24
; MM-NEXT: sw $ra, 20($sp) # 4-byte Folded Spill
; MM-NEXT: .cfi_offset 31, -4
; MM-NEXT: jal foo1
; MM-NEXT: nop
; MM-NEXT: lw $ra, 20($sp) # 4-byte Folded Reload
; MM-NEXT: jr $ra
; MM-NEXT: addiu $sp, $sp, 24
entry:
%cmp = icmp slt i32 %a, 0
br i1 %cmp, label %if.then, label %if.end
if.then:
tail call void @foo1()
br label %if.end
if.end:
ret void
}