PAPI 7.1.0.0
Loading...
Searching...
No Matches
msftc/arm.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2003 Hewlett-Packard Development Company, L.P.
3 * Copyright (c) 2009-2021 Ivan Maidanski
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining a copy
6 * of this software and associated documentation files (the "Software"), to deal
7 * in the Software without restriction, including without limitation the rights
8 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 * copies of the Software, and to permit persons to whom the Software is
10 * furnished to do so, subject to the following conditions:
11 *
12 * The above copyright notice and this permission notice shall be included in
13 * all copies or substantial portions of the Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 * SOFTWARE.
22 */
23
24/* Some ARM slide set, if it has been read correctly, claims that Loads */
25/* followed by either a Load or a Store are ordered, but nothing else. */
26/* It is assumed that Windows interrupt handlers clear the LL/SC flag. */
27/* Unaligned accesses are not guaranteed to be atomic. */
28#include "../all_aligned_atomic_load_store.h"
29
30#define AO_T_IS_INT
31
32#ifndef AO_ASSUME_WINDOWS98
33 /* CAS is always available */
34# define AO_ASSUME_WINDOWS98
35#endif
36#include "common32_defs.h"
37
38/* If only a single processor is used, we can define AO_UNIPROCESSOR. */
39#ifdef AO_UNIPROCESSOR
40 AO_INLINE void AO_nop_full(void)
41 {
43 }
44# define AO_HAVE_nop_full
45#else
46 /* AO_nop_full() is emulated using AO_test_and_set_full(). */
47#endif
48
49#ifndef AO_HAVE_test_and_set_full
50# include "../test_and_set_t_is_ao_t.h"
51 /* AO_test_and_set_full() is emulated. */
52#endif
53
54#if _M_ARM >= 7 && !defined(AO_NO_DOUBLE_CAS)
55
56# include "../standard_ao_double_t.h"
57
58/* These intrinsics are supposed to use LDREXD/STREXD. */
59# pragma intrinsic (_InterlockedCompareExchange64)
60# pragma intrinsic (_InterlockedCompareExchange64_acq)
61# pragma intrinsic (_InterlockedCompareExchange64_nf)
62# pragma intrinsic (_InterlockedCompareExchange64_rel)
63
64 AO_INLINE int
66 AO_double_t old_val, AO_double_t new_val)
67 {
69 return (double_ptr_storage)_InterlockedCompareExchange64_nf(
70 (__int64 volatile *)addr,
71 new_val.AO_whole /* exchange */,
72 old_val.AO_whole) == old_val.AO_whole;
73 }
74# define AO_HAVE_double_compare_and_swap
75
76 AO_INLINE int
78 AO_double_t old_val, AO_double_t new_val)
79 {
81 return (double_ptr_storage)_InterlockedCompareExchange64_acq(
82 (__int64 volatile *)addr,
83 new_val.AO_whole /* exchange */,
84 old_val.AO_whole) == old_val.AO_whole;
85 }
86# define AO_HAVE_double_compare_and_swap_acquire
87
88 AO_INLINE int
90 AO_double_t old_val, AO_double_t new_val)
91 {
93 return (double_ptr_storage)_InterlockedCompareExchange64_rel(
94 (__int64 volatile *)addr,
95 new_val.AO_whole /* exchange */,
96 old_val.AO_whole) == old_val.AO_whole;
97 }
98# define AO_HAVE_double_compare_and_swap_release
99
100 AO_INLINE int
102 AO_double_t old_val, AO_double_t new_val)
103 {
105 return (double_ptr_storage)_InterlockedCompareExchange64(
106 (__int64 volatile *)addr,
107 new_val.AO_whole /* exchange */,
108 old_val.AO_whole) == old_val.AO_whole;
109 }
110# define AO_HAVE_double_compare_and_swap_full
111
112#endif /* _M_ARM >= 7 && !AO_NO_DOUBLE_CAS */
AO_INLINE int AO_double_compare_and_swap(volatile AO_double_t *addr, AO_double_t old_val, AO_double_t new_val)
Definition: aarch64.h:141
AO_INLINE int AO_double_compare_and_swap_release(volatile AO_double_t *addr, AO_double_t old_val, AO_double_t new_val)
Definition: aarch64.h:203
AO_INLINE int AO_double_compare_and_swap_acquire(volatile AO_double_t *addr, AO_double_t old_val, AO_double_t new_val)
Definition: aarch64.h:172
AO_INLINE int AO_double_compare_and_swap_full(volatile AO_double_t *addr, AO_double_t old_val, AO_double_t new_val)
Definition: aarch64.h:234
AO_INLINE void AO_nop_full(void)
Definition: alpha.h:27
#define AO_ASSERT_ADDR_ALIGNED(addr)
Definition: atomic_ops.h:266
#define AO_compiler_barrier()
Definition: atomic_ops.h:305
#define AO_INLINE
Definition: atomic_ops.h:186
unsigned long long double_ptr_storage
double_ptr_storage AO_whole