diff options
author | Fraser Cormack <fraser@codeplay.com> | 2015-01-30 10:51:46 +0000 |
---|---|---|
committer | Fraser Cormack <fraser@codeplay.com> | 2015-01-30 10:51:46 +0000 |
commit | cc6e894587ec5c4b995dc88d672556369bf833c7 (patch) | |
tree | 1b6856c8ef6e90af87230624adbc7c3a21a971ce /clang/lib/Sema/SemaExpr.cpp | |
parent | 9469a592ba5f7fbe65c3cb62bdce6401c278ee75 (diff) | |
download | bcm5719-llvm-cc6e894587ec5c4b995dc88d672556369bf833c7.tar.gz bcm5719-llvm-cc6e894587ec5c4b995dc88d672556369bf833c7.zip |
Fix OpenCL 1.2 double as an optional core feature behaviour
In OpenCL 1.2, using double no longer requires using the pragma cl_khr_fp64,
instead a kernel is allowed to use double, but must first have queried
clGetDeviceInfo's CL_DEVICE_DOUBLE_FP_CONFIG.
Page 197, section 6.1.1 of the OpenCL 1.2 specification has a footnote 23
describing this behaviour.
I've also added test cases such that the pragma must be used if targeting
OpenCL 1.0 or 1.1, but is ignored in 1.2 and 2.0.
Patch by Neil Henning!
Reviewers: Pekka Jääskeläinen
Differential Revision: http://reviews.llvm.org/D7245
llvm-svn: 227565
Diffstat (limited to 'clang/lib/Sema/SemaExpr.cpp')
-rw-r--r-- | clang/lib/Sema/SemaExpr.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp index 08b58850232..fb340e701b7 100644 --- a/clang/lib/Sema/SemaExpr.cpp +++ b/clang/lib/Sema/SemaExpr.cpp @@ -3266,7 +3266,9 @@ ExprResult Sema::ActOnNumericConstant(const Token &Tok, Scope *UDLScope) { if (Ty == Context.DoubleTy) { if (getLangOpts().SinglePrecisionConstants) { Res = ImpCastExprToType(Res, Context.FloatTy, CK_FloatingCast).get(); - } else if (getLangOpts().OpenCL && !getOpenCLOptions().cl_khr_fp64) { + } else if (getLangOpts().OpenCL && + !((getLangOpts().OpenCLVersion >= 120) || + getOpenCLOptions().cl_khr_fp64)) { Diag(Tok.getLocation(), diag::warn_double_const_requires_fp64); Res = ImpCastExprToType(Res, Context.FloatTy, CK_FloatingCast).get(); } |