Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/llvm/llvm-project.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorV Donaldson <vdonaldson@nvidia.com>2022-04-12 20:26:14 +0300
committerV Donaldson <vdonaldson@nvidia.com>2022-04-14 23:01:32 +0300
commit96e45a8958cbfb5906f5b8b3c2423ad5dd884963 (patch)
tree9d34ae64301dd5f3e7fe6168e6b6093837a3b88e /flang/docs
parent8cf83e96591b2ab3e748c0dc5ff019397e00f1ab (diff)
[flang] Use full result range for clock_gettime implementation of SYSTEM_CLOCK
Update the primary clock_gettime implementation of SYSTEM_CLOCK to use the full range of values, dependent on the type kind of the requested result. Counts/sec and count max for supported kinds become: kind counts/sec count max 1 10 127 2 1000 32767 4 1000 2147483647 8 1000000000 9223372036854775807 16 1000000000 9223372036854775807 The secondary "fallback" implementation is not changed. Real valued COUNT_RATE arguments are not changed. The test program below has calls for kinds 1, 2, 4, 8, 16. Support for these types varies by compiler. The code as given can be restricted to accommodate these variations, with results shown below. subroutine c integer(1) c1, r1, m1 integer(2) c2, r2, m2 integer(4) c4, r4, m4 integer(8) c8, r8, m8 integer(16) c16, r16, m16 print* print '(a5,3a22)', 'kind', 'counts/sec', 'count max', 'count' print* call system_clock(c1, r1, m1) print '(i5,3i22)', 1, r1, m1, c1 call system_clock(c2, r2, m2) print '(i5,3i22)', 2, r2, m2, c2 call system_clock(c4, r4, m4) print '(i5,3i22)', 4, r4, m4, c4 call system_clock(c8, r8, m8) print '(i5,3i22)', 8, r8, m8, c8 call system_clock(c16, r16, m16) print '(i5,3i22)', 16, r16, m16, c16 end subroutine k(j) j = 0 do i=1,1000000000 j = j + i enddo end program p do i=1,1 ! increase loop count to check for (kind=1) wraparound call k(j) call c enddo end === flang output without change (last column counts vary per run) === kind counts/sec count max count 1 -24 127 83 2 1000 290 211 4 1000 290 211 8 1000000000 290448383 211631452 16 1000000000 290448383 211633853 === flang output with change (last column counts vary per run) === 1 10 127 21 2 1000 32767 2100 4 1000 2147483647 2100 8 1000000000 9223372036854775807 2100183374 16 1000000000 9223372036854775807 2100185353 Other compilers; kind support varies (last column counts vary per run). Test and ouput modified to avoid crashes and normalize results. Some negative values indicate unsupported kinds; others are bugs. kind counts/sec count max count 1 0 0 -127 2 0 0 -32767 4 1000 2147483647 69271692 8 1000000000 9223372036854775807 69271692353290 16 1000000000 9223372036854775807 69271692354794 ======= 1 10 127 0 2 1000 32767 0 4 1000000 2147483647 0 8 10000000 9223372036854775807 9 ======= 1 0 0 -127 2 1000 32767 3263 4 10000 2147483647 1788192630 8 1000000 9223372036854775807 1649443459263095 ======= 1 -24 -1 36 2 1000 -1 -10716 4 1000 2147483647 176018980 8 1000 9223372036854775807 1649443460644 ======= 2 100 28799 23080 4 100 8639999 4285480 8 100 8639999 4285480 16 100 8639999 4285480 ======= 1 -24 -1 4 2 1000 23551 -26108 4 1000 86399999 67541508 8 1000000 9223372036854775807 1649443541508087
Diffstat (limited to 'flang/docs')
-rw-r--r--flang/docs/Extensions.md7
1 files changed, 3 insertions, 4 deletions
diff --git a/flang/docs/Extensions.md b/flang/docs/Extensions.md
index 5e3d4dd09284..a648d717d82e 100644
--- a/flang/docs/Extensions.md
+++ b/flang/docs/Extensions.md
@@ -67,10 +67,9 @@ end
* If both the `COUNT=` and the `COUNT_MAX=` optional arguments are
present on the same call to the intrinsic subroutine `SYSTEM_CLOCK`,
we require that their types have the same integer kind, since the
- kind of these arguments is used to select the clock rate.
- In common with some other compilers, the clock is in milliseconds
- for kinds <= 4 and nanoseconds otherwise where the target system
- supports these rates.
+ kind of these arguments is used to select the clock rate. In common
+ with some other compilers, the clock rate varies from tenths of a
+ second to nanoseconds depending on argument kind and platform support.
* If a dimension of a descriptor has zero extent in a call to
`CFI_section`, `CFI_setpointer` or `CFI_allocate`, the lower
bound on that dimension will be set to 1 for consistency with