Matt Arsenault | c3a73c3 | 2014-05-22 03:20:30 +0000 | [diff] [blame] | 1 | ; RUN: llc -march=r600 -mcpu=SI -verify-machineinstrs < %s | FileCheck -check-prefix=SI %s |
| 2 | |
Matt Arsenault | f7c95e3 | 2014-10-03 23:54:41 +0000 | [diff] [blame^] | 3 | declare i32 @llvm.r600.read.tidig.x() nounwind readnone |
| 4 | |
| 5 | ; SI-LABEL: {{$}}uint_to_fp_f64_i32 |
Matt Arsenault | c3a73c3 | 2014-05-22 03:20:30 +0000 | [diff] [blame] | 6 | ; SI: V_CVT_F64_U32_e32 |
Matt Arsenault | aeca2fa | 2014-05-31 06:47:42 +0000 | [diff] [blame] | 7 | ; SI: S_ENDPGM |
Matt Arsenault | c3a73c3 | 2014-05-22 03:20:30 +0000 | [diff] [blame] | 8 | define void @uint_to_fp_f64_i32(double addrspace(1)* %out, i32 %in) { |
| 9 | %cast = uitofp i32 %in to double |
| 10 | store double %cast, double addrspace(1)* %out, align 8 |
| 11 | ret void |
| 12 | } |
Matt Arsenault | aeca2fa | 2014-05-31 06:47:42 +0000 | [diff] [blame] | 13 | |
Tom Stellard | 79243d9 | 2014-10-01 17:15:17 +0000 | [diff] [blame] | 14 | ; SI-LABEL: {{^}}uint_to_fp_i1_f64: |
Matt Arsenault | aeca2fa | 2014-05-31 06:47:42 +0000 | [diff] [blame] | 15 | ; SI: V_CMP_EQ_I32_e64 [[CMP:s\[[0-9]+:[0-9]\]]], |
Tom Stellard | 3ca1bfc | 2014-06-10 16:01:22 +0000 | [diff] [blame] | 16 | ; FIXME: We should the VGPR sources for V_CNDMASK are copied from SGPRs, |
| 17 | ; we should be able to fold the SGPRs into the V_CNDMASK instructions. |
| 18 | ; SI: V_CNDMASK_B32_e64 v{{[0-9]+}}, v{{[0-9]+}}, v{{[0-9]+}}, [[CMP]] |
| 19 | ; SI: V_CNDMASK_B32_e64 v{{[0-9]+}}, v{{[0-9]+}}, v{{[0-9]+}}, [[CMP]] |
| 20 | ; SI: BUFFER_STORE_DWORDX2 |
Matt Arsenault | aeca2fa | 2014-05-31 06:47:42 +0000 | [diff] [blame] | 21 | ; SI: S_ENDPGM |
| 22 | define void @uint_to_fp_i1_f64(double addrspace(1)* %out, i32 %in) { |
| 23 | %cmp = icmp eq i32 %in, 0 |
| 24 | %fp = uitofp i1 %cmp to double |
| 25 | store double %fp, double addrspace(1)* %out, align 4 |
| 26 | ret void |
| 27 | } |
| 28 | |
Tom Stellard | 79243d9 | 2014-10-01 17:15:17 +0000 | [diff] [blame] | 29 | ; SI-LABEL: {{^}}uint_to_fp_i1_f64_load: |
Matt Arsenault | aeca2fa | 2014-05-31 06:47:42 +0000 | [diff] [blame] | 30 | ; SI: V_CNDMASK_B32_e64 [[IRESULT:v[0-9]]], 0, 1 |
| 31 | ; SI-NEXT: V_CVT_F64_U32_e32 [[RESULT:v\[[0-9]+:[0-9]\]]], [[IRESULT]] |
| 32 | ; SI: BUFFER_STORE_DWORDX2 [[RESULT]] |
| 33 | ; SI: S_ENDPGM |
| 34 | define void @uint_to_fp_i1_f64_load(double addrspace(1)* %out, i1 %in) { |
| 35 | %fp = uitofp i1 %in to double |
| 36 | store double %fp, double addrspace(1)* %out, align 8 |
| 37 | ret void |
| 38 | } |
Matt Arsenault | f7c95e3 | 2014-10-03 23:54:41 +0000 | [diff] [blame^] | 39 | |
| 40 | ; SI-LABEL: {{$}}v_uint_to_fp_i64_to_f64 |
| 41 | ; SI: BUFFER_LOAD_DWORDX2 v{{\[}}[[LO:[0-9]+]]:[[HI:[0-9]+]]{{\]}} |
| 42 | ; SI-DAG: V_CVT_F64_U32_e32 [[LO_CONV:v\[[0-9]+:[0-9]+\]]], v[[LO]] |
| 43 | ; SI-DAG: V_CVT_F64_U32_e32 [[HI_CONV:v\[[0-9]+:[0-9]+\]]], v[[HI]] |
| 44 | ; SI: V_LDEXP_F64 [[LDEXP:v\[[0-9]+:[0-9]+\]]], [[HI_CONV]], 32 |
| 45 | ; SI: V_ADD_F64 [[RESULT:v\[[0-9]+:[0-9]+\]]], [[LDEXP]], [[LO_CONV]] |
| 46 | ; SI: BUFFER_STORE_DWORDX2 [[RESULT]] |
| 47 | define void @v_uint_to_fp_i64_to_f64(double addrspace(1)* %out, i64 addrspace(1)* %in) { |
| 48 | %tid = call i32 @llvm.r600.read.tidig.x() nounwind readnone |
| 49 | %gep = getelementptr i64 addrspace(1)* %in, i32 %tid |
| 50 | %val = load i64 addrspace(1)* %gep, align 8 |
| 51 | %result = uitofp i64 %val to double |
| 52 | store double %result, double addrspace(1)* %out |
| 53 | ret void |
| 54 | } |
| 55 | |
| 56 | ; SI-LABEL: {{$}}s_uint_to_fp_f64_i64 |
| 57 | define void @s_uint_to_fp_f64_i64(double addrspace(1)* %out, i64 %in) { |
| 58 | %cast = uitofp i64 %in to double |
| 59 | store double %cast, double addrspace(1)* %out, align 8 |
| 60 | ret void |
| 61 | } |
| 62 | |
| 63 | ; SI-LABEL: {{$}}s_uint_to_fp_v2f64_v2i64 |
| 64 | define void @s_uint_to_fp_v2f64_v2i64(<2 x double> addrspace(1)* %out, <2 x i64> %in) { |
| 65 | %cast = uitofp <2 x i64> %in to <2 x double> |
| 66 | store <2 x double> %cast, <2 x double> addrspace(1)* %out, align 16 |
| 67 | ret void |
| 68 | } |
| 69 | |
| 70 | ; SI-LABEL: {{$}}s_uint_to_fp_v4f64_v4i64 |
| 71 | define void @s_uint_to_fp_v4f64_v4i64(<4 x double> addrspace(1)* %out, <4 x i64> %in) { |
| 72 | %cast = uitofp <4 x i64> %in to <4 x double> |
| 73 | store <4 x double> %cast, <4 x double> addrspace(1)* %out, align 16 |
| 74 | ret void |
| 75 | } |