llvm.org GIT mirror llvm / 7c5ab08
[InstSimplify] add tests for saturating add/sub; NFC These are baseline tests for D54532. Patch based on the original tests by: @nikic (Nikita Popov) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347060 91177308-0d34-0410-b5e6-96231b3b80d8 Sanjay Patel 11 months ago
1 changed file(s) with 448 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
0 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
1 ; RUN: opt < %s -instsimplify -S | FileCheck %s
2
3 declare i3 @llvm.uadd.sat.i3(i3, i3)
4 declare i8 @llvm.uadd.sat.i8(i8, i8)
5 declare <2 x i8> @llvm.uadd.sat.v2i8(<2 x i8>, <2 x i8>)
6 declare <2 x i9> @llvm.uadd.sat.v2i9(<2 x i9>, <2 x i9>)
7
8 declare i8 @llvm.sadd.sat.i8(i8, i8)
9 declare <2 x i8> @llvm.sadd.sat.v2i8(<2 x i8>, <2 x i8>)
10
11 declare i8 @llvm.usub.sat.i8(i8, i8)
12 declare i8 @llvm.ssub.sat.i8(i8, i8)
13 declare <2 x i8> @llvm.usub.sat.v2i8(<2 x i8>, <2 x i8>)
14 declare <2 x i8> @llvm.ssub.sat.v2i8(<2 x i8>, <2 x i8>)
15
16 define i8 @uadd_scalar_0(i8 %a) {
17 ; CHECK-LABEL: @uadd_scalar_0(
18 ; CHECK-NEXT: [[X1:%.*]] = call i8 @llvm.uadd.sat.i8(i8 [[A:%.*]], i8 0)
19 ; CHECK-NEXT: ret i8 [[X1]]
20 ;
21 %x1 = call i8 @llvm.uadd.sat.i8(i8 %a, i8 0)
22 ret i8 %x1
23 }
24
25 define <2 x i8> @uadd_vector_0(<2 x i8> %a) {
26 ; CHECK-LABEL: @uadd_vector_0(
27 ; CHECK-NEXT: [[X1V:%.*]] = call <2 x i8> @llvm.uadd.sat.v2i8(<2 x i8> [[A:%.*]], <2 x i8> zeroinitializer)
28 ; CHECK-NEXT: ret <2 x i8> [[X1V]]
29 ;
30 %x1v = call <2 x i8> @llvm.uadd.sat.v2i8(<2 x i8> %a, <2 x i8> zeroinitializer)
31 ret <2 x i8> %x1v
32 }
33
34 define i3 @uadd_scalar_0_commute(i3 %a) {
35 ; CHECK-LABEL: @uadd_scalar_0_commute(
36 ; CHECK-NEXT: [[X2:%.*]] = call i3 @llvm.uadd.sat.i3(i3 0, i3 [[A:%.*]])
37 ; CHECK-NEXT: ret i3 [[X2]]
38 ;
39 %x2 = call i3 @llvm.uadd.sat.i3(i3 0, i3 %a)
40 ret i3 %x2
41 }
42
43 define <2 x i8> @uadd_vector_0_commute(<2 x i8> %a) {
44 ; CHECK-LABEL: @uadd_vector_0_commute(
45 ; CHECK-NEXT: [[X2V:%.*]] = call <2 x i8> @llvm.uadd.sat.v2i8(<2 x i8> , <2 x i8> [[A:%.*]])
46 ; CHECK-NEXT: ret <2 x i8> [[X2V]]
47 ;
48 %x2v = call <2 x i8> @llvm.uadd.sat.v2i8(<2 x i8> , <2 x i8> %a)
49 ret <2 x i8> %x2v
50 }
51
52 define i8 @uadd_scalar_maxval(i8 %a) {
53 ; CHECK-LABEL: @uadd_scalar_maxval(
54 ; CHECK-NEXT: [[X3:%.*]] = call i8 @llvm.uadd.sat.i8(i8 [[A:%.*]], i8 -1)
55 ; CHECK-NEXT: ret i8 [[X3]]
56 ;
57 %x3 = call i8 @llvm.uadd.sat.i8(i8 %a, i8 255)
58 ret i8 %x3
59 }
60
61 define <2 x i9> @uadd_vector_maxval(<2 x i9> %a) {
62 ; CHECK-LABEL: @uadd_vector_maxval(
63 ; CHECK-NEXT: [[X3V:%.*]] = call <2 x i9> @llvm.uadd.sat.v2i9(<2 x i9> [[A:%.*]], <2 x i9> )
64 ; CHECK-NEXT: ret <2 x i9> [[X3V]]
65 ;
66 %x3v = call <2 x i9> @llvm.uadd.sat.v2i9(<2 x i9> %a, <2 x i9> )
67 ret <2 x i9> %x3v
68 }
69
70 define i3 @uadd_scalar_maxval_commute(i3 %a) {
71 ; CHECK-LABEL: @uadd_scalar_maxval_commute(
72 ; CHECK-NEXT: [[X4:%.*]] = call i3 @llvm.uadd.sat.i3(i3 -1, i3 [[A:%.*]])
73 ; CHECK-NEXT: ret i3 [[X4]]
74 ;
75 %x4 = call i3 @llvm.uadd.sat.i3(i3 7, i3 %a)
76 ret i3 %x4
77 }
78
79 define <2 x i8> @uadd_vector_maxval_commute(<2 x i8> %a) {
80 ; CHECK-LABEL: @uadd_vector_maxval_commute(
81 ; CHECK-NEXT: [[X4V:%.*]] = call <2 x i8> @llvm.uadd.sat.v2i8(<2 x i8> , <2 x i8> [[A:%.*]])
82 ; CHECK-NEXT: ret <2 x i8> [[X4V]]
83 ;
84 %x4v = call <2 x i8> @llvm.uadd.sat.v2i8(<2 x i8> , <2 x i8> %a)
85 ret <2 x i8> %x4v
86 }
87
88 define i8 @uadd_scalar_undef(i8 %a) {
89 ; CHECK-LABEL: @uadd_scalar_undef(
90 ; CHECK-NEXT: [[X5:%.*]] = call i8 @llvm.uadd.sat.i8(i8 [[A:%.*]], i8 undef)
91 ; CHECK-NEXT: ret i8 [[X5]]
92 ;
93 %x5 = call i8 @llvm.uadd.sat.i8(i8 %a, i8 undef)
94 ret i8 %x5
95 }
96
97 define <2 x i8> @uadd_vector_undef(<2 x i8> %a) {
98 ; CHECK-LABEL: @uadd_vector_undef(
99 ; CHECK-NEXT: [[X5V:%.*]] = call <2 x i8> @llvm.uadd.sat.v2i8(<2 x i8> [[A:%.*]], <2 x i8> undef)
100 ; CHECK-NEXT: ret <2 x i8> [[X5V]]
101 ;
102 %x5v = call <2 x i8> @llvm.uadd.sat.v2i8(<2 x i8> %a, <2 x i8> )
103 ret <2 x i8> %x5v
104 }
105
106 define i8 @uadd_scalar_undef_commute(i8 %a) {
107 ; CHECK-LABEL: @uadd_scalar_undef_commute(
108 ; CHECK-NEXT: [[X6:%.*]] = call i8 @llvm.uadd.sat.i8(i8 undef, i8 [[A:%.*]])
109 ; CHECK-NEXT: ret i8 [[X6]]
110 ;
111 %x6 = call i8 @llvm.uadd.sat.i8(i8 undef, i8 %a)
112 ret i8 %x6
113 }
114
115 define <2 x i8> @uadd_vector_undef_commute(<2 x i8> %a) {
116 ; CHECK-LABEL: @uadd_vector_undef_commute(
117 ; CHECK-NEXT: [[X5V:%.*]] = call <2 x i8> @llvm.uadd.sat.v2i8(<2 x i8> undef, <2 x i8> [[A:%.*]])
118 ; CHECK-NEXT: ret <2 x i8> [[X5V]]
119 ;
120 %x5v = call <2 x i8> @llvm.uadd.sat.v2i8(<2 x i8> undef, <2 x i8> %a)
121 ret <2 x i8> %x5v
122 }
123
124 define i8 @sadd_scalar_0(i8 %a) {
125 ; CHECK-LABEL: @sadd_scalar_0(
126 ; CHECK-NEXT: [[Y1:%.*]] = call i8 @llvm.sadd.sat.i8(i8 [[A:%.*]], i8 0)
127 ; CHECK-NEXT: ret i8 [[Y1]]
128 ;
129 %y1 = call i8 @llvm.sadd.sat.i8(i8 %a, i8 0)
130 ret i8 %y1
131 }
132
133 define <2 x i8> @sadd_vector_0(<2 x i8> %a) {
134 ; CHECK-LABEL: @sadd_vector_0(
135 ; CHECK-NEXT: [[Y1V:%.*]] = call <2 x i8> @llvm.sadd.sat.v2i8(<2 x i8> [[A:%.*]], <2 x i8> )
136 ; CHECK-NEXT: ret <2 x i8> [[Y1V]]
137 ;
138 %y1v = call <2 x i8> @llvm.sadd.sat.v2i8(<2 x i8> %a, <2 x i8> )
139 ret <2 x i8> %y1v
140 }
141
142 define i8 @sadd_scalar_0_commute(i8 %a) {
143 ; CHECK-LABEL: @sadd_scalar_0_commute(
144 ; CHECK-NEXT: [[Y2:%.*]] = call i8 @llvm.sadd.sat.i8(i8 0, i8 [[A:%.*]])
145 ; CHECK-NEXT: ret i8 [[Y2]]
146 ;
147 %y2 = call i8 @llvm.sadd.sat.i8(i8 0, i8 %a)
148 ret i8 %y2
149 }
150
151 define <2 x i8> @sadd_vector_0_commute(<2 x i8> %a) {
152 ; CHECK-LABEL: @sadd_vector_0_commute(
153 ; CHECK-NEXT: [[Y2V:%.*]] = call <2 x i8> @llvm.sadd.sat.v2i8(<2 x i8> zeroinitializer, <2 x i8> [[A:%.*]])
154 ; CHECK-NEXT: ret <2 x i8> [[Y2V]]
155 ;
156 %y2v = call <2 x i8> @llvm.sadd.sat.v2i8(<2 x i8> zeroinitializer, <2 x i8> %a)
157 ret <2 x i8> %y2v
158 }
159
160 define i8 @sadd_scalar_maxval(i8 %a) {
161 ; CHECK-LABEL: @sadd_scalar_maxval(
162 ; CHECK-NEXT: [[Y3:%.*]] = call i8 @llvm.sadd.sat.i8(i8 [[A:%.*]], i8 127)
163 ; CHECK-NEXT: ret i8 [[Y3]]
164 ;
165 %y3 = call i8 @llvm.sadd.sat.i8(i8 %a, i8 127)
166 ret i8 %y3
167 }
168
169 define <2 x i8> @sadd_vector_maxval(<2 x i8> %a) {
170 ; CHECK-LABEL: @sadd_vector_maxval(
171 ; CHECK-NEXT: [[Y3V:%.*]] = call <2 x i8> @llvm.sadd.sat.v2i8(<2 x i8> [[A:%.*]], <2 x i8> )
172 ; CHECK-NEXT: ret <2 x i8> [[Y3V]]
173 ;
174 %y3v = call <2 x i8> @llvm.sadd.sat.v2i8(<2 x i8> %a, <2 x i8> )
175 ret <2 x i8> %y3v
176 }
177
178 define i8 @sadd_scalar_maxval_commute(i8 %a) {
179 ; CHECK-LABEL: @sadd_scalar_maxval_commute(
180 ; CHECK-NEXT: [[Y4:%.*]] = call i8 @llvm.sadd.sat.i8(i8 127, i8 [[A:%.*]])
181 ; CHECK-NEXT: ret i8 [[Y4]]
182 ;
183 %y4 = call i8 @llvm.sadd.sat.i8(i8 127, i8 %a)
184 ret i8 %y4
185 }
186
187 define <2 x i8> @sadd_vector_maxval_commute(<2 x i8> %a) {
188 ; CHECK-LABEL: @sadd_vector_maxval_commute(
189 ; CHECK-NEXT: [[Y4V:%.*]] = call <2 x i8> @llvm.sadd.sat.v2i8(<2 x i8> , <2 x i8> [[A:%.*]])
190 ; CHECK-NEXT: ret <2 x i8> [[Y4V]]
191 ;
192 %y4v = call <2 x i8> @llvm.sadd.sat.v2i8(<2 x i8> , <2 x i8> %a)
193 ret <2 x i8> %y4v
194 }
195
196 define i8 @sadd_scalar_undef(i8 %a) {
197 ; CHECK-LABEL: @sadd_scalar_undef(
198 ; CHECK-NEXT: [[Y5:%.*]] = call i8 @llvm.sadd.sat.i8(i8 [[A:%.*]], i8 undef)
199 ; CHECK-NEXT: ret i8 [[Y5]]
200 ;
201 %y5 = call i8 @llvm.sadd.sat.i8(i8 %a, i8 undef)
202 ret i8 %y5
203 }
204
205 define <2 x i8> @sadd_vector_undef(<2 x i8> %a) {
206 ; CHECK-LABEL: @sadd_vector_undef(
207 ; CHECK-NEXT: [[Y5V:%.*]] = call <2 x i8> @llvm.sadd.sat.v2i8(<2 x i8> [[A:%.*]], <2 x i8> undef)
208 ; CHECK-NEXT: ret <2 x i8> [[Y5V]]
209 ;
210 %y5v = call <2 x i8> @llvm.sadd.sat.v2i8(<2 x i8> %a, <2 x i8> undef)
211 ret <2 x i8> %y5v
212 }
213
214 define i8 @sadd_scalar_undef_commute(i8 %a) {
215 ; CHECK-LABEL: @sadd_scalar_undef_commute(
216 ; CHECK-NEXT: [[Y6:%.*]] = call i8 @llvm.sadd.sat.i8(i8 undef, i8 [[A:%.*]])
217 ; CHECK-NEXT: ret i8 [[Y6]]
218 ;
219 %y6 = call i8 @llvm.sadd.sat.i8(i8 undef, i8 %a)
220 ret i8 %y6
221 }
222
223 define <2 x i8> @sadd_vector_undef_commute(<2 x i8> %a) {
224 ; CHECK-LABEL: @sadd_vector_undef_commute(
225 ; CHECK-NEXT: [[Y6V:%.*]] = call <2 x i8> @llvm.sadd.sat.v2i8(<2 x i8> undef, <2 x i8> [[A:%.*]])
226 ; CHECK-NEXT: ret <2 x i8> [[Y6V]]
227 ;
228 %y6v = call <2 x i8> @llvm.sadd.sat.v2i8(<2 x i8> undef, <2 x i8> %a)
229 ret <2 x i8> %y6v
230 }
231
232 define i8 @usub_scalar_0(i8 %a) {
233 ; CHECK-LABEL: @usub_scalar_0(
234 ; CHECK-NEXT: [[X1:%.*]] = call i8 @llvm.usub.sat.i8(i8 [[A:%.*]], i8 0)
235 ; CHECK-NEXT: ret i8 [[X1]]
236 ;
237 %x1 = call i8 @llvm.usub.sat.i8(i8 %a, i8 0)
238 ret i8 %x1
239 }
240
241 define <2 x i8> @usub_vector_0(<2 x i8> %a) {
242 ; CHECK-LABEL: @usub_vector_0(
243 ; CHECK-NEXT: [[X1V:%.*]] = call <2 x i8> @llvm.usub.sat.v2i8(<2 x i8> [[A:%.*]], <2 x i8> zeroinitializer)
244 ; CHECK-NEXT: ret <2 x i8> [[X1V]]
245 ;
246 %x1v = call <2 x i8> @llvm.usub.sat.v2i8(<2 x i8> %a, <2 x i8> )
247 ret <2 x i8> %x1v
248 }
249
250 define i8 @usub_scalar_0_commute(i8 %a) {
251 ; CHECK-LABEL: @usub_scalar_0_commute(
252 ; CHECK-NEXT: [[X2:%.*]] = call i8 @llvm.usub.sat.i8(i8 0, i8 [[A:%.*]])
253 ; CHECK-NEXT: ret i8 [[X2]]
254 ;
255 %x2 = call i8 @llvm.usub.sat.i8(i8 0, i8 %a)
256 ret i8 %x2
257 }
258
259 define <2 x i8> @usub_vector_0_commute(<2 x i8> %a) {
260 ; CHECK-LABEL: @usub_vector_0_commute(
261 ; CHECK-NEXT: [[X2V:%.*]] = call <2 x i8> @llvm.usub.sat.v2i8(<2 x i8> zeroinitializer, <2 x i8> [[A:%.*]])
262 ; CHECK-NEXT: ret <2 x i8> [[X2V]]
263 ;
264 %x2v = call <2 x i8> @llvm.usub.sat.v2i8(<2 x i8> , <2 x i8> %a)
265 ret <2 x i8> %x2v
266 }
267
268 define i8 @usub_scalar_maxval(i8 %a) {
269 ; CHECK-LABEL: @usub_scalar_maxval(
270 ; CHECK-NEXT: [[X3:%.*]] = call i8 @llvm.usub.sat.i8(i8 [[A:%.*]], i8 -1)
271 ; CHECK-NEXT: ret i8 [[X3]]
272 ;
273 %x3 = call i8 @llvm.usub.sat.i8(i8 %a, i8 255)
274 ret i8 %x3
275 }
276
277 define <2 x i8> @usub_vector_maxval(<2 x i8> %a) {
278 ; CHECK-LABEL: @usub_vector_maxval(
279 ; CHECK-NEXT: [[X3V:%.*]] = call <2 x i8> @llvm.usub.sat.v2i8(<2 x i8> [[A:%.*]], <2 x i8> )
280 ; CHECK-NEXT: ret <2 x i8> [[X3V]]
281 ;
282 %x3v = call <2 x i8> @llvm.usub.sat.v2i8(<2 x i8> %a, <2 x i8> )
283 ret <2 x i8> %x3v
284 }
285
286 define i8 @usub_scalar_undef(i8 %a) {
287 ; CHECK-LABEL: @usub_scalar_undef(
288 ; CHECK-NEXT: [[X4:%.*]] = call i8 @llvm.usub.sat.i8(i8 [[A:%.*]], i8 undef)
289 ; CHECK-NEXT: ret i8 [[X4]]
290 ;
291 %x4 = call i8 @llvm.usub.sat.i8(i8 %a, i8 undef)
292 ret i8 %x4
293 }
294
295 define <2 x i8> @usub_vector_undef(<2 x i8> %a) {
296 ; CHECK-LABEL: @usub_vector_undef(
297 ; CHECK-NEXT: [[X4V:%.*]] = call <2 x i8> @llvm.usub.sat.v2i8(<2 x i8> [[A:%.*]], <2 x i8> )
298 ; CHECK-NEXT: ret <2 x i8> [[X4V]]
299 ;
300 %x4v = call <2 x i8> @llvm.usub.sat.v2i8(<2 x i8> %a, <2 x i8> )
301 ret <2 x i8> %x4v
302 }
303
304 define i8 @usub_scalar_undef_commute(i8 %a) {
305 ; CHECK-LABEL: @usub_scalar_undef_commute(
306 ; CHECK-NEXT: [[X5:%.*]] = call i8 @llvm.usub.sat.i8(i8 undef, i8 [[A:%.*]])
307 ; CHECK-NEXT: ret i8 [[X5]]
308 ;
309 %x5 = call i8 @llvm.usub.sat.i8(i8 undef, i8 %a)
310 ret i8 %x5
311 }
312
313 define <2 x i8> @usub_vector_undef_commute(<2 x i8> %a) {
314 ; CHECK-LABEL: @usub_vector_undef_commute(
315 ; CHECK-NEXT: [[X5V:%.*]] = call <2 x i8> @llvm.usub.sat.v2i8(<2 x i8> [[A:%.*]], <2 x i8> undef)
316 ; CHECK-NEXT: ret <2 x i8> [[X5V]]
317 ;
318 %x5v = call <2 x i8> @llvm.usub.sat.v2i8(<2 x i8> %a, <2 x i8> )
319 ret <2 x i8> %x5v
320 }
321
322 define i8 @usub_scalar_same(i8 %a) {
323 ; CHECK-LABEL: @usub_scalar_same(
324 ; CHECK-NEXT: [[X6:%.*]] = call i8 @llvm.usub.sat.i8(i8 [[A:%.*]], i8 [[A]])
325 ; CHECK-NEXT: ret i8 [[X6]]
326 ;
327 %x6 = call i8 @llvm.usub.sat.i8(i8 %a, i8 %a)
328 ret i8 %x6
329 }
330
331 define <2 x i8> @usub_vector_same(<2 x i8> %a) {
332 ; CHECK-LABEL: @usub_vector_same(
333 ; CHECK-NEXT: [[X6V:%.*]] = call <2 x i8> @llvm.usub.sat.v2i8(<2 x i8> [[A:%.*]], <2 x i8> [[A]])
334 ; CHECK-NEXT: ret <2 x i8> [[X6V]]
335 ;
336 %x6v = call <2 x i8> @llvm.usub.sat.v2i8(<2 x i8> %a, <2 x i8> %a)
337 ret <2 x i8> %x6v
338 }
339
340 define i8 @ssub_scalar_0(i8 %a) {
341 ; CHECK-LABEL: @ssub_scalar_0(
342 ; CHECK-NEXT: [[Y1:%.*]] = call i8 @llvm.ssub.sat.i8(i8 [[A:%.*]], i8 0)
343 ; CHECK-NEXT: ret i8 [[Y1]]
344 ;
345 %y1 = call i8 @llvm.ssub.sat.i8(i8 %a, i8 0)
346 ret i8 %y1
347 }
348
349 define <2 x i8> @ssub_vector_0(<2 x i8> %a) {
350 ; CHECK-LABEL: @ssub_vector_0(
351 ; CHECK-NEXT: [[Y1V:%.*]] = call <2 x i8> @llvm.ssub.sat.v2i8(<2 x i8> [[A:%.*]], <2 x i8> zeroinitializer)
352 ; CHECK-NEXT: ret <2 x i8> [[Y1V]]
353 ;
354 %y1v = call <2 x i8> @llvm.ssub.sat.v2i8(<2 x i8> %a, <2 x i8> )
355 ret <2 x i8> %y1v
356 }
357
358 define i8 @ssub_scalar_0_commute(i8 %a) {
359 ; CHECK-LABEL: @ssub_scalar_0_commute(
360 ; CHECK-NEXT: [[Y2:%.*]] = call i8 @llvm.ssub.sat.i8(i8 0, i8 [[A:%.*]])
361 ; CHECK-NEXT: ret i8 [[Y2]]
362 ;
363 %y2 = call i8 @llvm.ssub.sat.i8(i8 0, i8 %a)
364 ret i8 %y2
365 }
366
367 define <2 x i8> @ssub_vector_0_commute(<2 x i8> %a) {
368 ; CHECK-LABEL: @ssub_vector_0_commute(
369 ; CHECK-NEXT: [[Y2V:%.*]] = call <2 x i8> @llvm.ssub.sat.v2i8(<2 x i8> zeroinitializer, <2 x i8> [[A:%.*]])
370 ; CHECK-NEXT: ret <2 x i8> [[Y2V]]
371 ;
372 %y2v = call <2 x i8> @llvm.ssub.sat.v2i8(<2 x i8> , <2 x i8> %a)
373 ret <2 x i8> %y2v
374 }
375
376 define i8 @ssub_scalar_maxval(i8 %a) {
377 ; CHECK-LABEL: @ssub_scalar_maxval(
378 ; CHECK-NEXT: [[Y3:%.*]] = call i8 @llvm.ssub.sat.i8(i8 [[A:%.*]], i8 127)
379 ; CHECK-NEXT: ret i8 [[Y3]]
380 ;
381 %y3 = call i8 @llvm.ssub.sat.i8(i8 %a, i8 127)
382 ret i8 %y3
383 }
384
385 define <2 x i8> @ssub_vector_maxval(<2 x i8> %a) {
386 ; CHECK-LABEL: @ssub_vector_maxval(
387 ; CHECK-NEXT: [[Y3V:%.*]] = call <2 x i8> @llvm.ssub.sat.v2i8(<2 x i8> [[A:%.*]], <2 x i8> )
388 ; CHECK-NEXT: ret <2 x i8> [[Y3V]]
389 ;
390 %y3v = call <2 x i8> @llvm.ssub.sat.v2i8(<2 x i8> %a, <2 x i8> )
391 ret <2 x i8> %y3v
392 }
393
394 define i8 @ssub_scalar_undef(i8 %a) {
395 ; CHECK-LABEL: @ssub_scalar_undef(
396 ; CHECK-NEXT: [[Y4:%.*]] = call i8 @llvm.ssub.sat.i8(i8 [[A:%.*]], i8 undef)
397 ; CHECK-NEXT: ret i8 [[Y4]]
398 ;
399 %y4 = call i8 @llvm.ssub.sat.i8(i8 %a, i8 undef)
400 ret i8 %y4
401 }
402
403 define <2 x i8> @ssub_vector_undef(<2 x i8> %a) {
404 ; CHECK-LABEL: @ssub_vector_undef(
405 ; CHECK-NEXT: [[Y4V:%.*]] = call <2 x i8> @llvm.ssub.sat.v2i8(<2 x i8> [[A:%.*]], <2 x i8> undef)
406 ; CHECK-NEXT: ret <2 x i8> [[Y4V]]
407 ;
408 %y4v = call <2 x i8> @llvm.ssub.sat.v2i8(<2 x i8> %a, <2 x i8> undef)
409 ret <2 x i8> %y4v
410 }
411
412 define i8 @ssub_scalar_undef_commute(i8 %a) {
413 ; CHECK-LABEL: @ssub_scalar_undef_commute(
414 ; CHECK-NEXT: [[Y5:%.*]] = call i8 @llvm.ssub.sat.i8(i8 undef, i8 [[A:%.*]])
415 ; CHECK-NEXT: ret i8 [[Y5]]
416 ;
417 %y5 = call i8 @llvm.ssub.sat.i8(i8 undef, i8 %a)
418 ret i8 %y5
419 }
420
421 define <2 x i8> @ssub_vector_undef_commute(<2 x i8> %a) {
422 ; CHECK-LABEL: @ssub_vector_undef_commute(
423 ; CHECK-NEXT: [[Y5V:%.*]] = call <2 x i8> @llvm.ssub.sat.v2i8(<2 x i8> undef, <2 x i8> [[A:%.*]])
424 ; CHECK-NEXT: ret <2 x i8> [[Y5V]]
425 ;
426 %y5v = call <2 x i8> @llvm.ssub.sat.v2i8(<2 x i8> , <2 x i8> %a)
427 ret <2 x i8> %y5v
428 }
429
430 define i8 @ssub_scalar_same(i8 %a) {
431 ; CHECK-LABEL: @ssub_scalar_same(
432 ; CHECK-NEXT: [[Y6:%.*]] = call i8 @llvm.ssub.sat.i8(i8 [[A:%.*]], i8 [[A]])
433 ; CHECK-NEXT: ret i8 [[Y6]]
434 ;
435 %y6 = call i8 @llvm.ssub.sat.i8(i8 %a, i8 %a)
436 ret i8 %y6
437 }
438
439 define <2 x i8> @ssub_vector_same(<2 x i8> %a) {
440 ; CHECK-LABEL: @ssub_vector_same(
441 ; CHECK-NEXT: [[Y6V:%.*]] = call <2 x i8> @llvm.ssub.sat.v2i8(<2 x i8> [[A:%.*]], <2 x i8> [[A]])
442 ; CHECK-NEXT: ret <2 x i8> [[Y6V]]
443 ;
444 %y6v = call <2 x i8> @llvm.ssub.sat.v2i8(<2 x i8> %a, <2 x i8> %a)
445 ret <2 x i8> %y6v
446 }
447