[Mesa-dev] [PATCH 2/3] gallivm: add uint to float arit function.

Dave Airlie airlied at gmail.com
Fri Feb 17 11:02:22 PST 2012


From: Dave Airlie <airlied at redhat.com>

Signed-off-by: Dave Airlie <airlied at redhat.com>
---
 src/gallium/auxiliary/gallivm/lp_bld_arit.c |   15 +++++++++++++++
 src/gallium/auxiliary/gallivm/lp_bld_arit.h |    4 ++++
 2 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/src/gallium/auxiliary/gallivm/lp_bld_arit.c b/src/gallium/auxiliary/gallivm/lp_bld_arit.c
index f3e8ae4..1b97722 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_arit.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_arit.c
@@ -991,6 +991,21 @@ lp_build_int_to_float(struct lp_build_context *bld,
    return LLVMBuildSIToFP(builder, a, vec_type, "");
 }
 
+/**
+ * Convert vector of (or scalar) uint to vector of (or scalar) float.
+ */
+LLVMValueRef
+lp_build_uint_to_float(struct lp_build_context *bld,
+                      LLVMValueRef a)
+{
+   LLVMBuilderRef builder = bld->gallivm->builder;
+   const struct lp_type type = bld->type;
+   LLVMTypeRef vec_type = lp_build_vec_type(bld->gallivm, type);
+
+   assert(type.floating);
+
+   return LLVMBuildUIToFP(builder, a, vec_type, "");
+}
 
 
 enum lp_build_round_sse41_mode
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_arit.h b/src/gallium/auxiliary/gallivm/lp_bld_arit.h
index c78b61d..0c753b7 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_arit.h
+++ b/src/gallium/auxiliary/gallivm/lp_bld_arit.h
@@ -137,6 +137,10 @@ lp_build_int_to_float(struct lp_build_context *bld,
                       LLVMValueRef a);
 
 LLVMValueRef
+lp_build_uint_to_float(struct lp_build_context *bld,
+                      LLVMValueRef a);
+
+LLVMValueRef
 lp_build_round(struct lp_build_context *bld,
                LLVMValueRef a);
 
-- 
1.7.7.6



More information about the mesa-dev mailing list