Commit 8fd5330f by Colin Samples Committed by Nicolas Capens

Update Reactor for PPC64 support

This updates LLVMReactor to provide for PPC64 little endian support. It also adds an #ifdef condition to an assert macro, since llvm::sys::getHostCPUFeatures will always return false on non-x86 and ARM Linux platforms per 'third_party/llvm-7.0/llvm/lib/Support/Host.cpp'. Bug: b/135175069 Signed-off-by: 's avatarColin Samples <colin.samples+git@gmail.com> Change-Id: Idcdafe2f1bd934317ca9da09c99132f814fcf160 Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/32811 Kokoro-Presubmit: kokoro <noreply+kokoro@google.com> Tested-by: 's avatarNicolas Capens <nicolascapens@google.com> Reviewed-by: 's avatarAlexis Hétu <sugoi@google.com>
parent f63a3abb
...@@ -15,9 +15,10 @@ ...@@ -15,9 +15,10 @@
import("../swiftshader.gni") import("../swiftshader.gni")
declare_args() { declare_args() {
# Subzero produces smaller binaries, but doesn't support ARM64 and MIPS64. # Subzero produces smaller binaries, but doesn't support ARM64, MIPS64, and
# PPC64.
use_swiftshader_with_subzero = use_swiftshader_with_subzero =
target_cpu != "arm64" && target_cpu != "mips64el" target_cpu != "arm64" && target_cpu != "mips64el" && target_cpu != "ppc64"
supports_llvm = is_linux || is_fuchsia || is_win || is_android || is_mac supports_llvm = is_linux || is_fuchsia || is_win || is_android || is_mac
} }
......
...@@ -912,6 +912,8 @@ namespace rr ...@@ -912,6 +912,8 @@ namespace rr
#else #else
static const char arch[] = "mipsel"; static const char arch[] = "mipsel";
#endif #endif
#elif defined(__powerpc64__) && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
static const char arch[] = "ppc64le";
#else #else
#error "unknown architecture" #error "unknown architecture"
#endif #endif
...@@ -919,8 +921,16 @@ namespace rr ...@@ -919,8 +921,16 @@ namespace rr
llvm::SmallVector<std::string, 8> mattrs; llvm::SmallVector<std::string, 8> mattrs;
llvm::StringMap<bool> features; llvm::StringMap<bool> features;
bool ok = llvm::sys::getHostCPUFeatures(features); bool ok = llvm::sys::getHostCPUFeatures(features);
#if defined(__i386__) || defined(__x86_64__) || \
(defined(__linux__) && (defined(__arm__) || defined(__aarch64__)))
ASSERT_MSG(ok, "llvm::sys::getHostCPUFeatures returned false"); ASSERT_MSG(ok, "llvm::sys::getHostCPUFeatures returned false");
#else
(void) ok; // getHostCPUFeatures always returns false on other platforms
#endif
for (auto &feature : features) for (auto &feature : features)
{ {
if (feature.second) { mattrs.push_back(feature.first()); } if (feature.second) { mattrs.push_back(feature.first()); }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment