1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=amdgcn-amd-amdpal -mcpu=tahiti < %s | FileCheck --check-prefix=GFX6 %s
3 ; RUN: llc -mtriple=amdgcn-amd-amdpal -mcpu=fiji < %s | FileCheck --check-prefix=GFX8 %s
4 ; RUN: llc -mtriple=amdgcn-amd-amdpal -mcpu=gfx900 < %s | FileCheck --check-prefix=GFX9 %s
5 ; RUN: llc -mtriple=amdgcn-amd-amdpal -mcpu=gfx1010 < %s | FileCheck --check-prefixes=GFX10PLUS,GFX10 %s
6 ; RUN: llc -mtriple=amdgcn-amd-amdpal -mcpu=gfx1100 -amdgpu-enable-delay-alu=0 < %s | FileCheck --check-prefixes=GFX10PLUS,GFX11 %s
8 define i8 @v_usubsat_i8(i8 %lhs, i8 %rhs) {
9 ; GFX6-LABEL: v_usubsat_i8:
11 ; GFX6-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
12 ; GFX6-NEXT: v_and_b32_e32 v1, 0xff, v1
13 ; GFX6-NEXT: v_and_b32_e32 v0, 0xff, v0
14 ; GFX6-NEXT: v_max_u32_e32 v0, v0, v1
15 ; GFX6-NEXT: v_sub_i32_e32 v0, vcc, v0, v1
16 ; GFX6-NEXT: s_setpc_b64 s[30:31]
18 ; GFX8-LABEL: v_usubsat_i8:
20 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
21 ; GFX8-NEXT: v_sub_u16_sdwa v0, v0, v1 clamp dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:BYTE_0
22 ; GFX8-NEXT: s_setpc_b64 s[30:31]
24 ; GFX9-LABEL: v_usubsat_i8:
26 ; GFX9-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
27 ; GFX9-NEXT: v_sub_u16_sdwa v0, v0, v1 clamp dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:BYTE_0
28 ; GFX9-NEXT: s_setpc_b64 s[30:31]
30 ; GFX10PLUS-LABEL: v_usubsat_i8:
32 ; GFX10PLUS-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
33 ; GFX10PLUS-NEXT: v_and_b32_e32 v1, 0xff, v1
34 ; GFX10PLUS-NEXT: v_and_b32_e32 v0, 0xff, v0
35 ; GFX10PLUS-NEXT: v_sub_nc_u16 v0, v0, v1 clamp
36 ; GFX10PLUS-NEXT: s_setpc_b64 s[30:31]
37 %result = call i8 @llvm.usub.sat.i8(i8 %lhs, i8 %rhs)
41 define i16 @v_usubsat_i16(i16 %lhs, i16 %rhs) {
42 ; GFX6-LABEL: v_usubsat_i16:
44 ; GFX6-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
45 ; GFX6-NEXT: v_and_b32_e32 v1, 0xffff, v1
46 ; GFX6-NEXT: v_and_b32_e32 v0, 0xffff, v0
47 ; GFX6-NEXT: v_max_u32_e32 v0, v0, v1
48 ; GFX6-NEXT: v_sub_i32_e32 v0, vcc, v0, v1
49 ; GFX6-NEXT: s_setpc_b64 s[30:31]
51 ; GFX8-LABEL: v_usubsat_i16:
53 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
54 ; GFX8-NEXT: v_sub_u16_e64 v0, v0, v1 clamp
55 ; GFX8-NEXT: s_setpc_b64 s[30:31]
57 ; GFX9-LABEL: v_usubsat_i16:
59 ; GFX9-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
60 ; GFX9-NEXT: v_sub_u16_e64 v0, v0, v1 clamp
61 ; GFX9-NEXT: s_setpc_b64 s[30:31]
63 ; GFX10PLUS-LABEL: v_usubsat_i16:
65 ; GFX10PLUS-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
66 ; GFX10PLUS-NEXT: v_sub_nc_u16 v0, v0, v1 clamp
67 ; GFX10PLUS-NEXT: s_setpc_b64 s[30:31]
68 %result = call i16 @llvm.usub.sat.i16(i16 %lhs, i16 %rhs)
72 define i16 @usubsat_as_bithack_i16(i16 %x) {
73 ; GFX6-LABEL: usubsat_as_bithack_i16:
75 ; GFX6-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
76 ; GFX6-NEXT: v_bfe_i32 v1, v0, 0, 16
77 ; GFX6-NEXT: v_ashrrev_i32_e32 v1, 15, v1
78 ; GFX6-NEXT: v_xor_b32_e32 v0, 0xffff8000, v0
79 ; GFX6-NEXT: v_and_b32_e32 v0, v1, v0
80 ; GFX6-NEXT: s_setpc_b64 s[30:31]
82 ; GFX8-LABEL: usubsat_as_bithack_i16:
84 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
85 ; GFX8-NEXT: s_movk_i32 s4, 0x8000
86 ; GFX8-NEXT: v_sub_u16_e64 v0, v0, s4 clamp
87 ; GFX8-NEXT: s_setpc_b64 s[30:31]
89 ; GFX9-LABEL: usubsat_as_bithack_i16:
91 ; GFX9-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
92 ; GFX9-NEXT: s_movk_i32 s4, 0x8000
93 ; GFX9-NEXT: v_sub_u16_e64 v0, v0, s4 clamp
94 ; GFX9-NEXT: s_setpc_b64 s[30:31]
96 ; GFX10PLUS-LABEL: usubsat_as_bithack_i16:
98 ; GFX10PLUS-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
99 ; GFX10PLUS-NEXT: v_sub_nc_u16 v0, v0, 0x8000 clamp
100 ; GFX10PLUS-NEXT: s_setpc_b64 s[30:31]
101 %signsplat = ashr i16 %x, 15
102 %flipsign = xor i16 %x, 32768
103 %result = and i16 %signsplat, %flipsign
107 define i16 @usubsat_as_bithack2_i16(i16 %x) {
108 ; GFX6-LABEL: usubsat_as_bithack2_i16:
110 ; GFX6-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
111 ; GFX6-NEXT: v_bfe_i32 v1, v0, 0, 16
112 ; GFX6-NEXT: v_ashrrev_i32_e32 v1, 15, v1
113 ; GFX6-NEXT: v_add_i32_e32 v0, vcc, 0xffff8000, v0
114 ; GFX6-NEXT: v_and_b32_e32 v0, v1, v0
115 ; GFX6-NEXT: s_setpc_b64 s[30:31]
117 ; GFX8-LABEL: usubsat_as_bithack2_i16:
119 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
120 ; GFX8-NEXT: s_movk_i32 s4, 0x8000
121 ; GFX8-NEXT: v_sub_u16_e64 v0, v0, s4 clamp
122 ; GFX8-NEXT: s_setpc_b64 s[30:31]
124 ; GFX9-LABEL: usubsat_as_bithack2_i16:
126 ; GFX9-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
127 ; GFX9-NEXT: s_movk_i32 s4, 0x8000
128 ; GFX9-NEXT: v_sub_u16_e64 v0, v0, s4 clamp
129 ; GFX9-NEXT: s_setpc_b64 s[30:31]
131 ; GFX10PLUS-LABEL: usubsat_as_bithack2_i16:
132 ; GFX10PLUS: ; %bb.0:
133 ; GFX10PLUS-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
134 ; GFX10PLUS-NEXT: v_sub_nc_u16 v0, v0, 0x8000 clamp
135 ; GFX10PLUS-NEXT: s_setpc_b64 s[30:31]
136 %signsplat = ashr i16 %x, 15
137 %flipsign = add i16 %x, 32768
138 %result = and i16 %signsplat, %flipsign
142 define i16 @usubsat_as_bithack_commute_i16(i16 %x) {
143 ; GFX6-LABEL: usubsat_as_bithack_commute_i16:
145 ; GFX6-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
146 ; GFX6-NEXT: v_bfe_i32 v1, v0, 0, 16
147 ; GFX6-NEXT: v_ashrrev_i32_e32 v1, 15, v1
148 ; GFX6-NEXT: v_add_i32_e32 v0, vcc, 0xffff8000, v0
149 ; GFX6-NEXT: v_and_b32_e32 v0, v0, v1
150 ; GFX6-NEXT: s_setpc_b64 s[30:31]
152 ; GFX8-LABEL: usubsat_as_bithack_commute_i16:
154 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
155 ; GFX8-NEXT: s_movk_i32 s4, 0x8000
156 ; GFX8-NEXT: v_sub_u16_e64 v0, v0, s4 clamp
157 ; GFX8-NEXT: s_setpc_b64 s[30:31]
159 ; GFX9-LABEL: usubsat_as_bithack_commute_i16:
161 ; GFX9-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
162 ; GFX9-NEXT: s_movk_i32 s4, 0x8000
163 ; GFX9-NEXT: v_sub_u16_e64 v0, v0, s4 clamp
164 ; GFX9-NEXT: s_setpc_b64 s[30:31]
166 ; GFX10PLUS-LABEL: usubsat_as_bithack_commute_i16:
167 ; GFX10PLUS: ; %bb.0:
168 ; GFX10PLUS-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
169 ; GFX10PLUS-NEXT: v_sub_nc_u16 v0, v0, 0x8000 clamp
170 ; GFX10PLUS-NEXT: s_setpc_b64 s[30:31]
171 %signsplat = ashr i16 %x, 15
172 %flipsign = add i16 %x, 32768
173 %result = and i16 %flipsign, %signsplat
177 define i32 @v_usubsat_i32(i32 %lhs, i32 %rhs) {
178 ; GFX6-LABEL: v_usubsat_i32:
180 ; GFX6-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
181 ; GFX6-NEXT: v_max_u32_e32 v0, v0, v1
182 ; GFX6-NEXT: v_sub_i32_e32 v0, vcc, v0, v1
183 ; GFX6-NEXT: s_setpc_b64 s[30:31]
185 ; GFX8-LABEL: v_usubsat_i32:
187 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
188 ; GFX8-NEXT: v_sub_u32_e64 v0, s[4:5], v0, v1 clamp
189 ; GFX8-NEXT: s_setpc_b64 s[30:31]
191 ; GFX9-LABEL: v_usubsat_i32:
193 ; GFX9-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
194 ; GFX9-NEXT: v_sub_u32_e64 v0, v0, v1 clamp
195 ; GFX9-NEXT: s_setpc_b64 s[30:31]
197 ; GFX10PLUS-LABEL: v_usubsat_i32:
198 ; GFX10PLUS: ; %bb.0:
199 ; GFX10PLUS-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
200 ; GFX10PLUS-NEXT: v_sub_nc_u32_e64 v0, v0, v1 clamp
201 ; GFX10PLUS-NEXT: s_setpc_b64 s[30:31]
202 %result = call i32 @llvm.usub.sat.i32(i32 %lhs, i32 %rhs)
206 define <2 x i16> @v_usubsat_v2i16(<2 x i16> %lhs, <2 x i16> %rhs) {
207 ; GFX6-LABEL: v_usubsat_v2i16:
209 ; GFX6-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
210 ; GFX6-NEXT: v_and_b32_e32 v3, 0xffff, v3
211 ; GFX6-NEXT: v_and_b32_e32 v1, 0xffff, v1
212 ; GFX6-NEXT: v_and_b32_e32 v2, 0xffff, v2
213 ; GFX6-NEXT: v_and_b32_e32 v0, 0xffff, v0
214 ; GFX6-NEXT: v_max_u32_e32 v1, v1, v3
215 ; GFX6-NEXT: v_max_u32_e32 v0, v0, v2
216 ; GFX6-NEXT: v_sub_i32_e32 v1, vcc, v1, v3
217 ; GFX6-NEXT: v_sub_i32_e32 v0, vcc, v0, v2
218 ; GFX6-NEXT: v_lshlrev_b32_e32 v2, 16, v1
219 ; GFX6-NEXT: v_or_b32_e32 v0, v0, v2
220 ; GFX6-NEXT: s_setpc_b64 s[30:31]
222 ; GFX8-LABEL: v_usubsat_v2i16:
224 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
225 ; GFX8-NEXT: v_sub_u16_sdwa v2, v0, v1 clamp dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:WORD_1 src1_sel:WORD_1
226 ; GFX8-NEXT: v_sub_u16_e64 v0, v0, v1 clamp
227 ; GFX8-NEXT: v_or_b32_e32 v0, v0, v2
228 ; GFX8-NEXT: s_setpc_b64 s[30:31]
230 ; GFX9-LABEL: v_usubsat_v2i16:
232 ; GFX9-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
233 ; GFX9-NEXT: v_pk_sub_u16 v0, v0, v1 clamp
234 ; GFX9-NEXT: s_setpc_b64 s[30:31]
236 ; GFX10PLUS-LABEL: v_usubsat_v2i16:
237 ; GFX10PLUS: ; %bb.0:
238 ; GFX10PLUS-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
239 ; GFX10PLUS-NEXT: v_pk_sub_u16 v0, v0, v1 clamp
240 ; GFX10PLUS-NEXT: s_setpc_b64 s[30:31]
241 %result = call <2 x i16> @llvm.usub.sat.v2i16(<2 x i16> %lhs, <2 x i16> %rhs)
242 ret <2 x i16> %result
245 define <3 x i16> @v_usubsat_v3i16(<3 x i16> %lhs, <3 x i16> %rhs) {
246 ; GFX6-LABEL: v_usubsat_v3i16:
248 ; GFX6-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
249 ; GFX6-NEXT: v_and_b32_e32 v6, 0xffff, v4
250 ; GFX6-NEXT: v_and_b32_e32 v1, 0xffff, v1
251 ; GFX6-NEXT: v_and_b32_e32 v3, 0xffff, v3
252 ; GFX6-NEXT: v_and_b32_e32 v0, 0xffff, v0
253 ; GFX6-NEXT: v_max_u32_e32 v1, v1, v6
254 ; GFX6-NEXT: v_max_u32_e32 v0, v0, v3
255 ; GFX6-NEXT: v_sub_i32_e32 v1, vcc, v1, v4
256 ; GFX6-NEXT: v_and_b32_e32 v5, 0xffff, v5
257 ; GFX6-NEXT: v_and_b32_e32 v2, 0xffff, v2
258 ; GFX6-NEXT: v_sub_i32_e32 v0, vcc, v0, v3
259 ; GFX6-NEXT: v_lshlrev_b32_e32 v1, 16, v1
260 ; GFX6-NEXT: v_or_b32_e32 v0, v0, v1
261 ; GFX6-NEXT: v_max_u32_e32 v1, v2, v5
262 ; GFX6-NEXT: v_sub_i32_e32 v2, vcc, v1, v5
263 ; GFX6-NEXT: v_alignbit_b32 v1, v2, v0, 16
264 ; GFX6-NEXT: s_setpc_b64 s[30:31]
266 ; GFX8-LABEL: v_usubsat_v3i16:
268 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
269 ; GFX8-NEXT: v_sub_u16_sdwa v4, v0, v2 clamp dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:WORD_1 src1_sel:WORD_1
270 ; GFX8-NEXT: v_sub_u16_e64 v0, v0, v2 clamp
271 ; GFX8-NEXT: v_sub_u16_e64 v1, v1, v3 clamp
272 ; GFX8-NEXT: v_or_b32_e32 v0, v0, v4
273 ; GFX8-NEXT: s_setpc_b64 s[30:31]
275 ; GFX9-LABEL: v_usubsat_v3i16:
277 ; GFX9-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
278 ; GFX9-NEXT: v_pk_sub_u16 v1, v1, v3 clamp
279 ; GFX9-NEXT: v_pk_sub_u16 v0, v0, v2 clamp
280 ; GFX9-NEXT: s_setpc_b64 s[30:31]
282 ; GFX10PLUS-LABEL: v_usubsat_v3i16:
283 ; GFX10PLUS: ; %bb.0:
284 ; GFX10PLUS-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
285 ; GFX10PLUS-NEXT: v_pk_sub_u16 v0, v0, v2 clamp
286 ; GFX10PLUS-NEXT: v_pk_sub_u16 v1, v1, v3 clamp
287 ; GFX10PLUS-NEXT: s_setpc_b64 s[30:31]
288 %result = call <3 x i16> @llvm.usub.sat.v3i16(<3 x i16> %lhs, <3 x i16> %rhs)
289 ret <3 x i16> %result
292 define <2 x float> @v_usubsat_v4i16(<4 x i16> %lhs, <4 x i16> %rhs) {
293 ; GFX6-LABEL: v_usubsat_v4i16:
295 ; GFX6-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
296 ; GFX6-NEXT: v_and_b32_e32 v9, 0xffff, v5
297 ; GFX6-NEXT: v_and_b32_e32 v1, 0xffff, v1
298 ; GFX6-NEXT: v_and_b32_e32 v4, 0xffff, v4
299 ; GFX6-NEXT: v_and_b32_e32 v0, 0xffff, v0
300 ; GFX6-NEXT: v_max_u32_e32 v1, v1, v9
301 ; GFX6-NEXT: v_max_u32_e32 v0, v0, v4
302 ; GFX6-NEXT: v_sub_i32_e32 v1, vcc, v1, v5
303 ; GFX6-NEXT: v_and_b32_e32 v8, 0xffff, v7
304 ; GFX6-NEXT: v_and_b32_e32 v3, 0xffff, v3
305 ; GFX6-NEXT: v_and_b32_e32 v6, 0xffff, v6
306 ; GFX6-NEXT: v_and_b32_e32 v2, 0xffff, v2
307 ; GFX6-NEXT: v_sub_i32_e32 v0, vcc, v0, v4
308 ; GFX6-NEXT: v_lshlrev_b32_e32 v1, 16, v1
309 ; GFX6-NEXT: v_or_b32_e32 v0, v0, v1
310 ; GFX6-NEXT: v_max_u32_e32 v1, v2, v6
311 ; GFX6-NEXT: v_max_u32_e32 v2, v3, v8
312 ; GFX6-NEXT: v_sub_i32_e32 v2, vcc, v2, v7
313 ; GFX6-NEXT: v_sub_i32_e32 v1, vcc, v1, v6
314 ; GFX6-NEXT: v_lshlrev_b32_e32 v2, 16, v2
315 ; GFX6-NEXT: v_or_b32_e32 v1, v1, v2
316 ; GFX6-NEXT: s_setpc_b64 s[30:31]
318 ; GFX8-LABEL: v_usubsat_v4i16:
320 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
321 ; GFX8-NEXT: v_sub_u16_sdwa v4, v0, v2 clamp dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:WORD_1 src1_sel:WORD_1
322 ; GFX8-NEXT: v_sub_u16_e64 v0, v0, v2 clamp
323 ; GFX8-NEXT: v_sub_u16_sdwa v2, v1, v3 clamp dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:WORD_1 src1_sel:WORD_1
324 ; GFX8-NEXT: v_sub_u16_e64 v1, v1, v3 clamp
325 ; GFX8-NEXT: v_or_b32_e32 v0, v0, v4
326 ; GFX8-NEXT: v_or_b32_e32 v1, v1, v2
327 ; GFX8-NEXT: s_setpc_b64 s[30:31]
329 ; GFX9-LABEL: v_usubsat_v4i16:
331 ; GFX9-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
332 ; GFX9-NEXT: v_pk_sub_u16 v0, v0, v2 clamp
333 ; GFX9-NEXT: v_pk_sub_u16 v1, v1, v3 clamp
334 ; GFX9-NEXT: s_setpc_b64 s[30:31]
336 ; GFX10PLUS-LABEL: v_usubsat_v4i16:
337 ; GFX10PLUS: ; %bb.0:
338 ; GFX10PLUS-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
339 ; GFX10PLUS-NEXT: v_pk_sub_u16 v0, v0, v2 clamp
340 ; GFX10PLUS-NEXT: v_pk_sub_u16 v1, v1, v3 clamp
341 ; GFX10PLUS-NEXT: s_setpc_b64 s[30:31]
342 %result = call <4 x i16> @llvm.usub.sat.v4i16(<4 x i16> %lhs, <4 x i16> %rhs)
343 %cast = bitcast <4 x i16> %result to <2 x float>
344 ret <2 x float> %cast
347 define <2 x i32> @v_usubsat_v2i32(<2 x i32> %lhs, <2 x i32> %rhs) {
348 ; GFX6-LABEL: v_usubsat_v2i32:
350 ; GFX6-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
351 ; GFX6-NEXT: v_max_u32_e32 v0, v0, v2
352 ; GFX6-NEXT: v_max_u32_e32 v1, v1, v3
353 ; GFX6-NEXT: v_sub_i32_e32 v0, vcc, v0, v2
354 ; GFX6-NEXT: v_sub_i32_e32 v1, vcc, v1, v3
355 ; GFX6-NEXT: s_setpc_b64 s[30:31]
357 ; GFX8-LABEL: v_usubsat_v2i32:
359 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
360 ; GFX8-NEXT: v_sub_u32_e64 v0, s[4:5], v0, v2 clamp
361 ; GFX8-NEXT: v_sub_u32_e64 v1, s[4:5], v1, v3 clamp
362 ; GFX8-NEXT: s_setpc_b64 s[30:31]
364 ; GFX9-LABEL: v_usubsat_v2i32:
366 ; GFX9-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
367 ; GFX9-NEXT: v_sub_u32_e64 v0, v0, v2 clamp
368 ; GFX9-NEXT: v_sub_u32_e64 v1, v1, v3 clamp
369 ; GFX9-NEXT: s_setpc_b64 s[30:31]
371 ; GFX10PLUS-LABEL: v_usubsat_v2i32:
372 ; GFX10PLUS: ; %bb.0:
373 ; GFX10PLUS-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
374 ; GFX10PLUS-NEXT: v_sub_nc_u32_e64 v0, v0, v2 clamp
375 ; GFX10PLUS-NEXT: v_sub_nc_u32_e64 v1, v1, v3 clamp
376 ; GFX10PLUS-NEXT: s_setpc_b64 s[30:31]
377 %result = call <2 x i32> @llvm.usub.sat.v2i32(<2 x i32> %lhs, <2 x i32> %rhs)
378 ret <2 x i32> %result
381 define <3 x i32> @v_usubsat_v3i32(<3 x i32> %lhs, <3 x i32> %rhs) {
382 ; GFX6-LABEL: v_usubsat_v3i32:
384 ; GFX6-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
385 ; GFX6-NEXT: v_max_u32_e32 v0, v0, v3
386 ; GFX6-NEXT: v_max_u32_e32 v1, v1, v4
387 ; GFX6-NEXT: v_max_u32_e32 v2, v2, v5
388 ; GFX6-NEXT: v_sub_i32_e32 v0, vcc, v0, v3
389 ; GFX6-NEXT: v_sub_i32_e32 v1, vcc, v1, v4
390 ; GFX6-NEXT: v_sub_i32_e32 v2, vcc, v2, v5
391 ; GFX6-NEXT: s_setpc_b64 s[30:31]
393 ; GFX8-LABEL: v_usubsat_v3i32:
395 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
396 ; GFX8-NEXT: v_sub_u32_e64 v0, s[4:5], v0, v3 clamp
397 ; GFX8-NEXT: v_sub_u32_e64 v1, s[4:5], v1, v4 clamp
398 ; GFX8-NEXT: v_sub_u32_e64 v2, s[4:5], v2, v5 clamp
399 ; GFX8-NEXT: s_setpc_b64 s[30:31]
401 ; GFX9-LABEL: v_usubsat_v3i32:
403 ; GFX9-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
404 ; GFX9-NEXT: v_sub_u32_e64 v0, v0, v3 clamp
405 ; GFX9-NEXT: v_sub_u32_e64 v1, v1, v4 clamp
406 ; GFX9-NEXT: v_sub_u32_e64 v2, v2, v5 clamp
407 ; GFX9-NEXT: s_setpc_b64 s[30:31]
409 ; GFX10PLUS-LABEL: v_usubsat_v3i32:
410 ; GFX10PLUS: ; %bb.0:
411 ; GFX10PLUS-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
412 ; GFX10PLUS-NEXT: v_sub_nc_u32_e64 v0, v0, v3 clamp
413 ; GFX10PLUS-NEXT: v_sub_nc_u32_e64 v1, v1, v4 clamp
414 ; GFX10PLUS-NEXT: v_sub_nc_u32_e64 v2, v2, v5 clamp
415 ; GFX10PLUS-NEXT: s_setpc_b64 s[30:31]
416 %result = call <3 x i32> @llvm.usub.sat.v3i32(<3 x i32> %lhs, <3 x i32> %rhs)
417 ret <3 x i32> %result
420 define <4 x i32> @v_usubsat_v4i32(<4 x i32> %lhs, <4 x i32> %rhs) {
421 ; GFX6-LABEL: v_usubsat_v4i32:
423 ; GFX6-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
424 ; GFX6-NEXT: v_max_u32_e32 v0, v0, v4
425 ; GFX6-NEXT: v_max_u32_e32 v1, v1, v5
426 ; GFX6-NEXT: v_max_u32_e32 v2, v2, v6
427 ; GFX6-NEXT: v_max_u32_e32 v3, v3, v7
428 ; GFX6-NEXT: v_sub_i32_e32 v0, vcc, v0, v4
429 ; GFX6-NEXT: v_sub_i32_e32 v1, vcc, v1, v5
430 ; GFX6-NEXT: v_sub_i32_e32 v2, vcc, v2, v6
431 ; GFX6-NEXT: v_sub_i32_e32 v3, vcc, v3, v7
432 ; GFX6-NEXT: s_setpc_b64 s[30:31]
434 ; GFX8-LABEL: v_usubsat_v4i32:
436 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
437 ; GFX8-NEXT: v_sub_u32_e64 v0, s[4:5], v0, v4 clamp
438 ; GFX8-NEXT: v_sub_u32_e64 v1, s[4:5], v1, v5 clamp
439 ; GFX8-NEXT: v_sub_u32_e64 v2, s[4:5], v2, v6 clamp
440 ; GFX8-NEXT: v_sub_u32_e64 v3, s[4:5], v3, v7 clamp
441 ; GFX8-NEXT: s_setpc_b64 s[30:31]
443 ; GFX9-LABEL: v_usubsat_v4i32:
445 ; GFX9-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
446 ; GFX9-NEXT: v_sub_u32_e64 v0, v0, v4 clamp
447 ; GFX9-NEXT: v_sub_u32_e64 v1, v1, v5 clamp
448 ; GFX9-NEXT: v_sub_u32_e64 v2, v2, v6 clamp
449 ; GFX9-NEXT: v_sub_u32_e64 v3, v3, v7 clamp
450 ; GFX9-NEXT: s_setpc_b64 s[30:31]
452 ; GFX10PLUS-LABEL: v_usubsat_v4i32:
453 ; GFX10PLUS: ; %bb.0:
454 ; GFX10PLUS-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
455 ; GFX10PLUS-NEXT: v_sub_nc_u32_e64 v0, v0, v4 clamp
456 ; GFX10PLUS-NEXT: v_sub_nc_u32_e64 v1, v1, v5 clamp
457 ; GFX10PLUS-NEXT: v_sub_nc_u32_e64 v2, v2, v6 clamp
458 ; GFX10PLUS-NEXT: v_sub_nc_u32_e64 v3, v3, v7 clamp
459 ; GFX10PLUS-NEXT: s_setpc_b64 s[30:31]
460 %result = call <4 x i32> @llvm.usub.sat.v4i32(<4 x i32> %lhs, <4 x i32> %rhs)
461 ret <4 x i32> %result
464 define <8 x i32> @v_usubsat_v8i32(<8 x i32> %lhs, <8 x i32> %rhs) {
465 ; GFX6-LABEL: v_usubsat_v8i32:
467 ; GFX6-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
468 ; GFX6-NEXT: v_max_u32_e32 v0, v0, v8
469 ; GFX6-NEXT: v_max_u32_e32 v1, v1, v9
470 ; GFX6-NEXT: v_max_u32_e32 v2, v2, v10
471 ; GFX6-NEXT: v_max_u32_e32 v3, v3, v11
472 ; GFX6-NEXT: v_max_u32_e32 v4, v4, v12
473 ; GFX6-NEXT: v_max_u32_e32 v5, v5, v13
474 ; GFX6-NEXT: v_max_u32_e32 v6, v6, v14
475 ; GFX6-NEXT: v_max_u32_e32 v7, v7, v15
476 ; GFX6-NEXT: v_sub_i32_e32 v0, vcc, v0, v8
477 ; GFX6-NEXT: v_sub_i32_e32 v1, vcc, v1, v9
478 ; GFX6-NEXT: v_sub_i32_e32 v2, vcc, v2, v10
479 ; GFX6-NEXT: v_sub_i32_e32 v3, vcc, v3, v11
480 ; GFX6-NEXT: v_sub_i32_e32 v4, vcc, v4, v12
481 ; GFX6-NEXT: v_sub_i32_e32 v5, vcc, v5, v13
482 ; GFX6-NEXT: v_sub_i32_e32 v6, vcc, v6, v14
483 ; GFX6-NEXT: v_sub_i32_e32 v7, vcc, v7, v15
484 ; GFX6-NEXT: s_setpc_b64 s[30:31]
486 ; GFX8-LABEL: v_usubsat_v8i32:
488 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
489 ; GFX8-NEXT: v_sub_u32_e64 v0, s[4:5], v0, v8 clamp
490 ; GFX8-NEXT: v_sub_u32_e64 v1, s[4:5], v1, v9 clamp
491 ; GFX8-NEXT: v_sub_u32_e64 v2, s[4:5], v2, v10 clamp
492 ; GFX8-NEXT: v_sub_u32_e64 v3, s[4:5], v3, v11 clamp
493 ; GFX8-NEXT: v_sub_u32_e64 v4, s[4:5], v4, v12 clamp
494 ; GFX8-NEXT: v_sub_u32_e64 v5, s[4:5], v5, v13 clamp
495 ; GFX8-NEXT: v_sub_u32_e64 v6, s[4:5], v6, v14 clamp
496 ; GFX8-NEXT: v_sub_u32_e64 v7, s[4:5], v7, v15 clamp
497 ; GFX8-NEXT: s_setpc_b64 s[30:31]
499 ; GFX9-LABEL: v_usubsat_v8i32:
501 ; GFX9-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
502 ; GFX9-NEXT: v_sub_u32_e64 v0, v0, v8 clamp
503 ; GFX9-NEXT: v_sub_u32_e64 v1, v1, v9 clamp
504 ; GFX9-NEXT: v_sub_u32_e64 v2, v2, v10 clamp
505 ; GFX9-NEXT: v_sub_u32_e64 v3, v3, v11 clamp
506 ; GFX9-NEXT: v_sub_u32_e64 v4, v4, v12 clamp
507 ; GFX9-NEXT: v_sub_u32_e64 v5, v5, v13 clamp
508 ; GFX9-NEXT: v_sub_u32_e64 v6, v6, v14 clamp
509 ; GFX9-NEXT: v_sub_u32_e64 v7, v7, v15 clamp
510 ; GFX9-NEXT: s_setpc_b64 s[30:31]
512 ; GFX10PLUS-LABEL: v_usubsat_v8i32:
513 ; GFX10PLUS: ; %bb.0:
514 ; GFX10PLUS-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
515 ; GFX10PLUS-NEXT: v_sub_nc_u32_e64 v0, v0, v8 clamp
516 ; GFX10PLUS-NEXT: v_sub_nc_u32_e64 v1, v1, v9 clamp
517 ; GFX10PLUS-NEXT: v_sub_nc_u32_e64 v2, v2, v10 clamp
518 ; GFX10PLUS-NEXT: v_sub_nc_u32_e64 v3, v3, v11 clamp
519 ; GFX10PLUS-NEXT: v_sub_nc_u32_e64 v4, v4, v12 clamp
520 ; GFX10PLUS-NEXT: v_sub_nc_u32_e64 v5, v5, v13 clamp
521 ; GFX10PLUS-NEXT: v_sub_nc_u32_e64 v6, v6, v14 clamp
522 ; GFX10PLUS-NEXT: v_sub_nc_u32_e64 v7, v7, v15 clamp
523 ; GFX10PLUS-NEXT: s_setpc_b64 s[30:31]
524 %result = call <8 x i32> @llvm.usub.sat.v8i32(<8 x i32> %lhs, <8 x i32> %rhs)
525 ret <8 x i32> %result
528 define <16 x i32> @v_usubsat_v16i32(<16 x i32> %lhs, <16 x i32> %rhs) {
529 ; GFX6-LABEL: v_usubsat_v16i32:
531 ; GFX6-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
532 ; GFX6-NEXT: v_max_u32_e32 v0, v0, v16
533 ; GFX6-NEXT: v_sub_i32_e32 v0, vcc, v0, v16
534 ; GFX6-NEXT: buffer_load_dword v16, off, s[0:3], s32
535 ; GFX6-NEXT: v_max_u32_e32 v1, v1, v17
536 ; GFX6-NEXT: v_max_u32_e32 v2, v2, v18
537 ; GFX6-NEXT: v_max_u32_e32 v3, v3, v19
538 ; GFX6-NEXT: v_max_u32_e32 v4, v4, v20
539 ; GFX6-NEXT: v_max_u32_e32 v5, v5, v21
540 ; GFX6-NEXT: v_max_u32_e32 v6, v6, v22
541 ; GFX6-NEXT: v_max_u32_e32 v7, v7, v23
542 ; GFX6-NEXT: v_max_u32_e32 v8, v8, v24
543 ; GFX6-NEXT: v_max_u32_e32 v9, v9, v25
544 ; GFX6-NEXT: v_max_u32_e32 v10, v10, v26
545 ; GFX6-NEXT: v_max_u32_e32 v11, v11, v27
546 ; GFX6-NEXT: v_max_u32_e32 v12, v12, v28
547 ; GFX6-NEXT: v_max_u32_e32 v13, v13, v29
548 ; GFX6-NEXT: v_max_u32_e32 v14, v14, v30
549 ; GFX6-NEXT: v_sub_i32_e32 v1, vcc, v1, v17
550 ; GFX6-NEXT: v_sub_i32_e32 v2, vcc, v2, v18
551 ; GFX6-NEXT: v_sub_i32_e32 v3, vcc, v3, v19
552 ; GFX6-NEXT: v_sub_i32_e32 v4, vcc, v4, v20
553 ; GFX6-NEXT: v_sub_i32_e32 v5, vcc, v5, v21
554 ; GFX6-NEXT: v_sub_i32_e32 v6, vcc, v6, v22
555 ; GFX6-NEXT: v_sub_i32_e32 v7, vcc, v7, v23
556 ; GFX6-NEXT: v_sub_i32_e32 v8, vcc, v8, v24
557 ; GFX6-NEXT: v_sub_i32_e32 v9, vcc, v9, v25
558 ; GFX6-NEXT: v_sub_i32_e32 v10, vcc, v10, v26
559 ; GFX6-NEXT: v_sub_i32_e32 v11, vcc, v11, v27
560 ; GFX6-NEXT: v_sub_i32_e32 v12, vcc, v12, v28
561 ; GFX6-NEXT: v_sub_i32_e32 v13, vcc, v13, v29
562 ; GFX6-NEXT: v_sub_i32_e32 v14, vcc, v14, v30
563 ; GFX6-NEXT: s_waitcnt vmcnt(0)
564 ; GFX6-NEXT: v_max_u32_e32 v15, v15, v16
565 ; GFX6-NEXT: v_sub_i32_e32 v15, vcc, v15, v16
566 ; GFX6-NEXT: s_setpc_b64 s[30:31]
568 ; GFX8-LABEL: v_usubsat_v16i32:
570 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
571 ; GFX8-NEXT: v_sub_u32_e64 v0, s[4:5], v0, v16 clamp
572 ; GFX8-NEXT: buffer_load_dword v16, off, s[0:3], s32
573 ; GFX8-NEXT: v_sub_u32_e64 v1, s[4:5], v1, v17 clamp
574 ; GFX8-NEXT: v_sub_u32_e64 v2, s[4:5], v2, v18 clamp
575 ; GFX8-NEXT: v_sub_u32_e64 v3, s[4:5], v3, v19 clamp
576 ; GFX8-NEXT: v_sub_u32_e64 v4, s[4:5], v4, v20 clamp
577 ; GFX8-NEXT: v_sub_u32_e64 v5, s[4:5], v5, v21 clamp
578 ; GFX8-NEXT: v_sub_u32_e64 v6, s[4:5], v6, v22 clamp
579 ; GFX8-NEXT: v_sub_u32_e64 v7, s[4:5], v7, v23 clamp
580 ; GFX8-NEXT: v_sub_u32_e64 v8, s[4:5], v8, v24 clamp
581 ; GFX8-NEXT: v_sub_u32_e64 v9, s[4:5], v9, v25 clamp
582 ; GFX8-NEXT: v_sub_u32_e64 v10, s[4:5], v10, v26 clamp
583 ; GFX8-NEXT: v_sub_u32_e64 v11, s[4:5], v11, v27 clamp
584 ; GFX8-NEXT: v_sub_u32_e64 v12, s[4:5], v12, v28 clamp
585 ; GFX8-NEXT: v_sub_u32_e64 v13, s[4:5], v13, v29 clamp
586 ; GFX8-NEXT: v_sub_u32_e64 v14, s[4:5], v14, v30 clamp
587 ; GFX8-NEXT: s_waitcnt vmcnt(0)
588 ; GFX8-NEXT: v_sub_u32_e64 v15, s[4:5], v15, v16 clamp
589 ; GFX8-NEXT: s_setpc_b64 s[30:31]
591 ; GFX9-LABEL: v_usubsat_v16i32:
593 ; GFX9-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
594 ; GFX9-NEXT: v_sub_u32_e64 v0, v0, v16 clamp
595 ; GFX9-NEXT: buffer_load_dword v16, off, s[0:3], s32
596 ; GFX9-NEXT: v_sub_u32_e64 v1, v1, v17 clamp
597 ; GFX9-NEXT: v_sub_u32_e64 v2, v2, v18 clamp
598 ; GFX9-NEXT: v_sub_u32_e64 v3, v3, v19 clamp
599 ; GFX9-NEXT: v_sub_u32_e64 v4, v4, v20 clamp
600 ; GFX9-NEXT: v_sub_u32_e64 v5, v5, v21 clamp
601 ; GFX9-NEXT: v_sub_u32_e64 v6, v6, v22 clamp
602 ; GFX9-NEXT: v_sub_u32_e64 v7, v7, v23 clamp
603 ; GFX9-NEXT: v_sub_u32_e64 v8, v8, v24 clamp
604 ; GFX9-NEXT: v_sub_u32_e64 v9, v9, v25 clamp
605 ; GFX9-NEXT: v_sub_u32_e64 v10, v10, v26 clamp
606 ; GFX9-NEXT: v_sub_u32_e64 v11, v11, v27 clamp
607 ; GFX9-NEXT: v_sub_u32_e64 v12, v12, v28 clamp
608 ; GFX9-NEXT: v_sub_u32_e64 v13, v13, v29 clamp
609 ; GFX9-NEXT: v_sub_u32_e64 v14, v14, v30 clamp
610 ; GFX9-NEXT: s_waitcnt vmcnt(0)
611 ; GFX9-NEXT: v_sub_u32_e64 v15, v15, v16 clamp
612 ; GFX9-NEXT: s_setpc_b64 s[30:31]
614 ; GFX10-LABEL: v_usubsat_v16i32:
616 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
617 ; GFX10-NEXT: buffer_load_dword v31, off, s[0:3], s32
618 ; GFX10-NEXT: v_sub_nc_u32_e64 v0, v0, v16 clamp
619 ; GFX10-NEXT: v_sub_nc_u32_e64 v1, v1, v17 clamp
620 ; GFX10-NEXT: v_sub_nc_u32_e64 v2, v2, v18 clamp
621 ; GFX10-NEXT: v_sub_nc_u32_e64 v3, v3, v19 clamp
622 ; GFX10-NEXT: v_sub_nc_u32_e64 v4, v4, v20 clamp
623 ; GFX10-NEXT: v_sub_nc_u32_e64 v5, v5, v21 clamp
624 ; GFX10-NEXT: v_sub_nc_u32_e64 v6, v6, v22 clamp
625 ; GFX10-NEXT: v_sub_nc_u32_e64 v7, v7, v23 clamp
626 ; GFX10-NEXT: v_sub_nc_u32_e64 v8, v8, v24 clamp
627 ; GFX10-NEXT: v_sub_nc_u32_e64 v9, v9, v25 clamp
628 ; GFX10-NEXT: v_sub_nc_u32_e64 v10, v10, v26 clamp
629 ; GFX10-NEXT: v_sub_nc_u32_e64 v11, v11, v27 clamp
630 ; GFX10-NEXT: v_sub_nc_u32_e64 v12, v12, v28 clamp
631 ; GFX10-NEXT: v_sub_nc_u32_e64 v13, v13, v29 clamp
632 ; GFX10-NEXT: v_sub_nc_u32_e64 v14, v14, v30 clamp
633 ; GFX10-NEXT: s_waitcnt vmcnt(0)
634 ; GFX10-NEXT: v_sub_nc_u32_e64 v15, v15, v31 clamp
635 ; GFX10-NEXT: s_setpc_b64 s[30:31]
637 ; GFX11-LABEL: v_usubsat_v16i32:
639 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
640 ; GFX11-NEXT: scratch_load_b32 v31, off, s32
641 ; GFX11-NEXT: v_sub_nc_u32_e64 v0, v0, v16 clamp
642 ; GFX11-NEXT: v_sub_nc_u32_e64 v1, v1, v17 clamp
643 ; GFX11-NEXT: v_sub_nc_u32_e64 v2, v2, v18 clamp
644 ; GFX11-NEXT: v_sub_nc_u32_e64 v3, v3, v19 clamp
645 ; GFX11-NEXT: v_sub_nc_u32_e64 v4, v4, v20 clamp
646 ; GFX11-NEXT: v_sub_nc_u32_e64 v5, v5, v21 clamp
647 ; GFX11-NEXT: v_sub_nc_u32_e64 v6, v6, v22 clamp
648 ; GFX11-NEXT: v_sub_nc_u32_e64 v7, v7, v23 clamp
649 ; GFX11-NEXT: v_sub_nc_u32_e64 v8, v8, v24 clamp
650 ; GFX11-NEXT: v_sub_nc_u32_e64 v9, v9, v25 clamp
651 ; GFX11-NEXT: v_sub_nc_u32_e64 v10, v10, v26 clamp
652 ; GFX11-NEXT: v_sub_nc_u32_e64 v11, v11, v27 clamp
653 ; GFX11-NEXT: v_sub_nc_u32_e64 v12, v12, v28 clamp
654 ; GFX11-NEXT: v_sub_nc_u32_e64 v13, v13, v29 clamp
655 ; GFX11-NEXT: v_sub_nc_u32_e64 v14, v14, v30 clamp
656 ; GFX11-NEXT: s_waitcnt vmcnt(0)
657 ; GFX11-NEXT: v_sub_nc_u32_e64 v15, v15, v31 clamp
658 ; GFX11-NEXT: s_setpc_b64 s[30:31]
659 %result = call <16 x i32> @llvm.usub.sat.v16i32(<16 x i32> %lhs, <16 x i32> %rhs)
660 ret <16 x i32> %result
664 define i64 @v_usubsat_i64(i64 %lhs, i64 %rhs) {
665 ; GFX6-LABEL: v_usubsat_i64:
667 ; GFX6-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
668 ; GFX6-NEXT: v_sub_i32_e32 v2, vcc, v0, v2
669 ; GFX6-NEXT: v_subb_u32_e32 v3, vcc, v1, v3, vcc
670 ; GFX6-NEXT: v_cmp_gt_u64_e32 vcc, v[2:3], v[0:1]
671 ; GFX6-NEXT: v_cndmask_b32_e64 v0, v2, 0, vcc
672 ; GFX6-NEXT: v_cndmask_b32_e64 v1, v3, 0, vcc
673 ; GFX6-NEXT: s_setpc_b64 s[30:31]
675 ; GFX8-LABEL: v_usubsat_i64:
677 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
678 ; GFX8-NEXT: v_sub_u32_e32 v2, vcc, v0, v2
679 ; GFX8-NEXT: v_subb_u32_e32 v3, vcc, v1, v3, vcc
680 ; GFX8-NEXT: v_cmp_gt_u64_e32 vcc, v[2:3], v[0:1]
681 ; GFX8-NEXT: v_cndmask_b32_e64 v0, v2, 0, vcc
682 ; GFX8-NEXT: v_cndmask_b32_e64 v1, v3, 0, vcc
683 ; GFX8-NEXT: s_setpc_b64 s[30:31]
685 ; GFX9-LABEL: v_usubsat_i64:
687 ; GFX9-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
688 ; GFX9-NEXT: v_sub_co_u32_e32 v2, vcc, v0, v2
689 ; GFX9-NEXT: v_subb_co_u32_e32 v3, vcc, v1, v3, vcc
690 ; GFX9-NEXT: v_cmp_gt_u64_e32 vcc, v[2:3], v[0:1]
691 ; GFX9-NEXT: v_cndmask_b32_e64 v0, v2, 0, vcc
692 ; GFX9-NEXT: v_cndmask_b32_e64 v1, v3, 0, vcc
693 ; GFX9-NEXT: s_setpc_b64 s[30:31]
695 ; GFX10PLUS-LABEL: v_usubsat_i64:
696 ; GFX10PLUS: ; %bb.0:
697 ; GFX10PLUS-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
698 ; GFX10PLUS-NEXT: v_sub_co_u32 v2, vcc_lo, v0, v2
699 ; GFX10PLUS-NEXT: v_sub_co_ci_u32_e32 v3, vcc_lo, v1, v3, vcc_lo
700 ; GFX10PLUS-NEXT: v_cmp_gt_u64_e32 vcc_lo, v[2:3], v[0:1]
701 ; GFX10PLUS-NEXT: v_cndmask_b32_e64 v0, v2, 0, vcc_lo
702 ; GFX10PLUS-NEXT: v_cndmask_b32_e64 v1, v3, 0, vcc_lo
703 ; GFX10PLUS-NEXT: s_setpc_b64 s[30:31]
704 %result = call i64 @llvm.usub.sat.i64(i64 %lhs, i64 %rhs)
708 declare i8 @llvm.usub.sat.i8(i8, i8) #0
709 declare i16 @llvm.usub.sat.i16(i16, i16) #0
710 declare <2 x i16> @llvm.usub.sat.v2i16(<2 x i16>, <2 x i16>) #0
711 declare <3 x i16> @llvm.usub.sat.v3i16(<3 x i16>, <3 x i16>) #0
712 declare <4 x i16> @llvm.usub.sat.v4i16(<4 x i16>, <4 x i16>) #0
713 declare i32 @llvm.usub.sat.i32(i32, i32) #0
714 declare <2 x i32> @llvm.usub.sat.v2i32(<2 x i32>, <2 x i32>) #0
715 declare <3 x i32> @llvm.usub.sat.v3i32(<3 x i32>, <3 x i32>) #0
716 declare <4 x i32> @llvm.usub.sat.v4i32(<4 x i32>, <4 x i32>) #0
717 declare <8 x i32> @llvm.usub.sat.v8i32(<8 x i32>, <8 x i32>) #0
718 declare <16 x i32> @llvm.usub.sat.v16i32(<16 x i32>, <16 x i32>) #0
719 declare i64 @llvm.usub.sat.i64(i64, i64) #0
721 attributes #0 = { nounwind readnone speculatable willreturn }