2016-07-16 06:32:02 +08:00
|
|
|
; RUN: llc -march=amdgcn -verify-machineinstrs < %s | FileCheck %s
|
2016-05-21 07:02:13 +08:00
|
|
|
; We may have subregister live ranges that are undefined on some paths. The
|
|
|
|
; verifier should not complain about this.
|
|
|
|
|
2016-07-16 06:32:02 +08:00
|
|
|
|
|
|
|
; CHECK-LABEL: {{^}}func:
|
2017-03-22 05:39:51 +08:00
|
|
|
define amdgpu_kernel void @func() #0 {
|
2016-05-21 07:02:13 +08:00
|
|
|
B0:
|
|
|
|
br i1 undef, label %B1, label %B2
|
|
|
|
|
|
|
|
B1:
|
|
|
|
br label %B2
|
|
|
|
|
|
|
|
B2:
|
|
|
|
%v0 = phi <4 x float> [ zeroinitializer, %B1 ], [ <float 0.0, float 0.0, float 0.0, float undef>, %B0 ]
|
|
|
|
br i1 undef, label %B30.1, label %B30.2
|
|
|
|
|
|
|
|
B30.1:
|
|
|
|
%sub = fsub <4 x float> %v0, undef
|
|
|
|
br label %B30.2
|
|
|
|
|
|
|
|
B30.2:
|
|
|
|
%v3 = phi <4 x float> [ %sub, %B30.1 ], [ %v0, %B2 ]
|
|
|
|
%ve0 = extractelement <4 x float> %v3, i32 0
|
|
|
|
store float %ve0, float addrspace(3)* undef, align 4
|
|
|
|
ret void
|
|
|
|
}
|
2016-07-16 06:32:02 +08:00
|
|
|
|
|
|
|
; FIXME: Extra undef subregister copy should be removed before
|
|
|
|
; overwritten with defined copy
|
|
|
|
; CHECK-LABEL: {{^}}valley_partially_undef_copy:
|
|
|
|
define amdgpu_ps float @valley_partially_undef_copy() #0 {
|
|
|
|
bb:
|
|
|
|
%tmp = load volatile i32, i32 addrspace(1)* undef, align 4
|
|
|
|
%tmp1 = load volatile i32, i32 addrspace(1)* undef, align 4
|
|
|
|
%tmp2 = insertelement <4 x i32> undef, i32 %tmp1, i32 0
|
AMDGPU: Convert test cases to the dimension-aware intrinsics
Summary:
Also explicitly port over some tests in llvm.amdgcn.image.* that were
missing. Some tests are removed because they no longer apply (i.e.
explicitly testing building an address vector via insertelement).
This is in preparation for the eventual removal of the old-style
intrinsics.
Some additional notes:
- constant-address-space-32bit.ll: change some GCN-NEXT to GCN because
the instruction schedule was subtly altered
- insert_vector_elt.ll: the old test didn't actually test anything,
because %tmp1 was not used; remove the load, because it doesn't work
(Because of the amdgpu_ps calling convention? In any case, it's
orthogonal to what the test claims to be testing.)
Change-Id: Idfa99b6512ad139e755e82b8b89548ab08f0afcf
Reviewers: arsenm, rampitec
Subscribers: MatzeB, qcolombet, kzhuravl, wdng, yaxunl, dstuttard, tpr, t-tye, javed.absar, llvm-commits
Differential Revision: https://reviews.llvm.org/D48018
llvm-svn: 335229
2018-06-21 21:37:19 +08:00
|
|
|
%tmp3 = bitcast i32 %tmp1 to float
|
|
|
|
%tmp4 = call <4 x float> @llvm.amdgcn.image.sample.2d.v4f32.f32(i32 15, float %tmp3, float %tmp3, <8 x i32> undef, <4 x i32> undef, i1 0, i32 0, i32 0)
|
2016-07-16 06:32:02 +08:00
|
|
|
%tmp5 = extractelement <4 x float> %tmp4, i32 0
|
|
|
|
%tmp6 = fmul float %tmp5, undef
|
|
|
|
%tmp7 = fadd float %tmp6, %tmp6
|
|
|
|
%tmp8 = insertelement <4 x i32> %tmp2, i32 %tmp, i32 1
|
|
|
|
store <4 x i32> %tmp8, <4 x i32> addrspace(1)* undef, align 16
|
|
|
|
store float %tmp7, float addrspace(1)* undef, align 4
|
|
|
|
br label %bb9
|
|
|
|
|
|
|
|
bb9: ; preds = %bb9, %bb
|
|
|
|
%tmp10 = icmp eq i32 %tmp, 0
|
|
|
|
br i1 %tmp10, label %bb9, label %bb11
|
|
|
|
|
|
|
|
bb11: ; preds = %bb9
|
|
|
|
store <4 x i32> %tmp2, <4 x i32> addrspace(1)* undef, align 16
|
|
|
|
ret float undef
|
|
|
|
}
|
|
|
|
|
|
|
|
; FIXME: Should be able to remove the undef copies
|
|
|
|
|
|
|
|
; CHECK-LABEL: {{^}}partially_undef_copy:
|
|
|
|
; CHECK: v_mov_b32_e32 v5, 5
|
|
|
|
; CHECK: v_mov_b32_e32 v6, 6
|
|
|
|
|
|
|
|
; CHECK: v_mov_b32_e32 v[[OUTPUT_LO:[0-9]+]], v5
|
|
|
|
|
|
|
|
; Undef copy
|
|
|
|
; CHECK: v_mov_b32_e32 v1, v6
|
|
|
|
|
|
|
|
; undef copy
|
|
|
|
; CHECK: v_mov_b32_e32 v2, v7
|
|
|
|
|
|
|
|
; CHECK: v_mov_b32_e32 v[[OUTPUT_HI:[0-9]+]], v8
|
|
|
|
; CHECK: v_mov_b32_e32 v[[OUTPUT_LO]], v6
|
|
|
|
|
|
|
|
; CHECK: buffer_store_dwordx4 v{{\[}}[[OUTPUT_LO]]:[[OUTPUT_HI]]{{\]}}
|
2017-03-22 05:39:51 +08:00
|
|
|
define amdgpu_kernel void @partially_undef_copy() #0 {
|
2017-06-09 03:03:20 +08:00
|
|
|
%tmp0 = call i32 asm sideeffect "v_mov_b32_e32 v5, 5", "={v5}"()
|
|
|
|
%tmp1 = call i32 asm sideeffect "v_mov_b32_e32 v6, 6", "={v6}"()
|
2016-07-16 06:32:02 +08:00
|
|
|
|
|
|
|
%partially.undef.0 = insertelement <4 x i32> undef, i32 %tmp0, i32 0
|
|
|
|
%partially.undef.1 = insertelement <4 x i32> %partially.undef.0, i32 %tmp1, i32 0
|
|
|
|
|
|
|
|
store volatile <4 x i32> %partially.undef.1, <4 x i32> addrspace(1)* undef, align 16
|
2017-06-09 03:03:20 +08:00
|
|
|
tail call void asm sideeffect "v_nop", "v={v[5:8]}"(<4 x i32> %partially.undef.0)
|
2016-07-16 06:32:02 +08:00
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
AMDGPU: Convert test cases to the dimension-aware intrinsics
Summary:
Also explicitly port over some tests in llvm.amdgcn.image.* that were
missing. Some tests are removed because they no longer apply (i.e.
explicitly testing building an address vector via insertelement).
This is in preparation for the eventual removal of the old-style
intrinsics.
Some additional notes:
- constant-address-space-32bit.ll: change some GCN-NEXT to GCN because
the instruction schedule was subtly altered
- insert_vector_elt.ll: the old test didn't actually test anything,
because %tmp1 was not used; remove the load, because it doesn't work
(Because of the amdgpu_ps calling convention? In any case, it's
orthogonal to what the test claims to be testing.)
Change-Id: Idfa99b6512ad139e755e82b8b89548ab08f0afcf
Reviewers: arsenm, rampitec
Subscribers: MatzeB, qcolombet, kzhuravl, wdng, yaxunl, dstuttard, tpr, t-tye, javed.absar, llvm-commits
Differential Revision: https://reviews.llvm.org/D48018
llvm-svn: 335229
2018-06-21 21:37:19 +08:00
|
|
|
declare <4 x float> @llvm.amdgcn.image.sample.2d.v4f32.f32(i32, float, float, <8 x i32>, <4 x i32>, i1, i32, i32) #1
|
2016-07-16 06:32:02 +08:00
|
|
|
|
|
|
|
attributes #0 = { nounwind }
|
2017-03-22 00:24:12 +08:00
|
|
|
attributes #1 = { nounwind readonly }
|