mirror of https://github.com/golang/go.git
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:
parent
96a1ad298a
commit
0eb93d6b43
|
|
@ -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)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue