1 //go:build amd64
2 3 package p256k1
4 5 // fieldMulAsm multiplies two field elements using x86-64 assembly.
6 // This is a direct port of bitcoin-core secp256k1_fe_mul_inner.
7 // r, a, b are 5x52-bit limb representations.
8 //
9 //go:noescape
10 func fieldMulAsm(r, a, b *FieldElement)
11 12 // fieldSqrAsm squares a field element using x86-64 assembly.
13 // This is a direct port of bitcoin-core secp256k1_fe_sqr_inner.
14 // Squaring is optimized compared to multiplication.
15 //
16 //go:noescape
17 func fieldSqrAsm(r, a *FieldElement)
18 19 // fieldMulAsmBMI2 multiplies two field elements using BMI2+ADX instructions.
20 // Uses MULX for flag-free multiplication enabling parallel carry chains.
21 // r, a, b are 5x52-bit limb representations.
22 //
23 //go:noescape
24 func fieldMulAsmBMI2(r, a, b *FieldElement)
25 26 // fieldSqrAsmBMI2 squares a field element using BMI2+ADX instructions.
27 // Uses MULX for flag-free multiplication.
28 //
29 //go:noescape
30 func fieldSqrAsmBMI2(r, a *FieldElement)
31 32 // hasFieldAsm returns true if field assembly is available.
33 // On amd64, this is always true.
34 func hasFieldAsm() bool {
35 return true
36 }
37 38 // hasFieldAsmBMI2 returns true if BMI2+ADX optimized field assembly is available.
39 func hasFieldAsmBMI2() bool {
40 return HasBMI2()
41 }
42