[libc-commits] [PATCH] D143234: [libc] Add -mavx2 together with -mfma to allow clang pre-12 to generate fmainstructions.

Tue Ly via Phabricator via libc-commits libc-commits at lists.llvm.org
Thu Feb 2 17:08:10 PST 2023


lntue created this revision.
lntue added reviewers: michaelrj, sivachandra.
Herald added subscribers: ecnelises, tschuett.
Herald added projects: libc-project, All.
lntue requested review of this revision.

For clang-11, having -mfma without -mavx2 does not generate fma
instructions, causing a build bot to fail on log10_test.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D143234

Files:
  libc/cmake/modules/LLVMLibCObjectRules.cmake
  libc/test/src/math/CMakeLists.txt


Index: libc/test/src/math/CMakeLists.txt
===================================================================
--- libc/test/src/math/CMakeLists.txt
+++ libc/test/src/math/CMakeLists.txt
@@ -1317,24 +1317,22 @@
     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
Index: libc/cmake/modules/LLVMLibCObjectRules.cmake
===================================================================
--- libc/cmake/modules/LLVMLibCObjectRules.cmake
+++ libc/cmake/modules/LLVMLibCObjectRules.cmake
@@ -39,6 +39,7 @@
       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)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D143234.494476.patch
Type: text/x-patch
Size: 1424 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libc-commits/attachments/20230203/58921653/attachment.bin>


More information about the libc-commits mailing list