summaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary/gallivm
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2017-01-29 22:45:36 +0100
committerMarek Olšák <[email protected]>2017-02-21 21:27:23 +0100
commitfd3e73f54e323d5de182bf6cdb6094c2fd7362b3 (patch)
tree1dd7f363ca9902fa441ba4ac87ca7e495f9cedbd /src/gallium/auxiliary/gallivm
parent84e72f2962eab5eeb8b331e7a5d6eccaa7b8f5be (diff)
gallivm: add no-signed-zeros-fp-math option to lp_create_builder (v2)
v2: define lp_float_mode Reviewed-by: Nicolai Hähnle <[email protected]>
Diffstat (limited to 'src/gallium/auxiliary/gallivm')
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_misc.cpp15
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_misc.h8
2 files changed, 19 insertions, 4 deletions
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
index e005469a565..444686fdc79 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
+++ b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
@@ -781,15 +781,24 @@ lp_is_function(LLVMValueRef v)
}
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
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_misc.h b/src/gallium/auxiliary/gallivm/lp_bld_misc.h
index c499a6f51eb..6abb30d73fa 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_misc.h
+++ b/src/gallium/auxiliary/gallivm/lp_bld_misc.h
@@ -82,8 +82,14 @@ lp_get_called_value(LLVMValueRef call);
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
}