Mesa (master): gallivm: Add function lp_bld_gather_values()
Tom Stellard
tstellar at kemper.freedesktop.org
Mon Jan 30 18:46:27 UTC 2012
Module: Mesa
Branch: master
Commit: 52049744620854487012151a7ac26ca978905411
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=52049744620854487012151a7ac26ca978905411
Author: Tom Stellard <thomas.stellard at amd.com>
Date: Wed Jan 11 13:05:16 2012 -0500
gallivm: Add function lp_bld_gather_values()
---
src/gallium/auxiliary/gallivm/lp_bld_gather.c | 17 +++++++++++++++++
src/gallium/auxiliary/gallivm/lp_bld_gather.h | 4 ++++
2 files changed, 21 insertions(+), 0 deletions(-)
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_gather.c b/src/gallium/auxiliary/gallivm/lp_bld_gather.c
index 0dc81b1..1bdd4e4 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_gather.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_gather.c
@@ -147,3 +147,20 @@ lp_build_gather(struct gallivm_state *gallivm,
return res;
}
+
+LLVMValueRef
+lp_build_gather_values(struct gallivm_state * gallivm,
+ LLVMValueRef * values,
+ unsigned value_count)
+{
+ LLVMTypeRef vec_type = LLVMVectorType(LLVMTypeOf(values[0]), value_count);
+ LLVMBuilderRef builder = gallivm->builder;
+ LLVMValueRef vec = LLVMGetUndef(vec_type);
+ unsigned i;
+
+ for (i = 0; i < value_count; i++) {
+ LLVMValueRef index = lp_build_const_int32(gallivm, i);
+ vec = LLVMBuildInsertElement(builder, vec, values[i], index, "");
+ }
+ return vec;
+}
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_gather.h b/src/gallium/auxiliary/gallivm/lp_bld_gather.h
index 5b04131..8e4c07d 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_gather.h
+++ b/src/gallium/auxiliary/gallivm/lp_bld_gather.h
@@ -57,5 +57,9 @@ lp_build_gather(struct gallivm_state *gallivm,
LLVMValueRef base_ptr,
LLVMValueRef offsets);
+LLVMValueRef
+lp_build_gather_values(struct gallivm_state * gallivm,
+ LLVMValueRef * values,
+ unsigned value_count);
#endif /* LP_BLD_GATHER_H_ */
More information about the mesa-commit
mailing list