Skip to content

Commit

Permalink
Enable reciprocal math
Browse files Browse the repository at this point in the history
  • Loading branch information
nilsdeppe committed Feb 3, 2023
1 parent 901ba22 commit 780cb26
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions cmake/SetupCxxFlags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,15 @@ set_property(TARGET SpectreFlags
$<$<COMPILE_LANGUAGE:CXX>:-ffp-contract=on>
$<$<COMPILE_LANGUAGE:Fortran>:-ffp-contract=on>)

# Allow the compiler to transform divisions into multiplication by the
# reciprocal.
set_property(TARGET SpectreFlags
APPEND PROPERTY
INTERFACE_COMPILE_OPTIONS
$<$<COMPILE_LANGUAGE:C>:-freciprocal-math>
$<$<COMPILE_LANGUAGE:CXX>:-freciprocal-math>
$<$<COMPILE_LANGUAGE:Fortran>:-freciprocal-math>)

# By default, the LLVM optimizer assumes floating point exceptions are ignored.
create_cxx_flag_target("-ffp-exception-behavior=maytrap" SpectreFpExceptions)
target_link_libraries(
Expand Down

0 comments on commit 780cb26

Please sign in to comment.