Hi,

The attached patch adds support for the OpenCL option -cl-denorms-are-zero.
The spec defines this flag as an optimization hint, and it is up to the
compiler to decided whether or not to flush denormals.  For now, this flag
is a no-op.

-Tom
>From 2d7427fbfa54d54639722da547f060f6ff3f701d Mon Sep 17 00:00:00 2001
From: Tom Stellard <[email protected]>
Date: Tue, 19 Aug 2014 10:14:45 -0700
Subject: [PATCH] Driver: Implement -cl-denorms-are-zero

This is currently a no-op, which is allowed by the OpenCL specification.
---
 include/clang/Driver/CC1Options.td     | 2 ++
 test/CodeGenOpenCL/denorms-are-zero.cl | 5 +++++
 2 files changed, 7 insertions(+)
 create mode 100644 test/CodeGenOpenCL/denorms-are-zero.cl

diff --git a/include/clang/Driver/CC1Options.td b/include/clang/Driver/CC1Options.td
index 6e0c7b2..1747888 100644
--- a/include/clang/Driver/CC1Options.td
+++ b/include/clang/Driver/CC1Options.td
@@ -574,6 +574,8 @@ def cl_mad_enable : Flag<["-"], "cl-mad-enable">,
   HelpText<"OpenCL only. Enable less precise MAD instructions to be generated.">;
 def cl_std_EQ : Joined<["-"], "cl-std=">,
   HelpText<"OpenCL language standard to compile for">;
+def cl_denorms_are_zero : Flag<["-"], "cl-denorms-are-zero">,
+  HelpText<"OpenCL only. Allow denormals to be flushed to zero">;
 
 //===----------------------------------------------------------------------===//
 // CUDA Options
diff --git a/test/CodeGenOpenCL/denorms-are-zero.cl b/test/CodeGenOpenCL/denorms-are-zero.cl
new file mode 100644
index 0000000..488004f
--- /dev/null
+++ b/test/CodeGenOpenCL/denorms-are-zero.cl
@@ -0,0 +1,5 @@
+// RUN: %clang_cc1 -S -cl-denorms-are-zero -o - %s 2>&1
+
+// This test just checks that the -cl-denorms-are-zero argument is accepted
+// by clang.  This option is currently a no-op, which is allowed by the
+// OpenCL specification.
-- 
1.8.3.1

_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to