Skip to content

Commit

Permalink
missing file
Browse files Browse the repository at this point in the history
  • Loading branch information
eggrobin committed Dec 29, 2024
1 parent 0a811f4 commit b18890d
Showing 1 changed file with 58 additions and 0 deletions.
58 changes: 58 additions & 0 deletions nanobenchmarks/examples.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
#include <emmintrin.h>

#include "nanobenchmarks/function_registry.hpp"
#include "numerics/cbrt.hpp"

namespace principia {
namespace nanobenchmarks {
namespace _examples {

using namespace principia::numerics::_cbrt;

BENCHMARKED_FUNCTION(twice) {
return 2 * x;
}

BENCHMARKED_FUNCTION(thrice) {
return 3 * x;
}

BENCHMARKED_FUNCTION(inc) {
return x + 1;
}

BENCHMARKED_FUNCTION(add_4_times) {
return x * x * x * x * x;
}

BENCHMARKED_FUNCTION(add_16_times) {
return x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x;
}

BENCHMARKED_FUNCTION(square_root) {
__m128d x_0 = _mm_set_sd(x);
return _mm_cvtsd_f64(_mm_sqrt_sd(x_0, x_0));
}

BENCHMARKED_FUNCTION(sqrt_sqrt) {
__m128d x_0 = _mm_set_sd(x);
x_0 = _mm_sqrt_sd(x_0, x_0);
return _mm_cvtsd_f64(_mm_sqrt_sd(x_0, x_0));
}

BENCHMARKED_FUNCTION(square_root_division) {
__m128d x_0 = _mm_set_sd(x);
return _mm_cvtsd_f64(_mm_div_sd(x_0, _mm_sqrt_sd(x_0, x_0)));
}
BENCHMARK_FUNCTION(Cbrt);

using namespace principia::numerics::_cbrt::internal;

BENCHMARK_FUNCTION(method_3²ᴄZ5¹::Cbrt<Rounding::Faithful>);
BENCHMARK_FUNCTION(method_3²ᴄZ5¹::Cbrt<Rounding::Correct>);
BENCHMARK_FUNCTION(method_5²Z4¹FMA::Cbrt<Rounding::Faithful>);
BENCHMARK_FUNCTION(method_5²Z4¹FMA::Cbrt<Rounding::Correct>);

} // namespace _examples
} // namespace nanobenchmarks
} // namespace principia

Check warning on line 58 in nanobenchmarks/examples.cpp

View workflow job for this annotation

GitHub Actions / check-cpp

whitespace/ending_newline

Could not find a newline character at the end of the file.

0 comments on commit b18890d

Please sign in to comment.