Skip to content

Commit b43f85d

Browse files
committed
Fix unit tests on systems which don't support F128
1 parent 4f4ca1f commit b43f85d

File tree

10 files changed

+20
-2
lines changed

10 files changed

+20
-2
lines changed

flang/test/CMakeLists.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,16 @@ 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+
1424
# FIXME In out-of-tree builds, "SHLIBDIR" is undefined and passing it to
1525
# `configure_lit_site_cfg` leads to a configuration error. This is currently
1626
# only required by plugins/examples, which are not supported in out-of-tree

flang/test/Evaluate/folding07.f90

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
! REQUIRES: flang-supports-f128-math
12
! RUN: %python %S/test_folding.py %s %flang_fc1
23
! Test numeric model inquiry intrinsics
34

flang/test/Lower/Intrinsics/ieee_class_queries.f90

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

34
! CHECK-LABEL: func @_QQmain

flang/test/Lower/Intrinsics/ieee_unordered.f90

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

34
! 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,3 +1,4 @@
1+
! REQUIRES: flang-supports-f128-math
12
! RUN: bbc %s -o - | tco | FileCheck %s
23
! RUN: %flang -emit-llvm -S -mmlir -disable-external-name-interop %s -o - | FileCheck %s
34

@@ -78,4 +79,3 @@ subroutine s7()
7879
real(16) r16
7980
common /co1/ r16
8081
end subroutine
81-

flang/test/Semantics/kinds03.f90

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

flang/test/Semantics/modfile26.f90

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

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

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

45
module m1

flang/test/lit.cfg.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,8 +216,9 @@
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:
219+
if config.flang_runtime_f128_math_lib or config.have_ldbl_mant_dig_113:
220220
config.available_features.add("flang-supports-f128-math")
221+
if config.flang_runtime_f128_math_lib:
221222
config.available_features.add(
222223
"flang-f128-math-lib-" + config.flang_runtime_f128_math_lib
223224
)

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ 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@"
3435

3536
import lit.llvm
3637
lit.llvm.initialize(lit_config, config)

0 commit comments

Comments
 (0)