From: Marek Olšák Date: Sat, 12 Nov 2016 22:08:51 +0000 (+0100) Subject: gallivm: add lp_create_builder with an unsafe_fpmath option X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=41d20d492087477fd1f0f03e12598970d95e6e1f;p=mesa.git gallivm: add lp_create_builder with an unsafe_fpmath option Reviewed-by: Nicolai Hähnle --- 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::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