diff options
author | Samuel Pitoiset <[email protected]> | 2018-01-11 16:45:11 +0100 |
---|---|---|
committer | Samuel Pitoiset <[email protected]> | 2018-01-16 21:39:51 +0100 |
commit | ad2b3b2a9cefc28f8bd78a116ab549a08d35ec35 (patch) | |
tree | 2ddee41c7dc8e9d267bd5bba4d14ae32f4213152 /src | |
parent | 9b894c88a688904860d0f37221b78fbcb168f216 (diff) |
ac: replace llvm.AMDGPU.kilp by llvm.amdgcn.kill with LLVM 6
This also replaces llvm.AMDGPU.kilp by llvm.AMDGPU.kill with
LLVM < 6. Similar to RadeonSI codepath.
Signed-off-by: Samuel Pitoiset <[email protected]>
Reviewed-by: Bas Nieuwenhuizen <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/amd/common/ac_nir_to_llvm.c | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c index 20340395434..aca9a0a2601 100644 --- a/src/amd/common/ac_nir_to_llvm.c +++ b/src/amd/common/ac_nir_to_llvm.c @@ -3867,14 +3867,20 @@ static void emit_barrier(struct ac_llvm_context *ac, gl_shader_stage stage) ac->voidt, NULL, 0, AC_FUNC_ATTR_CONVERGENT); } -static void emit_discard_if(struct ac_nir_context *ctx, - const nir_intrinsic_instr *instr) +static void emit_discard(struct ac_nir_context *ctx, + const nir_intrinsic_instr *instr) { LLVMValueRef cond; - cond = LLVMBuildICmp(ctx->ac.builder, LLVMIntEQ, - get_src(ctx, instr->src[0]), - ctx->ac.i32_0, ""); + if (instr->intrinsic == nir_intrinsic_discard_if) { + cond = LLVMBuildICmp(ctx->ac.builder, LLVMIntEQ, + get_src(ctx, instr->src[0]), + ctx->ac.i32_0, ""); + } else { + assert(instr->intrinsic == nir_intrinsic_discard); + cond = LLVMConstInt(ctx->ac.i1, false, 0); + } + ac_build_kill_if_false(&ctx->ac, cond); } @@ -4348,12 +4354,8 @@ static void visit_intrinsic(struct ac_nir_context *ctx, result = visit_image_size(ctx, instr); break; case nir_intrinsic_discard: - ac_build_intrinsic(&ctx->ac, "llvm.AMDGPU.kilp", - LLVMVoidTypeInContext(ctx->ac.context), - NULL, 0, AC_FUNC_ATTR_LEGACY); - break; case nir_intrinsic_discard_if: - emit_discard_if(ctx, instr); + emit_discard(ctx, instr); break; case nir_intrinsic_memory_barrier: case nir_intrinsic_group_memory_barrier: |