[PATCH] D27917: [OpenCL] Improve diagnostics for double type

Yaxun Liu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 26 07:30:27 PST 2017


yaxunl added a comment.

with the new pragma for associating types with extensions. This feature can be implemented by solely modify opencl-c.h by adding #pragma OPENCL EXTENSION cl_khr_fp64 : begin/end around vector double type definitions, e.g.

  #pragma OPENCL EXTENSION cl_khr_fp64 : begin
  typedef double double2 __attribute__((ext_vector_type(2)));
  typedef double double3 __attribute__((ext_vector_type(3)));
  typedef double double4 __attribute__((ext_vector_type(4)));
  typedef double double8 __attribute__((ext_vector_type(8)));
  typedef double double16 __attribute__((ext_vector_type(16)));
  #pragma OPENCL EXTENSION cl_khr_fp64 : end
  #ifdef cl_khr_fp64
  #if __OPENCL_C_VERSION__ < CL_VERSION_1_2
  #pragma OPENCL EXTENSION cl_khr_fp64 : enable
  #endif
  #endif

The

  #pragma OPENCL EXTENSION cl_khr_fp64 : enable

is for suppressing diagnostics due to using double type in builtin functions. Ideally they should also be surrounded by #pragma OPENCL EXTENSION cl_khr_fp64 : begin/end.


https://reviews.llvm.org/D27917





More information about the cfe-commits mailing list