1 ; RUN: llc -march=r600 -mcpu=SI -verify-machineinstrs < %s | FileCheck -check-prefix=SI %s
3 declare i32 @llvm.r600.read.tidig.x() nounwind readnone
5 ; SI-LABEL: {{^}}sint_to_fp_i32_to_f64
6 ; SI: V_CVT_F64_I32_e32
7 define void @sint_to_fp_i32_to_f64(double addrspace(1)* %out, i32 %in) {
8 %result = sitofp i32 %in to double
9 store double %result, double addrspace(1)* %out
13 ; SI-LABEL: {{^}}sint_to_fp_i1_f64:
14 ; SI: V_CMP_EQ_I32_e64 [[CMP:s\[[0-9]+:[0-9]\]]],
15 ; FIXME: We should the VGPR sources for V_CNDMASK are copied from SGPRs,
16 ; we should be able to fold the SGPRs into the V_CNDMASK instructions.
17 ; SI: V_CNDMASK_B32_e64 v{{[0-9]+}}, v{{[0-9]+}}, v{{[0-9]+}}, [[CMP]]
18 ; SI: V_CNDMASK_B32_e64 v{{[0-9]+}}, v{{[0-9]+}}, v{{[0-9]+}}, [[CMP]]
19 ; SI: BUFFER_STORE_DWORDX2
21 define void @sint_to_fp_i1_f64(double addrspace(1)* %out, i32 %in) {
22 %cmp = icmp eq i32 %in, 0
23 %fp = sitofp i1 %cmp to double
24 store double %fp, double addrspace(1)* %out, align 4
28 ; SI-LABEL: {{^}}sint_to_fp_i1_f64_load:
29 ; SI: V_CNDMASK_B32_e64 [[IRESULT:v[0-9]]], 0, -1
30 ; SI-NEXT: V_CVT_F64_I32_e32 [[RESULT:v\[[0-9]+:[0-9]\]]], [[IRESULT]]
31 ; SI: BUFFER_STORE_DWORDX2 [[RESULT]]
33 define void @sint_to_fp_i1_f64_load(double addrspace(1)* %out, i1 %in) {
34 %fp = sitofp i1 %in to double
35 store double %fp, double addrspace(1)* %out, align 8
39 ; SI-LABEL: @s_sint_to_fp_i64_to_f64
40 define void @s_sint_to_fp_i64_to_f64(double addrspace(1)* %out, i64 %in) {
41 %result = sitofp i64 %in to double
42 store double %result, double addrspace(1)* %out
46 ; SI-LABEL: @v_sint_to_fp_i64_to_f64
47 ; SI: BUFFER_LOAD_DWORDX2 v{{\[}}[[LO:[0-9]+]]:[[HI:[0-9]+]]{{\]}}
48 ; SI-DAG: V_CVT_F64_U32_e32 [[LO_CONV:v\[[0-9]+:[0-9]+\]]], v[[LO]]
49 ; SI-DAG: V_CVT_F64_I32_e32 [[HI_CONV:v\[[0-9]+:[0-9]+\]]], v[[HI]]
50 ; SI: V_LDEXP_F64 [[LDEXP:v\[[0-9]+:[0-9]+\]]], [[HI_CONV]], 32
51 ; SI: V_ADD_F64 [[RESULT:v\[[0-9]+:[0-9]+\]]], [[LDEXP]], [[LO_CONV]]
52 ; SI: BUFFER_STORE_DWORDX2 [[RESULT]]
53 define void @v_sint_to_fp_i64_to_f64(double addrspace(1)* %out, i64 addrspace(1)* %in) {
54 %tid = call i32 @llvm.r600.read.tidig.x() nounwind readnone
55 %gep = getelementptr i64 addrspace(1)* %in, i32 %tid
56 %val = load i64 addrspace(1)* %gep, align 8
57 %result = sitofp i64 %val to double
58 store double %result, double addrspace(1)* %out