replace mul_const

This commit is contained in:
Dmitry Vagner 2022-10-18 12:47:31 -04:00
parent eb4f8fec45
commit 6451190d76
2 changed files with 28 additions and 26 deletions

View File

@ -17,15 +17,15 @@ return_on_stack:
/// macro | num | ops | cost
/// -------------------------
/// load | 8 | 40 | 320
/// store | 5 | 40 | 200
/// dup | 5 | 6 | 30
/// swap | 4 | 16 | 64
/// add | 3 | 16 | 48
/// sub | 2 | 17 | 34
/// mul | 3 | 156 | 468
/// i9 | 1 | 9 | 9
/// jump | 1 | 1 | 1
/// load | 8 | 40 | 320
/// store | 5 | 40 | 200
/// dup | 5 | 6 | 30
/// swap | 4 | 16 | 64
/// add | 3 | 16 | 48
/// sub | 2 | 17 | 34
/// mul | 3 | 156 | 468
/// i9 | 1 | 9 | 9
/// jump | 1 | 1 | 1
///
/// TOTAL: 1174

View File

@ -84,6 +84,24 @@
// stack:
%endmacro
// cost: 9; note this returns y, x for x + yi
%macro i9
// stack: a , b
DUP2
DUP2
// stack: a , b, a , b
PUSH 9
MULFP254
SUBFP254
// stack: 9a - b, a , b
SWAP2
// stack: b , a, 9a - b
PUSH 9
MULFP254
ADDFP254
// stack: 9b + a, 9a - b
%endmacro
// cost: 6
%macro dup1_fp6
// stack: f: 6
@ -190,22 +208,6 @@
// stack: h0, h1, h2, h3, h4, h5
%endmacro
// cost: 9; note this returns y, x for x + yi
%macro i9
// stack: a , b
DUP2
DUP2
// stack: a , b, a , b
%mul_const(9)
SUBFP254
// stack: 9a - b, a , b
SWAP2
// stack: b , a, 9a - b
%mul_const(9)
ADDFP254
// stack: 9b + a, 9a - b
%endmacro
// cost: 156
%macro mul_fp6
/// E = E0 + E1t + E2t^2 = CD