| 1 |
// Copyright 2022 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 |
//go:build loong64 |
| 6 |
|
| 7 |
package atomic |
| 8 |
|
| 9 |
import ( |
| 10 |
"internal/cpu" |
| 11 |
"unsafe" |
| 12 |
) |
| 13 |
|
| 14 |
const ( |
| 15 |
offsetLOONG64HasLAMCAS = unsafe.Offsetof(cpu.Loong64.HasLAMCAS) |
| 16 |
offsetLoong64HasLAM_BH = unsafe.Offsetof(cpu.Loong64.HasLAM_BH) |
| 17 |
) |
| 18 |
|
| 19 |
//go:noescape |
| 20 |
func Xadd(ptr *uint32, delta int32) uint32 |
| 21 |
|
| 22 |
//go:noescape |
| 23 |
func Xadd64(ptr *uint64, delta int64) uint64 |
| 24 |
|
| 25 |
//go:noescape |
| 26 |
func Xadduintptr(ptr *uintptr, delta uintptr) uintptr |
| 27 |
|
| 28 |
//go:noescape |
| 29 |
func Xchg8(ptr *uint8, new uint8) uint8 |
| 30 |
|
| 31 |
//go:noescape |
| 32 |
func Xchg(ptr *uint32, new uint32) uint32 |
| 33 |
|
| 34 |
//go:noescape |
| 35 |
func Xchg64(ptr *uint64, new uint64) uint64 |
| 36 |
|
| 37 |
//go:noescape |
| 38 |
func Xchguintptr(ptr *uintptr, new uintptr) uintptr |
| 39 |
|
| 40 |
//go:noescape |
| 41 |
func Load(ptr *uint32) uint32 |
| 42 |
|
| 43 |
//go:noescape |
| 44 |
func Load8(ptr *uint8) uint8 |
| 45 |
|
| 46 |
//go:noescape |
| 47 |
func Load64(ptr *uint64) uint64 |
| 48 |
|
| 49 |
// NO go:noescape annotation; *ptr escapes if result escapes (#31525) |
| 50 |
func Loadp(ptr unsafe.Pointer) unsafe.Pointer |
| 51 |
|
| 52 |
//go:noescape |
| 53 |
func LoadAcq(ptr *uint32) uint32 |
| 54 |
|
| 55 |
//go:noescape |
| 56 |
func LoadAcq64(ptr *uint64) uint64 |
| 57 |
|
| 58 |
//go:noescape |
| 59 |
func LoadAcquintptr(ptr *uintptr) uintptr |
| 60 |
|
| 61 |
//go:noescape |
| 62 |
func And8(ptr *uint8, val uint8) |
| 63 |
|
| 64 |
//go:noescape |
| 65 |
func And(ptr *uint32, val uint32) |
| 66 |
|
| 67 |
//go:noescape |
| 68 |
func Or8(ptr *uint8, val uint8) |
| 69 |
|
| 70 |
//go:noescape |
| 71 |
func Or(ptr *uint32, val uint32) |
| 72 |
|
| 73 |
//go:noescape |
| 74 |
func And32(ptr *uint32, val uint32) uint32 |
| 75 |
|
| 76 |
//go:noescape |
| 77 |
func Or32(ptr *uint32, val uint32) uint32 |
| 78 |
|
| 79 |
//go:noescape |
| 80 |
func And64(ptr *uint64, val uint64) uint64 |
| 81 |
|
| 82 |
//go:noescape |
| 83 |
func Or64(ptr *uint64, val uint64) uint64 |
| 84 |
|
| 85 |
//go:noescape |
| 86 |
func Anduintptr(ptr *uintptr, val uintptr) uintptr |
| 87 |
|
| 88 |
//go:noescape |
| 89 |
func Oruintptr(ptr *uintptr, val uintptr) uintptr |
| 90 |
|
| 91 |
// NOTE: Do not add atomicxor8 (XOR is not idempotent). |
| 92 |
|
| 93 |
//go:noescape |
| 94 |
func Cas64(ptr *uint64, old, new uint64) bool |
| 95 |
|
| 96 |
//go:noescape |
| 97 |
func CasRel(ptr *uint32, old, new uint32) bool |
| 98 |
|
| 99 |
//go:noescape |
| 100 |
func Store(ptr *uint32, val uint32) |
| 101 |
|
| 102 |
//go:noescape |
| 103 |
func Store8(ptr *uint8, val uint8) |
| 104 |
|
| 105 |
//go:noescape |
| 106 |
func Store64(ptr *uint64, val uint64) |
| 107 |
|
| 108 |
// NO go:noescape annotation; see atomic_pointer.go. |
| 109 |
func StorepNoWB(ptr unsafe.Pointer, val unsafe.Pointer) |
| 110 |
|
| 111 |
//go:noescape |
| 112 |
func StoreRel(ptr *uint32, val uint32) |
| 113 |
|
| 114 |
//go:noescape |
| 115 |
func StoreRel64(ptr *uint64, val uint64) |
| 116 |
|
| 117 |
//go:noescape |
| 118 |
func StoreReluintptr(ptr *uintptr, val uintptr) |