Mesa (master): llvmpipe: In the abcense of a min/max intrinsic, use the comparison intrinsics.

Jose Fonseca jrfonseca at kemper.freedesktop.org
Mon Aug 31 09:03:07 UTC 2009


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

Author: José Fonseca <jfonseca at vmware.com>
Date:   Mon Aug 31 10:00:38 2009 +0100

llvmpipe: In the abcense of a min/max intrinsic, use the comparison intrinsics.

---

 src/gallium/drivers/llvmpipe/lp_bld_arit.c  |   15 +++++----------
 src/gallium/drivers/llvmpipe/lp_bld_logic.c |    1 -
 src/gallium/drivers/llvmpipe/lp_bld_logic.h |    2 ++
 3 files changed, 7 insertions(+), 11 deletions(-)

diff --git a/src/gallium/drivers/llvmpipe/lp_bld_arit.c b/src/gallium/drivers/llvmpipe/lp_bld_arit.c
index 710e624..09a57ff 100644
--- a/src/gallium/drivers/llvmpipe/lp_bld_arit.c
+++ b/src/gallium/drivers/llvmpipe/lp_bld_arit.c
@@ -52,6 +52,7 @@
 #include "lp_bld_type.h"
 #include "lp_bld_const.h"
 #include "lp_bld_intr.h"
+#include "lp_bld_logic.h"
 #include "lp_bld_arit.h"
 
 
@@ -98,11 +99,8 @@ lp_build_min_simple(struct lp_build_context *bld,
    if(intrinsic)
       return lp_build_intrinsic_binary(bld->builder, intrinsic, lp_build_vec_type(bld->type), a, b);
 
-   if(type.floating)
-      cond = LLVMBuildFCmp(bld->builder, LLVMRealULT, a, b, "");
-   else
-      cond = LLVMBuildICmp(bld->builder, type.sign ? LLVMIntSLT : LLVMIntULT, a, b, "");
-   return LLVMBuildSelect(bld->builder, cond, a, b, "");
+   cond = lp_build_cmp(bld, PIPE_FUNC_LESS, a, b);
+   return lp_build_select(bld, cond, a, b);
 }
 
 
@@ -149,11 +147,8 @@ lp_build_max_simple(struct lp_build_context *bld,
    if(intrinsic)
       return lp_build_intrinsic_binary(bld->builder, intrinsic, lp_build_vec_type(bld->type), a, b);
 
-   if(type.floating)
-      cond = LLVMBuildFCmp(bld->builder, LLVMRealULT, a, b, "");
-   else
-      cond = LLVMBuildICmp(bld->builder, type.sign ? LLVMIntSLT : LLVMIntULT, a, b, "");
-   return LLVMBuildSelect(bld->builder, cond, b, a, "");
+   cond = lp_build_cmp(bld, PIPE_FUNC_GREATER, a, b);
+   return lp_build_select(bld, cond, a, b);
 }
 
 
diff --git a/src/gallium/drivers/llvmpipe/lp_bld_logic.c b/src/gallium/drivers/llvmpipe/lp_bld_logic.c
index 1e1ecf8..d6dfd85 100644
--- a/src/gallium/drivers/llvmpipe/lp_bld_logic.c
+++ b/src/gallium/drivers/llvmpipe/lp_bld_logic.c
@@ -33,7 +33,6 @@
  */
 
 
-#include "pipe/p_defines.h"
 #include "lp_bld_type.h"
 #include "lp_bld_const.h"
 #include "lp_bld_intr.h"
diff --git a/src/gallium/drivers/llvmpipe/lp_bld_logic.h b/src/gallium/drivers/llvmpipe/lp_bld_logic.h
index 0989f9f..29b9e1c 100644
--- a/src/gallium/drivers/llvmpipe/lp_bld_logic.h
+++ b/src/gallium/drivers/llvmpipe/lp_bld_logic.h
@@ -39,6 +39,8 @@
 
 #include <llvm-c/Core.h>  
 
+#include "pipe/p_defines.h" /* For PIPE_FUNC_xxx */
+
 
 union lp_type type;
 struct lp_build_context;




More information about the mesa-commit mailing list