github.com/songzhibin97/gkit@v1.2.13/structure/lscq/asm.s (about)

     1  // Copyright 2021 ByteDance Inc.
     2  //
     3  // Licensed under the Apache License, Version 2.0 (the "License");
     4  // you may not use this file except in compliance with the License.
     5  // You may obtain a copy of the License at
     6  //
     7  //     http://www.apache.org/licenses/LICENSE-2.0
     8  //
     9  // Unless required by applicable law or agreed to in writing, software
    10  // distributed under the License is distributed on an "AS IS" BASIS,
    11  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  // See the License for the specific language governing permissions and
    13  // limitations under the License.
    14  
    15  // +build amd64,!gccgo,!appengine
    16  
    17  #include "textflag.h"
    18  
    19  TEXT ·compareAndSwapUint128(SB),NOSPLIT,$0
    20  	MOVQ addr+0(FP), R8
    21  	MOVQ old1+8(FP), AX
    22  	MOVQ old2+16(FP), DX
    23  	MOVQ new1+24(FP), BX
    24  	MOVQ new2+32(FP), CX
    25  	LOCK
    26  	CMPXCHG16B (R8)
    27  	SETEQ swapped+40(FP)
    28  	RET
    29  
    30  TEXT ·loadUint128(SB),NOSPLIT,$0
    31  	MOVQ addr+0(FP), R8
    32  	XORQ AX, AX
    33  	XORQ DX, DX
    34  	XORQ BX, BX
    35  	XORQ CX, CX
    36  	LOCK
    37  	CMPXCHG16B (R8)
    38  	MOVQ AX, val_0+8(FP)
    39  	MOVQ DX, val_1+16(FP)
    40  	RET
    41  
    42  TEXT ·loadSCQNodeUint64(SB),NOSPLIT,$0
    43  	JMP ·loadUint128(SB)
    44  
    45  TEXT ·loadSCQNodePointer(SB),NOSPLIT,$0
    46  	JMP ·loadUint128(SB)
    47  
    48  TEXT ·atomicTestAndSetFirstBit(SB),NOSPLIT,$0
    49  	MOVQ addr+0(FP), DX
    50  	LOCK
    51  	BTSQ $63,(DX)
    52  	MOVQ AX, val+8(FP)
    53  	RET
    54  
    55  TEXT ·atomicTestAndSetSecondBit(SB),NOSPLIT,$0
    56  	MOVQ addr+0(FP), DX
    57  	LOCK
    58  	BTSQ $62,(DX)
    59  	MOVQ AX, val+8(FP)
    60  	RET
    61  
    62  TEXT ·resetNode(SB),NOSPLIT,$0
    63  	MOVQ addr+0(FP), DX
    64  	MOVQ $0, 8(DX)
    65  	LOCK
    66  	BTSQ $62, (DX)
    67  	RET
    68  
    69  TEXT ·runtimeEnableWriteBarrier(SB),NOSPLIT,$0
    70  	MOVL runtime·writeBarrier(SB), AX
    71  	MOVB AX, ret+0(FP)
    72  	RET