1 ;RUN: llc < %s -mtriple=amdgcn -mcpu=verde -verify-machineinstrs | FileCheck %s
2 ;RUN: llc < %s -mtriple=amdgcn -mcpu=tonga -verify-machineinstrs | FileCheck %s
4 ;CHECK-LABEL: {{^}}buffer_load:
5 ;CHECK: buffer_load_format_xyzw v[0:3], off, s[0:3], 0
6 ;CHECK: buffer_load_format_xyzw v[4:7], off, s[0:3], 0 glc
7 ;CHECK: buffer_load_format_xyzw v[8:11], off, s[0:3], 0 slc
9 define amdgpu_ps {<4 x float>, <4 x float>, <4 x float>} @buffer_load(ptr addrspace(8) inreg) {
11 %data = call <4 x float> @llvm.amdgcn.raw.ptr.buffer.load.format.v4f32(ptr addrspace(8) %0, i32 0, i32 0, i32 0)
12 %data_glc = call <4 x float> @llvm.amdgcn.raw.ptr.buffer.load.format.v4f32(ptr addrspace(8) %0, i32 0, i32 0, i32 1)
13 %data_slc = call <4 x float> @llvm.amdgcn.raw.ptr.buffer.load.format.v4f32(ptr addrspace(8) %0, i32 0, i32 0, i32 2)
14 %r0 = insertvalue {<4 x float>, <4 x float>, <4 x float>} undef, <4 x float> %data, 0
15 %r1 = insertvalue {<4 x float>, <4 x float>, <4 x float>} %r0, <4 x float> %data_glc, 1
16 %r2 = insertvalue {<4 x float>, <4 x float>, <4 x float>} %r1, <4 x float> %data_slc, 2
17 ret {<4 x float>, <4 x float>, <4 x float>} %r2
20 ;CHECK-LABEL: {{^}}buffer_load_immoffs:
21 ;CHECK: buffer_load_format_xyzw v[0:3], off, s[0:3], 0 offset:42
23 define amdgpu_ps <4 x float> @buffer_load_immoffs(ptr addrspace(8) inreg) {
25 %data = call <4 x float> @llvm.amdgcn.raw.ptr.buffer.load.format.v4f32(ptr addrspace(8) %0, i32 42, i32 0, i32 0)
29 ;CHECK-LABEL: {{^}}buffer_load_immoffs_large:
30 ;CHECK-DAG: buffer_load_format_xyzw {{v\[[0-9]+:[0-9]+\]}}, off, s[0:3], 60 offset:4092
31 ;CHECK-DAG: s_movk_i32 [[OFS1:s[0-9]+]], 0x7ffc
32 ;CHECK-DAG: buffer_load_format_xyzw {{v\[[0-9]+:[0-9]+\]}}, off, s[0:3], [[OFS1]] offset:4092
33 ;CHECK-DAG: s_mov_b32 [[OFS2:s[0-9]+]], 0x8ffc
34 ;CHECK-DAG: buffer_load_format_xyzw {{v\[[0-9]+:[0-9]+\]}}, off, s[0:3], [[OFS2]] offset:4
36 define amdgpu_ps <4 x float> @buffer_load_immoffs_large(ptr addrspace(8) inreg) {
38 %d.0 = call <4 x float> @llvm.amdgcn.raw.ptr.buffer.load.format.v4f32(ptr addrspace(8) %0, i32 4092, i32 60, i32 0)
39 %d.1 = call <4 x float> @llvm.amdgcn.raw.ptr.buffer.load.format.v4f32(ptr addrspace(8) %0, i32 4092, i32 32764, i32 0)
40 %d.2 = call <4 x float> @llvm.amdgcn.raw.ptr.buffer.load.format.v4f32(ptr addrspace(8) %0, i32 4, i32 36860, i32 0)
41 %d.3 = fadd <4 x float> %d.0, %d.1
42 %data = fadd <4 x float> %d.2, %d.3
46 ;CHECK-LABEL: {{^}}buffer_load_ofs:
47 ;CHECK: buffer_load_format_xyzw v[0:3], v0, s[0:3], 0 offen
49 define amdgpu_ps <4 x float> @buffer_load_ofs(ptr addrspace(8) inreg, i32) {
51 %data = call <4 x float> @llvm.amdgcn.raw.ptr.buffer.load.format.v4f32(ptr addrspace(8) %0, i32 %1, i32 0, i32 0)
55 ;CHECK-LABEL: {{^}}buffer_load_ofs_imm:
56 ;CHECK: buffer_load_format_xyzw v[0:3], v0, s[0:3], 0 offen offset:60
58 define amdgpu_ps <4 x float> @buffer_load_ofs_imm(ptr addrspace(8) inreg, i32) {
61 %data = call <4 x float> @llvm.amdgcn.raw.ptr.buffer.load.format.v4f32(ptr addrspace(8) %0, i32 %ofs, i32 0, i32 0)
65 ;CHECK-LABEL: {{^}}buffer_load_x:
66 ;CHECK: buffer_load_format_x v0, off, s[0:3], 0
68 define amdgpu_ps float @buffer_load_x(ptr addrspace(8) inreg %rsrc) {
70 %data = call float @llvm.amdgcn.raw.ptr.buffer.load.format.f32(ptr addrspace(8) %rsrc, i32 0, i32 0, i32 0)
74 ;CHECK-LABEL: {{^}}buffer_load_xy:
75 ;CHECK: buffer_load_format_xy v[0:1], off, s[0:3], 0
77 define amdgpu_ps <2 x float> @buffer_load_xy(ptr addrspace(8) inreg %rsrc) {
79 %data = call <2 x float> @llvm.amdgcn.raw.ptr.buffer.load.format.v2f32(ptr addrspace(8) %rsrc, i32 0, i32 0, i32 0)
83 declare float @llvm.amdgcn.raw.ptr.buffer.load.format.f32(ptr addrspace(8), i32, i32, i32) #0
84 declare <2 x float> @llvm.amdgcn.raw.ptr.buffer.load.format.v2f32(ptr addrspace(8), i32, i32, i32) #0
85 declare <4 x float> @llvm.amdgcn.raw.ptr.buffer.load.format.v4f32(ptr addrspace(8), i32, i32, i32) #0
87 attributes #0 = { nounwind readonly }