2017-07-18 01:32:45 +08:00
|
|
|
; RUN: llc -march=amdgcn -verify-machineinstrs < %s | FileCheck %s
|
2016-04-22 12:04:08 +08:00
|
|
|
|
|
|
|
; CHECK-LABEL: {{^}}test1:
|
AMDGPU: VALU carry-in and v_cndmask condition cannot be EXEC
The hardware will only forward EXEC_LO; the high 32 bits will be zero.
Additionally, inline constants do not work. At least,
v_addc_u32_e64 v0, vcc, v0, v1, -1
which could conceivably be used to combine (v0 + v1 + 1) into a single
instruction, acts as if all carry-in bits are zero.
The llvm.amdgcn.ps.live test is adjusted; it would be nice to combine
s_mov_b64 s[0:1], exec
v_cndmask_b32_e64 v0, v1, v2, s[0:1]
into
v_mov_b32 v0, v3
but it's not particularly high priority.
Fixes dEQP-GLES31.functional.shaders.helper_invocation.value.*
llvm-svn: 314522
2017-09-29 23:37:31 +08:00
|
|
|
; CHECK: s_mov_b64 s[0:1], exec
|
|
|
|
; CHECK: v_cndmask_b32_e64 v0, 0, 1, s[0:1]
|
|
|
|
;
|
|
|
|
; Note: The hardware doesn't implement EXEC as src2 for v_cndmask.
|
2016-04-22 12:04:08 +08:00
|
|
|
;
|
|
|
|
; Note: We could generate better code here if we recognized earlier that
|
|
|
|
; there is no WQM use and therefore llvm.amdgcn.ps.live is constant. However,
|
|
|
|
; the expectation is that the intrinsic will be used in non-trivial shaders,
|
|
|
|
; so such an optimization doesn't seem worth the effort.
|
2017-03-22 00:24:12 +08:00
|
|
|
define amdgpu_ps float @test1() #0 {
|
2016-04-22 12:04:08 +08:00
|
|
|
%live = call i1 @llvm.amdgcn.ps.live()
|
|
|
|
%live.32 = zext i1 %live to i32
|
|
|
|
%r = bitcast i32 %live.32 to float
|
|
|
|
ret float %r
|
|
|
|
}
|
|
|
|
|
|
|
|
; CHECK-LABEL: {{^}}test2:
|
|
|
|
; CHECK: s_mov_b64 [[LIVE:s\[[0-9]+:[0-9]+\]]], exec
|
|
|
|
; CHECK-DAG: s_wqm_b64 exec, exec
|
|
|
|
; CHECK-DAG: v_cndmask_b32_e64 [[VAR:v[0-9]+]], 0, 1, [[LIVE]]
|
|
|
|
; CHECK: image_sample v0, [[VAR]],
|
2017-03-22 00:24:12 +08:00
|
|
|
define amdgpu_ps float @test2() #0 {
|
2016-04-22 12:04:08 +08:00
|
|
|
%live = call i1 @llvm.amdgcn.ps.live()
|
|
|
|
%live.32 = zext i1 %live to i32
|
2017-03-22 00:24:12 +08:00
|
|
|
%live.32.bc = bitcast i32 %live.32 to float
|
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
|
|
|
%t = call <4 x float> @llvm.amdgcn.image.sample.1d.v4f32.f32(i32 15, float %live.32.bc, <8 x i32> undef, <4 x i32> undef, i1 0, i32 0, i32 0)
|
2016-04-22 12:04:08 +08:00
|
|
|
%r = extractelement <4 x float> %t, i32 0
|
|
|
|
ret float %r
|
|
|
|
}
|
|
|
|
|
|
|
|
; CHECK-LABEL: {{^}}test3:
|
|
|
|
; CHECK: s_mov_b64 [[LIVE:s\[[0-9]+:[0-9]+\]]], exec
|
|
|
|
; CHECK-DAG: s_wqm_b64 exec, exec
|
|
|
|
; CHECK-DAG: s_xor_b64 [[HELPER:s\[[0-9]+:[0-9]+\]]], [[LIVE]], -1
|
|
|
|
; CHECK_DAG: s_and_saveexec_b64 [[SAVED:s\[[0-9]+:[0-9]+\]]], [[HELPER]]
|
|
|
|
; CHECK: ; %dead
|
2017-03-22 00:24:12 +08:00
|
|
|
define amdgpu_ps float @test3(i32 %in) #0 {
|
2016-04-22 12:04:08 +08:00
|
|
|
entry:
|
|
|
|
%live = call i1 @llvm.amdgcn.ps.live()
|
|
|
|
br i1 %live, label %end, label %dead
|
|
|
|
|
|
|
|
dead:
|
|
|
|
%tc.dead = mul i32 %in, 2
|
|
|
|
br label %end
|
|
|
|
|
|
|
|
end:
|
|
|
|
%tc = phi i32 [ %in, %entry ], [ %tc.dead, %dead ]
|
2017-03-22 00:24:12 +08:00
|
|
|
%tc.bc = bitcast i32 %tc to float
|
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
|
|
|
%t = call <4 x float> @llvm.amdgcn.image.sample.1d.v4f32.f32(i32 15, float %tc.bc, <8 x i32> undef, <4 x i32> undef, i1 0, i32 0, i32 0) #0
|
2016-04-22 12:04:08 +08:00
|
|
|
%r = extractelement <4 x float> %t, i32 0
|
|
|
|
ret float %r
|
|
|
|
}
|
|
|
|
|
2017-03-22 00:24:12 +08:00
|
|
|
declare i1 @llvm.amdgcn.ps.live() #1
|
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.1d.v4f32.f32(i32, float, <8 x i32>, <4 x i32>, i1, i32, i32) #2
|
2016-04-22 12:04:08 +08:00
|
|
|
|
2017-03-22 00:24:12 +08:00
|
|
|
attributes #0 = { nounwind }
|
|
|
|
attributes #1 = { nounwind readnone }
|
|
|
|
attributes #2 = { nounwind readonly }
|