| Tim Renouf | 35484c9 | 2018-08-21 11:06:05 +0000 | [diff] [blame] | 1 | ;RUN: llc < %s -march=amdgcn -mcpu=verde -verify-machineinstrs | FileCheck -check-prefix=GCN %s |
| 2 | ;RUN: llc < %s -march=amdgcn -mcpu=tonga -verify-machineinstrs | FileCheck -check-prefix=GCN %s |
| 3 | |
| 4 | ; GCN-LABEL: {{^}}tbuffer_load: |
| 5 | ; GCN: v_mov_b32_e32 [[ZEROREG:v[0-9]+]], 0 |
| 6 | ; GCN: tbuffer_load_format_xyzw {{v\[[0-9]+:[0-9]+\]}}, [[ZEROREG]], {{s\[[0-9]+:[0-9]+\]}}, dfmt:14, nfmt:4, 0 idxen |
| 7 | ; GCN: tbuffer_load_format_xyzw {{v\[[0-9]+:[0-9]+\]}}, [[ZEROREG]], {{s\[[0-9]+:[0-9]+\]}}, dfmt:15, nfmt:3, 0 idxen glc |
| 8 | ; GCN: tbuffer_load_format_xyzw {{v\[[0-9]+:[0-9]+\]}}, [[ZEROREG]], {{s\[[0-9]+:[0-9]+\]}}, dfmt:6, nfmt:1, 0 idxen slc |
| 9 | ; GCN: tbuffer_load_format_xyzw {{v\[[0-9]+:[0-9]+\]}}, [[ZEROREG]], {{s\[[0-9]+:[0-9]+\]}}, dfmt:6, nfmt:1, 0 idxen |
| 10 | ; GCN: s_waitcnt |
| 11 | define amdgpu_vs {<4 x float>, <4 x float>, <4 x float>, <4 x float>} @tbuffer_load(<4 x i32> inreg) { |
| 12 | main_body: |
| 13 | %vdata = call <4 x i32> @llvm.amdgcn.struct.tbuffer.load.v4i32(<4 x i32> %0, i32 0, i32 0, i32 0, i32 78, i32 0) |
| 14 | %vdata_glc = call <4 x i32> @llvm.amdgcn.struct.tbuffer.load.v4i32(<4 x i32> %0, i32 0, i32 0, i32 0, i32 63, i32 1) |
| 15 | %vdata_slc = call <4 x i32> @llvm.amdgcn.struct.tbuffer.load.v4i32(<4 x i32> %0, i32 0, i32 0, i32 0, i32 22, i32 2) |
| 16 | %vdata_f32 = call <4 x float> @llvm.amdgcn.struct.tbuffer.load.v4f32(<4 x i32> %0, i32 0, i32 0, i32 0, i32 22, i32 0) |
| 17 | %vdata.f = bitcast <4 x i32> %vdata to <4 x float> |
| 18 | %vdata_glc.f = bitcast <4 x i32> %vdata_glc to <4 x float> |
| 19 | %vdata_slc.f = bitcast <4 x i32> %vdata_slc to <4 x float> |
| 20 | %r0 = insertvalue {<4 x float>, <4 x float>, <4 x float>, <4 x float>} undef, <4 x float> %vdata.f, 0 |
| 21 | %r1 = insertvalue {<4 x float>, <4 x float>, <4 x float>, <4 x float>} %r0, <4 x float> %vdata_glc.f, 1 |
| 22 | %r2 = insertvalue {<4 x float>, <4 x float>, <4 x float>, <4 x float>} %r1, <4 x float> %vdata_slc.f, 2 |
| 23 | %r3 = insertvalue {<4 x float>, <4 x float>, <4 x float>, <4 x float>} %r2, <4 x float> %vdata_f32, 3 |
| 24 | ret {<4 x float>, <4 x float>, <4 x float>, <4 x float>} %r3 |
| 25 | } |
| 26 | |
| 27 | ; GCN-LABEL: {{^}}tbuffer_load_immoffs: |
| 28 | ; GCN: v_mov_b32_e32 [[ZEROREG:v[0-9]+]], 0 |
| 29 | ; GCN: tbuffer_load_format_xyzw {{v\[[0-9]+:[0-9]+\]}}, [[ZEROREG]], {{s\[[0-9]+:[0-9]+\]}}, dfmt:14, nfmt:4, 0 idxen offset:42 |
| 30 | define amdgpu_vs <4 x float> @tbuffer_load_immoffs(<4 x i32> inreg) { |
| 31 | main_body: |
| 32 | %vdata = call <4 x i32> @llvm.amdgcn.struct.tbuffer.load.v4i32(<4 x i32> %0, i32 0, i32 42, i32 0, i32 78, i32 0) |
| 33 | %vdata.f = bitcast <4 x i32> %vdata to <4 x float> |
| 34 | ret <4 x float> %vdata.f |
| 35 | } |
| 36 | |
| 37 | ; GCN-LABEL: {{^}}tbuffer_load_immoffs_large |
| 38 | ; GCN: v_mov_b32_e32 [[ZEROREG:v[0-9]+]], 0 |
| 39 | ; GCN: tbuffer_load_format_xyzw {{v\[[0-9]+:[0-9]+\]}}, [[ZEROREG]], {{s\[[0-9]+:[0-9]+\]}}, dfmt:15, nfmt:2, 61 idxen offset:4095 |
| 40 | ; GCN: tbuffer_load_format_xyzw {{v\[[0-9]+:[0-9]+\]}}, [[ZEROREG]], {{s\[[0-9]+:[0-9]+\]}}, dfmt:14, nfmt:3, {{s[0-9]+}} idxen offset:73 |
| 41 | ; GCN: tbuffer_load_format_xyzw {{v\[[0-9]+:[0-9]+\]}}, [[ZEROREG]], {{s\[[0-9]+:[0-9]+\]}}, dfmt:13, nfmt:4, {{s[0-9]+}} idxen offset:1 |
| 42 | ; GCN: s_waitcnt |
| 43 | define amdgpu_vs {<4 x float>, <4 x float>, <4 x float>} @tbuffer_load_immoffs_large(<4 x i32> inreg, i32 inreg %soffs) { |
| 44 | %vdata = call <4 x i32> @llvm.amdgcn.struct.tbuffer.load.v4i32(<4 x i32> %0, i32 0, i32 4095, i32 61, i32 47, i32 0) |
| 45 | %vdata_glc = call <4 x i32> @llvm.amdgcn.struct.tbuffer.load.v4i32(<4 x i32> %0, i32 0, i32 73, i32 %soffs, i32 62, i32 0) |
| 46 | %vdata_slc = call <4 x i32> @llvm.amdgcn.struct.tbuffer.load.v4i32(<4 x i32> %0, i32 0, i32 1, i32 %soffs, i32 77, i32 0) |
| 47 | %vdata.f = bitcast <4 x i32> %vdata to <4 x float> |
| 48 | %vdata_glc.f = bitcast <4 x i32> %vdata_glc to <4 x float> |
| 49 | %vdata_slc.f = bitcast <4 x i32> %vdata_slc to <4 x float> |
| 50 | %r0 = insertvalue {<4 x float>, <4 x float>, <4 x float>} undef, <4 x float> %vdata.f, 0 |
| 51 | %r1 = insertvalue {<4 x float>, <4 x float>, <4 x float>} %r0, <4 x float> %vdata_glc.f, 1 |
| 52 | %r2 = insertvalue {<4 x float>, <4 x float>, <4 x float>} %r1, <4 x float> %vdata_slc.f, 2 |
| 53 | ret {<4 x float>, <4 x float>, <4 x float>} %r2 |
| 54 | } |
| 55 | |
| 56 | ; GCN-LABEL: {{^}}tbuffer_load_idx: |
| 57 | ; GCN: tbuffer_load_format_xyzw {{v\[[0-9]+:[0-9]+\]}}, {{v[0-9]+}}, {{s\[[0-9]+:[0-9]+\]}}, dfmt:14, nfmt:4, 0 idxen |
| 58 | define amdgpu_vs <4 x float> @tbuffer_load_idx(<4 x i32> inreg, i32 %vindex) { |
| 59 | main_body: |
| 60 | %vdata = call <4 x i32> @llvm.amdgcn.struct.tbuffer.load.v4i32(<4 x i32> %0, i32 %vindex, i32 0, i32 0, i32 78, i32 0) |
| 61 | %vdata.f = bitcast <4 x i32> %vdata to <4 x float> |
| 62 | ret <4 x float> %vdata.f |
| 63 | } |
| 64 | |
| 65 | ; GCN-LABEL: {{^}}tbuffer_load_ofs: |
| 66 | ; GCN: tbuffer_load_format_xyzw {{v\[[0-9]+:[0-9]+\]}}, {{v\[[0-9]+:[0-9]+\]}}, {{s\[[0-9]+:[0-9]+\]}}, dfmt:14, nfmt:4, 0 idxen offen |
| 67 | define amdgpu_vs <4 x float> @tbuffer_load_ofs(<4 x i32> inreg, i32 %voffs) { |
| 68 | main_body: |
| 69 | %vdata = call <4 x i32> @llvm.amdgcn.struct.tbuffer.load.v4i32(<4 x i32> %0, i32 0, i32 %voffs, i32 0, i32 78, i32 0) |
| 70 | %vdata.f = bitcast <4 x i32> %vdata to <4 x float> |
| 71 | ret <4 x float> %vdata.f |
| 72 | } |
| 73 | |
| 74 | ; GCN-LABEL: {{^}}tbuffer_load_ofs_imm: |
| 75 | ; GCN: tbuffer_load_format_xyzw {{v\[[0-9]+:[0-9]+\]}}, {{v\[[0-9]+:[0-9]+\]}}, {{s\[[0-9]+:[0-9]+\]}}, dfmt:14, nfmt:4, 0 idxen offen offset:52 |
| 76 | define amdgpu_vs <4 x float> @tbuffer_load_ofs_imm(<4 x i32> inreg, i32 %voffs) { |
| 77 | main_body: |
| 78 | %ofs = add i32 %voffs, 52 |
| 79 | %vdata = call <4 x i32> @llvm.amdgcn.struct.tbuffer.load.v4i32(<4 x i32> %0, i32 0, i32 %ofs, i32 0, i32 78, i32 0) |
| 80 | %vdata.f = bitcast <4 x i32> %vdata to <4 x float> |
| 81 | ret <4 x float> %vdata.f |
| 82 | } |
| 83 | |
| 84 | ; GCN-LABEL: {{^}}tbuffer_load_both: |
| 85 | ; GCN: tbuffer_load_format_xyzw {{v\[[0-9]+:[0-9]+\]}}, {{v\[[0-9]+:[0-9]+\]}}, {{s\[[0-9]+:[0-9]+\]}}, dfmt:14, nfmt:4, 0 idxen offen |
| 86 | define amdgpu_vs <4 x float> @tbuffer_load_both(<4 x i32> inreg, i32 %vindex, i32 %voffs) { |
| 87 | main_body: |
| 88 | %vdata = call <4 x i32> @llvm.amdgcn.struct.tbuffer.load.v4i32(<4 x i32> %0, i32 %vindex, i32 %voffs, i32 0, i32 78, i32 0) |
| 89 | %vdata.f = bitcast <4 x i32> %vdata to <4 x float> |
| 90 | ret <4 x float> %vdata.f |
| 91 | } |
| 92 | |
| 93 | |
| 94 | ; GCN-LABEL: {{^}}buffer_load_xy: |
| 95 | ; GCN: tbuffer_load_format_xy {{v\[[0-9]+:[0-9]+\]}}, {{v[0-9]+}}, {{s\[[0-9]+:[0-9]+\]}}, dfmt:13, nfmt:4, 0 idxen |
| 96 | define amdgpu_vs <2 x float> @buffer_load_xy(<4 x i32> inreg %rsrc) { |
| 97 | %vdata = call <2 x i32> @llvm.amdgcn.struct.tbuffer.load.v2i32(<4 x i32> %rsrc, i32 0, i32 0, i32 0, i32 77, i32 0) |
| 98 | %vdata.f = bitcast <2 x i32> %vdata to <2 x float> |
| 99 | ret <2 x float> %vdata.f |
| 100 | } |
| 101 | |
| 102 | ; GCN-LABEL: {{^}}buffer_load_x: |
| 103 | ; GCN: tbuffer_load_format_x {{v[0-9]+}}, {{v[0-9]+}}, {{s\[[0-9]+:[0-9]+\]}}, dfmt:13, nfmt:4, 0 idxen |
| 104 | define amdgpu_vs float @buffer_load_x(<4 x i32> inreg %rsrc) { |
| 105 | %vdata = call i32 @llvm.amdgcn.struct.tbuffer.load.i32(<4 x i32> %rsrc, i32 0, i32 0, i32 0, i32 77, i32 0) |
| 106 | %vdata.f = bitcast i32 %vdata to float |
| 107 | ret float %vdata.f |
| 108 | } |
| 109 | |
| 110 | declare i32 @llvm.amdgcn.struct.tbuffer.load.i32(<4 x i32>, i32, i32, i32, i32, i32) |
| 111 | declare <2 x i32> @llvm.amdgcn.struct.tbuffer.load.v2i32(<4 x i32>, i32, i32, i32, i32, i32) |
| 112 | declare <4 x i32> @llvm.amdgcn.struct.tbuffer.load.v4i32(<4 x i32>, i32, i32, i32, i32, i32) |
| 113 | declare <4 x float> @llvm.amdgcn.struct.tbuffer.load.v4f32(<4 x i32>, i32, i32, i32, i32, i32) |
| 114 | |