OpenCL allows half precision floating point type literals with suffices h or H when cl_khr_fp16 extension is enabled. This change supports that.
Differential Revision: http://reviews.llvm.org/D16865
Differential D16865
[OpenCL] Support half precision floating point type literal yaxunl on Feb 3 2016, 12:29 PM. Authored by
Details OpenCL allows half precision floating point type literals with suffices h or H when cl_khr_fp16 extension is enabled. This change supports that. Differential Revision: http://reviews.llvm.org/D16865
Diff Detail
Event Timeline
Comment Actions re-update diff. Accidentally dropped a line in test/SemaOpenCL/half.cl in the last update. Comment Actions I think a reference to Spec section would be nice somewhere either in code or test. Thanks!
Comment Actions Revised according to Anastasia's comments. I got difficulty diagnosing half literal as lexical error since the preprocessor and lexer do not know whether OpenCL extension cl_khr_fp16 is enabled or not, so I diagnose half literal used without cl_khr_fp16 enabled as semantic error and added tests to SemaOpenCL. Also I removed diagnostic for casting from half type since it is unnecessary. If half type value is created when cl_khr_fp16 is not enabled, it will be diagnosed before the cast expression is reached.
Comment Actions Can you add a test that tries to use half precision constants in non OpenCL C mode? Otherwise LGTM. |