55 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 expm1f 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 <math.h>24 25namespace mathtest {26 27template <> struct FunctionConfig<expm1f> {28 static constexpr llvm::StringRef Name = "expm1f";29 static constexpr llvm::StringRef KernelName = "expm1fKernel";30 31 // Source: The Khronos Group, The OpenCL C Specification v3.0.19, Sec. 7.4,32 // Table 65, Khronos Registry [July 10, 2025].33 static constexpr uint64_t UlpTolerance = 3;34};35} // namespace mathtest36 37int main(int argc, const char **argv) {38 llvm::cl::ParseCommandLineOptions(argc, argv,39 "Conformance test of the expm1f function");40 41 using namespace mathtest;42 43 IndexedRange<float> Range;44 ExhaustiveGenerator<float> Generator(Range);45 46 const auto Configs = cl::getTestConfigs();47 const llvm::StringRef DeviceBinaryDir = DEVICE_BINARY_DIR;48 const bool IsVerbose = cl::IsVerbose;49 50 bool Passed =51 runTests<expm1f>(Generator, Configs, DeviceBinaryDir, IsVerbose);52 53 return Passed ? EXIT_SUCCESS : EXIT_FAILURE;54}55