summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorAlexey Bataev <a.bataev@hotmail.com>2019-07-09 14:09:53 +0000
committerAlexey Bataev <a.bataev@hotmail.com>2019-07-09 14:09:53 +0000
commite509af3cd6c92fd9607415fa40d158254fe93fec (patch)
tree2111a0f628bda0acafaeaa4bee505769f9d65ca9 /clang/lib
parente6d10f97dd85c17e81e384b6fb42d201221d7baa (diff)
downloadbcm5719-llvm-e509af3cd6c92fd9607415fa40d158254fe93fec.tar.gz
bcm5719-llvm-e509af3cd6c92fd9607415fa40d158254fe93fec.zip
[OPENMP]Fix the float point semantics handling on the device.
The device should use the same float point representation as the host. Previous patch fixed the handling of the sizes of the float point types, but did not fixed the fp semantics. This patch makes target device to use the host fp semantics. this is required for the correct data transfer between host and device and correct codegen. llvm-svn: 365485
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/AST/ASTContext.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp
index cf0221542f2..ea13dcb6506 100644
--- a/clang/lib/AST/ASTContext.cpp
+++ b/clang/lib/AST/ASTContext.cpp
@@ -1524,8 +1524,16 @@ const llvm::fltSemantics &ASTContext::getFloatTypeSemantics(QualType T) const {
return Target->getHalfFormat();
case BuiltinType::Float: return Target->getFloatFormat();
case BuiltinType::Double: return Target->getDoubleFormat();
- case BuiltinType::LongDouble: return Target->getLongDoubleFormat();
- case BuiltinType::Float128: return Target->getFloat128Format();
+ case BuiltinType::LongDouble:
+ if (getLangOpts().OpenMP && getLangOpts().OpenMPIsDevice &&
+ &Target->getLongDoubleFormat() != &AuxTarget->getLongDoubleFormat())
+ return AuxTarget->getLongDoubleFormat();
+ return Target->getLongDoubleFormat();
+ case BuiltinType::Float128:
+ if (getLangOpts().OpenMP && getLangOpts().OpenMPIsDevice &&
+ &Target->getFloat128Format() != &AuxTarget->getFloat128Format())
+ return AuxTarget->getFloat128Format();
+ return Target->getFloat128Format();
}
}
OpenPOWER on IntegriCloud