1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=amdgcn -mcpu=gfx900 -verify-machineinstrs < %s | FileCheck -check-prefixes=GFX9 %s
3 define amdgpu_kernel void @sdwa_test() local_unnamed_addr #0 {
4 ; GFX9-LABEL: sdwa_test:
6 ; GFX9-NEXT: v_add_u32_e32 v1, 10, v0
7 ; GFX9-NEXT: v_add_u32_e32 v0, 20, v0
8 ; GFX9-NEXT: v_add_co_u32_sdwa v0, vcc, v1, v0 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:BYTE_0
9 ; GFX9-NEXT: v_addc_co_u32_e64 v1, s[0:1], 0, 0, vcc
10 ; GFX9-NEXT: global_store_dwordx2 v[0:1], v[0:1], off
13 %tid = tail call i32 @llvm.amdgcn.workitem.id.x()
14 %v0 = add i32 %tid, 10
15 %v1 = add i32 %tid, 20
16 %v2 = zext i32 %v0 to i64
17 %v3 = zext i32 %v1 to i64
18 %v.t = and i64 %v3, 255
19 %v4 = add i64 %v2, %v.t
20 store i64 %v4, ptr addrspace(1) undef
25 define amdgpu_kernel void @test_add_co_sdwa(ptr addrspace(1) %arg, ptr addrspace(1) %arg1) #0 {
26 ; GFX9-LABEL: test_add_co_sdwa:
27 ; GFX9: ; %bb.0: ; %bb
28 ; GFX9-NEXT: s_load_dwordx4 s[4:7], s[2:3], 0x24
29 ; GFX9-NEXT: v_lshlrev_b32_e32 v2, 2, v0
30 ; GFX9-NEXT: v_lshlrev_b32_e32 v3, 3, v0
31 ; GFX9-NEXT: s_waitcnt lgkmcnt(0)
32 ; GFX9-NEXT: global_load_dword v4, v2, s[6:7]
33 ; GFX9-NEXT: global_load_dwordx2 v[0:1], v3, s[4:5]
34 ; GFX9-NEXT: s_waitcnt vmcnt(0)
35 ; GFX9-NEXT: v_add_co_u32_sdwa v0, vcc, v0, v4 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:BYTE_0
36 ; GFX9-NEXT: v_addc_co_u32_e32 v1, vcc, 0, v1, vcc
37 ; GFX9-NEXT: global_store_dwordx2 v3, v[0:1], s[4:5]
40 %tmp = tail call i32 @llvm.amdgcn.workitem.id.x()
41 %tmp3 = getelementptr inbounds i32, ptr addrspace(1) %arg1, i32 %tmp
42 %tmp4 = load i32, ptr addrspace(1) %tmp3, align 4
43 %tmp5 = and i32 %tmp4, 255
44 %tmp6 = zext i32 %tmp5 to i64
45 %tmp7 = getelementptr inbounds i64, ptr addrspace(1) %arg, i32 %tmp
46 %tmp8 = load i64, ptr addrspace(1) %tmp7, align 8
47 %tmp9 = add nsw i64 %tmp8, %tmp6
48 store i64 %tmp9, ptr addrspace(1) %tmp7, align 8
53 declare i32 @llvm.amdgcn.workitem.id.x()