Index: CMakeLists.txt =================================================================== --- CMakeLists.txt +++ CMakeLists.txt @@ -1,5 +1,7 @@ cmake_minimum_required(VERSION 3.2) +include(CheckSymbolExists) + # The test-suite is designed to be built in release mode anyway and # falls over unless -DNDEBUG is set. if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) @@ -95,6 +97,11 @@ endif() endif() +if("${ARCH}" STREQUAL "Mips") + check_symbol_exists(__mips16 "" MIPS_IS_MIPS16_ENABLED) + check_symbol_exists(__mips64 "" MIPS_IS_MIPS64_ENABLED) +endif() + add_subdirectory(tools) # Shortcut for the path to the fpcmp executable set(FPCMP ${CMAKE_BINARY_DIR}/tools/fpcmp) Index: MultiSource/UnitTests/C++11/CMakeLists.txt =================================================================== --- MultiSource/UnitTests/C++11/CMakeLists.txt +++ MultiSource/UnitTests/C++11/CMakeLists.txt @@ -1,5 +1,5 @@ list(APPEND CPPFLAGS -std=c++11) -string(FIND "${MIPSARCH}" "mips16" TMP1) -if("" STREQUAL "${TMP1}") + +if(NOT MIPS_IS_MIPS16_ENABLED) llvm_add_subdirectories(frame_layout) endif() Index: MultiSource/UnitTests/Mips/CMakeLists.txt =================================================================== --- MultiSource/UnitTests/Mips/CMakeLists.txt +++ MultiSource/UnitTests/Mips/CMakeLists.txt @@ -1,4 +1,3 @@ -string(FIND "${MIPSARCH}" "mips16" TMP1) -if("" STREQUAL "${TMP1}") +if(MIPS_IS_MIPS16_ENABLED) llvm_add_subdirectories(Mips16) endif() Index: SingleSource/UnitTests/CMakeLists.txt =================================================================== --- SingleSource/UnitTests/CMakeLists.txt +++ SingleSource/UnitTests/CMakeLists.txt @@ -21,8 +21,8 @@ endif() if("${ARCH}" STREQUAL "Mips") llvm_add_subdirectories(Mips) - string(FIND "${MIPSARCH}" "mips64" TMP2) - if("" STREQUAL "${TMP2}") + # Only MIPS 64-bit supports 8 bytes atomic operations. + if(NOT MIPS_IS_MIPS64_ENABLED) list(APPEND PROGRAMS_TO_SKIP AtomicOps) endif() endif() Index: SingleSource/UnitTests/Mips/CMakeLists.txt =================================================================== --- SingleSource/UnitTests/Mips/CMakeLists.txt +++ SingleSource/UnitTests/Mips/CMakeLists.txt @@ -1,4 +1,3 @@ -string(FIND "${MIPSARCH}" "mips16" TMP1) -if(NOT "" STREQUAL "${TMP1}") +if(MIPS_IS_MIPS16_ENABLED) llvm_add_subdirectories(Mips16) endif()