[M680x0] Add google/benchmark's CycleTimer support for M68K

This is a cherrypick of the upstream fix commit ffe1342 onto
`llvm/utils/benchmark` and `libcxx/utils/google-benchmark`.
This adds CycleTimer implementation for M680x0, which simply
uses `gettimeofday` same as MIPS.

Differential Review: https://reviews.llvm.org/D88868
This commit is contained in:
Min-Yih Hsu 2020-10-05 20:24:33 -07:00
parent 297655c123
commit bd5fe7b010
8 changed files with 10 additions and 2 deletions

View File

@ -46,3 +46,4 @@ Stripe, Inc.
Yixuan Qiu <yixuanq@gmail.com>
Yusuke Suzuki <utatane.tea@gmail.com>
Zbigniew Skowron <zbychs@gmail.com>
Min-Yih Hsu <yihshyng223@gmail.com>

View File

@ -66,3 +66,4 @@ Tom Madams <tom.ej.madams@gmail.com> <tmadams@google.com>
Yixuan Qiu <yixuanq@gmail.com>
Yusuke Suzuki <utatane.tea@gmail.com>
Zbigniew Skowron <zbychs@gmail.com>
Min-Yih Hsu <yihshyng223@gmail.com>

View File

@ -22,3 +22,5 @@ Changes:
to fix timestamp-related inline asm issues and 32-bit RISC-V build failures.
The second cherrypicked commit fixes formatting issues introduced by the
preceding change.
* https://github.com/google/benchmark/commit/ffe1342eb2faa7d2e7c35b4db2ccf99fab81ec20
is applied to add the CycleTimer implementation for M680x0

View File

@ -161,7 +161,7 @@ inline BENCHMARK_ALWAYS_INLINE int64_t Now() {
struct timeval tv;
gettimeofday(&tv, nullptr);
return static_cast<int64_t>(tv.tv_sec) * 1000000 + tv.tv_usec;
#elif defined(__mips__)
#elif defined(__mips__) || defined(__m68k__)
// mips apparently only allows rdtsc for superusers, so we fall
// back to gettimeofday. It's possible clock_gettime would be better.
struct timeval tv;

View File

@ -44,3 +44,4 @@ Stripe, Inc.
Yixuan Qiu <yixuanq@gmail.com>
Yusuke Suzuki <utatane.tea@gmail.com>
Zbigniew Skowron <zbychs@gmail.com>
Min-Yih Hsu <yihshyng223@gmail.com>

View File

@ -63,3 +63,4 @@ Tom Madams <tom.ej.madams@gmail.com> <tmadams@google.com>
Yixuan Qiu <yixuanq@gmail.com>
Yusuke Suzuki <utatane.tea@gmail.com>
Zbigniew Skowron <zbychs@gmail.com>
Min-Yih Hsu <yihshyng223@gmail.com>

View File

@ -33,3 +33,5 @@ Changes:
are applied on top of the previous cherrypick to fix timestamp-related inline
asm issues and 32-bit RISC-V build failures. The second cherrypicked commit
fixes formatting issues introduced by the preceding change.
* https://github.com/google/benchmark/commit/ffe1342eb2faa7d2e7c35b4db2ccf99fab81ec20
is applied to add the CycleTimer implementation for M680x0

View File

@ -161,7 +161,7 @@ inline BENCHMARK_ALWAYS_INLINE int64_t Now() {
struct timeval tv;
gettimeofday(&tv, nullptr);
return static_cast<int64_t>(tv.tv_sec) * 1000000 + tv.tv_usec;
#elif defined(__mips__)
#elif defined(__mips__) || defined(__m68k__)
// mips apparently only allows rdtsc for superusers, so we fall
// back to gettimeofday. It's possible clock_gettime would be better.
struct timeval tv;