150
|
1 ; RUN: llc -march=amdgcn -mcpu=tahiti -verify-machineinstrs < %s | FileCheck -enable-var-scope -check-prefix=GCN -check-prefix=SI %s
|
|
2 ; RUN: llc -march=amdgcn -mcpu=bonaire -verify-machineinstrs < %s | FileCheck -enable-var-scope -check-prefix=GCN -check-prefix=SI %s
|
|
3 ; RUN: llc -march=amdgcn -mcpu=fiji -verify-machineinstrs < %s | FileCheck -enable-var-scope -check-prefix=GCN -check-prefix=VI %s
|
|
4 ; RUN: llc -march=amdgcn -mcpu=gfx900 -verify-machineinstrs < %s | FileCheck -enable-var-scope -check-prefix=GCN -check-prefix=VI %s
|
|
5
|
|
6 ; GCN-LABEL: {{^}}s_cvt_pk_i16_i32:
|
236
|
7 ; GCN-DAG: s_load_dwordx4 s[[[#LOAD:]]:{{[0-9]+}}], s[0:1], 0x{{9|24}}
|
|
8 ; GCN: v_mov_b32_e32 [[VY:v[0-9]+]], s[[#LOAD + 3]]
|
|
9 ; SI: v_cvt_pk_i16_i32_e32 v{{[0-9]+}}, s[[#LOAD + 2]], [[VY]]
|
|
10 ; VI: v_cvt_pk_i16_i32 v{{[0-9]+}}, s[[#LOAD + 2]], [[VY]]
|
252
|
11 define amdgpu_kernel void @s_cvt_pk_i16_i32(ptr addrspace(1) %out, i32 %x, i32 %y) #0 {
|
150
|
12 %result = call <2 x i16> @llvm.amdgcn.cvt.pk.i16(i32 %x, i32 %y)
|
|
13 %r = bitcast <2 x i16> %result to i32
|
252
|
14 store i32 %r, ptr addrspace(1) %out
|
150
|
15 ret void
|
|
16 }
|
|
17
|
|
18 ; GCN-LABEL: {{^}}s_cvt_pk_i16_samereg_i32:
|
|
19 ; GCN: s_load_dword [[X:s[0-9]+]]
|
|
20 ; GCN: v_cvt_pk_i16_i32{{(_e64)*}} v{{[0-9]+}}, [[X]], [[X]]
|
252
|
21 define amdgpu_kernel void @s_cvt_pk_i16_samereg_i32(ptr addrspace(1) %out, i32 %x) #0 {
|
150
|
22 %result = call <2 x i16> @llvm.amdgcn.cvt.pk.i16(i32 %x, i32 %x)
|
|
23 %r = bitcast <2 x i16> %result to i32
|
252
|
24 store i32 %r, ptr addrspace(1) %out
|
150
|
25 ret void
|
|
26 }
|
|
27
|
|
28 ; GCN-LABEL: {{^}}v_cvt_pk_i16_i32:
|
|
29 ; GCN: {{buffer|flat|global}}_load_dword [[A:v[0-9]+]]
|
|
30 ; GCN: {{buffer|flat|global}}_load_dword [[B:v[0-9]+]]
|
|
31 ; SI: v_cvt_pk_i16_i32_e32 v{{[0-9]+}}, [[A]], [[B]]
|
|
32 ; VI: v_cvt_pk_i16_i32 v{{[0-9]+}}, [[A]], [[B]]
|
252
|
33 define amdgpu_kernel void @v_cvt_pk_i16_i32(ptr addrspace(1) %out, ptr addrspace(1) %a.ptr, ptr addrspace(1) %b.ptr) #0 {
|
150
|
34 %tid = call i32 @llvm.amdgcn.workitem.id.x()
|
|
35 %tid.ext = sext i32 %tid to i64
|
252
|
36 %a.gep = getelementptr inbounds i32, ptr addrspace(1) %a.ptr, i64 %tid.ext
|
|
37 %b.gep = getelementptr inbounds i32, ptr addrspace(1) %b.ptr, i64 %tid.ext
|
|
38 %out.gep = getelementptr inbounds i32, ptr addrspace(1) %out, i64 %tid.ext
|
|
39 %a = load volatile i32, ptr addrspace(1) %a.gep
|
|
40 %b = load volatile i32, ptr addrspace(1) %b.gep
|
150
|
41 %cvt = call <2 x i16> @llvm.amdgcn.cvt.pk.i16(i32 %a, i32 %b)
|
|
42 %r = bitcast <2 x i16> %cvt to i32
|
252
|
43 store i32 %r, ptr addrspace(1) %out.gep
|
150
|
44 ret void
|
|
45 }
|
|
46
|
|
47 ; GCN-LABEL: {{^}}v_cvt_pk_i16_i32_reg_imm:
|
|
48 ; GCN: {{buffer|flat|global}}_load_dword [[A:v[0-9]+]]
|
|
49 ; GCN: v_cvt_pk_i16_i32{{(_e64)*}} v{{[0-9]+}}, [[A]], 1
|
252
|
50 define amdgpu_kernel void @v_cvt_pk_i16_i32_reg_imm(ptr addrspace(1) %out, ptr addrspace(1) %a.ptr) #0 {
|
150
|
51 %tid = call i32 @llvm.amdgcn.workitem.id.x()
|
|
52 %tid.ext = sext i32 %tid to i64
|
252
|
53 %a.gep = getelementptr inbounds i32, ptr addrspace(1) %a.ptr, i64 %tid.ext
|
|
54 %out.gep = getelementptr inbounds i32, ptr addrspace(1) %out, i64 %tid.ext
|
|
55 %a = load volatile i32, ptr addrspace(1) %a.gep
|
150
|
56 %cvt = call <2 x i16> @llvm.amdgcn.cvt.pk.i16(i32 %a, i32 1)
|
|
57 %r = bitcast <2 x i16> %cvt to i32
|
252
|
58 store i32 %r, ptr addrspace(1) %out.gep
|
150
|
59 ret void
|
|
60 }
|
|
61
|
|
62 ; GCN-LABEL: {{^}}v_cvt_pk_i16_i32_imm_reg:
|
|
63 ; GCN: {{buffer|flat|global}}_load_dword [[A:v[0-9]+]]
|
|
64 ; SI: v_cvt_pk_i16_i32_e32 v{{[0-9]+}}, 1, [[A]]
|
|
65 ; VI: v_cvt_pk_i16_i32 v{{[0-9]+}}, 1, [[A]]
|
252
|
66 define amdgpu_kernel void @v_cvt_pk_i16_i32_imm_reg(ptr addrspace(1) %out, ptr addrspace(1) %a.ptr) #0 {
|
150
|
67 %tid = call i32 @llvm.amdgcn.workitem.id.x()
|
|
68 %tid.ext = sext i32 %tid to i64
|
252
|
69 %a.gep = getelementptr inbounds i32, ptr addrspace(1) %a.ptr, i64 %tid.ext
|
|
70 %out.gep = getelementptr inbounds i32, ptr addrspace(1) %out, i64 %tid.ext
|
|
71 %a = load volatile i32, ptr addrspace(1) %a.gep
|
150
|
72 %cvt = call <2 x i16> @llvm.amdgcn.cvt.pk.i16(i32 1, i32 %a)
|
|
73 %r = bitcast <2 x i16> %cvt to i32
|
252
|
74 store i32 %r, ptr addrspace(1) %out.gep
|
150
|
75 ret void
|
|
76 }
|
|
77
|
|
78 declare <2 x i16> @llvm.amdgcn.cvt.pk.i16(i32, i32) #1
|
|
79 declare i32 @llvm.amdgcn.workitem.id.x() #1
|
|
80
|
|
81
|
|
82 attributes #0 = { nounwind }
|
|
83 attributes #1 = { nounwind readnone }
|