1 ; RUN: llc -march=r600 -mcpu=SI -verify-machineinstrs < %s | FileCheck %s -check-prefix=SI -check-prefix=FUNC 2 ; RUN: llc -march=r600 -mcpu=redwood < %s | FileCheck -check-prefix=R600 -check-prefix=FUNC %s 3 4 ; FUNC-LABEL: @atomic_add_local 5 ; R600: LDS_ADD * 6 ; SI: DS_ADD_RTN_U32 7 define void @atomic_add_local(i32 addrspace(3)* %local) { 8 %unused = atomicrmw volatile add i32 addrspace(3)* %local, i32 5 seq_cst 9 ret void 10 } 11 12 ; FUNC-LABEL: @atomic_add_local_const_offset 13 ; R600: LDS_ADD * 14 ; SI: DS_ADD_RTN_U32 v{{[0-9]+}}, v{{[0-9]+}}, v{{[0-9]+}}, 0x10 15 define void @atomic_add_local_const_offset(i32 addrspace(3)* %local) { 16 %gep = getelementptr i32 addrspace(3)* %local, i32 4 17 %val = atomicrmw volatile add i32 addrspace(3)* %gep, i32 5 seq_cst 18 ret void 19 } 20 21 ; FUNC-LABEL: @atomic_add_ret_local 22 ; R600: LDS_ADD_RET * 23 ; SI: DS_ADD_RTN_U32 24 define void @atomic_add_ret_local(i32 addrspace(1)* %out, i32 addrspace(3)* %local) { 25 %val = atomicrmw volatile add i32 addrspace(3)* %local, i32 5 seq_cst 26 store i32 %val, i32 addrspace(1)* %out 27 ret void 28 } 29 30 ; FUNC-LABEL: @atomic_add_ret_local_const_offset 31 ; R600: LDS_ADD_RET * 32 ; SI: DS_ADD_RTN_U32 v{{[0-9]+}}, v{{[0-9]+}}, v{{[0-9]+}}, 0x14 33 define void @atomic_add_ret_local_const_offset(i32 addrspace(1)* %out, i32 addrspace(3)* %local) { 34 %gep = getelementptr i32 addrspace(3)* %local, i32 5 35 %val = atomicrmw volatile add i32 addrspace(3)* %gep, i32 5 seq_cst 36 store i32 %val, i32 addrspace(1)* %out 37 ret void 38 } 39