summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/llvmpipe/lp_test_printf.c
diff options
context:
space:
mode:
authorChristian König <[email protected]>2010-10-12 23:05:25 +0200
committerChristian König <[email protected]>2010-10-12 23:07:29 +0200
commit695cc370a280a637f411f5ff3877b3fd1c05e424 (patch)
tree69ae2a8fbecfa553faba59274688ffe11ee1a612 /src/gallium/drivers/llvmpipe/lp_test_printf.c
parentf3e34ba6fba76870b1c91a27adb706d1b87aeec8 (diff)
parent48156b87bc9d3e09ec34372d69504a787332ea0b (diff)
Merge branch 'master' of ssh://git.freedesktop.org/git/mesa/mesa into pipe-video
Conflicts: configure.ac src/gallium/drivers/nvfx/Makefile src/gallium/include/pipe/p_defines.h src/gallium/include/pipe/p_screen.h src/gallium/include/state_tracker/dri1_api.h src/gallium/include/state_tracker/drm_api.h src/gallium/winsys/nouveau/drm/nouveau_drm_api.c
Diffstat (limited to 'src/gallium/drivers/llvmpipe/lp_test_printf.c')
-rw-r--r--src/gallium/drivers/llvmpipe/lp_test_printf.c28
1 files changed, 26 insertions, 2 deletions
diff --git a/src/gallium/drivers/llvmpipe/lp_test_printf.c b/src/gallium/drivers/llvmpipe/lp_test_printf.c
index e5e5925012a..4653f30e39d 100644
--- a/src/gallium/drivers/llvmpipe/lp_test_printf.c
+++ b/src/gallium/drivers/llvmpipe/lp_test_printf.c
@@ -29,7 +29,10 @@
#include <stdlib.h>
#include <stdio.h>
+#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 <llvm-c/Analysis.h>
@@ -41,6 +44,7 @@
struct printf_test_case {
+ int foo;
};
void
@@ -57,6 +61,7 @@ write_tsv_header(FILE *fp)
typedef void (*test_printf_t)(int i);
+
static LLVMValueRef
add_printf_test(LLVMModuleRef module)
{
@@ -71,6 +76,10 @@ 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));
+
+ /* 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;
@@ -91,6 +100,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");
@@ -103,11 +113,16 @@ 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
+ (void) provider;
+ engine = lp_build_engine;
+#endif
#if 0
pass = LLVMCreatePassManager();
@@ -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 = (test_printf_t)pointer_to_func(code);
memset(unpacked, 0, sizeof unpacked);
packed = 0;
@@ -147,7 +163,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);
@@ -160,3 +176,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;
+}