llvmpipe: Simpler variant of lp_build_broadcast_scalar.

This commit is contained in:
José Fonseca 2009-08-19 17:57:07 +01:00
parent 17baa01bfb
commit 6f5cd15f80
2 changed files with 25 additions and 0 deletions

View File

@ -34,6 +34,25 @@
#include "lp_bld_swizzle.h"
LLVMValueRef
lp_build_broadcast(LLVMBuilderRef builder,
LLVMTypeRef vec_type,
LLVMValueRef scalar)
{
const unsigned n = LLVMGetVectorSize(vec_type);
LLVMValueRef res;
unsigned i;
res = LLVMGetUndef(vec_type);
for(i = 0; i < n; ++i) {
LLVMValueRef index = LLVMConstInt(LLVMInt32Type(), i, 0);
res = LLVMBuildInsertElement(builder, res, scalar, index, "");
}
return res;
}
LLVMValueRef
lp_build_broadcast_scalar(struct lp_build_context *bld,
LLVMValueRef scalar)

View File

@ -44,6 +44,12 @@ union lp_type type;
struct lp_build_context;
LLVMValueRef
lp_build_broadcast(LLVMBuilderRef builder,
LLVMTypeRef vec_type,
LLVMValueRef scalar);
LLVMValueRef
lp_build_broadcast_scalar(struct lp_build_context *bld,
LLVMValueRef scalar);