...
Run Format

Text file src/sync/atomic/asm_mips64x.s

Documentation: sync/atomic

     1	// Copyright 2015 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	// +build mips64 mips64le
     6	
     7	#include "textflag.h"
     8	
     9	TEXT ·SwapInt32(SB),NOSPLIT,$0-20
    10		JMP	·SwapUint32(SB)
    11	
    12	TEXT ·SwapUint32(SB),NOSPLIT,$0-20
    13		MOVV	addr+0(FP), R2
    14		MOVW	new+8(FP), R5
    15		SYNC
    16		MOVV	R5, R3
    17		LL	(R2), R1
    18		SC	R3, (R2)
    19		BEQ	R3, -3(PC)
    20		MOVW	R1, old+16(FP)
    21		SYNC
    22		RET
    23	
    24	TEXT ·SwapInt64(SB),NOSPLIT,$0-24
    25		JMP	·SwapUint64(SB)
    26	
    27	TEXT ·SwapUint64(SB),NOSPLIT,$0-24
    28		MOVV	addr+0(FP), R2
    29		MOVV	new+8(FP), R5
    30		SYNC
    31		MOVV	R5, R3
    32		LLV	(R2), R1
    33		SCV	R3, (R2)
    34		BEQ	R3, -3(PC)
    35		MOVV	R1, old+16(FP)
    36		SYNC
    37		RET
    38	
    39	TEXT ·SwapUintptr(SB),NOSPLIT,$0-24
    40		JMP	·SwapUint64(SB)
    41	
    42	TEXT ·CompareAndSwapInt32(SB),NOSPLIT,$0-17
    43		JMP	·CompareAndSwapUint32(SB)
    44	
    45	TEXT ·CompareAndSwapUint32(SB),NOSPLIT,$0-17
    46		MOVV	addr+0(FP), R1
    47		MOVW	old+8(FP), R2
    48		MOVW	new+12(FP), R5
    49		SYNC
    50	cas_again:
    51		MOVV	R5, R3
    52		LL	(R1), R4
    53		BNE	R2, R4, cas_fail
    54		SC	R3, (R1)
    55		BEQ	R3, cas_again
    56		MOVV	$1, R1
    57		MOVB	R1, swapped+16(FP)
    58		SYNC
    59		RET
    60	cas_fail:
    61		MOVV	$0, R1
    62		JMP	-4(PC)
    63	
    64	TEXT ·CompareAndSwapUintptr(SB),NOSPLIT,$0-25
    65		JMP	·CompareAndSwapUint64(SB)
    66	
    67	TEXT ·CompareAndSwapInt64(SB),NOSPLIT,$0-25
    68		JMP	·CompareAndSwapUint64(SB)
    69	
    70	TEXT ·CompareAndSwapUint64(SB),NOSPLIT,$0-25
    71		MOVV	addr+0(FP), R1
    72		MOVV	old+8(FP), R2
    73		MOVV	new+16(FP), R5
    74		SYNC
    75	cas64_again:
    76		MOVV	R5, R3
    77		LLV	(R1), R4
    78		BNE	R2, R4, cas64_fail
    79		SCV	R3, (R1)
    80		BEQ	R3, cas64_again
    81		MOVV	$1, R1
    82		MOVB	R1, swapped+24(FP)
    83		SYNC
    84		RET
    85	cas64_fail:
    86		MOVV	$0, R1
    87		JMP	-4(PC)
    88	
    89	TEXT ·AddInt32(SB),NOSPLIT,$0-20
    90		JMP	·AddUint32(SB)
    91	
    92	TEXT ·AddUint32(SB),NOSPLIT,$0-20
    93		MOVV	addr+0(FP), R2
    94		MOVW	delta+8(FP), R3
    95		SYNC
    96		LL	(R2), R1
    97		ADDU	R1, R3, R4
    98		MOVV	R4, R1
    99		SC	R4, (R2)
   100		BEQ	R4, -4(PC)
   101		MOVW	R1, new+16(FP)
   102		SYNC
   103		RET
   104	
   105	TEXT ·AddUintptr(SB),NOSPLIT,$0-24
   106		JMP	·AddUint64(SB)
   107	
   108	TEXT ·AddInt64(SB),NOSPLIT,$0-24
   109		JMP	·AddUint64(SB)
   110	
   111	TEXT ·AddUint64(SB),NOSPLIT,$0-24
   112		MOVV	addr+0(FP), R2
   113		MOVV	delta+8(FP), R3
   114		SYNC
   115		LLV	(R2), R1
   116		ADDVU	R1, R3, R4
   117		MOVV	R4, R1
   118		SCV	R4, (R2)
   119		BEQ	R4, -4(PC)
   120		MOVV	R1, new+16(FP)
   121		SYNC
   122		RET
   123	
   124	TEXT ·LoadInt32(SB),NOSPLIT,$0-12
   125		JMP	·LoadUint32(SB)
   126	
   127	TEXT ·LoadUint32(SB),NOSPLIT,$0-12
   128		MOVV	addr+0(FP), R1
   129		SYNC
   130		MOVWU	0(R1), R1
   131		SYNC
   132		MOVW	R1, val+8(FP)
   133		RET
   134	
   135	TEXT ·LoadInt64(SB),NOSPLIT,$0-16
   136		JMP	·LoadUint64(SB)
   137	
   138	TEXT ·LoadUint64(SB),NOSPLIT,$0-16
   139		MOVV	addr+0(FP), R1
   140		SYNC
   141		MOVV	0(R1), R1
   142		SYNC
   143		MOVV	R1, val+8(FP)
   144		RET
   145	
   146	TEXT ·LoadUintptr(SB),NOSPLIT,$0-16
   147		JMP	·LoadPointer(SB)
   148	
   149	TEXT ·LoadPointer(SB),NOSPLIT,$0-16
   150		JMP	·LoadUint64(SB)
   151	
   152	TEXT ·StoreInt32(SB),NOSPLIT,$0-12
   153		JMP	·StoreUint32(SB)
   154	
   155	TEXT ·StoreUint32(SB),NOSPLIT,$0-12
   156		MOVV	addr+0(FP), R1
   157		MOVW	val+8(FP), R2
   158		SYNC
   159		MOVW	R2, 0(R1)
   160		SYNC
   161		RET
   162	
   163	TEXT ·StoreInt64(SB),NOSPLIT,$0-16
   164		JMP	·StoreUint64(SB)
   165	
   166	TEXT ·StoreUint64(SB),NOSPLIT,$0-16
   167		MOVV	addr+0(FP), R1
   168		MOVV	val+8(FP), R2
   169		SYNC
   170		MOVV	R2, 0(R1)
   171		SYNC
   172		RET
   173	
   174	TEXT ·StoreUintptr(SB),NOSPLIT,$0-16
   175		JMP	·StoreUint64(SB)

View as plain text