Skip to content

Commit 7a780ed

Browse files
committed
[flang] Make REAL/COMPLEX(10) a hard error for non-x86 targets
Currently the use of REAL/COMPLEX(KIND=10) as a type or literal constant suffix elicits an optional warning message only. This leads to compiler internal errors during lowering when these types appear in code being compiled to non-x86_64 targets. For better error messaging, make the use of these types a hard error in semantics instead when they are not supported by the target architecture.
1 parent 285009f commit 7a780ed

40 files changed

+136
-99
lines changed

flang/include/flang/Common/Fortran-features.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ ENUM_CLASS(UsageWarning, Portability, PointerToUndefinable,
7171
ZeroDoStep, UnusedForallIndex, OpenMPUsage, DataLength, IgnoredDirective,
7272
HomonymousSpecific, HomonymousResult, IgnoredIntrinsicFunctionType,
7373
PreviousScalarUse, RedeclaredInaccessibleComponent, ImplicitShared,
74-
IndexVarRedefinition, IncompatibleImplicitInterfaces, BadTypeForTarget,
74+
IndexVarRedefinition, IncompatibleImplicitInterfaces,
7575
VectorSubscriptFinalization, UndefinedFunctionResult, UselessIomsg,
7676
MismatchingDummyProcedure, SubscriptedEmptyArray, UnsignedLiteralTruncation,
7777
CompatibleDeclarationsFromDistinctModules)

flang/lib/Common/Fortran-features.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ LanguageFeatureControl::LanguageFeatureControl() {
7979
warnUsage_.set(UsageWarning::ImplicitShared);
8080
warnUsage_.set(UsageWarning::IndexVarRedefinition);
8181
warnUsage_.set(UsageWarning::IncompatibleImplicitInterfaces);
82-
warnUsage_.set(UsageWarning::BadTypeForTarget);
8382
warnUsage_.set(UsageWarning::VectorSubscriptFinalization);
8483
warnUsage_.set(UsageWarning::UndefinedFunctionResult);
8584
warnUsage_.set(UsageWarning::UselessIomsg);

flang/lib/Semantics/expression.cpp

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4079,8 +4079,7 @@ bool ExpressionAnalyzer::CheckIntrinsicKind(
40794079
return true;
40804080
} else if (foldingContext_.targetCharacteristics().CanSupportType(
40814081
category, kind)) {
4082-
Warn(common::UsageWarning::BadTypeForTarget,
4083-
"%s(KIND=%jd) is not an enabled type for this target"_warn_en_US,
4082+
Say("%s(KIND=%jd) is not an enabled type for this target"_err_en_US,
40844083
ToUpperCase(EnumToString(category)), kind);
40854084
return true;
40864085
} else {
@@ -4102,20 +4101,7 @@ bool ExpressionAnalyzer::CheckIntrinsicSize(
41024101
return false;
41034102
}
41044103
}
4105-
if (foldingContext_.targetCharacteristics().IsTypeEnabled(
4106-
category, kind)) { // C712, C714, C715, C727
4107-
return true;
4108-
} else if (foldingContext_.targetCharacteristics().CanSupportType(
4109-
category, kind)) {
4110-
Warn(common::UsageWarning::BadTypeForTarget,
4111-
"%s*%jd is not an enabled type for this target"_warn_en_US,
4112-
ToUpperCase(EnumToString(category)), size);
4113-
return true;
4114-
} else {
4115-
Say("%s*%jd is not a supported type"_err_en_US,
4116-
ToUpperCase(EnumToString(category)), size);
4117-
return false;
4118-
}
4104+
return CheckIntrinsicKind(category, kind);
41194105
}
41204106

41214107
bool ExpressionAnalyzer::AddImpliedDo(parser::CharBlock name, int kind) {

flang/test/Evaluate/rewrite-out_of_range.F90

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
! Tests rewriting of OUT_OF_RANGE()
2+
! REQUIRES: x86-registered-target
23
! RUN: %flang_fc1 -fdebug-unparse -cpp %s 2>&1 | FileCheck %s --check-prefixes=CHECK%if target=x86_64{{.*}} %{,CHECK-X86-64%}
34

45
logical round

flang/test/Lower/HLFIR/convert-variable.f90

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
! Test lowering of variables to fir.declare
2-
! RUN: bbc -emit-hlfir %s -o - | FileCheck %s
2+
! RUN: bbc -emit-hlfir %s -o - | FileCheck %s --check-prefixes=CHECK,%if system-aix %{F64%} %else %{F128%}
33

44
subroutine scalar_numeric(x)
55
integer :: x
@@ -68,13 +68,16 @@ subroutine scalar_numeric_attributes(x)
6868
! CHECK: %[[VAL_1:.*]] = hlfir.declare %[[VAL_0]] dummy_scope %{{[0-9]+}} {fortran_attrs = #fir.var_attrs<intent_in, optional, target>, uniq_name = "_QFscalar_numeric_attributesEx"} : (!fir.ref<i32>, !fir.dscope) -> (!fir.ref<i32>, !fir.ref<i32>)
6969

7070
subroutine scalar_numeric_attributes_2(x)
71-
real(16), value :: x(100)
71+
integer, parameter :: rk = merge(16, 8, selected_real_kind(33, 4931)==16)
72+
real(rk), value :: x(100)
7273
end subroutine
7374
! CHECK-LABEL: func.func @_QPscalar_numeric_attributes_2(
74-
! CHECK-SAME: %[[VAL_0:.*]]: !fir.ref<!fir.array<100xf128>>
75+
! F128-SAME: %[[VAL_0:.*]]: !fir.ref<!fir.array<100xf128>>
76+
! F64-SAME: %[[VAL_0:.*]]: !fir.ref<!fir.array<100xf64>>
7577
! CHECK: %[[VAL_1:.*]] = arith.constant 100 : index
7678
! CHECK: %[[VAL_2:.*]] = fir.shape %[[VAL_1]] : (index) -> !fir.shape<1>
77-
! CHECK: %[[VAL_3:.*]] = hlfir.declare %[[VAL_0]](%[[VAL_2]]) dummy_scope %{{[0-9]+}} {fortran_attrs = #fir.var_attrs<value>, uniq_name = "_QFscalar_numeric_attributes_2Ex"} : (!fir.ref<!fir.array<100xf128>>, !fir.shape<1>, !fir.dscope) -> (!fir.ref<!fir.array<100xf128>>, !fir.ref<!fir.array<100xf128>>)
79+
! F128: %[[VAL_3:.*]] = hlfir.declare %[[VAL_0]](%[[VAL_2]]) dummy_scope %{{[0-9]+}} {fortran_attrs = #fir.var_attrs<value>, uniq_name = "_QFscalar_numeric_attributes_2Ex"} : (!fir.ref<!fir.array<100xf128>>, !fir.shape<1>, !fir.dscope) -> (!fir.ref<!fir.array<100xf128>>, !fir.ref<!fir.array<100xf128>>)
80+
! F64: %[[VAL_3:.*]] = hlfir.declare %[[VAL_0]](%[[VAL_2]]) dummy_scope %{{[0-9]+}} {fortran_attrs = #fir.var_attrs<value>, uniq_name = "_QFscalar_numeric_attributes_2Ex"} : (!fir.ref<!fir.array<100xf64>>, !fir.shape<1>, !fir.dscope) -> (!fir.ref<!fir.array<100xf64>>, !fir.ref<!fir.array<100xf64>>)
7881

7982
subroutine scalar_numeric_attributes_3(x)
8083
real, intent(in) :: x

flang/test/Lower/Intrinsics/abs.f90

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
! RUN: bbc -emit-fir -hlfir=false %s -o - | FileCheck %s --check-prefixes="CHECK,CMPLX,CMPLX-PRECISE"
1+
! RUN: bbc -emit-fir -hlfir=false %s -o - | FileCheck %s --check-prefixes=%if system-aix %{CHECK,CMPLX,CMPLX-PRECISE,F64%} %else %{CHECK,CMPLX,CMPLX-PRECISE,F128%}
22
! RUN: bbc -emit-fir -hlfir=false --math-runtime=precise %s -o - | FileCheck %s --check-prefixes="CMPLX,CMPLX-PRECISE"
33
! RUN: bbc --force-mlir-complex -emit-fir -hlfir=false %s -o - | FileCheck %s --check-prefixes="CMPLX,CMPLX-FAST"
4-
! RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir %s -o - | FileCheck %s --check-prefixes="CHECK,CMPLX,CMPLX-PRECISE"
4+
! RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir %s -o - | FileCheck %s --check-prefixes=%if system-aix %{CHECK,CMPLX,CMPLX-PRECISE,F64%} %else %{CHECK,CMPLX,CMPLX-PRECISE,F128%}
55
! RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir -mllvm --math-runtime=precise %s -o - | FileCheck %s --check-prefixes="CMPLX,CMPLX-PRECISE"
66
! RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir -mllvm --force-mlir-complex %s -o - | FileCheck %s --check-prefixes="CMPLX,CMPLX-FAST"
77
! RUN: %flang_fc1 -fapprox-func -emit-fir -flang-deprecated-no-hlfir %s -o - | FileCheck %s --check-prefixes="CMPLX,CMPLX-APPROX"
@@ -85,13 +85,18 @@ subroutine abs_testd(a, b)
8585
end subroutine
8686

8787
! CHECK-LABEL: func @_QPabs_testr16(
88-
! CHECK-SAME: %[[VAL_0:.*]]: !fir.ref<f128>{{.*}}, %[[VAL_1:.*]]: !fir.ref<f128>{{.*}}) {
88+
! F128-SAME: %[[VAL_0:.*]]: !fir.ref<f128>{{.*}}, %[[VAL_1:.*]]: !fir.ref<f128>{{.*}}) {
89+
! F64-SAME: %[[VAL_0:.*]]: !fir.ref<f128>{{.*}}, %[[VAL_1:.*]]: !fir.ref<f128>{{.*}}) {
8990
subroutine abs_testr16(a, b)
90-
! CHECK: %[[VAL_2:.*]] = fir.load %[[VAL_0]] : !fir.ref<f128>
91-
! CHECK: %[[VAL_3:.*]] = math.absf %[[VAL_2]] {{.*}}: f128
92-
! CHECK: fir.store %[[VAL_3]] to %[[VAL_1]] : !fir.ref<f128>
91+
! F128: %[[VAL_2:.*]] = fir.load %[[VAL_0]] : !fir.ref<f128>
92+
! F64: %[[VAL_2:.*]] = fir.load %[[VAL_0]] : !fir.ref<f64>
93+
! F128: %[[VAL_3:.*]] = math.absf %[[VAL_2]] {{.*}}: f128
94+
! F64: %[[VAL_3:.*]] = math.absf %[[VAL_2]] {{.*}}: f64
95+
! F128: fir.store %[[VAL_3]] to %[[VAL_1]] : !fir.ref<f128>
96+
! F64: fir.store %[[VAL_3]] to %[[VAL_1]] : !fir.ref<f64>
9397
! CHECK: return
94-
real(kind=16) :: a, b
98+
integer, parameter :: rk = merge(16, 8, selected_real_kind(33, 4931)==16)
99+
real(kind=rk) :: a, b
95100
b = abs(a)
96101
end subroutine
97102

flang/test/Lower/Intrinsics/aint.f90

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
! RUN: bbc -emit-fir -hlfir=false %s -o - | FileCheck %s
1+
! REQUIRES: x86_64-registered-target
2+
! RUN: bbc -target x86_64-unknown-linux-gnu -emit-fir -hlfir=false -target x86_64-unknown-linux-gnu %s -o - | FileCheck %s
23

34
! CHECK-LABEL: func @_QPaint_test(
45
! CHECK-SAME: %[[VAL_0:.*]]: !fir.ref<f32>{{.*}}, %[[VAL_1:.*]]: !fir.ref<f32>{{.*}}) {

flang/test/Lower/Intrinsics/anint.f90

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
! RUN: bbc -emit-fir -hlfir=false %s -o - | FileCheck %s
1+
! REQUIRES: x86_64-registered-target
2+
! RUN: bbc -target x86_64-unknown-linux-gnu -emit-fir -hlfir=false -target x86_64-unknown-linux-gnu %s -o - | FileCheck %s
23

34
! CHECK-LABEL: func.func @_QPanint_test(
45
! CHECK-SAME: %[[VAL_0:.*]]: !fir.ref<f32> {fir.bindc_name = "a"},

flang/test/Lower/Intrinsics/dot_product.f90

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
! RUN: bbc -emit-fir -hlfir=false %s -o - | FileCheck %s
2-
! RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir %s -o - | FileCheck %s
1+
! REQUIRES: x86_64-registered-target
2+
! RUN: bbc -target x86_64-unknown-linux-gnu -emit-fir -hlfir=false %s -o - | FileCheck %s
3+
! RUN: %flang_fc1 -target x86_64-unknown-linux-gnu -emit-fir -flang-deprecated-no-hlfir %s -o - | FileCheck %s
34

45
! DOT_PROD
56
! CHECK-LABEL: dot_prod_int_default

flang/test/Lower/Intrinsics/exponent.f90

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
! RUN: bbc -emit-fir %s -o - | FileCheck %s
1+
! REQUIRES: x86_64-registered-target
2+
! RUN: bbc -target x86_64-unknown-linux-gnu -emit-fir %s -o - | FileCheck %s
23

34
! EXPONENT
45
! CHECK-LABEL: exponent_test

flang/test/Lower/Intrinsics/fma_real16.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 %s -o - | FileCheck %s
23
! RUN: bbc --math-runtime=precise -emit-fir %s -o - | FileCheck %s
34
! RUN: %flang_fc1 -emit-fir %s -o - | FileCheck %s

flang/test/Lower/Intrinsics/fraction.f90

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
! RUN: bbc -emit-fir %s -o - | FileCheck %s
1+
! REQUIRES: x86_64-registered-target
2+
! RUN: bbc -target x86_64-unknown-linux-gnu -emit-fir %s -o - | FileCheck %s
23

34
! FRACTION
45
! CHECK-LABE: fraction_test

flang/test/Lower/Intrinsics/ieee_class_queries.f90

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
! REQUIRES: flang-supports-f128-math
2-
! RUN: bbc -emit-fir -o - %s | FileCheck %s
2+
! REQUIRES: x86_64-registered-target
3+
! RUN: bbc -target x86_64-unknown-linux-gnu -emit-fir -o - %s | FileCheck %s
34

45
! CHECK-LABEL: func @_QQmain
56
use ieee_arithmetic, only: ieee_is_finite, ieee_is_nan, ieee_is_negative, &

flang/test/Lower/Intrinsics/ieee_is_normal.f90

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
! RUN: bbc -emit-fir %s -o - | FileCheck %s
2-
! RUN: flang -fc1 -emit-fir %s -o - | FileCheck %s
1+
! REQUIRES: x86_64-registered-target
2+
! RUN: bbc -target x86_64-unknown-linux-gnu -emit-fir %s -o - | FileCheck %s
3+
! RUN: %flang_fc1 -target x86_64-unknown-linux-gnu -emit-fir %s -o - | FileCheck %s
34

45
! CHECK-LABEL: ieee_is_normal_f16
56
subroutine ieee_is_normal_f16(r)

flang/test/Lower/Intrinsics/ieee_next.f90

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
! RUN: bbc -emit-fir -o - %s | FileCheck %s
1+
! REQUIRES: x86_64-registered-target
2+
! RUN: bbc -target x86_64-unknown-linux-gnu -emit-fir -o - %s | FileCheck %s
23

34
! CHECK-LABEL: c.func @_QQmain
45
program p

flang/test/Lower/Intrinsics/isnan.f90

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
! RUN: bbc -emit-fir %s -o - | FileCheck %s
2-
! RUN: flang -fc1 -emit-fir %s -o - | FileCheck %s
1+
! REQUIRES: x86_64-registered-target
2+
! RUN: bbc -target x86_64-unknown-linux-gnu -emit-fir %s -o - | FileCheck %s
3+
! RUN: %flang_fc1 -target x86_64-unknown-linux-gnu -emit-fir %s -o - | FileCheck %s
34

45
! CHECK-LABEL: isnan_f32
56
subroutine isnan_f32(r)

flang/test/Lower/Intrinsics/mod.f90

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
! RUN: bbc -emit-fir -hlfir=false %s -o - | FileCheck %s
2-
! RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir %s -o - | FileCheck %s
1+
! REQUIRES: x86_64-registered-target
2+
! RUN: bbc -target x86_64-unknown-linux-gnu -emit-fir -hlfir=false %s -o - | FileCheck %s
3+
! RUN: %flang_fc1 -target x86_64-unknown-linux-gnu -emit-fir -flang-deprecated-no-hlfir %s -o - | FileCheck %s
34

45
! CHECK-LABEL: func @_QPmod_testr4(
56
! CHECK-SAME: %[[arg0:.*]]: !fir.ref<f32>{{.*}}, %[[arg1:.*]]: !fir.ref<f32>{{.*}}, %[[arg2:.*]]: !fir.ref<f32>{{.*}}) {

flang/test/Lower/Intrinsics/modulo.f90

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
! RUN: bbc -emit-fir -hlfir=false %s -o - | FileCheck %s -check-prefixes=HONORINF,ALL
2-
! RUN: flang -fc1 -menable-no-infs -emit-fir -flang-deprecated-no-hlfir %s -o - | FileCheck %s -check-prefixes=CHECK,ALL
2+
! RUN: flang -fc1 -menable-no-infs -emit-fir -flang-deprecated-no-hlfir %s -o - | FileCheck %s -check-prefixes=%if system-aix %{CHECK,ALL,F64%} %else %{CHECK,ALL,F128%}
33

44
! ALL-LABEL: func @_QPmodulo_testr(
55
! ALL-SAME: %[[arg0:.*]]: !fir.ref<f64>{{.*}}, %[[arg1:.*]]: !fir.ref<f64>{{.*}}, %[[arg2:.*]]: !fir.ref<f64>{{.*}}) {
@@ -39,9 +39,12 @@ subroutine modulo_testi(r, a, p)
3939
end subroutine
4040

4141
! CHECK-LABEL: func @_QPmodulo_testr16(
42-
! CHECK-SAME: %[[arg0:.*]]: !fir.ref<f128>{{.*}}, %[[arg1:.*]]: !fir.ref<f128>{{.*}}, %[[arg2:.*]]: !fir.ref<f128>{{.*}}) {
42+
! F128-SAME: %[[arg0:.*]]: !fir.ref<f128>{{.*}}, %[[arg1:.*]]: !fir.ref<f128>{{.*}}, %[[arg2:.*]]: !fir.ref<f128>{{.*}}) {
43+
! F64-SAME: %[[arg0:.*]]: !fir.ref<f64>{{.*}}, %[[arg1:.*]]: !fir.ref<f64>{{.*}}, %[[arg2:.*]]: !fir.ref<f64>{{.*}}) {
4344
subroutine modulo_testr16(r, a, p)
44-
real(16) :: r, a, p
45-
! CHECK: fir.call @_FortranAModuloReal16({{.*}}){{.*}}: (f128, f128, !fir.ref<i8>, i32) -> f128
45+
integer, parameter :: rk = merge(16, 8, selected_real_kind(33, 4931)==16)
46+
real(rk) :: r, a, p
47+
!F128: fir.call @_FortranAModuloReal16({{.*}}){{.*}}: (f128, f128, !fir.ref<i8>, i32) -> f128
48+
!F64: fir.call @_FortranAModuloReal16({{.*}}){{.*}}: (f64, f64, !fir.ref<i8>, i32) -> f64
4649
r = modulo(a, p)
4750
end subroutine

flang/test/Lower/Intrinsics/nearest.f90

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
! RUN: bbc -emit-fir %s -o - | FileCheck %s
1+
! REQUIRES: x86_64-registered-target
2+
! RUN: bbc -target x86_64-unknown-linux-gnu -emit-fir %s -o - | FileCheck %s
23

34
! CHECK-LABEL: c.func @_QPnearest_test1
45
! CHECK: %[[V_0:[0-9]+]] = fir.dummy_scope : !fir.dscope

flang/test/Lower/Intrinsics/norm2.f90

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
! RUN: bbc -emit-fir -hlfir=false %s -o - | FileCheck %s
2-
! RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir %s -o - | FileCheck %s
1+
! REQUIRES: x86_64-registered-target
2+
! RUN: bbc -target x86_64-unknown-linux-gnu -emit-fir -hlfir=false %s -o - | FileCheck %s
3+
! RUN: %flang_fc1 -target x86_64-unknown-linux-gnu -emit-fir -flang-deprecated-no-hlfir %s -o - | FileCheck %s
34

45
! CHECK-LABEL: func @_QPnorm2_test_4(
56
! CHECK-SAME: %[[arg0:.*]]: !fir.box<!fir.array<?xf32>>{{.*}}) -> f32

flang/test/Lower/Intrinsics/powi_real16.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 %s -o - | FileCheck %s --check-prefix=CHECK-FAST
23
! RUN: bbc --math-runtime=precise -emit-fir %s -o - | FileCheck %s --check-prefix=CHECK-PRECISE
34
! RUN: %flang_fc1 -emit-fir %s -o - | FileCheck %s --check-prefix=CHECK-FAST

flang/test/Lower/Intrinsics/random_number_real16.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 %s -o - | FileCheck %s
23
! RUN: %flang_fc1 -emit-fir %s -o - | FileCheck %s
34

flang/test/Lower/Intrinsics/reduce.f90

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
! RUN: bbc -emit-hlfir %s -o - | FileCheck %s
1+
! REQUIRES: x86_64-registered-target
2+
! RUN: bbc -target x86_64-unknown-linux-gnu -emit-hlfir %s -o - | FileCheck %s
23

34
module reduce_mod
45

flang/test/Lower/Intrinsics/rrspacing.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 %s -o - | FileCheck %s
23
! RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir %s -o - | FileCheck %s
34

flang/test/Lower/Intrinsics/scale.f90

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
! RUN: bbc -emit-fir -hlfir=false %s -o - | FileCheck %s
1+
! REQUIRES: x86_64-registered-target
2+
! RUN: bbc -target x86_64-unknown-linux-gnu -emit-fir -hlfir=false %s -o - | FileCheck %s
23

34
! CHECK-LABEL: scale_test1
45
subroutine scale_test1(x, i)

flang/test/Lower/Intrinsics/set_exponent.f90

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
! RUN: bbc -emit-fir -hlfir=false %s -o - | FileCheck %s
2-
! RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir %s -o - | FileCheck %s
1+
! REQUIRES: x86_64-registered-target
2+
! RUN: bbc -target x86_64-unknown-linux-gnu -emit-fir -hlfir=false %s -o - | FileCheck %s
3+
! RUN: %flang_fc1 -target x86_64-unknown-linux-gnu -emit-fir -flang-deprecated-no-hlfir %s -o - | FileCheck %s
34

45
! SET_EXPONENT
56
! CHECK-LABEL: set_exponent_test

flang/test/Lower/Intrinsics/sign.f90

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
! RUN: bbc %s -o - | FileCheck %s
1+
! RUN: bbc %s -o - | FileCheck %s --check-prefixes=%if system-aix %{CHECK,F64%} %else %{CHECK,F128%}
22

33
! CHECK-LABEL: sign_testi
44
subroutine sign_testi(a, b, c)
@@ -22,8 +22,10 @@ subroutine sign_testr(a, b, c)
2222

2323
! CHECK-LABEL: sign_testr2
2424
subroutine sign_testr2(a, b, c)
25-
real(KIND=16) a, b, c
25+
integer, parameter :: rk = merge(16, 8, selected_real_kind(33, 4931)==16)
26+
real(KIND=rk) a, b, c
2627
! CHECK-NOT: fir.call @{{.*}}fabs
27-
! CHECK: math.copysign{{.*}} : f128
28+
! F128: math.copysign{{.*}} : f128
29+
! F64: math.copysign{{.*}} : f64
2830
c = sign(a, b)
2931
end subroutine

flang/test/Lower/Intrinsics/spacing.f90

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
! RUN: bbc -emit-fir %s -o - | FileCheck %s
2-
! RUN: %flang_fc1 -emit-fir %s -o - | FileCheck %s
1+
! REQUIRES: x86_64-registered-target
2+
! RUN: bbc -target x86_64-unknown-linux-gnu -emit-fir %s -o - | FileCheck %s
3+
! RUN: %flang_fc1 -target x86_64-unknown-linux-gnu -emit-fir %s -o - | FileCheck %s
34

45
! CHECK-LABEL: func @_QPspacing_test(
56
real*4 function spacing_test(x)

flang/test/Lower/OpenMP/parallel-firstprivate-clause-scalar.f90

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
! This test checks lowering of `FIRSTPRIVATE` clause for scalar types.
22

3+
! REQUIRES: x86_64-registered-target
34
! REQUIRES: shell
4-
! RUN: bbc -fopenmp -emit-hlfir %s -o - \
5+
! RUN: bbc -target x86_64-unknown-linux-gnu -fopenmp -emit-hlfir %s -o - \
56
! RUN: | FileCheck %s --check-prefix=CHECK
67

78
!CHECK: omp.private {type = firstprivate} @[[ARG2_LOGICAL_PRIVATIZER:_QFfirstprivate_logicalEarg2_firstprivate_ref_l8]] : !fir.ref<!fir.logical<1>> alloc

flang/test/Lower/assignment.f90

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
! RUN: %flang_fc1 %s -o "-" -emit-fir -cpp -flang-deprecated-no-hlfir | FileCheck %s --check-prefixes=CHECK%if target=x86_64{{.*}} %{,CHECK-X86-64%}
1+
! RUN: %flang_fc1 %s -o "-" -emit-fir -cpp -flang-deprecated-no-hlfir | FileCheck %s --check-prefixes=CHECK,%if system-aix %{F64%} %else %{F128%if target=x86_64{{.*}} %{,CHECK-X86-64%}%}
22

33
subroutine sub1(a)
44
integer :: a
@@ -261,27 +261,29 @@ real function divf(a, b)
261261
! CHECK: return %[[RET]] : complex<f32>
262262

263263
subroutine real_constant()
264+
integer, parameter :: rk = merge(16, 8, selected_real_kind(33, 4931)==16)
264265
real(2) :: a
265266
real(4) :: b
266267
real(8) :: c
267268
#if __x86_64__
268269
real(10) :: d
269270
#endif
270-
real(16) :: e
271+
real(rk) :: e
271272
a = 2.0_2
272273
b = 4.0_4
273274
c = 8.0_8
274275
#if __x86_64__
275276
d = 10.0_10
276277
#endif
277-
e = 16.0_16
278+
e = 16.0_rk
278279
end
279280

280281
! CHECK: %[[A:.*]] = fir.alloca f16
281282
! CHECK: %[[B:.*]] = fir.alloca f32
282283
! CHECK: %[[C:.*]] = fir.alloca f64
283284
! CHECK-X86-64: %[[D:.*]] = fir.alloca f80
284-
! CHECK: %[[E:.*]] = fir.alloca f128
285+
! F128: %[[E:.*]] = fir.alloca f128
286+
! F64: %[[E:.*]] = fir.alloca f64
285287
! CHECK: %[[C2:.*]] = arith.constant 2.000000e+00 : f16
286288
! CHECK: fir.store %[[C2]] to %[[A]] : !fir.ref<f16>
287289
! CHECK: %[[C4:.*]] = arith.constant 4.000000e+00 : f32
@@ -290,8 +292,10 @@ subroutine real_constant()
290292
! CHECK: fir.store %[[C8]] to %[[C]] : !fir.ref<f64>
291293
! CHECK-X86-64: %[[C10:.*]] = arith.constant 1.000000e+01 : f80
292294
! CHECK-X86-64: fir.store %[[C10]] to %[[D]] : !fir.ref<f80>
293-
! CHECK: %[[C16:.*]] = arith.constant 1.600000e+01 : f128
294-
! CHECK: fir.store %[[C16]] to %[[E]] : !fir.ref<f128>
295+
! F128: %[[C16:.*]] = arith.constant 1.600000e+01 : f128
296+
! F64: %[[C16:.*]] = arith.constant 1.600000e+01 : f64
297+
! F128: fir.store %[[C16]] to %[[E]] : !fir.ref<f128>
298+
! F64: fir.store %[[C16]] to %[[E]] : !fir.ref<f64>
295299

296300
subroutine complex_constant()
297301
complex(4) :: a

flang/test/Lower/basic-function.f90

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
! RUN: bbc %s -o "-" -emit-fir -hlfir=false | FileCheck %s
1+
! REQUIRES: x86_64-registered-target
2+
! RUN: bbc -target x86_64-unknown-linux-gnu %s -o "-" -emit-fir -hlfir=false | FileCheck %s
23

34
integer(1) function fct1()
45
end

0 commit comments

Comments
 (0)