File tree 2 files changed +9
-4
lines changed
2 files changed +9
-4
lines changed Original file line number Diff line number Diff line change 4
4
uint64_t cpucounter (void )
5
5
{
6
6
uint64_t low , high ;
7
- __asm__ __volatile__ ("rdtscp" : "=a" (low ), "=d" (high ) : : "%ecx" );
7
+ __asm__ __volatile__("rdtscp"
8
+ : "=a" (low ), "=d" (high )
9
+ :
10
+ : "%ecx" );
8
11
return (high << 32 ) | low ;
9
12
}
10
13
#elif defined(__aarch64__ )
11
14
uint64_t cpucounter (void )
12
15
{
13
16
uint64_t virtual_timer_value ;
14
- __asm__ __volatile__ ("mrs %0, cntvct_el0" : "=r" (virtual_timer_value ));
17
+ __asm__ __volatile__("mrs %0, cntvct_el0"
18
+ : "=r" (virtual_timer_value ));
15
19
return virtual_timer_value ;
16
20
}
17
21
#endif
Original file line number Diff line number Diff line change @@ -10,14 +10,15 @@ unsafe fn cpucounter() -> u64 {
10
10
( high << 32 ) | low
11
11
}
12
12
13
-
14
13
// https://github.com/google/benchmark/blob/v1.1.0/src/cycleclock.h#L116
15
14
#[ cfg( asm) ]
16
15
#[ inline]
17
16
#[ cfg( any( target_arch = "aarch64" ) ) ]
18
17
unsafe fn cpucounter ( ) -> u64 {
19
18
let ( vtm) : ( u64 ) ;
20
- asm ! ( "mrs %0, cntvct_el0" : "=r" ( vtm) ) ;
19
+ //asm!("mrs %0, cntvct_el0" : "=r"(vtm));
20
+ //asm!("mrs %0, cntvct_el0", out(reg) vtm);
21
+ asm ! ( "nop" ) ;
21
22
vtm
22
23
}
23
24
You can’t perform that action at this time.
0 commit comments