github.com/primecitizens/pcz/std@v0.2.1/core/atomic/atomic_riscv64.go (about)

     1  // SPDX-License-Identifier: Apache-2.0
     2  // Copyright 2023 The Prime Citizens
     3  //
     4  // Copyright 2015 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 riscv64
     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 Load8(ptr *uint8) uint8
    49  
    50  //go:noescape
    51  func Load32(ptr *uint32) uint32
    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  
    76  //go:noescape
    77  func Or8(ptr *uint8, val uint8)
    78  
    79  //go:noescape
    80  func Or32(ptr *uint32, val uint32)
    81  
    82  //go:noescape
    83  func And8(ptr *uint8, val uint8)
    84  
    85  //go:noescape
    86  func And32(ptr *uint32, val uint32)
    87  
    88  //
    89  // Swap
    90  //
    91  
    92  //go:noescape
    93  func Swap32(ptr *uint32, new uint32) uint32
    94  
    95  //go:noescape
    96  func Swap64(ptr *uint64, new uint64) uint64
    97  
    98  //go:noescape
    99  func SwapUintptr(ptr *uintptr, new uintptr) uintptr
   100  
   101  //
   102  // Add
   103  //
   104  
   105  //go:noescape
   106  func Add32(ptr *uint32, delta int32) uint32
   107  
   108  //go:noescape
   109  func Add64(ptr *uint64, delta int64) uint64
   110  
   111  //go:noescape
   112  func AddUintptr(ptr *uintptr, delta uintptr) uintptr
   113  
   114  //
   115  // Compare and swap
   116  //
   117  
   118  //go:noescape
   119  func Cas64(ptr *uint64, old, new uint64) bool
   120  
   121  //go:noescape
   122  func CasRel32(ptr *uint32, old, new uint32) bool