-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[libc][cmake] Do not overwrite SKIP_FLAG_EXPANSION_*. #125762
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@llvm/pr-subscribers-libc Author: None (lntue) ChangesSo that users can set these manually if needed. Full diff: https://github.com/llvm/llvm-project/pull/125762.diff 1 Files Affected:
diff --git a/libc/cmake/modules/LLVMLibCFlagRules.cmake b/libc/cmake/modules/LLVMLibCFlagRules.cmake
index e5b0e249c90676..7d5e73c2f12148 100644
--- a/libc/cmake/modules/LLVMLibCFlagRules.cmake
+++ b/libc/cmake/modules/LLVMLibCFlagRules.cmake
@@ -268,23 +268,29 @@ set(EXPLICIT_SIMD_OPT_FLAG "EXPLICIT_SIMD_OPT")
set(MISC_MATH_BASIC_OPS_OPT_FLAG "MISC_MATH_BASIC_OPS_OPT")
# Skip FMA_OPT flag for targets that don't support fma.
-if(NOT((LIBC_TARGET_ARCHITECTURE_IS_X86_64 AND (LIBC_CPU_FEATURES MATCHES "FMA")) OR
- LIBC_TARGET_ARCHITECTURE_IS_RISCV64))
- set(SKIP_FLAG_EXPANSION_FMA_OPT TRUE)
+if(NOT DEFINED SKIP_FLAG_EXPANSION_FMA_OPT)
+ if(NOT((LIBC_TARGET_ARCHITECTURE_IS_X86_64 AND (LIBC_CPU_FEATURES MATCHES "FMA")) OR
+ LIBC_TARGET_ARCHITECTURE_IS_RISCV64))
+ set(SKIP_FLAG_EXPANSION_FMA_OPT TRUE)
+ endif()
endif()
# Skip EXPLICIT_SIMD_OPT flag for targets that don't support SSE2.
# Note: one may want to revisit it if they want to control other explicit SIMD
-if(NOT(LIBC_TARGET_ARCHITECTURE_IS_X86_64 AND (LIBC_CPU_FEATURES MATCHES "SSE2")))
- set(SKIP_FLAG_EXPANSION_EXPLICIT_SIMD_OPT TRUE)
+if(NOT DEFINED SKIP_FLAG_EXPANSION_EXPLICIT_SIMD_OPT)
+ if(NOT(LIBC_TARGET_ARCHITECTURE_IS_X86_64 AND (LIBC_CPU_FEATURES MATCHES "SSE2")))
+ set(SKIP_FLAG_EXPANSION_EXPLICIT_SIMD_OPT TRUE)
+ endif()
endif()
# Skip ROUND_OPT flag for targets that don't support rounding instructions. On
# x86, these are SSE4.1 instructions, but we already had code to check for
# SSE4.2 support.
-if(NOT((LIBC_TARGET_ARCHITECTURE_IS_X86_64 AND (LIBC_CPU_FEATURES MATCHES "SSE4_2")) OR
- LIBC_TARGET_ARCHITECTURE_IS_AARCH64 OR LIBC_TARGET_OS_IS_GPU))
- set(SKIP_FLAG_EXPANSION_ROUND_OPT TRUE)
+if(NOT DEFINED SKIP_FLAG_EXPANSION_ROUND_OPT)
+ if(NOT((LIBC_TARGET_ARCHITECTURE_IS_X86_64 AND (LIBC_CPU_FEATURES MATCHES "SSE4_2")) OR
+ LIBC_TARGET_ARCHITECTURE_IS_AARCH64 OR LIBC_TARGET_OS_IS_GPU))
+ set(SKIP_FLAG_EXPANSION_ROUND_OPT TRUE)
+ endif()
endif()
# Choose whether time_t is 32- or 64-bit, based on target architecture
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought that's what FORCE
did for set
statements?
https://cmake.org/cmake/help/latest/command/set.html#set-cache-entry
i.e., if FORCE
wasn't set, set
would not re-set a value when it was specified by a user?
I don't care much either way, but perhaps I misremember what FORCE
does. Because we don't use FORCE
for these set statements, I would have thought we already do not overwrite these.
perhaps @petrhosek can clarify before you land this?
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/153/builds/22033 Here is the relevant piece of the build log for the reference
|
|
What's the motivation for this change? Why would users want to enable these features even when they aren't supported? |
So that users can set these manually if needed.
So that users can set these manually if needed.