[PATCH] D60763: Prototype OpenCL BIFs using Tablegen

Nicola Zaghen via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 25 05:04:16 PDT 2019

Nicola added inline comments.

Comment at: clang/include/clang/Basic/OpenCLBuiltins.td:140-144
+class RoundingModes<Type _Ty1, Type _Ty2> {
+  list<string> Modes = !if(!or(_Ty1.HasRounding, _Ty2.HasRounding),
+                          ["", "_rte", "_rtz", "_rtp", "_rtn"],
+                          [""]);
I think the CL standard (1.2, section specifies that RoundingModes should be available on all convert_ functions, not only selectively based on types: "Conversions may have an optional rounding mode modifier described in table 6.6. "

Comment at: clang/include/clang/Basic/OpenCLBuiltins.td:211-212
+  def float_t   : Type<"float", QualType<"field", "FloatTy">>;
+  def double_t  : Type<"double", QualType<"field", "DoubleTy">>;
+  def half_t    : Type<"half", QualType<"field", "HalfTy">>;
Can half and double types and builtins be made dependent on extensions or configurable? The half datatype needs the cl_khr_fp16 extension, while double needs CL_DEVICE_DOUBLE_FP_CONFIG or cl_khr_fp64



More information about the cfe-commits mailing list