]> Cypherpunks.ru repositories - gostls13.git/commitdiff
math/big: delete all mulWW assembly code
authorWayne Zuo <wdvxdr@golangcn.org>
Wed, 27 Apr 2022 13:53:00 +0000 (21:53 +0800)
committerGopher Robot <gobot@golang.org>
Thu, 28 Apr 2022 20:09:27 +0000 (20:09 +0000)
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>
14 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_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

index 8f55c195d4bf26e494cd98fc5e4e71c6fe9dd4e8..06e63e2574f31db43bc2769c4f719c99539a81db 100644 (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)
 }
index acf2b06665a34239b17341a1f136ae9b2b08a6d4..8cf4665f29cd688edee2faf38da005be3d7dc42f 100644 (file)
 // 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
index 5c72a27d8d8e5d82700d6a0219feb5604ac30cda..b1e914c2bdc0d73230a57610fbce763302291e2c 100644 (file)
 // 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.
index f2872d80a1ad0573739020dd731884f5644be0ac..10054bde474327605f9f8ffef77dc194d626bfb3 100644 (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
index 7bfe08e7b7c3de4c04fc1c8f6160756d7d447a1c..addf2d64a1886af35d511e75a867981c4092203e 100644 (file)
 // 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
index eea3d6b32561b7c1c669d07bc9057054629b986f..301aa55f1ab6fef8b8111accf41142a4d5512899 100644 (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)
index 059f6f1325fa530d1af39f05d1ee1cb6367cf8fb..75f3ed29486ee7b473529db250e24549d8f5d802 100644 (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)
 }
index 4b5c502440f5f8e511444bcb83c55459690f5a54..3ee6e27c82310066234212b07ae0c3b234c06caf 100644 (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)
 
index e72e6d6377e87f8fb0137dbdb9569ac776c49b3c..b1d32821afd40d89c6e384108747b6073a78cacb 100644 (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)
 
index 601cafe6bb748b063d98b688bf5d75b0068f1899..a83696a0cbf3702264a7d615bf32615acb9bd96e 100644 (file)
 // 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
index 2e950ddd0f3732a90259df04e85efb7992cdad05..cb9ac182927b6e9ca6b1f805f085dfc7de4ed97a 100644 (file)
 // 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)
 
index ad822f76b39d1d4a839b6425093882387eb8360b..aa6590e20a53da0d2829d72ca4edca3470f71700 100644 (file)
 // 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)
 
index 789b96bf35c189801ec46b6a6a11f2997ae73ed1..e530dd9750601bee062da35c2d2287a28d0eceb3 100644 (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)
                }
index e8605f1e15356dabf04e57950f442b0c8b5ac8b7..93eb16d21d8c7e54ff8d94cec7bb8bbf8c45b4a6 100644 (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)