...
Run Format

Text file src/sync/atomic/asm_amd64.s

Documentation: sync/atomic

     1	// Copyright 2011 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	// Note: some of these functions are semantically inlined
     6	// by the compiler (in src/cmd/compile/internal/gc/ssa.go).
     7	
     8	// +build !race
     9	
    10	#include "textflag.h"
    11	
    12	TEXT ·SwapInt32(SB),NOSPLIT,$0-20
    13		JMP	·SwapUint32(SB)
    14	
    15	TEXT ·SwapUint32(SB),NOSPLIT,$0-20
    16		MOVQ	addr+0(FP), BP
    17		MOVL	new+8(FP), AX
    18		XCHGL	AX, 0(BP)
    19		MOVL	AX, old+16(FP)
    20		RET
    21	
    22	TEXT ·SwapInt64(SB),NOSPLIT,$0-24
    23		JMP	·SwapUint64(SB)
    24	
    25	TEXT ·SwapUint64(SB),NOSPLIT,$0-24
    26		MOVQ	addr+0(FP), BP
    27		MOVQ	new+8(FP), AX
    28		XCHGQ	AX, 0(BP)
    29		MOVQ	AX, old+16(FP)
    30		RET
    31	
    32	TEXT ·SwapUintptr(SB),NOSPLIT,$0-24
    33		JMP	·SwapUint64(SB)
    34	
    35	TEXT ·CompareAndSwapInt32(SB),NOSPLIT,$0-17
    36		JMP	·CompareAndSwapUint32(SB)
    37	
    38	TEXT ·CompareAndSwapUint32(SB),NOSPLIT,$0-17
    39		MOVQ	addr+0(FP), BP
    40		MOVL	old+8(FP), AX
    41		MOVL	new+12(FP), CX
    42		LOCK
    43		CMPXCHGL	CX, 0(BP)
    44		SETEQ	swapped+16(FP)
    45		RET
    46	
    47	TEXT ·CompareAndSwapUintptr(SB),NOSPLIT,$0-25
    48		JMP	·CompareAndSwapUint64(SB)
    49	
    50	TEXT ·CompareAndSwapInt64(SB),NOSPLIT,$0-25
    51		JMP	·CompareAndSwapUint64(SB)
    52	
    53	TEXT ·CompareAndSwapUint64(SB),NOSPLIT,$0-25
    54		MOVQ	addr+0(FP), BP
    55		MOVQ	old+8(FP), AX
    56		MOVQ	new+16(FP), CX
    57		LOCK
    58		CMPXCHGQ	CX, 0(BP)
    59		SETEQ	swapped+24(FP)
    60		RET
    61	
    62	TEXT ·AddInt32(SB),NOSPLIT,$0-20
    63		JMP	·AddUint32(SB)
    64	
    65	TEXT ·AddUint32(SB),NOSPLIT,$0-20
    66		MOVQ	addr+0(FP), BP
    67		MOVL	delta+8(FP), AX
    68		MOVL	AX, CX
    69		LOCK
    70		XADDL	AX, 0(BP)
    71		ADDL	AX, CX
    72		MOVL	CX, new+16(FP)
    73		RET
    74	
    75	TEXT ·AddUintptr(SB),NOSPLIT,$0-24
    76		JMP	·AddUint64(SB)
    77	
    78	TEXT ·AddInt64(SB),NOSPLIT,$0-24
    79		JMP	·AddUint64(SB)
    80	
    81	TEXT ·AddUint64(SB),NOSPLIT,$0-24
    82		MOVQ	addr+0(FP), BP
    83		MOVQ	delta+8(FP), AX
    84		MOVQ	AX, CX
    85		LOCK
    86		XADDQ	AX, 0(BP)
    87		ADDQ	AX, CX
    88		MOVQ	CX, new+16(FP)
    89		RET
    90	
    91	TEXT ·LoadInt32(SB),NOSPLIT,$0-12
    92		JMP	·LoadUint32(SB)
    93	
    94	TEXT ·LoadUint32(SB),NOSPLIT,$0-12
    95		MOVQ	addr+0(FP), AX
    96		MOVL	0(AX), AX
    97		MOVL	AX, val+8(FP)
    98		RET
    99	
   100	TEXT ·LoadInt64(SB),NOSPLIT,$0-16
   101		JMP	·LoadUint64(SB)
   102	
   103	TEXT ·LoadUint64(SB),NOSPLIT,$0-16
   104		MOVQ	addr+0(FP), AX
   105		MOVQ	0(AX), AX
   106		MOVQ	AX, val+8(FP)
   107		RET
   108	
   109	TEXT ·LoadUintptr(SB),NOSPLIT,$0-16
   110		JMP	·LoadPointer(SB)
   111	
   112	TEXT ·LoadPointer(SB),NOSPLIT,$0-16
   113		MOVQ	addr+0(FP), AX
   114		MOVQ	0(AX), AX
   115		MOVQ	AX, val+8(FP)
   116		RET
   117	
   118	TEXT ·StoreInt32(SB),NOSPLIT,$0-12
   119		JMP	·StoreUint32(SB)
   120	
   121	TEXT ·StoreUint32(SB),NOSPLIT,$0-12
   122		MOVQ	addr+0(FP), BP
   123		MOVL	val+8(FP), AX
   124		XCHGL	AX, 0(BP)
   125		RET
   126	
   127	TEXT ·StoreInt64(SB),NOSPLIT,$0-16
   128		JMP	·StoreUint64(SB)
   129	
   130	TEXT ·StoreUint64(SB),NOSPLIT,$0-16
   131		MOVQ	addr+0(FP), BP
   132		MOVQ	val+8(FP), AX
   133		XCHGQ	AX, 0(BP)
   134		RET
   135	
   136	TEXT ·StoreUintptr(SB),NOSPLIT,$0-16
   137		JMP	·StoreUint64(SB)

View as plain text