[PATCH] D96524: [OpenCL] Add support of OpenCL C 3.0 __opencl_c_fp64

Anastasia Stulova via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon May 10 07:56:53 PDT 2021


Anastasia added inline comments.


================
Comment at: clang/include/clang/Basic/DiagnosticCommonKinds.td:369
+def err_opencl_extension_and_feature_differs : Error<
+  "Options %0 and %1 are set to different values which is illegal in OpenCL C 3.0">;
 }
----------------
We don't normally start from the upper case:

`Options` -> `options`

I am thinking we could drop "which is illegal in OpenCL C 3.0" because the fact that compiler gives an error indicates that it is illegal. So I find it a bit redundant.


================
Comment at: clang/include/clang/Basic/DiagnosticSemaKinds.td:121
 def warn_double_const_requires_fp64 : Warning<
-  "double precision constant requires cl_khr_fp64, casting to single precision">;
+  "double precision constant requires %select{cl_khr_fp64|__opencl_c_fp64}0, "
+  "casting to single precision">;
----------------
I am thinking that in OpenCL 3 both `cl_khr_fp64` and `__opencl_c_fp64` are required. Maybe we should re-word this as follows?



================
Comment at: clang/lib/Sema/Sema.cpp:306
+    // Set conditionally to provide correct diagnostics for 'double' type
+    llvm::StringRef FP64Feature(
+        getLangOpts().OpenCLVersion >= 300 ? "__opencl_c_fp64" : "cl_khr_fp64");
----------------
Technically both "__opencl_c_fp64" and "cl_khr_fp64" are required in OpenCL, perhaps we should report both in OpenCL 3?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D96524/new/

https://reviews.llvm.org/D96524



More information about the cfe-commits mailing list