Skip to content

Commit c26e9bf

Browse files
committed
Revert "Constant Fold Logf128 calls (#84501)"
This reverts commit e90bc9c.
1 parent ac39fa7 commit c26e9bf

File tree

14 files changed

+0
-236
lines changed

14 files changed

+0
-236
lines changed

llvm/CMakeLists.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -562,8 +562,6 @@ set(LLVM_USE_STATIC_ZSTD FALSE CACHE BOOL "Use static version of zstd. Can be TR
562562

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

565-
set(LLVM_HAS_LOGF128 "OFF" CACHE STRING "Use logf128 to constant fold fp128 logarithm calls. Can be ON, OFF, or FORCE_ON")
566-
567565
set(LLVM_ENABLE_HTTPLIB "OFF" CACHE STRING "Use cpp-httplib HTTP server library if available. Can be ON, OFF, or FORCE_ON")
568566

569567
set(LLVM_Z3_INSTALL_DIR "" CACHE STRING "Install directory of the Z3 solver.")

llvm/cmake/config-ix.cmake

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -257,17 +257,6 @@ else()
257257
set(LLVM_ENABLE_TERMINFO 0)
258258
endif()
259259

260-
if(LLVM_HAS_LOGF128)
261-
include(CheckCXXSymbolExists)
262-
check_cxx_symbol_exists(logf128 math.h HAS_LOGF128)
263-
264-
if(LLVM_HAS_LOGF128 STREQUAL FORCE_ON AND NOT HAS_LOGF128)
265-
message(FATAL_ERROR "Failed to configure logf128")
266-
endif()
267-
268-
set(LLVM_HAS_LOGF128 "${HAS_LOGF128}")
269-
endif()
270-
271260
# function checks
272261
check_symbol_exists(arc4random "stdlib.h" HAVE_DECL_ARC4RANDOM)
273262
find_package(Backtrace)

llvm/include/llvm/ADT/APFloat.h

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
#include "llvm/ADT/ArrayRef.h"
2020
#include "llvm/ADT/FloatingPointMode.h"
2121
#include "llvm/Support/ErrorHandling.h"
22-
#include "llvm/Support/float128.h"
2322
#include <memory>
2423

2524
#define APFLOAT_DISPATCH_ON_SEMANTICS(METHOD_CALL) \
@@ -355,9 +354,6 @@ class IEEEFloat final : public APFloatBase {
355354
Expected<opStatus> convertFromString(StringRef, roundingMode);
356355
APInt bitcastToAPInt() const;
357356
double convertToDouble() const;
358-
#ifdef __FLOAT128__
359-
float128 convertToQuad() const;
360-
#endif
361357
float convertToFloat() const;
362358

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

1225-
/// Converts this APFloat to host float value.
1226-
///
1227-
/// \pre The APFloat must be built using semantics, that can be represented by
1228-
/// the host float type without loss of precision. It can be IEEEquad and
1229-
/// shorter semantics, like IEEEdouble and others.
1230-
#ifdef __FLOAT128__
1231-
float128 convertToQuad() const;
1232-
#endif
1233-
12341221
/// Converts this APFloat to host float value.
12351222
///
12361223
/// \pre The APFloat must be built using semantics, that can be represented by

llvm/include/llvm/ADT/APInt.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717

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

1674-
#ifdef __FLOAT128__
1675-
float128 bitsToQuad() const {
1676-
__uint128_t ul = ((__uint128_t)U.pVal[1] << 64) + U.pVal[0];
1677-
return llvm::bit_cast<float128>(ul);
1678-
}
1679-
#endif
1680-
16811673
/// Converts APInt bits to a float
16821674
///
16831675
/// The conversion does not do a translation from integer to float, it just

llvm/include/llvm/Config/llvm-config.h.cmake

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,4 @@
198198
/* Define if plugins enabled */
199199
#cmakedefine LLVM_ENABLE_PLUGINS
200200

201-
/* Define if logf128 is available */
202-
#cmakedefine LLVM_HAS_LOGF128
203-
204201
#endif

llvm/include/llvm/Support/float128.h

Lines changed: 0 additions & 21 deletions
This file was deleted.

llvm/lib/Analysis/CMakeLists.txt

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -159,9 +159,3 @@ add_llvm_component_library(LLVMAnalysis
159159
Support
160160
TargetParser
161161
)
162-
163-
include(CheckCXXSymbolExists)
164-
check_cxx_symbol_exists(logf128 math.h HAS_LOGF128)
165-
if(HAS_LOGF128)
166-
target_compile_definitions(LLVMAnalysis PRIVATE HAS_LOGF128)
167-
endif()

llvm/lib/Analysis/ConstantFolding.cpp

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2089,17 +2089,6 @@ static Constant *ConstantFoldScalarCall1(StringRef Name,
20892089
if (IntrinsicID == Intrinsic::canonicalize)
20902090
return constantFoldCanonicalize(Ty, Call, U);
20912091

2092-
#if defined(__FLOAT128__) && defined(HAS_LOGF128)
2093-
if (Ty->isFP128Ty()) {
2094-
switch (IntrinsicID) {
2095-
default:
2096-
return nullptr;
2097-
case Intrinsic::log:
2098-
return ConstantFP::get(Ty, logf128(Op->getValueAPF().convertToQuad()));
2099-
}
2100-
}
2101-
#endif
2102-
21032092
if (!Ty->isHalfTy() && !Ty->isFloatTy() && !Ty->isDoubleTy())
21042093
return nullptr;
21052094

llvm/lib/Support/APFloat.cpp

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -3670,15 +3670,6 @@ double IEEEFloat::convertToDouble() const {
36703670
return api.bitsToDouble();
36713671
}
36723672

3673-
#ifdef __FLOAT128__
3674-
float128 IEEEFloat::convertToQuad() const {
3675-
assert(semantics == (const llvm::fltSemantics *)&semIEEEquad &&
3676-
"Float semantics are not IEEEquads");
3677-
APInt api = bitcastToAPInt();
3678-
return api.bitsToQuad();
3679-
}
3680-
#endif
3681-
36823673
/// Integer bit is explicit in this format. Intel hardware (387 and later)
36833674
/// does not support these bit patterns:
36843675
/// exponent = all 1's, integer bit 0, significand 0 ("pseudoinfinity")
@@ -5274,21 +5265,6 @@ double APFloat::convertToDouble() const {
52745265
return Temp.getIEEE().convertToDouble();
52755266
}
52765267

5277-
#ifdef __FLOAT128__
5278-
float128 APFloat::convertToQuad() const {
5279-
if (&getSemantics() == (const llvm::fltSemantics *)&semIEEEquad)
5280-
return getIEEE().convertToQuad();
5281-
assert(getSemantics().isRepresentableBy(semIEEEquad) &&
5282-
"Float semantics is not representable by IEEEquad");
5283-
APFloat Temp = *this;
5284-
bool LosesInfo;
5285-
opStatus St = Temp.convert(semIEEEquad, rmNearestTiesToEven, &LosesInfo);
5286-
assert(!(St & opInexact) && !LosesInfo && "Unexpected imprecision");
5287-
(void)St;
5288-
return Temp.getIEEE().convertToQuad();
5289-
}
5290-
#endif
5291-
52925268
float APFloat::convertToFloat() const {
52935269
if (&getSemantics() == (const llvm::fltSemantics *)&semIEEEsingle)
52945270
return getIEEE().convertToFloat();

llvm/test/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ llvm_canonicalize_cmake_booleans(
2525
LLVM_INCLUDE_DXIL_TESTS
2626
LLVM_TOOL_LLVM_DRIVER_BUILD
2727
LLVM_INCLUDE_SPIRV_TOOLS_TESTS
28-
LLVM_HAS_LOGF128
2928
)
3029

3130
configure_lit_site_cfg(

llvm/test/Transforms/InstSimplify/ConstProp/logf128.ll

Lines changed: 0 additions & 126 deletions
This file was deleted.

llvm/test/lit.cfg.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -614,6 +614,3 @@ def have_ld64_plugin_support():
614614
# "OBJECT_MODE" to 'any' by default on AIX OS.
615615
if "system-aix" in config.available_features:
616616
config.environment["OBJECT_MODE"] = "any"
617-
618-
if config.has_logf128:
619-
config.available_features.add("has_logf128")

llvm/test/lit.site.cfg.py.in

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ config.reverse_iteration = @LLVM_ENABLE_REVERSE_ITERATION@
6161
config.dxil_tests = @LLVM_INCLUDE_DXIL_TESTS@
6262
config.have_llvm_driver = @LLVM_TOOL_LLVM_DRIVER_BUILD@
6363
config.spirv_tools_tests = @LLVM_INCLUDE_SPIRV_TOOLS_TESTS@
64-
config.has_logf128 = @LLVM_HAS_LOGF128@
6564

6665
import lit.llvm
6766
lit.llvm.initialize(lit_config, config)

llvm/unittests/Analysis/CMakeLists.txt

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,5 @@ if(NOT WIN32)
8080
export_executable_symbols_for_plugins(AnalysisTests)
8181
endif()
8282

83-
include(CheckCXXSymbolExists)
84-
check_cxx_symbol_exists(logf128 math.h HAS_LOGF128)
85-
if(HAS_LOGF128)
86-
target_compile_definitions(AnalysisTests PRIVATE HAS_LOGF128)
87-
endif()
88-
8983
add_subdirectory(InlineAdvisorPlugin)
9084
add_subdirectory(InlineOrderPlugin)

0 commit comments

Comments
 (0)