diff options
author | Marek Olšák <[email protected]> | 2017-10-04 04:51:39 +0200 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2017-10-24 14:56:34 +0200 |
commit | 1ff9e27cbdd1fe770f18e5316c6f32a867e39095 (patch) | |
tree | a5b282c567496845ba6986e22e52ac046fa0cbcf /src/amd/common/ac_llvm_build.c | |
parent | f0a2bbd1a4a0caf85d91469e61d01a126cfc2a36 (diff) |
ac: replace ac_build_kill with ac_build_kill_if_false
This will be a new LLVM intrinsic and will also work nicely with
llvm.amdgcn.wqm.vote.
Reviewed-by: Nicolai Hähnle <[email protected]>
Diffstat (limited to 'src/amd/common/ac_llvm_build.c')
-rw-r--r-- | src/amd/common/ac_llvm_build.c | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/src/amd/common/ac_llvm_build.c b/src/amd/common/ac_llvm_build.c index 4d8f42d572c..5bd04663216 100644 --- a/src/amd/common/ac_llvm_build.c +++ b/src/amd/common/ac_llvm_build.c @@ -1405,20 +1405,13 @@ LLVMValueRef ac_build_cvt_pkrtz_f16(struct ac_llvm_context *ctx, AC_FUNC_ATTR_LEGACY); } -/** - * KILL, AKA discard in GLSL. - * - * \param value kill if value < 0.0 or value == NULL. - */ -void ac_build_kill(struct ac_llvm_context *ctx, LLVMValueRef value) +void ac_build_kill_if_false(struct ac_llvm_context *ctx, LLVMValueRef i1) { - if (value) { - ac_build_intrinsic(ctx, "llvm.AMDGPU.kill", ctx->voidt, - &value, 1, AC_FUNC_ATTR_LEGACY); - } else { - ac_build_intrinsic(ctx, "llvm.AMDGPU.kilp", ctx->voidt, - NULL, 0, AC_FUNC_ATTR_LEGACY); - } + LLVMValueRef value = LLVMBuildSelect(ctx->builder, i1, + LLVMConstReal(ctx->f32, 1), + LLVMConstReal(ctx->f32, -1), ""); + ac_build_intrinsic(ctx, "llvm.AMDGPU.kill", ctx->voidt, + &value, 1, AC_FUNC_ATTR_LEGACY); } LLVMValueRef ac_build_bfe(struct ac_llvm_context *ctx, LLVMValueRef input, |