diff options
author | Péter Szilágyi <peterke@gmail.com> | 2018-03-20 00:13:54 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-03-20 00:13:54 +0800 |
commit | 1203c6a237cb87b78ec495772cecb178200499ce (patch) | |
tree | a51e6c3a24e43f265fc5c9b4f2bdb7ff7de6a8db /crypto/bn256/cloudflare/gfp_amd64.s | |
parent | 0965761a45562d609f6036963dbac84561174677 (diff) | |
download | dexon-1203c6a237cb87b78ec495772cecb178200499ce.tar dexon-1203c6a237cb87b78ec495772cecb178200499ce.tar.gz dexon-1203c6a237cb87b78ec495772cecb178200499ce.tar.bz2 dexon-1203c6a237cb87b78ec495772cecb178200499ce.tar.lz dexon-1203c6a237cb87b78ec495772cecb178200499ce.tar.xz dexon-1203c6a237cb87b78ec495772cecb178200499ce.tar.zst dexon-1203c6a237cb87b78ec495772cecb178200499ce.zip |
crypto/bn256: full switchover to cloudflare's code (#16301)
* crypto/bn256: full switchover to cloudflare's code
* crypto/bn256: only use cloudflare for optimized architectures
* crypto/bn256: upstream fallback for non-optimized code
* .travis, build: drop support for Go 1.8 (need type aliases)
* crypto/bn256/cloudflare: enable curve mul lattice optimization
Diffstat (limited to 'crypto/bn256/cloudflare/gfp_amd64.s')
-rw-r--r-- | crypto/bn256/cloudflare/gfp_amd64.s | 42 |
1 files changed, 37 insertions, 5 deletions
diff --git a/crypto/bn256/cloudflare/gfp_amd64.s b/crypto/bn256/cloudflare/gfp_amd64.s index 2d0176f2e..3a785d200 100644 --- a/crypto/bn256/cloudflare/gfp_amd64.s +++ b/crypto/bn256/cloudflare/gfp_amd64.s @@ -1,8 +1,40 @@ -// +build amd64,!appengine,!gccgo - -#include "gfp.h" -#include "mul.h" -#include "mul_bmi2.h" +// +build amd64,!generic + +#define storeBlock(a0,a1,a2,a3, r) \ + MOVQ a0, 0+r \ + MOVQ a1, 8+r \ + MOVQ a2, 16+r \ + MOVQ a3, 24+r + +#define loadBlock(r, a0,a1,a2,a3) \ + MOVQ 0+r, a0 \ + MOVQ 8+r, a1 \ + MOVQ 16+r, a2 \ + MOVQ 24+r, a3 + +#define gfpCarry(a0,a1,a2,a3,a4, b0,b1,b2,b3,b4) \ + \ // b = a-p + MOVQ a0, b0 \ + MOVQ a1, b1 \ + MOVQ a2, b2 \ + MOVQ a3, b3 \ + MOVQ a4, b4 \ + \ + SUBQ ·p2+0(SB), b0 \ + SBBQ ·p2+8(SB), b1 \ + SBBQ ·p2+16(SB), b2 \ + SBBQ ·p2+24(SB), b3 \ + SBBQ $0, b4 \ + \ + \ // if b is negative then return a + \ // else return b + CMOVQCC b0, a0 \ + CMOVQCC b1, a1 \ + CMOVQCC b2, a2 \ + CMOVQCC b3, a3 + +#include "mul_amd64.h" +#include "mul_bmi2_amd64.h" TEXT ·gfpNeg(SB),0,$0-16 MOVQ ·p2+0(SB), R8 |