Source file src/crypto/internal/bigmod/nat_asm.go

     1  // Copyright 2023 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 !purego && (386 || amd64 || arm || arm64 || ppc64 || ppc64le || riscv64 || s390x)
     6  
     7  package bigmod
     8  
     9  import "internal/cpu"
    10  
    11  // amd64 assembly uses ADCX/ADOX/MULX if ADX is available to run two carry
    12  // chains in the flags in parallel across the whole operation, and aggressively
    13  // unrolls loops. arm64 processes four words at a time.
    14  //
    15  // It's unclear why the assembly for all other architectures, as well as for
    16  // amd64 without ADX, perform better than the compiler output.
    17  // TODO(filippo): file cmd/compile performance issue.
    18  
    19  var supportADX = cpu.X86.HasADX && cpu.X86.HasBMI2
    20  
    21  //go:noescape
    22  func addMulVVW1024(z, x *uint, y uint) (c uint)
    23  
    24  //go:noescape
    25  func addMulVVW1536(z, x *uint, y uint) (c uint)
    26  
    27  //go:noescape
    28  func addMulVVW2048(z, x *uint, y uint) (c uint)
    29  

View as plain text