[flang] More work on SYSTEM_CLOCK runtime API and implementation
authorpeter klausler <pklausler@nvidia.com>
Wed, 6 Oct 2021 21:03:48 +0000 (14:03 -0700)
committerpeter klausler <pklausler@nvidia.com>
Tue, 12 Oct 2021 16:24:24 +0000 (09:24 -0700)
commitf05c95f10fc1d8171071735af8ad3a9e87633120
tree26df77c5413b6fe96bc98ef8e4592c81f0fb59ad
parent57b40b5f34383634949d1639e64a5c2acd0dc5f6
[flang] More work on SYSTEM_CLOCK runtime API and implementation

To get proper wrap-around behavior for the various kind parameter
values of the optional COUNT= and COUNT_MAX= dummy arguments to
the intrinsic subroutine SYSTEM_CLOCK, add an extra argument to
the APIs for lowering to pass the integer kind of the actual argument.
Avoid confusion by requiring that both actual arguments have the same
kind when both are present.  The results of the runtime functions
remain std::int64_t and lowering should still convert them before
storing to the actual argument variables.

Rework the implementation a bit to accomodate the dynamic
specification of the kind parameter, and to clean up some coding
issues with preprocessing and templates.

Use the kind of the COUNT=/COUNT_MAX= actual arguments to determine
the clock's resolution, where possible, in conformance with other
Fortran implementations.

Differential Revision: https://reviews.llvm.org/D111281
flang/docs/Extensions.md
flang/include/flang/Runtime/time-intrinsic.h
flang/lib/Evaluate/intrinsics.cpp
flang/runtime/time-intrinsic.cpp
flang/unittests/Runtime/Time.cpp