Skip to content

[libc] Remove workaround for fmin / fmax after being fixed in LLVM #83421

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions libc/src/math/amdgpu/fmax.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@
namespace LIBC_NAMESPACE {

LLVM_LIBC_FUNCTION(double, fmax, (double x, double y)) {
// FIXME: The builtin function does not correctly handle the +/-0.0 case.
if (LIBC_UNLIKELY(x == y))
return cpp::bit_cast<double>(cpp::bit_cast<uint64_t>(x) &
cpp::bit_cast<uint64_t>(y));
return __builtin_fmax(x, y);
}

Expand Down
6 changes: 0 additions & 6 deletions libc/src/math/amdgpu/fmaxf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,11 @@

#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);
}

Expand Down
6 changes: 0 additions & 6 deletions libc/src/math/amdgpu/fmin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,11 @@

#include "src/math/fmin.h"

#include "src/__support/CPP/bit.h"
#include "src/__support/common.h"
#include "src/__support/macros/optimization.h"

namespace LIBC_NAMESPACE {

LLVM_LIBC_FUNCTION(double, fmin, (double x, double y)) {
// FIXME: The builtin function does not correctly handle the +/-0.0 case.
if (LIBC_UNLIKELY(x == y))
return cpp::bit_cast<double>(cpp::bit_cast<uint64_t>(x) |
cpp::bit_cast<uint64_t>(y));
return __builtin_fmin(x, y);
}

Expand Down
6 changes: 0 additions & 6 deletions libc/src/math/amdgpu/fminf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,11 @@

#include "src/math/fminf.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, fminf, (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_fminf(x, y);
}

Expand Down
6 changes: 0 additions & 6 deletions libc/src/math/nvptx/fmax.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,11 @@

#include "src/math/fmax.h"

#include "src/__support/CPP/bit.h"
#include "src/__support/common.h"
#include "src/__support/macros/optimization.h"

namespace LIBC_NAMESPACE {

LLVM_LIBC_FUNCTION(double, fmax, (double x, double y)) {
// FIXME: The builtin function does not correctly handle the +/-0.0 case.
if (LIBC_UNLIKELY(x == y))
return cpp::bit_cast<double>(cpp::bit_cast<uint64_t>(x) &
cpp::bit_cast<uint64_t>(y));
return __builtin_fmax(x, y);
}

Expand Down
4 changes: 0 additions & 4 deletions libc/src/math/nvptx/fmaxf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@
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);
}

Expand Down
6 changes: 0 additions & 6 deletions libc/src/math/nvptx/fmin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,11 @@

#include "src/math/fmin.h"

#include "src/__support/CPP/bit.h"
#include "src/__support/common.h"
#include "src/__support/macros/optimization.h"

namespace LIBC_NAMESPACE {

LLVM_LIBC_FUNCTION(double, fmin, (double x, double y)) {
// FIXME: The builtin function does not correctly handle the +/-0.0 case.
if (LIBC_UNLIKELY(x == y))
return cpp::bit_cast<double>(cpp::bit_cast<uint64_t>(x) |
cpp::bit_cast<uint64_t>(y));
return __builtin_fmin(x, y);
}

Expand Down
6 changes: 0 additions & 6 deletions libc/src/math/nvptx/fminf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,11 @@

#include "src/math/fminf.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, fminf, (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_fminf(x, y);
}

Expand Down