math/big: delete all mulWW assembly code

Now gc can generate the same assembly code.

Change-Id: Iac503003e14045d63e2def66408c13cee516aa37
Reviewed-on: https://go-review.googlesource.com/c/go/+/402575
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Run-TryBot: Wayne Zuo <wdvxdr@golangcn.org>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
This commit is contained in:
Wayne Zuo 2022-04-27 21:53:00 +08:00 committed by Gopher Robot
parent 96a1ad298a
commit 0eb93d6b43
14 changed files with 2 additions and 87 deletions

View File

@ -41,7 +41,7 @@ const (
// These operations are used by the vector operations below.
// z1<<_W + z0 = x*y
func mulWW_g(x, y Word) (z1, z0 Word) {
func mulWW(x, y Word) (z1, z0 Word) {
hi, lo := bits.Mul(uint(x), uint(y))
return Word(hi), Word(lo)
}

View File

@ -10,15 +10,6 @@
// This file provides fast assembly versions for the elementary
// arithmetic operations on vectors implemented in arith.go.
// func mulWW(x, y Word) (z1, z0 Word)
TEXT ·mulWW(SB),NOSPLIT,$0
MOVL x+0(FP), AX
MULL y+4(FP)
MOVL DX, z1+8(FP)
MOVL AX, z0+12(FP)
RET
// func addVV(z, x, y []Word) (c Word)
TEXT ·addVV(SB),NOSPLIT,$0
MOVL z+0(FP), DI

View File

@ -10,16 +10,6 @@
// This file provides fast assembly versions for the elementary
// arithmetic operations on vectors implemented in arith.go.
// func mulWW(x, y Word) (z1, z0 Word)
TEXT ·mulWW(SB),NOSPLIT,$0
MOVQ x+0(FP), AX
MULQ y+8(FP)
MOVQ DX, z1+16(FP)
MOVQ AX, z0+24(FP)
RET
// The carry bit is saved with SBBQ Rx, Rx: if the carry was set, Rx is -1, otherwise it is 0.
// It is restored with ADDQ Rx, Rx: if Rx was -1 the carry is set, otherwise it is cleared.
// This is faster than using rotate instructions.

View File

@ -271,14 +271,3 @@ E9:
MOVW R4, c+28(FP)
RET
// func mulWW(x, y Word) (z1, z0 Word)
TEXT ·mulWW(SB),NOSPLIT,$0
MOVW x+0(FP), R1
MOVW y+4(FP), R2
MULLU R1, R2, (R4, R3)
MOVW R4, z1+8(FP)
MOVW R3, z0+12(FP)
RET

View File

@ -13,17 +13,6 @@
// TODO: Consider re-implementing using Advanced SIMD
// once the assembler supports those instructions.
// func mulWW(x, y Word) (z1, z0 Word)
TEXT ·mulWW(SB),NOSPLIT,$0
MOVD x+0(FP), R0
MOVD y+8(FP), R1
MUL R0, R1, R2
UMULH R0, R1, R3
MOVD R3, z1+16(FP)
MOVD R2, z0+24(FP)
RET
// func addVV(z, x, y []Word) (c Word)
TEXT ·addVV(SB),NOSPLIT,$0
MOVD z_len+8(FP), R0

View File

@ -8,7 +8,6 @@
package big
// implemented in arith_$GOARCH.s
func mulWW(x, y Word) (z1, z0 Word)
func addVV(z, x, y []Word) (c Word)
func subVV(z, x, y []Word) (c Word)
func addVW(z, x []Word, y Word) (c Word)

View File

@ -7,10 +7,6 @@
package big
func mulWW(x, y Word) (z1, z0 Word) {
return mulWW_g(x, y)
}
func addVV(z, x, y []Word) (c Word) {
return addVV_g(z, x, y)
}

View File

@ -11,9 +11,6 @@
// This file provides fast assembly versions for the elementary
// arithmetic operations on vectors implemented in arith.go.
TEXT ·mulWW(SB),NOSPLIT,$0
JMP ·mulWW_g(SB)
TEXT ·addVV(SB),NOSPLIT,$0
JMP ·addVV_g(SB)

View File

@ -11,9 +11,6 @@
// This file provides fast assembly versions for the elementary
// arithmetic operations on vectors implemented in arith.go.
TEXT ·mulWW(SB),NOSPLIT,$0
JMP ·mulWW_g(SB)
TEXT ·addVV(SB),NOSPLIT,$0
JMP ·addVV_g(SB)

View File

@ -11,16 +11,6 @@
// This file provides fast assembly versions for the elementary
// arithmetic operations on vectors implemented in arith.go.
// func mulWW(x, y Word) (z1, z0 Word)
TEXT ·mulWW(SB), NOSPLIT, $0
MOVD x+0(FP), R4
MOVD y+8(FP), R5
MULHDU R4, R5, R6
MULLD R4, R5, R7
MOVD R6, z1+16(FP)
MOVD R7, z0+24(FP)
RET
// func addVV(z, y, y []Word) (c Word)
// z[i] = x[i] + y[i] for all i, carrying
TEXT ·addVV(SB), NOSPLIT, $0

View File

@ -10,17 +10,6 @@
// This file provides fast assembly versions for the elementary
// arithmetic operations on vectors implemented in arith.go.
// func mulWW(x, y Word) (z1, z0 Word)
TEXT ·mulWW(SB),NOSPLIT,$0
MOV x+0(FP), X5
MOV y+8(FP), X6
MULHU X5, X6, X7
MUL X5, X6, X8
MOV X7, z1+16(FP)
MOV X8, z0+24(FP)
RET
TEXT ·addVV(SB),NOSPLIT,$0
JMP ·addVV_g(SB)

View File

@ -10,15 +10,6 @@
// This file provides fast assembly versions for the elementary
// arithmetic operations on vectors implemented in arith.go.
TEXT ·mulWW(SB), NOSPLIT, $0
MOVD x+0(FP), R3
MOVD y+8(FP), R4
MULHDU R3, R4
MOVD R10, z1+16(FP)
MOVD R11, z0+24(FP)
RET
// DI = R3, CX = R4, SI = r10, r8 = r8, r9=r9, r10 = r2, r11 = r5, r12 = r6, r13 = r7, r14 = r1 (R0 set to 0) + use R11
// func addVV(z, x, y []Word) (c Word)

View File

@ -558,7 +558,7 @@ var mulWWTests = []struct {
func TestMulWW(t *testing.T) {
for i, test := range mulWWTests {
q, r := mulWW_g(test.x, test.y)
q, r := mulWW(test.x, test.y)
if q != test.q || r != test.r {
t.Errorf("#%d got (%x, %x) want (%x, %x)", i, q, r, test.q, test.r)
}

View File

@ -7,9 +7,6 @@
#include "textflag.h"
TEXT ·mulWW(SB),NOSPLIT,$0
JMP ·mulWW_g(SB)
TEXT ·addVV(SB),NOSPLIT,$0
JMP ·addVV_g(SB)