github.com/shogo82148/std@v1.22.1-0.20240327122250-4e474527810c/runtime/internal/sys/intrinsics.go (about)

     1  // Copyright 2016 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  package sys
     6  
     7  // TrailingZeros32 returns the number of trailing zero bits in x; the result is 32 for x == 0.
     8  func TrailingZeros32(x uint32) int
     9  
    10  // TrailingZeros64 returns the number of trailing zero bits in x; the result is 64 for x == 0.
    11  func TrailingZeros64(x uint64) int
    12  
    13  // TrailingZeros8 returns the number of trailing zero bits in x; the result is 8 for x == 0.
    14  func TrailingZeros8(x uint8) int
    15  
    16  // Len64 returns the minimum number of bits required to represent x; the result is 0 for x == 0.
    17  //
    18  // nosplit because this is used in src/runtime/histogram.go, which make run in sensitive contexts.
    19  //
    20  //go:nosplit
    21  func Len64(x uint64) (n int)
    22  
    23  // OnesCount64 returns the number of one bits ("population count") in x.
    24  func OnesCount64(x uint64) int
    25  
    26  // LeadingZeros64 returns the number of leading zero bits in x; the result is 64 for x == 0.
    27  func LeadingZeros64(x uint64) int
    28  
    29  // LeadingZeros8 returns the number of leading zero bits in x; the result is 8 for x == 0.
    30  func LeadingZeros8(x uint8) int
    31  
    32  // Len8 returns the minimum number of bits required to represent x; the result is 0 for x == 0.
    33  func Len8(x uint8) int
    34  
    35  // Bswap64 returns its input with byte order reversed
    36  // 0x0102030405060708 -> 0x0807060504030201
    37  func Bswap64(x uint64) uint64
    38  
    39  // Bswap32 returns its input with byte order reversed
    40  // 0x01020304 -> 0x04030201
    41  func Bswap32(x uint32) uint32
    42  
    43  // Prefetch prefetches data from memory addr to cache
    44  //
    45  // AMD64: Produce PREFETCHT0 instruction
    46  //
    47  // ARM64: Produce PRFM instruction with PLDL1KEEP option
    48  func Prefetch(addr uintptr)
    49  
    50  // PrefetchStreamed prefetches data from memory addr, with a hint that this data is being streamed.
    51  // That is, it is likely to be accessed very soon, but only once. If possible, this will avoid polluting the cache.
    52  //
    53  // AMD64: Produce PREFETCHNTA instruction
    54  //
    55  // ARM64: Produce PRFM instruction with PLDL1STRM option
    56  func PrefetchStreamed(addr uintptr)