os_HPUX_ia64.s (2259B)
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 #ifndef _LP64 19 addp4 r32 = 0, r32 ;; 20 #endif 21 fetchadd4.acq r8 = [r32], 1 ;; 22 adds r8 = 1, r8 23 br.ret.sptk.many b0 24 .endp _PR_ia64_AtomicIncrement# 25 26 // PRInt32 _PR_ia64_AtomicDecrement(PRInt32 *val) 27 // 28 // Atomically decrement the integer pointed to by 'val' and return 29 // the result of the decrement. 30 // 31 .align 16 32 .global _PR_ia64_AtomicDecrement# 33 .proc _PR_ia64_AtomicDecrement# 34 _PR_ia64_AtomicDecrement: 35 #ifndef _LP64 36 addp4 r32 = 0, r32 ;; 37 #endif 38 fetchadd4.rel r8 = [r32], -1 ;; 39 adds r8 = -1, r8 40 br.ret.sptk.many b0 41 .endp _PR_ia64_AtomicDecrement# 42 43 // PRInt32 _PR_ia64_AtomicAdd(PRInt32 *ptr, PRInt32 val) 44 // 45 // Atomically add 'val' to the integer pointed to by 'ptr' 46 // and return the result of the addition. 47 // 48 .align 16 49 .global _PR_ia64_AtomicAdd# 50 .proc _PR_ia64_AtomicAdd# 51 _PR_ia64_AtomicAdd: 52 #ifndef _LP64 53 addp4 r32 = 0, r32 ;; 54 #endif 55 ld4 r15 = [r32] ;; 56 .L3: 57 mov r14 = r15 58 mov ar.ccv = r15 59 add r8 = r15, r33 ;; 60 cmpxchg4.acq r15 = [r32], r8, ar.ccv ;; 61 cmp4.ne p6, p7 = r15, r14 62 (p6) br.cond.dptk .L3 63 br.ret.sptk.many b0 64 .endp _PR_ia64_AtomicAdd# 65 66 // PRInt32 _PR_ia64_AtomicSet(PRInt32 *val, PRInt32 newval) 67 // 68 // Atomically set the integer pointed to by 'val' to the new 69 // value 'newval' and return the old value. 70 // 71 .align 16 72 .global _PR_ia64_AtomicSet# 73 .proc _PR_ia64_AtomicSet# 74 _PR_ia64_AtomicSet: 75 #ifndef _LP64 76 addp4 r32 = 0, r32 ;; 77 #endif 78 xchg4 r8 = [r32], r33 79 br.ret.sptk.many b0 80 .endp _PR_ia64_AtomicSet#