diff options
author | Zack Rusin <[email protected]> | 2013-04-04 15:06:14 -0700 |
---|---|---|
committer | Zack Rusin <[email protected]> | 2013-04-10 12:25:34 -0700 |
commit | 1ad4a4eeb3fe83ce3ce7336250d725bf0a28de7b (patch) | |
tree | 158bba02218a1081049ca8fcc98635dc1fab616f /src/gallium/auxiliary | |
parent | e4484a0309ab44a790df29a599fb2b01eb885d5a (diff) |
gallivm: fix breakc
we break when the mask values are 0 not, 1, plus it's bit comparison
not a floating point comparison. This fixes both.
Signed-off-by: Zack Rusin <[email protected]>
Reviewed-by: Jose Fonseca <[email protected]>
Reviewed-by: Roland Scheidegger <[email protected]>
Diffstat (limited to 'src/gallium/auxiliary')
-rw-r--r-- | src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c index d8c419b7ac6..1e062e94e93 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c @@ -217,15 +217,14 @@ static void lp_exec_break_condition(struct lp_exec_mask *mask, LLVMValueRef cond) { LLVMBuilderRef builder = mask->bld->gallivm->builder; - LLVMValueRef exec_mask = LLVMBuildNot(builder, + LLVMValueRef cond_mask = LLVMBuildAnd(builder, mask->exec_mask, - "break"); - - exec_mask = LLVMBuildAnd(builder, exec_mask, cond, ""); + cond, "cond_mask"); + cond_mask = LLVMBuildNot(builder, cond, "break_cond"); mask->break_mask = LLVMBuildAnd(builder, mask->break_mask, - exec_mask, "break_full"); + cond_mask, "breakc_full"); lp_exec_mask_update(mask); } @@ -287,14 +286,14 @@ static void lp_exec_endloop(struct gallivm_state *gallivm, builder, LLVMIntNE, LLVMBuildBitCast(builder, mask->exec_mask, reg_type, ""), - LLVMConstNull(reg_type), ""); + LLVMConstNull(reg_type), "i1cond"); /* i2cond = (looplimiter > 0) */ i2cond = LLVMBuildICmp( builder, LLVMIntSGT, limiter, - LLVMConstNull(int_type), ""); + LLVMConstNull(int_type), "i2cond"); /* if( i1cond && i2cond ) */ icond = LLVMBuildAnd(builder, i1cond, i2cond, ""); @@ -2298,13 +2297,16 @@ breakc_emit( struct lp_build_tgsi_context * bld_base, struct lp_build_emit_data * emit_data) { - LLVMValueRef tmp; struct lp_build_tgsi_soa_context * bld = lp_soa_context(bld_base); + 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); - tmp = lp_build_cmp(&bld_base->base, PIPE_FUNC_NOTEQUAL, - emit_data->args[0], bld->bld_base.base.zero); - - lp_exec_break_condition(&bld->exec_mask, tmp); + lp_exec_break_condition(&bld->exec_mask, cond); } static void |