Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions libc/cmake/modules/LLVMLibCCompileOptionRules.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,6 @@ function(_get_compile_options_from_flags output_var)
elseif(LIBC_TARGET_ARCHITECTURE_IS_RISCV64)
list(APPEND compile_options "-D__LIBC_RISCV_USE_FMA")
endif()
# For clang, we will build the math functions with `-fno-math-errno` so that
# __builtin_fma* will generate the fused-mutliply-add instructions. We
# don't put the control flag to the public config yet, and see if it makes
# sense to just enable this flag by default.
if(LIBC_ADD_FNO_MATH_ERRNO)
list(APPEND compile_options "-fno-math-errno")
endif()
endif()
if(ADD_ROUND_OPT_FLAG)
if(LIBC_TARGET_ARCHITECTURE_IS_X86_64)
Expand Down Expand Up @@ -104,6 +97,9 @@ function(_get_compile_options_from_config output_var)

if(LIBC_CONF_MATH_OPTIMIZATIONS)
list(APPEND config_options "-DLIBC_MATH=${LIBC_CONF_MATH_OPTIMIZATIONS}")
if(LIBC_CONF_MATH_OPTIMIZATIONS MATCHES "LIBC_MATH_NO_ERRNO")
list(APPEND config_options "-fno-math-errno")
endif()
endif()

set(${output_var} ${config_options} PARENT_SCOPE)
Expand Down
5 changes: 0 additions & 5 deletions libc/cmake/modules/LLVMLibCTestRules.cmake
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
function(_get_common_test_compile_options output_var c_test flags)
_get_compile_options_from_flags(compile_flags ${flags})

# Remove -fno-math-errno if it was added.
if(LIBC_ADD_FNO_MATH_ERRNO)
list(REMOVE_ITEM compile_options "-fno-math-errno")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are there tests failed because of this part? Last time I tried, there are failed math tests that check errno when the tests are built with -fno-math-errno.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see any test failures on the presubmit bots, should those exercise all tests?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean the tests failed when the flag is set. I don't think any of our bots running baremetal config, so they don't cover this option.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't currently run tests on baremetal so I don't know if we have any way to find out.

endif()

set(compile_options
${LIBC_COMPILE_OPTIONS_DEFAULT}
${LIBC_TEST_COMPILE_OPTIONS_DEFAULT}
Expand Down
2 changes: 1 addition & 1 deletion libc/config/baremetal/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
},
"math": {
"LIBC_CONF_MATH_OPTIMIZATIONS": {
"value": "(LIBC_MATH_SKIP_ACCURATE_PASS | LIBC_MATH_SMALL_TABLES)"
"value": "(LIBC_MATH_SKIP_ACCURATE_PASS | LIBC_MATH_SMALL_TABLES | LIBC_MATH_NO_ERRNO)"
}
}
}