diff options
author | Marek Olšák <[email protected]> | 2016-11-12 23:08:51 +0100 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2016-11-15 19:17:56 +0100 |
commit | 41d20d492087477fd1f0f03e12598970d95e6e1f (patch) | |
tree | 9632e9435061180d78e31253128a745dfdd06506 /src | |
parent | 171e349782ab6b688c397f6bb76f105ac18a752a (diff) |
gallivm: add lp_create_builder with an unsafe_fpmath option
Reviewed-by: Nicolai Hähnle <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/gallium/auxiliary/gallivm/lp_bld_misc.cpp | 14 | ||||
-rw-r--r-- | src/gallium/auxiliary/gallivm/lp_bld_misc.h | 3 |
2 files changed, 17 insertions, 0 deletions
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp index bd4d4d3c094..da3cbdd53c5 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp +++ b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp @@ -733,3 +733,17 @@ lp_is_function(LLVMValueRef v) return llvm::isa<llvm::Function>(llvm::unwrap(v)); #endif } + +extern "C" LLVMBuilderRef +lp_create_builder(LLVMContextRef ctx, bool unsafe_fpmath) +{ + LLVMBuilderRef builder = LLVMCreateBuilderInContext(ctx); + + if (unsafe_fpmath) { + llvm::FastMathFlags flags; + flags.setUnsafeAlgebra(); + llvm::unwrap(builder)->setFastMathFlags(flags); + } + + return builder; +} diff --git a/src/gallium/auxiliary/gallivm/lp_bld_misc.h b/src/gallium/auxiliary/gallivm/lp_bld_misc.h index a55c6bd508d..c499a6f51eb 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_misc.h +++ b/src/gallium/auxiliary/gallivm/lp_bld_misc.h @@ -82,6 +82,9 @@ lp_get_called_value(LLVMValueRef call); extern bool lp_is_function(LLVMValueRef v); +extern LLVMBuilderRef +lp_create_builder(LLVMContextRef ctx, bool unsafe_fpmath); + #ifdef __cplusplus } #endif |