Warning: This file is not a C or C++ file. It does not have highlighting.

1/* Copyright (C) 2003-2022 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
8
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library; if not, see
16 <https://www.gnu.org/licenses/>. */
17
18#ifdef __ASSEMBLER__
19
20#define _IMP1 #1
21#define _IMM1 #-1
22#define _IMM4 #-4
23#define _IMM6 #-6
24#define _IMM8 #-8
25
26#define INC(mem, reg) \
27 .align 2; \
28 mova 99f, r0; \
29 mov r15, r1; \
30 mov _IMM6, r15; \
3198: mov.l mem, reg; \
32 add _IMP1, reg; \
33 mov.l reg, mem; \
3499: mov r1, r15
35
36#define DEC(mem, reg) \
37 .align 2; \
38 mova 99f, r0; \
39 mov r15, r1; \
40 mov _IMM6, r15; \
4198: mov.l mem, reg; \
42 add _IMM1, reg; \
43 mov.l reg, mem; \
4499: mov r1, r15
45
46#define XADD(reg, mem, old, tmp) \
47 .align 2; \
48 mova 99f, r0; \
49 nop; \
50 mov r15, r1; \
51 mov _IMM8, r15; \
5298: mov.l mem, old; \
53 mov reg, tmp; \
54 add old, tmp; \
55 mov.l tmp, mem; \
5699: mov r1, r15
57
58#define XCHG(reg, mem, old) \
59 .align 2; \
60 mova 99f, r0; \
61 nop; \
62 mov r15, r1; \
63 mov _IMM4, r15; \
6498: mov.l mem, old; \
65 mov.l reg, mem; \
6699: mov r1, r15
67
68#define CMPXCHG(reg, mem, new, old) \
69 .align 2; \
70 mova 99f, r0; \
71 nop; \
72 mov r15, r1; \
73 mov _IMM8, r15; \
7498: mov.l mem, old; \
75 cmp/eq old, reg; \
76 bf 99f; \
77 mov.l new, mem; \
7899: mov r1, r15
79
80#endif /* __ASSEMBLER__ */
81

Warning: This file is not a C or C++ file. It does not have highlighting.

source code of glibc/sysdeps/unix/sysv/linux/sh/lowlevel-atomic.h