Permalink
Browse files

Add fast-math.

  • Loading branch information...
sletz committed Sep 9, 2017
1 parent cf60110 commit 1aa96a2088ed1c6eb918b7f292f4571aecdfc6da
Showing with 21 additions and 2 deletions.
  1. +8 −1 Source/Runtime/LLVMEmitIR.cpp
  2. +13 −1 Source/Runtime/LLVMJIT.cpp
@@ -122,7 +122,12 @@ namespace LLVMJIT
, functionInstance(inFunctionInstance)
, llvmFunction(inLLVMFunction)
, irBuilder(context)
{}
{
// SL : fast-math a IR level
llvm::FastMathFlags FMF;
FMF.setUnsafeAlgebra();
irBuilder.setFastMathFlags(FMF);
}
void emit();
@@ -776,6 +781,8 @@ namespace LLVMJIT
//
// Load/store operators
//
// SL : removed setVolatile
#define EMIT_LOAD_OP(valueTypeId,name,llvmMemoryType,naturalAlignmentLog2,conversionOp) \
void valueTypeId##_##name(LoadOrStoreImm<naturalAlignmentLog2> imm) \
View
@@ -752,7 +752,19 @@ namespace LLVMJIT
// our symbols can't be found in the JITed object file.
targetTriple += "-elf";
#endif
targetMachine = llvm::EngineBuilder().selectTarget(
// SL : fast-math a native level
llvm::TargetOptions targetOptions;
targetOptions.AllowFPOpFusion = llvm::FPOpFusion::Fast;
targetOptions.UnsafeFPMath = true;
targetOptions.NoInfsFPMath = true;
targetOptions.NoNaNsFPMath = true;
targetOptions.GuaranteedTailCallOpt = true;
targetOptions.NoTrappingFPMath = true;
targetOptions.FPDenormalMode = llvm::FPDenormal::IEEE;
targetMachine = llvm::EngineBuilder().setTargetOptions(targetOptions).selectTarget(
llvm::Triple(targetTriple),"",llvm::sys::getHostCPUName(),
#if defined(_WIN32) && !defined(_WIN64)
// Use SSE2 instead of the FPU on x86 for more control over how intermediate results are rounded.

0 comments on commit 1aa96a2

Please sign in to comment.