1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2; RUN: llc -global-isel -mtriple=amdgcn-amd-amdhsa -mcpu=bonaire -verify-machineinstrs < %s | FileCheck %s
3; TODO: Replace with existing DAG tests
4
5@lds_512_4 = internal unnamed_addr addrspace(3) global [128 x i32] undef, align 4
6@lds_4_8 = addrspace(3) global i32 undef, align 8
7
8define amdgpu_kernel void @use_lds_globals(i32 addrspace(1)* %out, i32 addrspace(3)* %in) #0 {
9; CHECK-LABEL: use_lds_globals:
10; CHECK:       ; %bb.0: ; %entry
11; CHECK-NEXT:    s_load_dwordx2 s[0:1], s[4:5], 0x0
12; CHECK-NEXT:    s_add_u32 s2, 4, 4
13; CHECK-NEXT:    v_mov_b32_e32 v0, s2
14; CHECK-NEXT:    s_mov_b32 m0, -1
15; CHECK-NEXT:    ds_read_b32 v2, v0
16; CHECK-NEXT:    s_waitcnt lgkmcnt(0)
17; CHECK-NEXT:    s_add_u32 s0, s0, 4
18; CHECK-NEXT:    s_addc_u32 s1, s1, 0
19; CHECK-NEXT:    v_mov_b32_e32 v0, s0
20; CHECK-NEXT:    v_mov_b32_e32 v1, s1
21; CHECK-NEXT:    flat_store_dword v[0:1], v2
22; CHECK-NEXT:    v_mov_b32_e32 v0, 9
23; CHECK-NEXT:    v_mov_b32_e32 v1, 0
24; CHECK-NEXT:    ds_write_b32 v1, v0
25; CHECK-NEXT:    s_endpgm
26entry:
27  %tmp0 = getelementptr [128 x i32], [128 x i32] addrspace(3)* @lds_512_4, i32 0, i32 1
28  %tmp1 = load i32, i32 addrspace(3)* %tmp0
29  %tmp2 = getelementptr i32, i32 addrspace(1)* %out, i32 1
30  store i32 %tmp1, i32 addrspace(1)* %tmp2
31  store i32 9, i32 addrspace(3)* @lds_4_8
32  ret void
33}
34
35attributes #0 = { nounwind }
36