Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Nettle
nettle
Commits
c10336bf
Commit
c10336bf
authored
Jan 10, 2019
by
Niels Möller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
nettle-benchmark: Add volatile to inline asm.
parent
09def119
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
16 deletions
+21
-16
ChangeLog
ChangeLog
+5
-0
examples/nettle-benchmark.c
examples/nettle-benchmark.c
+16
-16
No files found.
ChangeLog
View file @
c10336bf
2019-01-09 Niels Möller <nisse@lysator.liu.se>
* examples/nettle-benchmark.c (GET_CYCLE_COUNTER): Add volatile to
inline asm.
2019-01-08 Niels Möller <nisse@lysator.liu.se>
2019-01-08 Niels Möller <nisse@lysator.liu.se>
* sha512-compress.c: Add missing include of sha2-internal.h.
* sha512-compress.c: Add missing include of sha2-internal.h.
...
...
examples/nettle-benchmark.c
View file @
c10336bf
...
@@ -92,24 +92,24 @@ static double frequency = 0.0;
...
@@ -92,24 +92,24 @@ static double frequency = 0.0;
#if WITH_CYCLE_COUNTER
#if WITH_CYCLE_COUNTER
# if defined(__i386__)
# if defined(__i386__)
#define GET_CYCLE_COUNTER(hi, lo) \
#define GET_CYCLE_COUNTER(hi, lo) \
__asm__("xorl %%eax,%%eax\n"
\
__asm__
volatile
("xorl %%eax,%%eax\n" \
"movl %%ebx, %%edi\n"
\
"movl %%ebx, %%edi\n" \
"cpuid\n"
\
"cpuid\n" \
"rdtsc\n"
\
"rdtsc\n" \
"movl %%edi, %%ebx\n"
\
"movl %%edi, %%ebx\n" \
: "=a" (lo), "=d" (hi)
\
: "=a" (lo), "=d" (hi) \
:
/* No inputs. */
\
:
/* No inputs. */
\
: "%edi", "%ecx", "cc")
: "%edi", "%ecx", "cc")
# elif defined(__x86_64__)
# elif defined(__x86_64__)
#define GET_CYCLE_COUNTER(hi, lo) \
#define GET_CYCLE_COUNTER(hi, lo) \
__asm__("xorl %%eax,%%eax\n"
\
__asm__
volatile
("xorl %%eax,%%eax\n" \
"mov %%rbx, %%r10\n"
\
"mov %%rbx, %%r10\n" \
"cpuid\n"
\
"cpuid\n" \
"rdtsc\n"
\
"rdtsc\n" \
"mov %%r10, %%rbx\n"
\
"mov %%r10, %%rbx\n" \
: "=a" (lo), "=d" (hi)
\
: "=a" (lo), "=d" (hi) \
:
/* No inputs. */
\
:
/* No inputs. */
\
: "%r10", "%rcx", "cc")
: "%r10", "%rcx", "cc")
# endif
# endif
#define BENCH_ITERATIONS 10
#define BENCH_ITERATIONS 10
#endif
#endif
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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