Update contrib.
1 .section ".text",#alloc,#execinstr
7 ** int _STLP_atomic_exchange (void *pvalue, int value)
10 .type _STLP_atomic_exchange,#function
11 .global _STLP_atomic_exchange
14 _STLP_atomic_exchange:
16 ld [%o0], %o2 ! Set the current value
17 mov %o1, %o3 ! Set the new value
18 ! swap [%o0], %o3 ! Do the compare and swap
20 cmp %o2, %o3 ! Check whether successful
21 bne 0b ! Retry upon failure
23 mov %o2, %o0 ! Set the new value
26 .size _STLP_atomic_exchange,(.-_STLP_atomic_exchange)
28 /* int _STLP_atomic_increment (void *pvalue) */
30 .type _STLP_atomic_increment,#function
31 .global _STLP_atomic_increment
33 _STLP_atomic_increment:
35 ld [%o0], %o2 ! set the current
36 add %o2, 0x1, %o3 ! Increment and store current
37 ! swap [%o0], %o3 ! Do the compare and swap
39 cmp %o3, %o2 ! Check whether successful
40 bne 1b ! Retry if we failed.
41 membar #LoadLoad | #LoadStore ! Ensure the cas finishes before
47 .size _STLP_atomic_increment,(.-_STLP_atomic_increment)
50 /* int _STLP_atomic_decrement (void *pvalue) */
51 .type _STLP_atomic_decrement,#function
52 .global _STLP_atomic_decrement
55 _STLP_atomic_decrement:
57 ld [%o0], %o2 ! set the current
58 sub %o2, 0x1, %o3 ! decrement and store current
59 ! swap [%o0], %o3 ! Do the compare and swap
61 cmp %o3, %o2 ! Check whether successful
62 bne 2b ! Retry if we failed.
63 membar #LoadLoad | #LoadStore ! Ensure the cas finishes before
68 .size _STLP_atomic_decrement,(.-_STLP_atomic_decrement)