Skip to content

Commit

Permalink
math/big: delete all mulWW assembly code
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reviewed-by: Keith Randall <[email protected]>
Reviewed-by: Dmitri Shuralyov <[email protected]>
Run-TryBot: Wayne Zuo <[email protected]>
Auto-Submit: Keith Randall <[email protected]>
Reviewed-by: Keith Randall <[email protected]>
  • Loading branch information
wdvxdr1123 authored and gopherbot committed Apr 28, 2022
1 parent 96a1ad2 commit 0eb93d6
Show file tree
Hide file tree
Showing 14 changed files with 2 additions and 87 deletions.
2 changes: 1 addition & 1 deletion src/math/big/arith.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
9 changes: 0 additions & 9 deletions src/math/big/arith_386.s
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 0 additions & 10 deletions src/math/big/arith_amd64.s
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
11 changes: 0 additions & 11 deletions src/math/big/arith_arm.s
Original file line number Diff line number Diff line change
Expand Up @@ -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
11 changes: 0 additions & 11 deletions src/math/big/arith_arm64.s
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion src/math/big/arith_decl.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 0 additions & 4 deletions src/math/big/arith_decl_pure.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
3 changes: 0 additions & 3 deletions src/math/big/arith_mips64x.s
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
3 changes: 0 additions & 3 deletions src/math/big/arith_mipsx.s
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
10 changes: 0 additions & 10 deletions src/math/big/arith_ppc64x.s
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 0 additions & 11 deletions src/math/big/arith_riscv64.s
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
9 changes: 0 additions & 9 deletions src/math/big/arith_s390x.s
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion src/math/big/arith_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
3 changes: 0 additions & 3 deletions src/math/big/arith_wasm.s
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit 0eb93d6

Please sign in to comment.