gallivm: Use new LLVM fast-math-flags API
authorTobias Droste <tdroste@gmx.de>
Wed, 8 Nov 2017 09:44:19 +0000 (10:44 +0100)
committerMichel Dänzer <michel.daenzer@amd.com>
Wed, 8 Nov 2017 09:44:19 +0000 (10:44 +0100)
LLVM 6 changed the API on the fast-math-flags:
https://reviews.llvm.org/rL317488

NOTE: This also enables the new flag 'ApproxFunc' to allow for
approximations for library functions (sin, cos, ...). I'm not completly
convinced, that this is something mesa should do.

Signed-off-by: Tobias Droste <tdroste@gmx.de>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-and-Tested-by: Michel Dänzer <michel.daenzer@amd.com>
src/gallium/auxiliary/gallivm/lp_bld_misc.cpp

index d988910a7ebc5cee649b74cf58e5e4924ab391af..13194072902a1302eb99f859c12c35822087423b 100644 (file)
@@ -830,7 +830,11 @@ lp_create_builder(LLVMContextRef ctx, enum lp_float_mode float_mode)
       llvm::unwrap(builder)->setFastMathFlags(flags);
       break;
    case LP_FLOAT_MODE_UNSAFE_FP_MATH:
+#if HAVE_LLVM >= 0x0600
+      flags.setFast();
+#else
       flags.setUnsafeAlgebra();
+#endif
       llvm::unwrap(builder)->setFastMathFlags(flags);
       break;
    }