Skip to content

Commit

Permalink
Revert "Constant Fold Logf128 calls (#84501)"
Browse files Browse the repository at this point in the history
This reverts commit e90bc9c.
  • Loading branch information
MDevereau committed Apr 18, 2024
1 parent ac39fa7 commit c26e9bf
Show file tree
Hide file tree
Showing 14 changed files with 0 additions and 236 deletions.
2 changes: 0 additions & 2 deletions llvm/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -562,8 +562,6 @@ set(LLVM_USE_STATIC_ZSTD FALSE CACHE BOOL "Use static version of zstd. Can be TR

set(LLVM_ENABLE_CURL "OFF" CACHE STRING "Use libcurl for the HTTP client if available. Can be ON, OFF, or FORCE_ON")

set(LLVM_HAS_LOGF128 "OFF" CACHE STRING "Use logf128 to constant fold fp128 logarithm calls. Can be ON, OFF, or FORCE_ON")

set(LLVM_ENABLE_HTTPLIB "OFF" CACHE STRING "Use cpp-httplib HTTP server library if available. Can be ON, OFF, or FORCE_ON")

set(LLVM_Z3_INSTALL_DIR "" CACHE STRING "Install directory of the Z3 solver.")
Expand Down
11 changes: 0 additions & 11 deletions llvm/cmake/config-ix.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -257,17 +257,6 @@ else()
set(LLVM_ENABLE_TERMINFO 0)
endif()

if(LLVM_HAS_LOGF128)
include(CheckCXXSymbolExists)
check_cxx_symbol_exists(logf128 math.h HAS_LOGF128)

if(LLVM_HAS_LOGF128 STREQUAL FORCE_ON AND NOT HAS_LOGF128)
message(FATAL_ERROR "Failed to configure logf128")
endif()

set(LLVM_HAS_LOGF128 "${HAS_LOGF128}")
endif()

# function checks
check_symbol_exists(arc4random "stdlib.h" HAVE_DECL_ARC4RANDOM)
find_package(Backtrace)
Expand Down
13 changes: 0 additions & 13 deletions llvm/include/llvm/ADT/APFloat.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/FloatingPointMode.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/float128.h"
#include <memory>

#define APFLOAT_DISPATCH_ON_SEMANTICS(METHOD_CALL) \
Expand Down Expand Up @@ -355,9 +354,6 @@ class IEEEFloat final : public APFloatBase {
Expected<opStatus> convertFromString(StringRef, roundingMode);
APInt bitcastToAPInt() const;
double convertToDouble() const;
#ifdef __FLOAT128__
float128 convertToQuad() const;
#endif
float convertToFloat() const;

/// @}
Expand Down Expand Up @@ -1222,15 +1218,6 @@ class APFloat : public APFloatBase {
/// shorter semantics, like IEEEsingle and others.
double convertToDouble() const;

/// Converts this APFloat to host float value.
///
/// \pre The APFloat must be built using semantics, that can be represented by
/// the host float type without loss of precision. It can be IEEEquad and
/// shorter semantics, like IEEEdouble and others.
#ifdef __FLOAT128__
float128 convertToQuad() const;
#endif

/// Converts this APFloat to host float value.
///
/// \pre The APFloat must be built using semantics, that can be represented by
Expand Down
8 changes: 0 additions & 8 deletions llvm/include/llvm/ADT/APInt.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

#include "llvm/Support/Compiler.h"
#include "llvm/Support/MathExtras.h"
#include "llvm/Support/float128.h"
#include <cassert>
#include <climits>
#include <cstring>
Expand Down Expand Up @@ -1671,13 +1670,6 @@ class [[nodiscard]] APInt {
/// any bit width. Exactly 64 bits will be translated.
double bitsToDouble() const { return llvm::bit_cast<double>(getWord(0)); }

#ifdef __FLOAT128__
float128 bitsToQuad() const {
__uint128_t ul = ((__uint128_t)U.pVal[1] << 64) + U.pVal[0];
return llvm::bit_cast<float128>(ul);
}
#endif

/// Converts APInt bits to a float
///
/// The conversion does not do a translation from integer to float, it just
Expand Down
3 changes: 0 additions & 3 deletions llvm/include/llvm/Config/llvm-config.h.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,4 @@
/* Define if plugins enabled */
#cmakedefine LLVM_ENABLE_PLUGINS

/* Define if logf128 is available */
#cmakedefine LLVM_HAS_LOGF128

#endif
21 changes: 0 additions & 21 deletions llvm/include/llvm/Support/float128.h

This file was deleted.

6 changes: 0 additions & 6 deletions llvm/lib/Analysis/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,3 @@ add_llvm_component_library(LLVMAnalysis
Support
TargetParser
)

include(CheckCXXSymbolExists)
check_cxx_symbol_exists(logf128 math.h HAS_LOGF128)
if(HAS_LOGF128)
target_compile_definitions(LLVMAnalysis PRIVATE HAS_LOGF128)
endif()
11 changes: 0 additions & 11 deletions llvm/lib/Analysis/ConstantFolding.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2089,17 +2089,6 @@ static Constant *ConstantFoldScalarCall1(StringRef Name,
if (IntrinsicID == Intrinsic::canonicalize)
return constantFoldCanonicalize(Ty, Call, U);

#if defined(__FLOAT128__) && defined(HAS_LOGF128)
if (Ty->isFP128Ty()) {
switch (IntrinsicID) {
default:
return nullptr;
case Intrinsic::log:
return ConstantFP::get(Ty, logf128(Op->getValueAPF().convertToQuad()));
}
}
#endif

if (!Ty->isHalfTy() && !Ty->isFloatTy() && !Ty->isDoubleTy())
return nullptr;

Expand Down
24 changes: 0 additions & 24 deletions llvm/lib/Support/APFloat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3670,15 +3670,6 @@ double IEEEFloat::convertToDouble() const {
return api.bitsToDouble();
}

#ifdef __FLOAT128__
float128 IEEEFloat::convertToQuad() const {
assert(semantics == (const llvm::fltSemantics *)&semIEEEquad &&
"Float semantics are not IEEEquads");
APInt api = bitcastToAPInt();
return api.bitsToQuad();
}
#endif

/// Integer bit is explicit in this format. Intel hardware (387 and later)
/// does not support these bit patterns:
/// exponent = all 1's, integer bit 0, significand 0 ("pseudoinfinity")
Expand Down Expand Up @@ -5274,21 +5265,6 @@ double APFloat::convertToDouble() const {
return Temp.getIEEE().convertToDouble();
}

#ifdef __FLOAT128__
float128 APFloat::convertToQuad() const {
if (&getSemantics() == (const llvm::fltSemantics *)&semIEEEquad)
return getIEEE().convertToQuad();
assert(getSemantics().isRepresentableBy(semIEEEquad) &&
"Float semantics is not representable by IEEEquad");
APFloat Temp = *this;
bool LosesInfo;
opStatus St = Temp.convert(semIEEEquad, rmNearestTiesToEven, &LosesInfo);
assert(!(St & opInexact) && !LosesInfo && "Unexpected imprecision");
(void)St;
return Temp.getIEEE().convertToQuad();
}
#endif

float APFloat::convertToFloat() const {
if (&getSemantics() == (const llvm::fltSemantics *)&semIEEEsingle)
return getIEEE().convertToFloat();
Expand Down
1 change: 0 additions & 1 deletion llvm/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ llvm_canonicalize_cmake_booleans(
LLVM_INCLUDE_DXIL_TESTS
LLVM_TOOL_LLVM_DRIVER_BUILD
LLVM_INCLUDE_SPIRV_TOOLS_TESTS
LLVM_HAS_LOGF128
)

configure_lit_site_cfg(
Expand Down
126 changes: 0 additions & 126 deletions llvm/test/Transforms/InstSimplify/ConstProp/logf128.ll

This file was deleted.

3 changes: 0 additions & 3 deletions llvm/test/lit.cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -614,6 +614,3 @@ def have_ld64_plugin_support():
# "OBJECT_MODE" to 'any' by default on AIX OS.
if "system-aix" in config.available_features:
config.environment["OBJECT_MODE"] = "any"

if config.has_logf128:
config.available_features.add("has_logf128")
1 change: 0 additions & 1 deletion llvm/test/lit.site.cfg.py.in
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ config.reverse_iteration = @LLVM_ENABLE_REVERSE_ITERATION@
config.dxil_tests = @LLVM_INCLUDE_DXIL_TESTS@
config.have_llvm_driver = @LLVM_TOOL_LLVM_DRIVER_BUILD@
config.spirv_tools_tests = @LLVM_INCLUDE_SPIRV_TOOLS_TESTS@
config.has_logf128 = @LLVM_HAS_LOGF128@

import lit.llvm
lit.llvm.initialize(lit_config, config)
Expand Down
6 changes: 0 additions & 6 deletions llvm/unittests/Analysis/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,5 @@ if(NOT WIN32)
export_executable_symbols_for_plugins(AnalysisTests)
endif()

include(CheckCXXSymbolExists)
check_cxx_symbol_exists(logf128 math.h HAS_LOGF128)
if(HAS_LOGF128)
target_compile_definitions(AnalysisTests PRIVATE HAS_LOGF128)
endif()

add_subdirectory(InlineAdvisorPlugin)
add_subdirectory(InlineOrderPlugin)

0 comments on commit c26e9bf

Please sign in to comment.