Update contrib.
1 .section ".text",#alloc,#execinstr
5 ! int _STLP_atomic_exchange (void *pvalue, int value)
8 .type _STLP_atomic_exchange,#function
9 .global _STLP_atomic_exchange
12 _STLP_atomic_exchange:
14 ldx [%o0], %o2 ! Set the current value
15 mov %o1, %o3 ! Set the new value
16 casx [%o0], %o2, %o3 ! Do the compare and swap
17 cmp %o2, %o3 ! Check whether successful
18 bne 1b ! Retry upon failure
19 membar #LoadLoad | #LoadStore ! Ensure the cas finishes before
22 mov %o2, %o0 ! Set the new value
23 .size _STLP_atomic_exchange,(.-_STLP_atomic_exchange)
26 ! int _STLP_atomic_increment (void *pvalue)
28 .type _STLP_atomic_increment,#function
29 .global _STLP_atomic_increment
31 _STLP_atomic_increment:
33 ldx [%o0], %o2 ! set the current
34 addx %o2, 0x1, %o3 ! Increment and store current
35 casx [%o0], %o2, %o3 ! Do the compare and swap
36 cmp %o3, %o2 ! Check whether successful
38 membar #LoadLoad | #LoadStore ! Ensure the cas finishes before
41 mov %o1, %o0 ! Set the return value
43 .size _STLP_atomic_increment,(.-_STLP_atomic_increment)
46 ! /* int _STLP_atomic_decrement (void *pvalue) */
47 .type _STLP_atomic_decrement,#function
48 .global _STLP_atomic_decrement
51 _STLP_atomic_decrement:
53 ldx [%o0], %o2 ! set the current
54 subx %o2, 0x1, %o3 ! decrement and store current
55 casx [%o0], %o2, %o3 ! Do the compare and swap
56 cmp %o3, %o2 ! Check whether successful
58 membar #LoadLoad | #LoadStore ! Ensure the cas finishes before
62 .size _STLP_atomic_decrement,(.-_STLP_atomic_decrement)