build/stlport/src/sparc_atomic.s

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 .section ".text",#alloc,#execinstr
michael@0 2 .align 8
michael@0 3 .skip 16
michael@0 4
michael@0 5
michael@0 6 /*
michael@0 7 ** int _STLP_atomic_exchange (void *pvalue, int value)
michael@0 8 */
michael@0 9
michael@0 10 .type _STLP_atomic_exchange,#function
michael@0 11 .global _STLP_atomic_exchange
michael@0 12 .align 8
michael@0 13
michael@0 14 _STLP_atomic_exchange:
michael@0 15 0:
michael@0 16 ld [%o0], %o2 ! Set the current value
michael@0 17 mov %o1, %o3 ! Set the new value
michael@0 18 ! swap [%o0], %o3 ! Do the compare and swap
michael@0 19 cas [%o0], %o2, %o3
michael@0 20 cmp %o2, %o3 ! Check whether successful
michael@0 21 bne 0b ! Retry upon failure
michael@0 22 stbar
michael@0 23 mov %o2, %o0 ! Set the new value
michael@0 24 retl ! return
michael@0 25 nop
michael@0 26 .size _STLP_atomic_exchange,(.-_STLP_atomic_exchange)
michael@0 27
michael@0 28 /* int _STLP_atomic_increment (void *pvalue) */
michael@0 29
michael@0 30 .type _STLP_atomic_increment,#function
michael@0 31 .global _STLP_atomic_increment
michael@0 32 .align 8
michael@0 33 _STLP_atomic_increment:
michael@0 34 1:
michael@0 35 ld [%o0], %o2 ! set the current
michael@0 36 add %o2, 0x1, %o3 ! Increment and store current
michael@0 37 ! swap [%o0], %o3 ! Do the compare and swap
michael@0 38 cas [%o0], %o2, %o3
michael@0 39 cmp %o3, %o2 ! Check whether successful
michael@0 40 bne 1b ! Retry if we failed.
michael@0 41 membar #LoadLoad | #LoadStore ! Ensure the cas finishes before
michael@0 42 ! returning
michael@0 43 nop
michael@0 44 retl ! return
michael@0 45 nop
michael@0 46
michael@0 47 .size _STLP_atomic_increment,(.-_STLP_atomic_increment)
michael@0 48
michael@0 49
michael@0 50 /* int _STLP_atomic_decrement (void *pvalue) */
michael@0 51 .type _STLP_atomic_decrement,#function
michael@0 52 .global _STLP_atomic_decrement
michael@0 53 .align 8
michael@0 54
michael@0 55 _STLP_atomic_decrement:
michael@0 56 2:
michael@0 57 ld [%o0], %o2 ! set the current
michael@0 58 sub %o2, 0x1, %o3 ! decrement and store current
michael@0 59 ! swap [%o0], %o3 ! Do the compare and swap
michael@0 60 cas [%o0], %o2, %o3
michael@0 61 cmp %o3, %o2 ! Check whether successful
michael@0 62 bne 2b ! Retry if we failed.
michael@0 63 membar #LoadLoad | #LoadStore ! Ensure the cas finishes before
michael@0 64 nop
michael@0 65 ! returning
michael@0 66 retl ! return
michael@0 67 nop
michael@0 68 .size _STLP_atomic_decrement,(.-_STLP_atomic_decrement)

mercurial