github.com/golang-haiku/go-1.4.3@v0.0.0-20190609233734-1f5ae41cc308/src/sync/atomic/asm_netbsd_arm.s (about)

     1  // Copyright 2013 The Go Authors.  All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  #include "textflag.h"
     6  
     7  // NetBSD/ARM atomic operations.
     8  // TODO(minux): this only supports ARMv6K or higher.
     9  
    10  TEXT ·CompareAndSwapInt32(SB),NOSPLIT,$0
    11  	B ·CompareAndSwapUint32(SB)
    12  
    13  TEXT ·CompareAndSwapUint32(SB),NOSPLIT,$0
    14  	B ·armCompareAndSwapUint32(SB)
    15  
    16  TEXT ·CompareAndSwapUintptr(SB),NOSPLIT,$0
    17  	B ·CompareAndSwapUint32(SB)
    18  
    19  TEXT ·CompareAndSwapPointer(SB),NOSPLIT,$0
    20  	B ·CompareAndSwapUint32(SB)
    21  
    22  TEXT ·AddInt32(SB),NOSPLIT,$0
    23  	B ·AddUint32(SB)
    24  
    25  TEXT ·AddUint32(SB),NOSPLIT,$0
    26  	B ·armAddUint32(SB)
    27  
    28  TEXT ·AddUintptr(SB),NOSPLIT,$0
    29  	B ·AddUint32(SB)
    30  
    31  TEXT ·SwapInt32(SB),NOSPLIT,$0
    32  	B ·SwapUint32(SB)
    33  
    34  TEXT ·SwapUint32(SB),NOSPLIT,$0
    35  	B ·armSwapUint32(SB)
    36  
    37  TEXT ·SwapUintptr(SB),NOSPLIT,$0
    38  	B ·SwapUint32(SB)
    39  
    40  TEXT ·SwapPointer(SB),NOSPLIT,$0
    41  	B ·SwapUint32(SB)
    42  
    43  TEXT ·CompareAndSwapInt64(SB),NOSPLIT,$0
    44  	B ·CompareAndSwapUint64(SB)
    45  
    46  TEXT ·CompareAndSwapUint64(SB),NOSPLIT,$-4
    47  	B ·armCompareAndSwapUint64(SB)
    48  
    49  TEXT ·AddInt64(SB),NOSPLIT,$0
    50  	B ·addUint64(SB)
    51  
    52  TEXT ·AddUint64(SB),NOSPLIT,$0
    53  	B ·addUint64(SB)
    54  
    55  TEXT ·SwapInt64(SB),NOSPLIT,$0
    56  	B ·swapUint64(SB)
    57  
    58  TEXT ·SwapUint64(SB),NOSPLIT,$0
    59  	B ·swapUint64(SB)
    60  
    61  TEXT ·LoadInt32(SB),NOSPLIT,$0
    62  	B ·LoadUint32(SB)
    63  
    64  TEXT ·LoadUint32(SB),NOSPLIT,$0-8
    65  	MOVW addr+0(FP), R1
    66  load32loop:
    67  	LDREX (R1), R2		// loads R2
    68  	STREX R2, (R1), R0	// stores R2
    69  	CMP $0, R0
    70  	BNE load32loop
    71  	MOVW R2, val+4(FP)
    72  	RET
    73  
    74  TEXT ·LoadInt64(SB),NOSPLIT,$0
    75  	B ·loadUint64(SB)
    76  
    77  TEXT ·LoadUint64(SB),NOSPLIT,$0
    78  	B ·loadUint64(SB)
    79  
    80  TEXT ·LoadUintptr(SB),NOSPLIT,$0
    81  	B ·LoadUint32(SB)
    82  
    83  TEXT ·LoadPointer(SB),NOSPLIT,$0
    84  	B ·LoadUint32(SB)
    85  
    86  TEXT ·StoreInt32(SB),NOSPLIT,$0
    87  	B ·StoreUint32(SB)
    88  
    89  TEXT ·StoreUint32(SB),NOSPLIT,$0-8
    90  	MOVW addr+0(FP), R1
    91  	MOVW val+4(FP), R2
    92  storeloop:
    93  	LDREX (R1), R4		// loads R4
    94  	STREX R2, (R1), R0	// stores R2
    95  	CMP $0, R0
    96  	BNE storeloop
    97  	RET
    98  
    99  TEXT ·StoreInt64(SB),NOSPLIT,$0
   100  	B ·storeUint64(SB)
   101  
   102  TEXT ·StoreUint64(SB),NOSPLIT,$0
   103  	B ·storeUint64(SB)
   104  
   105  TEXT ·StoreUintptr(SB),NOSPLIT,$0
   106  	B ·StoreUint32(SB)
   107  
   108  TEXT ·StorePointer(SB),NOSPLIT,$0
   109  	B ·StoreUint32(SB)