Ok to merge r197592 into 3.4 branch
Tom Stellard
tom at stellard.net
Wed Mar 26 09:40:30 PDT 2014
Hi Doug,
Since you are the default code owner for TargetInfo, do you approve
merging r197592 into the 3.4 branch:
OpenCL: Do not force 64 bit floats for (embedded) targets with only 32bit floats.
diff --git a/lib/Basic/TargetInfo.cpp b/lib/Basic/TargetInfo.cpp
index d0ed6e6..7ee2706 100644
--- a/lib/Basic/TargetInfo.cpp
+++ b/lib/Basic/TargetInfo.cpp
@@ -244,7 +244,14 @@ void TargetInfo::setForcedLangOptions(LangOptions
&Opts) {
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(LangOptions
&Opts) {
HalfFormat = &llvm::APFloat::IEEEhalf;
FloatFormat = &llvm::APFloat::IEEEsingle;
- DoubleFormat = &llvm::APFloat::IEEEdouble;
LongDoubleFormat = &llvm::APFloat::IEEEquad;
}
}
Thanks,
Tom
More information about the cfe-commits
mailing list