Skip to content

Commit

Permalink
perf: add Vector::Add, Sub and ScalarMul assembly (and purego) implem…
Browse files Browse the repository at this point in the history
…entations (#536)

* checkpoint

* style: cleanup vector add

* feat: added Vector.Sub

* feat: added vector.ScalarMul

* restore test

* style: add comments and named lables in vec asm code

* feat: add noadx fallback for scalarMulGeneric

* style: cosmetics
  • Loading branch information
gbotrel authored Sep 12, 2024
1 parent e6b99e7 commit df40d22
Show file tree
Hide file tree
Showing 94 changed files with 6,167 additions and 75 deletions.
8 changes: 4 additions & 4 deletions ecc/bls12-377/fp/element_mul_amd64.s
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ TEXT ·mul(SB), $24-24

NO_LOCAL_POINTERS
CMPB ·supportAdx(SB), $1
JNE l1
JNE noAdx_1
MOVQ x+8(FP), R8

// x[0] -> R10
Expand Down Expand Up @@ -570,7 +570,7 @@ TEXT ·mul(SB), $24-24
MOVQ DI, 40(AX)
RET

l1:
noAdx_1:
MOVQ res+0(FP), AX
MOVQ AX, (SP)
MOVQ x+8(FP), AX
Expand All @@ -595,7 +595,7 @@ TEXT ·fromMont(SB), $8-8
// (C,t[j-1]) := t[j] + m*q[j] + C
// t[N-1] = C
CMPB ·supportAdx(SB), $1
JNE l2
JNE noAdx_2
MOVQ res+0(FP), DX
MOVQ 0(DX), R14
MOVQ 8(DX), R15
Expand Down Expand Up @@ -850,7 +850,7 @@ TEXT ·fromMont(SB), $8-8
MOVQ DI, 40(AX)
RET

l2:
noAdx_2:
MOVQ res+0(FP), AX
MOVQ AX, (SP)
CALL ·_fromMontGeneric(SB)
Expand Down
71 changes: 71 additions & 0 deletions ecc/bls12-377/fp/element_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

45 changes: 45 additions & 0 deletions ecc/bls12-377/fp/vector.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions ecc/bls12-377/fr/element_mul_amd64.s
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ TEXT ·mul(SB), $24-24

NO_LOCAL_POINTERS
CMPB ·supportAdx(SB), $1
JNE l1
JNE noAdx_1
MOVQ x+8(FP), SI

// x[0] -> DI
Expand Down Expand Up @@ -322,7 +322,7 @@ TEXT ·mul(SB), $24-24
MOVQ BX, 24(AX)
RET

l1:
noAdx_1:
MOVQ res+0(FP), AX
MOVQ AX, (SP)
MOVQ x+8(FP), AX
Expand All @@ -347,7 +347,7 @@ TEXT ·fromMont(SB), $8-8
// (C,t[j-1]) := t[j] + m*q[j] + C
// t[N-1] = C
CMPB ·supportAdx(SB), $1
JNE l2
JNE noAdx_2
MOVQ res+0(FP), DX
MOVQ 0(DX), R14
MOVQ 8(DX), R13
Expand Down Expand Up @@ -480,7 +480,7 @@ TEXT ·fromMont(SB), $8-8
MOVQ BX, 24(AX)
RET

l2:
noAdx_2:
MOVQ res+0(FP), AX
MOVQ AX, (SP)
CALL ·_fromMontGeneric(SB)
Expand Down
36 changes: 36 additions & 0 deletions ecc/bls12-377/fr/element_ops_amd64.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit df40d22

Please sign in to comment.