diff options
author | Zack Rusin <[email protected]> | 2013-04-03 21:15:13 -0700 |
---|---|---|
committer | Zack Rusin <[email protected]> | 2013-04-04 12:09:55 -0700 |
commit | be9a42e980d9555f4f4c6c4a248dc269766085d9 (patch) | |
tree | bd5646fd300846b0d24ac857bc58a78a72fd3b92 /src/gallium/auxiliary/gallivm | |
parent | 5db22494934779a3e7fb7669379d1693ff19d39f (diff) |
llvmpipe: implement ucmp
and add a test for it
Signed-off-by: Zack Rusin <[email protected]>
Reviewed-by: José Fonseca <[email protected]>
Diffstat (limited to 'src/gallium/auxiliary/gallivm')
-rw-r--r-- | src/gallium/auxiliary/gallivm/lp_bld_tgsi_action.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_action.c b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_action.c index dfe581d1a11..f3ae7b6b6d8 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_action.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_action.c @@ -986,6 +986,26 @@ cmp_emit_cpu( cond, emit_data->args[1], emit_data->args[2]); } +/* TGSI_OPCODE_UCMP (CPU Only) */ +static void +ucmp_emit_cpu( + 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; + struct lp_build_context *uint_bld = &bld_base->uint_bld; + LLVMValueRef unsigned_cond = + LLVMBuildBitCast(builder, emit_data->args[0], uint_bld->vec_type, ""); + LLVMValueRef cond = lp_build_cmp(uint_bld, PIPE_FUNC_NOTEQUAL, + unsigned_cond, + uint_bld->zero); + emit_data->output[emit_data->chan] = + lp_build_select(&bld_base->base, + cond, emit_data->args[1], emit_data->args[2]); +} + + /* TGSI_OPCODE_CND (CPU Only) */ static void cnd_emit_cpu( @@ -1701,6 +1721,7 @@ lp_set_default_actions_cpu( bld_base->sqrt_action.emit = sqrt_emit_cpu; bld_base->op_actions[TGSI_OPCODE_UADD].emit = uadd_emit_cpu; + bld_base->op_actions[TGSI_OPCODE_UCMP].emit = ucmp_emit_cpu; bld_base->op_actions[TGSI_OPCODE_UDIV].emit = udiv_emit_cpu; bld_base->op_actions[TGSI_OPCODE_UMAX].emit = umax_emit_cpu; bld_base->op_actions[TGSI_OPCODE_UMIN].emit = umin_emit_cpu; |