62 lines · cpp
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-exception6//7//===----------------------------------------------------------------------===//8///9/// \file10/// This file contains the conformance test of the atanhf16 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 26using namespace mathtest;27 28extern "C" float16 atanhf16(float16);29 30namespace mathtest {31 32template <> struct FunctionConfig<atanhf16> {33 static constexpr llvm::StringRef Name = "atanhf16";34 static constexpr llvm::StringRef KernelName = "atanhf16Kernel";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 mathtest41 42int main(int argc, const char **argv) {43 llvm::cl::ParseCommandLineOptions(44 argc, argv, "Conformance test of the atanhf16 function");45 46 using namespace mathtest;47 48 IndexedRange<float16> Range(/*Begin=*/float16(-1.0),49 /*End=*/float16(1.0),50 /*Inclusive=*/true);51 ExhaustiveGenerator<float16> Generator(Range);52 53 const auto Configs = cl::getTestConfigs();54 const llvm::StringRef DeviceBinaryDir = DEVICE_BINARY_DIR;55 const bool IsVerbose = cl::IsVerbose;56 57 bool Passed =58 runTests<atanhf16>(Generator, Configs, DeviceBinaryDir, IsVerbose);59 60 return Passed ? EXIT_SUCCESS : EXIT_FAILURE;61}62