2017-11-13 07:40:12 +08:00
|
|
|
; RUN: llc -march=amdgcn -mcpu=bonaire -verify-machineinstrs < %s | FileCheck -enable-var-scope -check-prefixes=GCN,CI,CIVI %s
|
|
|
|
; RUN: llc -march=amdgcn -mcpu=tonga -mattr=-flat-for-global -verify-machineinstrs < %s | FileCheck -check-prefixes=GCN,VI,CIVI %s
|
|
|
|
; RUN: llc -march=amdgcn -mcpu=gfx900 -verify-machineinstrs < %s | FileCheck -check-prefixes=GCN,GFX9 %s
|
2016-04-12 22:05:04 +08:00
|
|
|
|
2017-03-31 06:21:40 +08:00
|
|
|
declare i32 @llvm.amdgcn.atomic.dec.i32.p1i32(i32 addrspace(1)* nocapture, i32, i32, i32, i1) #2
|
|
|
|
declare i32 @llvm.amdgcn.atomic.dec.i32.p3i32(i32 addrspace(3)* nocapture, i32, i32, i32, i1) #2
|
2018-02-03 00:07:16 +08:00
|
|
|
declare i32 @llvm.amdgcn.atomic.dec.i32.p0i32(i32* nocapture, i32, i32, i32, i1) #2
|
2016-04-12 22:05:04 +08:00
|
|
|
|
2017-03-31 06:21:40 +08:00
|
|
|
declare i64 @llvm.amdgcn.atomic.dec.i64.p1i64(i64 addrspace(1)* nocapture, i64, i32, i32, i1) #2
|
|
|
|
declare i64 @llvm.amdgcn.atomic.dec.i64.p3i64(i64 addrspace(3)* nocapture, i64, i32, i32, i1) #2
|
2018-02-03 00:07:16 +08:00
|
|
|
declare i64 @llvm.amdgcn.atomic.dec.i64.p0i64(i64* nocapture, i64, i32, i32, i1) #2
|
2016-04-12 22:05:04 +08:00
|
|
|
|
|
|
|
declare i32 @llvm.amdgcn.workitem.id.x() #1
|
|
|
|
|
|
|
|
; GCN-LABEL: {{^}}lds_atomic_dec_ret_i32:
|
2017-11-29 08:55:57 +08:00
|
|
|
; CIVI-DAG: s_mov_b32 m0
|
|
|
|
; GFX9-NOT: m0
|
|
|
|
|
|
|
|
; GCN-DAG: v_mov_b32_e32 [[K:v[0-9]+]], 42
|
2016-04-12 22:05:04 +08:00
|
|
|
; GCN: ds_dec_rtn_u32 v{{[0-9]+}}, v{{[0-9]+}}, [[K]]
|
2017-03-22 05:39:51 +08:00
|
|
|
define amdgpu_kernel void @lds_atomic_dec_ret_i32(i32 addrspace(1)* %out, i32 addrspace(3)* %ptr) #0 {
|
2017-03-31 06:21:40 +08:00
|
|
|
%result = call i32 @llvm.amdgcn.atomic.dec.i32.p3i32(i32 addrspace(3)* %ptr, i32 42, i32 0, i32 0, i1 false)
|
2016-04-12 22:05:04 +08:00
|
|
|
store i32 %result, i32 addrspace(1)* %out
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
; GCN-LABEL: {{^}}lds_atomic_dec_ret_i32_offset:
|
2017-11-29 08:55:57 +08:00
|
|
|
; CIVI-DAG: s_mov_b32 m0
|
|
|
|
; GFX9-NOT: m0
|
|
|
|
|
|
|
|
; GCN-DAG: v_mov_b32_e32 [[K:v[0-9]+]], 42
|
2016-04-12 22:05:04 +08:00
|
|
|
; GCN: ds_dec_rtn_u32 v{{[0-9]+}}, v{{[0-9]+}}, [[K]] offset:16
|
2017-03-22 05:39:51 +08:00
|
|
|
define amdgpu_kernel void @lds_atomic_dec_ret_i32_offset(i32 addrspace(1)* %out, i32 addrspace(3)* %ptr) #0 {
|
2016-04-12 22:05:04 +08:00
|
|
|
%gep = getelementptr i32, i32 addrspace(3)* %ptr, i32 4
|
2017-03-31 06:21:40 +08:00
|
|
|
%result = call i32 @llvm.amdgcn.atomic.dec.i32.p3i32(i32 addrspace(3)* %gep, i32 42, i32 0, i32 0, i1 false)
|
2016-04-12 22:05:04 +08:00
|
|
|
store i32 %result, i32 addrspace(1)* %out
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2017-11-13 07:40:12 +08:00
|
|
|
; GCN-LABEL: {{^}}lds_atomic_dec_noret_i32:
|
2017-11-29 08:55:57 +08:00
|
|
|
; CIVI-DAG: s_mov_b32 m0
|
|
|
|
; GFX9-NOT: m0
|
|
|
|
|
|
|
|
; GCN-DAG: s_load_dword [[SPTR:s[0-9]+]],
|
|
|
|
; GCN-DAG: v_mov_b32_e32 [[DATA:v[0-9]+]], 4
|
|
|
|
; GCN-DAG: v_mov_b32_e32 [[VPTR:v[0-9]+]], [[SPTR]]
|
2016-04-12 22:05:04 +08:00
|
|
|
; GCN: ds_dec_u32 [[VPTR]], [[DATA]]
|
2017-03-22 05:39:51 +08:00
|
|
|
define amdgpu_kernel void @lds_atomic_dec_noret_i32(i32 addrspace(3)* %ptr) nounwind {
|
2017-03-31 06:21:40 +08:00
|
|
|
%result = call i32 @llvm.amdgcn.atomic.dec.i32.p3i32(i32 addrspace(3)* %ptr, i32 42, i32 0, i32 0, i1 false)
|
2016-04-12 22:05:04 +08:00
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2017-11-13 07:40:12 +08:00
|
|
|
; GCN-LABEL: {{^}}lds_atomic_dec_noret_i32_offset:
|
2017-11-29 08:55:57 +08:00
|
|
|
; CIVI-DAG: s_mov_b32 m0
|
|
|
|
; GFX9-NOT: m0
|
|
|
|
|
|
|
|
; GCN-DAG: v_mov_b32_e32 [[K:v[0-9]+]], 42
|
2016-04-12 22:05:04 +08:00
|
|
|
; GCN: ds_dec_u32 v{{[0-9]+}}, [[K]] offset:16
|
2017-03-22 05:39:51 +08:00
|
|
|
define amdgpu_kernel void @lds_atomic_dec_noret_i32_offset(i32 addrspace(3)* %ptr) nounwind {
|
2016-04-12 22:05:04 +08:00
|
|
|
%gep = getelementptr i32, i32 addrspace(3)* %ptr, i32 4
|
2017-03-31 06:21:40 +08:00
|
|
|
%result = call i32 @llvm.amdgcn.atomic.dec.i32.p3i32(i32 addrspace(3)* %gep, i32 42, i32 0, i32 0, i1 false)
|
2016-04-12 22:05:04 +08:00
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
; GCN-LABEL: {{^}}global_atomic_dec_ret_i32:
|
|
|
|
; GCN: v_mov_b32_e32 [[K:v[0-9]+]], 42
|
2017-11-13 07:40:12 +08:00
|
|
|
; CIVI: buffer_atomic_dec [[K]], off, s{{\[[0-9]+:[0-9]+\]}}, 0 glc{{$}}
|
|
|
|
; GFX9: global_atomic_dec v{{[0-9]+}}, v{{\[[0-9]+:[0-9]+\]}}, [[K]], off glc{{$}}
|
2017-03-22 05:39:51 +08:00
|
|
|
define amdgpu_kernel void @global_atomic_dec_ret_i32(i32 addrspace(1)* %out, i32 addrspace(1)* %ptr) #0 {
|
2017-03-31 06:21:40 +08:00
|
|
|
%result = call i32 @llvm.amdgcn.atomic.dec.i32.p1i32(i32 addrspace(1)* %ptr, i32 42, i32 0, i32 0, i1 false)
|
2016-04-12 22:05:04 +08:00
|
|
|
store i32 %result, i32 addrspace(1)* %out
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
; GCN-LABEL: {{^}}global_atomic_dec_ret_i32_offset:
|
|
|
|
; GCN: v_mov_b32_e32 [[K:v[0-9]+]], 42
|
2017-11-13 07:40:12 +08:00
|
|
|
; CIVI: buffer_atomic_dec [[K]], off, s{{\[[0-9]+:[0-9]+\]}}, 0 offset:16 glc{{$}}
|
|
|
|
; GFX9: global_atomic_dec v{{[0-9]+}}, v{{\[[0-9]+:[0-9]+\]}}, [[K]], off offset:16 glc{{$}}
|
2017-03-22 05:39:51 +08:00
|
|
|
define amdgpu_kernel void @global_atomic_dec_ret_i32_offset(i32 addrspace(1)* %out, i32 addrspace(1)* %ptr) #0 {
|
2016-04-12 22:05:04 +08:00
|
|
|
%gep = getelementptr i32, i32 addrspace(1)* %ptr, i32 4
|
2017-03-31 06:21:40 +08:00
|
|
|
%result = call i32 @llvm.amdgcn.atomic.dec.i32.p1i32(i32 addrspace(1)* %gep, i32 42, i32 0, i32 0, i1 false)
|
2016-04-12 22:05:04 +08:00
|
|
|
store i32 %result, i32 addrspace(1)* %out
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2017-11-13 07:40:12 +08:00
|
|
|
; GCN-LABEL: {{^}}global_atomic_dec_noret_i32:
|
|
|
|
; GCN: v_mov_b32_e32 [[K:v[0-9]+]], 42
|
|
|
|
; CIVI: buffer_atomic_dec [[K]], off, s{{\[[0-9]+:[0-9]+\]}}, 0{{$}}
|
|
|
|
; GFX9: global_atomic_dec v{{\[[0-9]+:[0-9]+\]}}, [[K]], off{{$}}
|
2017-03-22 05:39:51 +08:00
|
|
|
define amdgpu_kernel void @global_atomic_dec_noret_i32(i32 addrspace(1)* %ptr) nounwind {
|
2017-03-31 06:21:40 +08:00
|
|
|
%result = call i32 @llvm.amdgcn.atomic.dec.i32.p1i32(i32 addrspace(1)* %ptr, i32 42, i32 0, i32 0, i1 false)
|
2016-04-12 22:05:04 +08:00
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2017-11-13 07:40:12 +08:00
|
|
|
; GCN-LABEL: {{^}}global_atomic_dec_noret_i32_offset:
|
2016-04-12 22:05:04 +08:00
|
|
|
; GCN: v_mov_b32_e32 [[K:v[0-9]+]], 42
|
2017-11-13 07:40:12 +08:00
|
|
|
; CIVI: buffer_atomic_dec [[K]], off, s{{\[[0-9]+:[0-9]+\]}}, 0 offset:16{{$}}
|
|
|
|
; GFX9: global_atomic_dec v{{\[[0-9]+:[0-9]+\]}}, [[K]], off offset:16{{$}}
|
2017-03-22 05:39:51 +08:00
|
|
|
define amdgpu_kernel void @global_atomic_dec_noret_i32_offset(i32 addrspace(1)* %ptr) nounwind {
|
2016-04-12 22:05:04 +08:00
|
|
|
%gep = getelementptr i32, i32 addrspace(1)* %ptr, i32 4
|
2017-03-31 06:21:40 +08:00
|
|
|
%result = call i32 @llvm.amdgcn.atomic.dec.i32.p1i32(i32 addrspace(1)* %gep, i32 42, i32 0, i32 0, i1 false)
|
2016-04-12 22:05:04 +08:00
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
; GCN-LABEL: {{^}}global_atomic_dec_ret_i32_offset_addr64:
|
|
|
|
; GCN: v_mov_b32_e32 [[K:v[0-9]+]], 42
|
|
|
|
; CI: buffer_atomic_dec [[K]], v{{\[[0-9]+:[0-9]+\]}}, s{{\[[0-9]+:[0-9]+\]}}, 0 addr64 offset:20 glc{{$}}
|
|
|
|
; VI: flat_atomic_dec v{{[0-9]+}}, v{{\[[0-9]+:[0-9]+\]}}, [[K]] glc{{$}}
|
2017-03-22 05:39:51 +08:00
|
|
|
define amdgpu_kernel void @global_atomic_dec_ret_i32_offset_addr64(i32 addrspace(1)* %out, i32 addrspace(1)* %ptr) #0 {
|
2016-04-12 22:05:04 +08:00
|
|
|
%id = call i32 @llvm.amdgcn.workitem.id.x()
|
|
|
|
%gep.tid = getelementptr i32, i32 addrspace(1)* %ptr, i32 %id
|
|
|
|
%out.gep = getelementptr i32, i32 addrspace(1)* %out, i32 %id
|
|
|
|
%gep = getelementptr i32, i32 addrspace(1)* %gep.tid, i32 5
|
2017-03-31 06:21:40 +08:00
|
|
|
%result = call i32 @llvm.amdgcn.atomic.dec.i32.p1i32(i32 addrspace(1)* %gep, i32 42, i32 0, i32 0, i1 false)
|
2016-04-12 22:05:04 +08:00
|
|
|
store i32 %result, i32 addrspace(1)* %out.gep
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
; GCN-LABEL: {{^}}global_atomic_dec_noret_i32_offset_addr64:
|
|
|
|
; GCN: v_mov_b32_e32 [[K:v[0-9]+]], 42
|
|
|
|
; CI: buffer_atomic_dec [[K]], v{{\[[0-9]+:[0-9]+\]}}, s{{\[[0-9]+:[0-9]+\]}}, 0 addr64 offset:20{{$}}
|
|
|
|
; VI: flat_atomic_dec v{{\[[0-9]+:[0-9]+\]}}, [[K]]{{$}}
|
2017-03-22 05:39:51 +08:00
|
|
|
define amdgpu_kernel void @global_atomic_dec_noret_i32_offset_addr64(i32 addrspace(1)* %ptr) #0 {
|
2016-04-12 22:05:04 +08:00
|
|
|
%id = call i32 @llvm.amdgcn.workitem.id.x()
|
|
|
|
%gep.tid = getelementptr i32, i32 addrspace(1)* %ptr, i32 %id
|
|
|
|
%gep = getelementptr i32, i32 addrspace(1)* %gep.tid, i32 5
|
2017-03-31 06:21:40 +08:00
|
|
|
%result = call i32 @llvm.amdgcn.atomic.dec.i32.p1i32(i32 addrspace(1)* %gep, i32 42, i32 0, i32 0, i1 false)
|
2016-04-12 22:05:04 +08:00
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2016-06-10 07:42:54 +08:00
|
|
|
; GCN-LABEL: {{^}}flat_atomic_dec_ret_i32:
|
|
|
|
; GCN: v_mov_b32_e32 [[K:v[0-9]+]], 42
|
|
|
|
; GCN: flat_atomic_dec v{{[0-9]+}}, v{{\[[0-9]+:[0-9]+\]}}, [[K]] glc{{$}}
|
2018-02-03 00:07:16 +08:00
|
|
|
define amdgpu_kernel void @flat_atomic_dec_ret_i32(i32* %out, i32* %ptr) #0 {
|
|
|
|
%result = call i32 @llvm.amdgcn.atomic.dec.i32.p0i32(i32* %ptr, i32 42, i32 0, i32 0, i1 false)
|
|
|
|
store i32 %result, i32* %out
|
2016-06-10 07:42:54 +08:00
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
; GCN-LABEL: {{^}}flat_atomic_dec_ret_i32_offset:
|
|
|
|
; GCN: v_mov_b32_e32 [[K:v[0-9]+]], 42
|
2017-11-13 07:40:12 +08:00
|
|
|
; CIVI: flat_atomic_dec v{{[0-9]+}}, v{{\[[0-9]+:[0-9]+\]}}, [[K]] glc{{$}}
|
|
|
|
; GFX9: flat_atomic_dec v{{[0-9]+}}, v{{\[[0-9]+:[0-9]+\]}}, [[K]] offset:16 glc{{$}}
|
2018-02-03 00:07:16 +08:00
|
|
|
define amdgpu_kernel void @flat_atomic_dec_ret_i32_offset(i32* %out, i32* %ptr) #0 {
|
|
|
|
%gep = getelementptr i32, i32* %ptr, i32 4
|
|
|
|
%result = call i32 @llvm.amdgcn.atomic.dec.i32.p0i32(i32* %gep, i32 42, i32 0, i32 0, i1 false)
|
|
|
|
store i32 %result, i32* %out
|
2016-06-10 07:42:54 +08:00
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2017-11-13 07:40:12 +08:00
|
|
|
; GCN-LABEL: {{^}}flat_atomic_dec_noret_i32:
|
|
|
|
; GCN: v_mov_b32_e32 [[K:v[0-9]+]], 42
|
2016-06-10 07:42:54 +08:00
|
|
|
; GCN: flat_atomic_dec v{{\[[0-9]+:[0-9]+\]}}, [[K]]{{$}}
|
2018-02-03 00:07:16 +08:00
|
|
|
define amdgpu_kernel void @flat_atomic_dec_noret_i32(i32* %ptr) nounwind {
|
|
|
|
%result = call i32 @llvm.amdgcn.atomic.dec.i32.p0i32(i32* %ptr, i32 42, i32 0, i32 0, i1 false)
|
2016-06-10 07:42:54 +08:00
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2017-11-13 07:40:12 +08:00
|
|
|
; GCN-LABEL: {{^}}flat_atomic_dec_noret_i32_offset:
|
2016-06-10 07:42:54 +08:00
|
|
|
; GCN: v_mov_b32_e32 [[K:v[0-9]+]], 42
|
2017-11-13 07:40:12 +08:00
|
|
|
; CIVI: flat_atomic_dec v{{\[[0-9]+:[0-9]+\]}}, [[K]]{{$}}
|
|
|
|
; GFX9: flat_atomic_dec v{{\[[0-9]+:[0-9]+\]}}, [[K]] offset:16{{$}}
|
2018-02-03 00:07:16 +08:00
|
|
|
define amdgpu_kernel void @flat_atomic_dec_noret_i32_offset(i32* %ptr) nounwind {
|
|
|
|
%gep = getelementptr i32, i32* %ptr, i32 4
|
|
|
|
%result = call i32 @llvm.amdgcn.atomic.dec.i32.p0i32(i32* %gep, i32 42, i32 0, i32 0, i1 false)
|
2016-06-10 07:42:54 +08:00
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
; GCN-LABEL: {{^}}flat_atomic_dec_ret_i32_offset_addr64:
|
|
|
|
; GCN: v_mov_b32_e32 [[K:v[0-9]+]], 42
|
2017-11-13 07:40:12 +08:00
|
|
|
; CIVI: flat_atomic_dec v{{[0-9]+}}, v{{\[[0-9]+:[0-9]+\]}}, [[K]] glc{{$}}
|
|
|
|
; GFX9: flat_atomic_dec v{{[0-9]+}}, v{{\[[0-9]+:[0-9]+\]}}, [[K]] offset:20 glc{{$}}
|
2018-02-03 00:07:16 +08:00
|
|
|
define amdgpu_kernel void @flat_atomic_dec_ret_i32_offset_addr64(i32* %out, i32* %ptr) #0 {
|
2016-06-10 07:42:54 +08:00
|
|
|
%id = call i32 @llvm.amdgcn.workitem.id.x()
|
2018-02-03 00:07:16 +08:00
|
|
|
%gep.tid = getelementptr i32, i32* %ptr, i32 %id
|
|
|
|
%out.gep = getelementptr i32, i32* %out, i32 %id
|
|
|
|
%gep = getelementptr i32, i32* %gep.tid, i32 5
|
|
|
|
%result = call i32 @llvm.amdgcn.atomic.dec.i32.p0i32(i32* %gep, i32 42, i32 0, i32 0, i1 false)
|
|
|
|
store i32 %result, i32* %out.gep
|
2016-06-10 07:42:54 +08:00
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
; GCN-LABEL: {{^}}flat_atomic_dec_noret_i32_offset_addr64:
|
|
|
|
; GCN: v_mov_b32_e32 [[K:v[0-9]+]], 42
|
2017-11-13 07:40:12 +08:00
|
|
|
; CIVI: flat_atomic_dec v{{\[[0-9]+:[0-9]+\]}}, [[K]]{{$}}
|
|
|
|
; GFX9: flat_atomic_dec v{{\[[0-9]+:[0-9]+\]}}, [[K]] offset:20{{$}}
|
2018-02-03 00:07:16 +08:00
|
|
|
define amdgpu_kernel void @flat_atomic_dec_noret_i32_offset_addr64(i32* %ptr) #0 {
|
2016-06-10 07:42:54 +08:00
|
|
|
%id = call i32 @llvm.amdgcn.workitem.id.x()
|
2018-02-03 00:07:16 +08:00
|
|
|
%gep.tid = getelementptr i32, i32* %ptr, i32 %id
|
|
|
|
%gep = getelementptr i32, i32* %gep.tid, i32 5
|
|
|
|
%result = call i32 @llvm.amdgcn.atomic.dec.i32.p0i32(i32* %gep, i32 42, i32 0, i32 0, i1 false)
|
2016-06-10 07:42:54 +08:00
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
; GCN-LABEL: {{^}}flat_atomic_dec_ret_i64:
|
|
|
|
; GCN-DAG: v_mov_b32_e32 v[[KLO:[0-9]+]], 42
|
|
|
|
; GCN-DAG: v_mov_b32_e32 v[[KHI:[0-9]+]], 0{{$}}
|
|
|
|
; GCN: flat_atomic_dec_x2 v{{\[[0-9]+:[0-9]+\]}}, v{{\[[0-9]+:[0-9]+\]}}, v{{\[}}[[KLO]]:[[KHI]]{{\]}} glc{{$}}
|
2018-02-03 00:07:16 +08:00
|
|
|
define amdgpu_kernel void @flat_atomic_dec_ret_i64(i64* %out, i64* %ptr) #0 {
|
|
|
|
%result = call i64 @llvm.amdgcn.atomic.dec.i64.p0i64(i64* %ptr, i64 42, i32 0, i32 0, i1 false)
|
|
|
|
store i64 %result, i64* %out
|
2016-06-10 07:42:54 +08:00
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
; GCN-LABEL: {{^}}flat_atomic_dec_ret_i64_offset:
|
|
|
|
; GCN-DAG: v_mov_b32_e32 v[[KLO:[0-9]+]], 42
|
|
|
|
; GCN-DAG: v_mov_b32_e32 v[[KHI:[0-9]+]], 0{{$}}
|
2017-11-13 07:40:12 +08:00
|
|
|
; CIVI: flat_atomic_dec_x2 v{{\[[0-9]+:[0-9]+\]}}, v{{\[[0-9]+:[0-9]+\]}}, v{{\[}}[[KLO]]:[[KHI]]{{\]}} glc{{$}}
|
|
|
|
; GFX9: flat_atomic_dec_x2 v{{\[[0-9]+:[0-9]+\]}}, v{{\[[0-9]+:[0-9]+\]}}, v{{\[}}[[KLO]]:[[KHI]]{{\]}} offset:32 glc{{$}}
|
2018-02-03 00:07:16 +08:00
|
|
|
define amdgpu_kernel void @flat_atomic_dec_ret_i64_offset(i64* %out, i64* %ptr) #0 {
|
|
|
|
%gep = getelementptr i64, i64* %ptr, i32 4
|
|
|
|
%result = call i64 @llvm.amdgcn.atomic.dec.i64.p0i64(i64* %gep, i64 42, i32 0, i32 0, i1 false)
|
|
|
|
store i64 %result, i64* %out
|
2016-06-10 07:42:54 +08:00
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2017-11-13 07:40:12 +08:00
|
|
|
; GCN-LABEL: {{^}}flat_atomic_dec_noret_i64:
|
2016-06-10 07:42:54 +08:00
|
|
|
; GCN-DAG: v_mov_b32_e32 v[[KLO:[0-9]+]], 42
|
|
|
|
; GCN-DAG: v_mov_b32_e32 v[[KHI:[0-9]+]], 0{{$}}
|
|
|
|
; GCN: flat_atomic_dec_x2 v{{\[[0-9]+:[0-9]+\]}}, v{{\[}}[[KLO]]:[[KHI]]{{\]$}}
|
2018-02-03 00:07:16 +08:00
|
|
|
define amdgpu_kernel void @flat_atomic_dec_noret_i64(i64* %ptr) nounwind {
|
|
|
|
%result = call i64 @llvm.amdgcn.atomic.dec.i64.p0i64(i64* %ptr, i64 42, i32 0, i32 0, i1 false)
|
2016-06-10 07:42:54 +08:00
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2017-11-13 07:40:12 +08:00
|
|
|
; GCN-LABEL: {{^}}flat_atomic_dec_noret_i64_offset:
|
2016-06-10 07:42:54 +08:00
|
|
|
; GCN-DAG: v_mov_b32_e32 v[[KLO:[0-9]+]], 42
|
|
|
|
; GCN-DAG: v_mov_b32_e32 v[[KHI:[0-9]+]], 0{{$}}
|
2017-11-13 07:40:12 +08:00
|
|
|
; CIVI: flat_atomic_dec_x2 v{{\[[0-9]+:[0-9]+\]}}, v{{\[}}[[KLO]]:[[KHI]]{{\]$}}
|
|
|
|
; GFX9: flat_atomic_dec_x2 v{{\[[0-9]+:[0-9]+\]}}, v{{\[}}[[KLO]]:[[KHI]]{{\]}} offset:32{{$}}
|
2018-02-03 00:07:16 +08:00
|
|
|
define amdgpu_kernel void @flat_atomic_dec_noret_i64_offset(i64* %ptr) nounwind {
|
|
|
|
%gep = getelementptr i64, i64* %ptr, i32 4
|
|
|
|
%result = call i64 @llvm.amdgcn.atomic.dec.i64.p0i64(i64* %gep, i64 42, i32 0, i32 0, i1 false)
|
2016-06-10 07:42:54 +08:00
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
; GCN-LABEL: {{^}}flat_atomic_dec_ret_i64_offset_addr64:
|
2017-04-13 04:48:56 +08:00
|
|
|
; GCN: v_mov_b32_e32 v[[KLO:[0-9]+]], 42
|
|
|
|
; GCN: v_mov_b32_e32 v[[KHI:[0-9]+]], 0{{$}}
|
2017-11-13 07:40:12 +08:00
|
|
|
; CIVI: flat_atomic_dec_x2 v{{\[[0-9]+:[0-9]+\]}}, v{{\[[0-9]+:[0-9]+\]}}, v{{\[}}[[KLO]]:[[KHI]]{{\]}} glc{{$}}
|
|
|
|
; GFX9: flat_atomic_dec_x2 v{{\[[0-9]+:[0-9]+\]}}, v{{\[[0-9]+:[0-9]+\]}}, v{{\[}}[[KLO]]:[[KHI]]{{\]}} offset:40 glc{{$}}
|
2018-02-03 00:07:16 +08:00
|
|
|
define amdgpu_kernel void @flat_atomic_dec_ret_i64_offset_addr64(i64* %out, i64* %ptr) #0 {
|
2016-06-10 07:42:54 +08:00
|
|
|
%id = call i32 @llvm.amdgcn.workitem.id.x()
|
2018-02-03 00:07:16 +08:00
|
|
|
%gep.tid = getelementptr i64, i64* %ptr, i32 %id
|
|
|
|
%out.gep = getelementptr i64, i64* %out, i32 %id
|
|
|
|
%gep = getelementptr i64, i64* %gep.tid, i32 5
|
|
|
|
%result = call i64 @llvm.amdgcn.atomic.dec.i64.p0i64(i64* %gep, i64 42, i32 0, i32 0, i1 false)
|
|
|
|
store i64 %result, i64* %out.gep
|
2016-06-10 07:42:54 +08:00
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
; GCN-LABEL: {{^}}flat_atomic_dec_noret_i64_offset_addr64:
|
2017-04-13 04:48:56 +08:00
|
|
|
; GCN: v_mov_b32_e32 v[[KLO:[0-9]+]], 42
|
|
|
|
; GCN: v_mov_b32_e32 v[[KHI:[0-9]+]], 0{{$}}
|
2017-11-13 07:40:12 +08:00
|
|
|
; CIVI: flat_atomic_dec_x2 v{{\[[0-9]+:[0-9]+\]}}, v{{\[}}[[KLO]]:[[KHI]]{{\]$}}
|
|
|
|
; GFX9: flat_atomic_dec_x2 v{{\[[0-9]+:[0-9]+\]}}, v{{\[}}[[KLO]]:[[KHI]]{{\]}} offset:40{{$}}
|
2018-02-03 00:07:16 +08:00
|
|
|
define amdgpu_kernel void @flat_atomic_dec_noret_i64_offset_addr64(i64* %ptr) #0 {
|
2016-06-10 07:42:54 +08:00
|
|
|
%id = call i32 @llvm.amdgcn.workitem.id.x()
|
2018-02-03 00:07:16 +08:00
|
|
|
%gep.tid = getelementptr i64, i64* %ptr, i32 %id
|
|
|
|
%gep = getelementptr i64, i64* %gep.tid, i32 5
|
|
|
|
%result = call i64 @llvm.amdgcn.atomic.dec.i64.p0i64(i64* %gep, i64 42, i32 0, i32 0, i1 false)
|
2016-06-10 07:42:54 +08:00
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2016-04-12 22:05:04 +08:00
|
|
|
@lds0 = addrspace(3) global [512 x i32] undef
|
|
|
|
|
2017-11-13 07:40:12 +08:00
|
|
|
; GCN-LABEL: {{^}}atomic_dec_shl_base_lds_0:
|
2017-11-29 08:55:57 +08:00
|
|
|
; CIVI-DAG: s_mov_b32 m0
|
|
|
|
; GFX9-NOT: m0
|
|
|
|
|
AMDGPU: Write LDS objects out as global symbols in code generation
Summary:
The symbols use the processor-specific SHN_AMDGPU_LDS section index
introduced with a previous change. The linker is then expected to resolve
relocations, which are also emitted.
Initially disabled for HSA and PAL environments until they have caught up
in terms of linker and runtime loader.
Some notes:
- The llvm.amdgcn.groupstaticsize intrinsics can no longer be lowered
to a constant at compile times, which means some tests can no longer
be applied.
The current "solution" is a terrible hack, but the intrinsic isn't
used by Mesa, so we can keep it for now.
- We no longer know the full LDS size per kernel at compile time, which
means that we can no longer generate a relevant error message at
compile time. It would be possible to add a check for the size of
individual variables, but ultimately the linker will have to perform
the final check.
Change-Id: If66dbf33fccfbf3609aefefa2558ac0850d42275
Reviewers: arsenm, rampitec, t-tye, b-sumner, jsjodin
Subscribers: qcolombet, kzhuravl, jvesely, wdng, yaxunl, dstuttard, tpr, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D61494
llvm-svn: 364297
2019-06-25 19:52:30 +08:00
|
|
|
; CIVI-DAG: v_lshlrev_b32_e32 [[OFS:v[0-9]+]], 2, {{v[0-9]+}}
|
|
|
|
; CIVI-DAG: v_add_{{[ui]}}32_e32 [[PTR:v[0-9]+]], vcc, lds0@abs32@lo, [[OFS]]
|
|
|
|
; GFX9-DAG: s_mov_b32 [[BASE:s[0-9]+]], lds0@abs32@lo
|
|
|
|
; GFX9-DAG: v_lshl_add_u32 [[PTR:v[0-9]+]], {{v[0-9]+}}, 2, [[BASE]]
|
|
|
|
|
2017-11-13 07:40:12 +08:00
|
|
|
; GCN: ds_dec_rtn_u32 {{v[0-9]+}}, [[PTR]], {{v[0-9]+}} offset:8
|
2017-03-22 05:39:51 +08:00
|
|
|
define amdgpu_kernel void @atomic_dec_shl_base_lds_0(i32 addrspace(1)* %out, i32 addrspace(1)* %add_use) #0 {
|
2016-04-12 22:05:04 +08:00
|
|
|
%tid.x = tail call i32 @llvm.amdgcn.workitem.id.x() #1
|
|
|
|
%idx.0 = add nsw i32 %tid.x, 2
|
|
|
|
%arrayidx0 = getelementptr inbounds [512 x i32], [512 x i32] addrspace(3)* @lds0, i32 0, i32 %idx.0
|
2017-03-31 06:21:40 +08:00
|
|
|
%val0 = call i32 @llvm.amdgcn.atomic.dec.i32.p3i32(i32 addrspace(3)* %arrayidx0, i32 9, i32 0, i32 0, i1 false)
|
2016-04-12 22:05:04 +08:00
|
|
|
store i32 %idx.0, i32 addrspace(1)* %add_use
|
|
|
|
store i32 %val0, i32 addrspace(1)* %out
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
; GCN-LABEL: {{^}}lds_atomic_dec_ret_i64:
|
2017-11-29 08:55:57 +08:00
|
|
|
; CIVI-DAG: s_mov_b32 m0
|
|
|
|
; GFX9-NOT: m0
|
|
|
|
|
2016-04-12 22:05:04 +08:00
|
|
|
; GCN-DAG: v_mov_b32_e32 v[[KLO:[0-9]+]], 42
|
|
|
|
; GCN-DAG: v_mov_b32_e32 v[[KHI:[0-9]+]], 0{{$}}
|
|
|
|
; GCN: ds_dec_rtn_u64 v{{\[[0-9]+:[0-9]+\]}}, v{{[0-9]+}}, v{{\[}}[[KLO]]:[[KHI]]{{\]}}{{$}}
|
2017-03-22 05:39:51 +08:00
|
|
|
define amdgpu_kernel void @lds_atomic_dec_ret_i64(i64 addrspace(1)* %out, i64 addrspace(3)* %ptr) #0 {
|
2017-03-31 06:21:40 +08:00
|
|
|
%result = call i64 @llvm.amdgcn.atomic.dec.i64.p3i64(i64 addrspace(3)* %ptr, i64 42, i32 0, i32 0, i1 false)
|
2016-04-12 22:05:04 +08:00
|
|
|
store i64 %result, i64 addrspace(1)* %out
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
; GCN-LABEL: {{^}}lds_atomic_dec_ret_i64_offset:
|
2017-11-29 08:55:57 +08:00
|
|
|
; CIVI-DAG: s_mov_b32 m0
|
|
|
|
; GFX9-NOT: m0
|
|
|
|
|
2016-04-12 22:05:04 +08:00
|
|
|
; GCN-DAG: v_mov_b32_e32 v[[KLO:[0-9]+]], 42
|
|
|
|
; GCN-DAG: v_mov_b32_e32 v[[KHI:[0-9]+]], 0{{$}}
|
|
|
|
; GCN: ds_dec_rtn_u64 v{{\[[0-9]+:[0-9]+\]}}, v{{[0-9]+}}, v{{\[}}[[KLO]]:[[KHI]]{{\]}} offset:32
|
2017-03-22 05:39:51 +08:00
|
|
|
define amdgpu_kernel void @lds_atomic_dec_ret_i64_offset(i64 addrspace(1)* %out, i64 addrspace(3)* %ptr) #0 {
|
2016-04-12 22:05:04 +08:00
|
|
|
%gep = getelementptr i64, i64 addrspace(3)* %ptr, i32 4
|
2017-03-31 06:21:40 +08:00
|
|
|
%result = call i64 @llvm.amdgcn.atomic.dec.i64.p3i64(i64 addrspace(3)* %gep, i64 42, i32 0, i32 0, i1 false)
|
2016-04-12 22:05:04 +08:00
|
|
|
store i64 %result, i64 addrspace(1)* %out
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2017-11-13 07:40:12 +08:00
|
|
|
; GCN-LABEL: {{^}}lds_atomic_dec_noret_i64:
|
2017-11-29 08:55:57 +08:00
|
|
|
; CIVI-DAG: s_mov_b32 m0
|
|
|
|
; GFX9-NOT: m0
|
|
|
|
|
2016-04-12 22:05:04 +08:00
|
|
|
; GCN-DAG: v_mov_b32_e32 v[[KLO:[0-9]+]], 42
|
|
|
|
; GCN-DAG: v_mov_b32_e32 v[[KHI:[0-9]+]], 0{{$}}
|
|
|
|
; GCN: ds_dec_u64 v{{[0-9]+}}, v{{\[}}[[KLO]]:[[KHI]]{{\]}}{{$}}
|
2017-03-22 05:39:51 +08:00
|
|
|
define amdgpu_kernel void @lds_atomic_dec_noret_i64(i64 addrspace(3)* %ptr) nounwind {
|
2017-03-31 06:21:40 +08:00
|
|
|
%result = call i64 @llvm.amdgcn.atomic.dec.i64.p3i64(i64 addrspace(3)* %ptr, i64 42, i32 0, i32 0, i1 false)
|
2016-04-12 22:05:04 +08:00
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2017-11-13 07:40:12 +08:00
|
|
|
; GCN-LABEL: {{^}}lds_atomic_dec_noret_i64_offset:
|
2017-11-29 08:55:57 +08:00
|
|
|
; CIVI-DAG: s_mov_b32 m0
|
|
|
|
; GFX9-NOT: m0
|
|
|
|
|
2016-04-12 22:05:04 +08:00
|
|
|
; GCN-DAG: v_mov_b32_e32 v[[KLO:[0-9]+]], 42
|
|
|
|
; GCN-DAG: v_mov_b32_e32 v[[KHI:[0-9]+]], 0{{$}}
|
|
|
|
; GCN: ds_dec_u64 v{{[0-9]+}}, v{{\[}}[[KLO]]:[[KHI]]{{\]}} offset:32{{$}}
|
2017-03-22 05:39:51 +08:00
|
|
|
define amdgpu_kernel void @lds_atomic_dec_noret_i64_offset(i64 addrspace(3)* %ptr) nounwind {
|
2016-04-12 22:05:04 +08:00
|
|
|
%gep = getelementptr i64, i64 addrspace(3)* %ptr, i32 4
|
2017-03-31 06:21:40 +08:00
|
|
|
%result = call i64 @llvm.amdgcn.atomic.dec.i64.p3i64(i64 addrspace(3)* %gep, i64 42, i32 0, i32 0, i1 false)
|
2016-04-12 22:05:04 +08:00
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
; GCN-LABEL: {{^}}global_atomic_dec_ret_i64:
|
|
|
|
; GCN-DAG: v_mov_b32_e32 v[[KLO:[0-9]+]], 42
|
|
|
|
; GCN-DAG: v_mov_b32_e32 v[[KHI:[0-9]+]], 0{{$}}
|
2017-11-13 07:40:12 +08:00
|
|
|
; CIVI: buffer_atomic_dec_x2 v{{\[}}[[KLO]]:[[KHI]]{{\]}}, off, s{{\[[0-9]+:[0-9]+\]}}, 0 glc{{$}}
|
|
|
|
; GFX9: global_atomic_dec_x2 v{{\[[0-9]+:[0-9]+\]}}, v{{\[[0-9]+:[0-9]+\]}}, v{{\[}}[[KLO]]:[[KHI]]{{\]}}, off glc{{$}}
|
2017-03-22 05:39:51 +08:00
|
|
|
define amdgpu_kernel void @global_atomic_dec_ret_i64(i64 addrspace(1)* %out, i64 addrspace(1)* %ptr) #0 {
|
2017-03-31 06:21:40 +08:00
|
|
|
%result = call i64 @llvm.amdgcn.atomic.dec.i64.p1i64(i64 addrspace(1)* %ptr, i64 42, i32 0, i32 0, i1 false)
|
2016-04-12 22:05:04 +08:00
|
|
|
store i64 %result, i64 addrspace(1)* %out
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
; GCN-LABEL: {{^}}global_atomic_dec_ret_i64_offset:
|
|
|
|
; GCN-DAG: v_mov_b32_e32 v[[KLO:[0-9]+]], 42
|
|
|
|
; GCN-DAG: v_mov_b32_e32 v[[KHI:[0-9]+]], 0{{$}}
|
2017-11-13 07:40:12 +08:00
|
|
|
; CIVI: buffer_atomic_dec_x2 v{{\[}}[[KLO]]:[[KHI]]{{\]}}, off, s{{\[[0-9]+:[0-9]+\]}}, 0 offset:32 glc{{$}}
|
|
|
|
; GFX9: global_atomic_dec_x2 v{{\[[0-9]+:[0-9]+\]}}, v{{\[[0-9]+:[0-9]+\]}}, v{{\[}}[[KLO]]:[[KHI]]{{\]}}, off offset:32 glc{{$}}
|
2017-03-22 05:39:51 +08:00
|
|
|
define amdgpu_kernel void @global_atomic_dec_ret_i64_offset(i64 addrspace(1)* %out, i64 addrspace(1)* %ptr) #0 {
|
2016-04-12 22:05:04 +08:00
|
|
|
%gep = getelementptr i64, i64 addrspace(1)* %ptr, i32 4
|
2017-03-31 06:21:40 +08:00
|
|
|
%result = call i64 @llvm.amdgcn.atomic.dec.i64.p1i64(i64 addrspace(1)* %gep, i64 42, i32 0, i32 0, i1 false)
|
2016-04-12 22:05:04 +08:00
|
|
|
store i64 %result, i64 addrspace(1)* %out
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2017-11-13 07:40:12 +08:00
|
|
|
; GCN-LABEL: {{^}}global_atomic_dec_noret_i64:
|
2016-04-12 22:05:04 +08:00
|
|
|
; GCN-DAG: v_mov_b32_e32 v[[KLO:[0-9]+]], 42
|
|
|
|
; GCN-DAG: v_mov_b32_e32 v[[KHI:[0-9]+]], 0{{$}}
|
2017-11-13 07:40:12 +08:00
|
|
|
; CIVI: buffer_atomic_dec_x2 v{{\[}}[[KLO]]:[[KHI]]{{\]}}, off, s{{\[[0-9]+:[0-9]+\]}}, 0{{$}}
|
|
|
|
; GFX9: global_atomic_dec_x2 v{{\[[0-9]+:[0-9]+\]}}, v{{\[}}[[KLO]]:[[KHI]]{{\]}}, off{{$}}
|
2017-03-22 05:39:51 +08:00
|
|
|
define amdgpu_kernel void @global_atomic_dec_noret_i64(i64 addrspace(1)* %ptr) nounwind {
|
2017-03-31 06:21:40 +08:00
|
|
|
%result = call i64 @llvm.amdgcn.atomic.dec.i64.p1i64(i64 addrspace(1)* %ptr, i64 42, i32 0, i32 0, i1 false)
|
2016-04-12 22:05:04 +08:00
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2017-11-13 07:40:12 +08:00
|
|
|
; GCN-LABEL: {{^}}global_atomic_dec_noret_i64_offset:
|
2016-04-12 22:05:04 +08:00
|
|
|
; GCN-DAG: v_mov_b32_e32 v[[KLO:[0-9]+]], 42
|
|
|
|
; GCN-DAG: v_mov_b32_e32 v[[KHI:[0-9]+]], 0{{$}}
|
2017-11-13 07:40:12 +08:00
|
|
|
; CIVI: buffer_atomic_dec_x2 v{{\[}}[[KLO]]:[[KHI]]{{\]}}, off, s{{\[[0-9]+:[0-9]+\]}}, 0 offset:32{{$}}
|
|
|
|
; GFX9: global_atomic_dec_x2 v{{\[[0-9]+:[0-9]+\]}}, v{{\[}}[[KLO]]:[[KHI]]{{\]}}, off offset:32{{$}}
|
2017-03-22 05:39:51 +08:00
|
|
|
define amdgpu_kernel void @global_atomic_dec_noret_i64_offset(i64 addrspace(1)* %ptr) nounwind {
|
2016-04-12 22:05:04 +08:00
|
|
|
%gep = getelementptr i64, i64 addrspace(1)* %ptr, i32 4
|
2017-03-31 06:21:40 +08:00
|
|
|
%result = call i64 @llvm.amdgcn.atomic.dec.i64.p1i64(i64 addrspace(1)* %gep, i64 42, i32 0, i32 0, i1 false)
|
2016-04-12 22:05:04 +08:00
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
; GCN-LABEL: {{^}}global_atomic_dec_ret_i64_offset_addr64:
|
2017-04-13 04:48:56 +08:00
|
|
|
; GCN: v_mov_b32_e32 v[[KLO:[0-9]+]], 42
|
2017-05-23 00:58:10 +08:00
|
|
|
; CI: v_mov_b32_e32 v{{[0-9]+}}, 0{{$}}
|
2017-04-13 04:48:56 +08:00
|
|
|
; GCN: v_mov_b32_e32 v[[KHI:[0-9]+]], 0{{$}}
|
2016-04-12 22:05:04 +08:00
|
|
|
; CI: buffer_atomic_dec_x2 v{{\[}}[[KLO]]:[[KHI]]{{\]}}, v{{\[[0-9]+:[0-9]+\]}}, s{{\[[0-9]+:[0-9]+\]}}, 0 addr64 offset:40 glc{{$}}
|
|
|
|
; VI: flat_atomic_dec_x2 v{{\[[0-9]+:[0-9]+\]}}, v{{\[[0-9]+:[0-9]+\]}}, v{{\[}}[[KLO]]:[[KHI]]{{\]}} glc{{$}}
|
2017-03-22 05:39:51 +08:00
|
|
|
define amdgpu_kernel void @global_atomic_dec_ret_i64_offset_addr64(i64 addrspace(1)* %out, i64 addrspace(1)* %ptr) #0 {
|
2016-04-12 22:05:04 +08:00
|
|
|
%id = call i32 @llvm.amdgcn.workitem.id.x()
|
|
|
|
%gep.tid = getelementptr i64, i64 addrspace(1)* %ptr, i32 %id
|
|
|
|
%out.gep = getelementptr i64, i64 addrspace(1)* %out, i32 %id
|
|
|
|
%gep = getelementptr i64, i64 addrspace(1)* %gep.tid, i32 5
|
2017-03-31 06:21:40 +08:00
|
|
|
%result = call i64 @llvm.amdgcn.atomic.dec.i64.p1i64(i64 addrspace(1)* %gep, i64 42, i32 0, i32 0, i1 false)
|
2016-04-12 22:05:04 +08:00
|
|
|
store i64 %result, i64 addrspace(1)* %out.gep
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
; GCN-LABEL: {{^}}global_atomic_dec_noret_i64_offset_addr64:
|
2017-04-13 04:48:56 +08:00
|
|
|
; GCN: v_mov_b32_e32 v[[KLO:[0-9]+]], 42
|
2017-05-23 00:58:10 +08:00
|
|
|
; CI: v_mov_b32_e32 v{{[0-9]+}}, 0{{$}}
|
2017-04-13 04:48:56 +08:00
|
|
|
; GCN: v_mov_b32_e32 v[[KHI:[0-9]+]], 0{{$}}
|
2016-04-12 22:05:04 +08:00
|
|
|
; CI: buffer_atomic_dec_x2 v{{\[}}[[KLO]]:[[KHI]]{{\]}}, v{{\[[0-9]+:[0-9]+\]}}, s{{\[[0-9]+:[0-9]+\]}}, 0 addr64 offset:40{{$}}
|
|
|
|
; VI: flat_atomic_dec_x2 v{{\[[0-9]+:[0-9]+\]}}, v{{\[}}[[KLO]]:[[KHI]]{{\]}}{{$}}
|
2017-03-22 05:39:51 +08:00
|
|
|
define amdgpu_kernel void @global_atomic_dec_noret_i64_offset_addr64(i64 addrspace(1)* %ptr) #0 {
|
2016-04-12 22:05:04 +08:00
|
|
|
%id = call i32 @llvm.amdgcn.workitem.id.x()
|
|
|
|
%gep.tid = getelementptr i64, i64 addrspace(1)* %ptr, i32 %id
|
|
|
|
%gep = getelementptr i64, i64 addrspace(1)* %gep.tid, i32 5
|
2017-03-31 06:21:40 +08:00
|
|
|
%result = call i64 @llvm.amdgcn.atomic.dec.i64.p1i64(i64 addrspace(1)* %gep, i64 42, i32 0, i32 0, i1 false)
|
2016-04-12 22:05:04 +08:00
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
@lds1 = addrspace(3) global [512 x i64] undef, align 8
|
|
|
|
|
|
|
|
; GCN-LABEL: {{^}}atomic_dec_shl_base_lds_0_i64:
|
2017-11-29 08:55:57 +08:00
|
|
|
; CIVI-DAG: s_mov_b32 m0
|
|
|
|
; GFX9-NOT: m0
|
|
|
|
|
AMDGPU: Write LDS objects out as global symbols in code generation
Summary:
The symbols use the processor-specific SHN_AMDGPU_LDS section index
introduced with a previous change. The linker is then expected to resolve
relocations, which are also emitted.
Initially disabled for HSA and PAL environments until they have caught up
in terms of linker and runtime loader.
Some notes:
- The llvm.amdgcn.groupstaticsize intrinsics can no longer be lowered
to a constant at compile times, which means some tests can no longer
be applied.
The current "solution" is a terrible hack, but the intrinsic isn't
used by Mesa, so we can keep it for now.
- We no longer know the full LDS size per kernel at compile time, which
means that we can no longer generate a relevant error message at
compile time. It would be possible to add a check for the size of
individual variables, but ultimately the linker will have to perform
the final check.
Change-Id: If66dbf33fccfbf3609aefefa2558ac0850d42275
Reviewers: arsenm, rampitec, t-tye, b-sumner, jsjodin
Subscribers: qcolombet, kzhuravl, jvesely, wdng, yaxunl, dstuttard, tpr, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D61494
llvm-svn: 364297
2019-06-25 19:52:30 +08:00
|
|
|
; CIVI-DAG: v_lshlrev_b32_e32 [[OFS:v[0-9]+]], 3, {{v[0-9]+}}
|
|
|
|
; CIVI-DAG: v_add_{{[ui]}}32_e32 [[PTR:v[0-9]+]], vcc, lds1@abs32@lo, [[OFS]]
|
|
|
|
; GFX9-DAG: v_mov_b32_e32 [[BASE:v[0-9]+]], lds1@abs32@lo
|
|
|
|
; GFX9-DAG: v_lshl_add_u32 [[PTR:v[0-9]+]], {{v[0-9]+}}, 3, [[BASE]]
|
|
|
|
|
2016-04-12 22:05:04 +08:00
|
|
|
; GCN: ds_dec_rtn_u64 v{{\[[0-9]+:[0-9]+\]}}, [[PTR]], v{{\[[0-9]+:[0-9]+\]}} offset:16
|
2017-03-22 05:39:51 +08:00
|
|
|
define amdgpu_kernel void @atomic_dec_shl_base_lds_0_i64(i64 addrspace(1)* %out, i32 addrspace(1)* %add_use) #0 {
|
2016-04-12 22:05:04 +08:00
|
|
|
%tid.x = tail call i32 @llvm.amdgcn.workitem.id.x() #1
|
|
|
|
%idx.0 = add nsw i32 %tid.x, 2
|
|
|
|
%arrayidx0 = getelementptr inbounds [512 x i64], [512 x i64] addrspace(3)* @lds1, i32 0, i32 %idx.0
|
2017-03-31 06:21:40 +08:00
|
|
|
%val0 = call i64 @llvm.amdgcn.atomic.dec.i64.p3i64(i64 addrspace(3)* %arrayidx0, i64 9, i32 0, i32 0, i1 false)
|
2016-04-12 22:05:04 +08:00
|
|
|
store i32 %idx.0, i32 addrspace(1)* %add_use
|
|
|
|
store i64 %val0, i64 addrspace(1)* %out
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
attributes #0 = { nounwind }
|
|
|
|
attributes #1 = { nounwind readnone }
|
|
|
|
attributes #2 = { nounwind argmemonly }
|