1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py UTC_ARGS: --version 5
2 # RUN: llc -mtriple=riscv32 -run-pass=legalizer %s -o - \
3 # RUN: | FileCheck %s --check-prefixes=CHECK,RV32I
4 # RUN: llc -mtriple=riscv32 -mattr=+zbb -run-pass=legalizer %s -o - \
5 # RUN: | FileCheck %s --check-prefixes=CHECK,RV32ZBB
13 ; RV32I-LABEL: name: uaddsat_i32
14 ; RV32I: liveins: $x10, $x11
16 ; RV32I-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $x10
17 ; RV32I-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x11
18 ; RV32I-NEXT: [[ADD:%[0-9]+]]:_(s32) = G_ADD [[COPY]], [[COPY1]]
19 ; RV32I-NEXT: [[ICMP:%[0-9]+]]:_(s32) = G_ICMP intpred(ult), [[ADD]](s32), [[COPY1]]
20 ; RV32I-NEXT: [[COPY2:%[0-9]+]]:_(s32) = COPY [[ADD]](s32)
21 ; RV32I-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 -1
22 ; RV32I-NEXT: [[SELECT:%[0-9]+]]:_(s32) = G_SELECT [[ICMP]](s32), [[C]], [[COPY2]]
23 ; RV32I-NEXT: $x10 = COPY [[SELECT]](s32)
24 ; RV32I-NEXT: PseudoRET implicit $x10
26 ; RV32ZBB-LABEL: name: uaddsat_i32
27 ; RV32ZBB: liveins: $x10, $x11
28 ; RV32ZBB-NEXT: {{ $}}
29 ; RV32ZBB-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $x10
30 ; RV32ZBB-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x11
31 ; RV32ZBB-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 -1
32 ; RV32ZBB-NEXT: [[XOR:%[0-9]+]]:_(s32) = G_XOR [[COPY]], [[C]]
33 ; RV32ZBB-NEXT: [[UMIN:%[0-9]+]]:_(s32) = G_UMIN [[XOR]], [[COPY1]]
34 ; RV32ZBB-NEXT: [[ADD:%[0-9]+]]:_(s32) = G_ADD [[COPY]], [[UMIN]]
35 ; RV32ZBB-NEXT: $x10 = COPY [[ADD]](s32)
36 ; RV32ZBB-NEXT: PseudoRET implicit $x10
39 %2:_(s32) = G_UADDSAT %0, %1(s32)
41 PseudoRET implicit $x10
49 ; CHECK-LABEL: name: uaddsat_i64
50 ; CHECK: liveins: $x10, $x11
52 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $x10
53 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x11
54 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:_(s32) = COPY $x12
55 ; CHECK-NEXT: [[COPY3:%[0-9]+]]:_(s32) = COPY $x13
56 ; CHECK-NEXT: [[ADD:%[0-9]+]]:_(s32) = G_ADD [[COPY]], [[COPY2]]
57 ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s32) = G_ICMP intpred(ult), [[ADD]](s32), [[COPY2]]
58 ; CHECK-NEXT: [[COPY4:%[0-9]+]]:_(s32) = COPY [[ADD]](s32)
59 ; CHECK-NEXT: [[ADD1:%[0-9]+]]:_(s32) = G_ADD [[COPY1]], [[COPY3]]
60 ; CHECK-NEXT: [[ADD2:%[0-9]+]]:_(s32) = G_ADD [[ADD1]], [[ICMP]]
61 ; CHECK-NEXT: [[COPY5:%[0-9]+]]:_(s32) = COPY [[ADD2]](s32)
62 ; CHECK-NEXT: [[ICMP1:%[0-9]+]]:_(s32) = G_ICMP intpred(ult), [[COPY4]](s32), [[COPY2]]
63 ; CHECK-NEXT: [[ICMP2:%[0-9]+]]:_(s32) = G_ICMP intpred(ult), [[COPY5]](s32), [[COPY3]]
64 ; CHECK-NEXT: [[ICMP3:%[0-9]+]]:_(s32) = G_ICMP intpred(eq), [[COPY5]](s32), [[COPY3]]
65 ; CHECK-NEXT: [[SELECT:%[0-9]+]]:_(s32) = G_SELECT [[ICMP3]](s32), [[ICMP1]], [[ICMP2]]
66 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 -1
67 ; CHECK-NEXT: [[SELECT1:%[0-9]+]]:_(s32) = G_SELECT [[SELECT]](s32), [[C]], [[COPY4]]
68 ; CHECK-NEXT: [[SELECT2:%[0-9]+]]:_(s32) = G_SELECT [[SELECT]](s32), [[C]], [[COPY5]]
69 ; CHECK-NEXT: $x10 = COPY [[SELECT1]](s32)
70 ; CHECK-NEXT: $x11 = COPY [[SELECT2]](s32)
71 ; CHECK-NEXT: PseudoRET implicit $x10, implicit $x11
74 %0:_(s64) = G_MERGE_VALUES %2(s32), %3(s32)
77 %1:_(s64) = G_MERGE_VALUES %4(s32), %5(s32)
78 %6:_(s64) = G_UADDSAT %0, %1(s64)
79 %7:_(s32), %8:_(s32) = G_UNMERGE_VALUES %6(s64)
82 PseudoRET implicit $x10, implicit $x11
91 ; RV32I-LABEL: name: saddsat_i32
92 ; RV32I: liveins: $x10, $x11
94 ; RV32I-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $x10
95 ; RV32I-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x11
96 ; RV32I-NEXT: [[ADD:%[0-9]+]]:_(s32) = G_ADD [[COPY]], [[COPY1]]
97 ; RV32I-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 0
98 ; RV32I-NEXT: [[ICMP:%[0-9]+]]:_(s32) = G_ICMP intpred(slt), [[ADD]](s32), [[COPY]]
99 ; RV32I-NEXT: [[ICMP1:%[0-9]+]]:_(s32) = G_ICMP intpred(slt), [[COPY1]](s32), [[C]]
100 ; RV32I-NEXT: [[XOR:%[0-9]+]]:_(s32) = G_XOR [[ICMP1]], [[ICMP]]
101 ; RV32I-NEXT: [[COPY2:%[0-9]+]]:_(s32) = COPY [[ADD]](s32)
102 ; RV32I-NEXT: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 31
103 ; RV32I-NEXT: [[ASHR:%[0-9]+]]:_(s32) = G_ASHR [[COPY2]], [[C1]](s32)
104 ; RV32I-NEXT: [[C2:%[0-9]+]]:_(s32) = G_CONSTANT i32 -2147483648
105 ; RV32I-NEXT: [[ADD1:%[0-9]+]]:_(s32) = G_ADD [[ASHR]], [[C2]]
106 ; RV32I-NEXT: [[SELECT:%[0-9]+]]:_(s32) = G_SELECT [[XOR]](s32), [[ADD1]], [[COPY2]]
107 ; RV32I-NEXT: $x10 = COPY [[SELECT]](s32)
108 ; RV32I-NEXT: PseudoRET implicit $x10
110 ; RV32ZBB-LABEL: name: saddsat_i32
111 ; RV32ZBB: liveins: $x10, $x11
112 ; RV32ZBB-NEXT: {{ $}}
113 ; RV32ZBB-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $x10
114 ; RV32ZBB-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x11
115 ; RV32ZBB-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 2147483647
116 ; RV32ZBB-NEXT: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 -2147483648
117 ; RV32ZBB-NEXT: [[C2:%[0-9]+]]:_(s32) = G_CONSTANT i32 0
118 ; RV32ZBB-NEXT: [[SMAX:%[0-9]+]]:_(s32) = G_SMAX [[COPY]], [[C2]]
119 ; RV32ZBB-NEXT: [[SUB:%[0-9]+]]:_(s32) = G_SUB [[C]], [[SMAX]]
120 ; RV32ZBB-NEXT: [[SMIN:%[0-9]+]]:_(s32) = G_SMIN [[COPY]], [[C2]]
121 ; RV32ZBB-NEXT: [[SUB1:%[0-9]+]]:_(s32) = G_SUB [[C1]], [[SMIN]]
122 ; RV32ZBB-NEXT: [[SMAX1:%[0-9]+]]:_(s32) = G_SMAX [[SUB1]], [[COPY1]]
123 ; RV32ZBB-NEXT: [[SMIN1:%[0-9]+]]:_(s32) = G_SMIN [[SMAX1]], [[SUB]]
124 ; RV32ZBB-NEXT: [[ADD:%[0-9]+]]:_(s32) = G_ADD [[COPY]], [[SMIN1]]
125 ; RV32ZBB-NEXT: $x10 = COPY [[ADD]](s32)
126 ; RV32ZBB-NEXT: PseudoRET implicit $x10
127 %0:_(s32) = COPY $x10
128 %1:_(s32) = COPY $x11
129 %2:_(s32) = G_SADDSAT %0, %1(s32)
131 PseudoRET implicit $x10
139 ; CHECK-LABEL: name: saddsat_i64
140 ; CHECK: liveins: $x10, $x11
142 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $x10
143 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x11
144 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:_(s32) = COPY $x12
145 ; CHECK-NEXT: [[COPY3:%[0-9]+]]:_(s32) = COPY $x13
146 ; CHECK-NEXT: [[ADD:%[0-9]+]]:_(s32) = G_ADD [[COPY]], [[COPY2]]
147 ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s32) = G_ICMP intpred(ult), [[ADD]](s32), [[COPY2]]
148 ; CHECK-NEXT: [[COPY4:%[0-9]+]]:_(s32) = COPY [[ADD]](s32)
149 ; CHECK-NEXT: [[ADD1:%[0-9]+]]:_(s32) = G_ADD [[COPY1]], [[COPY3]]
150 ; CHECK-NEXT: [[ADD2:%[0-9]+]]:_(s32) = G_ADD [[ADD1]], [[ICMP]]
151 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 0
152 ; CHECK-NEXT: [[COPY5:%[0-9]+]]:_(s32) = COPY [[ADD2]](s32)
153 ; CHECK-NEXT: [[ICMP1:%[0-9]+]]:_(s32) = G_ICMP intpred(ult), [[COPY4]](s32), [[COPY]]
154 ; CHECK-NEXT: [[ICMP2:%[0-9]+]]:_(s32) = G_ICMP intpred(slt), [[COPY5]](s32), [[COPY1]]
155 ; CHECK-NEXT: [[ICMP3:%[0-9]+]]:_(s32) = G_ICMP intpred(eq), [[COPY5]](s32), [[COPY1]]
156 ; CHECK-NEXT: [[SELECT:%[0-9]+]]:_(s32) = G_SELECT [[ICMP3]](s32), [[ICMP1]], [[ICMP2]]
157 ; CHECK-NEXT: [[ICMP4:%[0-9]+]]:_(s32) = G_ICMP intpred(ult), [[COPY2]](s32), [[C]]
158 ; CHECK-NEXT: [[ICMP5:%[0-9]+]]:_(s32) = G_ICMP intpred(slt), [[COPY3]](s32), [[C]]
159 ; CHECK-NEXT: [[ICMP6:%[0-9]+]]:_(s32) = G_ICMP intpred(eq), [[COPY3]](s32), [[C]]
160 ; CHECK-NEXT: [[SELECT1:%[0-9]+]]:_(s32) = G_SELECT [[ICMP6]](s32), [[ICMP4]], [[ICMP5]]
161 ; CHECK-NEXT: [[XOR:%[0-9]+]]:_(s32) = G_XOR [[SELECT1]], [[SELECT]]
162 ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 31
163 ; CHECK-NEXT: [[ASHR:%[0-9]+]]:_(s32) = G_ASHR [[COPY5]], [[C1]](s32)
164 ; CHECK-NEXT: [[C2:%[0-9]+]]:_(s32) = G_CONSTANT i32 -2147483648
165 ; CHECK-NEXT: [[ADD3:%[0-9]+]]:_(s32) = G_ADD [[ASHR]], [[C]]
166 ; CHECK-NEXT: [[ICMP7:%[0-9]+]]:_(s32) = G_ICMP intpred(ult), [[ADD3]](s32), [[C]]
167 ; CHECK-NEXT: [[COPY6:%[0-9]+]]:_(s32) = COPY [[ADD3]](s32)
168 ; CHECK-NEXT: [[ADD4:%[0-9]+]]:_(s32) = G_ADD [[ASHR]], [[C2]]
169 ; CHECK-NEXT: [[ADD5:%[0-9]+]]:_(s32) = G_ADD [[ADD4]], [[ICMP7]]
170 ; CHECK-NEXT: [[COPY7:%[0-9]+]]:_(s32) = COPY [[ADD5]](s32)
171 ; CHECK-NEXT: [[SELECT2:%[0-9]+]]:_(s32) = G_SELECT [[XOR]](s32), [[COPY6]], [[COPY4]]
172 ; CHECK-NEXT: [[SELECT3:%[0-9]+]]:_(s32) = G_SELECT [[XOR]](s32), [[COPY7]], [[COPY5]]
173 ; CHECK-NEXT: $x10 = COPY [[SELECT2]](s32)
174 ; CHECK-NEXT: $x11 = COPY [[SELECT3]](s32)
175 ; CHECK-NEXT: PseudoRET implicit $x10, implicit $x11
176 %2:_(s32) = COPY $x10
177 %3:_(s32) = COPY $x11
178 %0:_(s64) = G_MERGE_VALUES %2(s32), %3(s32)
179 %4:_(s32) = COPY $x12
180 %5:_(s32) = COPY $x13
181 %1:_(s64) = G_MERGE_VALUES %4(s32), %5(s32)
182 %6:_(s64) = G_SADDSAT %0, %1(s64)
183 %7:_(s32), %8:_(s32) = G_UNMERGE_VALUES %6(s64)
186 PseudoRET implicit $x10, implicit $x11
195 ; RV32I-LABEL: name: usubsat_i32
196 ; RV32I: liveins: $x10, $x11
198 ; RV32I-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $x10
199 ; RV32I-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x11
200 ; RV32I-NEXT: [[SUB:%[0-9]+]]:_(s32) = G_SUB [[COPY]], [[COPY1]]
201 ; RV32I-NEXT: [[ICMP:%[0-9]+]]:_(s32) = G_ICMP intpred(ult), [[COPY]](s32), [[COPY1]]
202 ; RV32I-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 0
203 ; RV32I-NEXT: [[SELECT:%[0-9]+]]:_(s32) = G_SELECT [[ICMP]](s32), [[C]], [[SUB]]
204 ; RV32I-NEXT: $x10 = COPY [[SELECT]](s32)
205 ; RV32I-NEXT: PseudoRET implicit $x10
207 ; RV32ZBB-LABEL: name: usubsat_i32
208 ; RV32ZBB: liveins: $x10, $x11
209 ; RV32ZBB-NEXT: {{ $}}
210 ; RV32ZBB-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $x10
211 ; RV32ZBB-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x11
212 ; RV32ZBB-NEXT: [[UMIN:%[0-9]+]]:_(s32) = G_UMIN [[COPY]], [[COPY1]]
213 ; RV32ZBB-NEXT: [[SUB:%[0-9]+]]:_(s32) = G_SUB [[COPY]], [[UMIN]]
214 ; RV32ZBB-NEXT: $x10 = COPY [[SUB]](s32)
215 ; RV32ZBB-NEXT: PseudoRET implicit $x10
216 %0:_(s32) = COPY $x10
217 %1:_(s32) = COPY $x11
218 %2:_(s32) = G_USUBSAT %0, %1(s32)
220 PseudoRET implicit $x10
228 ; CHECK-LABEL: name: usubsat_i64
229 ; CHECK: liveins: $x10, $x11
231 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $x10
232 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x11
233 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:_(s32) = COPY $x12
234 ; CHECK-NEXT: [[COPY3:%[0-9]+]]:_(s32) = COPY $x13
235 ; CHECK-NEXT: [[SUB:%[0-9]+]]:_(s32) = G_SUB [[COPY]], [[COPY2]]
236 ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s32) = G_ICMP intpred(ult), [[COPY]](s32), [[COPY2]]
237 ; CHECK-NEXT: [[SUB1:%[0-9]+]]:_(s32) = G_SUB [[COPY1]], [[COPY3]]
238 ; CHECK-NEXT: [[SUB2:%[0-9]+]]:_(s32) = G_SUB [[SUB1]], [[ICMP]]
239 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 0
240 ; CHECK-NEXT: [[ICMP1:%[0-9]+]]:_(s32) = G_ICMP intpred(ult), [[COPY]](s32), [[COPY2]]
241 ; CHECK-NEXT: [[ICMP2:%[0-9]+]]:_(s32) = G_ICMP intpred(ult), [[COPY1]](s32), [[COPY3]]
242 ; CHECK-NEXT: [[ICMP3:%[0-9]+]]:_(s32) = G_ICMP intpred(eq), [[COPY1]](s32), [[COPY3]]
243 ; CHECK-NEXT: [[SELECT:%[0-9]+]]:_(s32) = G_SELECT [[ICMP3]](s32), [[ICMP1]], [[ICMP2]]
244 ; CHECK-NEXT: [[SELECT1:%[0-9]+]]:_(s32) = G_SELECT [[SELECT]](s32), [[C]], [[SUB]]
245 ; CHECK-NEXT: [[SELECT2:%[0-9]+]]:_(s32) = G_SELECT [[SELECT]](s32), [[C]], [[SUB2]]
246 ; CHECK-NEXT: $x10 = COPY [[SELECT1]](s32)
247 ; CHECK-NEXT: $x11 = COPY [[SELECT2]](s32)
248 ; CHECK-NEXT: PseudoRET implicit $x10, implicit $x11
249 %2:_(s32) = COPY $x10
250 %3:_(s32) = COPY $x11
251 %0:_(s64) = G_MERGE_VALUES %2(s32), %3(s32)
252 %4:_(s32) = COPY $x12
253 %5:_(s32) = COPY $x13
254 %1:_(s64) = G_MERGE_VALUES %4(s32), %5(s32)
255 %6:_(s64) = G_USUBSAT %0, %1(s64)
256 %7:_(s32), %8:_(s32) = G_UNMERGE_VALUES %6(s64)
259 PseudoRET implicit $x10, implicit $x11
268 ; RV32I-LABEL: name: ssubsat_i32
269 ; RV32I: liveins: $x10, $x11
271 ; RV32I-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $x10
272 ; RV32I-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x11
273 ; RV32I-NEXT: [[SUB:%[0-9]+]]:_(s32) = G_SUB [[COPY]], [[COPY1]]
274 ; RV32I-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 0
275 ; RV32I-NEXT: [[ICMP:%[0-9]+]]:_(s32) = G_ICMP intpred(slt), [[SUB]](s32), [[COPY]]
276 ; RV32I-NEXT: [[ICMP1:%[0-9]+]]:_(s32) = G_ICMP intpred(sgt), [[COPY1]](s32), [[C]]
277 ; RV32I-NEXT: [[XOR:%[0-9]+]]:_(s32) = G_XOR [[ICMP1]], [[ICMP]]
278 ; RV32I-NEXT: [[COPY2:%[0-9]+]]:_(s32) = COPY [[SUB]](s32)
279 ; RV32I-NEXT: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 31
280 ; RV32I-NEXT: [[ASHR:%[0-9]+]]:_(s32) = G_ASHR [[COPY2]], [[C1]](s32)
281 ; RV32I-NEXT: [[C2:%[0-9]+]]:_(s32) = G_CONSTANT i32 -2147483648
282 ; RV32I-NEXT: [[ADD:%[0-9]+]]:_(s32) = G_ADD [[ASHR]], [[C2]]
283 ; RV32I-NEXT: [[SELECT:%[0-9]+]]:_(s32) = G_SELECT [[XOR]](s32), [[ADD]], [[COPY2]]
284 ; RV32I-NEXT: $x10 = COPY [[SELECT]](s32)
285 ; RV32I-NEXT: PseudoRET implicit $x10
287 ; RV32ZBB-LABEL: name: ssubsat_i32
288 ; RV32ZBB: liveins: $x10, $x11
289 ; RV32ZBB-NEXT: {{ $}}
290 ; RV32ZBB-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $x10
291 ; RV32ZBB-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x11
292 ; RV32ZBB-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 2147483647
293 ; RV32ZBB-NEXT: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 -2147483648
294 ; RV32ZBB-NEXT: [[C2:%[0-9]+]]:_(s32) = G_CONSTANT i32 -1
295 ; RV32ZBB-NEXT: [[SMAX:%[0-9]+]]:_(s32) = G_SMAX [[COPY]], [[C2]]
296 ; RV32ZBB-NEXT: [[SUB:%[0-9]+]]:_(s32) = G_SUB [[SMAX]], [[C]]
297 ; RV32ZBB-NEXT: [[SMIN:%[0-9]+]]:_(s32) = G_SMIN [[COPY]], [[C2]]
298 ; RV32ZBB-NEXT: [[SUB1:%[0-9]+]]:_(s32) = G_SUB [[SMIN]], [[C1]]
299 ; RV32ZBB-NEXT: [[SMAX1:%[0-9]+]]:_(s32) = G_SMAX [[SUB]], [[COPY1]]
300 ; RV32ZBB-NEXT: [[SMIN1:%[0-9]+]]:_(s32) = G_SMIN [[SMAX1]], [[SUB1]]
301 ; RV32ZBB-NEXT: [[SUB2:%[0-9]+]]:_(s32) = G_SUB [[COPY]], [[SMIN1]]
302 ; RV32ZBB-NEXT: $x10 = COPY [[SUB2]](s32)
303 ; RV32ZBB-NEXT: PseudoRET implicit $x10
304 %0:_(s32) = COPY $x10
305 %1:_(s32) = COPY $x11
306 %2:_(s32) = G_SSUBSAT %0, %1(s32)
308 PseudoRET implicit $x10
316 ; CHECK-LABEL: name: ssubsat_i64
317 ; CHECK: liveins: $x10, $x11
319 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $x10
320 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x11
321 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:_(s32) = COPY $x12
322 ; CHECK-NEXT: [[COPY3:%[0-9]+]]:_(s32) = COPY $x13
323 ; CHECK-NEXT: [[SUB:%[0-9]+]]:_(s32) = G_SUB [[COPY]], [[COPY2]]
324 ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s32) = G_ICMP intpred(ult), [[COPY]](s32), [[COPY2]]
325 ; CHECK-NEXT: [[SUB1:%[0-9]+]]:_(s32) = G_SUB [[COPY1]], [[COPY3]]
326 ; CHECK-NEXT: [[SUB2:%[0-9]+]]:_(s32) = G_SUB [[SUB1]], [[ICMP]]
327 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 0
328 ; CHECK-NEXT: [[ICMP1:%[0-9]+]]:_(s32) = G_ICMP intpred(ult), [[SUB]](s32), [[COPY]]
329 ; CHECK-NEXT: [[ICMP2:%[0-9]+]]:_(s32) = G_ICMP intpred(slt), [[SUB2]](s32), [[COPY1]]
330 ; CHECK-NEXT: [[ICMP3:%[0-9]+]]:_(s32) = G_ICMP intpred(eq), [[SUB2]](s32), [[COPY1]]
331 ; CHECK-NEXT: [[SELECT:%[0-9]+]]:_(s32) = G_SELECT [[ICMP3]](s32), [[ICMP1]], [[ICMP2]]
332 ; CHECK-NEXT: [[ICMP4:%[0-9]+]]:_(s32) = G_ICMP intpred(ugt), [[COPY2]](s32), [[C]]
333 ; CHECK-NEXT: [[ICMP5:%[0-9]+]]:_(s32) = G_ICMP intpred(sgt), [[COPY3]](s32), [[C]]
334 ; CHECK-NEXT: [[ICMP6:%[0-9]+]]:_(s32) = G_ICMP intpred(eq), [[COPY3]](s32), [[C]]
335 ; CHECK-NEXT: [[SELECT1:%[0-9]+]]:_(s32) = G_SELECT [[ICMP6]](s32), [[ICMP4]], [[ICMP5]]
336 ; CHECK-NEXT: [[XOR:%[0-9]+]]:_(s32) = G_XOR [[SELECT1]], [[SELECT]]
337 ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 31
338 ; CHECK-NEXT: [[ASHR:%[0-9]+]]:_(s32) = G_ASHR [[SUB2]], [[C1]](s32)
339 ; CHECK-NEXT: [[C2:%[0-9]+]]:_(s32) = G_CONSTANT i32 -2147483648
340 ; CHECK-NEXT: [[ADD:%[0-9]+]]:_(s32) = G_ADD [[ASHR]], [[C]]
341 ; CHECK-NEXT: [[ICMP7:%[0-9]+]]:_(s32) = G_ICMP intpred(ult), [[ADD]](s32), [[C]]
342 ; CHECK-NEXT: [[COPY4:%[0-9]+]]:_(s32) = COPY [[ADD]](s32)
343 ; CHECK-NEXT: [[ADD1:%[0-9]+]]:_(s32) = G_ADD [[ASHR]], [[C2]]
344 ; CHECK-NEXT: [[ADD2:%[0-9]+]]:_(s32) = G_ADD [[ADD1]], [[ICMP7]]
345 ; CHECK-NEXT: [[COPY5:%[0-9]+]]:_(s32) = COPY [[ADD2]](s32)
346 ; CHECK-NEXT: [[SELECT2:%[0-9]+]]:_(s32) = G_SELECT [[XOR]](s32), [[COPY4]], [[SUB]]
347 ; CHECK-NEXT: [[SELECT3:%[0-9]+]]:_(s32) = G_SELECT [[XOR]](s32), [[COPY5]], [[SUB2]]
348 ; CHECK-NEXT: $x10 = COPY [[SELECT2]](s32)
349 ; CHECK-NEXT: $x11 = COPY [[SELECT3]](s32)
350 ; CHECK-NEXT: PseudoRET implicit $x10, implicit $x11
351 %2:_(s32) = COPY $x10
352 %3:_(s32) = COPY $x11
353 %0:_(s64) = G_MERGE_VALUES %2(s32), %3(s32)
354 %4:_(s32) = COPY $x12
355 %5:_(s32) = COPY $x13
356 %1:_(s64) = G_MERGE_VALUES %4(s32), %5(s32)
357 %6:_(s64) = G_SSUBSAT %0, %1(s64)
358 %7:_(s32), %8:_(s32) = G_UNMERGE_VALUES %6(s64)
361 PseudoRET implicit $x10, implicit $x11
370 ; CHECK-LABEL: name: uaddsat_i8
371 ; CHECK: liveins: $x10, $x11
373 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $x10
374 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x11
375 ; CHECK-NEXT: [[ADD:%[0-9]+]]:_(s32) = G_ADD [[COPY]], [[COPY1]]
376 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 255
377 ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND [[ADD]], [[C]]
378 ; CHECK-NEXT: [[AND1:%[0-9]+]]:_(s32) = G_AND [[COPY1]], [[C]]
379 ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s32) = G_ICMP intpred(ult), [[AND]](s32), [[AND1]]
380 ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 -1
381 ; CHECK-NEXT: [[SELECT:%[0-9]+]]:_(s32) = G_SELECT [[ICMP]](s32), [[C1]], [[ADD]]
382 ; CHECK-NEXT: $x10 = COPY [[SELECT]](s32)
383 ; CHECK-NEXT: PseudoRET implicit $x10
384 %2:_(s32) = COPY $x10
385 %0:_(s8) = G_TRUNC %2(s32)
386 %3:_(s32) = COPY $x11
387 %1:_(s8) = G_TRUNC %3(s32)
388 %4:_(s8) = G_UADDSAT %0, %1(s8)
389 %5:_(s32) = G_ANYEXT %4(s8)
391 PseudoRET implicit $x10