brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.9 KiB · eae9818 Raw
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 tanf16 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 tanf16(float16);29 30namespace mathtest {31 32template <> struct FunctionConfig<tanf16> {33  static constexpr llvm::StringRef Name = "tanf16";34  static constexpr llvm::StringRef KernelName = "tanf16Kernel";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  // Note:   The minimum accuracy at the source is 2.5 ULP, but we round it39  //         down to ensure conformance.40  static constexpr uint64_t UlpTolerance = 2;41};42} // namespace mathtest43 44int main(int argc, const char **argv) {45  llvm::cl::ParseCommandLineOptions(argc, argv,46                                    "Conformance test of the tanf16 function");47 48  using namespace mathtest;49 50  IndexedRange<float16> Range;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<tanf16>(Generator, Configs, DeviceBinaryDir, IsVerbose);59 60  return Passed ? EXIT_SUCCESS : EXIT_FAILURE;61}62