Fix OpenCL C for 32bit targets without 64bit doubles
Pekka Jääskeläinen
pekka.jaaskelainen at tut.fi
Wed Dec 18 10:26:52 PST 2013
On 12/17/2013 06:53 PM, Erik Schnetter wrote:
> 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.
Perhaps those can be derived from the same implicit check.
If double is 64bit, then enable cl_khr_fp64 extension by
default, and same for cl_khr_int64?
> Is it possible to disable double and long in clang without causing
> major breakage? If not, the patch is fine.
I do not think so. The problem is that C introduces double
so one has to support it at the language level. However,
C does not force double to be larger than float in size.
This problem was exposed for me due to the fact that all float
args to undeclared function calls (including varargs in
printf) are promoted to double by C (and thus also in
OpenCL C), causing illegal fp64 code to be generated for TCE
when OpenCL C printf was called with float arguments.
Committed in r197592.
Thanks,
--
--Pekka
More information about the llvm-commits
mailing list