Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Wim Lewis
nettle
Commits
71502947
Commit
71502947
authored
Sep 22, 2010
by
Niels Möller
Browse files
(GET_CYCLE_COUNTER): Define also for x86_64.
(time_memxor): Improved display. Rev: nettle/examples/nettle-benchmark.c:1.11
parent
e376c4eb
Changes
1
Hide whitespace changes
Inline
Side-by-side
examples/nettle-benchmark.c
View file @
71502947
...
...
@@ -61,7 +61,7 @@ static double frequency = 0.0;
/* FIXME: Proper configure test for rdtsc? */
#ifndef WITH_CYCLE_COUNTER
# if defined(__GNUC__) && defined(__i386__)
# if defined(__GNUC__) &&
(
defined(__i386__)
|| defined(__x86_64__))
# define WITH_CYCLE_COUNTER 1
# else
# define WITH_CYCLE_COUNTER 0
...
...
@@ -69,6 +69,7 @@ static double frequency = 0.0;
#endif
#if WITH_CYCLE_COUNTER
# if defined(__i386__)
#define GET_CYCLE_COUNTER(hi, lo) \
__asm__("xorl %%eax,%%eax\n" \
"movl %%ebx, %%edi\n" \
...
...
@@ -78,6 +79,17 @@ static double frequency = 0.0;
: "=a" (lo), "=d" (hi) \
:
/* No inputs. */
\
: "%edi", "%ecx", "cc")
# elif defined(__x86_64__)
#define GET_CYCLE_COUNTER(hi, lo) \
__asm__("xorl %%eax,%%eax\n" \
"mov %%rbx, %%r10\n" \
"cpuid\n" \
"rdtsc\n" \
"mov %%r10, %%rbx\n" \
: "=a" (lo), "=d" (hi) \
:
/* No inputs. */
\
: "%r10", "%rcx", "cc")
# endif
#define BENCH_ITERATIONS 10
#endif
...
...
@@ -272,9 +284,9 @@ time_memxor(void)
info
.
src
=
src
;
info
.
dst
=
dst
;
display
(
"xor"
,
"aligned"
,
1
,
time_function
(
bench_memxor
,
&
info
));
display
(
"
mem
xor"
,
"aligned"
,
0
,
time_function
(
bench_memxor
,
&
info
));
info
.
src
++
;
display
(
"xor"
,
"unaligned"
,
1
,
time_function
(
bench_memxor
,
&
info
));
display
(
"
mem
xor"
,
"unaligned"
,
0
,
time_function
(
bench_memxor
,
&
info
));
}
static
void
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment