[PATCH] D38667: AMDGPU: Parse r600 CPU name early and expose FMAF capability

Jan Vesely via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 19 13:42:02 PDT 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL316181: AMDGPU: Parse r600 CPU name early and expose FMAF capability (authored by jvesely).

Changed prior to commit:
  https://reviews.llvm.org/D38667?vs=118136&id=119614#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D38667

Files:
  cfe/trunk/lib/Basic/Targets/AMDGPU.cpp
  cfe/trunk/test/Preprocessor/predefined-arch-macros.c


Index: cfe/trunk/test/Preprocessor/predefined-arch-macros.c
===================================================================
--- cfe/trunk/test/Preprocessor/predefined-arch-macros.c
+++ cfe/trunk/test/Preprocessor/predefined-arch-macros.c
@@ -2378,10 +2378,20 @@
 // RUN:     -target amdgcn-unknown-unknown \
 // RUN:   | FileCheck -match-full-lines %s -check-prefix=CHECK_AMDGCN
 // CHECK_AMDGCN: #define __AMDGCN__ 1
+// CHECK_AMDGCN: #define __HAS_FMAF__ 1
+// CHECK_AMDGCN: #define __HAS_FP64__ 1
+// CHECK_AMDGCN: #define __HAS_LDEXPF__ 1
 
 // Begin r600 tests ----------------
 //
 // RUN: %clang -march=amdgcn -E -dM %s -o - 2>&1 \
 // RUN:     -target r600-unknown-unknown \
 // RUN:   | FileCheck -match-full-lines %s -check-prefix=CHECK_R600
 // CHECK_R600: #define __R600__ 1
+// CHECK_R600-NOT: #define __HAS_FMAF__ 1
+
+// RUN: %clang -march=amdgcn -mcpu=cypress -E -dM %s -o - 2>&1 \
+// RUN:     -target r600-unknown-unknown \
+// RUN:   | FileCheck -match-full-lines %s -check-prefix=CHECK_R600_FP64
+// CHECK_R600_FP64-DAG: #define __R600__ 1
+// CHECK_R600_FP64-DAG: #define __HAS_FMAF__ 1
Index: cfe/trunk/lib/Basic/Targets/AMDGPU.cpp
===================================================================
--- cfe/trunk/lib/Basic/Targets/AMDGPU.cpp
+++ cfe/trunk/lib/Basic/Targets/AMDGPU.cpp
@@ -308,14 +308,20 @@
 
 AMDGPUTargetInfo::AMDGPUTargetInfo(const llvm::Triple &Triple,
                                    const TargetOptions &Opts)
-    : TargetInfo(Triple), GPU(isAMDGCN(Triple) ? GK_GFX6 : GK_R600),
+    : TargetInfo(Triple),
+      GPU(isAMDGCN(Triple) ? GK_GFX6 : parseR600Name(Opts.CPU)),
       hasFP64(false), hasFMAF(false), hasLDEXPF(false),
       AS(isGenericZero(Triple)) {
   if (getTriple().getArch() == llvm::Triple::amdgcn) {
     hasFP64 = true;
     hasFMAF = true;
     hasLDEXPF = true;
   }
+  if (getTriple().getArch() == llvm::Triple::r600) {
+    if (GPU == GK_EVERGREEN_DOUBLE_OPS || GPU == GK_CAYMAN) {
+      hasFMAF = true;
+    }
+  }
   auto IsGenericZero = isGenericZero(Triple);
   resetDataLayout(getTriple().getArch() == llvm::Triple::amdgcn
                       ? (IsGenericZero ? DataLayoutStringSIGenericIsZero


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D38667.119614.patch
Type: text/x-patch
Size: 2182 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20171019/38e1bcba/attachment.bin>


More information about the cfe-commits mailing list