2021-01-06 11:24:37 +08:00
|
|
|
; RUN: llc -march=amdgcn -mattr=-promote-alloca,+max-private-element-size-16 -verify-machineinstrs < %s | FileCheck --check-prefixes=SI-ALLOCA16,SI %s
|
|
|
|
; RUN: llc -march=amdgcn -mattr=-promote-alloca,+max-private-element-size-4 -verify-machineinstrs < %s | FileCheck --check-prefixes=SI-ALLOCA4,SI %s
|
|
|
|
; RUN: llc -march=amdgcn -mattr=+promote-alloca -disable-promote-alloca-to-vector -verify-machineinstrs < %s | FileCheck --check-prefixes=SI-PROMOTE,SI %s
|
|
|
|
; RUN: llc -march=amdgcn -mcpu=tonga -mattr=-flat-for-global -mattr=-promote-alloca,+max-private-element-size-16 -verify-machineinstrs < %s | FileCheck -check-prefix=SI %s
|
|
|
|
; RUN: llc -march=amdgcn -mcpu=tonga -mattr=-flat-for-global -mattr=+promote-alloca -disable-promote-alloca-to-vector -verify-machineinstrs < %s | FileCheck --check-prefixes=CI-PROMOTE,SI %s
|
2014-07-13 10:46:17 +08:00
|
|
|
|
2016-05-17 05:19:59 +08:00
|
|
|
declare void @llvm.amdgcn.s.barrier() #0
|
2014-02-02 08:13:12 +08:00
|
|
|
|
2014-10-02 01:15:17 +08:00
|
|
|
; SI-LABEL: {{^}}private_access_f64_alloca:
|
2014-07-13 10:46:17 +08:00
|
|
|
|
2016-05-11 08:28:54 +08:00
|
|
|
; SI-ALLOCA16: buffer_store_dwordx2
|
|
|
|
; SI-ALLOCA16: buffer_load_dwordx2
|
|
|
|
|
|
|
|
; SI-ALLOCA4: buffer_store_dword v
|
|
|
|
; SI-ALLOCA4: buffer_store_dword v
|
|
|
|
; SI-ALLOCA4: buffer_load_dword v
|
|
|
|
; SI-ALLOCA4: buffer_load_dword v
|
2014-07-13 10:46:17 +08:00
|
|
|
|
2014-11-05 22:50:53 +08:00
|
|
|
; SI-PROMOTE: ds_write_b64
|
|
|
|
; SI-PROMOTE: ds_read_b64
|
2016-05-27 03:35:29 +08:00
|
|
|
; CI-PROMOTE: ds_write_b64
|
|
|
|
; CI-PROMOTE: ds_read_b64
|
2017-03-22 05:39:51 +08:00
|
|
|
define amdgpu_kernel void @private_access_f64_alloca(double addrspace(1)* noalias %out, double addrspace(1)* noalias %in, i32 %b) #1 {
|
2015-02-28 05:17:42 +08:00
|
|
|
%val = load double, double addrspace(1)* %in, align 8
|
2018-02-03 00:07:16 +08:00
|
|
|
%array = alloca [8 x double], align 8, addrspace(5)
|
|
|
|
%ptr = getelementptr inbounds [8 x double], [8 x double] addrspace(5)* %array, i32 0, i32 %b
|
|
|
|
store double %val, double addrspace(5)* %ptr, align 8
|
2016-02-11 14:02:01 +08:00
|
|
|
call void @llvm.amdgcn.s.barrier()
|
2018-02-03 00:07:16 +08:00
|
|
|
%result = load double, double addrspace(5)* %ptr, align 8
|
2014-02-02 08:13:12 +08:00
|
|
|
store double %result, double addrspace(1)* %out, align 8
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2014-10-02 01:15:17 +08:00
|
|
|
; SI-LABEL: {{^}}private_access_v2f64_alloca:
|
2014-07-13 10:46:17 +08:00
|
|
|
|
2016-05-11 08:28:54 +08:00
|
|
|
; SI-ALLOCA16: buffer_store_dwordx4
|
|
|
|
; SI-ALLOCA16: buffer_load_dwordx4
|
|
|
|
|
|
|
|
; SI-ALLOCA4: buffer_store_dword v
|
|
|
|
; SI-ALLOCA4: buffer_store_dword v
|
|
|
|
; SI-ALLOCA4: buffer_store_dword v
|
|
|
|
; SI-ALLOCA4: buffer_store_dword v
|
|
|
|
; SI-ALLOCA4: buffer_load_dword v
|
|
|
|
; SI-ALLOCA4: buffer_load_dword v
|
|
|
|
; SI-ALLOCA4: buffer_load_dword v
|
|
|
|
; SI-ALLOCA4: buffer_load_dword v
|
2014-07-13 10:46:17 +08:00
|
|
|
|
2015-11-24 20:18:54 +08:00
|
|
|
; SI-PROMOTE: ds_write_b64
|
|
|
|
; SI-PROMOTE: ds_write_b64
|
|
|
|
; SI-PROMOTE: ds_read_b64
|
|
|
|
; SI-PROMOTE: ds_read_b64
|
2020-04-02 04:46:10 +08:00
|
|
|
; CI-PROMOTE: ds_write_b128
|
|
|
|
; CI-PROMOTE: ds_read_b128
|
2017-03-22 05:39:51 +08:00
|
|
|
define amdgpu_kernel void @private_access_v2f64_alloca(<2 x double> addrspace(1)* noalias %out, <2 x double> addrspace(1)* noalias %in, i32 %b) #1 {
|
2015-02-28 05:17:42 +08:00
|
|
|
%val = load <2 x double>, <2 x double> addrspace(1)* %in, align 16
|
2018-02-03 00:07:16 +08:00
|
|
|
%array = alloca [4 x <2 x double>], align 16, addrspace(5)
|
|
|
|
%ptr = getelementptr inbounds [4 x <2 x double>], [4 x <2 x double>] addrspace(5)* %array, i32 0, i32 %b
|
|
|
|
store <2 x double> %val, <2 x double> addrspace(5)* %ptr, align 16
|
2016-02-11 14:02:01 +08:00
|
|
|
call void @llvm.amdgcn.s.barrier()
|
2018-02-03 00:07:16 +08:00
|
|
|
%result = load <2 x double>, <2 x double> addrspace(5)* %ptr, align 16
|
2014-02-02 08:13:12 +08:00
|
|
|
store <2 x double> %result, <2 x double> addrspace(1)* %out, align 16
|
|
|
|
ret void
|
|
|
|
}
|
2014-03-25 01:50:46 +08:00
|
|
|
|
2014-10-02 01:15:17 +08:00
|
|
|
; SI-LABEL: {{^}}private_access_i64_alloca:
|
2014-07-13 10:46:17 +08:00
|
|
|
|
2016-05-11 08:28:54 +08:00
|
|
|
; SI-ALLOCA16: buffer_store_dwordx2
|
|
|
|
; SI-ALLOCA16: buffer_load_dwordx2
|
|
|
|
|
|
|
|
; SI-ALLOCA4: buffer_store_dword v
|
|
|
|
; SI-ALLOCA4: buffer_store_dword v
|
|
|
|
; SI-ALLOCA4: buffer_load_dword v
|
|
|
|
; SI-ALLOCA4: buffer_load_dword v
|
|
|
|
|
2014-07-13 10:46:17 +08:00
|
|
|
|
2014-11-05 22:50:53 +08:00
|
|
|
; SI-PROMOTE: ds_write_b64
|
|
|
|
; SI-PROMOTE: ds_read_b64
|
2016-05-27 03:35:29 +08:00
|
|
|
; CI-PROMOTE: ds_write_b64
|
|
|
|
; CI-PROMOTE: ds_read_b64
|
2017-03-22 05:39:51 +08:00
|
|
|
define amdgpu_kernel void @private_access_i64_alloca(i64 addrspace(1)* noalias %out, i64 addrspace(1)* noalias %in, i32 %b) #1 {
|
2015-02-28 05:17:42 +08:00
|
|
|
%val = load i64, i64 addrspace(1)* %in, align 8
|
2018-02-03 00:07:16 +08:00
|
|
|
%array = alloca [8 x i64], align 8, addrspace(5)
|
|
|
|
%ptr = getelementptr inbounds [8 x i64], [8 x i64] addrspace(5)* %array, i32 0, i32 %b
|
|
|
|
store i64 %val, i64 addrspace(5)* %ptr, align 8
|
2016-02-11 14:02:01 +08:00
|
|
|
call void @llvm.amdgcn.s.barrier()
|
2018-02-03 00:07:16 +08:00
|
|
|
%result = load i64, i64 addrspace(5)* %ptr, align 8
|
2014-03-25 01:50:46 +08:00
|
|
|
store i64 %result, i64 addrspace(1)* %out, align 8
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2014-10-02 01:15:17 +08:00
|
|
|
; SI-LABEL: {{^}}private_access_v2i64_alloca:
|
2014-07-13 10:46:17 +08:00
|
|
|
|
2016-05-11 08:28:54 +08:00
|
|
|
; SI-ALLOCA16: buffer_store_dwordx4
|
|
|
|
; SI-ALLOCA16: buffer_load_dwordx4
|
|
|
|
|
|
|
|
; SI-ALLOCA4: buffer_store_dword v
|
|
|
|
; SI-ALLOCA4: buffer_store_dword v
|
|
|
|
; SI-ALLOCA4: buffer_store_dword v
|
|
|
|
; SI-ALLOCA4: buffer_store_dword v
|
|
|
|
|
|
|
|
; SI-ALLOCA4: buffer_load_dword v
|
|
|
|
; SI-ALLOCA4: buffer_load_dword v
|
|
|
|
; SI-ALLOCA4: buffer_load_dword v
|
|
|
|
; SI-ALLOCA4: buffer_load_dword v
|
2014-07-13 10:46:17 +08:00
|
|
|
|
2015-11-24 20:18:54 +08:00
|
|
|
; SI-PROMOTE: ds_write_b64
|
|
|
|
; SI-PROMOTE: ds_write_b64
|
|
|
|
; SI-PROMOTE: ds_read_b64
|
|
|
|
; SI-PROMOTE: ds_read_b64
|
2020-04-02 04:46:10 +08:00
|
|
|
; CI-PROMOTE: ds_write_b128
|
|
|
|
; CI-PROMOTE: ds_read_b128
|
2017-03-22 05:39:51 +08:00
|
|
|
define amdgpu_kernel void @private_access_v2i64_alloca(<2 x i64> addrspace(1)* noalias %out, <2 x i64> addrspace(1)* noalias %in, i32 %b) #1 {
|
2015-02-28 05:17:42 +08:00
|
|
|
%val = load <2 x i64>, <2 x i64> addrspace(1)* %in, align 16
|
2018-02-03 00:07:16 +08:00
|
|
|
%array = alloca [4 x <2 x i64>], align 16, addrspace(5)
|
|
|
|
%ptr = getelementptr inbounds [4 x <2 x i64>], [4 x <2 x i64>] addrspace(5)* %array, i32 0, i32 %b
|
|
|
|
store <2 x i64> %val, <2 x i64> addrspace(5)* %ptr, align 16
|
2016-02-11 14:02:01 +08:00
|
|
|
call void @llvm.amdgcn.s.barrier()
|
2018-02-03 00:07:16 +08:00
|
|
|
%result = load <2 x i64>, <2 x i64> addrspace(5)* %ptr, align 16
|
2014-03-25 01:50:46 +08:00
|
|
|
store <2 x i64> %result, <2 x i64> addrspace(1)* %out, align 16
|
|
|
|
ret void
|
|
|
|
}
|
2016-02-11 14:02:01 +08:00
|
|
|
|
2016-05-17 05:19:59 +08:00
|
|
|
attributes #0 = { convergent nounwind }
|
2017-04-07 00:48:30 +08:00
|
|
|
attributes #1 = { nounwind "amdgpu-waves-per-eu"="1,2" "amdgpu-flat-work-group-size"="64,128" }
|