1;RUN: llc < %s -march=amdgcn -mcpu=verde -verify-machineinstrs | FileCheck %s
2;RUN: llc < %s -march=amdgcn -mcpu=tonga -verify-machineinstrs | FileCheck %s
3
4; Example of a simple geometry shader loading vertex attributes from the
5; ESGS ring buffer
6
7; CHECK-LABEL: {{^}}main:
8; CHECK: buffer_load_dword
9; CHECK: buffer_load_dword
10; CHECK: buffer_load_dword
11; CHECK: buffer_load_dword
12
13define void @main([17 x <16 x i8>] addrspace(2)* byval, [32 x <16 x i8>] addrspace(2)* byval, [16 x <32 x i8>] addrspace(2)* byval, [2 x <16 x i8>] addrspace(2)* byval, [17 x <16 x i8>] addrspace(2)* inreg, [17 x <16 x i8>] addrspace(2)* inreg, i32, i32, i32, i32) #0 {
14main_body:
15  %10 = getelementptr [2 x <16 x i8>] addrspace(2)* %3, i64 0, i32 1
16  %11 = load <16 x i8> addrspace(2)* %10, !tbaa !0
17  %12 = shl i32 %6, 2
18  %13 = call i32 @llvm.SI.buffer.load.dword.i32.i32(<16 x i8> %11, i32 0, i32 0, i32 0, i32 0, i32 0, i32 1, i32 1, i32 0)
19  %14 = bitcast i32 %13 to float
20  %15 = call i32 @llvm.SI.buffer.load.dword.i32.i32(<16 x i8> %11, i32 %12, i32 0, i32 0, i32 1, i32 0, i32 1, i32 1, i32 0)
21  %16 = bitcast i32 %15 to float
22  %17 = call i32 @llvm.SI.buffer.load.dword.i32.i32(<16 x i8> %11, i32 %12, i32 0, i32 0, i32 0, i32 1, i32 1, i32 1, i32 0)
23  %18 = bitcast i32 %17 to float
24  %19 = call i32 @llvm.SI.buffer.load.dword.i32.v2i32(<16 x i8> %11, <2 x i32> <i32 0, i32 0>, i32 0, i32 0, i32 1, i32 1, i32 1, i32 1, i32 0)
25  %20 = bitcast i32 %19 to float
26  call void @llvm.SI.export(i32 15, i32 0, i32 1, i32 12, i32 0, float %14, float %16, float %18, float %20)
27  ret void
28}
29
30; Function Attrs: nounwind readonly
31declare i32 @llvm.SI.buffer.load.dword.i32.i32(<16 x i8>, i32, i32, i32, i32, i32, i32, i32, i32) #1
32
33; Function Attrs: nounwind readonly
34declare i32 @llvm.SI.buffer.load.dword.i32.v2i32(<16 x i8>, <2 x i32>, i32, i32, i32, i32, i32, i32, i32) #1
35
36declare void @llvm.SI.export(i32, i32, i32, i32, i32, float, float, float, float)
37
38attributes #0 = { "ShaderType"="1" }
39attributes #1 = { nounwind readonly }
40
41!0 = !{!"const", null, i32 1}
42