stack macro

This commit is contained in:
Dmitry Vagner 2023-02-08 09:10:17 -08:00
parent 361d6d7262
commit cecad5980d
3 changed files with 7 additions and 8 deletions

View File

@ -95,7 +95,7 @@ mul_fp254_12_2:
// stack: fg, g+g', f', inA, inB, out {0: sh(f'g'), 6: f'g'}
%store_fp254_6(12)
// stack: g+g', f', inA, inB, out {0: sh(f'g'), 6: f'g', 12: fg}
%swap_fp254_6
%stack (x: 6, y: 6) -> (y, x)
// stack: f', g+g', inA, inB, out {0: sh(f'g'), 6: f'g', 12: fg}
PUSH mul_fp254_12_3
// stack: mul_fp254_12_3, f', g+g', inA, inB, out {0: sh(f'g'), 6: f'g', 12: fg}
@ -110,7 +110,7 @@ mul_fp254_12_3:
// stack: (f+f')(g+g'), inB, out {0: sh(f'g'), 6: f'g', 12: fg}
%load_fp254_6(12)
// stack: fg, (f+f')(g+g'), inB, out {0: sh(f'g'), 6: f'g', 12: fg}
%swap_fp254_6
%stack (x: 6, y: 6) -> (y, x)
// stack: (f+f')(g+g'), fg, inB, out {0: sh(f'g'), 6: f'g', 12: fg}
%dup_fp254_6_6
// stack: fg, (f+f')(g+g'), fg, inB, out {0: sh(f'g'), 6: f'g', 12: fg}
@ -213,7 +213,7 @@ global mul_fp254_12_sparse:
// stack: g0 , f, f', inB, f, inB, f', out, f, inB, f', inA, inB, out
%mul_fp254__fp254_6
// stack: g0 * f, f', inB, f, inB, f', out, f, inB, f', inA, inB, out
%swap_fp254_6
%stack (x: 6, y: 6) -> (y, x)
// stack: f' , g0 * f, inB, f, inB, f', out, f, inB, f', inA, inB, out
DUP13
%add_const(8)

View File

@ -250,12 +250,12 @@ global test_frob_fp254_6_3:
%macro frobt1_2
PUSH 0x30644e72e131a0295e6dd9e7e0acccb0c28f069fbb966e3de4bd44e5607cfd48
%mul_fp254__fp254_2
%scale_fp254_2
%endmacro
%macro frobt2_2
PUSH 0x59e26bcea0d48bacd4f263f1acdb5c4f5763473177fffffe
%mul_fp254__fp254_2
%scale_fp254_2
%endmacro

View File

@ -23,7 +23,7 @@
// stack: a, -b
%endmacro
%macro mul_fp254__fp254_2
%macro scale_fp254_2
// stack: c, x, y
SWAP2
// stack: y, x, c
@ -88,7 +88,6 @@
// fp254_6 macros
// cost: 6 loads + 6 dup/swaps + 5 adds = 6*4 + 6*1 + 5*2 = 40
%macro load_fp254_6
// stack: ptr
DUP1
@ -512,7 +511,7 @@
// cost: 18
// add two fp254_6 elements with a to-be-popped stack term separating them
// (f: 6, X, g: 6) -> (f + g: 6)
// (f: 6, X, g: 6) -> (f + g)
%macro add_fp254_6_hole
// stack: f0, f1, f2, f3, f4, f5, X, g0, g1, g2, g3, g4, g5
SWAP8