Ignore:
Timestamp:
Jan 7, 2021, 2:55:57 PM (5 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
58fe85a
Parents:
bdfc032 (diff), 44e37ef (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' into dkobets-vector

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/bits/defs.hfa

    rbdfc032 reef8dfb  
    1010// Created On       : Thu Nov  9 13:24:10 2017
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Jan 28 22:38:27 2020
    13 // Update Count     : 9
     12// Last Modified On : Sat Oct 24 10:53:15 2020
     13// Update Count     : 21
    1414//
    1515
    1616#pragma once
    1717
    18 #include <stdbool.h>
    19 #include <stddef.h>
    2018#include <stdint.h>
     19#include <assert.h>
    2120
    2221#define likely(x)   __builtin_expect(!!(x), 1)
     
    3029#define __cfa_anonymous_object(x) inline struct x
    3130#else
    32 #define __cfa_anonymous_object(x) x __cfa_anonymous_object
     31#define __cfa_anonymous_object(x) struct x __cfa_anonymous_object
    3332#endif
    3433
     
    4948#endif
    5049
    51 static inline long long rdtscl(void) {
    52     unsigned int lo, hi;
    53     __asm__ __volatile__ ("rdtsc" : "=a"(lo), "=d"(hi));
    54     return ( (unsigned long long)lo)|( ((unsigned long long)hi)<<32 );
     50static inline long long int rdtscl(void) {
     51        #if defined( __i386 ) || defined( __x86_64 )
     52        unsigned int lo, hi;
     53        __asm__ __volatile__ ("rdtsc" : "=a"(lo), "=d"(hi));
     54        return ( (unsigned long long)lo)|( ((unsigned long long)hi)<<32 );
     55        #elif defined( __aarch64__ ) || defined( __arm__ )
     56        // https://github.com/google/benchmark/blob/v1.1.0/src/cycleclock.h#L116
     57        long long int virtual_timer_value;
     58        asm volatile("mrs %0, cntvct_el0" : "=r"(virtual_timer_value));
     59        return virtual_timer_value;
     60        #else
     61                #error unsupported hardware architecture
     62        #endif
    5563}
Note: See TracChangeset for help on using the changeset viewer.