Don't enable llvm's UnsafeFPMath option when --opt=fast-math is supplied.
This was causing functions like round() to fail on SSE2, since it has code
that does:
x += 0x1.0p23f;
x -= 0x1.0p23f;
which was in turn being undesirably optimized away.
Fixes issue #211.
This commit is contained in:
7
ispc.cpp
7
ispc.cpp
@@ -355,8 +355,15 @@ Target::GetTargetMachine() const {
|
||||
#if defined(LLVM_3_1svn)
|
||||
std::string featuresString = attributes;
|
||||
llvm::TargetOptions options;
|
||||
#if 0
|
||||
// This was breaking e.g. round() on SSE2, where the code we want to
|
||||
// run wants to do:
|
||||
// x += 0x1.0p23f;
|
||||
// x -= 0x1.0p23f;
|
||||
// But then LLVM was optimizing this away...
|
||||
if (g->opt.fastMath == true)
|
||||
options.UnsafeFPMath = 1;
|
||||
#endif
|
||||
llvm::TargetMachine *targetMachine =
|
||||
target->createTargetMachine(triple, cpu, featuresString, options,
|
||||
relocModel);
|
||||
|
||||
Reference in New Issue
Block a user