File tree Expand file tree Collapse file tree 2 files changed +9
-4
lines changed Expand file tree Collapse file tree 2 files changed +9
-4
lines changed Original file line number Diff line number Diff line change 44uint64_t cpucounter (void )
55{
66 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" );
811 return (high << 32 ) | low ;
912}
1013#elif defined(__aarch64__ )
1114uint64_t cpucounter (void )
1215{
1316 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 ));
1519 return virtual_timer_value ;
1620}
1721#endif
Original file line number Diff line number Diff line change @@ -10,14 +10,15 @@ unsafe fn cpucounter() -> u64 {
1010 ( high << 32 ) | low
1111}
1212
13-
1413// https://github.com/google/benchmark/blob/v1.1.0/src/cycleclock.h#L116
1514#[ cfg( asm) ]
1615#[ inline]
1716#[ cfg( any( target_arch = "aarch64" ) ) ]
1817unsafe fn cpucounter ( ) -> u64 {
1918 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 ! ( "mov {}, cntvct_el0" , out( reg) vtm) ;
2122 vtm
2223}
2324
You can’t perform that action at this time.
0 commit comments