Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
SWIFTsim
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SWIFT
SWIFTsim
Commits
55684274
Commit
55684274
authored
7 years ago
by
Matthieu Schaller
Browse files
Options
Downloads
Patches
Plain Diff
New upstream version of cycle.h taken from FFTW.
parent
aab0b0fd
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!504
New upstream version of cycle.h taken from FFTW.
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/cycle.h
+47
-23
47 additions, 23 deletions
src/cycle.h
with
47 additions
and
23 deletions
src/cycle.h
+
47
−
23
View file @
55684274
/*
* Copyright (c) 2003, 2007-
8
Matteo Frigo
* Copyright (c) 2003, 2007-
8
Massachusetts Institute of Technology
* Copyright (c) 2003, 2007-
14
Matteo Frigo
* Copyright (c) 2003, 2007-
14
Massachusetts Institute of Technology
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
...
...
@@ -179,14 +179,7 @@ INLINE_ELAPSED(__inline__)
!defined(HAVE_TICK_COUNTER)
typedef
unsigned
long
long
ticks
;
#ifndef INLINE
#if __GNUC__ && !__GNUC_STDC_INLINE__
#define INLINE extern inline
#else
#define INLINE inline
#endif
#endif
INLINE
static
ticks
getticks
(
void
)
{
static
__inline__
ticks
getticks
(
void
)
{
ticks
ret
;
__asm__
__volatile__
(
"rdtsc"
:
"=A"
(
ret
));
...
...
@@ -210,8 +203,9 @@ static __inline ticks getticks(void) {
ticks
retval
;
__asm
{
RDTSC
mov
retval
.
HighPart
,
edx
mov
retval
.
LowPart
,
eax
RDTSC
mov
retval
.
HighPart
,
edx
mov
retval
.
LowPart
,
eax
}
return
retval
;
}
...
...
@@ -232,22 +226,16 @@ static __inline double elapsed(ticks t1, ticks t0) {
defined(__x86_64__) && !defined(HAVE_TICK_COUNTER)
typedef
unsigned
long
long
ticks
;
#ifndef INLINE
#if __GNUC__ && !__GNUC_STDC_INLINE__
#define INLINE extern inline
#else
#define INLINE inline
#endif
#endif
INLINE
static
ticks
getticks
(
void
)
{
static
__inline__
ticks
getticks
(
void
)
{
unsigned
a
,
d
;
asm
volatile
(
"rdtsc"
:
"=a"
(
a
),
"=d"
(
d
));
__
asm
__
__
volatile
__
(
"rdtsc"
:
"=a"
(
a
),
"=d"
(
d
));
return
((
ticks
)
a
)
|
(((
ticks
)
d
)
<<
32
);
}
INLINE_ELAPSED
(
__inline__
)
#define HAVE_TICK_COUNTER
#define TIME_MIN 5000.0
#endif
/* PGI compiler, courtesy Cristiano Calonaci, Andrea Tarsi, & Roberto Gori.
...
...
@@ -260,6 +248,7 @@ static ticks getticks(void) {
}
INLINE_ELAPSED
(
__inline__
)
#define HAVE_TICK_COUNTER
#define TIME_MIN 5000.0
#endif
/* Visual C++, courtesy of Dirk Michaelis */
...
...
@@ -273,6 +262,7 @@ typedef unsigned __int64 ticks;
INLINE_ELAPSED
(
__inline
)
#define HAVE_TICK_COUNTER
#define TIME_MIN 5000.0
#endif
/*----------------------------------------------------------------*/
...
...
@@ -352,7 +342,7 @@ INLINE_ELAPSED(inline)
/*
* PA-RISC cycle counter
*/
#if defined(__hppa__) || defined(__hppa) && !defined(HAVE_TICK_COUNTER)
#if
(
defined(__hppa__) || defined(__hppa)
)
&& !defined(HAVE_TICK_COUNTER)
typedef
unsigned
long
ticks
;
#ifdef __GNUC__
...
...
@@ -445,7 +435,7 @@ INLINE_ELAPSED(__inline)
/*----------------------------------------------------------------*/
/* SGI/Irix */
#if defined(HAVE_CLOCK_GETTIME) && defined(CLOCK_SGI_CYCLE) && \
!defined(HAVE_TICK_COUNTER)
!defined(HAVE_TICK_COUNTER)
&& !defined(__ANDROID__)
typedef
struct
timespec
ticks
;
static
inline
ticks
getticks
(
void
)
{
...
...
@@ -517,3 +507,37 @@ INLINE_ELAPSED(inline)
#define HAVE_TICK_COUNTER
#endif
#endif
/* HAVE_MIPS_ZBUS_TIMER */
#if defined(HAVE_ARMV7A_CNTVCT)
typedef
uint64_t
ticks
;
static
inline
ticks
getticks
(
void
)
{
uint32_t
Rt
,
Rt2
=
0
;
asm
volatile
(
"mrrc p15, 1, %0, %1, c14"
:
"=r"
(
Rt
),
"=r"
(
Rt2
));
return
((
uint64_t
)
Rt
)
|
(((
uint64_t
)
Rt2
)
<<
32
);
}
INLINE_ELAPSED
(
inline
)
#define HAVE_TICK_COUNTER
#endif
#if defined(__aarch64__) && defined(HAVE_ARMV8_CNTVCT_EL0) && \
!defined(HAVE_ARMV8CC)
typedef
uint64_t
ticks
;
static
inline
ticks
getticks
(
void
)
{
uint64_t
Rt
;
asm
volatile
(
"mrs %0, CNTVCT_EL0"
:
"=r"
(
Rt
));
return
Rt
;
}
INLINE_ELAPSED
(
inline
)
#define HAVE_TICK_COUNTER
#endif
#if defined(__aarch64__) && defined(HAVE_ARMV8CC)
typedef
uint64_t
ticks
;
static
inline
ticks
getticks
(
void
)
{
uint64_t
cc
=
0
;
asm
volatile
(
"mrs %0, PMCCNTR_EL0"
:
"=r"
(
cc
));
return
cc
;
}
INLINE_ELAPSED
(
inline
)
#define HAVE_TICK_COUNTER
#endif
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment