• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2# RUN: llc -O0 -mtriple=mipsel-linux-gnu -run-pass=legalizer -verify-machineinstrs %s -o - | FileCheck %s -check-prefixes=MIPS32
3--- |
4
5  define void @sub_i32() {entry: ret void}
6  define void @sub_i8_sext() {entry: ret void}
7  define void @sub_i8_zext() {entry: ret void}
8  define void @sub_i8_aext() {entry: ret void}
9  define void @sub_i16_sext() {entry: ret void}
10  define void @sub_i16_zext() {entry: ret void}
11  define void @sub_i16_aext() {entry: ret void}
12  define void @sub_i64() {entry: ret void}
13  define void @sub_i128() {entry: ret void}
14
15...
16---
17name:            sub_i32
18alignment:       4
19tracksRegLiveness: true
20body:             |
21  bb.1.entry:
22    liveins: $a0, $a1
23
24    ; MIPS32-LABEL: name: sub_i32
25    ; MIPS32: liveins: $a0, $a1
26    ; MIPS32: [[COPY:%[0-9]+]]:_(s32) = COPY $a0
27    ; MIPS32: [[COPY1:%[0-9]+]]:_(s32) = COPY $a1
28    ; MIPS32: [[SUB:%[0-9]+]]:_(s32) = G_SUB [[COPY]], [[COPY1]]
29    ; MIPS32: $v0 = COPY [[SUB]](s32)
30    ; MIPS32: RetRA implicit $v0
31    %0:_(s32) = COPY $a0
32    %1:_(s32) = COPY $a1
33    %2:_(s32) = G_SUB %0, %1
34    $v0 = COPY %2(s32)
35    RetRA implicit $v0
36
37...
38---
39name:            sub_i8_sext
40alignment:       4
41tracksRegLiveness: true
42body:             |
43  bb.1.entry:
44    liveins: $a0, $a1
45
46    ; MIPS32-LABEL: name: sub_i8_sext
47    ; MIPS32: liveins: $a0, $a1
48    ; MIPS32: [[COPY:%[0-9]+]]:_(s32) = COPY $a0
49    ; MIPS32: [[COPY1:%[0-9]+]]:_(s32) = COPY $a1
50    ; MIPS32: [[COPY2:%[0-9]+]]:_(s32) = COPY [[COPY1]](s32)
51    ; MIPS32: [[COPY3:%[0-9]+]]:_(s32) = COPY [[COPY]](s32)
52    ; MIPS32: [[SUB:%[0-9]+]]:_(s32) = G_SUB [[COPY2]], [[COPY3]]
53    ; MIPS32: [[COPY4:%[0-9]+]]:_(s32) = COPY [[SUB]](s32)
54    ; MIPS32: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 24
55    ; MIPS32: [[SHL:%[0-9]+]]:_(s32) = G_SHL [[COPY4]], [[C]](s32)
56    ; MIPS32: [[ASHR:%[0-9]+]]:_(s32) = G_ASHR [[SHL]], [[C]](s32)
57    ; MIPS32: $v0 = COPY [[ASHR]](s32)
58    ; MIPS32: RetRA implicit $v0
59    %2:_(s32) = COPY $a0
60    %0:_(s8) = G_TRUNC %2(s32)
61    %3:_(s32) = COPY $a1
62    %1:_(s8) = G_TRUNC %3(s32)
63    %4:_(s8) = G_SUB %1, %0
64    %5:_(s32) = G_SEXT %4(s8)
65    $v0 = COPY %5(s32)
66    RetRA implicit $v0
67
68...
69---
70name:            sub_i8_zext
71alignment:       4
72tracksRegLiveness: true
73body:             |
74  bb.1.entry:
75    liveins: $a0, $a1
76
77    ; MIPS32-LABEL: name: sub_i8_zext
78    ; MIPS32: liveins: $a0, $a1
79    ; MIPS32: [[COPY:%[0-9]+]]:_(s32) = COPY $a0
80    ; MIPS32: [[COPY1:%[0-9]+]]:_(s32) = COPY $a1
81    ; MIPS32: [[COPY2:%[0-9]+]]:_(s32) = COPY [[COPY1]](s32)
82    ; MIPS32: [[COPY3:%[0-9]+]]:_(s32) = COPY [[COPY]](s32)
83    ; MIPS32: [[SUB:%[0-9]+]]:_(s32) = G_SUB [[COPY2]], [[COPY3]]
84    ; MIPS32: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 255
85    ; MIPS32: [[COPY4:%[0-9]+]]:_(s32) = COPY [[SUB]](s32)
86    ; MIPS32: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY4]], [[C]]
87    ; MIPS32: $v0 = COPY [[AND]](s32)
88    ; MIPS32: RetRA implicit $v0
89    %2:_(s32) = COPY $a0
90    %0:_(s8) = G_TRUNC %2(s32)
91    %3:_(s32) = COPY $a1
92    %1:_(s8) = G_TRUNC %3(s32)
93    %4:_(s8) = G_SUB %1, %0
94    %5:_(s32) = G_ZEXT %4(s8)
95    $v0 = COPY %5(s32)
96    RetRA implicit $v0
97
98...
99---
100name:            sub_i8_aext
101alignment:       4
102tracksRegLiveness: true
103body:             |
104  bb.1.entry:
105    liveins: $a0, $a1
106
107    ; MIPS32-LABEL: name: sub_i8_aext
108    ; MIPS32: liveins: $a0, $a1
109    ; MIPS32: [[COPY:%[0-9]+]]:_(s32) = COPY $a0
110    ; MIPS32: [[COPY1:%[0-9]+]]:_(s32) = COPY $a1
111    ; MIPS32: [[COPY2:%[0-9]+]]:_(s32) = COPY [[COPY1]](s32)
112    ; MIPS32: [[COPY3:%[0-9]+]]:_(s32) = COPY [[COPY]](s32)
113    ; MIPS32: [[SUB:%[0-9]+]]:_(s32) = G_SUB [[COPY2]], [[COPY3]]
114    ; MIPS32: [[COPY4:%[0-9]+]]:_(s32) = COPY [[SUB]](s32)
115    ; MIPS32: $v0 = COPY [[COPY4]](s32)
116    ; MIPS32: RetRA implicit $v0
117    %2:_(s32) = COPY $a0
118    %0:_(s8) = G_TRUNC %2(s32)
119    %3:_(s32) = COPY $a1
120    %1:_(s8) = G_TRUNC %3(s32)
121    %4:_(s8) = G_SUB %1, %0
122    %5:_(s32) = G_ANYEXT %4(s8)
123    $v0 = COPY %5(s32)
124    RetRA implicit $v0
125
126...
127---
128name:            sub_i16_sext
129alignment:       4
130tracksRegLiveness: true
131body:             |
132  bb.1.entry:
133    liveins: $a0, $a1
134
135    ; MIPS32-LABEL: name: sub_i16_sext
136    ; MIPS32: liveins: $a0, $a1
137    ; MIPS32: [[COPY:%[0-9]+]]:_(s32) = COPY $a0
138    ; MIPS32: [[COPY1:%[0-9]+]]:_(s32) = COPY $a1
139    ; MIPS32: [[COPY2:%[0-9]+]]:_(s32) = COPY [[COPY1]](s32)
140    ; MIPS32: [[COPY3:%[0-9]+]]:_(s32) = COPY [[COPY]](s32)
141    ; MIPS32: [[SUB:%[0-9]+]]:_(s32) = G_SUB [[COPY2]], [[COPY3]]
142    ; MIPS32: [[COPY4:%[0-9]+]]:_(s32) = COPY [[SUB]](s32)
143    ; MIPS32: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 16
144    ; MIPS32: [[SHL:%[0-9]+]]:_(s32) = G_SHL [[COPY4]], [[C]](s32)
145    ; MIPS32: [[ASHR:%[0-9]+]]:_(s32) = G_ASHR [[SHL]], [[C]](s32)
146    ; MIPS32: $v0 = COPY [[ASHR]](s32)
147    ; MIPS32: RetRA implicit $v0
148    %2:_(s32) = COPY $a0
149    %0:_(s16) = G_TRUNC %2(s32)
150    %3:_(s32) = COPY $a1
151    %1:_(s16) = G_TRUNC %3(s32)
152    %4:_(s16) = G_SUB %1, %0
153    %5:_(s32) = G_SEXT %4(s16)
154    $v0 = COPY %5(s32)
155    RetRA implicit $v0
156
157...
158---
159name:            sub_i16_zext
160alignment:       4
161tracksRegLiveness: true
162body:             |
163  bb.1.entry:
164    liveins: $a0, $a1
165
166    ; MIPS32-LABEL: name: sub_i16_zext
167    ; MIPS32: liveins: $a0, $a1
168    ; MIPS32: [[COPY:%[0-9]+]]:_(s32) = COPY $a0
169    ; MIPS32: [[COPY1:%[0-9]+]]:_(s32) = COPY $a1
170    ; MIPS32: [[COPY2:%[0-9]+]]:_(s32) = COPY [[COPY1]](s32)
171    ; MIPS32: [[COPY3:%[0-9]+]]:_(s32) = COPY [[COPY]](s32)
172    ; MIPS32: [[SUB:%[0-9]+]]:_(s32) = G_SUB [[COPY2]], [[COPY3]]
173    ; MIPS32: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 65535
174    ; MIPS32: [[COPY4:%[0-9]+]]:_(s32) = COPY [[SUB]](s32)
175    ; MIPS32: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY4]], [[C]]
176    ; MIPS32: $v0 = COPY [[AND]](s32)
177    ; MIPS32: RetRA implicit $v0
178    %2:_(s32) = COPY $a0
179    %0:_(s16) = G_TRUNC %2(s32)
180    %3:_(s32) = COPY $a1
181    %1:_(s16) = G_TRUNC %3(s32)
182    %4:_(s16) = G_SUB %1, %0
183    %5:_(s32) = G_ZEXT %4(s16)
184    $v0 = COPY %5(s32)
185    RetRA implicit $v0
186
187...
188---
189name:            sub_i16_aext
190alignment:       4
191tracksRegLiveness: true
192body:             |
193  bb.1.entry:
194    liveins: $a0, $a1
195
196    ; MIPS32-LABEL: name: sub_i16_aext
197    ; MIPS32: liveins: $a0, $a1
198    ; MIPS32: [[COPY:%[0-9]+]]:_(s32) = COPY $a0
199    ; MIPS32: [[COPY1:%[0-9]+]]:_(s32) = COPY $a1
200    ; MIPS32: [[COPY2:%[0-9]+]]:_(s32) = COPY [[COPY1]](s32)
201    ; MIPS32: [[COPY3:%[0-9]+]]:_(s32) = COPY [[COPY]](s32)
202    ; MIPS32: [[SUB:%[0-9]+]]:_(s32) = G_SUB [[COPY2]], [[COPY3]]
203    ; MIPS32: [[COPY4:%[0-9]+]]:_(s32) = COPY [[SUB]](s32)
204    ; MIPS32: $v0 = COPY [[COPY4]](s32)
205    ; MIPS32: RetRA implicit $v0
206    %2:_(s32) = COPY $a0
207    %0:_(s16) = G_TRUNC %2(s32)
208    %3:_(s32) = COPY $a1
209    %1:_(s16) = G_TRUNC %3(s32)
210    %4:_(s16) = G_SUB %1, %0
211    %5:_(s32) = G_ANYEXT %4(s16)
212    $v0 = COPY %5(s32)
213    RetRA implicit $v0
214
215...
216---
217name:            sub_i64
218alignment:       4
219tracksRegLiveness: true
220body:             |
221  bb.1.entry:
222    liveins: $a0, $a1, $a2, $a3
223
224    ; MIPS32-LABEL: name: sub_i64
225    ; MIPS32: liveins: $a0, $a1, $a2, $a3
226    ; MIPS32: [[COPY:%[0-9]+]]:_(s32) = COPY $a0
227    ; MIPS32: [[COPY1:%[0-9]+]]:_(s32) = COPY $a1
228    ; MIPS32: [[COPY2:%[0-9]+]]:_(s32) = COPY $a2
229    ; MIPS32: [[COPY3:%[0-9]+]]:_(s32) = COPY $a3
230    ; MIPS32: [[SUB:%[0-9]+]]:_(s32) = G_SUB [[COPY3]], [[COPY1]]
231    ; MIPS32: [[ICMP:%[0-9]+]]:_(s32) = G_ICMP intpred(ult), [[COPY3]](s32), [[COPY1]]
232    ; MIPS32: [[SUB1:%[0-9]+]]:_(s32) = G_SUB [[COPY2]], [[COPY]]
233    ; MIPS32: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 1
234    ; MIPS32: [[COPY4:%[0-9]+]]:_(s32) = COPY [[ICMP]](s32)
235    ; MIPS32: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY4]], [[C]]
236    ; MIPS32: [[SUB2:%[0-9]+]]:_(s32) = G_SUB [[SUB1]], [[AND]]
237    ; MIPS32: $v0 = COPY [[SUB2]](s32)
238    ; MIPS32: $v1 = COPY [[SUB]](s32)
239    ; MIPS32: RetRA implicit $v0, implicit $v1
240    %2:_(s32) = COPY $a0
241    %3:_(s32) = COPY $a1
242    %0:_(s64) = G_MERGE_VALUES %3(s32), %2(s32)
243    %4:_(s32) = COPY $a2
244    %5:_(s32) = COPY $a3
245    %1:_(s64) = G_MERGE_VALUES %5(s32), %4(s32)
246    %6:_(s64) = G_SUB %1, %0
247    %7:_(s32), %8:_(s32) = G_UNMERGE_VALUES %6(s64)
248    $v0 = COPY %8(s32)
249    $v1 = COPY %7(s32)
250    RetRA implicit $v0, implicit $v1
251
252...
253---
254name:            sub_i128
255alignment:       4
256tracksRegLiveness: true
257fixedStack:
258  - { id: 0, offset: 28, size: 4, alignment: 4, stack-id: default, isImmutable: true }
259  - { id: 1, offset: 24, size: 4, alignment: 8, stack-id: default, isImmutable: true }
260  - { id: 2, offset: 20, size: 4, alignment: 4, stack-id: default, isImmutable: true }
261  - { id: 3, offset: 16, size: 4, alignment: 8, stack-id: default, isImmutable: true }
262body:             |
263  bb.1.entry:
264    liveins: $a0, $a1, $a2, $a3
265
266    ; MIPS32-LABEL: name: sub_i128
267    ; MIPS32: liveins: $a0, $a1, $a2, $a3
268    ; MIPS32: [[COPY:%[0-9]+]]:_(s32) = COPY $a0
269    ; MIPS32: [[COPY1:%[0-9]+]]:_(s32) = COPY $a1
270    ; MIPS32: [[COPY2:%[0-9]+]]:_(s32) = COPY $a2
271    ; MIPS32: [[COPY3:%[0-9]+]]:_(s32) = COPY $a3
272    ; MIPS32: [[FRAME_INDEX:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.0
273    ; MIPS32: [[LOAD:%[0-9]+]]:_(s32) = G_LOAD [[FRAME_INDEX]](p0) :: (load 4 from %fixed-stack.0, align 8)
274    ; MIPS32: [[FRAME_INDEX1:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.1
275    ; MIPS32: [[LOAD1:%[0-9]+]]:_(s32) = G_LOAD [[FRAME_INDEX1]](p0) :: (load 4 from %fixed-stack.1)
276    ; MIPS32: [[FRAME_INDEX2:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.2
277    ; MIPS32: [[LOAD2:%[0-9]+]]:_(s32) = G_LOAD [[FRAME_INDEX2]](p0) :: (load 4 from %fixed-stack.2, align 8)
278    ; MIPS32: [[FRAME_INDEX3:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.3
279    ; MIPS32: [[LOAD3:%[0-9]+]]:_(s32) = G_LOAD [[FRAME_INDEX3]](p0) :: (load 4 from %fixed-stack.3)
280    ; MIPS32: [[SUB:%[0-9]+]]:_(s32) = G_SUB [[LOAD]], [[COPY]]
281    ; MIPS32: [[ICMP:%[0-9]+]]:_(s32) = G_ICMP intpred(ult), [[LOAD]](s32), [[COPY]]
282    ; MIPS32: [[SUB1:%[0-9]+]]:_(s32) = G_SUB [[LOAD1]], [[COPY1]]
283    ; MIPS32: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 1
284    ; MIPS32: [[COPY4:%[0-9]+]]:_(s32) = COPY [[ICMP]](s32)
285    ; MIPS32: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY4]], [[C]]
286    ; MIPS32: [[SUB2:%[0-9]+]]:_(s32) = G_SUB [[SUB1]], [[AND]]
287    ; MIPS32: [[ICMP1:%[0-9]+]]:_(s32) = G_ICMP intpred(eq), [[LOAD1]](s32), [[COPY1]]
288    ; MIPS32: [[ICMP2:%[0-9]+]]:_(s32) = G_ICMP intpred(ult), [[LOAD1]](s32), [[COPY1]]
289    ; MIPS32: [[COPY5:%[0-9]+]]:_(s32) = COPY [[ICMP]](s32)
290    ; MIPS32: [[COPY6:%[0-9]+]]:_(s32) = COPY [[ICMP2]](s32)
291    ; MIPS32: [[COPY7:%[0-9]+]]:_(s32) = COPY [[ICMP1]](s32)
292    ; MIPS32: [[AND1:%[0-9]+]]:_(s32) = G_AND [[COPY7]], [[C]]
293    ; MIPS32: [[SELECT:%[0-9]+]]:_(s32) = G_SELECT [[AND1]](s32), [[COPY5]], [[COPY6]]
294    ; MIPS32: [[SUB3:%[0-9]+]]:_(s32) = G_SUB [[LOAD2]], [[COPY2]]
295    ; MIPS32: [[COPY8:%[0-9]+]]:_(s32) = COPY [[SELECT]](s32)
296    ; MIPS32: [[AND2:%[0-9]+]]:_(s32) = G_AND [[COPY8]], [[C]]
297    ; MIPS32: [[SUB4:%[0-9]+]]:_(s32) = G_SUB [[SUB3]], [[AND2]]
298    ; MIPS32: [[ICMP3:%[0-9]+]]:_(s32) = G_ICMP intpred(eq), [[LOAD2]](s32), [[COPY2]]
299    ; MIPS32: [[ICMP4:%[0-9]+]]:_(s32) = G_ICMP intpred(ult), [[LOAD2]](s32), [[COPY2]]
300    ; MIPS32: [[COPY9:%[0-9]+]]:_(s32) = COPY [[SELECT]](s32)
301    ; MIPS32: [[COPY10:%[0-9]+]]:_(s32) = COPY [[ICMP4]](s32)
302    ; MIPS32: [[COPY11:%[0-9]+]]:_(s32) = COPY [[ICMP3]](s32)
303    ; MIPS32: [[AND3:%[0-9]+]]:_(s32) = G_AND [[COPY11]], [[C]]
304    ; MIPS32: [[SELECT1:%[0-9]+]]:_(s32) = G_SELECT [[AND3]](s32), [[COPY9]], [[COPY10]]
305    ; MIPS32: [[SUB5:%[0-9]+]]:_(s32) = G_SUB [[LOAD3]], [[COPY3]]
306    ; MIPS32: [[COPY12:%[0-9]+]]:_(s32) = COPY [[SELECT1]](s32)
307    ; MIPS32: [[AND4:%[0-9]+]]:_(s32) = G_AND [[COPY12]], [[C]]
308    ; MIPS32: [[SUB6:%[0-9]+]]:_(s32) = G_SUB [[SUB5]], [[AND4]]
309    ; MIPS32: $v0 = COPY [[SUB]](s32)
310    ; MIPS32: $v1 = COPY [[SUB2]](s32)
311    ; MIPS32: $a0 = COPY [[SUB4]](s32)
312    ; MIPS32: $a1 = COPY [[SUB6]](s32)
313    ; MIPS32: RetRA implicit $v0, implicit $v1, implicit $a0, implicit $a1
314    %2:_(s32) = COPY $a0
315    %3:_(s32) = COPY $a1
316    %4:_(s32) = COPY $a2
317    %5:_(s32) = COPY $a3
318    %0:_(s128) = G_MERGE_VALUES %2(s32), %3(s32), %4(s32), %5(s32)
319    %10:_(p0) = G_FRAME_INDEX %fixed-stack.3
320    %6:_(s32) = G_LOAD %10(p0) :: (load 4 from %fixed-stack.3, align 8)
321    %11:_(p0) = G_FRAME_INDEX %fixed-stack.2
322    %7:_(s32) = G_LOAD %11(p0) :: (load 4 from %fixed-stack.2, align 4)
323    %12:_(p0) = G_FRAME_INDEX %fixed-stack.1
324    %8:_(s32) = G_LOAD %12(p0) :: (load 4 from %fixed-stack.1, align 8)
325    %13:_(p0) = G_FRAME_INDEX %fixed-stack.0
326    %9:_(s32) = G_LOAD %13(p0) :: (load 4 from %fixed-stack.0, align 4)
327    %1:_(s128) = G_MERGE_VALUES %6(s32), %7(s32), %8(s32), %9(s32)
328    %14:_(s128) = G_SUB %1, %0
329    %15:_(s32), %16:_(s32), %17:_(s32), %18:_(s32) = G_UNMERGE_VALUES %14(s128)
330    $v0 = COPY %15(s32)
331    $v1 = COPY %16(s32)
332    $a0 = COPY %17(s32)
333    $a1 = COPY %18(s32)
334    RetRA implicit $v0, implicit $v1, implicit $a0, implicit $a1
335
336...
337