Skip to content

Commit

Permalink
Fancier solution
Browse files Browse the repository at this point in the history
  • Loading branch information
eggrobin committed Mar 30, 2024
1 parent 0d65cc0 commit 87ab5a6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 2 additions & 0 deletions ksp_plugin_test/plugin_compatibility_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,8 @@ TEST_P(PluginCompatibilityTest, Reach) {
std::optional<FMAPreventer> fma_preventer;
if (!GetParam()) {
fma_preventer.emplace();
} else if (!UseHardwareFMA) {
GTEST_SKIP() << "FMA not used by default";
}
StringLogSink log_warning(google::WARNING);
not_null<std::unique_ptr<Plugin const>> plugin = ReadPluginFromFile(
Expand Down
9 changes: 4 additions & 5 deletions numerics/fma.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,10 @@ inline bool const& UseHardwareFMA = FMAPreventer::use_hardware_fma;
// The functions in this file unconditionally wrap the appropriate intrinsics.
// The caller may only use them if |UseHardwareFMA| is true.
inline bool const UseHardwareFMA = PRINCIPIA_USE_HARDWARE_FMA_DEFAULT;
#if PRINCIPIA_COMPILER_MSVC
class FMAPreventer; // Undefined.
#else
class FMAPreventer {}; // Nothing to prevent.
#endif
struct TrivialFMAPreventer {};
using FMAPreventer = std::conditional_t<CanEmitFMAInstructions,
struct UndefinedFMAPreventer,
TrivialFMAPreventer>;
#endif

#undef PRINCIPIA_USE_HARDWARE_FMA_DEFAULT
Expand Down

0 comments on commit 87ab5a6

Please sign in to comment.