blob: 2c81c537093b082273bbaf6a85708e17bb5acbaa [file] [log] [blame]
Tim Renouf35484c92018-08-21 11:06:05 +00001; RUN: llc < %s -march=amdgcn -mcpu=tonga -verify-machineinstrs -show-mc-encoding | FileCheck -enable-var-scope -check-prefix=GCN -check-prefix=UNPACKED %s
2; RUN: llc < %s -march=amdgcn -mcpu=gfx810 -verify-machineinstrs | FileCheck -enable-var-scope -check-prefix=GCN -check-prefix=PACKED %s
3; RUN: llc < %s -march=amdgcn -mcpu=gfx900 -verify-machineinstrs | FileCheck -enable-var-scope -check-prefix=GCN -check-prefix=PACKED %s
4
5; GCN-LABEL: {{^}}tbuffer_load_d16_x:
6; GCN: tbuffer_load_format_d16_x v{{[0-9]+}}, off, s[{{[0-9]+:[0-9]+}}], dfmt:6, nfmt:1, 0
7define amdgpu_ps half @tbuffer_load_d16_x(<4 x i32> inreg %rsrc) {
8main_body:
9 %data = call half @llvm.amdgcn.raw.tbuffer.load.f16(<4 x i32> %rsrc, i32 0, i32 0, i32 22, i32 0)
10 ret half %data
11}
12
13; GCN-LABEL: {{^}}tbuffer_load_d16_xy:
14; UNPACKED: tbuffer_load_format_d16_xy v{{\[}}{{[0-9]+}}:[[HI:[0-9]+]]{{\]}}, off, s[{{[0-9]+:[0-9]+}}], dfmt:6, nfmt:1, 0
15; UNPACKED: v_mov_b32_e32 v{{[0-9]+}}, v[[HI]]
16
17; PACKED: tbuffer_load_format_d16_xy v[[FULL:[0-9]+]], off, s[{{[0-9]+:[0-9]+}}], dfmt:6, nfmt:1, 0
18; PACKED: v_lshrrev_b32_e32 v{{[0-9]+}}, 16, v[[FULL]]
19define amdgpu_ps half @tbuffer_load_d16_xy(<4 x i32> inreg %rsrc) {
20main_body:
21 %data = call <2 x half> @llvm.amdgcn.raw.tbuffer.load.v2f16(<4 x i32> %rsrc, i32 0, i32 0, i32 22, i32 0)
22 %elt = extractelement <2 x half> %data, i32 1
23 ret half %elt
24}
25
26; GCN-LABEL: {{^}}tbuffer_load_d16_xyzw:
27; UNPACKED: tbuffer_load_format_d16_xyzw v{{\[}}{{[0-9]+}}:[[HI:[0-9]+]]{{\]}}, off, s[{{[0-9]+:[0-9]+}}], dfmt:6, nfmt:1, 0
28; UNPACKED: v_mov_b32_e32 v{{[0-9]+}}, v[[HI]]
29
30; PACKED: tbuffer_load_format_d16_xyzw v{{\[}}{{[0-9]+}}:[[HI:[0-9]+]]{{\]}}, off, s[{{[0-9]+:[0-9]+}}], dfmt:6, nfmt:1, 0
31; PACKED: v_lshrrev_b32_e32 v{{[0-9]+}}, 16, v[[HI]]
32define amdgpu_ps half @tbuffer_load_d16_xyzw(<4 x i32> inreg %rsrc) {
33main_body:
34 %data = call <4 x half> @llvm.amdgcn.raw.tbuffer.load.v4f16(<4 x i32> %rsrc, i32 0, i32 0, i32 22, i32 0)
35 %elt = extractelement <4 x half> %data, i32 3
36 ret half %elt
37}
38
39declare half @llvm.amdgcn.raw.tbuffer.load.f16(<4 x i32>, i32, i32, i32, i32)
40declare <2 x half> @llvm.amdgcn.raw.tbuffer.load.v2f16(<4 x i32>, i32, i32, i32, i32)
41declare <4 x half> @llvm.amdgcn.raw.tbuffer.load.v4f16(<4 x i32>, i32, i32, i32, i32)
42