Fix OpenCL C for 32bit targets without 64bit doubles

Erik Schnetter schnetter at
Tue Dec 17 08:53:14 PST 2013

On Dec 17, 2013, at 5:13 , Pekka Jääskeläinen <pekka.jaaskelainen at> wrote:

> Hi,
> The attached patch ensures we do not override target's setting for
> double with OpenCL C in case it is set to be the same as FloatWidth.
> This can happen with 32bit targets (currently at least TCE in LLVM)
> that define double as float, and thus might support only the
> OpenCL EP or just do not support the fp64 extension of OpenCL.
> Good to commit?

Ideally, clang would record at this place whether OpenCL double (and long) are supported. This is a target-dependent property, and this routine (which may override target-specific settings) would be a good place to do so. Currently, this fact is only implicitly recorded via the condition sizeof(double)!=sizeof(float).

Later, the default values of the cl_khr_float64 and cl_khr_int64 attributes can then be set accordingly.

Is it possible to disable double and long in clang without causing major breakage? If not, the patch is fine.


Erik Schnetter <schnetter at>

My email is as private as my paper mail. I therefore support encrypting
and signing email messages. Get my PGP key from

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 203 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <>

More information about the llvm-commits mailing list