xref: /llvm-project/libc/test/src/math/performance_testing/exp2f16_perf.cpp (revision 936515c7a5607f83aa0684586c7e34ab4b8387ff)
1*936515c7SOverMighty //===-- Performance test for exp2f16 --------------------------------------===//
2*936515c7SOverMighty //
3*936515c7SOverMighty // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4*936515c7SOverMighty // See https://llvm.org/LICENSE.txt for license information.
5*936515c7SOverMighty // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6*936515c7SOverMighty //
7*936515c7SOverMighty //===----------------------------------------------------------------------===//
8*936515c7SOverMighty 
9*936515c7SOverMighty #include "SingleInputSingleOutputPerf.h"
10*936515c7SOverMighty 
11*936515c7SOverMighty #include "src/math/exp2f16.h"
12*936515c7SOverMighty 
13*936515c7SOverMighty // LLVM libc might be the only libc implementation with support for float16 math
14*936515c7SOverMighty // functions currently. We can't compare our float16 functions against the
15*936515c7SOverMighty // system libc, so we compare them against this placeholder function.
16*936515c7SOverMighty static float16 placeholderf16(float16 x) { return x; }
17*936515c7SOverMighty 
18*936515c7SOverMighty int main() {
19*936515c7SOverMighty   SINGLE_INPUT_SINGLE_OUTPUT_PERF_EX(float16, LIBC_NAMESPACE::exp2f16,
20*936515c7SOverMighty                                      ::placeholderf16, 20'000,
21*936515c7SOverMighty                                      "exp2f16_perf.log")
22*936515c7SOverMighty }
23