1*9880d681SAndroid Build Coastguard Worker; RUN: llc -march=amdgcn -verify-machineinstrs < %s | FileCheck -check-prefix=FUNC -check-prefix=SI %s 2*9880d681SAndroid Build Coastguard Worker 3*9880d681SAndroid Build Coastguard Worker 4*9880d681SAndroid Build Coastguard Worker; FIXME: This currently doesn't do a great job of clustering the 5*9880d681SAndroid Build Coastguard Worker; loads, which end up with extra moves between them. Right now, it 6*9880d681SAndroid Build Coastguard Worker; seems the only things areLoadsFromSameBasePtr is accomplishing is 7*9880d681SAndroid Build Coastguard Worker; ordering the loads so that the lower address loads come first. 8*9880d681SAndroid Build Coastguard Worker 9*9880d681SAndroid Build Coastguard Worker; FUNC-LABEL: {{^}}cluster_global_arg_loads: 10*9880d681SAndroid Build Coastguard Worker; SI-DAG: buffer_load_dword [[REG0:v[0-9]+]], off, s{{\[[0-9]+:[0-9]+\]}}, 0{{$}} 11*9880d681SAndroid Build Coastguard Worker; SI-DAG: buffer_load_dword [[REG1:v[0-9]+]], off, s{{\[[0-9]+:[0-9]+\]}}, 0 offset:8 12*9880d681SAndroid Build Coastguard Worker; SI: buffer_store_dword [[REG0]] 13*9880d681SAndroid Build Coastguard Worker; SI: buffer_store_dword [[REG1]] 14*9880d681SAndroid Build Coastguard Workerdefine void @cluster_global_arg_loads(i32 addrspace(1)* %out0, i32 addrspace(1)* %out1, i32 addrspace(1)* %ptr) #0 { 15*9880d681SAndroid Build Coastguard Worker %load0 = load i32, i32 addrspace(1)* %ptr, align 4 16*9880d681SAndroid Build Coastguard Worker %gep = getelementptr i32, i32 addrspace(1)* %ptr, i32 2 17*9880d681SAndroid Build Coastguard Worker %load1 = load i32, i32 addrspace(1)* %gep, align 4 18*9880d681SAndroid Build Coastguard Worker store i32 %load0, i32 addrspace(1)* %out0, align 4 19*9880d681SAndroid Build Coastguard Worker store i32 %load1, i32 addrspace(1)* %out1, align 4 20*9880d681SAndroid Build Coastguard Worker ret void 21*9880d681SAndroid Build Coastguard Worker} 22*9880d681SAndroid Build Coastguard Worker 23*9880d681SAndroid Build Coastguard Worker; Test for a crach in SIInstrInfo::areLoadsFromSameBasePtr() when checking 24*9880d681SAndroid Build Coastguard Worker; an MUBUF load which does not have a vaddr operand. 25*9880d681SAndroid Build Coastguard Worker; FUNC-LABEL: {{^}}same_base_ptr_crash: 26*9880d681SAndroid Build Coastguard Worker; SI: buffer_load_dword 27*9880d681SAndroid Build Coastguard Worker; SI: buffer_load_dword 28*9880d681SAndroid Build Coastguard Workerdefine void @same_base_ptr_crash(i32 addrspace(1)* %out, i32 addrspace(1)* %in, i32 %offset) { 29*9880d681SAndroid Build Coastguard Workerentry: 30*9880d681SAndroid Build Coastguard Worker %out1 = getelementptr i32, i32 addrspace(1)* %out, i32 %offset 31*9880d681SAndroid Build Coastguard Worker %tmp0 = load i32, i32 addrspace(1)* %out 32*9880d681SAndroid Build Coastguard Worker %tmp1 = load i32, i32 addrspace(1)* %out1 33*9880d681SAndroid Build Coastguard Worker %tmp2 = add i32 %tmp0, %tmp1 34*9880d681SAndroid Build Coastguard Worker store i32 %tmp2, i32 addrspace(1)* %out 35*9880d681SAndroid Build Coastguard Worker ret void 36*9880d681SAndroid Build Coastguard Worker} 37*9880d681SAndroid Build Coastguard Worker 38*9880d681SAndroid Build Coastguard Workerattributes #0 = { nounwind } 39*9880d681SAndroid Build Coastguard Workerattributes #1 = { nounwind readnone } 40