R600: Custom lower f32 = uint_to_fp i64
[oota-llvm.git] / test / CodeGen / R600 / uint_to_fp.ll
1 ; RUN: llc < %s -march=r600 -mcpu=redwood | FileCheck %s --check-prefix=R600-CHECK
2 ; RUN: llc < %s -march=r600 -mcpu=SI -verify-machineinstrs | FileCheck %s --check-prefix=SI-CHECK
3
4 ; R600-CHECK-LABEL: @uint_to_fp_v2i32
5 ; R600-CHECK-DAG: UINT_TO_FLT * T{{[0-9]+\.[XYZW]}}, KC0[2].W
6 ; R600-CHECK-DAG: UINT_TO_FLT * T{{[0-9]+\.[XYZW]}}, KC0[3].X
7 ; SI-CHECK-LABEL: @uint_to_fp_v2i32
8 ; SI-CHECK: V_CVT_F32_U32_e32
9 ; SI-CHECK: V_CVT_F32_U32_e32
10 define void @uint_to_fp_v2i32(<2 x float> addrspace(1)* %out, <2 x i32> %in) {
11   %result = uitofp <2 x i32> %in to <2 x float>
12   store <2 x float> %result, <2 x float> addrspace(1)* %out
13   ret void
14 }
15
16 ; R600-CHECK-LABEL: @uint_to_fp_v4i32
17 ; R600-CHECK: UINT_TO_FLT * T{{[0-9]+\.[XYZW], T[0-9]+\.[XYZW]}}
18 ; R600-CHECK: UINT_TO_FLT * T{{[0-9]+\.[XYZW], T[0-9]+\.[XYZW]}}
19 ; R600-CHECK: UINT_TO_FLT * T{{[0-9]+\.[XYZW], T[0-9]+\.[XYZW]}}
20 ; R600-CHECK: UINT_TO_FLT * T{{[0-9]+\.[XYZW], T[0-9]+\.[XYZW]}}
21 ; SI-CHECK-LABEL: @uint_to_fp_v4i32
22 ; SI-CHECK: V_CVT_F32_U32_e32
23 ; SI-CHECK: V_CVT_F32_U32_e32
24 ; SI-CHECK: V_CVT_F32_U32_e32
25 ; SI-CHECK: V_CVT_F32_U32_e32
26 define void @uint_to_fp_v4i32(<4 x float> addrspace(1)* %out, <4 x i32> addrspace(1)* %in) {
27   %value = load <4 x i32> addrspace(1) * %in
28   %result = uitofp <4 x i32> %value to <4 x float>
29   store <4 x float> %result, <4 x float> addrspace(1)* %out
30   ret void
31 }
32
33 ; R600-CHECK-LABEL: @uint_to_fp_i64_f32
34 ; R600-CHECK: UINT_TO_FLT
35 ; R600-CHECK: UINT_TO_FLT
36 ; R600-CHECK: MULADD_IEEE
37 ; SI-CHECK-LABEL: @uint_to_fp_i64_f32
38 ; SI-CHECK: V_CVT_F32_U32_e32
39 ; SI-CHECK: V_CVT_F32_U32_e32
40 ; SI-CHECK: V_MAD_F32
41 define void @uint_to_fp_i64_f32(float addrspace(1)* %out, i64 %in) {
42 entry:
43   %0 = uitofp i64 %in to float
44   store float %0, float addrspace(1)* %out
45   ret void
46 }