Mesa (master): llvmpipe: improve based on review from Jose and fix else clauses

Zack Rusin zack at kemper.freedesktop.org
Tue Mar 2 15:18:32 UTC 2010


Module: Mesa
Branch: master
Commit: faf8215bae70f020420242dc812ef141fdcf5417
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=faf8215bae70f020420242dc812ef141fdcf5417

Author: Zack Rusin <zackr at vmware.com>
Date:   Tue Mar  2 10:18:29 2010 -0500

llvmpipe: improve based on review from Jose and fix else clauses

else was broken in the outter most else statemants, plus the code
didn't need an inverted mask to compute the inverse of the current
condition.

---

 src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c |   17 +++++++++--------
 1 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
index 81b0ab7..ae86624 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
@@ -96,8 +96,6 @@ struct lp_exec_mask {
    LLVMValueRef cond_mask;
 
    LLVMValueRef exec_mask;
-
-   LLVMValueRef inv_mask;
 };
 
 struct lp_build_tgsi_soa_context
@@ -149,9 +147,6 @@ static void lp_exec_mask_init(struct lp_exec_mask *mask, struct lp_build_context
    mask->cond_stack_size = 0;
 
    mask->int_vec_type = lp_build_int_vec_type(mask->bld->type);
-   mask->inv_mask =
-      LLVMConstSub(LLVMConstNull(mask->int_vec_type),
-                   LLVMConstAllOnes(mask->int_vec_type));
 }
 
 static void lp_exec_mask_update(struct lp_exec_mask *mask)
@@ -174,9 +169,15 @@ static void lp_exec_mask_cond_push(struct lp_exec_mask *mask,
 static void lp_exec_mask_cond_invert(struct lp_exec_mask *mask)
 {
    LLVMValueRef prev_mask = mask->cond_stack[mask->cond_stack_size - 1];
-   LLVMValueRef inv_mask = LLVMBuildXor(mask->bld->builder,
-                                        mask->cond_mask,
-                                        mask->inv_mask, "");
+   LLVMValueRef inv_mask = LLVMBuildNot(mask->bld->builder,
+                                        mask->cond_mask, "");
+
+   /* means that we didn't have any mask before and that
+    * we were fully enabled */
+   if (mask->cond_stack_size <= 1) {
+      prev_mask = LLVMConstAllOnes(mask->int_vec_type);
+   }
+
    mask->cond_mask = LLVMBuildAnd(mask->bld->builder,
                                   inv_mask,
                                   prev_mask, "");




More information about the mesa-commit mailing list