r197592 - OpenCL: Do not force 64 bit floats for (embedded) targets with only 32bit floats.
Pekka Jaaskelainen
pekka.jaaskelainen at tut.fi
Wed Dec 18 10:15:03 PST 2013
Author: pjaaskel
Date: Wed Dec 18 12:15:03 2013
New Revision: 197592
URL: http://llvm.org/viewvc/llvm-project?rev=197592&view=rev
Log:
OpenCL: Do not force 64 bit floats for (embedded) targets with only 32bit floats.
Modified:
cfe/trunk/lib/Basic/TargetInfo.cpp
Modified: cfe/trunk/lib/Basic/TargetInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/TargetInfo.cpp?rev=197592&r1=197591&r2=197592&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/TargetInfo.cpp (original)
+++ cfe/trunk/lib/Basic/TargetInfo.cpp Wed Dec 18 12:15:03 2013
@@ -244,7 +244,14 @@ void TargetInfo::setForcedLangOptions(La
LongLongWidth = LongLongAlign = 128;
HalfWidth = HalfAlign = 16;
FloatWidth = FloatAlign = 32;
- DoubleWidth = DoubleAlign = 64;
+
+ // Embedded 32-bit targets (OpenCL EP) might have double C type
+ // defined as float. Let's not override this as it might lead
+ // to generating illegal code that uses 64bit doubles.
+ if (DoubleWidth != FloatWidth) {
+ DoubleWidth = DoubleAlign = 64;
+ DoubleFormat = &llvm::APFloat::IEEEdouble;
+ }
LongDoubleWidth = LongDoubleAlign = 128;
assert(PointerWidth == 32 || PointerWidth == 64);
@@ -259,7 +266,6 @@ void TargetInfo::setForcedLangOptions(La
HalfFormat = &llvm::APFloat::IEEEhalf;
FloatFormat = &llvm::APFloat::IEEEsingle;
- DoubleFormat = &llvm::APFloat::IEEEdouble;
LongDoubleFormat = &llvm::APFloat::IEEEquad;
}
}
More information about the cfe-commits
mailing list