1; RUN: llc -march=amdgcn -verify-machineinstrs < %s | FileCheck -check-prefix=SI -check-prefix=FUNC %s 2; RUN: llc -march=amdgcn -mcpu=tonga -verify-machineinstrs < %s | FileCheck -check-prefix=SI -check-prefix=FUNC %s 3; RUN: llc -march=r600 -mcpu=redwood < %s | FileCheck -check-prefix=R600 -check-prefix=FUNC %s 4 5; FUNC-LABEL: {{^}}atomic_sub_local: 6; R600: LDS_SUB * 7; SI: ds_sub_u32 8define void @atomic_sub_local(i32 addrspace(3)* %local) { 9 %unused = atomicrmw volatile sub i32 addrspace(3)* %local, i32 5 seq_cst 10 ret void 11} 12 13; FUNC-LABEL: {{^}}atomic_sub_local_const_offset: 14; R600: LDS_SUB * 15; SI: ds_sub_u32 v{{[0-9]+}}, v{{[0-9]+}} offset:16 16define void @atomic_sub_local_const_offset(i32 addrspace(3)* %local) { 17 %gep = getelementptr i32, i32 addrspace(3)* %local, i32 4 18 %val = atomicrmw volatile sub i32 addrspace(3)* %gep, i32 5 seq_cst 19 ret void 20} 21 22; FUNC-LABEL: {{^}}atomic_sub_ret_local: 23; R600: LDS_SUB_RET * 24; SI: ds_sub_rtn_u32 25define void @atomic_sub_ret_local(i32 addrspace(1)* %out, i32 addrspace(3)* %local) { 26 %val = atomicrmw volatile sub i32 addrspace(3)* %local, i32 5 seq_cst 27 store i32 %val, i32 addrspace(1)* %out 28 ret void 29} 30 31; FUNC-LABEL: {{^}}atomic_sub_ret_local_const_offset: 32; R600: LDS_SUB_RET * 33; SI: ds_sub_rtn_u32 v{{[0-9]+}}, v{{[0-9]+}}, v{{[0-9]+}} offset:20 34define void @atomic_sub_ret_local_const_offset(i32 addrspace(1)* %out, i32 addrspace(3)* %local) { 35 %gep = getelementptr i32, i32 addrspace(3)* %local, i32 5 36 %val = atomicrmw volatile sub i32 addrspace(3)* %gep, i32 5 seq_cst 37 store i32 %val, i32 addrspace(1)* %out 38 ret void 39} 40