Debian Codegraph @

offload/unittests/Conformance/tests/CospifTest.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 cospif 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
20 #include "llvm/ADT/StringRef.h"
21
22 #include <cstdlib>
23 #include <math.h>
24
25 extern "C" float cospif(float);
26
27 namespace mathtest {
28
29 template <> struct FunctionConfig<cospif> {
30 static constexpr llvm::StringRef Name = "cospif";
31 static constexpr llvm::StringRef KernelName = "cospifKernel";
32
33 // Source: The Khronos Group, The OpenCL C Specification v3.0.19, Sec. 7.4,
34 // Table 65, Khronos Registry [July 10, 2025].
35 static constexpr uint64_t UlpTolerance = 4;
36 };
37 } // namespace mathtest
38
39 int main(int argc, const char **argv) {
40 llvm::cl::ParseCommandLineOptions(argc, argv,
41 "Conformance test of the cospif function");
42
43 using namespace mathtest;
44
45 IndexedRange<float> Range;
46 ExhaustiveGenerator<float> Generator(Range);
47
48 const auto Configs = cl::getTestConfigs();
49 const llvm::StringRef DeviceBinaryDir = DEVICE_BINARY_DIR;
50 const bool IsVerbose = cl::IsVerbose;
51
52 bool Passed =
53 runTests<cospif>(Generator, Configs, DeviceBinaryDir, IsVerbose);
54
55 return Passed ? EXIT_SUCCESS : EXIT_FAILURE;
56 }