Explorar el Código

gallivm: Add function lp_bld_gather_values()

tags/i965-primitive-restart-v2
Tom Stellard hace 13 años
padre
commit
5204974462

+ 17
- 0
src/gallium/auxiliary/gallivm/lp_bld_gather.c Ver fichero

@@ -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;
}

+ 4
- 0
src/gallium/auxiliary/gallivm/lp_bld_gather.h Ver fichero

@@ -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_ */

Cargando…
Cancelar
Guardar