When the --emit-c++ option is used, the state of the --opt=fast-math option is passed into the generated C++ code.
If --opt=fast-math is used then the generated code contains: #define ISPC_FAST_MATH 1 Otherwise it contains: #undef ISPC_FAST_MATH This allows the generic headers to support the user's request.
This commit is contained in:
committed by
Matt Pharr
parent
e431b07e04
commit
66d4c2ddd9
@@ -12,6 +12,8 @@
|
|||||||
//
|
//
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
|
#include "ispc.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#ifndef _MSC_VER
|
#ifndef _MSC_VER
|
||||||
@@ -2144,6 +2146,12 @@ bool CWriter::doInitialization(llvm::Module &M) {
|
|||||||
Out << " #include <alloca.h>\n";
|
Out << " #include <alloca.h>\n";
|
||||||
Out << "#endif\n\n";
|
Out << "#endif\n\n";
|
||||||
|
|
||||||
|
if (g->opt.fastMath) {
|
||||||
|
Out << "#define ISPC_FAST_MATH 1\n"
|
||||||
|
} else {
|
||||||
|
Out << "#undef ISPC_FAST_MATH\n"
|
||||||
|
}
|
||||||
|
|
||||||
Out << "#include \"" << includeName << "\"\n";
|
Out << "#include \"" << includeName << "\"\n";
|
||||||
|
|
||||||
Out << "\n/* Basic Library Function Declarations */\n";
|
Out << "\n/* Basic Library Function Declarations */\n";
|
||||||
|
|||||||
Reference in New Issue
Block a user