richer comments

This commit is contained in:
Dmitry Vagner 2022-10-20 16:48:31 -04:00
parent 7d4cec55fb
commit 1c2fab6718
2 changed files with 49 additions and 46 deletions

View File

@ -1,18 +1,21 @@
global test_mul_Fp12:
// stack: f, f', g, g', in2, out, in1
%store_fp6(0)
%store_fp6(6)
%store_fp6(12)
%store_fp6(18)
// stack: in2, out, in1
// stack: in0, f, in0', f', in1, g, in1', g', in1, out, in0, out
%store_fp6
%store_fp6
%store_fp6
%store_fp6
// stack: in1, out, in0, out
PUSH return_on_stack
SWAP3
// stack: in1, in2, out, return_on_stack
// stack: in0, in1, out, return_on_stack, out
%jump(mul_Fp12)
return_on_stack:
// stack:
%load_fp6(30)
%load_fp6(24)
// stack: out
DUP1
%add_const(6)
// stack: out', out
%load_fp6
%load_fp6
// stack: h, h'
%jump(0xdeadbeef)
@ -52,84 +55,84 @@ return_on_stack:
/// Note: f, f', g, g' consist of six terms on the stack
global mul_Fp12:
// stack: in1, in2, out
// stack: in0, in1, out
DUP1
%add_const(6)
%load_fp6
// stack: f', in1, in2, out
// stack: f', in0, in1, out
DUP7
%add_const(6)
%load_fp6
// stack: g', f', in1, in2, out
// stack: g', f', in0, in1, out
PUSH post_mul_1
%dup_fp6_7
// stack: f', post_mul_1, g', f', in1, in2, out
// stack: f', post_mul_1, g', f', in0, in1, out
%dup_fp6_7
// stack: g', f', post_mul_1, g', f', in1, in2, out
// stack: g', f', post_mul_1, g', f', in0, in1, out
%jump(mul_fp6)
post_mul_1:
// stack: f'g', g' , f', in1, in2, out
// stack: f'g', g' , f', in0, in1, out
%dup_fp6_0
// stack: f'g', f'g', g' , f', in1, in2, out
%store_fp6_sh(36)
// stack: f'g', g' , f', in1, in2, out
// stack: f'g', f'g', g' , f', in0, in1, out
%store_fp6_sh(36)
// stack: f'g', g' , f', in0, in1, out {36: sh(f'g')}
%store_fp6(42)
// stack: g' , f', in1, in2, out
// stack: g' , f', in0, in1, out {36: sh(f'g'), 42: f'g'}
DUP13
// stack: in1, g' , f', in1, in2, out
// stack: in0, g' , f', in0, in1, out {36: sh(f'g'), 42: f'g'}
DUP15
%load_fp6
// stack: g , in1, g' , f', in1, in2, out
// stack: g , in0, g' , f', in0, in1, out {36: sh(f'g'), 42: f'g'}
%swap_fp6_hole
// stack: g', in1, g , f', in1, in2, out
// stack: g', in0, g , f', in0, in1, out {36: sh(f'g'), 42: f'g'}
dup_fp6_7
// stack: g,g', in1, g , f', in1, in2, out
// stack: g,g', in0, g , f', in0, in1, out {36: sh(f'g'), 42: f'g'}
%add_fp6
// stack: g+g', in1, g , f', in1, in2, out
// stack: g+g', in0, g , f', in0, in1, out {36: sh(f'g'), 42: f'g'}
%swap_fp6_hole
// stack: g, in1, g+g', f', in1, in2, out
// stack: g, in0, g+g', f', in0, in1, out {36: sh(f'g'), 42: f'g'}
PUSH post_mul_2
SWAP7
%load_fp6
// stack: f, g, post_mul_2, g+g', f', in1, in2, out
// stack: f, g, post_mul_2, g+g', f', in0, in1, out {36: sh(f'g'), 42: f'g'}
%jump(mul_fp6)
post_mul_2:
// stack: fg, g+g', f', in1, in2, out
// stack: fg, g+g', f', in0, in1, out {36: sh(f'g'), 42: f'g'}
%store_fp6(48)
// stack: g+g', f', in1, in2, out
// stack: g+g', f', in0, in1, out {36: sh(f'g'), 42: f'g', 48: fg}
%swap_fp6
// stack: f', g+g', in1, in2, out
// stack: f', g+g', in0, in1, out {36: sh(f'g'), 42: f'g', 48: fg}
PUSH post_mul_3
SWAP13
%load_fp6
// stack: f,f', g+g', post_mul_3, in2, out
// stack: f,f', g+g', post_mul_3, in1, out {36: sh(f'g'), 42: f'g', 48: fg}
%add_fp6
// stack: f+f', g+g', post_mul_3, in2, out
// stack: f+f', g+g', post_mul_3, in1, out {36: sh(f'g'), 42: f'g', 48: fg}
%jump(mul_fp6)
post_mul_3:
// stack: (f+f')(g+g'), in2, out
%load_fp6(42)
// stack: f'g', (f+f')(g+g'), in2, out
%subr_fp6
// stack: (f+f')(g+g') - f'g', in2, out
// stack: (f+f')(g+g'), in1, out {36: sh(f'g'), 42: f'g', 48: fg}
%load_fp6(48)
// stack: fg, (f+f')(g+g') - f'g', in2, out
// stack: fg, (f+f')(g+g'), in1, out {36: sh(f'g'), 42: f'g', 48: fg}
%swap_fp6
// stack: (f+f')(g+g') - f'g', fg, in2, out
// stack: (f+f')(g+g'), fg, in1, out {36: sh(f'g'), 42: f'g', 48: fg}
%dup_fp6_6
// stack: fg, (f+f')(g+g') - f'g', fg, in2, out
// stack: fg, (f+f')(g+g'), fg, in1, out {36: sh(f'g'), 42: f'g', 48: fg}
%load_fp6(42)
// stack: f'g',fg, (f+f')(g+g'), fg, in1, out {36: sh(f'g'), 42: f'g', 48: fg}
%add_fp6
// stack: f'g'+fg, (f+f')(g+g'), fg, in1, out {36: sh(f'g'), 42: f'g', 48: fg}
%subr_fp6
// stack: (f+f')(g+g') - f'g' - fg, fg, in2, out
// stack: (f+f')(g+g') - (f'g'+fg), fg, in1, out {36: sh(f'g'), 42: f'g', 48: fg}
DUP14
add_const(6)
%store_fp6
// stack: fg, in2, out
// stack: fg, in1, out {36: sh(f'g'), 42: f'g', 48: fg}
%load_fp6(36)
// stack: sh(f'g') , fg, in2, out
// stack: sh(f'g') , fg, in1, out {36: sh(f'g'), 42: f'g', 48: fg}
%add_fp6
// stack: sh(f'g') + fg, in2, out
// stack: sh(f'g') + fg, in1, out {36: sh(f'g'), 42: f'g', 48: fg}
DUP8
%store_fp6
// stack: in2, out
// stack: in1, out {36: sh(f'g'), 42: f'g', 48: fg}
%pop2
JUMP

View File

@ -152,7 +152,7 @@
// stack:
%endmacro
// cost: 9; note this returns y, x for x + yi
// cost: 9; note this returns y, x for the output x + yi
%macro i9
// stack: a , b
DUP2