llvmpipe: In the abcense of a min/max intrinsic, use the comparison intrinsics.
authorJosé Fonseca <jfonseca@vmware.com>
Mon, 31 Aug 2009 09:00:38 +0000 (10:00 +0100)
committerJosé Fonseca <jfonseca@vmware.com>
Mon, 31 Aug 2009 09:00:38 +0000 (10:00 +0100)
src/gallium/drivers/llvmpipe/lp_bld_arit.c
src/gallium/drivers/llvmpipe/lp_bld_logic.c
src/gallium/drivers/llvmpipe/lp_bld_logic.h

index 710e6246d746c076c7c1ce616d9c593e8a4e5ea1..09a57ff33d51e63ccfdeaf55fdc61bf2454fd093 100644 (file)
@@ -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);
 }
 
 
index 1e1ecf805bccad3b80b7d1b165b0eb6915251478..d6dfd853422df269f3d8fe0e575dce2615a39650 100644 (file)
@@ -33,7 +33,6 @@
  */
 
 
-#include "pipe/p_defines.h"
 #include "lp_bld_type.h"
 #include "lp_bld_const.h"
 #include "lp_bld_intr.h"
index 0989f9f20784a0c9e48eedc746304823c51e17d0..29b9e1c45b822122c6dee012e4c450d6df3a722f 100644 (file)
@@ -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;