]> Cypherpunks repositories - gostls13.git/commit
math/big: replace addMulVVW with addMulVVWW
authorRuss Cox <rsc@golang.org>
Sat, 5 Apr 2025 18:29:00 +0000 (14:29 -0400)
committerRuss Cox <rsc@golang.org>
Fri, 11 Apr 2025 12:42:18 +0000 (05:42 -0700)
commit4dffdd797b69d9423b4a492e2d832e1023326b1b
tree2b6ba4ddbecb7a6d8c133f8bde27145284042842
parent037112464b4439571b45536de9ebe4bc9e10ecb7
math/big: replace addMulVVW with addMulVVWW

addMulVVW is an unnecessarily special case.
All other assembly routines taking []Word (V as in vector) arguments
take separate source and destination. For example:

addVV: z = x+y
mulAddVWW: z = x*m+a

addMulVVW uses the z parameter as both destination and source:

addMulVVW: z = z+x*m

Even looking at the signatures is confusing: all the VV routines take
two input vectors x and y, but addMulVVW takes only x: where is y?
(The answer is that the two inputs are z and x.)

It would be nice to fix this, both for understandability and regularity,
and to simplify a future assembly generator.

We cannot remove or redefine addMulVVW, because it has been used
in linknames. Instead, the CL adds a new final addend argument ‘a’
like in mulAddVWW, making the natural name addMulVVWW
(two input vectors, two input words):

addMulVVWW: z = x+y*m+a

This CL updates all the assembly implementations to rename the
inputs z, x, y -> x, y, m, and then introduces a separate destination z.

Change-Id: Ib76c80b53f6d1f4a901f663566e9c4764bb20488
Reviewed-on: https://go-review.googlesource.com/c/go/+/664895
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
17 files changed:
src/math/big/arith.go
src/math/big/arith_386.s
src/math/big/arith_amd64.s
src/math/big/arith_arm.s
src/math/big/arith_arm64.s
src/math/big/arith_decl.go
src/math/big/arith_decl_pure.go
src/math/big/arith_loong64.s
src/math/big/arith_mips64x.s
src/math/big/arith_mipsx.s
src/math/big/arith_ppc64x.s
src/math/big/arith_riscv64.s
src/math/big/arith_s390x.s
src/math/big/arith_test.go
src/math/big/arith_wasm.s
src/math/big/nat.go
src/math/big/natmul.go