github.com/geraldss/go/src@v0.0.0-20210511222824-ac7d0ebfc235/runtime/internal/atomic/atomic_ppc64x.s (about)

     1  // Copyright 2014 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 ppc64 ppc64le
     6  
     7  #include "textflag.h"
     8  
     9  
    10  // For more details about how various memory models are
    11  // enforced on POWER, the following paper provides more
    12  // details about how they enforce C/C++ like models. This
    13  // gives context about why the strange looking code
    14  // sequences below work.
    15  //
    16  // http://www.rdrop.com/users/paulmck/scalability/paper/N2745r.2011.03.04a.html
    17  
    18  // uint32 runtime∕internal∕atomic·Load(uint32 volatile* ptr)
    19  TEXT ·Load(SB),NOSPLIT|NOFRAME,$-8-12
    20  	MOVD	ptr+0(FP), R3
    21  	SYNC
    22  	MOVWZ	0(R3), R3
    23  	CMPW	R3, R3, CR7
    24  	BC	4, 30, 1(PC) // bne- cr7,0x4
    25  	ISYNC
    26  	MOVW	R3, ret+8(FP)
    27  	RET
    28  
    29  // uint8 runtime∕internal∕atomic·Load8(uint8 volatile* ptr)
    30  TEXT ·Load8(SB),NOSPLIT|NOFRAME,$-8-9
    31  	MOVD	ptr+0(FP), R3
    32  	SYNC
    33  	MOVBZ	0(R3), R3
    34  	CMP	R3, R3, CR7
    35  	BC	4, 30, 1(PC) // bne- cr7,0x4
    36  	ISYNC
    37  	MOVB	R3, ret+8(FP)
    38  	RET
    39  
    40  // uint64 runtime∕internal∕atomic·Load64(uint64 volatile* ptr)
    41  TEXT ·Load64(SB),NOSPLIT|NOFRAME,$-8-16
    42  	MOVD	ptr+0(FP), R3
    43  	SYNC
    44  	MOVD	0(R3), R3
    45  	CMP	R3, R3, CR7
    46  	BC	4, 30, 1(PC) // bne- cr7,0x4
    47  	ISYNC
    48  	MOVD	R3, ret+8(FP)
    49  	RET
    50  
    51  // void *runtime∕internal∕atomic·Loadp(void *volatile *ptr)
    52  TEXT ·Loadp(SB),NOSPLIT|NOFRAME,$-8-16
    53  	MOVD	ptr+0(FP), R3
    54  	SYNC
    55  	MOVD	0(R3), R3
    56  	CMP	R3, R3, CR7
    57  	BC	4, 30, 1(PC) // bne- cr7,0x4
    58  	ISYNC
    59  	MOVD	R3, ret+8(FP)
    60  	RET
    61  
    62  // uint32 runtime∕internal∕atomic·LoadAcq(uint32 volatile* ptr)
    63  TEXT ·LoadAcq(SB),NOSPLIT|NOFRAME,$-8-12
    64  	MOVD   ptr+0(FP), R3
    65  	MOVWZ  0(R3), R3
    66  	CMPW   R3, R3, CR7
    67  	BC     4, 30, 1(PC) // bne- cr7, 0x4
    68  	ISYNC
    69  	MOVW   R3, ret+8(FP)
    70  	RET
    71  
    72  // uint64 runtime∕internal∕atomic·LoadAcq64(uint64 volatile* ptr)
    73  TEXT ·LoadAcq64(SB),NOSPLIT|NOFRAME,$-8-16
    74  	MOVD   ptr+0(FP), R3
    75  	MOVD   0(R3), R3
    76  	CMP    R3, R3, CR7
    77  	BC     4, 30, 1(PC) // bne- cr7, 0x4
    78  	ISYNC
    79  	MOVD   R3, ret+8(FP)
    80  	RET