@@ -9182,50 +9182,6 @@ FORCE_INLINE void _sse2neon_mm_set_denormals_zero_mode(unsigned int flag)
91829182}
91839183#endif
91849184
9185- // Return the current 64-bit value of the processor's time-stamp counter.
9186- // https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=rdtsc
9187- FORCE_INLINE uint64_t _rdtsc (void )
9188- {
9189- #if defined(__aarch64__ ) || defined(_M_ARM64 )
9190- uint64_t val ;
9191-
9192- /* According to ARM DDI 0487F.c, from Armv8.0 to Armv8.5 inclusive, the
9193- * system counter is at least 56 bits wide; from Armv8.6, the counter
9194- * must be 64 bits wide. So the system counter could be less than 64
9195- * bits wide and it is attributed with the flag 'cap_user_time_short'
9196- * is true.
9197- */
9198- #if defined(_MSC_VER )
9199- val = _ReadStatusReg (ARM64_SYSREG (3 , 3 , 14 , 0 , 2 ));
9200- #else
9201- __asm__ __volatile__("mrs %0, cntvct_el0" : "=r" (val ));
9202- #endif
9203-
9204- return val ;
9205- #elif defined(_M_ARM )
9206- uint32_t val = _MoveFromCoprocessor (15 ,0 , 9 ,13 ,0 );
9207- return ((uint64_t )val ) << 6 ;
9208- #else
9209- uint32_t pmccntr , pmuseren , pmcntenset ;
9210- // Read the user mode Performance Monitoring Unit (PMU)
9211- // User Enable Register (PMUSERENR) access permissions.
9212- __asm__ __volatile__("mrc p15, 0, %0, c9, c14, 0" : "=r" (pmuseren ));
9213- if (pmuseren & 1 ) { // Allows reading PMUSERENR for user mode code.
9214- __asm__ __volatile__("mrc p15, 0, %0, c9, c12, 1" : "=r" (pmcntenset ));
9215- if (pmcntenset & 0x80000000UL ) { // Is it counting?
9216- __asm__ __volatile__("mrc p15, 0, %0, c9, c13, 0" : "=r" (pmccntr ));
9217- // The counter is set up to count every 64th cycle
9218- return (uint64_t ) (pmccntr ) << 6 ;
9219- }
9220- }
9221-
9222- // Fallback to syscall as we can't enable PMUSERENR in user mode.
9223- struct timeval tv ;
9224- gettimeofday (& tv , NULL );
9225- return (uint64_t ) (tv .tv_sec ) * 1000000 + tv .tv_usec ;
9226- #endif
9227- }
9228-
92299185#if defined(__GNUC__ ) || defined(__clang__ )
92309186#pragma pop_macro("ALIGN_STRUCT")
92319187#pragma pop_macro("FORCE_INLINE")
0 commit comments