/home/ntakagi/work/STLport-5.1.5/src/sparc_atomic64.s

Go to the documentation of this file.
00001         .section        ".text",#alloc,#execinstr
00002         .align 8
00003         .skip 16
00004 
00005 !  int _STLP_atomic_exchange (void *pvalue, int value)
00006 !
00007 
00008         .type   _STLP_atomic_exchange,#function
00009         .global _STLP_atomic_exchange
00010         .align  8
00011 
00012 _STLP_atomic_exchange:
00013 1:
00014   ldx      [%o0], %o2              ! Set the current value
00015         mov      %o1, %o3                ! Set the new value
00016         casx     [%o0], %o2, %o3         ! Do the compare and swap
00017         cmp      %o2, %o3                ! Check whether successful
00018         bne      1b                  ! Retry upon failure
00019         membar  #LoadLoad | #LoadStore  ! Ensure the cas finishes before
00020                                         ! returning
00021         retl                            ! return
00022         mov     %o2, %o0                                ! Set the new value
00023         .size   _STLP_atomic_exchange,(.-_STLP_atomic_exchange)
00024 
00025 
00026 ! int _STLP_atomic_increment (void *pvalue)
00027 
00028         .type   _STLP_atomic_increment,#function
00029         .global _STLP_atomic_increment
00030         .align  8
00031 _STLP_atomic_increment:
00032 0:
00033         ldx      [%o0], %o2              ! set the current
00034         addx     %o2, 0x1, %o3                   ! Increment and store current
00035         casx     [%o0], %o2, %o3         ! Do the compare and swap
00036         cmp     %o3, %o2                ! Check whether successful
00037         bne     0b
00038         membar  #LoadLoad | #LoadStore  ! Ensure the cas finishes before
00039                                         ! returning
00040         retl                            ! return
00041         mov    %o1, %o0                                 ! Set the return value
00042 
00043         .size   _STLP_atomic_increment,(.-_STLP_atomic_increment)
00044 
00045 
00046 !        /* int _STLP_atomic_decrement (void *pvalue) */
00047         .type   _STLP_atomic_decrement,#function
00048         .global _STLP_atomic_decrement
00049         .align  8
00050 
00051 _STLP_atomic_decrement:
00052 0:
00053         ldx      [%o0], %o2              ! set the current
00054         subx             %o2, 0x1, %o3                   ! decrement and store current
00055         casx     [%o0], %o2, %o3         ! Do the compare and swap
00056         cmp     %o3, %o2                ! Check whether successful
00057         bne     0b
00058         membar  #LoadLoad | #LoadStore  ! Ensure the cas finishes before
00059                                         ! returning
00060         retl                            ! return
00061   nop
00062         .size   _STLP_atomic_decrement,(.-_STLP_atomic_decrement)
00063 
00064 
00065 



Generated on Mon Mar 10 15:32:17 2008 by  doxygen 1.5.1