[Mesa-dev] [PATCH 2/3] gallivm: add lp_create_builder with an unsafe_fpmath option
Marek Olšák
maraeo at gmail.com
Sun Nov 13 16:13:16 UTC 2016
From: Marek Olšák <marek.olsak at amd.com>
---
src/gallium/auxiliary/gallivm/lp_bld_misc.cpp | 14 ++++++++++++++
src/gallium/auxiliary/gallivm/lp_bld_misc.h | 3 +++
2 files changed, 17 insertions(+)
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
index bd4d4d3..da3cbdd 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
+++ b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
@@ -726,10 +726,24 @@ lp_get_called_value(LLVMValueRef call)
extern "C" bool
lp_is_function(LLVMValueRef v)
{
#if HAVE_LLVM >= 0x0309
return LLVMGetValueKind(v) == LLVMFunctionValueKind;
#else
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 a55c6bd..c499a6f 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_misc.h
+++ b/src/gallium/auxiliary/gallivm/lp_bld_misc.h
@@ -75,16 +75,19 @@ lp_free_memory_manager(LLVMMCJITMemoryManagerRef memorymgr);
extern void
lp_add_attr_dereferenceable(LLVMValueRef val, uint64_t bytes);
extern LLVMValueRef
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
#endif /* !LP_BLD_MISC_H */
--
2.7.4
More information about the mesa-dev
mailing list