Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions criterion-measurement/cbits/cycles.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,19 @@ StgWord64 criterion_rdtsc(void)
return ret;
}

#elif powerpc64le_HOST_ARCH || powerpc64_HOST_ARCH

StgWord64 criterion_rdtsc(void)
{
// Read the PowerPC Time Base: a monotonically-increasing 64-bit counter
// that is the architectural analogue of x86's TSC. SPR 268 returns the
// full 64-bit Time Base on 64-bit PowerPC (this is what the deprecated
// `mftb` mnemonic expanded to).
StgWord64 ret;
__asm__ __volatile__ ("mfspr %0, 268" : "=r"(ret));
Comment thread
pkubaj marked this conversation as resolved.
return ret;
}

#elif x86_64_HOST_ARCH || i386_HOST_ARCH

StgWord64 criterion_rdtsc(void)
Expand Down
Loading