63 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 log10f16 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 27using namespace mathtest;28 29extern "C" float16 log10f16(float16);30 31namespace mathtest {32 33template <> struct FunctionConfig<log10f16> {34 static constexpr llvm::StringRef Name = "log10f16";35 static constexpr llvm::StringRef KernelName = "log10f16Kernel";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 mathtest42 43int main(int argc, const char **argv) {44 llvm::cl::ParseCommandLineOptions(45 argc, argv, "Conformance test of the log10f16 function");46 47 using namespace mathtest;48 49 IndexedRange<float16> Range(/*Begin=*/float16(0.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<log10f16>(Generator, Configs, DeviceBinaryDir, IsVerbose);60 61 return Passed ? EXIT_SUCCESS : EXIT_FAILURE;62}63