[PATCH 1/1] R600: Report fp64 on all capable asics

Jan Vesely jan.vesely at rutgers.edu
Mon Apr 20 16:56:05 PDT 2015


Signed-off-by: Jan Vesely <jan.vesely at rutgers.edu>
---

I was thinking about how to add more macros here.
Would it be preferable to have per feature/opcode macros like:
__HAVE_FMA32 (or the specs like FP_FAST_FMAF)
and __HAVE_LDEXP32
or do we just export asic class and handle the details in libclc?

jan

 lib/Basic/Targets.cpp | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/lib/Basic/Targets.cpp b/lib/Basic/Targets.cpp
index 1f81bcd..613b947 100644
--- a/lib/Basic/Targets.cpp
+++ b/lib/Basic/Targets.cpp
@@ -1695,6 +1695,8 @@ class R600TargetInfo : public TargetInfo {
     GK_SEA_ISLANDS
   } GPU;
 
+  bool hasFP64;
+
 public:
   R600TargetInfo(const llvm::Triple &Triple)
       : TargetInfo(Triple) {
@@ -1702,9 +1704,11 @@ public:
     if (Triple.getArch() == llvm::Triple::amdgcn) {
       DescriptionString = DescriptionStringSI;
       GPU = GK_SOUTHERN_ISLANDS;
+      hasFP64 = true;
     } else {
       DescriptionString = DescriptionStringR600;
       GPU = GK_R600;
+      hasFP64 = false;
     }
     AddrSpaceMap = &R600AddrSpaceMap;
     UseAddrSpaceMapMangling = true;
@@ -1751,8 +1755,9 @@ public:
   void getTargetDefines(const LangOptions &Opts,
                         MacroBuilder &Builder) const override {
     Builder.defineMacro("__R600__");
-    if (GPU >= GK_SOUTHERN_ISLANDS && Opts.OpenCL)
+    if (hasFP64 && Opts.OpenCL) {
       Builder.defineMacro("cl_khr_fp64");
+    }
   }
 
   BuiltinVaListKind getBuiltinVaListKind() const override {
@@ -1810,16 +1815,19 @@ public:
     case GK_EVERGREEN:
     case GK_NORTHERN_ISLANDS:
       DescriptionString = DescriptionStringR600;
+      hasFP64 = false;
       break;
     case GK_R600_DOUBLE_OPS:
     case GK_R700_DOUBLE_OPS:
     case GK_EVERGREEN_DOUBLE_OPS:
     case GK_CAYMAN:
       DescriptionString = DescriptionStringR600DoubleOps;
+      hasFP64 = true;
       break;
     case GK_SOUTHERN_ISLANDS:
     case GK_SEA_ISLANDS:
       DescriptionString = DescriptionStringSI;
+      hasFP64 = true;
       break;
     }
 
-- 
2.1.0




More information about the cfe-commits mailing list