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
5 define void @add_i32() {entry: ret void}
6 define void @add_i8_sext() {entry: ret void}
7 define void @add_i8_zext() {entry: ret void}
8 define void @add_i8_aext() {entry: ret void}
9 define void @add_i16_sext() {entry: ret void}
10 define void @add_i16_zext() {entry: ret void}
11 define void @add_i16_aext() {entry: ret void}
12 define void @add_i64() {entry: ret void}
18 tracksRegLiveness: true
23 ; MIPS32-LABEL: name: add_i32
24 ; MIPS32: liveins: $a0, $a1
25 ; MIPS32: [[COPY:%[0-9]+]]:_(s32) = COPY $a0
26 ; MIPS32: [[COPY1:%[0-9]+]]:_(s32) = COPY $a1
27 ; MIPS32: [[ADD:%[0-9]+]]:_(s32) = G_ADD [[COPY]], [[COPY1]]
28 ; MIPS32: $v0 = COPY [[ADD]](s32)
29 ; MIPS32: RetRA implicit $v0
32 %2:_(s32) = G_ADD %0, %1
40 tracksRegLiveness: true
45 ; MIPS32-LABEL: name: add_i8_sext
46 ; MIPS32: liveins: $a0, $a1
47 ; MIPS32: [[COPY:%[0-9]+]]:_(s32) = COPY $a0
48 ; MIPS32: [[COPY1:%[0-9]+]]:_(s32) = COPY $a1
49 ; MIPS32: [[COPY2:%[0-9]+]]:_(s32) = COPY [[COPY1]](s32)
50 ; MIPS32: [[COPY3:%[0-9]+]]:_(s32) = COPY [[COPY]](s32)
51 ; MIPS32: [[ADD:%[0-9]+]]:_(s32) = G_ADD [[COPY2]], [[COPY3]]
52 ; MIPS32: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 24
53 ; MIPS32: [[COPY4:%[0-9]+]]:_(s32) = COPY [[ADD]](s32)
54 ; MIPS32: [[SHL:%[0-9]+]]:_(s32) = G_SHL [[COPY4]], [[C]]
55 ; MIPS32: [[ASHR:%[0-9]+]]:_(s32) = G_ASHR [[SHL]], [[C]]
56 ; MIPS32: $v0 = COPY [[ASHR]](s32)
57 ; MIPS32: RetRA implicit $v0
59 %0:_(s8) = G_TRUNC %2(s32)
61 %1:_(s8) = G_TRUNC %3(s32)
62 %4:_(s8) = G_ADD %1, %0
63 %5:_(s32) = G_SEXT %4(s8)
71 tracksRegLiveness: true
76 ; MIPS32-LABEL: name: add_i8_zext
77 ; MIPS32: liveins: $a0, $a1
78 ; MIPS32: [[COPY:%[0-9]+]]:_(s32) = COPY $a0
79 ; MIPS32: [[COPY1:%[0-9]+]]:_(s32) = COPY $a1
80 ; MIPS32: [[COPY2:%[0-9]+]]:_(s32) = COPY [[COPY1]](s32)
81 ; MIPS32: [[COPY3:%[0-9]+]]:_(s32) = COPY [[COPY]](s32)
82 ; MIPS32: [[ADD:%[0-9]+]]:_(s32) = G_ADD [[COPY2]], [[COPY3]]
83 ; MIPS32: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 255
84 ; MIPS32: [[COPY4:%[0-9]+]]:_(s32) = COPY [[ADD]](s32)
85 ; MIPS32: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY4]], [[C]]
86 ; MIPS32: $v0 = COPY [[AND]](s32)
87 ; MIPS32: RetRA implicit $v0
89 %0:_(s8) = G_TRUNC %2(s32)
91 %1:_(s8) = G_TRUNC %3(s32)
92 %4:_(s8) = G_ADD %1, %0
93 %5:_(s32) = G_ZEXT %4(s8)
101 tracksRegLiveness: true
106 ; MIPS32-LABEL: name: add_i8_aext
107 ; MIPS32: liveins: $a0, $a1
108 ; MIPS32: [[COPY:%[0-9]+]]:_(s32) = COPY $a0
109 ; MIPS32: [[COPY1:%[0-9]+]]:_(s32) = COPY $a1
110 ; MIPS32: [[COPY2:%[0-9]+]]:_(s32) = COPY [[COPY1]](s32)
111 ; MIPS32: [[COPY3:%[0-9]+]]:_(s32) = COPY [[COPY]](s32)
112 ; MIPS32: [[ADD:%[0-9]+]]:_(s32) = G_ADD [[COPY2]], [[COPY3]]
113 ; MIPS32: [[COPY4:%[0-9]+]]:_(s32) = COPY [[ADD]](s32)
114 ; MIPS32: $v0 = COPY [[COPY4]](s32)
115 ; MIPS32: RetRA implicit $v0
117 %0:_(s8) = G_TRUNC %2(s32)
119 %1:_(s8) = G_TRUNC %3(s32)
120 %4:_(s8) = G_ADD %1, %0
121 %5:_(s32) = G_ANYEXT %4(s8)
129 tracksRegLiveness: true
134 ; MIPS32-LABEL: name: add_i16_sext
135 ; MIPS32: liveins: $a0, $a1
136 ; MIPS32: [[COPY:%[0-9]+]]:_(s32) = COPY $a0
137 ; MIPS32: [[COPY1:%[0-9]+]]:_(s32) = COPY $a1
138 ; MIPS32: [[COPY2:%[0-9]+]]:_(s32) = COPY [[COPY1]](s32)
139 ; MIPS32: [[COPY3:%[0-9]+]]:_(s32) = COPY [[COPY]](s32)
140 ; MIPS32: [[ADD:%[0-9]+]]:_(s32) = G_ADD [[COPY2]], [[COPY3]]
141 ; MIPS32: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 16
142 ; MIPS32: [[COPY4:%[0-9]+]]:_(s32) = COPY [[ADD]](s32)
143 ; MIPS32: [[SHL:%[0-9]+]]:_(s32) = G_SHL [[COPY4]], [[C]]
144 ; MIPS32: [[ASHR:%[0-9]+]]:_(s32) = G_ASHR [[SHL]], [[C]]
145 ; MIPS32: $v0 = COPY [[ASHR]](s32)
146 ; MIPS32: RetRA implicit $v0
148 %0:_(s16) = G_TRUNC %2(s32)
150 %1:_(s16) = G_TRUNC %3(s32)
151 %4:_(s16) = G_ADD %1, %0
152 %5:_(s32) = G_SEXT %4(s16)
160 tracksRegLiveness: true
165 ; MIPS32-LABEL: name: add_i16_zext
166 ; MIPS32: liveins: $a0, $a1
167 ; MIPS32: [[COPY:%[0-9]+]]:_(s32) = COPY $a0
168 ; MIPS32: [[COPY1:%[0-9]+]]:_(s32) = COPY $a1
169 ; MIPS32: [[COPY2:%[0-9]+]]:_(s32) = COPY [[COPY1]](s32)
170 ; MIPS32: [[COPY3:%[0-9]+]]:_(s32) = COPY [[COPY]](s32)
171 ; MIPS32: [[ADD:%[0-9]+]]:_(s32) = G_ADD [[COPY2]], [[COPY3]]
172 ; MIPS32: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 65535
173 ; MIPS32: [[COPY4:%[0-9]+]]:_(s32) = COPY [[ADD]](s32)
174 ; MIPS32: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY4]], [[C]]
175 ; MIPS32: $v0 = COPY [[AND]](s32)
176 ; MIPS32: RetRA implicit $v0
178 %0:_(s16) = G_TRUNC %2(s32)
180 %1:_(s16) = G_TRUNC %3(s32)
181 %4:_(s16) = G_ADD %1, %0
182 %5:_(s32) = G_ZEXT %4(s16)
190 tracksRegLiveness: true
195 ; MIPS32-LABEL: name: add_i16_aext
196 ; MIPS32: liveins: $a0, $a1
197 ; MIPS32: [[COPY:%[0-9]+]]:_(s32) = COPY $a0
198 ; MIPS32: [[COPY1:%[0-9]+]]:_(s32) = COPY $a1
199 ; MIPS32: [[COPY2:%[0-9]+]]:_(s32) = COPY [[COPY1]](s32)
200 ; MIPS32: [[COPY3:%[0-9]+]]:_(s32) = COPY [[COPY]](s32)
201 ; MIPS32: [[ADD:%[0-9]+]]:_(s32) = G_ADD [[COPY2]], [[COPY3]]
202 ; MIPS32: [[COPY4:%[0-9]+]]:_(s32) = COPY [[ADD]](s32)
203 ; MIPS32: $v0 = COPY [[COPY4]](s32)
204 ; MIPS32: RetRA implicit $v0
206 %0:_(s16) = G_TRUNC %2(s32)
208 %1:_(s16) = G_TRUNC %3(s32)
209 %4:_(s16) = G_ADD %1, %0
210 %5:_(s32) = G_ANYEXT %4(s16)
218 tracksRegLiveness: true
221 liveins: $a0, $a1, $a2, $a3
223 ; MIPS32-LABEL: name: add_i64
224 ; MIPS32: liveins: $a0, $a1, $a2, $a3
225 ; MIPS32: [[COPY:%[0-9]+]]:_(s32) = COPY $a0
226 ; MIPS32: [[COPY1:%[0-9]+]]:_(s32) = COPY $a1
227 ; MIPS32: [[COPY2:%[0-9]+]]:_(s32) = COPY $a2
228 ; MIPS32: [[COPY3:%[0-9]+]]:_(s32) = COPY $a3
229 ; MIPS32: [[ADD:%[0-9]+]]:_(s32) = G_ADD [[COPY2]], [[COPY]]
230 ; MIPS32: [[ADD1:%[0-9]+]]:_(s32) = G_ADD [[COPY3]], [[COPY1]]
231 ; MIPS32: [[ICMP:%[0-9]+]]:_(s32) = G_ICMP intpred(ult), [[ADD1]](s32), [[COPY3]]
232 ; MIPS32: [[ADD2:%[0-9]+]]:_(s32) = G_ADD [[ADD]], [[ICMP]]
233 ; MIPS32: $v0 = COPY [[ADD2]](s32)
234 ; MIPS32: $v1 = COPY [[ADD1]](s32)
235 ; MIPS32: RetRA implicit $v0, implicit $v1
238 %0:_(s64) = G_MERGE_VALUES %3(s32), %2(s32)
241 %1:_(s64) = G_MERGE_VALUES %5(s32), %4(s32)
242 %6:_(s64) = G_ADD %1, %0
243 %7:_(s32), %8:_(s32) = G_UNMERGE_VALUES %6(s64)
246 RetRA implicit $v0, implicit $v1