github.com/primecitizens/pcz/std@v0.2.1/core/atomic/atomic_ppc64x.go (about) 1 // SPDX-License-Identifier: Apache-2.0 2 // Copyright 2023 The Prime Citizens 3 // 4 // Copyright 2014 The Go Authors. All rights reserved. 5 // Use of this source code is governed by a BSD-style 6 // license that can be found in the LICENSE file. 7 8 //go:build ppc64 || ppc64le 9 10 package atomic 11 12 import "unsafe" 13 14 // 15 // Store 16 // 17 18 //go:noescape 19 func Store8(ptr *uint8, val uint8) 20 21 //go:noescape 22 func Store32(ptr *uint32, val uint32) 23 24 //go:noescape 25 func Store64(ptr *uint64, val uint64) 26 27 // NO go:noescape annotation; see atomic_pointer.go. 28 func StorePointer(ptr unsafe.Pointer, val unsafe.Pointer) 29 30 // 31 // StoreRel 32 // 33 34 //go:noescape 35 func StoreRel32(ptr *uint32, val uint32) 36 37 //go:noescape 38 func StoreRel64(ptr *uint64, val uint64) 39 40 //go:noescape 41 func StoreRelUintptr(ptr *uintptr, val uintptr) 42 43 // 44 // Load 45 // 46 47 //go:noescape 48 func Load32(ptr *uint32) uint32 49 50 //go:noescape 51 func Load8(ptr *uint8) uint8 52 53 //go:noescape 54 func Load64(ptr *uint64) uint64 55 56 // NO go:noescape annotation; *ptr escapes if result escapes (#31525) 57 func LoadPointer(ptr unsafe.Pointer) unsafe.Pointer 58 59 // 60 // LoadAcq 61 // 62 63 //go:noescape 64 func LoadAcq32(ptr *uint32) uint32 65 66 //go:noescape 67 func LoadAcq64(ptr *uint64) uint64 68 69 //go:noescape 70 func LoadAcqUintptr(ptr *uintptr) uintptr 71 72 // 73 // bitwise 74 // 75 // NOTE: Do not add atomicxor8 (XOR is not idempotent). 76 77 //go:noescape 78 func And8(ptr *uint8, val uint8) 79 80 //go:noescape 81 func And32(ptr *uint32, val uint32) 82 83 //go:noescape 84 func Or8(ptr *uint8, val uint8) 85 86 //go:noescape 87 func Or32(ptr *uint32, val uint32) 88 89 // 90 // Swap 91 // 92 93 //go:noescape 94 func Swap32(ptr *uint32, new uint32) uint32 95 96 //go:noescape 97 func Swap64(ptr *uint64, new uint64) uint64 98 99 //go:noescape 100 func SwapUintptr(ptr *uintptr, new uintptr) uintptr 101 102 // 103 // Add 104 // 105 106 //go:noescape 107 func Add32(ptr *uint32, delta int32) uint32 108 109 //go:noescape 110 func Add64(ptr *uint64, delta int64) uint64 111 112 //go:noescape 113 func AddUintptr(ptr *uintptr, delta uintptr) uintptr 114 115 // Compare and swap 116 // 117 //go:noescape 118 func Cas64(ptr *uint64, old, new uint64) bool 119 120 //go:noescape 121 func CasRel32(ptr *uint32, old, new uint32) bool