Skip to content

Commit

Permalink
Fixes #345: PPC build for non-glibc.
Browse files Browse the repository at this point in the history
Thanks @jbeich for reporting this.

PiperOrigin-RevId: 392382660
  • Loading branch information
jan-wassenberg authored and Copybara-Service committed Aug 23, 2021
1 parent a8fba91 commit 3769cb2
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions hwy/nanobenchmark.cc
Expand Up @@ -46,7 +46,7 @@
#endif

#include "hwy/base.h"
#if HWY_ARCH_PPC
#if HWY_ARCH_PPC && defined(__GLIBC__)
#include <sys/platform/ppc.h> // NOLINT __ppc_get_timebase_freq
#elif HWY_ARCH_X86

Expand Down Expand Up @@ -119,7 +119,7 @@ using Ticks = uint64_t;
// divide by InvariantTicksPerSecond.
inline Ticks Start() {
Ticks t;
#if HWY_ARCH_PPC
#if HWY_ARCH_PPC && defined(__GLIBC__)
asm volatile("mfspr %0, %1" : "=r"(t) : "i"(268));
#elif HWY_ARCH_X86 && HWY_COMPILER_MSVC
_ReadWriteBarrier();
Expand Down Expand Up @@ -161,7 +161,7 @@ inline Ticks Start() {

inline Ticks Stop() {
uint64_t t;
#if HWY_ARCH_PPC
#if HWY_ARCH_PPC && defined(__GLIBC__)
asm volatile("mfspr %0, %1" : "=r"(t) : "i"(268));
#elif HWY_ARCH_X86 && HWY_COMPILER_MSVC
_ReadWriteBarrier();
Expand Down Expand Up @@ -399,7 +399,7 @@ double NominalClockRate() {
} // namespace

double InvariantTicksPerSecond() {
#if HWY_ARCH_PPC
#if HWY_ARCH_PPC && defined(__GLIBC__)
return double(__ppc_get_timebase_freq());
#elif HWY_ARCH_X86
// We assume the TSC is invariant; it is on all recent Intel/AMD CPUs.
Expand Down

0 comments on commit 3769cb2

Please sign in to comment.