Mesa (master): llvmpipe: Test lp_test_arit with LP_NATIVE_VECTOR_WIDTH.

Jose Fonseca jrfonseca at kemper.freedesktop.org
Fri Feb 17 16:24:25 UTC 2012


Module: Mesa
Branch: master
Commit: e648f5e197a62afeb9d86c36cc8337058e325d38
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=e648f5e197a62afeb9d86c36cc8337058e325d38

Author: José Fonseca <jfonseca at vmware.com>
Date:   Fri Feb 17 16:17:28 2012 +0000

llvmpipe: Test lp_test_arit with LP_NATIVE_VECTOR_WIDTH.

Instead of assuming 4 wide vectors.

---

 src/gallium/drivers/llvmpipe/lp_test_arit.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/gallium/drivers/llvmpipe/lp_test_arit.c b/src/gallium/drivers/llvmpipe/lp_test_arit.c
index 1b576a2..3030426 100644
--- a/src/gallium/drivers/llvmpipe/lp_test_arit.c
+++ b/src/gallium/drivers/llvmpipe/lp_test_arit.c
@@ -35,6 +35,7 @@
 #include "util/u_math.h"
 
 #include "gallivm/lp_bld.h"
+#include "gallivm/lp_bld_debug.h"
 #include "gallivm/lp_bld_init.h"
 #include "gallivm/lp_bld_arit.h"
 
@@ -194,9 +195,10 @@ build_unary_test_func(struct gallivm_state *gallivm,
                       LLVMContextRef context,
                       const struct unary_test_t *test)
 {
+   struct lp_type type = lp_type_float_vec(32);
    LLVMTypeRef i32t = LLVMInt32TypeInContext(context);
    LLVMTypeRef f32t = LLVMFloatTypeInContext(context);
-   LLVMTypeRef v4f32t = LLVMVectorType(f32t, 4);
+   LLVMTypeRef vf32t = lp_build_vec_type(gallivm, type);
    LLVMTypeRef args[1] = { f32t };
    LLVMValueRef func = LLVMAddFunction(module, test->name, LLVMFunctionType(f32t, args, Elements(args), 0));
    LLVMValueRef arg1 = LLVMGetParam(func, 0);
@@ -207,14 +209,14 @@ build_unary_test_func(struct gallivm_state *gallivm,
 
    struct lp_build_context bld;
 
-   lp_build_context_init(&bld, gallivm, lp_float32_vec4_type());
+   lp_build_context_init(&bld, gallivm, lp_type_float_vec(32));
 
    LLVMSetFunctionCallConv(func, LLVMCCallConv);
 
    LLVMPositionBuilderAtEnd(builder, block);
    
    /* scalar to vector */
-   arg1 = LLVMBuildInsertElement(builder, LLVMGetUndef(v4f32t), arg1, index0, "");
+   arg1 = LLVMBuildInsertElement(builder, LLVMGetUndef(vf32t), arg1, index0, "");
 
    ret = test->builder(&bld, arg1);
    




More information about the mesa-commit mailing list