]> Cypherpunks repositories - gostls13.git/commitdiff
crypto: remove hand encoded amd64 instructions
authorIlya Tocar <ilya.tocar@intel.com>
Thu, 1 Mar 2018 18:52:21 +0000 (12:52 -0600)
committerIlya Tocar <ilya.tocar@intel.com>
Thu, 1 Mar 2018 19:20:53 +0000 (19:20 +0000)
Replace BYTE.. encodings with asm. This is possible due to asm
implementing more instructions and removal of
MOV $0, reg -> XOR reg, reg transformation from asm.

Change-Id: I011749ab6b3f64403ab6e746f3760c5841548b57
Reviewed-on: https://go-review.googlesource.com/97936
Run-TryBot: Ilya Tocar <ilya.tocar@intel.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

src/crypto/elliptic/p256_asm_amd64.s
src/hash/crc32/crc32_amd64.s

index 3f9d624270e2171a60fc14e38cdcb0df7e0ff2a1..c8adc7b6a6285632d30687fb41e2bf9d3ccc6e07 100644 (file)
@@ -1486,7 +1486,7 @@ TEXT p256MulInternal(SB),NOSPLIT,$0
        ADCQ mul0, acc2
        ADCQ $0, mul1
        MOVQ mul1, acc3
-       BYTE $0x48; BYTE $0xc7; BYTE $0xc5; BYTE $0x00; BYTE $0x00; BYTE $0x00; BYTE $0x00   // MOVQ $0, BP
+       MOVQ $0, BP
        // Add bits [511:256] of the result
        ADCQ acc0, acc4
        ADCQ acc1, acc5
@@ -1628,7 +1628,7 @@ TEXT p256SqrInternal(SB),NOSPLIT,$0
        ADCQ mul0, acc2
        ADCQ $0, mul1
        MOVQ mul1, acc3
-       BYTE $0x48; BYTE $0xc7; BYTE $0xc5; BYTE $0x00; BYTE $0x00; BYTE $0x00; BYTE $0x00   // MOVQ $0, BP
+       MOVQ $0, BP
        // Add bits [511:256] of the result
        ADCQ acc0, t0
        ADCQ acc1, t1
index d49093602ef7af4ff425b817528d5cb9d0da80d5..a944ead9b2f2ea8e3cab66844d49150f4bee08af 100644 (file)
@@ -37,8 +37,7 @@ align_2:
        BTQ $1, BX
        JNC align_4
 
-       // CRC32W (SI), AX
-       BYTE $0x66; BYTE $0xf2; BYTE $0x0f; BYTE $0x38; BYTE $0xf1; BYTE $0x06
+       CRC32W (SI), AX
 
        SUBQ $2, CX
        ADDQ $2, SI
@@ -47,8 +46,7 @@ align_4:
        BTQ $2, BX
        JNC aligned
 
-       // CRC32L (SI), AX
-       BYTE $0xf2; BYTE $0x0f; BYTE $0x38; BYTE $0xf1; BYTE $0x06
+       CRC32L (SI), AX
 
        SUBQ $4, CX
        ADDQ $4, SI
@@ -68,16 +66,14 @@ less_than_8:
        BTQ $2, CX
        JNC less_than_4
 
-       // CRC32L (SI), AX
-       BYTE $0xf2; BYTE $0x0f; BYTE $0x38; BYTE $0xf1; BYTE $0x06
+       CRC32L (SI), AX
        ADDQ $4, SI
 
 less_than_4:
        BTQ $1, CX
        JNC less_than_2
 
-       // CRC32W (SI), AX
-       BYTE $0x66; BYTE $0xf2; BYTE $0x0f; BYTE $0x38; BYTE $0xf1; BYTE $0x06
+       CRC32W (SI), AX
        ADDQ $2, SI
 
 less_than_2: