1*9880d681SAndroid Build Coastguard Worker; RUN: llc -verify-machineinstrs -march=amdgcn -mcpu=SI < %s 2*9880d681SAndroid Build Coastguard Worker; RUN: llc -verify-machineinstrs -march=amdgcn -mcpu=tonga < %s 3*9880d681SAndroid Build Coastguard Worker 4*9880d681SAndroid Build Coastguard Worker; This works because promote allocas pass replaces these with LDS atomics. 5*9880d681SAndroid Build Coastguard Worker 6*9880d681SAndroid Build Coastguard Worker; Private atomics have no real use, but at least shouldn't crash on it. 7*9880d681SAndroid Build Coastguard Workerdefine void @atomicrmw_private(i32 addrspace(1)* %out, i32 %in) nounwind { 8*9880d681SAndroid Build Coastguard Workerentry: 9*9880d681SAndroid Build Coastguard Worker %tmp = alloca [2 x i32] 10*9880d681SAndroid Build Coastguard Worker %tmp1 = getelementptr inbounds [2 x i32], [2 x i32]* %tmp, i32 0, i32 0 11*9880d681SAndroid Build Coastguard Worker %tmp2 = getelementptr inbounds [2 x i32], [2 x i32]* %tmp, i32 0, i32 1 12*9880d681SAndroid Build Coastguard Worker store i32 0, i32* %tmp1 13*9880d681SAndroid Build Coastguard Worker store i32 1, i32* %tmp2 14*9880d681SAndroid Build Coastguard Worker %tmp3 = getelementptr inbounds [2 x i32], [2 x i32]* %tmp, i32 0, i32 %in 15*9880d681SAndroid Build Coastguard Worker %tmp4 = atomicrmw add i32* %tmp3, i32 7 acq_rel 16*9880d681SAndroid Build Coastguard Worker store i32 %tmp4, i32 addrspace(1)* %out 17*9880d681SAndroid Build Coastguard Worker ret void 18*9880d681SAndroid Build Coastguard Worker} 19*9880d681SAndroid Build Coastguard Worker 20*9880d681SAndroid Build Coastguard Workerdefine void @cmpxchg_private(i32 addrspace(1)* %out, i32 %in) nounwind { 21*9880d681SAndroid Build Coastguard Workerentry: 22*9880d681SAndroid Build Coastguard Worker %tmp = alloca [2 x i32] 23*9880d681SAndroid Build Coastguard Worker %tmp1 = getelementptr inbounds [2 x i32], [2 x i32]* %tmp, i32 0, i32 0 24*9880d681SAndroid Build Coastguard Worker %tmp2 = getelementptr inbounds [2 x i32], [2 x i32]* %tmp, i32 0, i32 1 25*9880d681SAndroid Build Coastguard Worker store i32 0, i32* %tmp1 26*9880d681SAndroid Build Coastguard Worker store i32 1, i32* %tmp2 27*9880d681SAndroid Build Coastguard Worker %tmp3 = getelementptr inbounds [2 x i32], [2 x i32]* %tmp, i32 0, i32 %in 28*9880d681SAndroid Build Coastguard Worker %tmp4 = cmpxchg i32* %tmp3, i32 0, i32 1 acq_rel monotonic 29*9880d681SAndroid Build Coastguard Worker %val = extractvalue { i32, i1 } %tmp4, 0 30*9880d681SAndroid Build Coastguard Worker store i32 %val, i32 addrspace(1)* %out 31*9880d681SAndroid Build Coastguard Worker ret void 32*9880d681SAndroid Build Coastguard Worker} 33