source: libcfa/src/bits/defs.hfa @ 3d0560d

ADTarm-ehast-experimentalenumforall-pointer-decayjacob/cs343-translationnew-ast-unique-exprpthread-emulationqualifiedEnum
Last change on this file since 3d0560d was c1076a2f, checked in by Peter A. Buhr <pabuhr@…>, 3 years ago

remove preprocessor comment

  • Property mode set to 100644
File size: 1.9 KB
RevLine 
[3d5f2ef1]1//
[ea7d2b0]2// Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo
3//
4// The contents of this file are covered under the licence agreement in the
5// file "LICENCE" distributed with Cforall.
[3d5f2ef1]6//
[73abe95]7// defs.hfa --
[3d5f2ef1]8//
[ea7d2b0]9// Author           : Thierry Delisle
[490d9972]10// Created On       : Thu Nov  9 13:24:10 2017
11// Last Modified By : Peter A. Buhr
[c1076a2f]12// Last Modified On : Sat Oct 24 10:53:15 2020
13// Update Count     : 21
[3d5f2ef1]14//
[ea7d2b0]15
16#pragma once
17
18#include <stdint.h>
[d685cb0]19#include <assert.h>
[ea7d2b0]20
[490d9972]21#define likely(x)   __builtin_expect(!!(x), 1)
22#define unlikely(x) __builtin_expect(!!(x), 0)
[0cf5b79]23#define thread_local _Thread_local
24
25typedef void (*fptr_t)();
26typedef int_fast16_t __lock_size_t;
27
28#ifdef __cforall
[b1672e1]29#define __cfa_anonymous_object(x) inline struct x
[0cf5b79]30#else
[b1672e1]31#define __cfa_anonymous_object(x) x __cfa_anonymous_object
[c2b9f21]32#endif
33
34#ifdef __cforall
[8a13c47]35void abort( const char fmt[], ... ) __attribute__ (( format(printf, 1, 2), __nothrow__, __leaf__, __noreturn__ ));
36void abort( bool signalAbort, const char fmt[], ... ) __attribute__ (( format(printf, 2, 3), __nothrow__, __leaf__, __noreturn__ ));
[c2b9f21]37extern "C" {
38#endif
[169d944]39void __cabi_abort( const char fmt[], ... ) __attribute__ (( format(printf, 1, 2), __nothrow__, __leaf__, __noreturn__ ));
[c2b9f21]40#ifdef __cforall
41}
[490d9972]42#endif
[2026bb6]43
44#if defined(__cforall_thread__)
45#define OPTIONAL_THREAD
46#else
47#define OPTIONAL_THREAD __attribute__((weak))
48#endif
[21184e3]49
[d685cb0]50static inline long long int rdtscl(void) {
[98cf828]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__ )
[d685cb0]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
[98cf828]61                #error unsupported hardware architecture
[c1076a2f]62        #endif
[21184e3]63}
Note: See TracBrowser for help on using the repository browser.