From c722029f3a54c2e619b95e3b02005a7d844bca43 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 12 May 2010 12:12:08 -0600 Subject: llvmpipe: s/bool/boolean/ in test progs --- src/gallium/drivers/llvmpipe/lp_test_printf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/gallium/drivers/llvmpipe/lp_test_printf.c') diff --git a/src/gallium/drivers/llvmpipe/lp_test_printf.c b/src/gallium/drivers/llvmpipe/lp_test_printf.c index e5e5925012a..666d414769d 100644 --- a/src/gallium/drivers/llvmpipe/lp_test_printf.c +++ b/src/gallium/drivers/llvmpipe/lp_test_printf.c @@ -147,7 +147,7 @@ test_printf(unsigned verbose, FILE *fp, const struct printf_test_case *testcase) boolean test_all(unsigned verbose, FILE *fp) { - bool success = TRUE; + boolean success = TRUE; test_printf(verbose, fp, NULL); -- cgit v1.2.3 From 966d28cb2e5e090d8f591810f331df0d05b06271 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 13 May 2010 13:21:19 -0600 Subject: llvmpipe: silence cast warnings in test programs --- src/gallium/drivers/llvmpipe/lp_test_blend.c | 19 +++++++++++++++++-- src/gallium/drivers/llvmpipe/lp_test_conv.c | 17 +++++++++++++++-- src/gallium/drivers/llvmpipe/lp_test_format.c | 15 ++++++++++++++- src/gallium/drivers/llvmpipe/lp_test_printf.c | 18 +++++++++++++++++- 4 files changed, 63 insertions(+), 6 deletions(-) (limited to 'src/gallium/drivers/llvmpipe/lp_test_printf.c') diff --git a/src/gallium/drivers/llvmpipe/lp_test_blend.c b/src/gallium/drivers/llvmpipe/lp_test_blend.c index d32a9223cda..072d699666b 100644 --- a/src/gallium/drivers/llvmpipe/lp_test_blend.c +++ b/src/gallium/drivers/llvmpipe/lp_test_blend.c @@ -52,6 +52,19 @@ enum vector_mode typedef void (*blend_test_ptr_t)(const void *src, const void *dst, const void *con, void *res); +/** cast wrapper */ +static blend_test_ptr_t +voidptr_to_blend_test_ptr_t(void *p) +{ + union { + void *v; + blend_test_ptr_t f; + } u; + u.v = p; + return u.f; +} + + void write_tsv_header(FILE *fp) @@ -482,6 +495,7 @@ test_one(unsigned verbose, int64_t cycles[LP_TEST_NUM_SAMPLES]; double cycles_avg = 0.0; unsigned i, j; + void *code; if(verbose >= 1) dump_blend_type(stdout, blend, mode, type); @@ -523,10 +537,11 @@ test_one(unsigned verbose, if(verbose >= 2) LLVMDumpModule(module); - blend_test_ptr = (blend_test_ptr_t)LLVMGetPointerToGlobal(engine, func); + code = LLVMGetPointerToGlobal(engine, func); + blend_test_ptr = voidptr_to_blend_test_ptr_t(code); if(verbose >= 2) - lp_disassemble(blend_test_ptr); + lp_disassemble(code); success = TRUE; for(i = 0; i < n && success; ++i) { diff --git a/src/gallium/drivers/llvmpipe/lp_test_conv.c b/src/gallium/drivers/llvmpipe/lp_test_conv.c index f8acda7bfd8..254f0daea3b 100644 --- a/src/gallium/drivers/llvmpipe/lp_test_conv.c +++ b/src/gallium/drivers/llvmpipe/lp_test_conv.c @@ -43,6 +43,17 @@ typedef void (*conv_test_ptr_t)(const void *src, const void *dst); +/** cast wrapper */ +static conv_test_ptr_t +voidptr_to_conv_test_ptr_t(void *p) +{ + union { + void *v; + conv_test_ptr_t f; + } u; + u.v = p; + return u.f; +} void write_tsv_header(FILE *fp) @@ -164,6 +175,7 @@ test_one(unsigned verbose, unsigned num_dsts; double eps; unsigned i, j; + void *code; if(verbose >= 1) dump_conv_types(stdout, src_type, dst_type); @@ -221,10 +233,11 @@ test_one(unsigned verbose, if(verbose >= 2) LLVMDumpModule(module); - conv_test_ptr = (conv_test_ptr_t)LLVMGetPointerToGlobal(engine, func); + code = LLVMGetPointerToGlobal(engine, func); + conv_test_ptr = voidptr_to_conv_test_ptr_t(code); if(verbose >= 2) - lp_disassemble(conv_test_ptr); + lp_disassemble(code); success = TRUE; for(i = 0; i < n && success; ++i) { diff --git a/src/gallium/drivers/llvmpipe/lp_test_format.c b/src/gallium/drivers/llvmpipe/lp_test_format.c index d5a81a941cf..267f1487bb8 100644 --- a/src/gallium/drivers/llvmpipe/lp_test_format.c +++ b/src/gallium/drivers/llvmpipe/lp_test_format.c @@ -73,6 +73,19 @@ typedef void (*fetch_ptr_t)(float *, const void *packed, unsigned i, unsigned j); +/** cast wrapper to avoid warnings */ +static fetch_ptr_t +void_to_fetch_ptr_t(void *p) +{ + union { + void *v; + fetch_ptr_t f; + } u; + u.v = p; + return u.f; +} + + static LLVMValueRef add_fetch_rgba_test(LLVMModuleRef lp_build_module, @@ -149,7 +162,7 @@ test_format(unsigned verbose, FILE *fp, (void)pass; #endif - fetch_ptr = (fetch_ptr_t) LLVMGetPointerToGlobal(lp_build_engine, fetch); + fetch_ptr = void_to_fetch_ptr_t(LLVMGetPointerToGlobal(lp_build_engine, fetch)); for (i = 0; i < desc->block.height; ++i) { for (j = 0; j < desc->block.width; ++j) { diff --git a/src/gallium/drivers/llvmpipe/lp_test_printf.c b/src/gallium/drivers/llvmpipe/lp_test_printf.c index 666d414769d..13485c37748 100644 --- a/src/gallium/drivers/llvmpipe/lp_test_printf.c +++ b/src/gallium/drivers/llvmpipe/lp_test_printf.c @@ -41,6 +41,7 @@ struct printf_test_case { + int foo; }; void @@ -57,6 +58,19 @@ write_tsv_header(FILE *fp) typedef void (*test_printf_t)(int i); +/** cast wrapper */ +static test_printf_t +voidptr_to_test_printf_t(void *p) +{ + union { + void *v; + test_printf_t f; + } u; + u.v = p; + return u.f; +} + + static LLVMValueRef add_printf_test(LLVMModuleRef module) { @@ -91,6 +105,7 @@ test_printf(unsigned verbose, FILE *fp, const struct printf_test_case *testcase) float unpacked[4]; unsigned packed; boolean success = TRUE; + void *code; module = LLVMModuleCreateWithName("test"); @@ -124,7 +139,8 @@ test_printf(unsigned verbose, FILE *fp, const struct printf_test_case *testcase) (void)pass; #endif - test_printf = (test_printf_t)LLVMGetPointerToGlobal(engine, test); + code = LLVMGetPointerToGlobal(engine, test); + test_printf = voidptr_to_test_printf_t(code); memset(unpacked, 0, sizeof unpacked); packed = 0; -- cgit v1.2.3 From f503b3dd9d6522abdabab1e25d0652c9d3079421 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Sun, 30 May 2010 16:38:23 +0100 Subject: llvmpipe: Use pointer_to_func() instead of custom wrappers. --- src/gallium/drivers/llvmpipe/lp_jit.h | 30 --------------------------- src/gallium/drivers/llvmpipe/lp_state_fs.c | 3 ++- src/gallium/drivers/llvmpipe/lp_test_conv.c | 14 ++----------- src/gallium/drivers/llvmpipe/lp_test_format.c | 16 ++------------ src/gallium/drivers/llvmpipe/lp_test_printf.c | 15 ++------------ 5 files changed, 8 insertions(+), 70 deletions(-) (limited to 'src/gallium/drivers/llvmpipe/lp_test_printf.c') diff --git a/src/gallium/drivers/llvmpipe/lp_jit.h b/src/gallium/drivers/llvmpipe/lp_jit.h index 8dee0413019..8d06e65725f 100644 --- a/src/gallium/drivers/llvmpipe/lp_jit.h +++ b/src/gallium/drivers/llvmpipe/lp_jit.h @@ -169,36 +169,6 @@ typedef void uint32_t *counter); -/** cast wrapper to avoid compiler warnings */ -static INLINE lp_jit_frag_func -cast_voidptr_to_lp_jit_frag_func(void *v) -{ - union { - void *v; - lp_jit_frag_func f; - } u; - assert(sizeof(u.v) == sizeof(u.f)); - u.v = v; - return u.f; -} - - -/** cast wrapper */ -static INLINE void * -cast_lp_jit_frag_func_to_voidptr(lp_jit_frag_func f) -{ - union { - void *v; - lp_jit_frag_func f; - } u; - assert(sizeof(u.v) == sizeof(u.f)); - u.f = f; - return u.v; -} - - - - void lp_jit_screen_cleanup(struct llvmpipe_screen *screen); diff --git a/src/gallium/drivers/llvmpipe/lp_state_fs.c b/src/gallium/drivers/llvmpipe/lp_state_fs.c index a7e7451983e..0e5fd179743 100644 --- a/src/gallium/drivers/llvmpipe/lp_state_fs.c +++ b/src/gallium/drivers/llvmpipe/lp_state_fs.c @@ -64,6 +64,7 @@ #include "pipe/p_defines.h" #include "util/u_inlines.h" #include "util/u_memory.h" +#include "util/u_pointer.h" #include "util/u_format.h" #include "util/u_dump.h" #include "os/os_time.h" @@ -873,7 +874,7 @@ generate_fragment(struct llvmpipe_context *lp, { void *f = LLVMGetPointerToGlobal(screen->engine, function); - variant->jit_function[do_tri_test] = cast_voidptr_to_lp_jit_frag_func(f); + variant->jit_function[do_tri_test] = (lp_jit_frag_func)pointer_to_func(f); if (gallivm_debug & GALLIVM_DEBUG_ASM) { lp_disassemble(f); diff --git a/src/gallium/drivers/llvmpipe/lp_test_conv.c b/src/gallium/drivers/llvmpipe/lp_test_conv.c index 254f0daea3b..cb0d02ab32c 100644 --- a/src/gallium/drivers/llvmpipe/lp_test_conv.c +++ b/src/gallium/drivers/llvmpipe/lp_test_conv.c @@ -34,6 +34,7 @@ */ +#include "util/u_pointer.h" #include "gallivm/lp_bld_type.h" #include "gallivm/lp_bld_const.h" #include "gallivm/lp_bld_conv.h" @@ -43,17 +44,6 @@ typedef void (*conv_test_ptr_t)(const void *src, const void *dst); -/** cast wrapper */ -static conv_test_ptr_t -voidptr_to_conv_test_ptr_t(void *p) -{ - union { - void *v; - conv_test_ptr_t f; - } u; - u.v = p; - return u.f; -} void write_tsv_header(FILE *fp) @@ -234,7 +224,7 @@ test_one(unsigned verbose, LLVMDumpModule(module); code = LLVMGetPointerToGlobal(engine, func); - conv_test_ptr = voidptr_to_conv_test_ptr_t(code); + conv_test_ptr = (conv_test_ptr_t)pointer_to_func(code); if(verbose >= 2) lp_disassemble(code); diff --git a/src/gallium/drivers/llvmpipe/lp_test_format.c b/src/gallium/drivers/llvmpipe/lp_test_format.c index e5f8bf96330..7c0d7d2e656 100644 --- a/src/gallium/drivers/llvmpipe/lp_test_format.c +++ b/src/gallium/drivers/llvmpipe/lp_test_format.c @@ -37,6 +37,7 @@ #include #include "util/u_memory.h" +#include "util/u_pointer.h" #include "util/u_format.h" #include "util/u_format_tests.h" #include "util/u_format_s3tc.h" @@ -73,19 +74,6 @@ typedef void (*fetch_ptr_t)(float *, const void *packed, unsigned i, unsigned j); -/** cast wrapper to avoid warnings */ -static fetch_ptr_t -void_to_fetch_ptr_t(void *p) -{ - union { - void *v; - fetch_ptr_t f; - } u; - u.v = p; - return u.f; -} - - static LLVMValueRef add_fetch_rgba_test(LLVMModuleRef lp_build_module, @@ -162,7 +150,7 @@ test_format(unsigned verbose, FILE *fp, (void)pass; #endif - fetch_ptr = void_to_fetch_ptr_t(LLVMGetPointerToGlobal(lp_build_engine, fetch)); + fetch_ptr = (fetch_ptr_t)pointer_to_func(LLVMGetPointerToGlobal(lp_build_engine, fetch)); for (i = 0; i < desc->block.height; ++i) { for (j = 0; j < desc->block.width; ++j) { diff --git a/src/gallium/drivers/llvmpipe/lp_test_printf.c b/src/gallium/drivers/llvmpipe/lp_test_printf.c index 13485c37748..d99ca816387 100644 --- a/src/gallium/drivers/llvmpipe/lp_test_printf.c +++ b/src/gallium/drivers/llvmpipe/lp_test_printf.c @@ -29,6 +29,7 @@ #include #include +#include "util/u_pointer.h" #include "gallivm/lp_bld.h" #include "gallivm/lp_bld_printf.h" @@ -58,18 +59,6 @@ write_tsv_header(FILE *fp) typedef void (*test_printf_t)(int i); -/** cast wrapper */ -static test_printf_t -voidptr_to_test_printf_t(void *p) -{ - union { - void *v; - test_printf_t f; - } u; - u.v = p; - return u.f; -} - static LLVMValueRef add_printf_test(LLVMModuleRef module) @@ -140,7 +129,7 @@ test_printf(unsigned verbose, FILE *fp, const struct printf_test_case *testcase) #endif code = LLVMGetPointerToGlobal(engine, test); - test_printf = voidptr_to_test_printf_t(code); + test_printf = (test_printf_t)pointer_to_func(code); memset(unpacked, 0, sizeof unpacked); packed = 0; -- cgit v1.2.3 From 4f067ada47bfeef792e5adbed4f3e215b704212a Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 4 Jun 2010 17:00:48 -0600 Subject: llvmpipe: new -s option to run single test Put specific test code in the test_single() function and pass -s to execute that code. --- src/gallium/drivers/llvmpipe/lp_test.h | 2 ++ src/gallium/drivers/llvmpipe/lp_test_blend.c | 8 ++++++++ src/gallium/drivers/llvmpipe/lp_test_conv.c | 26 ++++++++++++++++++++++++-- src/gallium/drivers/llvmpipe/lp_test_format.c | 8 ++++++++ src/gallium/drivers/llvmpipe/lp_test_main.c | 7 ++++++- src/gallium/drivers/llvmpipe/lp_test_printf.c | 8 ++++++++ src/gallium/drivers/llvmpipe/lp_test_sincos.c | 7 +++++++ 7 files changed, 63 insertions(+), 3 deletions(-) (limited to 'src/gallium/drivers/llvmpipe/lp_test_printf.c') diff --git a/src/gallium/drivers/llvmpipe/lp_test.h b/src/gallium/drivers/llvmpipe/lp_test.h index 338a04a4878..90422e42588 100644 --- a/src/gallium/drivers/llvmpipe/lp_test.h +++ b/src/gallium/drivers/llvmpipe/lp_test.h @@ -66,6 +66,8 @@ write_tsv_header(FILE *fp); boolean test_some(unsigned verbose, FILE *fp, unsigned long n); +boolean +test_single(unsigned verbose, FILE *fp); boolean test_all(unsigned verbose, FILE *fp); diff --git a/src/gallium/drivers/llvmpipe/lp_test_blend.c b/src/gallium/drivers/llvmpipe/lp_test_blend.c index 557eb8e3e6f..0c955556551 100644 --- a/src/gallium/drivers/llvmpipe/lp_test_blend.c +++ b/src/gallium/drivers/llvmpipe/lp_test_blend.c @@ -895,3 +895,11 @@ test_some(unsigned verbose, FILE *fp, unsigned long n) return success; } + + +boolean +test_single(unsigned verbose, FILE *fp) +{ + printf("no test_single()"); + return TRUE; +} diff --git a/src/gallium/drivers/llvmpipe/lp_test_conv.c b/src/gallium/drivers/llvmpipe/lp_test_conv.c index cb0d02ab32c..9b02f436c5b 100644 --- a/src/gallium/drivers/llvmpipe/lp_test_conv.c +++ b/src/gallium/drivers/llvmpipe/lp_test_conv.c @@ -260,10 +260,15 @@ test_one(unsigned verbose, success = FALSE; } - if (!success) { + if (!success || verbose >= 3) { if(verbose < 1) dump_conv_types(stderr, src_type, dst_type); - fprintf(stderr, "MISMATCH\n"); + if (success) { + fprintf(stderr, "PASS\n"); + } + else { + fprintf(stderr, "MISMATCH\n"); + } for(j = 0; j < num_srcs; ++j) { fprintf(stderr, " Src%u: ", j); @@ -429,3 +434,20 @@ test_some(unsigned verbose, FILE *fp, unsigned long n) return success; } + + +boolean +test_single(unsigned verbose, FILE *fp) +{ + /* float, fixed, sign, norm, width, len */ + struct lp_type f32x4_type = + { TRUE, FALSE, TRUE, TRUE, 32, 4 }; + struct lp_type ub8x4_type = + { FALSE, FALSE, FALSE, TRUE, 8, 16 }; + + boolean success; + + success = test_one(verbose, fp, f32x4_type, ub8x4_type); + + return success; +} diff --git a/src/gallium/drivers/llvmpipe/lp_test_format.c b/src/gallium/drivers/llvmpipe/lp_test_format.c index 7c0d7d2e656..8b6dc1c7f5d 100644 --- a/src/gallium/drivers/llvmpipe/lp_test_format.c +++ b/src/gallium/drivers/llvmpipe/lp_test_format.c @@ -269,3 +269,11 @@ test_some(unsigned verbose, FILE *fp, unsigned long n) { return test_all(verbose, fp); } + + +boolean +test_single(unsigned verbose, FILE *fp) +{ + printf("no test_single()"); + return TRUE; +} diff --git a/src/gallium/drivers/llvmpipe/lp_test_main.c b/src/gallium/drivers/llvmpipe/lp_test_main.c index f9dce8b9c25..7bbbc61d4c2 100644 --- a/src/gallium/drivers/llvmpipe/lp_test_main.c +++ b/src/gallium/drivers/llvmpipe/lp_test_main.c @@ -370,10 +370,13 @@ int main(int argc, char **argv) unsigned long n = 1000; unsigned i; boolean success; + boolean single = FALSE; for(i = 1; i < argc; ++i) { if(strcmp(argv[i], "-v") == 0) ++verbose; + else if(strcmp(argv[i], "-s") == 0) + single = TRUE; else if(strcmp(argv[i], "-o") == 0) fp = fopen(argv[++i], "wt"); else @@ -391,7 +394,9 @@ int main(int argc, char **argv) write_tsv_header(fp); } - if(n) + if (single) + success = test_single(verbose, fp); + else if (n) success = test_some(verbose, fp, n); else success = test_all(verbose, fp); diff --git a/src/gallium/drivers/llvmpipe/lp_test_printf.c b/src/gallium/drivers/llvmpipe/lp_test_printf.c index d99ca816387..21df83f9d89 100644 --- a/src/gallium/drivers/llvmpipe/lp_test_printf.c +++ b/src/gallium/drivers/llvmpipe/lp_test_printf.c @@ -165,3 +165,11 @@ test_some(unsigned verbose, FILE *fp, unsigned long n) { return test_all(verbose, fp); } + + +boolean +test_single(unsigned verbose, FILE *fp) +{ + printf("no test_single()"); + return TRUE; +} diff --git a/src/gallium/drivers/llvmpipe/lp_test_sincos.c b/src/gallium/drivers/llvmpipe/lp_test_sincos.c index da16fea7bd5..c7a903a0256 100644 --- a/src/gallium/drivers/llvmpipe/lp_test_sincos.c +++ b/src/gallium/drivers/llvmpipe/lp_test_sincos.c @@ -198,3 +198,10 @@ test_some(unsigned verbose, FILE *fp, unsigned long n) { return test_all(verbose, fp); } + +boolean +test_single(unsigned verbose, FILE *fp) +{ + printf("no test_single()"); + return TRUE; +} -- cgit v1.2.3 From d05cb9f0187984e461b41eb1ba6ca2adf0593c74 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 29 Jul 2010 12:49:12 -0600 Subject: llvmpipe: don't call LLVMCreateJITCompiler() twice Fixes a failed assertion with LLVM 2.6: ::JITResolver::JITResolver(llvm::JIT&): Assertion `TheJITResolver == 0&& "Multiple JIT resolvers?"' failed. Though, not everyone seems to experience this problem. --- src/gallium/drivers/llvmpipe/lp_test_blend.c | 14 ++------------ src/gallium/drivers/llvmpipe/lp_test_conv.c | 14 ++------------ src/gallium/drivers/llvmpipe/lp_test_printf.c | 6 ++++++ src/gallium/drivers/llvmpipe/lp_test_round.c | 12 ++---------- src/gallium/drivers/llvmpipe/lp_test_sincos.c | 13 ++----------- 5 files changed, 14 insertions(+), 45 deletions(-) (limited to 'src/gallium/drivers/llvmpipe/lp_test_printf.c') diff --git a/src/gallium/drivers/llvmpipe/lp_test_blend.c b/src/gallium/drivers/llvmpipe/lp_test_blend.c index 0c955556551..d0389f0cb0b 100644 --- a/src/gallium/drivers/llvmpipe/lp_test_blend.c +++ b/src/gallium/drivers/llvmpipe/lp_test_blend.c @@ -37,6 +37,7 @@ */ +#include "gallivm/lp_bld_init.h" #include "gallivm/lp_bld_type.h" #include "gallivm/lp_bld_debug.h" #include "lp_bld_blend.h" @@ -485,8 +486,7 @@ test_one(unsigned verbose, { LLVMModuleRef module = NULL; LLVMValueRef func = NULL; - LLVMExecutionEngineRef engine = NULL; - LLVMModuleProviderRef provider = NULL; + LLVMExecutionEngineRef engine = lp_build_engine; LLVMPassManagerRef pass = NULL; char *error = NULL; blend_test_ptr_t blend_test_ptr; @@ -510,15 +510,6 @@ test_one(unsigned verbose, } LLVMDisposeMessage(error); - provider = LLVMCreateModuleProviderForExistingModule(module); - if (LLVMCreateJITCompiler(&engine, provider, 1, &error)) { - if(verbose < 1) - dump_blend_type(stderr, blend, mode, type); - fprintf(stderr, "%s\n", error); - LLVMDisposeMessage(error); - abort(); - } - #if 0 pass = LLVMCreatePassManager(); LLVMAddTargetData(LLVMGetExecutionEngineTargetData(engine), pass); @@ -735,7 +726,6 @@ test_one(unsigned verbose, LLVMFreeMachineCodeForFunction(engine, func); - LLVMDisposeExecutionEngine(engine); if(pass) LLVMDisposePassManager(pass); diff --git a/src/gallium/drivers/llvmpipe/lp_test_conv.c b/src/gallium/drivers/llvmpipe/lp_test_conv.c index cf41b40581f..3ba42bf11a6 100644 --- a/src/gallium/drivers/llvmpipe/lp_test_conv.c +++ b/src/gallium/drivers/llvmpipe/lp_test_conv.c @@ -35,6 +35,7 @@ #include "util/u_pointer.h" +#include "gallivm/lp_bld_init.h" #include "gallivm/lp_bld_type.h" #include "gallivm/lp_bld_const.h" #include "gallivm/lp_bld_conv.h" @@ -152,8 +153,7 @@ test_one(unsigned verbose, { LLVMModuleRef module = NULL; LLVMValueRef func = NULL; - LLVMExecutionEngineRef engine = NULL; - LLVMModuleProviderRef provider = NULL; + LLVMExecutionEngineRef engine = lp_build_engine; LLVMPassManagerRef pass = NULL; char *error = NULL; conv_test_ptr_t conv_test_ptr; @@ -203,15 +203,6 @@ test_one(unsigned verbose, } LLVMDisposeMessage(error); - provider = LLVMCreateModuleProviderForExistingModule(module); - if (LLVMCreateJITCompiler(&engine, provider, 1, &error)) { - if(verbose < 1) - dump_conv_types(stderr, src_type, dst_type); - fprintf(stderr, "%s\n", error); - LLVMDisposeMessage(error); - abort(); - } - #if 0 pass = LLVMCreatePassManager(); LLVMAddTargetData(LLVMGetExecutionEngineTargetData(engine), pass); @@ -351,7 +342,6 @@ test_one(unsigned verbose, LLVMFreeMachineCodeForFunction(engine, func); - LLVMDisposeExecutionEngine(engine); if(pass) LLVMDisposePassManager(pass); diff --git a/src/gallium/drivers/llvmpipe/lp_test_printf.c b/src/gallium/drivers/llvmpipe/lp_test_printf.c index 21df83f9d89..62041f0301a 100644 --- a/src/gallium/drivers/llvmpipe/lp_test_printf.c +++ b/src/gallium/drivers/llvmpipe/lp_test_printf.c @@ -31,6 +31,7 @@ #include "util/u_pointer.h" #include "gallivm/lp_bld.h" +#include "gallivm/lp_bld_init.h" #include "gallivm/lp_bld_printf.h" #include @@ -74,6 +75,7 @@ add_printf_test(LLVMModuleRef module) lp_build_printf(builder, "hello, world\n"); lp_build_printf(builder, "print 5 6: %d %d\n", LLVMConstInt(LLVMInt32Type(), 5, 0), LLVMConstInt(LLVMInt32Type(), 6, 0)); + LLVMBuildRetVoid(builder); LLVMDisposeBuilder(builder); return func; @@ -107,11 +109,15 @@ test_printf(unsigned verbose, FILE *fp, const struct printf_test_case *testcase) LLVMDisposeMessage(error); provider = LLVMCreateModuleProviderForExistingModule(module); +#if 0 if (LLVMCreateJITCompiler(&engine, provider, 1, &error)) { fprintf(stderr, "%s\n", error); LLVMDisposeMessage(error); abort(); } +#else + engine = lp_build_engine; +#endif #if 0 pass = LLVMCreatePassManager(); diff --git a/src/gallium/drivers/llvmpipe/lp_test_round.c b/src/gallium/drivers/llvmpipe/lp_test_round.c index f571a81a4a4..57b0ee57767 100644 --- a/src/gallium/drivers/llvmpipe/lp_test_round.c +++ b/src/gallium/drivers/llvmpipe/lp_test_round.c @@ -31,7 +31,7 @@ #include "util/u_pointer.h" #include "gallivm/lp_bld.h" -#include "gallivm/lp_bld_printf.h" +#include "gallivm/lp_bld_init.h" #include "gallivm/lp_bld_arit.h" #include @@ -121,8 +121,7 @@ test_round(unsigned verbose, FILE *fp) { LLVMModuleRef module = NULL; LLVMValueRef test_round = NULL, test_trunc, test_floor, test_ceil; - LLVMExecutionEngineRef engine = NULL; - LLVMModuleProviderRef provider = NULL; + LLVMExecutionEngineRef engine = lp_build_engine; LLVMPassManagerRef pass = NULL; char *error = NULL; test_round_t round_func, trunc_func, floor_func, ceil_func; @@ -145,13 +144,6 @@ test_round(unsigned verbose, FILE *fp) } LLVMDisposeMessage(error); - provider = LLVMCreateModuleProviderForExistingModule(module); - if (LLVMCreateJITCompiler(&engine, provider, 1, &error)) { - fprintf(stderr, "%s\n", error); - LLVMDisposeMessage(error); - abort(); - } - #if 0 pass = LLVMCreatePassManager(); LLVMAddTargetData(LLVMGetExecutionEngineTargetData(engine), pass); diff --git a/src/gallium/drivers/llvmpipe/lp_test_sincos.c b/src/gallium/drivers/llvmpipe/lp_test_sincos.c index 1366ecddcbc..e93c1b7859d 100644 --- a/src/gallium/drivers/llvmpipe/lp_test_sincos.c +++ b/src/gallium/drivers/llvmpipe/lp_test_sincos.c @@ -30,7 +30,7 @@ #include #include "gallivm/lp_bld.h" -#include "gallivm/lp_bld_printf.h" +#include "gallivm/lp_bld_init.h" #include "gallivm/lp_bld_arit.h" #include @@ -101,8 +101,7 @@ test_sincos(unsigned verbose, FILE *fp) { LLVMModuleRef module = NULL; LLVMValueRef test_sin = NULL, test_cos = NULL; - LLVMExecutionEngineRef engine = NULL; - LLVMModuleProviderRef provider = NULL; + LLVMExecutionEngineRef engine = lp_build_engine; LLVMPassManagerRef pass = NULL; char *error = NULL; test_sincos_t sin_func; @@ -122,13 +121,6 @@ test_sincos(unsigned verbose, FILE *fp) } LLVMDisposeMessage(error); - provider = LLVMCreateModuleProviderForExistingModule(module); - if (LLVMCreateJITCompiler(&engine, provider, 1, &error)) { - fprintf(stderr, "%s\n", error); - LLVMDisposeMessage(error); - abort(); - } - #if 0 pass = LLVMCreatePassManager(); LLVMAddTargetData(LLVMGetExecutionEngineTargetData(engine), pass); @@ -162,7 +154,6 @@ test_sincos(unsigned verbose, FILE *fp) LLVMFreeMachineCodeForFunction(engine, test_sin); LLVMFreeMachineCodeForFunction(engine, test_cos); - LLVMDisposeExecutionEngine(engine); if(pass) LLVMDisposePassManager(pass); -- cgit v1.2.3 From 330852b3b33883b8fb22ce8c67efae79e64ce273 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 29 Jul 2010 12:51:34 -0600 Subject: llvmpipe: also test the new lp_build_assert() function --- src/gallium/drivers/llvmpipe/lp_test_printf.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/gallium/drivers/llvmpipe/lp_test_printf.c') diff --git a/src/gallium/drivers/llvmpipe/lp_test_printf.c b/src/gallium/drivers/llvmpipe/lp_test_printf.c index 62041f0301a..a3447bf53f9 100644 --- a/src/gallium/drivers/llvmpipe/lp_test_printf.c +++ b/src/gallium/drivers/llvmpipe/lp_test_printf.c @@ -32,6 +32,7 @@ #include "util/u_pointer.h" #include "gallivm/lp_bld.h" #include "gallivm/lp_bld_init.h" +#include "gallivm/lp_bld_assert.h" #include "gallivm/lp_bld_printf.h" #include @@ -76,6 +77,9 @@ add_printf_test(LLVMModuleRef module) lp_build_printf(builder, "print 5 6: %d %d\n", LLVMConstInt(LLVMInt32Type(), 5, 0), LLVMConstInt(LLVMInt32Type(), 6, 0)); + /* Also test lp_build_assert(). This should not fail. */ + lp_build_assert(builder, LLVMConstInt(LLVMInt32Type(), 1, 0), "assert(1)"); + LLVMBuildRetVoid(builder); LLVMDisposeBuilder(builder); return func; -- cgit v1.2.3 From 79ab5b9798c911e7612e26616df82e98372549bf Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Fri, 30 Jul 2010 13:11:14 -0700 Subject: llvmpipe: Silence unused value warning. --- src/gallium/drivers/llvmpipe/lp_test_printf.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src/gallium/drivers/llvmpipe/lp_test_printf.c') diff --git a/src/gallium/drivers/llvmpipe/lp_test_printf.c b/src/gallium/drivers/llvmpipe/lp_test_printf.c index a3447bf53f9..4653f30e39d 100644 --- a/src/gallium/drivers/llvmpipe/lp_test_printf.c +++ b/src/gallium/drivers/llvmpipe/lp_test_printf.c @@ -120,6 +120,7 @@ test_printf(unsigned verbose, FILE *fp, const struct printf_test_case *testcase) abort(); } #else + (void) provider; engine = lp_build_engine; #endif -- cgit v1.2.3