|
1 // -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- |
|
2 // |
|
3 // This Source Code Form is subject to the terms of the Mozilla Public |
|
4 // License, v. 2.0. If a copy of the MPL was not distributed with this |
|
5 // file, You can obtain one at http://mozilla.org/MPL/2.0/. |
|
6 |
|
7 .text |
|
8 |
|
9 // PRInt32 _PR_ia64_AtomicIncrement(PRInt32 *val) |
|
10 // |
|
11 // Atomically increment the integer pointed to by 'val' and return |
|
12 // the result of the increment. |
|
13 // |
|
14 .align 16 |
|
15 .global _PR_ia64_AtomicIncrement# |
|
16 .proc _PR_ia64_AtomicIncrement# |
|
17 _PR_ia64_AtomicIncrement: |
|
18 fetchadd4.acq r8 = [r32], 1 ;; |
|
19 adds r8 = 1, r8 |
|
20 br.ret.sptk.many b0 |
|
21 .endp _PR_ia64_AtomicIncrement# |
|
22 |
|
23 // PRInt32 _PR_ia64_AtomicDecrement(PRInt32 *val) |
|
24 // |
|
25 // Atomically decrement the integer pointed to by 'val' and return |
|
26 // the result of the decrement. |
|
27 // |
|
28 .align 16 |
|
29 .global _PR_ia64_AtomicDecrement# |
|
30 .proc _PR_ia64_AtomicDecrement# |
|
31 _PR_ia64_AtomicDecrement: |
|
32 fetchadd4.rel r8 = [r32], -1 ;; |
|
33 adds r8 = -1, r8 |
|
34 br.ret.sptk.many b0 |
|
35 .endp _PR_ia64_AtomicDecrement# |
|
36 |
|
37 // PRInt32 _PR_ia64_AtomicAdd(PRInt32 *ptr, PRInt32 val) |
|
38 // |
|
39 // Atomically add 'val' to the integer pointed to by 'ptr' |
|
40 // and return the result of the addition. |
|
41 // |
|
42 .align 16 |
|
43 .global _PR_ia64_AtomicAdd# |
|
44 .proc _PR_ia64_AtomicAdd# |
|
45 _PR_ia64_AtomicAdd: |
|
46 ld4 r15 = [r32] ;; |
|
47 .L3: |
|
48 mov r14 = r15 |
|
49 mov ar.ccv = r15 |
|
50 add r8 = r15, r33 ;; |
|
51 cmpxchg4.acq r15 = [r32], r8, ar.ccv ;; |
|
52 cmp4.ne p6, p7 = r15, r14 |
|
53 (p6) br.cond.dptk .L3 |
|
54 br.ret.sptk.many b0 |
|
55 .endp _PR_ia64_AtomicAdd# |
|
56 |
|
57 // PRInt32 _PR_ia64_AtomicSet(PRInt32 *val, PRInt32 newval) |
|
58 // |
|
59 // Atomically set the integer pointed to by 'val' to the new |
|
60 // value 'newval' and return the old value. |
|
61 // |
|
62 .align 16 |
|
63 .global _PR_ia64_AtomicSet# |
|
64 .proc _PR_ia64_AtomicSet# |
|
65 _PR_ia64_AtomicSet: |
|
66 xchg4 r8 = [r32], r33 |
|
67 br.ret.sptk.many b0 |
|
68 .endp _PR_ia64_AtomicSet# |
|
69 |
|
70 // Magic indicating no need for an executable stack |
|
71 .section .note.GNU-stack, "", @progbits ; .previous |