diff --git a/compiler-rt/lib/builtins/CMakeLists.txt b/compiler-rt/lib/builtins/CMakeLists.txt --- a/compiler-rt/lib/builtins/CMakeLists.txt +++ b/compiler-rt/lib/builtins/CMakeLists.txt @@ -735,6 +735,10 @@ add_custom_target(builtins) set_target_properties(builtins PROPERTIES FOLDER "Compiler-RT Misc") +option(COMPILER_RT_FORCE_ENABLE_INT128 + "Enable the int128 builtin routines for all targets." + OFF) + if (APPLE) add_subdirectory(Darwin-excludes) add_subdirectory(macho_embedded) @@ -811,7 +815,7 @@ # For RISCV32, we must force enable int128 for compiling long # double routines. - if("${arch}" STREQUAL "riscv32") + if(COMPILER_RT_FORCE_ENABLE_INT128 OR "${arch}" STREQUAL "riscv32") list(APPEND BUILTIN_CFLAGS_${arch} -fforce-enable-int128) endif() diff --git a/compiler-rt/test/builtins/CMakeLists.txt b/compiler-rt/test/builtins/CMakeLists.txt --- a/compiler-rt/test/builtins/CMakeLists.txt +++ b/compiler-rt/test/builtins/CMakeLists.txt @@ -39,7 +39,7 @@ string(REPLACE ";" " " BUILTINS_TEST_TARGET_CFLAGS "${BUILTINS_TEST_TARGET_CFLAGS}") endif() - if (${arch} STREQUAL "riscv32") + if (COMPILER_RT_FORCE_ENABLE_INT128 OR ${arch} STREQUAL "riscv32") list(APPEND BUILTINS_TEST_TARGET_CFLAGS -fforce-enable-int128) string(REPLACE ";" " " BUILTINS_TEST_TARGET_CFLAGS "${BUILTINS_TEST_TARGET_CFLAGS}") endif()