brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.9 KiB · 4388cf4 Raw
58 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 log1pf 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 <limits>24#include <math.h>25 26namespace mathtest {27 28template <> struct FunctionConfig<log1pf> {29  static constexpr llvm::StringRef Name = "log1pf";30  static constexpr llvm::StringRef KernelName = "log1pfKernel";31 32  // Source: The Khronos Group, The OpenCL C Specification v3.0.19, Sec. 7.4,33  //         Table 65, Khronos Registry [July 10, 2025].34  static constexpr uint64_t UlpTolerance = 2;35};36} // namespace mathtest37 38int main(int argc, const char **argv) {39  llvm::cl::ParseCommandLineOptions(argc, argv,40                                    "Conformance test of the log1pf function");41 42  using namespace mathtest;43 44  IndexedRange<float> Range(/*Begin=*/-1.0f,45                            /*End=*/std::numeric_limits<float>::infinity(),46                            /*Inclusive=*/true);47  ExhaustiveGenerator<float> Generator(Range);48 49  const auto Configs = cl::getTestConfigs();50  const llvm::StringRef DeviceBinaryDir = DEVICE_BINARY_DIR;51  const bool IsVerbose = cl::IsVerbose;52 53  bool Passed =54      runTests<log1pf>(Generator, Configs, DeviceBinaryDir, IsVerbose);55 56  return Passed ? EXIT_SUCCESS : EXIT_FAILURE;57}58