Matt Arsenault | caa1288 | 2015-02-18 02:04:38 +0000 | [diff] [blame] | 1 | ; RUN: llc -march=amdgcn -mcpu=verde -show-mc-encoding -verify-machineinstrs < %s | FileCheck %s |
| 2 | ; RUN: llc -march=amdgcn -mcpu=tonga -show-mc-encoding -verify-machineinstrs < %s | FileCheck %s |
Michel Danzer | 1373622 | 2014-01-27 07:20:51 +0000 | [diff] [blame] | 3 | |
| 4 | ; Example of a simple geometry shader loading vertex attributes from the |
| 5 | ; ESGS ring buffer |
| 6 | |
Matt Arsenault | caa1288 | 2015-02-18 02:04:38 +0000 | [diff] [blame] | 7 | ; FIXME: Out of bounds immediate offset crashes |
Michel Danzer | 1373622 | 2014-01-27 07:20:51 +0000 | [diff] [blame] | 8 | |
Matt Arsenault | caa1288 | 2015-02-18 02:04:38 +0000 | [diff] [blame] | 9 | ; CHECK-LABEL: {{^}}main: |
Nikolay Haustov | 4f672a3 | 2016-04-29 09:02:30 +0000 | [diff] [blame] | 10 | ; CHECK: buffer_load_dword {{v[0-9]+}}, off, {{s\[[0-9]+:[0-9]+\]}}, 0 glc slc |
Matt Arsenault | caa1288 | 2015-02-18 02:04:38 +0000 | [diff] [blame] | 11 | ; CHECK: buffer_load_dword {{v[0-9]+}}, {{v[0-9]+}}, {{s\[[0-9]+:[0-9]+\]}}, 0 offen glc slc |
| 12 | ; CHECK: buffer_load_dword {{v[0-9]+}}, {{v[0-9]+}}, {{s\[[0-9]+:[0-9]+\]}}, 0 idxen glc slc |
| 13 | ; CHECK: buffer_load_dword {{v[0-9]+}}, {{v\[[0-9]+:[0-9]+\]}}, {{s\[[0-9]+:[0-9]+\]}}, 0 idxen offen glc slc |
| 14 | ; CHECK: s_movk_i32 [[K:s[0-9]+]], 0x4d2 ; encoding |
| 15 | ; CHECK: buffer_load_dword {{v[0-9]+}}, {{v\[[0-9]+:[0-9]+\]}}, {{s\[[0-9]+:[0-9]+\]}}, [[K]] idxen offen offset:65535 glc slc |
| 16 | |
Nicolai Haehnle | df3a20c | 2016-04-06 19:40:20 +0000 | [diff] [blame] | 17 | define amdgpu_vs void @main([17 x <16 x i8>] addrspace(2)* byval %arg, [32 x <16 x i8>] addrspace(2)* byval %arg1, [16 x <32 x i8>] addrspace(2)* byval %arg2, [2 x <16 x i8>] addrspace(2)* byval %arg3, [17 x <16 x i8>] addrspace(2)* inreg %arg4, [17 x <16 x i8>] addrspace(2)* inreg %arg5, i32 %arg6, i32 %arg7, i32 %arg8, i32 %arg9) { |
Michel Danzer | 1373622 | 2014-01-27 07:20:51 +0000 | [diff] [blame] | 18 | main_body: |
David Blaikie | 79e6c74 | 2015-02-27 19:29:02 +0000 | [diff] [blame] | 19 | %tmp = getelementptr [2 x <16 x i8>], [2 x <16 x i8>] addrspace(2)* %arg3, i64 0, i32 1 |
David Blaikie | a79ac14 | 2015-02-27 21:17:42 +0000 | [diff] [blame] | 20 | %tmp10 = load <16 x i8>, <16 x i8> addrspace(2)* %tmp, !tbaa !0 |
Matt Arsenault | caa1288 | 2015-02-18 02:04:38 +0000 | [diff] [blame] | 21 | %tmp11 = shl i32 %arg6, 2 |
| 22 | %tmp12 = call i32 @llvm.SI.buffer.load.dword.i32.i32(<16 x i8> %tmp10, i32 0, i32 0, i32 0, i32 0, i32 0, i32 1, i32 1, i32 0) |
| 23 | %tmp13 = bitcast i32 %tmp12 to float |
| 24 | %tmp14 = call i32 @llvm.SI.buffer.load.dword.i32.i32(<16 x i8> %tmp10, i32 %tmp11, i32 0, i32 0, i32 1, i32 0, i32 1, i32 1, i32 0) |
| 25 | %tmp15 = bitcast i32 %tmp14 to float |
| 26 | %tmp16 = call i32 @llvm.SI.buffer.load.dword.i32.i32(<16 x i8> %tmp10, i32 %tmp11, i32 0, i32 0, i32 0, i32 1, i32 1, i32 1, i32 0) |
| 27 | %tmp17 = bitcast i32 %tmp16 to float |
| 28 | %tmp18 = call i32 @llvm.SI.buffer.load.dword.i32.v2i32(<16 x i8> %tmp10, <2 x i32> zeroinitializer, i32 0, i32 0, i32 1, i32 1, i32 1, i32 1, i32 0) |
| 29 | %tmp19 = bitcast i32 %tmp18 to float |
| 30 | |
| 31 | %tmp20 = call i32 @llvm.SI.buffer.load.dword.i32.v2i32(<16 x i8> %tmp10, <2 x i32> zeroinitializer, i32 0, i32 123, i32 1, i32 1, i32 1, i32 1, i32 0) |
| 32 | %tmp21 = bitcast i32 %tmp20 to float |
| 33 | |
| 34 | %tmp22 = call i32 @llvm.SI.buffer.load.dword.i32.v2i32(<16 x i8> %tmp10, <2 x i32> zeroinitializer, i32 1234, i32 65535, i32 1, i32 1, i32 1, i32 1, i32 0) |
| 35 | %tmp23 = bitcast i32 %tmp22 to float |
| 36 | |
| 37 | call void @llvm.SI.export(i32 15, i32 0, i32 1, i32 12, i32 0, float %tmp13, float %tmp15, float %tmp17, float %tmp19) |
| 38 | call void @llvm.SI.export(i32 15, i32 0, i32 1, i32 12, i32 0, float %tmp21, float %tmp23, float %tmp23, float %tmp23) |
Michel Danzer | 1373622 | 2014-01-27 07:20:51 +0000 | [diff] [blame] | 39 | ret void |
| 40 | } |
| 41 | |
| 42 | ; Function Attrs: nounwind readonly |
Nicolai Haehnle | df3a20c | 2016-04-06 19:40:20 +0000 | [diff] [blame] | 43 | declare i32 @llvm.SI.buffer.load.dword.i32.i32(<16 x i8>, i32, i32, i32, i32, i32, i32, i32, i32) #0 |
Michel Danzer | 1373622 | 2014-01-27 07:20:51 +0000 | [diff] [blame] | 44 | |
| 45 | ; Function Attrs: nounwind readonly |
Nicolai Haehnle | df3a20c | 2016-04-06 19:40:20 +0000 | [diff] [blame] | 46 | declare i32 @llvm.SI.buffer.load.dword.i32.v2i32(<16 x i8>, <2 x i32>, i32, i32, i32, i32, i32, i32, i32) #0 |
Michel Danzer | 1373622 | 2014-01-27 07:20:51 +0000 | [diff] [blame] | 47 | |
| 48 | declare void @llvm.SI.export(i32, i32, i32, i32, i32, float, float, float, float) |
| 49 | |
Nicolai Haehnle | df3a20c | 2016-04-06 19:40:20 +0000 | [diff] [blame] | 50 | attributes #0 = { nounwind readonly } |
Michel Danzer | 1373622 | 2014-01-27 07:20:51 +0000 | [diff] [blame] | 51 | |
Sanjoy Das | 3336f68 | 2016-12-11 20:07:15 +0000 | [diff] [blame] | 52 | !0 = !{!"const", !1, i32 1} |
| 53 | !1 = !{!"tbaa root"} |