forked from TrueCloudLab/tzhash
*: format assembly code with asmfmt
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
parent
1520cde665
commit
0fa6b1314e
4 changed files with 251 additions and 252 deletions
|
@ -1,7 +1,7 @@
|
|||
#include "textflag.h"
|
||||
|
||||
// func Add(a, b, c *[2]uint64)
|
||||
TEXT ·Add(SB),NOSPLIT,$0
|
||||
TEXT ·Add(SB), NOSPLIT, $0
|
||||
MOVQ a+0(FP), AX
|
||||
MOVUPD (AX), X0
|
||||
MOVQ b+8(FP), BX
|
||||
|
@ -12,7 +12,7 @@ TEXT ·Add(SB),NOSPLIT,$0
|
|||
RET
|
||||
|
||||
// func Mul10(a, b *[2]uint64)
|
||||
TEXT ·Mul10(SB),NOSPLIT,$0
|
||||
TEXT ·Mul10(SB), NOSPLIT, $0
|
||||
MOVQ a+0(FP), AX
|
||||
MOVUPD (AX), X0
|
||||
VPSLLQ $1, X0, X1
|
||||
|
@ -28,7 +28,7 @@ TEXT ·Mul10(SB),NOSPLIT,$0
|
|||
RET
|
||||
|
||||
// func Mul11(a, b *[2]uint64)
|
||||
TEXT ·Mul11(SB),NOSPLIT,$0
|
||||
TEXT ·Mul11(SB), NOSPLIT, $0
|
||||
MOVQ a+0(FP), AX
|
||||
MOVUPD (AX), X0
|
||||
VPSLLQ $1, X0, X1
|
||||
|
@ -45,7 +45,7 @@ TEXT ·Mul11(SB),NOSPLIT,$0
|
|||
RET
|
||||
|
||||
// func Mul(a, b, c *[2]uint64)
|
||||
TEXT ·Mul(SB),NOSPLIT,$0
|
||||
TEXT ·Mul(SB), NOSPLIT, $0
|
||||
MOVQ a+0(FP), AX // X0 = a0 . a1
|
||||
MOVUPD (AX), X0 // X0 = a0 . a1
|
||||
MOVQ b+8(FP), BX // X1 = b0 . b1
|
||||
|
@ -56,11 +56,11 @@ TEXT ·Mul(SB),NOSPLIT,$0
|
|||
PCLMULQDQ $0x10, X3, X3 // X3 = (a0 + a1) * (b0 + b1)
|
||||
VPCLMULQDQ $0x00, X0, X1, X4 // X4 = a0 * b0
|
||||
VPCLMULQDQ $0x11, X0, X1, X5 // X5 = a1 * b1
|
||||
XORPD X4, X3 //
|
||||
XORPD X4, X3
|
||||
XORPD X5, X3 // X3 = a0 * b1 + a1 * b0
|
||||
VPSLLDQ $8, X3, X2 //
|
||||
VPSLLDQ $8, X3, X2
|
||||
XORPD X2, X4 // X4 = a0 * b0 + lo(X3)
|
||||
VPSRLDQ $8, X3, X6 //
|
||||
VPSRLDQ $8, X3, X6
|
||||
XORPD X6, X5 // X5 = a1 * b1 + hi(X3)
|
||||
|
||||
// at this point, a * b = X4 . X5 (as 256-bit number)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include "textflag.h"
|
||||
|
||||
// func Mul10x2(a, b) *[4]uint64
|
||||
TEXT ·Mul10x2(SB),NOSPLIT,$0
|
||||
TEXT ·Mul10x2(SB), NOSPLIT, $0
|
||||
MOVQ a+0(FP), AX
|
||||
VMOVDQA (AX), Y0
|
||||
VPSLLQ $1, Y0, Y1
|
||||
|
@ -16,9 +16,8 @@ TEXT ·Mul10x2(SB),NOSPLIT,$0
|
|||
VMOVDQA Y3, (AX)
|
||||
RET
|
||||
|
||||
|
||||
// func Mul11x2(a, b) *[4]uint64
|
||||
TEXT ·Mul11x2(SB),NOSPLIT,$0
|
||||
TEXT ·Mul11x2(SB), NOSPLIT, $0
|
||||
MOVQ a+0(FP), AX
|
||||
VMOVDQA (AX), Y0
|
||||
VPSLLQ $1, Y0, Y1
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
VPXOR Y4, in_1, out_2 \
|
||||
|
||||
// func mulByteSliceRightx2(c00c10, c01c11 *[4]uint64, n int, data *byte)
|
||||
TEXT ·mulByteSliceRightx2(SB),NOSPLIT,$0
|
||||
TEXT ·mulByteSliceRightx2(SB), NOSPLIT, $0
|
||||
MOVQ c00c10+0(FP), AX
|
||||
VMOVDQU (AX), Y0
|
||||
MOVQ c01c11+8(FP), BX
|
||||
|
@ -61,7 +61,7 @@ finish:
|
|||
RET
|
||||
|
||||
// func mulBitRightx2(c00c10, c01c11 *[4]uint64, e *[2]uint64)
|
||||
TEXT ·mulBitRightx2(SB),NOSPLIT,$0
|
||||
TEXT ·mulBitRightx2(SB), NOSPLIT, $0
|
||||
MOVQ c00c10+0(FP), AX
|
||||
VMOVDQU (AX), Y0
|
||||
MOVQ c01c11+8(FP), BX
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
VXORPD X9, X3, X3
|
||||
|
||||
// func mulBitRight(c00, c01, c10, c11, e *[2]uint64)
|
||||
TEXT ·mulBitRight(SB),NOSPLIT,$0
|
||||
TEXT ·mulBitRight(SB), NOSPLIT, $0
|
||||
MOVQ c00+0(FP), AX
|
||||
VMOVDQU (AX), X0
|
||||
VMOVDQU X0, X8 // remember c00 value
|
||||
|
@ -66,7 +66,7 @@ TEXT ·mulBitRight(SB),NOSPLIT,$0
|
|||
|
||||
RET
|
||||
|
||||
TEXT ·mulByteRight(SB),NOSPLIT,$0
|
||||
TEXT ·mulByteRight(SB), NOSPLIT, $0
|
||||
MOVQ c00+0(FP), AX
|
||||
VMOVDQU (AX), X0
|
||||
MOVQ c01+8(FP), BX
|
||||
|
|
Loading…
Reference in a new issue