[PATCH] D57707: Add Triple::isAMDGPU

Yaxun Liu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 4 12:47:21 PST 2019


yaxunl updated this revision to Diff 185136.
yaxunl added a comment.

add usage of it


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D57707/new/

https://reviews.llvm.org/D57707

Files:
  include/llvm/ADT/Triple.h
  lib/Analysis/TargetLibraryInfo.cpp


Index: lib/Analysis/TargetLibraryInfo.cpp
===================================================================
--- lib/Analysis/TargetLibraryInfo.cpp
+++ lib/Analysis/TargetLibraryInfo.cpp
@@ -91,8 +91,7 @@
   TLI.setShouldExtI32Return(ShouldExtI32Return);
   TLI.setShouldSignExtI32Param(ShouldSignExtI32Param);
 
-  if (T.getArch() == Triple::r600 ||
-      T.getArch() == Triple::amdgcn) {
+  if (T.isAMDGPU()) {
     TLI.setUnavailable(LibFunc_ldexp);
     TLI.setUnavailable(LibFunc_ldexpf);
     TLI.setUnavailable(LibFunc_ldexpl);
@@ -106,8 +105,7 @@
 
   // There are no library implementations of mempcy and memset for AMD gpus and
   // these can be difficult to lower in the backend.
-  if (T.getArch() == Triple::r600 ||
-      T.getArch() == Triple::amdgcn) {
+  if (T.isAMDGPU()) {
     TLI.setUnavailable(LibFunc_memcpy);
     TLI.setUnavailable(LibFunc_memset);
     TLI.setUnavailable(LibFunc_memset_pattern16);
Index: include/llvm/ADT/Triple.h
===================================================================
--- include/llvm/ADT/Triple.h
+++ include/llvm/ADT/Triple.h
@@ -660,6 +660,10 @@
     return getArch() == Triple::nvptx || getArch() == Triple::nvptx64;
   }
 
+  bool isAMDGPU() const {
+    return getArch() == Triple::r600 || getArch() == Triple::amdgcn;
+  }
+
   /// Tests whether the target is Thumb (little and big endian).
   bool isThumb() const {
     return getArch() == Triple::thumb || getArch() == Triple::thumbeb;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D57707.185136.patch
Type: text/x-patch
Size: 1457 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190204/82cae9c5/attachment.bin>


More information about the llvm-commits mailing list