1 # RUN: llc -march=amdgcn -mcpu=hawaii -run-pass=regbankselect %s -verify-machineinstrs -o - | FileCheck %s
4 define amdgpu_kernel void @load_constant(i32 addrspace(4)* %ptr0) { ret void }
5 define amdgpu_kernel void @load_global_uniform(i32 addrspace(1)* %ptr1) {
6 %tmp0 = load i32, i32 addrspace(1)* %ptr1
9 define amdgpu_kernel void @load_global_non_uniform(i32 addrspace(1)* %ptr2) {
10 %tmp0 = call i32 @llvm.amdgcn.workitem.id.x() #0
11 %tmp1 = getelementptr i32, i32 addrspace(1)* %ptr2, i32 %tmp0
12 %tmp2 = load i32, i32 addrspace(1)* %tmp1
15 define void @non_power_of_2() { ret void }
16 declare i32 @llvm.amdgcn.workitem.id.x() #0
17 attributes #0 = { nounwind readnone }
24 # CHECK-LABEL: name: load_constant
26 # CHECK: - { id: 0, class: sgpr, preferred-register: '' }
27 # CHECK: - { id: 1, class: sgpr, preferred-register: '' }
32 %0:_(p4) = COPY $sgpr0_sgpr1
33 %1:_(s32) = G_LOAD %0 :: (load 4 from %ir.ptr0)
37 name: load_global_uniform
40 # CHECK-LABEL: name: load_global_uniform
42 # CHECK: - { id: 0, class: sgpr, preferred-register: '' }
43 # CHECK: - { id: 1, class: sgpr, preferred-register: '' }
48 %0:_(p1) = COPY $sgpr0_sgpr1
49 %1:_(s32) = G_LOAD %0 :: (load 4 from %ir.ptr1)
53 name: load_global_non_uniform
56 # CHECK-LABEL: name: load_global_non_uniform
58 # CHECK: - { id: 0, class: sgpr, preferred-register: '' }
59 # CHECK: - { id: 1, class: vgpr, preferred-register: '' }
60 # CHECK: - { id: 2, class: vgpr, preferred-register: '' }
66 %0:_(p1) = COPY $sgpr0_sgpr1
67 %1:_(s32) = G_LOAD %0 :: (load 4 from %ir.tmp1)
74 # CHECK-LABEL: name: non_power_of_2
75 # CHECK: [[S448:%[0-9]+]]:sgpr(s448) = G_IMPLICIT_DEF
76 # CHECK: sgpr(s32) = G_EXTRACT [[S448]](s448), 0
80 %0:_(s448) = G_IMPLICIT_DEF
81 %1:_(s32) = G_EXTRACT %0:_(s448), 0
82 $sgpr0 = COPY %1:_(s32)
83 SI_RETURN_TO_EPILOG $sgpr0