Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/llvm/llvm-project.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTue Ly <lntue@google.com>2022-07-16 05:59:36 +0300
committerTue Ly <lntue@google.com>2022-07-22 16:29:41 +0300
commited261e710693cd611fd003db45a85bdeba1e8367 (patch)
treeb131856c228ac51f8fae313a72091da7ce7e731e /libc/cmake/modules/LLVMLibCObjectRules.cmake
parent06dbcf7b2bbe5beb3174c33cced029a2fac87168 (diff)
[libc] Add float type and flag for nearest_integer to enable SSE4.2.
Add float type and flag for nearest integer to automatically test with and without SSE4.2 flag. Reviewed By: sivachandra Differential Revision: https://reviews.llvm.org/D129916
Diffstat (limited to 'libc/cmake/modules/LLVMLibCObjectRules.cmake')
-rw-r--r--libc/cmake/modules/LLVMLibCObjectRules.cmake11
1 files changed, 11 insertions, 0 deletions
diff --git a/libc/cmake/modules/LLVMLibCObjectRules.cmake b/libc/cmake/modules/LLVMLibCObjectRules.cmake
index 760a8cb9e27e..a824cad94b7c 100644
--- a/libc/cmake/modules/LLVMLibCObjectRules.cmake
+++ b/libc/cmake/modules/LLVMLibCObjectRules.cmake
@@ -9,6 +9,14 @@ function(_get_common_compile_options output_var flags)
set(ADD_FMA_FLAG TRUE)
endif()
+ list(FIND flags ${ROUND_OPT_FLAG} round)
+ if(${round} LESS 0)
+ list(FIND flags "${ROUND_OPT_FLAG}__ONLY" round)
+ endif()
+ if((${round} GREATER -1) AND (LIBC_CPU_FEATURES MATCHES "SSE4_2"))
+ set(ADD_SSE4_2_FLAG TRUE)
+ endif()
+
set(compile_options ${LIBC_COMPILE_OPTIONS_DEFAULT} ${ARGN})
if(NOT ${LIBC_TARGET_OS} STREQUAL "windows")
set(compile_options ${compile_options} -fpie -ffreestanding -fno-builtin)
@@ -21,6 +29,9 @@ function(_get_common_compile_options output_var flags)
if(ADD_FMA_FLAG)
list(APPEND compile_options "-mfma")
endif()
+ if(ADD_SSE4_2_FLAG)
+ list(APPEND compile_options "-msse4.2")
+ endif()
elseif(MSVC)
list(APPEND compile_options "/EHs-c-")
list(APPEND compile_options "/GR-")