| 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 acoshf16 function. |
| 11 |
/// |
| 12 |
//===----------------------------------------------------------------------===// |
| 13 |
|
| 14 |
#include "mathtest/CommandLineExtras.hpp" |
| 15 |
#include "mathtest/ExhaustiveGenerator.hpp" |
| 16 |
#include "mathtest/IndexedRange.hpp" |
| 17 |
#include "mathtest/Numerics.hpp" |
| 18 |
#include "mathtest/TestConfig.hpp" |
| 19 |
#include "mathtest/TestRunner.hpp" |
| 20 |
#include "mathtest/TypeExtras.hpp" |
| 21 |
|
| 22 |
#include "llvm/ADT/StringRef.h" |
| 23 |
|
| 24 |
#include <cstdlib> |
| 25 |
#include <math.h> |
| 26 |
|
| 27 |
using namespace mathtest; |
| 28 |
|
| 29 |
extern "C" float16 acoshf16(float16); |
| 30 |
|
| 31 |
namespace mathtest { |
| 32 |
|
| 33 |
template <> struct FunctionConfig<acoshf16> { |
| 34 |
static constexpr llvm::StringRef Name = "acoshf16"; |
| 35 |
static constexpr llvm::StringRef KernelName = "acoshf16Kernel"; |
| 36 |
|
| 37 |
// Source: The Khronos Group, The OpenCL C Specification v3.0.19, Sec. 7.4, |
| 38 |
// Table 69 (Full Profile), Khronos Registry [July 10, 2025]. |
| 39 |
static constexpr uint64_t UlpTolerance = 2; |
| 40 |
}; |
| 41 |
} // namespace mathtest |
| 42 |
|
| 43 |
int main(int argc, const char **argv) { |
| 44 |
llvm::cl::ParseCommandLineOptions( |
| 45 |
argc, argv, "Conformance test of the acoshf16 function"); |
| 46 |
|
| 47 |
using namespace mathtest; |
| 48 |
|
| 49 |
IndexedRange<float16> Range(/*Begin=*/float16(1.0), |
| 50 |
/*End=*/getMaxOrInf<float16>(), |
| 51 |
/*Inclusive=*/true); |
| 52 |
ExhaustiveGenerator<float16> Generator(Range); |
| 53 |
|
| 54 |
const auto Configs = cl::getTestConfigs(); |
| 55 |
const llvm::StringRef DeviceBinaryDir = DEVICE_BINARY_DIR; |
| 56 |
const bool IsVerbose = cl::IsVerbose; |
| 57 |
|
| 58 |
bool Passed = |
| 59 |
runTests<acoshf16>(Generator, Configs, DeviceBinaryDir, IsVerbose); |
| 60 |
|
| 61 |
return Passed ? EXIT_SUCCESS : EXIT_FAILURE; |
| 62 |
} |