• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: llc -march=mipsel -mcpu=mips32r6 -relocation-model=static -disable-mips-delay-filler < %s | FileCheck %s -check-prefix=STATIC32
2; RUN: llc -march=mipsel -mcpu=mips64r6 -target-abi n64 -disable-mips-delay-filler < %s | FileCheck %s -check-prefix=PIC
3
4; Function Attrs: nounwind
5define void @l()  {
6entry:
7; PIC: jalrc $25
8  %call = tail call i32 @k()
9; PIC: jalrc $25
10  %call1 = tail call i32 @j()
11  %cmp = icmp eq i32 %call, %call1
12; CHECK: bnec
13  br i1 %cmp, label %if.then, label %if.end
14
15if.then:                                          ; preds = %entry:
16; STATIC: nop
17; STATIC: jal
18; PIC: jalrc $25
19  tail call void @f(i32 signext -2)
20  br label %if.end
21
22if.end:                                           ; preds = %if.then, %entry
23; CHECK: jrc  $ra
24  ret void
25}
26
27declare i32 @k()
28
29declare i32 @j()
30
31declare void @f(i32 signext)
32
33; Function Attrs: define void @l2()  {
34define void @l2()  {
35entry:
36; PIC: jalrc $25
37  %call = tail call i32 @k()
38; PIC: jalrc $25
39  %call1 = tail call i32 @i()
40  %cmp = icmp eq i32 %call, %call1
41; CHECK beqc
42  br i1 %cmp, label %if.end, label %if.then
43
44if.then:                                          ; preds = %entry:
45; STATIC: nop
46; STATIC: jal
47; PIC: jalrc $25
48  tail call void @f(i32 signext -1)
49  br label %if.end
50
51if.end:                                           ; preds = %entry, %if.then
52; CHECK: jrc  $ra
53  ret void
54}
55
56declare i32 @i()
57
58; Function Attrs: nounwind
59define void @l3()  {
60entry:
61; PIC: jalrc $25
62  %call = tail call i32 @k()
63  %cmp = icmp slt i32 %call, 0
64; CHECK : bgez
65  br i1 %cmp, label %if.then, label %if.end
66
67if.then:                                          ; preds = %entry:
68; STATIC: nop
69; STATIC: jal
70; PIC: jalrc $25
71  tail call void @f(i32 signext 0)
72  br label %if.end
73
74if.end:                                           ; preds = %if.then, %entry
75; CHECK: jrc $ra
76  ret void
77}
78
79; Function Attrs: nounwind
80define void @l4()  {
81entry:
82  %call = tail call i32 @k()
83  %cmp = icmp slt i32 %call, 1
84; CHECK: bgtzc
85  br i1 %cmp, label %if.then, label %if.end
86
87if.then:                                          ; preds = %entry:
88; STATIC: nop
89; STATIC: jal
90  tail call void @f(i32 signext 1)
91  br label %if.end
92
93if.end:                                           ; preds = %if.then, %entry
94; CHECK: jrc $ra
95  ret void
96}
97
98; Function Attrs: nounwind
99define void @l5()  {
100entry:
101; PIC: jalrc $25
102  %call = tail call i32 @k()
103; PIC: jalrc $25
104  %cmp = icmp sgt i32 %call, 0
105; CHECK: blezc
106  br i1 %cmp, label %if.then, label %if.end
107
108if.then:                                          ; preds = %entry:
109; STATIC: nop
110; STATIC: jal
111; PIC: jalrc $25
112  tail call void @f(i32 signext 2)
113  br label %if.end
114
115if.end:                                           ; preds = %if.then, %entry
116; CHECK: jrc  $ra
117  ret void
118}
119
120; Function Attrs: nounwind
121define void @l6()  {
122entry:
123; PIC: jalrc $25
124  %call = tail call i32 @k()
125; PIC: jalrc $25
126  %cmp = icmp sgt i32 %call, -1
127; CHECK: bltzc
128  br i1 %cmp, label %if.then, label %if.end
129
130if.then:                                          ; preds = %entry:
131; STATIC: nop
132; STATIC: jal
133; PIC: jalrc $25
134  tail call void @f(i32 signext 3)
135  br label %if.end
136
137if.end:                                           ; preds = %if.then, %entry
138; CHECK: jrc $ra
139  ret void
140}
141
142; Function Attrs: nounwind
143define void @l7()  {
144entry:
145; PIC: jalrc $25
146  %call = tail call i32 @k()
147  %cmp = icmp eq i32 %call, 0
148; CHECK: bnezc
149  br i1 %cmp, label %if.then, label %if.end
150
151if.then:                                          ; preds = %entry:
152; STATIC: nop
153; STATIC: jal
154; PIC: jalrc $25
155  tail call void @f(i32 signext 4)
156  br label %if.end
157
158if.end:                                           ; preds = %if.then, %entry
159; CHECK: jrc  $ra
160  ret void
161}
162
163; Function Attrs: nounwind
164define void @l8()  {
165entry:
166; PIC: jalrc $25
167  %call = tail call i32 @k()
168  %cmp = icmp eq i32 %call, 0
169; CHECK: beqzc
170  br i1 %cmp, label %if.end, label %if.then
171
172if.then:                                          ; preds = %entry:
173; STATIC: nop
174; STATIC: jal
175; PIC: jalrc $25
176  tail call void @f(i32 signext 5)
177  br label %if.end
178
179if.end:                                           ; preds = %entry, %if.then
180; CHECK: jrc  $ra
181  ret void
182}
183
184define i32 @l9(i8* ()* %i) #0 {
185entry:
186  %i.addr = alloca i8* ()*, align 4
187  store i8* ()* %i, i8* ()** %i.addr, align 4
188; STATIC32: jal
189; STATIC32: nop
190; PIC: jalrc $25
191  %call = call i32 @k()
192; PIC: jalrc $25
193  %cmp = icmp ne i32 %call, 0
194; CHECK: beqzc
195  br i1 %cmp, label %if.then, label %if.end
196
197if.then:                                          ; preds = %entry
198  %0 = load i8* ()*, i8* ()** %i.addr, align 4
199; CHECK: jalrc $25
200  %call1 = call i8* %0()
201  br label %if.end
202
203if.end:                                           ; preds = %if.then, %entry
204; CHECK: jrc $ra
205  ret i32 -1
206}
207