2014-08-12 17:48:49 -06:00
|
|
|
// Copyright 2014 The Go Authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style
|
|
|
|
// license that can be found in the LICENSE file.
|
|
|
|
|
2014-12-05 17:13:20 -07:00
|
|
|
// +build ppc64 ppc64le
|
2014-08-12 17:48:49 -06:00
|
|
|
|
2014-10-27 15:27:03 -06:00
|
|
|
#include "textflag.h"
|
2014-08-12 17:48:49 -06:00
|
|
|
|
|
|
|
// uint32 runtime·atomicload(uint32 volatile* addr)
|
2014-10-27 15:27:03 -06:00
|
|
|
TEXT ·atomicload(SB),NOSPLIT,$-8-12
|
2015-02-18 21:02:16 -07:00
|
|
|
MOVD addr+0(FP), R3
|
2014-08-12 17:48:49 -06:00
|
|
|
SYNC
|
|
|
|
MOVWZ 0(R3), R3
|
|
|
|
CMPW R3, R3, CR7
|
|
|
|
BC 4, 30, 1(PC) // bne- cr7,0x4
|
|
|
|
ISYNC
|
2014-10-27 15:27:03 -06:00
|
|
|
MOVW R3, ret+8(FP)
|
2015-06-03 12:59:27 -06:00
|
|
|
RET
|
2014-08-12 17:48:49 -06:00
|
|
|
|
|
|
|
// uint64 runtime·atomicload64(uint64 volatile* addr)
|
2014-10-27 15:27:03 -06:00
|
|
|
TEXT ·atomicload64(SB),NOSPLIT,$-8-16
|
2015-02-18 21:02:16 -07:00
|
|
|
MOVD addr+0(FP), R3
|
2014-08-12 17:48:49 -06:00
|
|
|
SYNC
|
|
|
|
MOVD 0(R3), R3
|
|
|
|
CMP R3, R3, CR7
|
|
|
|
BC 4, 30, 1(PC) // bne- cr7,0x4
|
|
|
|
ISYNC
|
2014-10-27 15:27:03 -06:00
|
|
|
MOVD R3, ret+8(FP)
|
2015-06-03 12:59:27 -06:00
|
|
|
RET
|
2014-08-12 17:48:49 -06:00
|
|
|
|
|
|
|
// void *runtime·atomicloadp(void *volatile *addr)
|
2014-10-27 15:27:03 -06:00
|
|
|
TEXT ·atomicloadp(SB),NOSPLIT,$-8-16
|
2015-02-18 21:02:16 -07:00
|
|
|
MOVD addr+0(FP), R3
|
2014-08-12 17:48:49 -06:00
|
|
|
SYNC
|
|
|
|
MOVD 0(R3), R3
|
|
|
|
CMP R3, R3, CR7
|
|
|
|
BC 4, 30, 1(PC) // bne- cr7,0x4
|
|
|
|
ISYNC
|
2014-10-27 15:27:03 -06:00
|
|
|
MOVD R3, ret+8(FP)
|
2015-06-03 12:59:27 -06:00
|
|
|
RET
|
2015-06-15 10:30:23 -06:00
|
|
|
|
|
|
|
TEXT ·publicationBarrier(SB),NOSPLIT,$-8-0
|
|
|
|
// LWSYNC is the "export" barrier recommended by Power ISA
|
|
|
|
// v2.07 book II, appendix B.2.2.2.
|
|
|
|
// LWSYNC is a load/load, load/store, and store/store barrier.
|
|
|
|
WORD $0x7c2004ac // LWSYNC
|
|
|
|
RET
|