2015-01-06 18:00:21 +00:00
|
|
|
; RUN: llc -march=amdgcn -mcpu=SI -verify-machineinstrs < %s | FileCheck %s -check-prefix=SI -check-prefix=FUNC
|
2015-01-27 17:27:15 +00:00
|
|
|
; RUN: llc -march=amdgcn -mcpu=tonga -verify-machineinstrs < %s | FileCheck %s -check-prefix=SI -check-prefix=FUNC
|
2014-06-11 18:08:34 +00:00
|
|
|
; RUN: llc -march=r600 -mcpu=redwood < %s | FileCheck -check-prefix=R600 -check-prefix=FUNC %s
|
2013-09-05 18:38:09 +00:00
|
|
|
|
2014-10-01 17:15:17 +00:00
|
|
|
; FUNC-LABEL: {{^}}atomic_add_local:
|
2014-06-11 18:08:34 +00:00
|
|
|
; R600: LDS_ADD *
|
2014-11-05 14:50:53 +00:00
|
|
|
; SI: ds_add_u32
|
2013-09-05 18:38:09 +00:00
|
|
|
define void @atomic_add_local(i32 addrspace(3)* %local) {
|
2014-06-11 18:08:34 +00:00
|
|
|
%unused = atomicrmw volatile add i32 addrspace(3)* %local, i32 5 seq_cst
|
2013-09-05 18:38:09 +00:00
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2014-10-01 17:15:17 +00:00
|
|
|
; FUNC-LABEL: {{^}}atomic_add_local_const_offset:
|
2014-06-11 18:08:34 +00:00
|
|
|
; R600: LDS_ADD *
|
2014-11-05 14:50:53 +00:00
|
|
|
; SI: ds_add_u32 v{{[0-9]+}}, v{{[0-9]+}} offset:16
|
2014-06-11 18:08:34 +00:00
|
|
|
define void @atomic_add_local_const_offset(i32 addrspace(3)* %local) {
|
|
|
|
%gep = getelementptr i32 addrspace(3)* %local, i32 4
|
|
|
|
%val = atomicrmw volatile add i32 addrspace(3)* %gep, i32 5 seq_cst
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2014-10-01 17:15:17 +00:00
|
|
|
; FUNC-LABEL: {{^}}atomic_add_ret_local:
|
2014-06-11 18:08:34 +00:00
|
|
|
; R600: LDS_ADD_RET *
|
2014-11-05 14:50:53 +00:00
|
|
|
; SI: ds_add_rtn_u32
|
2013-09-05 18:38:09 +00:00
|
|
|
define void @atomic_add_ret_local(i32 addrspace(1)* %out, i32 addrspace(3)* %local) {
|
2014-06-11 18:08:34 +00:00
|
|
|
%val = atomicrmw volatile add i32 addrspace(3)* %local, i32 5 seq_cst
|
|
|
|
store i32 %val, i32 addrspace(1)* %out
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2014-10-01 17:15:17 +00:00
|
|
|
; FUNC-LABEL: {{^}}atomic_add_ret_local_const_offset:
|
2014-06-11 18:08:34 +00:00
|
|
|
; R600: LDS_ADD_RET *
|
2014-11-05 14:50:53 +00:00
|
|
|
; SI: ds_add_rtn_u32 v{{[0-9]+}}, v{{[0-9]+}}, v{{[0-9]+}} offset:20
|
2014-06-11 18:08:34 +00:00
|
|
|
define void @atomic_add_ret_local_const_offset(i32 addrspace(1)* %out, i32 addrspace(3)* %local) {
|
|
|
|
%gep = getelementptr i32 addrspace(3)* %local, i32 5
|
|
|
|
%val = atomicrmw volatile add i32 addrspace(3)* %gep, i32 5 seq_cst
|
|
|
|
store i32 %val, i32 addrspace(1)* %out
|
2013-09-05 18:38:09 +00:00
|
|
|
ret void
|
|
|
|
}
|