...
Run Format

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

View as plain text