[compiler-rt] c2d6cc9 - [builtins] Add option to always build int128 routines

Shoaib Meenai via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 28 16:38:45 PST 2023


Author: Shoaib Meenai
Date: 2023-02-28T16:38:24-08:00
New Revision: c2d6cc9ac41cf83833b3d995aa1bb3b17b8204ea

URL: https://github.com/llvm/llvm-project/commit/c2d6cc9ac41cf83833b3d995aa1bb3b17b8204ea
DIFF: https://github.com/llvm/llvm-project/commit/c2d6cc9ac41cf83833b3d995aa1bb3b17b8204ea.diff

LOG: [builtins] Add option to always build int128 routines

32-bit targets don't build these by default, but e.g. armv7 and x86 can
build them just fine, and it's useful to have the int128 routines
available for certain applications. Add a CMake option to let us include
the int128 routines for architectures which would otherwise lack them.

Reviewed By: compnerd, MaskRay, phosek

Differential Revision: https://reviews.llvm.org/D145003

Added: 
    

Modified: 
    compiler-rt/lib/builtins/CMakeLists.txt
    compiler-rt/test/builtins/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/builtins/CMakeLists.txt b/compiler-rt/lib/builtins/CMakeLists.txt
index 5e2274d522560..891a92f5e19b8 100644
--- a/compiler-rt/lib/builtins/CMakeLists.txt
+++ b/compiler-rt/lib/builtins/CMakeLists.txt
@@ -735,6 +735,10 @@ set(ve_SOURCES
 add_custom_target(builtins)
 set_target_properties(builtins PROPERTIES FOLDER "Compiler-RT Misc")
 
+option(COMPILER_RT_ENABLE_SOFTWARE_INT128
+  "Enable the int128 builtin routines for all targets."
+  OFF)
+
 if (APPLE)
   add_subdirectory(Darwin-excludes)
   add_subdirectory(macho_embedded)
@@ -811,7 +815,7 @@ else ()
 
       # For RISCV32, we must force enable int128 for compiling long
       # double routines.
-      if("${arch}" STREQUAL "riscv32")
+      if(COMPILER_RT_ENABLE_SOFTWARE_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
index ceacbd8335804..57117f64bff91 100644
--- a/compiler-rt/test/builtins/CMakeLists.txt
+++ b/compiler-rt/test/builtins/CMakeLists.txt
@@ -39,7 +39,7 @@ foreach(arch ${BUILTIN_TEST_ARCH})
     string(REPLACE ";" " " BUILTINS_TEST_TARGET_CFLAGS "${BUILTINS_TEST_TARGET_CFLAGS}")
   endif()
 
-  if (${arch} STREQUAL "riscv32")
+  if (COMPILER_RT_ENABLE_SOFTWARE_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()


        


More information about the llvm-commits mailing list