Commit 20622c01 by Gordana Cmiljanovic

[MIPS] Add support for 64b MIPS architecture

* LLVM reactor backend: requires LLVM 7.0 * Subzero reactor backend: not supported Bug: b/117854176 Change-Id: I7b76ebf854f65c2d111552552bd5a81c049d3b50 Reviewed-on: https://swiftshader-review.googlesource.com/c/22308Reviewed-by: 's avatarNicolas Capens <nicolascapens@google.com> Tested-by: 's avatarGordana Cmiljanovic <gordana.cmiljanovic@mips.com>
parent 9911aca4
...@@ -104,6 +104,13 @@ config("swiftshader_config") { ...@@ -104,6 +104,13 @@ config("swiftshader_config") {
"-mhard-float", "-mhard-float",
"-mfp32", "-mfp32",
] ]
} else if (target_cpu == "mips64el" && current_cpu == target_cpu) {
cflags += [
"-march=mips64el",
"-mcpu=mips64r2",
"-mabi=64",
"-fPIC",
]
} }
if (is_linux) { if (is_linux) {
...@@ -114,6 +121,11 @@ config("swiftshader_config") { ...@@ -114,6 +121,11 @@ config("swiftshader_config") {
"-Wl,--hash-style=sysv", "-Wl,--hash-style=sysv",
"-mips32r2", "-mips32r2",
] ]
} else if (target_cpu == "mips64el") {
ldflags += [
"-Wl,--hash-style=sysv",
"-mips64r2",
]
} else { } else {
ldflags += [ "-Wl,--hash-style=both" ] ldflags += [ "-Wl,--hash-style=both" ]
} }
......
...@@ -139,7 +139,7 @@ macro(set_shared_library_export_map TARGET DIR) ...@@ -139,7 +139,7 @@ macro(set_shared_library_export_map TARGET DIR)
# Don't allow symbols to be overridden by another module. # Don't allow symbols to be overridden by another module.
set_property(TARGET ${TARGET} APPEND_STRING PROPERTY COMPILE_FLAGS " -fvisibility=protected") set_property(TARGET ${TARGET} APPEND_STRING PROPERTY COMPILE_FLAGS " -fvisibility=protected")
if(ARCH STREQUAL "mipsel") if(ARCH STREQUAL "mipsel" OR ARCH STREQUAL "mips64el")
# MIPS supports sysv hash-style only. # MIPS supports sysv hash-style only.
set_property(TARGET ${TARGET} APPEND_STRING PROPERTY LINK_FLAGS " -Wl,--hash-style=sysv") set_property(TARGET ${TARGET} APPEND_STRING PROPERTY LINK_FLAGS " -Wl,--hash-style=sysv")
else() else()
...@@ -231,6 +231,11 @@ else() ...@@ -231,6 +231,11 @@ else()
set_cpp_flag("-mhard-float") set_cpp_flag("-mhard-float")
set_cpp_flag("-mfp32") set_cpp_flag("-mfp32")
endif() endif()
if(ARCH STREQUAL "mips64el")
set_cpp_flag("-march=mips64r2")
set_cpp_flag("-mabi=64")
set_cpp_flag("-fPIC")
endif()
if(LINUX) if(LINUX)
set_cpp_flag("-DUSE_X11=1") set_cpp_flag("-DUSE_X11=1")
......
...@@ -15,8 +15,9 @@ ...@@ -15,8 +15,9 @@
import("../swiftshader.gni") import("../swiftshader.gni")
declare_args() { declare_args() {
# Subzero produces smaller binaries, but doesn't support ARM64. # Subzero produces smaller binaries, but doesn't support ARM64 and MIPS64.
use_swiftshader_with_subzero = (target_cpu != "arm64") use_swiftshader_with_subzero =
target_cpu != "arm64" && target_cpu != "mips64el"
} }
# Need a separate config to ensure the warnings are added to the end. # Need a separate config to ensure the warnings are added to the end.
......
...@@ -830,7 +830,11 @@ namespace rr ...@@ -830,7 +830,11 @@ namespace rr
#elif defined(__arm__) #elif defined(__arm__)
static const char arch[] = "arm"; static const char arch[] = "arm";
#elif defined(__mips__) #elif defined(__mips__)
#if defined(__mips64)
static const char arch[] = "mips64el";
#else
static const char arch[] = "mipsel"; static const char arch[] = "mipsel";
#endif
#else #else
#error "unknown architecture" #error "unknown architecture"
#endif #endif
......
...@@ -301,6 +301,8 @@ ...@@ -301,6 +301,8 @@
#define LLVM_DEFAULT_TARGET_TRIPLE "aarch64-linux-gnu" #define LLVM_DEFAULT_TARGET_TRIPLE "aarch64-linux-gnu"
#elif defined(__mips__) #elif defined(__mips__)
#define LLVM_DEFAULT_TARGET_TRIPLE "mipsel-linux-gnu" #define LLVM_DEFAULT_TARGET_TRIPLE "mipsel-linux-gnu"
#elif defined(__mips64)
#define LLVM_DEFAULT_TARGET_TRIPLE "mips64el-linux-gnuabi64"
#else #else
#error "unknown architecture" #error "unknown architecture"
#endif #endif
......
...@@ -31,6 +31,8 @@ ...@@ -31,6 +31,8 @@
#define LLVM_DEFAULT_TARGET_TRIPLE "aarch64-linux-gnu" #define LLVM_DEFAULT_TARGET_TRIPLE "aarch64-linux-gnu"
#elif defined(__mips__) #elif defined(__mips__)
#define LLVM_DEFAULT_TARGET_TRIPLE "mipsel-linux-gnu" #define LLVM_DEFAULT_TARGET_TRIPLE "mipsel-linux-gnu"
#elif defined(__mips64)
#define LLVM_DEFAULT_TARGET_TRIPLE "mips64el-linux-gnuabi64"
#else #else
#error "unknown architecture" #error "unknown architecture"
#endif #endif
...@@ -52,6 +54,8 @@ ...@@ -52,6 +54,8 @@
#define LLVM_HOST_TRIPLE "aarch64-linux-gnu" #define LLVM_HOST_TRIPLE "aarch64-linux-gnu"
#elif defined(__mips__) #elif defined(__mips__)
#define LLVM_HOST_TRIPLE "mipsel-linux-gnu" #define LLVM_HOST_TRIPLE "mipsel-linux-gnu"
#elif defined(__mips64)
#define LLVM_HOST_TRIPLE "mips64el-linux-gnuabi64"
#else #else
#error "unknown architecture" #error "unknown architecture"
#endif #endif
......
...@@ -49,6 +49,7 @@ LLVM_TRIPLES = { ...@@ -49,6 +49,7 @@ LLVM_TRIPLES = {
('__arm__', 'armv7-linux-gnueabihf'), ('__arm__', 'armv7-linux-gnueabihf'),
('__aarch64__', 'aarch64-linux-gnu'), ('__aarch64__', 'aarch64-linux-gnu'),
('__mips__', 'mipsel-linux-gnu'), ('__mips__', 'mipsel-linux-gnu'),
('__mips64', 'mips64el-linux-gnuabi64'),
], ],
'darwin': [ 'darwin': [
('__x86_64__', 'x86_64-apple-darwin'), ('__x86_64__', 'x86_64-apple-darwin'),
......
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