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 || loong64 || ppc64 || ppc64le || riscv64 || s390x)
6 7 package bigmod
8 9 import (
10 "crypto/internal/fips140deps/cpu"
11 "crypto/internal/impl"
12 )
13 14 // amd64 assembly uses ADCX/ADOX/MULX if ADX is available to run two carry
15 // chains in the flags in parallel across the whole operation, and aggressively
16 // unrolls loops. arm64 processes four words at a time.
17 //
18 // It's unclear why the assembly for all other architectures, as well as for
19 // amd64 without ADX, perform better than the compiler output.
20 // TODO(filippo): file cmd/compile performance issue.
21 22 var supportADX = cpu.X86HasADX && cpu.X86HasBMI2
23 24 func init() {
25 if cpu.AMD64 {
26 impl.Register("aes", "ADX", &supportADX)
27 }
28 }
29 30 //go:noescape
31 func addMulVVW1024(z, x *uint, y uint) (c uint)
32 33 //go:noescape
34 func addMulVVW1536(z, x *uint, y uint) (c uint)
35 36 //go:noescape
37 func addMulVVW2048(z, x *uint, y uint) (c uint)
38