diff options
author | José Fonseca <[email protected]> | 2009-09-29 17:26:20 +0100 |
---|---|---|
committer | José Fonseca <[email protected]> | 2009-09-29 17:28:15 +0100 |
commit | baddcbc5225e12052b3bc8c07a8b65243d76574d (patch) | |
tree | 7c38c5440f040bfca2b8094f9d7676fd4bb9ba3b /src/gallium/drivers/llvmpipe/lp_jit.c | |
parent | a02ecdf8c2fc5783a4bc82e8cd9d36f0dec7ccec (diff) |
llvmpipe: Workaround for bug in llvm 2.5.
The combination of fptosi
and sitofp (necessary for trunc/floor/ceil/round implementation)
somehow becomes invalid code.
Skip the instruction combining pass when SSE4.1 is not available.
Diffstat (limited to 'src/gallium/drivers/llvmpipe/lp_jit.c')
-rw-r--r-- | src/gallium/drivers/llvmpipe/lp_jit.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/gallium/drivers/llvmpipe/lp_jit.c b/src/gallium/drivers/llvmpipe/lp_jit.c index 5d2cf01e5bc..1126bf90b96 100644 --- a/src/gallium/drivers/llvmpipe/lp_jit.c +++ b/src/gallium/drivers/llvmpipe/lp_jit.c @@ -150,6 +150,12 @@ lp_jit_screen_init(struct llvmpipe_screen *screen) util_cpu_detect(); +#if 0 + /* For simulating less capable machines */ + util_cpu_caps.has_sse3 = 0; + util_cpu_caps.has_sse4_1 = 0; +#endif + #ifdef LLVM_NATIVE_ARCH LLVMLinkInJIT(); LLVMInitializeNativeTarget(); @@ -171,8 +177,15 @@ lp_jit_screen_init(struct llvmpipe_screen *screen) LLVMAddTargetData(screen->target, screen->pass); /* These are the passes currently listed in llvm-c/Transforms/Scalar.h, * but there are more on SVN. */ + /* TODO: Add more passes */ LLVMAddConstantPropagationPass(screen->pass); - LLVMAddInstructionCombiningPass(screen->pass); + if(util_cpu_caps.has_sse4_1) { + /* FIXME: There is a bug in this pass, whereby the combination of fptosi + * and sitofp (necessary for trunc/floor/ceil/round implementation) + * somehow becomes invalid code. + */ + LLVMAddInstructionCombiningPass(screen->pass); + } LLVMAddPromoteMemoryToRegisterPass(screen->pass); LLVMAddGVNPass(screen->pass); LLVMAddCFGSimplificationPass(screen->pass); |