Skip to content

Commit 69cddd6

Browse files
optimization of rdtsc()
On x86-64, the most significant bits of the RDX:RAX registers are guaranteed to be zero. This means that the rdtsc instruction will return two 64-bit numbers. In practice, this removes the extra instruction to clear the most significant bits of the return value.
1 parent 5862261 commit 69cddd6

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

runtime/Cycles.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class Cycles {
4242
if (mockTscValue)
4343
return mockTscValue;
4444
#endif
45-
uint32_t lo, hi;
45+
size_t lo, hi;
4646
__asm__ __volatile__("rdtsc" : "=a" (lo), "=d" (hi));
4747
// __asm__ __volatile__("rdtscp" : "=a" (lo), "=d" (hi) : : "%rcx");
4848
return (((uint64_t)hi << 32) | lo);

0 commit comments

Comments
 (0)