Home | History | Annotate | Download | only in runtime
      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 // uint32 runtimeatomicload(uint32 volatile* addr)
     10 TEXT atomicload(SB),NOSPLIT,$-8-12
     11 	MOVD	addr+0(FP), R3
     12 	SYNC
     13 	MOVWZ	0(R3), R3
     14 	CMPW	R3, R3, CR7
     15 	BC	4, 30, 1(PC) // bne- cr7,0x4
     16 	ISYNC
     17 	MOVW	R3, ret+8(FP)
     18 	RET
     19 
     20 // uint64 runtimeatomicload64(uint64 volatile* addr)
     21 TEXT atomicload64(SB),NOSPLIT,$-8-16
     22 	MOVD	addr+0(FP), R3
     23 	SYNC
     24 	MOVD	0(R3), R3
     25 	CMP	R3, R3, CR7
     26 	BC	4, 30, 1(PC) // bne- cr7,0x4
     27 	ISYNC
     28 	MOVD	R3, ret+8(FP)
     29 	RET
     30 
     31 // void *runtimeatomicloadp(void *volatile *addr)
     32 TEXT atomicloadp(SB),NOSPLIT,$-8-16
     33 	MOVD	addr+0(FP), R3
     34 	SYNC
     35 	MOVD	0(R3), R3
     36 	CMP	R3, R3, CR7
     37 	BC	4, 30, 1(PC) // bne- cr7,0x4
     38 	ISYNC
     39 	MOVD	R3, ret+8(FP)
     40 	RET
     41 
     42 TEXT publicationBarrier(SB),NOSPLIT,$-8-0
     43 	// LWSYNC is the "export" barrier recommended by Power ISA
     44 	// v2.07 book II, appendix B.2.2.2.
     45 	// LWSYNC is a load/load, load/store, and store/store barrier.
     46 	WORD $0x7c2004ac	// LWSYNC
     47 	RET
     48