2016-02-11 07:02:01 +01:00
|
|
|
; RUN: llc -march=amdgcn -verify-machineinstrs < %s | FileCheck -check-prefix=GCN -check-prefix=SI -check-prefix=FUNC %s
|
2017-01-24 23:02:15 +01:00
|
|
|
; RUN: llc -march=amdgcn -mcpu=tonga -mattr=-flat-for-global -verify-machineinstrs < %s | FileCheck -check-prefix=GCN -check-prefix=VI -check-prefix=FUNC %s
|
2016-01-11 23:01:48 +01:00
|
|
|
|
|
|
|
; FIXME: This should be merged with sint_to_fp.ll, but s_sint_to_fp_v2i64 crashes on r600
|
|
|
|
|
2016-11-13 08:01:11 +01:00
|
|
|
; FUNC-LABEL: {{^}}s_sint_to_fp_i64_to_f16:
|
2017-03-21 22:39:51 +01:00
|
|
|
define amdgpu_kernel void @s_sint_to_fp_i64_to_f16(half addrspace(1)* %out, i64 %in) #0 {
|
2016-11-13 08:01:11 +01:00
|
|
|
%result = sitofp i64 %in to half
|
|
|
|
store half %result, half addrspace(1)* %out
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
; FUNC-LABEL: {{^}}v_sint_to_fp_i64_to_f16:
|
|
|
|
; GCN: {{buffer|flat}}_load_dwordx2
|
|
|
|
|
|
|
|
; GCN: v_ashrrev_i32_e32 v{{[0-9]+}}, 31, v{{[0-9]+}}
|
|
|
|
; GCN: v_xor_b32
|
|
|
|
|
|
|
|
; GCN: v_ffbh_u32
|
|
|
|
; GCN: v_ffbh_u32
|
|
|
|
; GCN: v_cndmask
|
|
|
|
; GCN: v_cndmask
|
|
|
|
|
|
|
|
; GCN-DAG: v_cmp_eq_u64
|
2017-06-20 20:32:42 +02:00
|
|
|
; GCN-DAG: v_cmp_gt_u64
|
2016-11-13 08:01:11 +01:00
|
|
|
|
|
|
|
; GCN: v_xor_b32_e32 v{{[0-9]+}}, 0x80000000, v{{[0-9]+}}
|
|
|
|
; GCN: v_cndmask_b32_e{{32|64}} [[SIGN_SEL:v[0-9]+]],
|
|
|
|
; GCN: v_cvt_f16_f32_e32 [[SIGN_SEL_F16:v[0-9]+]], [[SIGN_SEL]]
|
|
|
|
; GCN: {{buffer|flat}}_store_short {{.*}}[[SIGN_SEL_F16]]
|
2017-03-21 22:39:51 +01:00
|
|
|
define amdgpu_kernel void @v_sint_to_fp_i64_to_f16(half addrspace(1)* %out, i64 addrspace(1)* %in) #0 {
|
2016-11-13 08:01:11 +01:00
|
|
|
%tid = call i32 @llvm.amdgcn.workitem.id.x()
|
|
|
|
%in.gep = getelementptr i64, i64 addrspace(1)* %in, i32 %tid
|
|
|
|
%out.gep = getelementptr half, half addrspace(1)* %out, i32 %tid
|
|
|
|
%val = load i64, i64 addrspace(1)* %in.gep
|
|
|
|
%result = sitofp i64 %val to half
|
|
|
|
store half %result, half addrspace(1)* %out.gep
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2016-01-11 23:01:48 +01:00
|
|
|
; FUNC-LABEL: {{^}}s_sint_to_fp_i64_to_f32:
|
2017-03-21 22:39:51 +01:00
|
|
|
define amdgpu_kernel void @s_sint_to_fp_i64_to_f32(float addrspace(1)* %out, i64 %in) #0 {
|
2016-01-11 23:01:48 +01:00
|
|
|
%result = sitofp i64 %in to float
|
|
|
|
store float %result, float addrspace(1)* %out
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
; FUNC-LABEL: {{^}}v_sint_to_fp_i64_to_f32:
|
|
|
|
; GCN: {{buffer|flat}}_load_dwordx2
|
|
|
|
|
2016-01-18 23:09:04 +01:00
|
|
|
; GCN: v_ashrrev_i32_e32 v{{[0-9]+}}, 31, v{{[0-9]+}}
|
2016-01-11 23:01:48 +01:00
|
|
|
; GCN: v_xor_b32
|
|
|
|
|
|
|
|
; GCN: v_ffbh_u32
|
|
|
|
; GCN: v_ffbh_u32
|
|
|
|
; GCN: v_cndmask
|
|
|
|
; GCN: v_cndmask
|
|
|
|
|
2016-09-30 03:50:20 +02:00
|
|
|
; GCN-DAG: v_cmp_eq_u64
|
2017-06-20 20:32:42 +02:00
|
|
|
; GCN-DAG: v_cmp_gt_u64
|
2016-01-11 23:01:48 +01:00
|
|
|
|
|
|
|
; GCN: v_xor_b32_e32 v{{[0-9]+}}, 0x80000000, v{{[0-9]+}}
|
2016-06-06 17:23:43 +02:00
|
|
|
; GCN: v_cndmask_b32_e{{32|64}} [[SIGN_SEL:v[0-9]+]],
|
2016-02-12 18:57:54 +01:00
|
|
|
; GCN: {{buffer|flat}}_store_dword {{.*}}[[SIGN_SEL]]
|
2017-03-21 22:39:51 +01:00
|
|
|
define amdgpu_kernel void @v_sint_to_fp_i64_to_f32(float addrspace(1)* %out, i64 addrspace(1)* %in) #0 {
|
2016-02-11 07:02:01 +01:00
|
|
|
%tid = call i32 @llvm.amdgcn.workitem.id.x()
|
2016-01-11 23:01:48 +01:00
|
|
|
%in.gep = getelementptr i64, i64 addrspace(1)* %in, i32 %tid
|
|
|
|
%out.gep = getelementptr float, float addrspace(1)* %out, i32 %tid
|
|
|
|
%val = load i64, i64 addrspace(1)* %in.gep
|
|
|
|
%result = sitofp i64 %val to float
|
|
|
|
store float %result, float addrspace(1)* %out.gep
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2016-11-13 08:01:11 +01:00
|
|
|
; FUNC-LABEL: {{^}}s_sint_to_fp_v2i64_to_v2f32:
|
2016-09-14 17:19:03 +02:00
|
|
|
; GCN-NOT: v_and_b32_e32 v{{[0-9]+}}, -1,
|
2017-03-21 22:39:51 +01:00
|
|
|
define amdgpu_kernel void @s_sint_to_fp_v2i64_to_v2f32(<2 x float> addrspace(1)* %out, <2 x i64> %in) #0{
|
2016-01-11 23:01:48 +01:00
|
|
|
%result = sitofp <2 x i64> %in to <2 x float>
|
|
|
|
store <2 x float> %result, <2 x float> addrspace(1)* %out
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2016-11-13 08:01:11 +01:00
|
|
|
; FUNC-LABEL: {{^}}v_sint_to_fp_v4i64_to_v4f32:
|
2017-03-21 22:39:51 +01:00
|
|
|
define amdgpu_kernel void @v_sint_to_fp_v4i64_to_v4f32(<4 x float> addrspace(1)* %out, <4 x i64> addrspace(1)* %in) #0 {
|
2016-02-11 07:02:01 +01:00
|
|
|
%tid = call i32 @llvm.amdgcn.workitem.id.x()
|
2016-01-11 23:01:48 +01:00
|
|
|
%in.gep = getelementptr <4 x i64>, <4 x i64> addrspace(1)* %in, i32 %tid
|
|
|
|
%out.gep = getelementptr <4 x float>, <4 x float> addrspace(1)* %out, i32 %tid
|
|
|
|
%value = load <4 x i64>, <4 x i64> addrspace(1)* %in.gep
|
|
|
|
%result = sitofp <4 x i64> %value to <4 x float>
|
|
|
|
store <4 x float> %result, <4 x float> addrspace(1)* %out.gep
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2016-11-13 08:01:11 +01:00
|
|
|
; FUNC-LABEL: {{^}}s_sint_to_fp_v2i64_to_v2f16:
|
|
|
|
; GCN-NOT: v_and_b32_e32 v{{[0-9]+}}, -1,
|
2017-03-21 22:39:51 +01:00
|
|
|
define amdgpu_kernel void @s_sint_to_fp_v2i64_to_v2f16(<2 x half> addrspace(1)* %out, <2 x i64> %in) #0{
|
2016-11-13 08:01:11 +01:00
|
|
|
%result = sitofp <2 x i64> %in to <2 x half>
|
|
|
|
store <2 x half> %result, <2 x half> addrspace(1)* %out
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
; FUNC-LABEL: {{^}}v_sint_to_fp_v4i64_to_v4f16:
|
2017-03-21 22:39:51 +01:00
|
|
|
define amdgpu_kernel void @v_sint_to_fp_v4i64_to_v4f16(<4 x half> addrspace(1)* %out, <4 x i64> addrspace(1)* %in) #0 {
|
2016-11-13 08:01:11 +01:00
|
|
|
%tid = call i32 @llvm.amdgcn.workitem.id.x()
|
|
|
|
%in.gep = getelementptr <4 x i64>, <4 x i64> addrspace(1)* %in, i32 %tid
|
|
|
|
%out.gep = getelementptr <4 x half>, <4 x half> addrspace(1)* %out, i32 %tid
|
|
|
|
%value = load <4 x i64>, <4 x i64> addrspace(1)* %in.gep
|
|
|
|
%result = sitofp <4 x i64> %value to <4 x half>
|
|
|
|
store <4 x half> %result, <4 x half> addrspace(1)* %out.gep
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2016-02-11 07:02:01 +01:00
|
|
|
declare i32 @llvm.amdgcn.workitem.id.x() #1
|
2016-01-11 23:01:48 +01:00
|
|
|
|
|
|
|
attributes #0 = { nounwind }
|
|
|
|
attributes #1 = { nounwind readnone }
|