Home | History | Annotate | Download | only in AMDGPU
      1 ; RUN: llc -march=amdgcn -mcpu=SI -verify-machineinstrs < %s | FileCheck -check-prefix=GCN -check-prefix=SI -check-prefix=FUNC %s
      2 ; RUN: llc -march=amdgcn -mcpu=tonga -verify-machineinstrs < %s | FileCheck -check-prefix=GCN -check-prefix=VI -check-prefix=FUNC %s
      3 
      4 ; FIXME: This should be merged with uint_to_fp.ll, but s_uint_to_fp_v2i64 crashes on r600
      5 
      6 ; FUNC-LABEL: {{^}}s_uint_to_fp_i64_to_f32:
      7 define void @s_uint_to_fp_i64_to_f32(float addrspace(1)* %out, i64 %in) #0 {
      8   %result = uitofp i64 %in to float
      9   store float %result, float addrspace(1)* %out
     10   ret void
     11 }
     12 
     13 ; FUNC-LABEL: {{^}}v_uint_to_fp_i64_to_f32:
     14 ; GCN: {{buffer|flat}}_load_dwordx2
     15 
     16 ; GCN: v_ffbh_u32
     17 ; GCN: v_ffbh_u32
     18 ; GCN: v_cndmask
     19 ; GCN: v_cndmask
     20 
     21 ; GCN-DAG: v_cmp_eq_i64
     22 ; GCN-DAG: v_cmp_lt_u64
     23 
     24 ; GCN: v_add_i32_e32 [[VR:v[0-9]+]]
     25 ; GCN: {{buffer|flat}}_store_dword {{.*}}[[VR]]
     26 define void @v_uint_to_fp_i64_to_f32(float addrspace(1)* %out, i64 addrspace(1)* %in) #0 {
     27   %tid = call i32 @llvm.r600.read.tidig.x()
     28   %in.gep = getelementptr i64, i64 addrspace(1)* %in, i32 %tid
     29   %out.gep = getelementptr float, float addrspace(1)* %out, i32 %tid
     30   %val = load i64, i64 addrspace(1)* %in.gep
     31   %result = uitofp i64 %val to float
     32   store float %result, float addrspace(1)* %out.gep
     33   ret void
     34 }
     35 
     36 ; FUNC-LABEL: {{^}}s_uint_to_fp_v2i64:
     37 define void @s_uint_to_fp_v2i64(<2 x float> addrspace(1)* %out, <2 x i64> %in) #0{
     38   %result = uitofp <2 x i64> %in to <2 x float>
     39   store <2 x float> %result, <2 x float> addrspace(1)* %out
     40   ret void
     41 }
     42 
     43 ; FUNC-LABEL: {{^}}v_uint_to_fp_v4i64:
     44 define void @v_uint_to_fp_v4i64(<4 x float> addrspace(1)* %out, <4 x i64> addrspace(1)* %in) #0 {
     45   %tid = call i32 @llvm.r600.read.tidig.x()
     46   %in.gep = getelementptr <4 x i64>, <4 x i64> addrspace(1)* %in, i32 %tid
     47   %out.gep = getelementptr <4 x float>, <4 x float> addrspace(1)* %out, i32 %tid
     48   %value = load <4 x i64>, <4 x i64> addrspace(1)* %in.gep
     49   %result = uitofp <4 x i64> %value to <4 x float>
     50   store <4 x float> %result, <4 x float> addrspace(1)* %out.gep
     51   ret void
     52 }
     53 
     54 declare i32 @llvm.r600.read.tidig.x() #1
     55 
     56 attributes #0 = { nounwind }
     57 attributes #1 = { nounwind readnone }
     58