diff options
author | Vincent Lejeune <[email protected]> | 2012-09-24 16:04:26 +0200 |
---|---|---|
committer | Vincent Lejeune <[email protected]> | 2012-09-27 01:43:35 +0200 |
commit | ff947c6d65830b7be6e9fcbfe666fa7dba6341f6 (patch) | |
tree | 96de8c46afa7c97dc31589942e9cdc77238cfe51 /src/gallium/drivers/r600 | |
parent | bb7ecb29fb6358a4c65278c2fe88936c578074cd (diff) |
radeon/llvm: improve select_cc lowering to generate CND* more often
v2: - Simplify isZero()
- Remove a unused function prototype
- Clean whitespace trails
Reviewed-by: Tom Stellard <[email protected]>
Diffstat (limited to 'src/gallium/drivers/r600')
-rw-r--r-- | src/gallium/drivers/r600/r600_llvm.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/gallium/drivers/r600/r600_llvm.c b/src/gallium/drivers/r600/r600_llvm.c index dd0a714ebf6..71ea5781220 100644 --- a/src/gallium/drivers/r600/r600_llvm.c +++ b/src/gallium/drivers/r600/r600_llvm.c @@ -165,6 +165,20 @@ static void llvm_emit_tex( emit_data->dst_type, args, c, LLVMReadNoneAttribute); } +static void emit_cndlt( + const struct lp_build_tgsi_action * action, + struct lp_build_tgsi_context * bld_base, + struct lp_build_emit_data * emit_data) +{ + LLVMBuilderRef builder = bld_base->base.gallivm->builder; + LLVMValueRef float_zero = lp_build_const_float( + bld_base->base.gallivm, 0.0f); + LLVMValueRef cmp = LLVMBuildFCmp( + builder, LLVMRealULT, emit_data->args[0], float_zero, ""); + emit_data->output[emit_data->chan] = LLVMBuildSelect(builder, + cmp, emit_data->args[1], emit_data->args[2], ""); +} + static void dp_fetch_args( struct lp_build_tgsi_context * bld_base, struct lp_build_emit_data * emit_data) @@ -241,6 +255,7 @@ LLVMModuleRef r600_tgsi_llvm( bld_base->op_actions[TGSI_OPCODE_TXF].emit = llvm_emit_tex; bld_base->op_actions[TGSI_OPCODE_TXQ].emit = llvm_emit_tex; bld_base->op_actions[TGSI_OPCODE_TXP].emit = llvm_emit_tex; + bld_base->op_actions[TGSI_OPCODE_CMP].emit = emit_cndlt; lp_build_tgsi_llvm(bld_base, tokens); |