blob: f6ed46699a049f8806f7c72949ae90438f7f7baa (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
//===-- Implementation of the fmaxf function for GPU ----------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#include "src/math/fmaxf.h"
#include "src/__support/CPP/bit.h"
#include "src/__support/common.h"
#include "src/__support/macros/optimization.h"
namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(float, fmaxf, (float x, float y)) {
// FIXME: The builtin function does not correctly handle the +/-0.0 case.
if (LIBC_UNLIKELY(x == y))
return cpp::bit_cast<float>(cpp::bit_cast<uint32_t>(x) &
cpp::bit_cast<uint32_t>(y));
return __builtin_fmaxf(x, y);
}
} // namespace LIBC_NAMESPACE
|