File: sparc_atomic64.s

package info (click to toggle)
stlport4.6 4.6.2-3
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 7,048 kB
  • ctags: 16,390
  • sloc: ansic: 46,190; cpp: 18,805; sh: 266; asm: 93; perl: 58; makefile: 8
file content (65 lines) | stat: -rw-r--r-- 2,437 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
        .section        ".text",#alloc,#execinstr
        .align 8
        .skip 16

!  int _STLP_atomic_exchange (void *pvalue, int value)
!

        .type   _STLP_atomic_exchange,#function
        .global _STLP_atomic_exchange
        .align  8

_STLP_atomic_exchange:
1:	
	ldx      [%o0], %o2              ! Set the current value
        mov      %o1, %o3                ! Set the new value
        casx     [%o0], %o2, %o3         ! Do the compare and swap
        cmp      %o2, %o3                ! Check whether successful
        bne      1b                  ! Retry upon failure
        membar  #LoadLoad | #LoadStore  ! Ensure the cas finishes before
                                        ! returning
        retl                            ! return
        mov     %o2, %o0                                ! Set the new value
        .size   _STLP_atomic_exchange,(.-_STLP_atomic_exchange)

	
! int _STLP_atomic_increment (void *pvalue)

        .type   _STLP_atomic_increment,#function
        .global _STLP_atomic_increment
        .align  8
_STLP_atomic_increment:
0:	
        ldx      [%o0], %o2              ! set the current
        addx     %o2, 0x1, %o3                   ! Increment and store current
        casx     [%o0], %o2, %o3         ! Do the compare and swap
        cmp     %o3, %o2                ! Check whether successful
        bne     0b
        membar  #LoadLoad | #LoadStore  ! Ensure the cas finishes before
                                        ! returning
        retl                            ! return
        mov    %o1, %o0                                 ! Set the return value

        .size   _STLP_atomic_increment,(.-_STLP_atomic_increment)

	
!        /* int _STLP_atomic_decrement (void *pvalue) */
        .type   _STLP_atomic_decrement,#function
        .global _STLP_atomic_decrement
        .align  8

_STLP_atomic_decrement:
0:	
        ldx      [%o0], %o2              ! set the current
        subx             %o2, 0x1, %o3                   ! decrement and store current
        casx     [%o0], %o2, %o3         ! Do the compare and swap
        cmp     %o3, %o2                ! Check whether successful
        bne     0b
        membar  #LoadLoad | #LoadStore  ! Ensure the cas finishes before
                                        ! returning
        retl                            ! return
	nop
        .size   _STLP_atomic_decrement,(.-_STLP_atomic_decrement)