Source file src/simd/config.go

     1  // Copyright 2026 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 goexperiment.simdstable
     6  
     7  package simd
     8  
     9  // These functions are declared once for all GOARCHes so that each has a single
    10  // doc comment. The state they report is defined per GOARCH: in midway_common.go
    11  // on GOARCHes with SIMD hardware support, and in simd_emulated.go elsewhere.
    12  
    13  // VectorBits returns the bit length of the vectors used by this package.
    14  //
    15  // If [Emulated] is true, this is 128. Otherwise, it is the longest vector
    16  // length supported by the hardware and the simd package. It can be artificially
    17  // reduced by setting the GODEBUG=simd=<smaller size> environment variable
    18  // before running a program.
    19  func VectorBits() int {
    20  	return maxVectorSize
    21  }
    22  
    23  // Emulated reports whether this package's operations are emulated in software
    24  // rather than executed on vector hardware.
    25  func Emulated() bool {
    26  	return emulated
    27  }
    28  

View as plain text