Skip to content
Closed
Show file tree
Hide file tree
Changes from all 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
12 changes: 12 additions & 0 deletions libc/test/src/math/performance_testing/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -475,6 +475,18 @@ add_perf_binary(
libc.src.math.fminimum_numf16
COMPILE_OPTIONS
-fno-builtin
)

add_perf_binary(
fadd_perf
SRCS
fadd_perf.cpp
DEPENDS
.binary_op_single_output_diff
libc.src.math.fadd
libc.src.__support.FPUtil.fp_bits
COMPILE_OPTIONS
-fno-builtin
)

add_perf_binary(
Expand Down
23 changes: 23 additions & 0 deletions libc/test/src/math/performance_testing/fadd_perf.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
//===-- Performance test for the fadd function ----------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#include "BinaryOpSingleOutputPerf.h"
#include "src/math/fadd.h"

static constexpr size_t DOUBLE_ROUNDS = 40;

float fadd_placeholder_binary(double x, double y) {
return static_cast<float>(x + y);
}

int main() {
BINARY_OP_SINGLE_OUTPUT_PERF_EX(float, double, LIBC_NAMESPACE::fadd,
fadd_placeholder_binary, DOUBLE_ROUNDS,
"fadd_perf.log")
return 0;
}