[PATCH] D21698: [OpenCL] Allow disabling types and declarations associated with extensions

Yaxun Liu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Dec 14 14:17:21 PST 2016


yaxunl marked 6 inline comments as done.
yaxunl added inline comments.


================
Comment at: lib/Serialization/ASTReader.cpp:3167
     case OPENCL_EXTENSIONS:
-      // Later tables overwrite earlier ones.
-      OpenCLExtensions.swap(Record);
----------------
Anastasia wrote:
> Btw, OpenCLTypeExtMap and OpenCLTypeDeclMap don't have to be serialized?
Yes. I will add it.


================
Comment at: test/Parser/opencl-atomics-cl20.cl:51
 // expected-error at -28 {{use of type 'atomic_double' (aka '_Atomic(double)') requires cl_khr_int64_extended_atomics extension to be enabled}}
-// expected-error-re at -27 {{use of type 'atomic_intptr_t' (aka '_Atomic({{.+}})') requires cl_khr_int64_base_atomics extension to be enabled}}
-// expected-error-re at -28 {{use of type 'atomic_intptr_t' (aka '_Atomic({{.+}})') requires cl_khr_int64_extended_atomics extension to be enabled}}
-// expected-error-re at -28 {{use of type 'atomic_uintptr_t' (aka '_Atomic({{.+}})') requires cl_khr_int64_base_atomics extension to be enabled}}
-// expected-error-re at -29 {{use of type 'atomic_uintptr_t' (aka '_Atomic({{.+}})') requires cl_khr_int64_extended_atomics extension to be enabled}}
-// expected-error-re at -29 {{use of type 'atomic_size_t' (aka '_Atomic({{.+}})') requires cl_khr_int64_base_atomics extension to be enabled}}
-// expected-error-re at -30 {{use of type 'atomic_size_t' (aka '_Atomic({{.+}})') requires cl_khr_int64_extended_atomics extension to be enabled}}
-// expected-error-re at -30 {{use of type 'atomic_ptrdiff_t' (aka '_Atomic({{.+}})') requires cl_khr_int64_base_atomics extension to be enabled}}
-// expected-error-re at -31 {{use of type 'atomic_ptrdiff_t' (aka '_Atomic({{.+}})') requires cl_khr_int64_extended_atomics extension to be enabled}}
+#if __LP64__
+// expected-error-re at -28 {{use of type 'atomic_intptr_t' (aka '_Atomic({{.+}})') requires cl_khr_int64_base_atomics extension to be enabled}}
----------------
Anastasia wrote:
> yaxunl wrote:
> > Anastasia wrote:
> > > Why this change?
> > atomic_intptr_t etc. requires cl_khr_int64_extended_atomics only on 64 bit platforms.
> > 
> > This is a bug which was fixed by this patch.
> The spec says:
> "If the device address space is 64-bits, the data types atomic_intptr_t, atomic_uintptr_t,
> atomic_size_t and atomic_ptrdiff_t are supported if the cl_khr_int64_base_atomics and
> cl_khr_int64_extended_atomics extensions are supported."
> 
> This seems to be the same as long and double?
Yes. Use of long and double were correctly diagnosed if the corresponding extension was disabled but size_t/intptr_t/uintptr_t/ptrdiff_t was not. This patch fixes that.


https://reviews.llvm.org/D21698





More information about the cfe-commits mailing list