Skip to content

Commit 8ae877a

Browse files
authored
Revert "[flang] Warn when F128 is unsupported" (llvm#106561)
Reverts llvm#102147 It seems some systems which should support F128 are wrongly detected as not supporting. This might be due to checking `LDBL_MANT_DIG` instead of `__LDBL_MANT_DIG__`. I will investigate.
1 parent 5fef40c commit 8ae877a

14 files changed

+4
-112
lines changed

flang/include/flang/Tools/TargetSetup.h

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111

1212
#include "flang/Evaluate/target.h"
1313
#include "llvm/Target/TargetMachine.h"
14-
#include <cfloat>
1514

1615
namespace Fortran::tools {
1716

@@ -22,25 +21,9 @@ namespace Fortran::tools {
2221

2322
const llvm::Triple &targetTriple{targetMachine.getTargetTriple()};
2423
// FIXME: Handle real(3) ?
25-
if (targetTriple.getArch() != llvm::Triple::ArchType::x86_64) {
24+
if (targetTriple.getArch() != llvm::Triple::ArchType::x86_64)
2625
targetCharacteristics.DisableType(
2726
Fortran::common::TypeCategory::Real, /*kind=*/10);
28-
}
29-
30-
// Figure out if we can support F128: see
31-
// flang/runtime/Float128Math/math-entries.h
32-
#ifdef FLANG_RUNTIME_F128_MATH_LIB
33-
// we can use libquadmath wrappers
34-
constexpr bool f128Support = true;
35-
#elif LDBL_MANT_DIG == 113
36-
// we can use libm wrappers
37-
constexpr bool f128Support = true;
38-
#else
39-
constexpr bool f128Support = false;
40-
#endif
41-
42-
if constexpr (!f128Support)
43-
targetCharacteristics.DisableType(Fortran::common::TypeCategory::Real, 16);
4427

4528
targetCharacteristics.set_compilerOptionsString(compilerOptions)
4629
.set_compilerVersionString(compilerVersion);

flang/module/ieee_arithmetic.f90

Lines changed: 0 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -161,33 +161,19 @@ end function ieee_round_ne
161161
G(1) G(2) G(4) G(8) G(16)
162162
#define SPECIFICS_L(G) \
163163
G(1) G(2) G(4) G(8)
164-
165-
#if FLANG_SUPPORT_R16
166164
#if __x86_64__
167165
#define SPECIFICS_R(G) \
168166
G(2) G(3) G(4) G(8) G(10) G(16)
169167
#else
170168
#define SPECIFICS_R(G) \
171169
G(2) G(3) G(4) G(8) G(16)
172170
#endif
173-
#else
174-
#if __x86_64__
175-
#define SPECIFICS_R(G) \
176-
G(2) G(3) G(4) G(8) G(10)
177-
#else
178-
#define SPECIFICS_R(G) \
179-
G(2) G(3) G(4) G(8)
180-
#endif
181-
#endif
182-
183171
#define SPECIFICS_II(G) \
184172
G(1,1) G(1,2) G(1,4) G(1,8) G(1,16) \
185173
G(2,1) G(2,2) G(2,4) G(2,8) G(2,16) \
186174
G(4,1) G(4,2) G(4,4) G(4,8) G(4,16) \
187175
G(8,1) G(8,2) G(8,4) G(8,8) G(8,16) \
188176
G(16,1) G(16,2) G(16,4) G(16,8) G(16,16)
189-
190-
#if FLANG_SUPPORT_R16
191177
#if __x86_64__
192178
#define SPECIFICS_RI(G) \
193179
G(2,1) G(2,2) G(2,4) G(2,8) G(2,16) \
@@ -204,24 +190,7 @@ end function ieee_round_ne
204190
G(8,1) G(8,2) G(8,4) G(8,8) G(8,16) \
205191
G(16,1) G(16,2) G(16,4) G(16,8) G(16,16)
206192
#endif
207-
#else
208-
#if __x86_64__
209-
#define SPECIFICS_RI(G) \
210-
G(2,1) G(2,2) G(2,4) G(2,8) \
211-
G(3,1) G(3,2) G(3,4) G(3,8) \
212-
G(4,1) G(4,2) G(4,4) G(4,8) \
213-
G(8,1) G(8,2) G(8,4) G(8,8) \
214-
G(10,1) G(10,2) G(10,4) G(10,8)
215-
#else
216-
#define SPECIFICS_RI(G) \
217-
G(2,1) G(2,2) G(2,4) G(2,8) \
218-
G(3,1) G(3,2) G(3,4) G(3,8) \
219-
G(4,1) G(4,2) G(4,4) G(4,8) \
220-
G(8,1) G(8,2) G(8,4) G(8,8)
221-
#endif
222-
#endif
223193

224-
#if FLANG_SUPPORT_R16
225194
#if __x86_64__
226195
#define SPECIFICS_RR(G) \
227196
G(2,2) G(2,3) G(2,4) G(2,8) G(2,10) G(2,16) \
@@ -238,22 +207,6 @@ end function ieee_round_ne
238207
G(8,2) G(8,3) G(8,4) G(8,8) G(8,16) \
239208
G(16,2) G(16,3) G(16,4) G(16,8) G(16,16)
240209
#endif
241-
#else
242-
#if __x86_64__
243-
#define SPECIFICS_RR(G) \
244-
G(2,2) G(2,3) G(2,4) G(2,8) G(2,10) \
245-
G(3,2) G(3,3) G(3,4) G(3,8) G(3,10) \
246-
G(4,2) G(4,3) G(4,4) G(4,8) G(4,10) \
247-
G(8,2) G(8,3) G(8,4) G(8,8) G(8,10) \
248-
G(10,2) G(10,3) G(10,4) G(10,8) G(10,10)
249-
#else
250-
#define SPECIFICS_RR(G) \
251-
G(2,2) G(2,3) G(2,4) G(2,8) \
252-
G(3,2) G(3,3) G(3,4) G(3,8) \
253-
G(4,2) G(4,3) G(4,4) G(4,8) \
254-
G(8,2) G(8,3) G(8,4) G(8,8)
255-
#endif
256-
#endif
257210

258211
#define IEEE_CLASS_R(XKIND) \
259212
elemental type(ieee_class_type) function ieee_class_a##XKIND(x); \
@@ -509,10 +462,8 @@ end function ieee_real_a##AKIND##_i##KKIND;
509462
interface ieee_real
510463
SPECIFICS_I(IEEE_REAL_I)
511464
SPECIFICS_R(IEEE_REAL_R)
512-
#if FLANG_SUPPORT_R16
513465
SPECIFICS_II(IEEE_REAL_II)
514466
SPECIFICS_RI(IEEE_REAL_RI)
515-
#endif
516467
end interface ieee_real
517468
public :: ieee_real
518469
#undef IEEE_REAL_I

flang/test/CMakeLists.txt

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,6 @@ llvm_canonicalize_cmake_booleans(
1111

1212
set(FLANG_TOOLS_DIR ${FLANG_BINARY_DIR}/bin)
1313

14-
# Check if 128-bit float computations can be done via long double
15-
check_cxx_source_compiles(
16-
"#include <cfloat>
17-
#if LDBL_MANT_DIG != 113
18-
#error LDBL_MANT_DIG != 113
19-
#endif
20-
int main() { return 0; }
21-
"
22-
HAVE_LDBL_MANT_DIG_113)
23-
2414
# FIXME In out-of-tree builds, "SHLIBDIR" is undefined and passing it to
2515
# `configure_lit_site_cfg` leads to a configuration error. This is currently
2616
# only required by plugins/examples, which are not supported in out-of-tree

flang/test/Evaluate/fold-out_of_range.f90

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
! RUN: %python %S/test_folding.py %s %flang_fc1 -pedantic -triple x86_64-unknown-linux-gnu
22
! UNSUPPORTED: system-windows
33
! REQUIRES: target=x86_64{{.*}}
4-
! REQUIRES: flang-supports-f128-math
54
! Tests folding of OUT_OF_RANGE().
65
module m
76
integer(1), parameter :: i1v(*) = [ -huge(1_1) - 1_1, huge(1_1) ]

flang/test/Evaluate/folding07.f90

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
! REQUIRES: flang-supports-f128-math
21
! RUN: %python %S/test_folding.py %s %flang_fc1
32
! Test numeric model inquiry intrinsics
43

flang/test/Lower/Intrinsics/ieee_class_queries.f90

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
! REQUIRES: flang-supports-f128-math
21
! RUN: bbc -emit-fir -o - %s | FileCheck %s
32

43
! CHECK-LABEL: func @_QQmain

flang/test/Lower/Intrinsics/ieee_unordered.f90

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
! REQUIRES: flang-supports-f128-math
21
! RUN: bbc -emit-fir -hlfir=false -o - %s | FileCheck %s
32

43
! CHECK-LABEL: func @_QQmain

flang/test/Lower/common-block.f90

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
! REQUIRES: flang-supports-f128-math
21
! RUN: bbc %s -o - | tco | FileCheck %s
32
! RUN: %flang -emit-llvm -S -mmlir -disable-external-name-interop %s -o - | FileCheck %s
43

@@ -79,3 +78,4 @@ subroutine s7()
7978
real(16) r16
8079
common /co1/ r16
8180
end subroutine
81+

flang/test/Semantics/kinds03.f90

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
! REQUIRES: flang-supports-f128-math
21
! RUN: %python %S/test_symbols.py %s %flang_fc1
32
!DEF: /MainProgram1/ipdt DerivedType
43
!DEF: /MainProgram1/ipdt/k TypeParam INTEGER(4)

flang/test/Semantics/modfile26.f90

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
! REQUIRES: flang-supports-f128-math
21
! RUN: %python %S/test_modfile.py %s %flang_fc1
32
! Intrinsics SELECTED_INT_KIND, SELECTED_REAL_KIND, PRECISION, RANGE,
43
! RADIX, DIGITS

flang/test/Semantics/realkinds-aarch64-01.f90

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
! REQUIRES: aarch64-registered-target
2-
! REQUIRES: flang-supports-f128-math
32
! RUN: %python %S/test_modfile.py %s %flang_fc1 -triple aarch64-unknown-linux-gnu
43

54
module m1

flang/test/lit.cfg.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,9 +216,8 @@
216216
# Add features and substitutions to test F128 math support.
217217
# %f128-lib substitution may be used to generate check prefixes
218218
# for LIT tests checking for F128 library support.
219-
if config.flang_runtime_f128_math_lib or config.have_ldbl_mant_dig_113:
220-
config.available_features.add("flang-supports-f128-math")
221219
if config.flang_runtime_f128_math_lib:
220+
config.available_features.add("flang-supports-f128-math")
222221
config.available_features.add(
223222
"flang-f128-math-lib-" + config.flang_runtime_f128_math_lib
224223
)

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ if "openmp" in "@LLVM_ENABLE_RUNTIMES@".lower().split(";"):
3131
else:
3232
config.openmp_module_dir = None
3333
config.flang_runtime_f128_math_lib = "@FLANG_RUNTIME_F128_MATH_LIB@"
34-
config.have_ldbl_mant_dig_113 = "@HAVE_LDBL_MANT_DIG_113@"
3534

3635
import lit.llvm
3736
lit.llvm.initialize(lit_config, config)

flang/tools/f18/CMakeLists.txt

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -31,25 +31,6 @@ set(MODULES_WITHOUT_IMPLEMENTATION
3131

3232
set(MODULES ${MODULES_WITH_IMPLEMENTATION} ${MODULES_WITHOUT_IMPLEMENTATION})
3333

34-
# Check if 128-bit float computations can be done via long double.
35-
check_cxx_source_compiles(
36-
"#include <cfloat>
37-
#if LDBL_MANT_DIG != 113
38-
#error LDBL_MANT_DIG != 113
39-
#endif
40-
int main() { return 0; }
41-
"
42-
HAVE_LDBL_MANT_DIG_113)
43-
44-
# Figure out whether we can support REAL(KIND=16)
45-
if (FLANG_RUNTIME_F128_MATH_LIB)
46-
set(FLANG_SUPPORT_R16 "1")
47-
elseif (HAVE_LDBL_MANT_DIG_113)
48-
set(FLANG_SUPPORT_R16 "1")
49-
else()
50-
set(FLANG_SUPPORT_R16 "0")
51-
endif()
52-
5334
# Init variable to hold extra object files coming from the Fortran modules;
5435
# these module files will be contributed from the CMakeLists in flang/tools/f18.
5536
set(module_objects "")
@@ -95,10 +76,6 @@ if (NOT CMAKE_CROSSCOMPILING)
9576
endif()
9677
endif()
9778

98-
set(decls "")
99-
if (FLANG_SUPPORT_R16)
100-
set(decls "-DFLANG_SUPPORT_R16")
101-
endif()
10279

10380
# Some modules have an implementation part that needs to be added to the
10481
# FortranRuntime library.
@@ -115,7 +92,7 @@ if (NOT CMAKE_CROSSCOMPILING)
11592
# TODO: We may need to flag this with conditional, in case Flang is built w/o OpenMP support
11693
add_custom_command(OUTPUT ${base}.mod ${object_output}
11794
COMMAND ${CMAKE_COMMAND} -E make_directory ${FLANG_INTRINSIC_MODULES_DIR}
118-
COMMAND flang-new ${opts} ${decls} -cpp ${compile_with} -module-dir ${FLANG_INTRINSIC_MODULES_DIR}
95+
COMMAND flang-new ${opts} -cpp ${compile_with} -module-dir ${FLANG_INTRINSIC_MODULES_DIR}
11996
${FLANG_SOURCE_DIR}/module/${filename}.f90
12097
DEPENDS flang-new ${FLANG_SOURCE_DIR}/module/${filename}.f90 ${FLANG_SOURCE_DIR}/module/__fortran_builtins.f90 ${depends}
12198
)

0 commit comments

Comments
 (0)