2017-02-22 08:02:21 +08:00
|
|
|
; RUN: llc -march=amdgcn -mcpu=verde -verify-machineinstrs < %s | FileCheck -check-prefix=GCN %s
|
|
|
|
; RUN: llc -march=amdgcn -mcpu=tonga -mattr=-flat-for-global -verify-machineinstrs < %s | FileCheck -check-prefix=GCN %s
|
2013-08-15 07:24:32 +08:00
|
|
|
|
2013-11-12 10:35:51 +08:00
|
|
|
; This shader has the potential to generated illegal VGPR to SGPR copies if
|
2013-08-15 07:24:32 +08:00
|
|
|
; the wrong register class is used for the REG_SEQUENCE instructions.
|
|
|
|
|
2017-02-22 08:02:21 +08:00
|
|
|
; GCN-LABEL: {{^}}main:
|
|
|
|
; GCN: image_sample_b v{{\[[0-9]:[0-9]\]}}, v{{\[[0-9]:[0-9]\]}}, s[{{[0-9]+:[0-9]+}}], s[{{[0-9]+:[0-9]+}}] dmask:0xf
|
2017-02-16 10:01:13 +08:00
|
|
|
define amdgpu_ps void @main(<16 x i8> addrspace(2)* inreg %arg, <16 x i8> addrspace(2)* inreg %arg1, <8 x i32> addrspace(2)* inreg %arg2, i32 inreg %arg3, <2 x i32> %arg4, <2 x i32> %arg5, <2 x i32> %arg6, <3 x i32> %arg7, <2 x i32> %arg8, <2 x i32> %arg9, <2 x i32> %arg10, float %arg11, float %arg12, float %arg13, float %arg14, float %arg15, float %arg16, float %arg17, float %arg18, float %arg19) #0 {
|
2013-08-15 07:24:32 +08:00
|
|
|
main_body:
|
2016-01-23 13:42:43 +08:00
|
|
|
%tmp = getelementptr <16 x i8>, <16 x i8> addrspace(2)* %arg, i32 0
|
|
|
|
%tmp20 = load <16 x i8>, <16 x i8> addrspace(2)* %tmp, !tbaa !0
|
|
|
|
%tmp21 = call float @llvm.SI.load.const(<16 x i8> %tmp20, i32 16)
|
2016-01-26 12:38:08 +08:00
|
|
|
%tmp22 = getelementptr <8 x i32>, <8 x i32> addrspace(2)* %arg2, i32 0
|
|
|
|
%tmp23 = load <8 x i32>, <8 x i32> addrspace(2)* %tmp22, !tbaa !0
|
2016-01-23 13:42:43 +08:00
|
|
|
%tmp24 = getelementptr <16 x i8>, <16 x i8> addrspace(2)* %arg1, i32 0
|
|
|
|
%tmp25 = load <16 x i8>, <16 x i8> addrspace(2)* %tmp24, !tbaa !0
|
2017-02-16 10:01:13 +08:00
|
|
|
%i.i = extractelement <2 x i32> %arg5, i32 0
|
|
|
|
%j.i = extractelement <2 x i32> %arg5, i32 1
|
|
|
|
%i.f.i = bitcast i32 %i.i to float
|
|
|
|
%j.f.i = bitcast i32 %j.i to float
|
|
|
|
%p1.i = call float @llvm.amdgcn.interp.p1(float %i.f.i, i32 0, i32 0, i32 %arg3) #0
|
|
|
|
%p2.i = call float @llvm.amdgcn.interp.p2(float %p1.i, float %j.f.i, i32 0, i32 0, i32 %arg3) #0
|
|
|
|
%i.i1 = extractelement <2 x i32> %arg5, i32 0
|
|
|
|
%j.i2 = extractelement <2 x i32> %arg5, i32 1
|
|
|
|
%i.f.i3 = bitcast i32 %i.i1 to float
|
|
|
|
%j.f.i4 = bitcast i32 %j.i2 to float
|
|
|
|
%p1.i5 = call float @llvm.amdgcn.interp.p1(float %i.f.i3, i32 1, i32 0, i32 %arg3) #0
|
|
|
|
%p2.i6 = call float @llvm.amdgcn.interp.p2(float %p1.i5, float %j.f.i4, i32 1, i32 0, i32 %arg3) #0
|
2016-01-23 13:42:43 +08:00
|
|
|
%tmp28 = bitcast float %tmp21 to i32
|
2017-02-16 10:01:13 +08:00
|
|
|
%tmp29 = bitcast float %p2.i to i32
|
|
|
|
%tmp30 = bitcast float %p2.i6 to i32
|
2016-01-23 13:42:43 +08:00
|
|
|
%tmp31 = insertelement <4 x i32> undef, i32 %tmp28, i32 0
|
|
|
|
%tmp32 = insertelement <4 x i32> %tmp31, i32 %tmp29, i32 1
|
|
|
|
%tmp33 = insertelement <4 x i32> %tmp32, i32 %tmp30, i32 2
|
|
|
|
%tmp34 = insertelement <4 x i32> %tmp33, i32 undef, i32 3
|
2016-01-26 12:38:08 +08:00
|
|
|
%tmp25.bc = bitcast <16 x i8> %tmp25 to <4 x i32>
|
|
|
|
%tmp35 = call <4 x float> @llvm.SI.image.sample.b.v4i32(<4 x i32> %tmp34, <8 x i32> %tmp23, <4 x i32> %tmp25.bc, i32 15, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0)
|
2016-01-23 13:42:43 +08:00
|
|
|
%tmp36 = extractelement <4 x float> %tmp35, i32 0
|
|
|
|
%tmp37 = extractelement <4 x float> %tmp35, i32 1
|
|
|
|
%tmp38 = extractelement <4 x float> %tmp35, i32 2
|
|
|
|
%tmp39 = extractelement <4 x float> %tmp35, i32 3
|
2017-02-22 08:02:21 +08:00
|
|
|
call void @llvm.amdgcn.exp.f32(i32 0, i32 15, float %tmp36, float %tmp37, float %tmp38, float %tmp39, i1 true, i1 true) #0
|
2013-08-15 07:24:32 +08:00
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2017-02-16 10:01:13 +08:00
|
|
|
declare float @llvm.amdgcn.interp.p1(float, i32, i32, i32) #1
|
|
|
|
declare float @llvm.amdgcn.interp.p2(float, float, i32, i32, i32) #1
|
2017-02-22 08:02:21 +08:00
|
|
|
declare void @llvm.amdgcn.exp.f32(i32, i32, float, float, float, float, i1, i1) #0
|
2017-02-16 10:01:13 +08:00
|
|
|
|
2017-02-22 08:02:21 +08:00
|
|
|
declare float @llvm.SI.load.const(<16 x i8>, i32) #1
|
|
|
|
declare <4 x float> @llvm.SI.image.sample.b.v4i32(<4 x i32>, <8 x i32>, <4 x i32>, i32, i32, i32, i32, i32, i32, i32, i32) #1
|
2016-04-07 03:40:20 +08:00
|
|
|
|
2017-02-16 10:01:13 +08:00
|
|
|
attributes #0 = { nounwind }
|
2013-08-15 07:24:32 +08:00
|
|
|
attributes #1 = { nounwind readnone }
|
|
|
|
|
2016-01-23 13:42:43 +08:00
|
|
|
!0 = !{!1, !1, i64 0, i32 1}
|
[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
|
|
|
!1 = !{!"const", !2}
|
|
|
|
!2 = !{!"tbaa root"}
|