]> git.sesse.net Git - x264/commit
checkasm: Serialize read_time() calls on x86
authorHenrik Gramner <henrik@gramner.com>
Wed, 8 Oct 2014 20:25:35 +0000 (22:25 +0200)
committerFiona <fiona@x264.com>
Thu, 9 Oct 2014 00:17:27 +0000 (17:17 -0700)
commit4576cfd8c391b27748d6f97f5b621cec4ed8047c
tree253418744fcc053b8c7f6b274f71c340d1b80d83
parentb85a74a22f79c8722674c4cfd7cddf5f54c8421d
checkasm: Serialize read_time() calls on x86

Improves the accuracy of benchmarks, especially in short functions.

To quote the Intel 64 and IA-32 Architectures Software Developer's Manual:
"The RDTSC instruction is not a serializing instruction. It does not necessarily
wait until all previous instructions have been executed before reading the counter.
Similarly, subsequent instructions may begin execution before the read operation
is performed. If software requires RDTSC to be executed only after all previous
instructions have completed locally, it can either use RDTSCP (if the processor
supports that instruction) or execute the sequence LFENCE;RDTSC."

RDTSCP would accomplish the same task, but it's only available since Nehalem.

This change makes SSE2 a requirement to run checkasm.
tools/checkasm.c