Debian Codegraph @

offload/unittests/Conformance/tests/Exp10f16Test.cpp

raw
1 //===----------------------------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 ///
9 /// \file
10 /// This file contains the conformance test of the exp10f16 function.
11 ///
12 //===----------------------------------------------------------------------===//
13
14 #include "mathtest/CommandLineExtras.hpp"
15 #include "mathtest/ExhaustiveGenerator.hpp"
16 #include "mathtest/IndexedRange.hpp"
17 #include "mathtest/TestConfig.hpp"
18 #include "mathtest/TestRunner.hpp"
19 #include "mathtest/TypeExtras.hpp"
20
21 #include "llvm/ADT/StringRef.h"
22
23 #include <cstdlib>
24 #include <math.h>
25
26 using namespace mathtest;
27
28 extern "C" float16 exp10f16(float16);
29
30 namespace mathtest {
31
32 template <> struct FunctionConfig<exp10f16> {
33 static constexpr llvm::StringRef Name = "exp10f16";
34 static constexpr llvm::StringRef KernelName = "exp10f16Kernel";
35
36 // Source: The Khronos Group, The OpenCL C Specification v3.0.19, Sec. 7.4,
37 // Table 69 (Full Profile), Khronos Registry [July 10, 2025].
38 static constexpr uint64_t UlpTolerance = 2;
39 };
40 } // namespace mathtest
41
42 int main(int argc, const char **argv) {
43 llvm::cl::ParseCommandLineOptions(
44 argc, argv, "Conformance test of the exp10f16 function");
45
46 using namespace mathtest;
47
48 IndexedRange<float16> Range;
49 ExhaustiveGenerator<float16> Generator(Range);
50
51 const auto Configs = cl::getTestConfigs();
52 const llvm::StringRef DeviceBinaryDir = DEVICE_BINARY_DIR;
53 const bool IsVerbose = cl::IsVerbose;
54
55 bool Passed =
56 runTests<exp10f16>(Generator, Configs, DeviceBinaryDir, IsVerbose);
57
58 return Passed ? EXIT_SUCCESS : EXIT_FAILURE;
59 }