[libc-commits] [libc] c1e2524 - [libc] Add -mavx2 together with -mfma to allow clang pre-12 to generate fma
Tue Ly via libc-commits
libc-commits at lists.llvm.org
Fri Feb 3 12:12:17 PST 2023
Author: Tue Ly
Date: 2023-02-03T15:12:09-05:00
New Revision: c1e252417e399557157e977d8bfb3033bd567f46
URL: https://github.com/llvm/llvm-project/commit/c1e252417e399557157e977d8bfb3033bd567f46
DIFF: https://github.com/llvm/llvm-project/commit/c1e252417e399557157e977d8bfb3033bd567f46.diff
LOG: [libc] Add -mavx2 together with -mfma to allow clang pre-12 to generate fma
instructions.
For clang-11, having -mfma without -mavx2 does not generate fma
instructions, causing a build bot to fail on log10_test.
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/D143234
Added:
Modified:
libc/cmake/modules/LLVMLibCObjectRules.cmake
libc/test/src/math/CMakeLists.txt
Removed:
################################################################################
diff --git a/libc/cmake/modules/LLVMLibCObjectRules.cmake b/libc/cmake/modules/LLVMLibCObjectRules.cmake
index 4ac540a4c550f..4100d3d482878 100644
--- a/libc/cmake/modules/LLVMLibCObjectRules.cmake
+++ b/libc/cmake/modules/LLVMLibCObjectRules.cmake
@@ -39,6 +39,7 @@ function(_get_common_compile_options output_var flags)
list(APPEND compile_options "-Wthread-safety")
endif()
if(ADD_FMA_FLAG)
+ list(APPEND compile_options "-mavx2")
list(APPEND compile_options "-mfma")
endif()
if(ADD_SSE4_2_FLAG)
diff --git a/libc/test/src/math/CMakeLists.txt b/libc/test/src/math/CMakeLists.txt
index 1360ae2a927e1..8b559c3e9c3eb 100644
--- a/libc/test/src/math/CMakeLists.txt
+++ b/libc/test/src/math/CMakeLists.txt
@@ -1317,24 +1317,22 @@ add_fp_unittest(
libc.src.__support.FPUtil.fp_bits
)
-# TODO: Enable log10_test after #60282 is addressed. It is disabled for now
-# as it is failing on the bots.
-#add_fp_unittest(
-# log10_test
-# NEED_MPFR
-# SUITE
-# libc_math_unittests
-# SRCS
-# log10_test.cpp
-# DEPENDS
-# libc.include.errno
-# libc.src.errno.errno
-# libc.include.math
-# libc.src.math.log10
-# libc.src.__support.FPUtil.fp_bits
-# FLAGS
-# FMA_OPT__ONLY
-#)
+add_fp_unittest(
+ log10_test
+ NEED_MPFR
+ SUITE
+ libc_math_unittests
+ SRCS
+ log10_test.cpp
+ DEPENDS
+ libc.include.errno
+ libc.src.errno.errno
+ libc.include.math
+ libc.src.math.log10
+ libc.src.__support.FPUtil.fp_bits
+ FLAGS
+ FMA_OPT__ONLY
+)
add_fp_unittest(
log10f_test
More information about the libc-commits
mailing list