[PATCH] D84764: Fix computeHostNumPhysicalCores() for Linux on POWER and Linux on Z
Ettore Tiotto via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 29 13:58:25 PDT 2020
etiotto updated this revision to Diff 281730.
etiotto added a comment.
Fix test case for PPC64 and SystemZ
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D84764/new/
https://reviews.llvm.org/D84764
Files:
llvm/lib/Support/Host.cpp
llvm/unittests/Support/Host.cpp
Index: llvm/unittests/Support/Host.cpp
===================================================================
--- llvm/unittests/Support/Host.cpp
+++ llvm/unittests/Support/Host.cpp
@@ -40,7 +40,9 @@
// x86_64 Linux and Darwin.
return (Host.isOSWindows() && llvm_is_multithreaded()) ||
(Host.isX86() &&
- (Host.isOSDarwin() || Host.getOS() == Triple::Linux));
+ (Host.isOSDarwin() || Host.getOS() == Triple::Linux)) ||
+ (Host.getOS() == Triple::Linux &&
+ (Host.isPPC64() || Host.isSystemZ()));
}
HostTest() : Host(Triple::normalize(sys::getProcessTriple())) {}
Index: llvm/lib/Support/Host.cpp
===================================================================
--- llvm/lib/Support/Host.cpp
+++ llvm/lib/Support/Host.cpp
@@ -1271,6 +1271,12 @@
}
return CPU_COUNT(&Enabled);
}
+#elif (defined(__linux__) && \
+ (defined(__ppc__) || defined(__powerpc__) || defined(__s390x__)))
+#include <unistd.h>
+
+// Gets the number of *physical cores* on the machine.
+int computeHostNumPhysicalCores() { return sysconf(_SC_NPROCESSORS_ONLN); }
#elif defined(__APPLE__) && defined(__x86_64__)
#include <sys/param.h>
#include <sys/sysctl.h>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D84764.281730.patch
Type: text/x-patch
Size: 1266 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200729/1991c656/attachment.bin>
More information about the llvm-commits
mailing list