}
extern "C" LLVMBuilderRef
-lp_create_builder(LLVMContextRef ctx, bool unsafe_fpmath)
+lp_create_builder(LLVMContextRef ctx, enum lp_float_mode float_mode)
{
LLVMBuilderRef builder = LLVMCreateBuilderInContext(ctx);
#if HAVE_LLVM >= 0x0308
- if (unsafe_fpmath) {
- llvm::FastMathFlags flags;
+ llvm::FastMathFlags flags;
+
+ switch (float_mode) {
+ case LP_FLOAT_MODE_DEFAULT:
+ break;
+ case LP_FLOAT_MODE_NO_SIGNED_ZEROS_FP_MATH:
+ flags.setNoSignedZeros();
+ llvm::unwrap(builder)->setFastMathFlags(flags);
+ break;
+ case LP_FLOAT_MODE_UNSAFE_FP_MATH:
flags.setUnsafeAlgebra();
llvm::unwrap(builder)->setFastMathFlags(flags);
+ break;
}
#endif
extern bool
lp_is_function(LLVMValueRef v);
+enum lp_float_mode {
+ LP_FLOAT_MODE_DEFAULT,
+ LP_FLOAT_MODE_NO_SIGNED_ZEROS_FP_MATH,
+ LP_FLOAT_MODE_UNSAFE_FP_MATH,
+};
+
extern LLVMBuilderRef
-lp_create_builder(LLVMContextRef ctx, bool unsafe_fpmath);
+lp_create_builder(LLVMContextRef ctx, enum lp_float_mode float_mode);
#ifdef __cplusplus
}
#endif
bool unsafe_fpmath = (sscreen->b.debug_flags & DBG_UNSAFE_MATH) != 0;
+ enum lp_float_mode float_mode =
+ unsafe_fpmath ? LP_FLOAT_MODE_UNSAFE_FP_MATH :
+ LP_FLOAT_MODE_DEFAULT;
+
ctx->gallivm.builder = lp_create_builder(ctx->gallivm.context,
- unsafe_fpmath);
+ float_mode);
ac_llvm_context_init(&ctx->ac, ctx->gallivm.context);
ctx->ac.module = ctx->gallivm.module;