summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Stellard <thomas.stellard@amd.com>2012-01-11 13:05:16 -0500
committerTom Stellard <thomas.stellard@amd.com>2012-01-13 16:38:02 -0500
commitb387a8b57e8a15d7ca70edb8ce54581a183d3996 (patch)
tree0b1cc15da3d723206c366788d336636babd2ac8b
parent24b545ea9cef8f38fc8ec12da3b2f3831368d030 (diff)
gallivm: Add function lp_bld_gather_values()
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_gather.c17
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_gather.h4
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 0dc81b1abbe..1bdd4e4845a 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 5b041317302..8e4c07d82b8 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_ */