blob: 1c9196a8bd6b49b9ca00d6b7b9833da932368c9d [file] [log] [blame]
Matt Arsenault9c47dd52016-02-11 06:02:01 +00001; RUN: llc -march=amdgcn -verify-machineinstrs < %s | FileCheck -check-prefix=GCN -check-prefix=SI -check-prefix=FUNC %s
Matt Arsenault5e0bdb82016-01-11 22:01:48 +00002; 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 sint_to_fp.ll, but s_sint_to_fp_v2i64 crashes on r600
5
6; FUNC-LABEL: {{^}}s_sint_to_fp_i64_to_f32:
7define void @s_sint_to_fp_i64_to_f32(float addrspace(1)* %out, i64 %in) #0 {
8 %result = sitofp i64 %in to float
9 store float %result, float addrspace(1)* %out
10 ret void
11}
12
13; FUNC-LABEL: {{^}}v_sint_to_fp_i64_to_f32:
14; GCN: {{buffer|flat}}_load_dwordx2
15
Matt Arsenault33e3ece2016-01-18 22:09:04 +000016; GCN: v_ashrrev_i32_e32 v{{[0-9]+}}, 31, v{{[0-9]+}}
Matt Arsenault5e0bdb82016-01-11 22:01:48 +000017; GCN: v_xor_b32
18
19; GCN: v_ffbh_u32
20; GCN: v_ffbh_u32
21; GCN: v_cndmask
22; GCN: v_cndmask
23
Matt Arsenault5d8eb252016-09-30 01:50:20 +000024; GCN-DAG: v_cmp_eq_u64
Matt Arsenault5e0bdb82016-01-11 22:01:48 +000025; GCN-DAG: v_cmp_lt_u64
26
27; GCN: v_xor_b32_e32 v{{[0-9]+}}, 0x80000000, v{{[0-9]+}}
Artem Tamazov13548772016-06-06 15:23:43 +000028; GCN: v_cndmask_b32_e{{32|64}} [[SIGN_SEL:v[0-9]+]],
Tom Stellard46937ca2016-02-12 17:57:54 +000029; GCN: {{buffer|flat}}_store_dword {{.*}}[[SIGN_SEL]]
Matt Arsenault5e0bdb82016-01-11 22:01:48 +000030define void @v_sint_to_fp_i64_to_f32(float addrspace(1)* %out, i64 addrspace(1)* %in) #0 {
Matt Arsenault9c47dd52016-02-11 06:02:01 +000031 %tid = call i32 @llvm.amdgcn.workitem.id.x()
Matt Arsenault5e0bdb82016-01-11 22:01:48 +000032 %in.gep = getelementptr i64, i64 addrspace(1)* %in, i32 %tid
33 %out.gep = getelementptr float, float addrspace(1)* %out, i32 %tid
34 %val = load i64, i64 addrspace(1)* %in.gep
35 %result = sitofp i64 %val to float
36 store float %result, float addrspace(1)* %out.gep
37 ret void
38}
39
40; FUNC-LABEL: {{^}}s_sint_to_fp_v2i64:
Matt Arsenaultfa5f7672016-09-14 15:19:03 +000041; GCN-NOT: v_and_b32_e32 v{{[0-9]+}}, -1,
Matt Arsenault5e0bdb82016-01-11 22:01:48 +000042define void @s_sint_to_fp_v2i64(<2 x float> addrspace(1)* %out, <2 x i64> %in) #0{
43 %result = sitofp <2 x i64> %in to <2 x float>
44 store <2 x float> %result, <2 x float> addrspace(1)* %out
45 ret void
46}
47
48; FUNC-LABEL: {{^}}v_sint_to_fp_v4i64:
49define void @v_sint_to_fp_v4i64(<4 x float> addrspace(1)* %out, <4 x i64> addrspace(1)* %in) #0 {
Matt Arsenault9c47dd52016-02-11 06:02:01 +000050 %tid = call i32 @llvm.amdgcn.workitem.id.x()
Matt Arsenault5e0bdb82016-01-11 22:01:48 +000051 %in.gep = getelementptr <4 x i64>, <4 x i64> addrspace(1)* %in, i32 %tid
52 %out.gep = getelementptr <4 x float>, <4 x float> addrspace(1)* %out, i32 %tid
53 %value = load <4 x i64>, <4 x i64> addrspace(1)* %in.gep
54 %result = sitofp <4 x i64> %value to <4 x float>
55 store <4 x float> %result, <4 x float> addrspace(1)* %out.gep
56 ret void
57}
58
Matt Arsenault9c47dd52016-02-11 06:02:01 +000059declare i32 @llvm.amdgcn.workitem.id.x() #1
Matt Arsenault5e0bdb82016-01-11 22:01:48 +000060
61attributes #0 = { nounwind }
62attributes #1 = { nounwind readnone }