[PATCH] AMDGCN: Define cl_khr_fp64 when compiling OpenCL programs

Tom Stellard thomas.stellard at amd.com
Thu Feb 26 17:00:24 PST 2015


---
 lib/Basic/Targets.cpp    | 2 ++
 test/Preprocessor/init.c | 3 +++
 2 files changed, 5 insertions(+)

diff --git a/lib/Basic/Targets.cpp b/lib/Basic/Targets.cpp
index 03cd853..e828918 100644
--- a/lib/Basic/Targets.cpp
+++ b/lib/Basic/Targets.cpp
@@ -1645,6 +1645,8 @@ public:
   void getTargetDefines(const LangOptions &Opts,
                         MacroBuilder &Builder) const override {
     Builder.defineMacro("__R600__");
+    if (GPU >= GK_SOUTHERN_ISLANDS && Opts.OpenCL)
+      Builder.defineMacro("cl_khr_fp64");
   }
 
   BuiltinVaListKind getBuiltinVaListKind() const override {
diff --git a/test/Preprocessor/init.c b/test/Preprocessor/init.c
index e31b3bd..5dc5921 100644
--- a/test/Preprocessor/init.c
+++ b/test/Preprocessor/init.c
@@ -6584,6 +6584,9 @@
 // PPC-DARWIN:#define __powerpc__ 1
 // PPC-DARWIN:#define __ppc__ 1
 //
+// RUN: %clang_cc1 -x cl -E -dM -ffreestanding -triple=amdgcn < /dev/null | FileCheck -check-prefix AMDGCN %s
+// AMDGCN:#define cl_khr_fp64 1
+
 // RUN: %clang_cc1 -E -dM -ffreestanding -triple=s390x-none-none -fno-signed-char < /dev/null | FileCheck -check-prefix S390X %s
 //
 // S390X:#define __BIGGEST_ALIGNMENT__ 8
-- 
2.0.4




More information about the cfe-commits mailing list