1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -amdgpu-scalarize-global-loads=false -march=amdgcn -mcpu=tahiti -verify-machineinstrs | FileCheck %s --check-prefix=SI
3 ; RUN: llc < %s -amdgpu-scalarize-global-loads=false -march=amdgcn -mcpu=tonga -verify-machineinstrs | FileCheck %s --check-prefix=VI
4 ; RUN: llc < %s -amdgpu-scalarize-global-loads=false -march=amdgcn -mcpu=gfx900 -verify-machineinstrs | FileCheck %s --check-prefix=GFX9
5 ; RUN: llc < %s -amdgpu-scalarize-global-loads=false -march=amdgcn -mcpu=gfx1010 -verify-machineinstrs | FileCheck %s --check-prefix=GFX10
6 ; RUN: llc < %s -amdgpu-scalarize-global-loads=false -march=amdgcn -mcpu=gfx1100 -verify-machineinstrs | FileCheck %s --check-prefix=GFX11
9 declare { i32, i1 } @llvm.sadd.with.overflow.i32(i32, i32) nounwind readnone
10 declare { i64, i1 } @llvm.sadd.with.overflow.i64(i64, i64) nounwind readnone
13 declare { <2 x i32>, <2 x i1> } @llvm.sadd.with.overflow.v2i32(<2 x i32>, <2 x i32>) nounwind readnone
15 define amdgpu_kernel void @saddo_i64_zext(ptr addrspace(1) %out, i64 %a, i64 %b) nounwind {
16 ; SI-LABEL: saddo_i64_zext:
18 ; SI-NEXT: s_load_dwordx4 s[4:7], s[0:1], 0x9
19 ; SI-NEXT: s_load_dwordx2 s[8:9], s[0:1], 0xd
20 ; SI-NEXT: s_mov_b32 s3, 0xf000
21 ; SI-NEXT: s_mov_b32 s2, -1
22 ; SI-NEXT: s_waitcnt lgkmcnt(0)
23 ; SI-NEXT: v_mov_b32_e32 v0, s6
24 ; SI-NEXT: s_add_u32 s10, s6, s8
25 ; SI-NEXT: s_addc_u32 s11, s7, s9
26 ; SI-NEXT: v_mov_b32_e32 v1, s7
27 ; SI-NEXT: v_cmp_lt_i64_e32 vcc, s[10:11], v[0:1]
28 ; SI-NEXT: v_cmp_lt_i64_e64 s[6:7], s[8:9], 0
29 ; SI-NEXT: s_mov_b32 s0, s4
30 ; SI-NEXT: s_mov_b32 s1, s5
31 ; SI-NEXT: s_xor_b64 s[4:5], s[6:7], vcc
32 ; SI-NEXT: v_cndmask_b32_e64 v0, 0, 1, s[4:5]
33 ; SI-NEXT: v_mov_b32_e32 v1, s11
34 ; SI-NEXT: v_add_i32_e32 v0, vcc, s10, v0
35 ; SI-NEXT: v_addc_u32_e32 v1, vcc, 0, v1, vcc
36 ; SI-NEXT: buffer_store_dwordx2 v[0:1], off, s[0:3], 0
39 ; VI-LABEL: saddo_i64_zext:
41 ; VI-NEXT: s_load_dwordx4 s[4:7], s[0:1], 0x24
42 ; VI-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x34
43 ; VI-NEXT: s_waitcnt lgkmcnt(0)
44 ; VI-NEXT: v_mov_b32_e32 v1, s6
45 ; VI-NEXT: s_add_u32 s2, s6, s0
46 ; VI-NEXT: v_mov_b32_e32 v2, s7
47 ; VI-NEXT: s_addc_u32 s3, s7, s1
48 ; VI-NEXT: v_cmp_lt_i64_e64 s[8:9], s[0:1], 0
49 ; VI-NEXT: v_cmp_lt_i64_e32 vcc, s[2:3], v[1:2]
50 ; VI-NEXT: v_mov_b32_e32 v3, s3
51 ; VI-NEXT: s_xor_b64 s[0:1], s[8:9], vcc
52 ; VI-NEXT: v_cndmask_b32_e64 v2, 0, 1, s[0:1]
53 ; VI-NEXT: v_add_u32_e32 v2, vcc, s2, v2
54 ; VI-NEXT: v_mov_b32_e32 v0, s4
55 ; VI-NEXT: v_mov_b32_e32 v1, s5
56 ; VI-NEXT: v_addc_u32_e32 v3, vcc, 0, v3, vcc
57 ; VI-NEXT: flat_store_dwordx2 v[0:1], v[2:3]
60 ; GFX9-LABEL: saddo_i64_zext:
62 ; GFX9-NEXT: s_load_dwordx4 s[4:7], s[0:1], 0x24
63 ; GFX9-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x34
64 ; GFX9-NEXT: v_mov_b32_e32 v2, 0
65 ; GFX9-NEXT: s_waitcnt lgkmcnt(0)
66 ; GFX9-NEXT: v_mov_b32_e32 v0, s6
67 ; GFX9-NEXT: s_add_u32 s0, s6, s2
68 ; GFX9-NEXT: v_mov_b32_e32 v1, s7
69 ; GFX9-NEXT: s_addc_u32 s1, s7, s3
70 ; GFX9-NEXT: v_cmp_lt_i64_e64 s[8:9], s[2:3], 0
71 ; GFX9-NEXT: v_cmp_lt_i64_e32 vcc, s[0:1], v[0:1]
72 ; GFX9-NEXT: v_mov_b32_e32 v1, s1
73 ; GFX9-NEXT: s_xor_b64 s[2:3], s[8:9], vcc
74 ; GFX9-NEXT: v_cndmask_b32_e64 v0, 0, 1, s[2:3]
75 ; GFX9-NEXT: v_add_co_u32_e32 v0, vcc, s0, v0
76 ; GFX9-NEXT: v_addc_co_u32_e32 v1, vcc, 0, v1, vcc
77 ; GFX9-NEXT: global_store_dwordx2 v2, v[0:1], s[4:5]
80 ; GFX10-LABEL: saddo_i64_zext:
82 ; GFX10-NEXT: s_clause 0x1
83 ; GFX10-NEXT: s_load_dwordx4 s[4:7], s[0:1], 0x24
84 ; GFX10-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x34
85 ; GFX10-NEXT: v_mov_b32_e32 v2, 0
86 ; GFX10-NEXT: s_waitcnt lgkmcnt(0)
87 ; GFX10-NEXT: s_add_u32 s0, s6, s2
88 ; GFX10-NEXT: s_addc_u32 s1, s7, s3
89 ; GFX10-NEXT: v_cmp_lt_i64_e64 s2, s[2:3], 0
90 ; GFX10-NEXT: v_cmp_lt_i64_e64 s3, s[0:1], s[6:7]
91 ; GFX10-NEXT: s_xor_b32 s2, s2, s3
92 ; GFX10-NEXT: v_cndmask_b32_e64 v0, 0, 1, s2
93 ; GFX10-NEXT: v_add_co_u32 v0, s0, s0, v0
94 ; GFX10-NEXT: v_add_co_ci_u32_e64 v1, s0, s1, 0, s0
95 ; GFX10-NEXT: global_store_dwordx2 v2, v[0:1], s[4:5]
96 ; GFX10-NEXT: s_endpgm
98 ; GFX11-LABEL: saddo_i64_zext:
100 ; GFX11-NEXT: s_clause 0x1
101 ; GFX11-NEXT: s_load_b128 s[4:7], s[0:1], 0x24
102 ; GFX11-NEXT: s_load_b64 s[0:1], s[0:1], 0x34
103 ; GFX11-NEXT: v_mov_b32_e32 v2, 0
104 ; GFX11-NEXT: s_waitcnt lgkmcnt(0)
105 ; GFX11-NEXT: s_add_u32 s2, s6, s0
106 ; GFX11-NEXT: s_addc_u32 s3, s7, s1
107 ; GFX11-NEXT: v_cmp_lt_i64_e64 s0, s[0:1], 0
108 ; GFX11-NEXT: v_cmp_lt_i64_e64 s1, s[2:3], s[6:7]
109 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
110 ; GFX11-NEXT: s_xor_b32 s0, s0, s1
111 ; GFX11-NEXT: v_cndmask_b32_e64 v0, 0, 1, s0
112 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
113 ; GFX11-NEXT: v_add_co_u32 v0, s0, s2, v0
114 ; GFX11-NEXT: v_add_co_ci_u32_e64 v1, null, s3, 0, s0
115 ; GFX11-NEXT: global_store_b64 v2, v[0:1], s[4:5]
116 ; GFX11-NEXT: s_nop 0
117 ; GFX11-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
118 ; GFX11-NEXT: s_endpgm
119 %sadd = call { i64, i1 } @llvm.sadd.with.overflow.i64(i64 %a, i64 %b) nounwind
120 %val = extractvalue { i64, i1 } %sadd, 0
121 %carry = extractvalue { i64, i1 } %sadd, 1
122 %ext = zext i1 %carry to i64
123 %add2 = add i64 %val, %ext
124 store i64 %add2, ptr addrspace(1) %out, align 8
128 define amdgpu_kernel void @s_saddo_i32(ptr addrspace(1) %out, ptr addrspace(1) %carryout, i32 %a, i32 %b) nounwind {
129 ; SI-LABEL: s_saddo_i32:
131 ; SI-NEXT: s_load_dwordx4 s[4:7], s[0:1], 0x9
132 ; SI-NEXT: s_load_dwordx2 s[8:9], s[0:1], 0xd
133 ; SI-NEXT: s_mov_b32 s3, 0xf000
134 ; SI-NEXT: s_mov_b32 s2, -1
135 ; SI-NEXT: s_waitcnt lgkmcnt(0)
136 ; SI-NEXT: s_mov_b32 s0, s4
137 ; SI-NEXT: s_add_i32 s12, s8, s9
138 ; SI-NEXT: s_cmp_lt_i32 s9, 0
139 ; SI-NEXT: s_cselect_b64 s[10:11], -1, 0
140 ; SI-NEXT: s_cmp_lt_i32 s12, s8
141 ; SI-NEXT: s_mov_b32 s1, s5
142 ; SI-NEXT: s_cselect_b64 s[8:9], -1, 0
143 ; SI-NEXT: v_mov_b32_e32 v0, s12
144 ; SI-NEXT: buffer_store_dword v0, off, s[0:3], 0
145 ; SI-NEXT: s_xor_b64 s[0:1], s[10:11], s[8:9]
146 ; SI-NEXT: s_mov_b32 s4, s6
147 ; SI-NEXT: s_mov_b32 s5, s7
148 ; SI-NEXT: s_mov_b32 s6, s2
149 ; SI-NEXT: s_mov_b32 s7, s3
150 ; SI-NEXT: s_waitcnt expcnt(0)
151 ; SI-NEXT: v_cndmask_b32_e64 v0, 0, 1, s[0:1]
152 ; SI-NEXT: buffer_store_byte v0, off, s[4:7], 0
155 ; VI-LABEL: s_saddo_i32:
157 ; VI-NEXT: s_load_dwordx4 s[4:7], s[0:1], 0x24
158 ; VI-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x34
159 ; VI-NEXT: s_waitcnt lgkmcnt(0)
160 ; VI-NEXT: v_mov_b32_e32 v0, s4
161 ; VI-NEXT: s_add_i32 s4, s0, s1
162 ; VI-NEXT: s_cmp_lt_i32 s1, 0
163 ; VI-NEXT: s_cselect_b64 s[2:3], -1, 0
164 ; VI-NEXT: s_cmp_lt_i32 s4, s0
165 ; VI-NEXT: s_cselect_b64 s[0:1], -1, 0
166 ; VI-NEXT: v_mov_b32_e32 v1, s5
167 ; VI-NEXT: v_mov_b32_e32 v4, s4
168 ; VI-NEXT: s_xor_b64 s[0:1], s[2:3], s[0:1]
169 ; VI-NEXT: v_mov_b32_e32 v2, s6
170 ; VI-NEXT: v_mov_b32_e32 v3, s7
171 ; VI-NEXT: flat_store_dword v[0:1], v4
172 ; VI-NEXT: v_cndmask_b32_e64 v0, 0, 1, s[0:1]
173 ; VI-NEXT: flat_store_byte v[2:3], v0
176 ; GFX9-LABEL: s_saddo_i32:
178 ; GFX9-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x34
179 ; GFX9-NEXT: s_load_dwordx4 s[4:7], s[0:1], 0x24
180 ; GFX9-NEXT: v_mov_b32_e32 v0, 0
181 ; GFX9-NEXT: s_waitcnt lgkmcnt(0)
182 ; GFX9-NEXT: v_mov_b32_e32 v1, s3
183 ; GFX9-NEXT: s_add_i32 s0, s2, s3
184 ; GFX9-NEXT: v_add_i32 v1, s2, v1 clamp
185 ; GFX9-NEXT: v_cmp_ne_u32_e32 vcc, s0, v1
186 ; GFX9-NEXT: v_mov_b32_e32 v2, s0
187 ; GFX9-NEXT: v_cndmask_b32_e64 v1, 0, 1, vcc
188 ; GFX9-NEXT: global_store_dword v0, v2, s[4:5]
189 ; GFX9-NEXT: global_store_byte v0, v1, s[6:7]
190 ; GFX9-NEXT: s_endpgm
192 ; GFX10-LABEL: s_saddo_i32:
194 ; GFX10-NEXT: s_clause 0x1
195 ; GFX10-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x34
196 ; GFX10-NEXT: s_load_dwordx4 s[4:7], s[0:1], 0x24
197 ; GFX10-NEXT: v_mov_b32_e32 v1, 0
198 ; GFX10-NEXT: s_waitcnt lgkmcnt(0)
199 ; GFX10-NEXT: v_add_nc_i32 v0, s2, s3 clamp
200 ; GFX10-NEXT: s_add_i32 s0, s2, s3
201 ; GFX10-NEXT: v_mov_b32_e32 v2, s0
202 ; GFX10-NEXT: v_cmp_ne_u32_e32 vcc_lo, s0, v0
203 ; GFX10-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
204 ; GFX10-NEXT: global_store_dword v1, v2, s[4:5]
205 ; GFX10-NEXT: global_store_byte v1, v0, s[6:7]
206 ; GFX10-NEXT: s_endpgm
208 ; GFX11-LABEL: s_saddo_i32:
210 ; GFX11-NEXT: s_clause 0x1
211 ; GFX11-NEXT: s_load_b64 s[4:5], s[0:1], 0x34
212 ; GFX11-NEXT: s_load_b128 s[0:3], s[0:1], 0x24
213 ; GFX11-NEXT: s_waitcnt lgkmcnt(0)
214 ; GFX11-NEXT: v_add_nc_i32 v0, s4, s5 clamp
215 ; GFX11-NEXT: s_add_i32 s4, s4, s5
216 ; GFX11-NEXT: s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(VALU_DEP_2)
217 ; GFX11-NEXT: v_dual_mov_b32 v1, 0 :: v_dual_mov_b32 v2, s4
218 ; GFX11-NEXT: v_cmp_ne_u32_e32 vcc_lo, s4, v0
219 ; GFX11-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
220 ; GFX11-NEXT: s_clause 0x1
221 ; GFX11-NEXT: global_store_b32 v1, v2, s[0:1]
222 ; GFX11-NEXT: global_store_b8 v1, v0, s[2:3]
223 ; GFX11-NEXT: s_nop 0
224 ; GFX11-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
225 ; GFX11-NEXT: s_endpgm
226 %sadd = call { i32, i1 } @llvm.sadd.with.overflow.i32(i32 %a, i32 %b) nounwind
227 %val = extractvalue { i32, i1 } %sadd, 0
228 %carry = extractvalue { i32, i1 } %sadd, 1
229 store i32 %val, ptr addrspace(1) %out, align 4
230 store i1 %carry, ptr addrspace(1) %carryout
234 define amdgpu_kernel void @v_saddo_i32(ptr addrspace(1) %out, ptr addrspace(1) %carryout, ptr addrspace(1) %aptr, ptr addrspace(1) %bptr) nounwind {
235 ; SI-LABEL: v_saddo_i32:
237 ; SI-NEXT: s_load_dwordx8 s[0:7], s[0:1], 0x9
238 ; SI-NEXT: s_mov_b32 s11, 0xf000
239 ; SI-NEXT: s_mov_b32 s10, -1
240 ; SI-NEXT: s_mov_b32 s14, s10
241 ; SI-NEXT: s_mov_b32 s15, s11
242 ; SI-NEXT: s_waitcnt lgkmcnt(0)
243 ; SI-NEXT: s_mov_b32 s12, s4
244 ; SI-NEXT: s_mov_b32 s13, s5
245 ; SI-NEXT: s_mov_b32 s4, s6
246 ; SI-NEXT: s_mov_b32 s5, s7
247 ; SI-NEXT: s_mov_b32 s6, s10
248 ; SI-NEXT: s_mov_b32 s7, s11
249 ; SI-NEXT: buffer_load_dword v0, off, s[12:15], 0
250 ; SI-NEXT: buffer_load_dword v1, off, s[4:7], 0
251 ; SI-NEXT: s_mov_b32 s8, s0
252 ; SI-NEXT: s_mov_b32 s9, s1
253 ; SI-NEXT: s_mov_b32 s4, s2
254 ; SI-NEXT: s_mov_b32 s5, s3
255 ; SI-NEXT: s_waitcnt vmcnt(0)
256 ; SI-NEXT: v_add_i32_e32 v2, vcc, v0, v1
257 ; SI-NEXT: v_cmp_gt_i32_e32 vcc, 0, v1
258 ; SI-NEXT: v_cmp_lt_i32_e64 s[0:1], v2, v0
259 ; SI-NEXT: s_xor_b64 s[0:1], vcc, s[0:1]
260 ; SI-NEXT: v_cndmask_b32_e64 v0, 0, 1, s[0:1]
261 ; SI-NEXT: buffer_store_dword v2, off, s[8:11], 0
262 ; SI-NEXT: buffer_store_byte v0, off, s[4:7], 0
265 ; VI-LABEL: v_saddo_i32:
267 ; VI-NEXT: s_load_dwordx8 s[0:7], s[0:1], 0x24
268 ; VI-NEXT: s_waitcnt lgkmcnt(0)
269 ; VI-NEXT: v_mov_b32_e32 v0, s4
270 ; VI-NEXT: v_mov_b32_e32 v1, s5
271 ; VI-NEXT: v_mov_b32_e32 v2, s6
272 ; VI-NEXT: v_mov_b32_e32 v3, s7
273 ; VI-NEXT: flat_load_dword v4, v[0:1]
274 ; VI-NEXT: flat_load_dword v5, v[2:3]
275 ; VI-NEXT: v_mov_b32_e32 v0, s0
276 ; VI-NEXT: v_mov_b32_e32 v1, s1
277 ; VI-NEXT: v_mov_b32_e32 v2, s2
278 ; VI-NEXT: v_mov_b32_e32 v3, s3
279 ; VI-NEXT: s_waitcnt vmcnt(0)
280 ; VI-NEXT: v_add_u32_e32 v6, vcc, v4, v5
281 ; VI-NEXT: v_cmp_gt_i32_e32 vcc, 0, v5
282 ; VI-NEXT: v_cmp_lt_i32_e64 s[0:1], v6, v4
283 ; VI-NEXT: s_xor_b64 s[0:1], vcc, s[0:1]
284 ; VI-NEXT: flat_store_dword v[0:1], v6
285 ; VI-NEXT: v_cndmask_b32_e64 v0, 0, 1, s[0:1]
286 ; VI-NEXT: flat_store_byte v[2:3], v0
289 ; GFX9-LABEL: v_saddo_i32:
291 ; GFX9-NEXT: s_load_dwordx8 s[0:7], s[0:1], 0x24
292 ; GFX9-NEXT: v_mov_b32_e32 v0, 0
293 ; GFX9-NEXT: s_waitcnt lgkmcnt(0)
294 ; GFX9-NEXT: global_load_dword v1, v0, s[4:5]
295 ; GFX9-NEXT: global_load_dword v2, v0, s[6:7]
296 ; GFX9-NEXT: s_waitcnt vmcnt(0)
297 ; GFX9-NEXT: v_add_i32 v3, v1, v2 clamp
298 ; GFX9-NEXT: v_add_u32_e32 v1, v1, v2
299 ; GFX9-NEXT: v_cmp_ne_u32_e32 vcc, v1, v3
300 ; GFX9-NEXT: global_store_dword v0, v1, s[0:1]
301 ; GFX9-NEXT: v_cndmask_b32_e64 v1, 0, 1, vcc
302 ; GFX9-NEXT: global_store_byte v0, v1, s[2:3]
303 ; GFX9-NEXT: s_endpgm
305 ; GFX10-LABEL: v_saddo_i32:
307 ; GFX10-NEXT: s_load_dwordx8 s[0:7], s[0:1], 0x24
308 ; GFX10-NEXT: v_mov_b32_e32 v0, 0
309 ; GFX10-NEXT: s_waitcnt lgkmcnt(0)
310 ; GFX10-NEXT: s_clause 0x1
311 ; GFX10-NEXT: global_load_dword v1, v0, s[4:5]
312 ; GFX10-NEXT: global_load_dword v2, v0, s[6:7]
313 ; GFX10-NEXT: s_waitcnt vmcnt(0)
314 ; GFX10-NEXT: v_add_nc_i32 v3, v1, v2 clamp
315 ; GFX10-NEXT: v_add_nc_u32_e32 v1, v1, v2
316 ; GFX10-NEXT: v_cmp_ne_u32_e32 vcc_lo, v1, v3
317 ; GFX10-NEXT: v_cndmask_b32_e64 v2, 0, 1, vcc_lo
318 ; GFX10-NEXT: global_store_dword v0, v1, s[0:1]
319 ; GFX10-NEXT: global_store_byte v0, v2, s[2:3]
320 ; GFX10-NEXT: s_endpgm
322 ; GFX11-LABEL: v_saddo_i32:
324 ; GFX11-NEXT: s_load_b256 s[0:7], s[0:1], 0x24
325 ; GFX11-NEXT: v_mov_b32_e32 v0, 0
326 ; GFX11-NEXT: s_waitcnt lgkmcnt(0)
327 ; GFX11-NEXT: s_clause 0x1
328 ; GFX11-NEXT: global_load_b32 v1, v0, s[4:5]
329 ; GFX11-NEXT: global_load_b32 v2, v0, s[6:7]
330 ; GFX11-NEXT: s_waitcnt vmcnt(0)
331 ; GFX11-NEXT: v_add_nc_i32 v3, v1, v2 clamp
332 ; GFX11-NEXT: v_add_nc_u32_e32 v1, v1, v2
333 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1)
334 ; GFX11-NEXT: v_cmp_ne_u32_e32 vcc_lo, v1, v3
335 ; GFX11-NEXT: v_cndmask_b32_e64 v2, 0, 1, vcc_lo
336 ; GFX11-NEXT: s_clause 0x1
337 ; GFX11-NEXT: global_store_b32 v0, v1, s[0:1]
338 ; GFX11-NEXT: global_store_b8 v0, v2, s[2:3]
339 ; GFX11-NEXT: s_nop 0
340 ; GFX11-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
341 ; GFX11-NEXT: s_endpgm
342 %a = load i32, ptr addrspace(1) %aptr, align 4
343 %b = load i32, ptr addrspace(1) %bptr, align 4
344 %sadd = call { i32, i1 } @llvm.sadd.with.overflow.i32(i32 %a, i32 %b) nounwind
345 %val = extractvalue { i32, i1 } %sadd, 0
346 %carry = extractvalue { i32, i1 } %sadd, 1
347 store i32 %val, ptr addrspace(1) %out, align 4
348 store i1 %carry, ptr addrspace(1) %carryout
352 define amdgpu_kernel void @s_saddo_i64(ptr addrspace(1) %out, ptr addrspace(1) %carryout, i64 %a, i64 %b) nounwind {
353 ; SI-LABEL: s_saddo_i64:
355 ; SI-NEXT: s_load_dwordx8 s[0:7], s[0:1], 0x9
356 ; SI-NEXT: s_mov_b32 s11, 0xf000
357 ; SI-NEXT: s_mov_b32 s10, -1
358 ; SI-NEXT: s_waitcnt lgkmcnt(0)
359 ; SI-NEXT: s_add_u32 s12, s4, s6
360 ; SI-NEXT: v_mov_b32_e32 v0, s4
361 ; SI-NEXT: s_addc_u32 s13, s5, s7
362 ; SI-NEXT: v_mov_b32_e32 v1, s5
363 ; SI-NEXT: v_cmp_lt_i64_e32 vcc, s[12:13], v[0:1]
364 ; SI-NEXT: v_cmp_lt_i64_e64 s[4:5], s[6:7], 0
365 ; SI-NEXT: v_mov_b32_e32 v0, s12
366 ; SI-NEXT: s_mov_b32 s8, s0
367 ; SI-NEXT: s_mov_b32 s9, s1
368 ; SI-NEXT: v_mov_b32_e32 v1, s13
369 ; SI-NEXT: s_xor_b64 s[4:5], s[4:5], vcc
370 ; SI-NEXT: s_mov_b32 s0, s2
371 ; SI-NEXT: s_mov_b32 s1, s3
372 ; SI-NEXT: s_mov_b32 s2, s10
373 ; SI-NEXT: s_mov_b32 s3, s11
374 ; SI-NEXT: buffer_store_dwordx2 v[0:1], off, s[8:11], 0
375 ; SI-NEXT: s_waitcnt expcnt(0)
376 ; SI-NEXT: v_cndmask_b32_e64 v0, 0, 1, s[4:5]
377 ; SI-NEXT: buffer_store_byte v0, off, s[0:3], 0
380 ; VI-LABEL: s_saddo_i64:
382 ; VI-NEXT: s_load_dwordx8 s[0:7], s[0:1], 0x24
383 ; VI-NEXT: s_waitcnt lgkmcnt(0)
384 ; VI-NEXT: v_mov_b32_e32 v0, s0
385 ; VI-NEXT: s_add_u32 s0, s4, s6
386 ; VI-NEXT: v_mov_b32_e32 v4, s4
387 ; VI-NEXT: v_mov_b32_e32 v1, s1
388 ; VI-NEXT: s_addc_u32 s1, s5, s7
389 ; VI-NEXT: v_mov_b32_e32 v5, s5
390 ; VI-NEXT: v_mov_b32_e32 v2, s2
391 ; VI-NEXT: v_mov_b32_e32 v3, s3
392 ; VI-NEXT: v_cmp_lt_i64_e32 vcc, s[0:1], v[4:5]
393 ; VI-NEXT: v_cmp_lt_i64_e64 s[2:3], s[6:7], 0
394 ; VI-NEXT: v_mov_b32_e32 v5, s1
395 ; VI-NEXT: v_mov_b32_e32 v4, s0
396 ; VI-NEXT: s_xor_b64 s[0:1], s[2:3], vcc
397 ; VI-NEXT: flat_store_dwordx2 v[0:1], v[4:5]
398 ; VI-NEXT: v_cndmask_b32_e64 v0, 0, 1, s[0:1]
399 ; VI-NEXT: flat_store_byte v[2:3], v0
402 ; GFX9-LABEL: s_saddo_i64:
404 ; GFX9-NEXT: s_load_dwordx8 s[0:7], s[0:1], 0x24
405 ; GFX9-NEXT: v_mov_b32_e32 v2, 0
406 ; GFX9-NEXT: s_waitcnt lgkmcnt(0)
407 ; GFX9-NEXT: s_add_u32 s8, s4, s6
408 ; GFX9-NEXT: v_mov_b32_e32 v0, s4
409 ; GFX9-NEXT: v_mov_b32_e32 v1, s5
410 ; GFX9-NEXT: s_addc_u32 s9, s5, s7
411 ; GFX9-NEXT: v_cmp_lt_i64_e64 s[10:11], s[6:7], 0
412 ; GFX9-NEXT: v_cmp_lt_i64_e32 vcc, s[8:9], v[0:1]
413 ; GFX9-NEXT: v_mov_b32_e32 v0, s8
414 ; GFX9-NEXT: v_mov_b32_e32 v1, s9
415 ; GFX9-NEXT: global_store_dwordx2 v2, v[0:1], s[0:1]
416 ; GFX9-NEXT: s_xor_b64 s[0:1], s[10:11], vcc
417 ; GFX9-NEXT: v_cndmask_b32_e64 v0, 0, 1, s[0:1]
418 ; GFX9-NEXT: global_store_byte v2, v0, s[2:3]
419 ; GFX9-NEXT: s_endpgm
421 ; GFX10-LABEL: s_saddo_i64:
423 ; GFX10-NEXT: s_load_dwordx8 s[0:7], s[0:1], 0x24
424 ; GFX10-NEXT: v_mov_b32_e32 v2, 0
425 ; GFX10-NEXT: s_waitcnt lgkmcnt(0)
426 ; GFX10-NEXT: s_add_u32 s8, s4, s6
427 ; GFX10-NEXT: s_addc_u32 s9, s5, s7
428 ; GFX10-NEXT: v_cmp_lt_i64_e64 s6, s[6:7], 0
429 ; GFX10-NEXT: v_cmp_lt_i64_e64 s4, s[8:9], s[4:5]
430 ; GFX10-NEXT: v_mov_b32_e32 v0, s8
431 ; GFX10-NEXT: v_mov_b32_e32 v1, s9
432 ; GFX10-NEXT: s_xor_b32 s4, s6, s4
433 ; GFX10-NEXT: v_cndmask_b32_e64 v3, 0, 1, s4
434 ; GFX10-NEXT: global_store_dwordx2 v2, v[0:1], s[0:1]
435 ; GFX10-NEXT: global_store_byte v2, v3, s[2:3]
436 ; GFX10-NEXT: s_endpgm
438 ; GFX11-LABEL: s_saddo_i64:
440 ; GFX11-NEXT: s_load_b256 s[0:7], s[0:1], 0x24
441 ; GFX11-NEXT: s_waitcnt lgkmcnt(0)
442 ; GFX11-NEXT: s_add_u32 s8, s4, s6
443 ; GFX11-NEXT: s_addc_u32 s9, s5, s7
444 ; GFX11-NEXT: v_cmp_lt_i64_e64 s6, s[6:7], 0
445 ; GFX11-NEXT: v_cmp_lt_i64_e64 s4, s[8:9], s[4:5]
446 ; GFX11-NEXT: v_mov_b32_e32 v0, s8
447 ; GFX11-NEXT: v_dual_mov_b32 v2, 0 :: v_dual_mov_b32 v1, s9
448 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(SALU_CYCLE_1)
449 ; GFX11-NEXT: s_xor_b32 s4, s6, s4
450 ; GFX11-NEXT: v_cndmask_b32_e64 v3, 0, 1, s4
451 ; GFX11-NEXT: s_clause 0x1
452 ; GFX11-NEXT: global_store_b64 v2, v[0:1], s[0:1]
453 ; GFX11-NEXT: global_store_b8 v2, v3, s[2:3]
454 ; GFX11-NEXT: s_nop 0
455 ; GFX11-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
456 ; GFX11-NEXT: s_endpgm
457 %sadd = call { i64, i1 } @llvm.sadd.with.overflow.i64(i64 %a, i64 %b) nounwind
458 %val = extractvalue { i64, i1 } %sadd, 0
459 %carry = extractvalue { i64, i1 } %sadd, 1
460 store i64 %val, ptr addrspace(1) %out, align 8
461 store i1 %carry, ptr addrspace(1) %carryout
465 define amdgpu_kernel void @v_saddo_i64(ptr addrspace(1) %out, ptr addrspace(1) %carryout, ptr addrspace(1) %aptr, ptr addrspace(1) %bptr) nounwind {
466 ; SI-LABEL: v_saddo_i64:
468 ; SI-NEXT: s_load_dwordx8 s[0:7], s[0:1], 0x9
469 ; SI-NEXT: s_mov_b32 s11, 0xf000
470 ; SI-NEXT: s_mov_b32 s10, -1
471 ; SI-NEXT: s_mov_b32 s14, s10
472 ; SI-NEXT: s_mov_b32 s15, s11
473 ; SI-NEXT: s_waitcnt lgkmcnt(0)
474 ; SI-NEXT: s_mov_b32 s12, s4
475 ; SI-NEXT: s_mov_b32 s13, s5
476 ; SI-NEXT: s_mov_b32 s4, s6
477 ; SI-NEXT: s_mov_b32 s5, s7
478 ; SI-NEXT: s_mov_b32 s6, s10
479 ; SI-NEXT: s_mov_b32 s7, s11
480 ; SI-NEXT: buffer_load_dwordx2 v[0:1], off, s[12:15], 0
481 ; SI-NEXT: buffer_load_dwordx2 v[2:3], off, s[4:7], 0
482 ; SI-NEXT: s_mov_b32 s8, s0
483 ; SI-NEXT: s_mov_b32 s9, s1
484 ; SI-NEXT: s_mov_b32 s4, s2
485 ; SI-NEXT: s_mov_b32 s5, s3
486 ; SI-NEXT: s_waitcnt vmcnt(0)
487 ; SI-NEXT: v_add_i32_e32 v4, vcc, v0, v2
488 ; SI-NEXT: v_addc_u32_e32 v5, vcc, v1, v3, vcc
489 ; SI-NEXT: v_cmp_gt_i64_e32 vcc, 0, v[2:3]
490 ; SI-NEXT: v_cmp_lt_i64_e64 s[0:1], v[4:5], v[0:1]
491 ; SI-NEXT: buffer_store_dwordx2 v[4:5], off, s[8:11], 0
492 ; SI-NEXT: s_xor_b64 s[0:1], vcc, s[0:1]
493 ; SI-NEXT: v_cndmask_b32_e64 v0, 0, 1, s[0:1]
494 ; SI-NEXT: buffer_store_byte v0, off, s[4:7], 0
497 ; VI-LABEL: v_saddo_i64:
499 ; VI-NEXT: s_load_dwordx8 s[0:7], s[0:1], 0x24
500 ; VI-NEXT: s_waitcnt lgkmcnt(0)
501 ; VI-NEXT: v_mov_b32_e32 v0, s4
502 ; VI-NEXT: v_mov_b32_e32 v1, s5
503 ; VI-NEXT: v_mov_b32_e32 v2, s6
504 ; VI-NEXT: v_mov_b32_e32 v3, s7
505 ; VI-NEXT: flat_load_dwordx2 v[0:1], v[0:1]
506 ; VI-NEXT: flat_load_dwordx2 v[2:3], v[2:3]
507 ; VI-NEXT: v_mov_b32_e32 v4, s0
508 ; VI-NEXT: v_mov_b32_e32 v5, s1
509 ; VI-NEXT: v_mov_b32_e32 v6, s2
510 ; VI-NEXT: v_mov_b32_e32 v7, s3
511 ; VI-NEXT: s_waitcnt vmcnt(0)
512 ; VI-NEXT: v_add_u32_e32 v8, vcc, v0, v2
513 ; VI-NEXT: v_addc_u32_e32 v9, vcc, v1, v3, vcc
514 ; VI-NEXT: v_cmp_gt_i64_e32 vcc, 0, v[2:3]
515 ; VI-NEXT: v_cmp_lt_i64_e64 s[0:1], v[8:9], v[0:1]
516 ; VI-NEXT: flat_store_dwordx2 v[4:5], v[8:9]
517 ; VI-NEXT: s_xor_b64 s[0:1], vcc, s[0:1]
518 ; VI-NEXT: v_cndmask_b32_e64 v0, 0, 1, s[0:1]
519 ; VI-NEXT: flat_store_byte v[6:7], v0
522 ; GFX9-LABEL: v_saddo_i64:
524 ; GFX9-NEXT: s_load_dwordx8 s[4:11], s[0:1], 0x24
525 ; GFX9-NEXT: v_mov_b32_e32 v6, 0
526 ; GFX9-NEXT: s_waitcnt lgkmcnt(0)
527 ; GFX9-NEXT: global_load_dwordx2 v[0:1], v6, s[8:9]
528 ; GFX9-NEXT: global_load_dwordx2 v[2:3], v6, s[10:11]
529 ; GFX9-NEXT: s_waitcnt vmcnt(0)
530 ; GFX9-NEXT: v_add_co_u32_e32 v4, vcc, v0, v2
531 ; GFX9-NEXT: v_addc_co_u32_e32 v5, vcc, v1, v3, vcc
532 ; GFX9-NEXT: v_cmp_gt_i64_e32 vcc, 0, v[2:3]
533 ; GFX9-NEXT: v_cmp_lt_i64_e64 s[0:1], v[4:5], v[0:1]
534 ; GFX9-NEXT: global_store_dwordx2 v6, v[4:5], s[4:5]
535 ; GFX9-NEXT: s_xor_b64 s[0:1], vcc, s[0:1]
536 ; GFX9-NEXT: v_cndmask_b32_e64 v0, 0, 1, s[0:1]
537 ; GFX9-NEXT: global_store_byte v6, v0, s[6:7]
538 ; GFX9-NEXT: s_endpgm
540 ; GFX10-LABEL: v_saddo_i64:
542 ; GFX10-NEXT: s_load_dwordx8 s[4:11], s[0:1], 0x24
543 ; GFX10-NEXT: v_mov_b32_e32 v6, 0
544 ; GFX10-NEXT: s_waitcnt lgkmcnt(0)
545 ; GFX10-NEXT: s_clause 0x1
546 ; GFX10-NEXT: global_load_dwordx2 v[0:1], v6, s[8:9]
547 ; GFX10-NEXT: global_load_dwordx2 v[2:3], v6, s[10:11]
548 ; GFX10-NEXT: s_waitcnt vmcnt(0)
549 ; GFX10-NEXT: v_add_co_u32 v4, vcc_lo, v0, v2
550 ; GFX10-NEXT: v_add_co_ci_u32_e32 v5, vcc_lo, v1, v3, vcc_lo
551 ; GFX10-NEXT: v_cmp_gt_i64_e32 vcc_lo, 0, v[2:3]
552 ; GFX10-NEXT: v_cmp_lt_i64_e64 s0, v[4:5], v[0:1]
553 ; GFX10-NEXT: s_xor_b32 s0, vcc_lo, s0
554 ; GFX10-NEXT: v_cndmask_b32_e64 v0, 0, 1, s0
555 ; GFX10-NEXT: global_store_dwordx2 v6, v[4:5], s[4:5]
556 ; GFX10-NEXT: global_store_byte v6, v0, s[6:7]
557 ; GFX10-NEXT: s_endpgm
559 ; GFX11-LABEL: v_saddo_i64:
561 ; GFX11-NEXT: s_load_b256 s[4:11], s[0:1], 0x24
562 ; GFX11-NEXT: v_mov_b32_e32 v6, 0
563 ; GFX11-NEXT: s_waitcnt lgkmcnt(0)
564 ; GFX11-NEXT: s_clause 0x1
565 ; GFX11-NEXT: global_load_b64 v[0:1], v6, s[8:9]
566 ; GFX11-NEXT: global_load_b64 v[2:3], v6, s[10:11]
567 ; GFX11-NEXT: s_waitcnt vmcnt(0)
568 ; GFX11-NEXT: v_add_co_u32 v4, vcc_lo, v0, v2
569 ; GFX11-NEXT: v_add_co_ci_u32_e32 v5, vcc_lo, v1, v3, vcc_lo
570 ; GFX11-NEXT: v_cmp_gt_i64_e32 vcc_lo, 0, v[2:3]
571 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
572 ; GFX11-NEXT: v_cmp_lt_i64_e64 s0, v[4:5], v[0:1]
573 ; GFX11-NEXT: s_xor_b32 s0, vcc_lo, s0
574 ; GFX11-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
575 ; GFX11-NEXT: v_cndmask_b32_e64 v0, 0, 1, s0
576 ; GFX11-NEXT: s_clause 0x1
577 ; GFX11-NEXT: global_store_b64 v6, v[4:5], s[4:5]
578 ; GFX11-NEXT: global_store_b8 v6, v0, s[6:7]
579 ; GFX11-NEXT: s_nop 0
580 ; GFX11-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
581 ; GFX11-NEXT: s_endpgm
582 %a = load i64, ptr addrspace(1) %aptr, align 4
583 %b = load i64, ptr addrspace(1) %bptr, align 4
584 %sadd = call { i64, i1 } @llvm.sadd.with.overflow.i64(i64 %a, i64 %b) nounwind
585 %val = extractvalue { i64, i1 } %sadd, 0
586 %carry = extractvalue { i64, i1 } %sadd, 1
587 store i64 %val, ptr addrspace(1) %out, align 8
588 store i1 %carry, ptr addrspace(1) %carryout
592 define amdgpu_kernel void @v_saddo_v2i32(ptr addrspace(1) %out, ptr addrspace(1) %carryout, ptr addrspace(1) %aptr, ptr addrspace(1) %bptr) nounwind {
593 ; SI-LABEL: v_saddo_v2i32:
595 ; SI-NEXT: s_load_dwordx8 s[0:7], s[0:1], 0x9
596 ; SI-NEXT: s_mov_b32 s11, 0xf000
597 ; SI-NEXT: s_mov_b32 s10, -1
598 ; SI-NEXT: s_mov_b32 s14, s10
599 ; SI-NEXT: s_mov_b32 s15, s11
600 ; SI-NEXT: s_waitcnt lgkmcnt(0)
601 ; SI-NEXT: s_mov_b32 s12, s4
602 ; SI-NEXT: s_mov_b32 s13, s5
603 ; SI-NEXT: s_mov_b32 s4, s6
604 ; SI-NEXT: s_mov_b32 s5, s7
605 ; SI-NEXT: s_mov_b32 s6, s10
606 ; SI-NEXT: s_mov_b32 s7, s11
607 ; SI-NEXT: buffer_load_dwordx2 v[0:1], off, s[12:15], 0
608 ; SI-NEXT: buffer_load_dwordx2 v[2:3], off, s[4:7], 0
609 ; SI-NEXT: s_mov_b32 s8, s0
610 ; SI-NEXT: s_mov_b32 s9, s1
611 ; SI-NEXT: s_mov_b32 s12, s2
612 ; SI-NEXT: s_mov_b32 s13, s3
613 ; SI-NEXT: s_waitcnt vmcnt(0)
614 ; SI-NEXT: v_add_i32_e32 v5, vcc, v1, v3
615 ; SI-NEXT: v_add_i32_e32 v4, vcc, v0, v2
616 ; SI-NEXT: v_cmp_gt_i32_e64 s[0:1], 0, v3
617 ; SI-NEXT: v_cmp_lt_i32_e64 s[4:5], v5, v1
618 ; SI-NEXT: v_cmp_gt_i32_e32 vcc, 0, v2
619 ; SI-NEXT: v_cmp_lt_i32_e64 s[2:3], v4, v0
620 ; SI-NEXT: s_xor_b64 s[0:1], s[0:1], s[4:5]
621 ; SI-NEXT: v_cndmask_b32_e64 v1, 0, 1, s[0:1]
622 ; SI-NEXT: s_xor_b64 s[0:1], vcc, s[2:3]
623 ; SI-NEXT: v_cndmask_b32_e64 v0, 0, 1, s[0:1]
624 ; SI-NEXT: buffer_store_dwordx2 v[4:5], off, s[8:11], 0
625 ; SI-NEXT: buffer_store_dwordx2 v[0:1], off, s[12:15], 0
628 ; VI-LABEL: v_saddo_v2i32:
630 ; VI-NEXT: s_load_dwordx8 s[0:7], s[0:1], 0x24
631 ; VI-NEXT: s_waitcnt lgkmcnt(0)
632 ; VI-NEXT: v_mov_b32_e32 v0, s4
633 ; VI-NEXT: v_mov_b32_e32 v1, s5
634 ; VI-NEXT: v_mov_b32_e32 v2, s6
635 ; VI-NEXT: v_mov_b32_e32 v3, s7
636 ; VI-NEXT: flat_load_dwordx2 v[0:1], v[0:1]
637 ; VI-NEXT: flat_load_dwordx2 v[2:3], v[2:3]
638 ; VI-NEXT: v_mov_b32_e32 v4, s0
639 ; VI-NEXT: v_mov_b32_e32 v5, s1
640 ; VI-NEXT: v_mov_b32_e32 v6, s2
641 ; VI-NEXT: v_mov_b32_e32 v7, s3
642 ; VI-NEXT: s_waitcnt vmcnt(0)
643 ; VI-NEXT: v_add_u32_e32 v9, vcc, v1, v3
644 ; VI-NEXT: v_add_u32_e32 v8, vcc, v0, v2
645 ; VI-NEXT: v_cmp_gt_i32_e64 s[0:1], 0, v3
646 ; VI-NEXT: v_cmp_lt_i32_e64 s[4:5], v9, v1
647 ; VI-NEXT: v_cmp_gt_i32_e32 vcc, 0, v2
648 ; VI-NEXT: v_cmp_lt_i32_e64 s[2:3], v8, v0
649 ; VI-NEXT: s_xor_b64 s[0:1], s[0:1], s[4:5]
650 ; VI-NEXT: v_cndmask_b32_e64 v1, 0, 1, s[0:1]
651 ; VI-NEXT: s_xor_b64 s[0:1], vcc, s[2:3]
652 ; VI-NEXT: v_cndmask_b32_e64 v0, 0, 1, s[0:1]
653 ; VI-NEXT: flat_store_dwordx2 v[4:5], v[8:9]
654 ; VI-NEXT: flat_store_dwordx2 v[6:7], v[0:1]
657 ; GFX9-LABEL: v_saddo_v2i32:
659 ; GFX9-NEXT: s_load_dwordx8 s[0:7], s[0:1], 0x24
660 ; GFX9-NEXT: v_mov_b32_e32 v6, 0
661 ; GFX9-NEXT: s_waitcnt lgkmcnt(0)
662 ; GFX9-NEXT: global_load_dwordx2 v[0:1], v6, s[4:5]
663 ; GFX9-NEXT: global_load_dwordx2 v[2:3], v6, s[6:7]
664 ; GFX9-NEXT: s_waitcnt vmcnt(0)
665 ; GFX9-NEXT: v_add_u32_e32 v5, v1, v3
666 ; GFX9-NEXT: v_add_i32 v1, v1, v3 clamp
667 ; GFX9-NEXT: v_add_u32_e32 v4, v0, v2
668 ; GFX9-NEXT: v_add_i32 v0, v0, v2 clamp
669 ; GFX9-NEXT: v_cmp_ne_u32_e32 vcc, v5, v1
670 ; GFX9-NEXT: v_cndmask_b32_e64 v1, 0, 1, vcc
671 ; GFX9-NEXT: v_cmp_ne_u32_e32 vcc, v4, v0
672 ; GFX9-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc
673 ; GFX9-NEXT: global_store_dwordx2 v6, v[4:5], s[0:1]
674 ; GFX9-NEXT: global_store_dwordx2 v6, v[0:1], s[2:3]
675 ; GFX9-NEXT: s_endpgm
677 ; GFX10-LABEL: v_saddo_v2i32:
679 ; GFX10-NEXT: s_load_dwordx8 s[0:7], s[0:1], 0x24
680 ; GFX10-NEXT: v_mov_b32_e32 v5, 0
681 ; GFX10-NEXT: s_waitcnt lgkmcnt(0)
682 ; GFX10-NEXT: s_clause 0x1
683 ; GFX10-NEXT: global_load_dwordx2 v[0:1], v5, s[4:5]
684 ; GFX10-NEXT: global_load_dwordx2 v[2:3], v5, s[6:7]
685 ; GFX10-NEXT: s_waitcnt vmcnt(0)
686 ; GFX10-NEXT: v_add_nc_u32_e32 v4, v1, v3
687 ; GFX10-NEXT: v_add_nc_i32 v1, v1, v3 clamp
688 ; GFX10-NEXT: v_add_nc_u32_e32 v3, v0, v2
689 ; GFX10-NEXT: v_add_nc_i32 v0, v0, v2 clamp
690 ; GFX10-NEXT: v_cmp_ne_u32_e32 vcc_lo, v4, v1
691 ; GFX10-NEXT: v_cndmask_b32_e64 v1, 0, 1, vcc_lo
692 ; GFX10-NEXT: v_cmp_ne_u32_e32 vcc_lo, v3, v0
693 ; GFX10-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
694 ; GFX10-NEXT: global_store_dwordx2 v5, v[3:4], s[0:1]
695 ; GFX10-NEXT: global_store_dwordx2 v5, v[0:1], s[2:3]
696 ; GFX10-NEXT: s_endpgm
698 ; GFX11-LABEL: v_saddo_v2i32:
700 ; GFX11-NEXT: s_load_b256 s[0:7], s[0:1], 0x24
701 ; GFX11-NEXT: v_mov_b32_e32 v5, 0
702 ; GFX11-NEXT: s_waitcnt lgkmcnt(0)
703 ; GFX11-NEXT: s_clause 0x1
704 ; GFX11-NEXT: global_load_b64 v[0:1], v5, s[4:5]
705 ; GFX11-NEXT: global_load_b64 v[2:3], v5, s[6:7]
706 ; GFX11-NEXT: s_waitcnt vmcnt(0)
707 ; GFX11-NEXT: v_add_nc_u32_e32 v4, v1, v3
708 ; GFX11-NEXT: v_add_nc_i32 v1, v1, v3 clamp
709 ; GFX11-NEXT: v_add_nc_u32_e32 v3, v0, v2
710 ; GFX11-NEXT: v_add_nc_i32 v0, v0, v2 clamp
711 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_1) | instid1(VALU_DEP_3)
712 ; GFX11-NEXT: v_cmp_ne_u32_e32 vcc_lo, v4, v1
713 ; GFX11-NEXT: v_cndmask_b32_e64 v1, 0, 1, vcc_lo
714 ; GFX11-NEXT: v_cmp_ne_u32_e32 vcc_lo, v3, v0
715 ; GFX11-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
716 ; GFX11-NEXT: s_clause 0x1
717 ; GFX11-NEXT: global_store_b64 v5, v[3:4], s[0:1]
718 ; GFX11-NEXT: global_store_b64 v5, v[0:1], s[2:3]
719 ; GFX11-NEXT: s_nop 0
720 ; GFX11-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
721 ; GFX11-NEXT: s_endpgm
722 %a = load <2 x i32>, ptr addrspace(1) %aptr, align 4
723 %b = load <2 x i32>, ptr addrspace(1) %bptr, align 4
724 %sadd = call { <2 x i32>, <2 x i1> } @llvm.sadd.with.overflow.v2i32(<2 x i32> %a, <2 x i32> %b) nounwind
725 %val = extractvalue { <2 x i32>, <2 x i1> } %sadd, 0
726 %carry = extractvalue { <2 x i32>, <2 x i1> } %sadd, 1
727 store <2 x i32> %val, ptr addrspace(1) %out, align 4
728 %carry.ext = zext <2 x i1> %carry to <2 x i32>
729 store <2 x i32> %carry.ext, ptr addrspace(1) %carryout