brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.8 KiB · 39094f4 Raw
59 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 hypotf16 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 hypotf16(float16, float16);29 30namespace mathtest {31 32template <> struct FunctionConfig<hypotf16> {33  static constexpr llvm::StringRef Name = "hypotf16";34  static constexpr llvm::StringRef KernelName = "hypotf16Kernel";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 hypotf16 function");45 46  IndexedRange<float16> RangeX;47  IndexedRange<float16> RangeY;48  ExhaustiveGenerator<float16, float16> Generator(RangeX, RangeY);49 50  const auto Configs = cl::getTestConfigs();51  const llvm::StringRef DeviceBinaryDir = DEVICE_BINARY_DIR;52  const bool IsVerbose = cl::IsVerbose;53 54  bool Passed =55      runTests<hypotf16>(Generator, Configs, DeviceBinaryDir, IsVerbose);56 57  return Passed ? EXIT_SUCCESS : EXIT_FAILURE;58}59