[flang-commits] [PATCH] D111281: [flang] More work on SYSTEM_CLOCK runtime API and implementation

Peter Klausler via Phabricator via flang-commits flang-commits at lists.llvm.org
Thu Oct 7 11:16:30 PDT 2021


klausler marked 3 inline comments as done.
klausler added inline comments.


================
Comment at: flang/runtime/time-intrinsic.cpp:122
+  constexpr auto max_clock_t{std::numeric_limits<std::clock_t>::max()};
+  unsigned_count_t maxCount{GetHUGE(kind)};
+  return max_clock_t <= maxCount ? static_cast<count_t>(max_clock_t)
----------------
rovka wrote:
> Isn't maxCount actually GetHUGE - 1? (Since you're doing % at the end of GetSystemClockCount).
Thanks for noticing that!


================
Comment at: flang/runtime/time-intrinsic.cpp:153
+          ? unsignedNsecs
+          : unsignedNsecs / (NSECS_PER_SEC / MILLIS_PER_SEC)};
+  // Return the modulus of the unsigned integral count with HUGE(COUNT).
----------------
rovka wrote:
> Should we extract this into a helper, so it stays in sync with GetSystemClockCountMax?
Sure, will do.


================
Comment at: flang/unittests/Runtime/Time.cpp:71
+  EXPECT_GE(start8, 0);
+  EXPECT_LT(start8, max8);
 
----------------
rovka wrote:
> Maybe also add tests for kind = 16?
Good idea, will do.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D111281/new/

https://reviews.llvm.org/D111281



More information about the flang-commits mailing list