diff options
author | Kiran Chandramohan <kiran.chandramohan@arm.com> | 2023-07-18 10:33:57 +0000 |
---|---|---|
committer | Kiran Chandramohan <kiran.chandramohan@arm.com> | 2023-07-18 11:05:25 +0000 |
commit | fc43c4f0181bfb7e7821e8b12fbd45e5178e884b (patch) | |
tree | 26832bf9dee7d7a03198f8055c4342841a07320f /flang | |
parent | 75f459d555a46a337c9f77948392fa9d750ea555 (diff) | |
download | llvm-fc43c4f0181bfb7e7821e8b12fbd45e5178e884b.zip llvm-fc43c4f0181bfb7e7821e8b12fbd45e5178e884b.tar.gz llvm-fc43c4f0181bfb7e7821e8b12fbd45e5178e884b.tar.bz2 |
[Flang] Include logical default with default-integer-8
Other compilers include the logical default also with the
default-integer-8 setting. This patch does the same for
flang.
Reviewed By: awarzynski, sscalpone
Differential Revision: https://reviews.llvm.org/D155279
Diffstat (limited to 'flang')
-rw-r--r-- | flang/docs/IntrinsicTypes.md | 3 | ||||
-rw-r--r-- | flang/lib/Frontend/CompilerInvocation.cpp | 1 | ||||
-rw-r--r-- | flang/test/Driver/driver-help-hidden.f90 | 2 | ||||
-rw-r--r-- | flang/test/Driver/driver-help.f90 | 4 | ||||
-rw-r--r-- | flang/test/Lower/Intrinsics/get_environment_variable.f90 | 14 | ||||
-rw-r--r-- | flang/tools/f18-parse-demo/f18-parse-demo.cpp | 1 |
6 files changed, 15 insertions, 10 deletions
diff --git a/flang/docs/IntrinsicTypes.md b/flang/docs/IntrinsicTypes.md index c5f22e0..3706b3f 100644 --- a/flang/docs/IntrinsicTypes.md +++ b/flang/docs/IntrinsicTypes.md @@ -73,8 +73,7 @@ COMPLEX 8 #### Modifying the default kind with default-integer-8: INTEGER 8 - -There is no option to modify the default logical kind. +LOGICAL 8 Modules compiled with different default-real and default-integer kinds may be freely mixed. diff --git a/flang/lib/Frontend/CompilerInvocation.cpp b/flang/lib/Frontend/CompilerInvocation.cpp index 4c49f3b..e76b67a 100644 --- a/flang/lib/Frontend/CompilerInvocation.cpp +++ b/flang/lib/Frontend/CompilerInvocation.cpp @@ -704,6 +704,7 @@ static bool parseDialectArgs(CompilerInvocation &res, llvm::opt::ArgList &args, res.getDefaultKinds().set_defaultIntegerKind(8); res.getDefaultKinds().set_subscriptIntegerKind(8); res.getDefaultKinds().set_sizeIntegerKind(8); + res.getDefaultKinds().set_defaultLogicalKind(8); } if (args.hasArg(clang::driver::options::OPT_fdefault_double_8)) { if (!args.hasArg(clang::driver::options::OPT_fdefault_real_8)) { diff --git a/flang/test/Driver/driver-help-hidden.f90 b/flang/test/Driver/driver-help-hidden.f90 index a3fe2f0..f8f1df7 100644 --- a/flang/test/Driver/driver-help-hidden.f90 +++ b/flang/test/Driver/driver-help-hidden.f90 @@ -27,7 +27,7 @@ ! CHECK-NEXT: -fcolor-diagnostics Enable colors in diagnostics ! CHECK-NEXT: -fconvert=<value> Set endian conversion of data for unformatted files ! CHECK-NEXT: -fdefault-double-8 Set the default double precision kind to an 8 byte wide type -! CHECK-NEXT: -fdefault-integer-8 Set the default integer kind to an 8 byte wide type +! CHECK-NEXT: -fdefault-integer-8 Set the default integer and logical kind to an 8 byte wide type ! CHECK-NEXT: -fdefault-real-8 Set the default real kind to an 8 byte wide type ! CHECK-NEXT: -ffast-math Allow aggressive, lossy floating-point optimizations ! CHECK-NEXT: -ffixed-form Process source files in fixed form diff --git a/flang/test/Driver/driver-help.f90 b/flang/test/Driver/driver-help.f90 index e9e4d08..a80e6f5 100644 --- a/flang/test/Driver/driver-help.f90 +++ b/flang/test/Driver/driver-help.f90 @@ -27,7 +27,7 @@ ! HELP-NEXT: -fcolor-diagnostics Enable colors in diagnostics ! HELP-NEXT: -fconvert=<value> Set endian conversion of data for unformatted files ! HELP-NEXT: -fdefault-double-8 Set the default double precision kind to an 8 byte wide type -! HELP-NEXT: -fdefault-integer-8 Set the default integer kind to an 8 byte wide type +! HELP-NEXT: -fdefault-integer-8 Set the default integer and logical kind to an 8 byte wide type ! HELP-NEXT: -fdefault-real-8 Set the default real kind to an 8 byte wide type ! HELP-NEXT: -ffast-math Allow aggressive, lossy floating-point optimizations ! HELP-NEXT: -ffixed-form Process source files in fixed form @@ -125,7 +125,7 @@ ! HELP-FC1-NEXT: Unparse and stop. ! HELP-FC1-NEXT: -fdebug-unparse Unparse and stop. ! HELP-FC1-NEXT: -fdefault-double-8 Set the default double precision kind to an 8 byte wide type -! HELP-FC1-NEXT: -fdefault-integer-8 Set the default integer kind to an 8 byte wide type +! HELP-FC1-NEXT: -fdefault-integer-8 Set the default integer and logical kind to an 8 byte wide type ! HELP-FC1-NEXT: -fdefault-real-8 Set the default real kind to an 8 byte wide type ! HELP-FC1-NEXT: -fembed-offload-object=<value> ! HELP-FC1-NEXT: Embed Offloading device-side binary into host object file as a section. diff --git a/flang/test/Lower/Intrinsics/get_environment_variable.f90 b/flang/test/Lower/Intrinsics/get_environment_variable.f90 index ad9b45d..efeff63 100644 --- a/flang/test/Lower/Intrinsics/get_environment_variable.f90 +++ b/flang/test/Lower/Intrinsics/get_environment_variable.f90 @@ -82,7 +82,8 @@ end subroutine name_and_status_only ! CHECK-LABEL: func @_QPname_and_trim_name_only( ! CHECK-SAME: %[[nameArg:.*]]: !fir.boxchar<1> {fir.bindc_name = "name"}, -! CHECK-SAME: %[[trimNameArg:.*]]: !fir.ref<!fir.logical<4>> {fir.bindc_name = "trim_name"}) { +! CHECK-32-SAME: %[[trimNameArg:.*]]: !fir.ref<!fir.logical<4>> {fir.bindc_name = "trim_name"}) { +! CHECK-64-SAME: %[[trimNameArg:.*]]: !fir.ref<!fir.logical<8>> {fir.bindc_name = "trim_name"}) { subroutine name_and_trim_name_only(name, trim_name) character(len=32) :: name logical :: trim_name @@ -120,7 +121,8 @@ end subroutine name_and_errmsg_only ! CHECK-SAME: %[[valueArg:.*]]: !fir.boxchar<1> {fir.bindc_name = "value"}, ! CHECK-SAME: %[[lengthArg:[^:]*]]: !fir.ref<i[[DEFAULT_INTEGER_SIZE]]> {fir.bindc_name = "length"}, ! CHECK-SAME: %[[statusArg:.*]]: !fir.ref<i[[DEFAULT_INTEGER_SIZE]]> {fir.bindc_name = "status"}, -! CHECK-SAME: %[[trimNameArg:.*]]: !fir.ref<!fir.logical<4>> {fir.bindc_name = "trim_name"}, +! CHECK-32-SAME: %[[trimNameArg:.*]]: !fir.ref<!fir.logical<4>> {fir.bindc_name = "trim_name"}, +! CHECK-64-SAME: %[[trimNameArg:.*]]: !fir.ref<!fir.logical<8>> {fir.bindc_name = "trim_name"}, ! CHECK-SAME: %[[errmsgArg:.*]]: !fir.boxchar<1> {fir.bindc_name = "errmsg"}) { subroutine all_arguments(name, value, length, status, trim_name, errmsg) character(len=32) :: name, value, errmsg @@ -138,15 +140,17 @@ subroutine all_arguments(name, value, length, status, trim_name, errmsg) ! CHECK-NEXT: %[[lengthBoxed:.*]] = fir.embox %[[lengthArg]] : (!fir.ref<i[[DEFAULT_INTEGER_SIZE]]>) -> !fir.box<i[[DEFAULT_INTEGER_SIZE]]> ! CHECK-NEXT: %[[errmsgBoxed:.*]] = fir.embox %[[errmsgCast]] : (!fir.ref<!fir.char<1,32>>) -> !fir.box<!fir.char<1,32>> ! CHECK: %[[trimName:.*]] = fir.if %{{.*}} -> (i1) { -! CHECK-NEXT: %[[trimNameLoaded:.*]] = fir.load %[[trimNameArg]] : !fir.ref<!fir.logical<4>> -! CHECK-NEXT: %[[trimCast:.*]] = fir.convert %[[trimNameLoaded]] : (!fir.logical<4>) -> i1 +! CHECK-32-NEXT: %[[trimNameLoaded:.*]] = fir.load %[[trimNameArg]] : !fir.ref<!fir.logical<4>> +! CHECK-64-NEXT: %[[trimNameLoaded:.*]] = fir.load %[[trimNameArg]] : !fir.ref<!fir.logical<8>> +! CHECK-32-NEXT: %[[trimCast:.*]] = fir.convert %[[trimNameLoaded]] : (!fir.logical<4>) -> i1 +! CHECK-64-NEXT: %[[trimCast:.*]] = fir.convert %[[trimNameLoaded]] : (!fir.logical<8>) -> i1 ! CHECK-NEXT: fir.result %[[trimCast]] : i1 ! CHECK-NEXT: } else { ! CHECK-NEXT: %[[trueVal:.*]] = arith.constant true ! CHECK-NEXT: fir.result %[[trueVal]] : i1 ! CHECK-NEXT: } ! CHECK: %[[sourceFileString:.*]] = fir.address_of(@_QQcl.[[fileString:.*]]) : !fir.ref<!fir.char<1,[[fileStringLength:.*]]>> -! CHECK-NEXT: %[[sourceLine:.*]] = arith.constant [[# @LINE - 20]] : i32 +! CHECK-NEXT: %[[sourceLine:.*]] = arith.constant [[# @LINE - 22]] : i32 ! CHECK-NEXT: %[[name:.*]] = fir.convert %[[nameBoxed]] : (!fir.box<!fir.char<1,32>>) -> !fir.box<none> ! CHECK-NEXT: %[[value:.*]] = fir.convert %[[valueBoxed]] : (!fir.box<!fir.char<1,32>>) -> !fir.box<none> ! CHECK-NEXT: %[[length:.*]] = fir.convert %[[lengthBoxed]] : (!fir.box<i[[DEFAULT_INTEGER_SIZE]]>) -> !fir.box<none> diff --git a/flang/tools/f18-parse-demo/f18-parse-demo.cpp b/flang/tools/f18-parse-demo/f18-parse-demo.cpp index afaa18b..3025dbd 100644 --- a/flang/tools/f18-parse-demo/f18-parse-demo.cpp +++ b/flang/tools/f18-parse-demo/f18-parse-demo.cpp @@ -405,6 +405,7 @@ int main(int argc, char *const argv[]) { defaultKinds.set_defaultRealKind(8); } else if (arg == "-i8" || arg == "-fdefault-integer-8") { defaultKinds.set_defaultIntegerKind(8); + defaultKinds.set_defaultLogicalKind(8); } else if (arg == "-help" || arg == "--help" || arg == "-?") { llvm::errs() << "f18-parse-demo options:\n" |