[PATCH] D24235: [OpenCL] Improve double literal handling

Anastasia Stulova via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 7 10:25:35 PDT 2016


Anastasia added inline comments.

================
Comment at: lib/Sema/SemaExpr.cpp:832
@@ -831,2 +831,3 @@
               BTy->getKind() == BuiltinType::Float))
-    E = ImpCastExprToType(E, Context.DoubleTy, CK_FloatingCast).get();
+  {
+    if (getLangOpts().OpenCL &&
----------------
This should go on the previous line.

================
Comment at: lib/Sema/SemaExpr.cpp:837
@@ +836,3 @@
+               .getSupportedOpenCLOpts()
+               .cl_khr_fp64) ||
+          getOpenCLOptions().cl_khr_fp64)) {
----------------
Could we merge this and two lines above into one?

================
Comment at: lib/Sema/SemaExpr.cpp:840
@@ +839,3 @@
+        E = ImpCastExprToType(E, Context.FloatTy, CK_FloatingCast).get();
+    }
+    else
----------------
I think the formatting is not right here.

Could you change to:
  } else {

================
Comment at: test/CodeGenOpenCL/fpmath.cl:28
@@ +27,3 @@
+void testdbllit(long *val) {
+  // CHECK-DBL: float 2.000000e+01
+  printf("%f", 20.0);
----------------
Could you please add a check that double is generated in either CL2.0 or fp64 mode.


https://reviews.llvm.org/D24235





More information about the cfe-commits mailing list