2015-02-18 10:04:38 +08:00
|
|
|
; RUN: llc -march=amdgcn -mcpu=verde -show-mc-encoding -verify-machineinstrs < %s | FileCheck %s
|
|
|
|
; RUN: llc -march=amdgcn -mcpu=tonga -show-mc-encoding -verify-machineinstrs < %s | FileCheck %s
|
2014-01-27 15:20:51 +08:00
|
|
|
|
|
|
|
; Example of a simple geometry shader loading vertex attributes from the
|
|
|
|
; ESGS ring buffer
|
|
|
|
|
2015-02-18 10:04:38 +08:00
|
|
|
; FIXME: Out of bounds immediate offset crashes
|
2014-01-27 15:20:51 +08:00
|
|
|
|
2015-02-18 10:04:38 +08:00
|
|
|
; CHECK-LABEL: {{^}}main:
|
2016-04-29 17:02:30 +08:00
|
|
|
; CHECK: buffer_load_dword {{v[0-9]+}}, off, {{s\[[0-9]+:[0-9]+\]}}, 0 glc slc
|
2015-02-18 10:04:38 +08:00
|
|
|
; CHECK: buffer_load_dword {{v[0-9]+}}, {{v[0-9]+}}, {{s\[[0-9]+:[0-9]+\]}}, 0 offen glc slc
|
|
|
|
; CHECK: buffer_load_dword {{v[0-9]+}}, {{v[0-9]+}}, {{s\[[0-9]+:[0-9]+\]}}, 0 idxen glc slc
|
|
|
|
; CHECK: buffer_load_dword {{v[0-9]+}}, {{v\[[0-9]+:[0-9]+\]}}, {{s\[[0-9]+:[0-9]+\]}}, 0 idxen offen glc slc
|
|
|
|
; CHECK: s_movk_i32 [[K:s[0-9]+]], 0x4d2 ; encoding
|
|
|
|
; CHECK: buffer_load_dword {{v[0-9]+}}, {{v\[[0-9]+:[0-9]+\]}}, {{s\[[0-9]+:[0-9]+\]}}, [[K]] idxen offen offset:65535 glc slc
|
|
|
|
|
2017-06-29 05:38:50 +08:00
|
|
|
define amdgpu_vs void @main([17 x <4 x i32>] addrspace(2)* byval %arg, [32 x <4 x i32>] addrspace(2)* byval %arg1, [16 x <32 x i8>] addrspace(2)* byval %arg2, [2 x <4 x i32>] addrspace(2)* byval %arg3, [17 x <4 x i32>] addrspace(2)* inreg %arg4, [17 x <4 x i32>] addrspace(2)* inreg %arg5, i32 %arg6, i32 %arg7, i32 %arg8, i32 %arg9) {
|
2014-01-27 15:20:51 +08:00
|
|
|
main_body:
|
2017-06-29 05:38:50 +08:00
|
|
|
%tmp = getelementptr [2 x <4 x i32>], [2 x <4 x i32>] addrspace(2)* %arg3, i64 0, i32 1
|
|
|
|
%tmp10 = load <4 x i32>, <4 x i32> addrspace(2)* %tmp, !tbaa !0
|
2015-02-18 10:04:38 +08:00
|
|
|
%tmp11 = shl i32 %arg6, 2
|
2017-06-29 05:38:50 +08:00
|
|
|
%tmp12 = call i32 @llvm.SI.buffer.load.dword.i32.i32(<4 x i32> %tmp10, i32 0, i32 0, i32 0, i32 0, i32 0, i32 1, i32 1, i32 0)
|
2015-02-18 10:04:38 +08:00
|
|
|
%tmp13 = bitcast i32 %tmp12 to float
|
2017-06-29 05:38:50 +08:00
|
|
|
%tmp14 = call i32 @llvm.SI.buffer.load.dword.i32.i32(<4 x i32> %tmp10, i32 %tmp11, i32 0, i32 0, i32 1, i32 0, i32 1, i32 1, i32 0)
|
2015-02-18 10:04:38 +08:00
|
|
|
%tmp15 = bitcast i32 %tmp14 to float
|
2017-06-29 05:38:50 +08:00
|
|
|
%tmp16 = call i32 @llvm.SI.buffer.load.dword.i32.i32(<4 x i32> %tmp10, i32 %tmp11, i32 0, i32 0, i32 0, i32 1, i32 1, i32 1, i32 0)
|
2015-02-18 10:04:38 +08:00
|
|
|
%tmp17 = bitcast i32 %tmp16 to float
|
2017-06-29 05:38:50 +08:00
|
|
|
%tmp18 = call i32 @llvm.SI.buffer.load.dword.i32.v2i32(<4 x i32> %tmp10, <2 x i32> zeroinitializer, i32 0, i32 0, i32 1, i32 1, i32 1, i32 1, i32 0)
|
2015-02-18 10:04:38 +08:00
|
|
|
%tmp19 = bitcast i32 %tmp18 to float
|
|
|
|
|
2017-06-29 05:38:50 +08:00
|
|
|
%tmp20 = call i32 @llvm.SI.buffer.load.dword.i32.v2i32(<4 x i32> %tmp10, <2 x i32> zeroinitializer, i32 0, i32 123, i32 1, i32 1, i32 1, i32 1, i32 0)
|
2015-02-18 10:04:38 +08:00
|
|
|
%tmp21 = bitcast i32 %tmp20 to float
|
|
|
|
|
2017-06-29 05:38:50 +08:00
|
|
|
%tmp22 = call i32 @llvm.SI.buffer.load.dword.i32.v2i32(<4 x i32> %tmp10, <2 x i32> zeroinitializer, i32 1234, i32 65535, i32 1, i32 1, i32 1, i32 1, i32 0)
|
2015-02-18 10:04:38 +08:00
|
|
|
%tmp23 = bitcast i32 %tmp22 to float
|
|
|
|
|
2017-04-05 00:34:39 +08:00
|
|
|
call void @llvm.amdgcn.exp.f32(i32 15, i32 12, float %tmp13, float %tmp15, float %tmp17, float %tmp19, i1 false, i1 false)
|
|
|
|
call void @llvm.amdgcn.exp.f32(i32 15, i32 12, float %tmp21, float %tmp23, float %tmp23, float %tmp23, i1 true, i1 false)
|
2014-01-27 15:20:51 +08:00
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
; Function Attrs: nounwind readonly
|
2017-06-29 05:38:50 +08:00
|
|
|
declare i32 @llvm.SI.buffer.load.dword.i32.i32(<4 x i32>, i32, i32, i32, i32, i32, i32, i32, i32) #0
|
2014-01-27 15:20:51 +08:00
|
|
|
|
|
|
|
; Function Attrs: nounwind readonly
|
2017-06-29 05:38:50 +08:00
|
|
|
declare i32 @llvm.SI.buffer.load.dword.i32.v2i32(<4 x i32>, <2 x i32>, i32, i32, i32, i32, i32, i32, i32) #0
|
2014-01-27 15:20:51 +08:00
|
|
|
|
2017-04-05 00:34:39 +08:00
|
|
|
declare void @llvm.amdgcn.exp.f32(i32, i32, float, float, float, float, i1, i1) #1
|
2014-01-27 15:20:51 +08:00
|
|
|
|
2016-04-07 03:40:20 +08:00
|
|
|
attributes #0 = { nounwind readonly }
|
2017-04-05 00:34:39 +08:00
|
|
|
attributes #1 = { nounwind inaccessiblememonly }
|
2014-01-27 15:20:51 +08:00
|
|
|
|
[Verifier] Add verification for TBAA metadata
Summary:
This change adds some verification in the IR verifier around struct path
TBAA metadata.
Other than some basic sanity checks (e.g. we get constant integers where
we expect constant integers), this checks:
- That by the time an struct access tuple `(base-type, offset)` is
"reduced" to a scalar base type, the offset is `0`. For instance, in
C++ you can't start from, say `("struct-a", 16)`, and end up with
`("int", 4)` -- by the time the base type is `"int"`, the offset
better be zero. In particular, a variant of this invariant is needed
for `llvm::getMostGenericTBAA` to be correct.
- That there are no cycles in a struct path.
- That struct type nodes have their offsets listed in an ascending
order.
- That when generating the struct access path, you eventually reach the
access type listed in the tbaa tag node.
Reviewers: dexonsmith, chandlerc, reames, mehdi_amini, manmanren
Subscribers: mcrosier, llvm-commits
Differential Revision: https://reviews.llvm.org/D26438
llvm-svn: 289402
2016-12-12 04:07:15 +08:00
|
|
|
!0 = !{!"const", !1, i32 1}
|
|
|
|
!1 = !{!"tbaa root"}
|