Index: runtime/CMakeLists.txt =================================================================== --- runtime/CMakeLists.txt +++ runtime/CMakeLists.txt @@ -38,7 +38,7 @@ # If adding a new architecture, take a look at cmake/LibompGetArchitecture.cmake libomp_get_architecture(LIBOMP_DETECTED_ARCH) set(LIBOMP_ARCH ${LIBOMP_DETECTED_ARCH} CACHE STRING - "The architecture to build for (x86_64/i386/arm/ppc64/ppc64le/aarch64/mic).") + "The architecture to build for (x86_64/i386/arm/ppc64/ppc64le/aarch64/mic/mips/mips64).") # Allow user to choose a suffix for the installation directory. set(LIBOMP_LIBDIR_SUFFIX "" CACHE STRING "suffix of lib installation directory e.g., 64 => lib64") @@ -83,7 +83,7 @@ set(LIBOMP_ENABLE_ASSERTIONS ${LLVM_ENABLE_ASSERTIONS}) set(LIBOMP_ENABLE_WERROR ${LLVM_ENABLE_WERROR}) endif() -libomp_check_variable(LIBOMP_ARCH 32e x86_64 32 i386 arm ppc64 ppc64le aarch64 mic) +libomp_check_variable(LIBOMP_ARCH 32e x86_64 32 i386 arm ppc64 ppc64le aarch64 mic mips mips64) set(LIBOMP_LIB_TYPE normal CACHE STRING "Performance,Profiling,Stubs library (normal/profile/stubs)") @@ -174,6 +174,8 @@ set(PPC64LE FALSE) set(PPC64 FALSE) set(MIC FALSE) +set(MIPS64 FALSE) +set(MIPS FALSE) if("${LIBOMP_ARCH}" STREQUAL "i386" OR "${LIBOMP_ARCH}" STREQUAL "32") # IA-32 architecture set(IA32 TRUE) elseif("${LIBOMP_ARCH}" STREQUAL "x86_64" OR "${LIBOMP_ARCH}" STREQUAL "32e") # Intel(R) 64 architecture @@ -190,6 +192,10 @@ set(AARCH64 TRUE) elseif("${LIBOMP_ARCH}" STREQUAL "mic") # Intel(R) Many Integrated Core Architecture set(MIC TRUE) +elseif("${LIBOMP_ARCH}" STREQUAL "mips") # MIPS architecture + set(MIPS TRUE) +elseif("${LIBOMP_ARCH}" STREQUAL "mips64") # MIPS64 architecture + set(MIPS64 TRUE) endif() # Set some flags based on build_type Index: runtime/README.txt =================================================================== --- runtime/README.txt +++ runtime/README.txt @@ -52,6 +52,7 @@ * Aarch64 (64-bit ARM) architecture * IBM(R) Power architecture (big endian) * IBM(R) Power architecture (little endian) +* MIPS and MIPS64 architecture Supported RTL Build Configurations ================================== Index: runtime/cmake/LibompGetArchitecture.cmake =================================================================== --- runtime/cmake/LibompGetArchitecture.cmake +++ runtime/cmake/LibompGetArchitecture.cmake @@ -42,6 +42,10 @@ #error ARCHITECTURE=ppc64le #elif defined(__powerpc64__) #error ARCHITECTURE=ppc64 + #elif defined(__mips__) && defined(__mips64) + #error ARCHITECTURE=mips64 + #elif defined(__mips__) && !defined(__mips64) + #error ARCHITECTURE=mips #else #error ARCHITECTURE=UnknownArchitecture #endif Index: runtime/cmake/LibompMicroTests.cmake =================================================================== --- runtime/cmake/LibompMicroTests.cmake +++ runtime/cmake/LibompMicroTests.cmake @@ -206,6 +206,9 @@ elseif(${PPC64}) libomp_append(libomp_expected_library_deps libc.so.6) libomp_append(libomp_expected_library_deps ld64.so.1) + elseif(${MIPS} OR ${MIPS64}) + libomp_append(libomp_expected_library_deps libc.so.6) + libomp_append(libomp_expected_library_deps ld.so.1) endif() libomp_append(libomp_expected_library_deps libpthread.so.0 IF_FALSE STUBS_LIBRARY) libomp_append(libomp_expected_library_deps libhwloc.so.5 LIBOMP_USE_HWLOC) Index: runtime/cmake/LibompUtils.cmake =================================================================== --- runtime/cmake/LibompUtils.cmake +++ runtime/cmake/LibompUtils.cmake @@ -102,6 +102,10 @@ set(${return_arch_string} "PPC64LE" PARENT_SCOPE) elseif(${AARCH64}) set(${return_arch_string} "AARCH64" PARENT_SCOPE) + elseif(${MIPS}) + set(${return_arch_string} "MIPS" PARENT_SCOPE) + elseif(${MIPS64}) + set(${return_arch_string} "MIPS64" PARENT_SCOPE) else() set(${return_arch_string} "${LIBOMP_ARCH}" PARENT_SCOPE) libomp_warning_say("libomp_get_legal_arch(): Warning: Unknown architecture: Using ${LIBOMP_ARCH}") Index: runtime/src/kmp_affinity.h =================================================================== --- runtime/src/kmp_affinity.h +++ runtime/src/kmp_affinity.h @@ -204,7 +204,28 @@ # elif __NR_sched_getaffinity != 223 # error Wrong code for getaffinity system call. # endif /* __NR_sched_getaffinity */ -# else +# elif KMP_ARCH_MIPS +# ifndef __NR_sched_setaffinity +# define __NR_sched_setaffinity 4239 +# elif __NR_sched_setaffinity != 4239 +# error Wrong code for setaffinity system call. +# endif /* __NR_sched_setaffinity */ +# ifndef __NR_sched_getaffinity +# define __NR_sched_getaffinity 4240 +# elif __NR_sched_getaffinity != 4240 +# error Wrong code for getaffinity system call. +# endif /* __NR_sched_getaffinity */ +# elif KMP_ARCH_MIPS64 +# ifndef __NR_sched_setaffinity +# define __NR_sched_setaffinity 5195 +# elif __NR_sched_setaffinity != 5195 +# error Wrong code for setaffinity system call. +# endif /* __NR_sched_setaffinity */ +# ifndef __NR_sched_getaffinity +# define __NR_sched_getaffinity 5196 +# elif __NR_sched_getaffinity != 5196 +# error Wrong code for getaffinity system call. +# endif /* __NR_sched_getaffinity */ # error Unknown or unsupported architecture # endif /* KMP_ARCH_* */ class KMPNativeAffinity : public KMPAffinity { Index: runtime/src/kmp_csupport.c =================================================================== --- runtime/src/kmp_csupport.c +++ runtime/src/kmp_csupport.c @@ -624,7 +624,7 @@ #endif // KMP_COMPILER_ICC }; // if #endif // KMP_MIC - #elif (KMP_ARCH_ARM || KMP_ARCH_AARCH64) + #elif (KMP_ARCH_ARM || KMP_ARCH_AARCH64 || KMP_ARCH_MIPS || KMP_ARCH_MIPS64) // Nothing to see here move along #elif KMP_ARCH_PPC64 // Nothing needed here (we have a real MB above). Index: runtime/src/kmp_gsupport.c =================================================================== --- runtime/src/kmp_gsupport.c +++ runtime/src/kmp_gsupport.c @@ -232,7 +232,7 @@ // (IA-32 architecture) or 64-bit signed (Intel(R) 64). // -#if KMP_ARCH_X86 || KMP_ARCH_ARM +#if KMP_ARCH_X86 || KMP_ARCH_ARM || KMP_ARCH_MIPS # define KMP_DISPATCH_INIT __kmp_aux_dispatch_init_4 # define KMP_DISPATCH_FINI_CHUNK __kmp_aux_dispatch_fini_chunk_4 # define KMP_DISPATCH_NEXT __kmpc_dispatch_next_4 Index: runtime/src/kmp_os.h =================================================================== --- runtime/src/kmp_os.h +++ runtime/src/kmp_os.h @@ -147,9 +147,9 @@ # define KMP_UINT64_SPEC "llu" #endif /* KMP_OS_UNIX */ -#if KMP_ARCH_X86 || KMP_ARCH_ARM +#if KMP_ARCH_X86 || KMP_ARCH_ARM || KMP_ARCH_MIPS # define KMP_SIZE_T_SPEC KMP_UINT32_SPEC -#elif KMP_ARCH_X86_64 || KMP_ARCH_PPC64 || KMP_ARCH_AARCH64 +#elif KMP_ARCH_X86_64 || KMP_ARCH_PPC64 || KMP_ARCH_AARCH64 || KMP_ARCH_MIPS64 # define KMP_SIZE_T_SPEC KMP_UINT64_SPEC #else # error "Can't determine size_t printf format specifier." @@ -559,7 +559,7 @@ # endif #endif /* KMP_OS_WINDOWS */ -#if KMP_ARCH_PPC64 || KMP_ARCH_ARM || KMP_ARCH_AARCH64 +#if KMP_ARCH_PPC64 || KMP_ARCH_ARM || KMP_ARCH_AARCH64 || KMP_ARCH_MIPS || KMP_ARCH_MIPS64 # define KMP_MB() __sync_synchronize() #endif @@ -618,7 +618,7 @@ #define TCW_SYNC_8(a,b) (a) = (b) #define TCX_SYNC_8(a,b,c) KMP_COMPARE_AND_STORE_REL64((volatile kmp_int64 *)(volatile void *)&(a), (kmp_int64)(b), (kmp_int64)(c)) -#if KMP_ARCH_X86 +#if KMP_ARCH_X86 || KMP_ARCH_MIPS // What about ARM? #define TCR_PTR(a) ((void *)TCR_4(a)) #define TCW_PTR(a,b) TCW_4((a),(b)) Index: runtime/src/kmp_platform.h =================================================================== --- runtime/src/kmp_platform.h +++ runtime/src/kmp_platform.h @@ -77,6 +77,8 @@ #define KMP_ARCH_PPC64_BE 0 #define KMP_ARCH_PPC64_LE 0 #define KMP_ARCH_PPC64 (KMP_ARCH_PPC64_LE || KMP_ARCH_PPC64_BE) +#define KMP_ARCH_MIPS 0 +#define KMP_ARCH_MIPS64 0 #if KMP_OS_WINDOWS # if defined _M_AMD64 @@ -106,6 +108,14 @@ # elif defined __aarch64__ # undef KMP_ARCH_AARCH64 # define KMP_ARCH_AARCH64 1 +# elif defined __mips__ +# if defined __mips64 +# undef KMP_ARCH_MIPS64 +# define KMP_ARCH_MIPS64 1 +# else +# undef KMP_ARCH_MIPS +# define KMP_ARCH_MIPS 1 +# endif # endif #endif @@ -161,10 +171,10 @@ #endif /* Specify 32 bit architectures here */ -#define KMP_32_BIT_ARCH (KMP_ARCH_X86 || KMP_ARCH_ARM) +#define KMP_32_BIT_ARCH (KMP_ARCH_X86 || KMP_ARCH_ARM || KMP_ARCH_MIPS) // TODO: Fixme - This is clever, but really fugly -#if (1 != KMP_ARCH_X86 + KMP_ARCH_X86_64 + KMP_ARCH_ARM + KMP_ARCH_PPC64 + KMP_ARCH_AARCH64) +#if (1 != KMP_ARCH_X86 + KMP_ARCH_X86_64 + KMP_ARCH_ARM + KMP_ARCH_PPC64 + KMP_ARCH_AARCH64 + KMP_ARCH_MIPS + KMP_ARCH_MIPS64) # error Unknown or unsupported architecture #endif Index: runtime/src/kmp_runtime.c =================================================================== --- runtime/src/kmp_runtime.c +++ runtime/src/kmp_runtime.c @@ -7565,7 +7565,7 @@ int atomic_available = FAST_REDUCTION_ATOMIC_METHOD_GENERATED; int tree_available = FAST_REDUCTION_TREE_METHOD_GENERATED; - #if KMP_ARCH_X86_64 || KMP_ARCH_PPC64 || KMP_ARCH_AARCH64 + #if KMP_ARCH_X86_64 || KMP_ARCH_PPC64 || KMP_ARCH_AARCH64 || KMP_ARCH_MIPS64 #if KMP_OS_LINUX || KMP_OS_FREEBSD || KMP_OS_NETBSD || KMP_OS_WINDOWS || KMP_OS_DARWIN @@ -7591,7 +7591,7 @@ #error "Unknown or unsupported OS" #endif // KMP_OS_LINUX || KMP_OS_FREEBSD || KMP_OS_NETBSD || KMP_OS_WINDOWS || KMP_OS_DARWIN - #elif KMP_ARCH_X86 || KMP_ARCH_ARM || KMP_ARCH_AARCH + #elif KMP_ARCH_X86 || KMP_ARCH_ARM || KMP_ARCH_AARCH || KMP_ARCH_MIPS #if KMP_OS_LINUX || KMP_OS_WINDOWS Index: runtime/src/thirdparty/ittnotify/ittnotify_config.h =================================================================== --- runtime/src/thirdparty/ittnotify/ittnotify_config.h +++ runtime/src/thirdparty/ittnotify/ittnotify_config.h @@ -142,7 +142,15 @@ # define ITT_ARCH_PPC64 5 #endif /* ITT_ARCH_PPC64 */ +#ifndef ITT_ARCH_MIPS +# define ITT_ARCH_MIPS 6 +#endif /* ITT_ARCH_MIPS */ +#ifndef ITT_ARCH_MIPS64 +# define ITT_ARCH_MIPS64 6 +#endif /* ITT_ARCH_MIPS64 */ + + #ifndef ITT_ARCH # if defined _M_IX86 || defined __i386__ # define ITT_ARCH ITT_ARCH_IA32 @@ -156,6 +164,10 @@ # define ITT_ARCH ITT_ARCH_PPC64 # elif defined __aarch64__ # define ITT_ARCH ITT_ARCH_AARCH64 +# elif defined __mips__ && !defined __mips64 +# define ITT_ARCH ITT_ARCH_MIPS +# elif defined __mips__ && defined __mips64 +# define ITT_ARCH ITT_ARCH_MIPS64 # endif #endif @@ -293,7 +305,7 @@ : "memory"); return result; } -#elif ITT_ARCH==ITT_ARCH_ARM || ITT_ARCH==ITT_ARCH_PPC64 || ITT_ARCH==ITT_ARCH_AARCH64 +#elif ITT_ARCH==ITT_ARCH_ARM || ITT_ARCH==ITT_ARCH_PPC64 || ITT_ARCH==ITT_ARCH_AARCH64 || ITT_ARCH==ITT_ARCH_MIPS || ITT_ARCH==ITT_ARCH_MIPS64 #define __TBB_machine_fetchadd4(addr, val) __sync_fetch_and_add(addr, val) #endif /* ITT_ARCH==ITT_ARCH_IA64 */ #ifndef ITT_SIMPLE_INIT Index: runtime/src/thirdparty/ittnotify/ittnotify_static.c =================================================================== --- runtime/src/thirdparty/ittnotify/ittnotify_static.c +++ runtime/src/thirdparty/ittnotify/ittnotify_static.c @@ -72,7 +72,7 @@ #ifndef LIB_VAR_NAME -#if ITT_ARCH==ITT_ARCH_IA32 || ITT_ARCH==ITT_ARCH_ARM +#if ITT_ARCH==ITT_ARCH_IA32 || ITT_ARCH==ITT_ARCH_ARM || ITT_ARCH==ITT_ARCH_MIPS #define LIB_VAR_NAME INTEL_LIBITTNOTIFY32 #else #define LIB_VAR_NAME INTEL_LIBITTNOTIFY64 Index: runtime/src/z_Linux_asm.s =================================================================== --- runtime/src/z_Linux_asm.s +++ runtime/src/z_Linux_asm.s @@ -1776,7 +1776,7 @@ #endif /* KMP_ARCH_PPC64 */ -#if KMP_ARCH_ARM +#if KMP_ARCH_ARM || KMP_ARCH_MIPS .data .comm .gomp_critical_user_,32,8 .data @@ -1787,7 +1787,7 @@ .size __kmp_unnamed_critical_addr,4 #endif /* KMP_ARCH_ARM */ -#if KMP_ARCH_PPC64 || KMP_ARCH_AARCH64 +#if KMP_ARCH_PPC64 || KMP_ARCH_AARCH64 || KMP_ARCH_MIPS64 .data .comm .gomp_critical_user_,32,8 .data Index: runtime/tools/lib/Platform.pm =================================================================== --- runtime/tools/lib/Platform.pm +++ runtime/tools/lib/Platform.pm @@ -58,6 +58,10 @@ $arch = "aarch64"; } elsif ( $arch =~ m{\Amic} ) { $arch = "mic"; + } elsif ( $arch =~ m{\Amips64} ) { + $arch = "mips64"; + } elsif ( $arch =~ m{\Amips} ) { + $arch = "mips"; } else { $arch = undef; }; # if @@ -89,6 +93,8 @@ "arm" => "ARM", "aarch64" => "AArch64", "mic" => "Intel(R) Many Integrated Core Architecture", + "mips" => "MIPS", + "mips64" => "MIPS64", ); sub legal_arch($) { @@ -109,6 +115,8 @@ "arm" => "arm", "aarch64" => "aarch", "mic" => "intel64", + "mips" => "mips", + "mips64" => "MIPS64", ); sub arch_opt($) { @@ -209,6 +217,10 @@ $_host_arch = "ppc64"; } elsif ( $hardware_platform eq "aarch64" ) { $_host_arch = "aarch64"; + } elsif ( $hardware_platform eq "mips64" ) { + $_host_arch = "mips64"; + } elsif ( $hardware_platform eq "mips" ) { + $_host_arch = "mips"; } else { die "Unsupported host hardware platform: \"$hardware_platform\"; stopped"; }; # if @@ -398,7 +410,7 @@ Input string is an architecture name to canonize. The function recognizes many variants, for example: C<32e>, C, C, etc. Returned string is a canononized architecture name, -one of: C<32>, C<32e>, C<64>, C, C, C, C, or C is input string is not recognized. +one of: C<32>, C<32e>, C<64>, C, C, C, C, C, C, or C is input string is not recognized. =item B @@ -470,4 +482,3 @@ =cut # end of file # - Index: runtime/tools/lib/Uname.pm =================================================================== --- runtime/tools/lib/Uname.pm +++ runtime/tools/lib/Uname.pm @@ -153,6 +153,10 @@ $values{ hardware_platform } = "ppc64"; } elsif ( $values{ machine } =~ m{\Aaarch64\z} ) { $values{ hardware_platform } = "aarch64"; + } elsif ( $values{ machine } =~ m{\Amips64\z} ) { + $values{ hardware_platform } = "mips64"; + } elsif ( $values{ machine } =~ m{\Amips\z} ) { + $values{ hardware_platform } = "mips"; } else { die "Unsupported machine (\"$values{ machine }\") returned by POSIX::uname(); stopped"; }; # if Index: www/README.txt =================================================================== --- www/README.txt +++ www/README.txt @@ -52,6 +52,7 @@ * Aarch64 (64-bit ARM) architecture * IBM(R) Power architecture (big endian) * IBM(R) Power architecture (little endian) +* MIPS and MIPS64 architectures Supported RTL Build Configurations ================================== Index: www/index.html =================================================================== --- www/index.html +++ www/index.html @@ -142,6 +142,7 @@ or with gcc, and also the Intel® Xeon Phi™ product family, when compiled with the Intel compiler. +
  • MIPS and MIPS64
  • Ports to other architectures and operating systems are welcome.

    @@ -232,6 +233,10 @@ ARM is a trademark of ARM Corporation in the U.S. and/or other countries. +
  • + MIPS is a trademark of MIPS Computer Systems in the U.S. and/or + other countries. +