This commit is contained in:
Dmitry Vagner 2022-12-08 18:20:24 -08:00
parent 83328f918c
commit 8737ba9b93
3 changed files with 42 additions and 40 deletions

View File

@ -70,7 +70,7 @@ miller_end:
// stack: times, O, P, Q, out, retdest
%pop3 %pop3 %pop3
// stack: out, retdest
%jump(post_mllr)
SWAP1 %jump(post_mllr)
miller_one:

View File

@ -15,58 +15,60 @@
/// return out
global tate:
// stack: ptr, out, retdest
PUSH tate_mul3 SWAP2
// stack: out, ptr, tate_mul3, retdest
PUSH tate_mul2 SWAP2
// stack: ptr, out, tate_mul2, tate_mul3, retdest
PUSH tate_mul1 SWAP2
// stack: out, ptr, tate_mul1, tate_mul2, tate_mul3, retdest
PUSH post_mllr SWAP2
// stack: ptr, out, post_mllr, tate_mul1, tate_mul2, tate_mul3, retdest
// stack: ptr, out, retdest
PUSH post_mllr SWAP2 SWAP1
// stack: ptr, out, post_mllr, retdest
%jump(miller_init)
global post_mllr:
// stack: out, tate_mul1, tate_mul2, tate_mul3, retdest
DUP1
// stack: out, out, tate_mul1, tate_mul2, tate_mul3, retdest
// stack: out, retdest
PUSH tate_inv
// stack: tate_inv, out, retdest
PUSH 100
// stack: 100, out, out, tate_mul1, tate_mul2, tate_mul3, retdest
// stack: 100, tate_inv, out, retdest
DUP3
// stack: out, 100, tate_inv, out, retdest
%jump(inverse_fp12)
tate_inv:
// stack: out, retdest {100: inv}
PUSH tate_mul1
// stack: tate_mul1, out, retdest {100: inv}
DUP2
// stack: out, 100, out, out, tate_mul1, tate_mul2, tate_mul3, retdest
// %inverse_fp12
// stack: 100, out, tate_mul1, tate_mul2, tate_mul3, retdest {100: inv}
// stack: out, tate_mul1, out, retdest {100: inv}
PUSH 100
// stack: 100, out, tate_mul1, out, retdest {100: inv}
DUP2
// stack: out, 100, out, tate_mul1, tate_mul2, tate_mul3, retdest {100: inv}
// stack: out, 100, out, tate_mul1, out, retdest {100: inv}
%frob_fp12_6
// stack: out, 100, out, tate_mul1, tate_mul2, tate_mul3, retdest {100: inv}
// stack: out, 100, out, tate_mul1, out, retdest {100: inv}
%jump(mul_fp12)
tate_mul1:
// stack: out, tate_mul2, tate_mul3, retdest {100: inv}
DUP1
// stack: out, out, tate_mul2, tate_mul3, retdest {100: inv}
PUSH 100
// stack: 100, out, out, tate_mul2, tate_mul3, retdest {100: inv}
// stack: out, retdest {100: inv}
PUSH tate_mul2
// stack: tate_mul2, out, retdest {100: inv}
DUP2
// stack: out, 100, out, out, tate_mul2, tate_mul3, retdest {100: inv}
// stack: out, tate_mul2, out, retdest {100: inv}
PUSH 100
// stack: 100, out, tate_mul2, out, retdest {100: inv}
DUP2
// stack: out, 100, out, tate_mul2, out, retdest {100: inv}
%frob_fp12_2
// stack: 100, out, out, tate_mul2, tate_mul3, retdest {100: inv}
// stack: out, 100, out, tate_mul2, out, retdest {100: inv}
%jump(mul_fp12)
tate_mul2:
// stack: out, tate_mul3, retdest {100: acc}
// stack: out, retdest {100: acc}
PUSH post_pow
// stack: post_pow, out, tate_mul3, retdest {100: acc}
// stack: post_pow, out, retdest {100: acc}
PUSH 100
// stack: 100, post_pow, out, tate_mul3, retdest {100: acc}
// stack: 100, post_pow, out, retdest {100: acc}
DUP3
// stack: out, 100, post_pow, out, tate_mul3, retdest {100: acc}
// %jump(power)
// stack: out, 100, post_pow, out, retdest {100: acc}
%jump(power)
post_pow:
// stack: 100, out, tate_mul3, retdest {100: pow}
// stack: out, retdest {100: pow}
PUSH 100
// stack: 100, out, retdest {100: pow}
DUP2
// stack: out, 100, out, tate_mul3, retdest {100: pow}
// stack: out, 100, out, retdest {100: pow}
%frob_fp12_3
// stack: out, 100, out, tate_mul3, retdest {100: pow}
// stack: out, 100, out, retdest {100: pow}
%jump(mul_fp12)
tate_mul3:
// stack: out, retdest {100: pow}
SWAP1 JUMP

View File

@ -173,7 +173,7 @@ ret_3:
// stack: out, sh(f'g') + fg, inB, out {0: sh(f'g'), 6: f'g', 12: fg}
%store_fp6
// stack: inB, out {0: sh(f'g'), 6: f'g', 12: fg}
POP SWAP1 JUMP
%pop2 JUMP
//////////////////////////////////////
@ -303,7 +303,7 @@ global mul_fp12_sparse:
// stack: out', G1 * sh(f') + G2 * sh(f) + g0 * f', inA, inB, out
%store_fp6
// stack: inA, inB, out
%pop2 SWAP1 JUMP
%pop3 JUMP
/// global mul_fp12_sparse_fast:
/// // stack: inA, inB, out
@ -447,4 +447,4 @@ post_sq2:
// stack: out, ff + sh(f'f'), inp, out
%store_fp6
// stack: inp, out
POP SWAP1 JUMP
%pop2 JUMP