13b961d11SVinayak Dev //===-- Implementation of roundevenf function -----------------------------===// 23b961d11SVinayak Dev // 33b961d11SVinayak Dev // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 43b961d11SVinayak Dev // See https://llvm.org/LICENSE.txt for license information. 53b961d11SVinayak Dev // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 63b961d11SVinayak Dev // 73b961d11SVinayak Dev //===----------------------------------------------------------------------===// 83b961d11SVinayak Dev 93b961d11SVinayak Dev #include "src/math/roundevenf.h" 103b961d11SVinayak Dev #include "src/__support/FPUtil/NearestIntegerOperations.h" 113b961d11SVinayak Dev #include "src/__support/common.h" 125ff3ff33SPetr Hosek #include "src/__support/macros/config.h" 133b961d11SVinayak Dev 145ff3ff33SPetr Hosek namespace LIBC_NAMESPACE_DECL { 153b961d11SVinayak Dev 163b961d11SVinayak Dev LLVM_LIBC_FUNCTION(float, roundevenf, (float x)) { 17*4531f82cSOverMighty #ifdef __LIBC_USE_BUILTIN_ROUNDEVEN 18*4531f82cSOverMighty return __builtin_roundevenf(x); 19*4531f82cSOverMighty #else 203b961d11SVinayak Dev return fputil::round_using_specific_rounding_mode(x, FP_INT_TONEAREST); 21*4531f82cSOverMighty #endif 223b961d11SVinayak Dev } 233b961d11SVinayak Dev 245ff3ff33SPetr Hosek } // namespace LIBC_NAMESPACE_DECL 25