diff --git a/evm/src/cpu/kernel/asm/fields/Fp12.asm b/evm/src/cpu/kernel/asm/fields/Fp12.asm index 19a9a5d2..c2173b55 100644 --- a/evm/src/cpu/kernel/asm/fields/Fp12.asm +++ b/evm/src/cpu/kernel/asm/fields/Fp12.asm @@ -1,14 +1,3 @@ -/// F = f + f'z -/// G = g + g'z -/// -/// h + h'z = FG -/// -/// h = fg + sh(f'g') -/// h' = (f+f')(g+g') - fg - f'g' -/// -/// Note: each symbol in the stack comments consists of six words - - global test_mul_Fp12: // stack: f, f', g, g' %store_fp6(0) @@ -26,6 +15,31 @@ return_on_stack: %jump(0xdeadbeef) +/// 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 +/// +/// TOTAL: 1174 + + +/// F = f + f'z +/// G = g + g'z +/// +/// H = h + h'z = FG +/// +/// h = fg + sh(f'g') +/// h' = (f+f')(g+g') - fg - f'g' +/// +/// Note: each symbol in the stack comments consists of six words + global mul_Fp12: %load_fp6(6) %load_fp6(18) diff --git a/evm/src/cpu/kernel/asm/fields/Fp6.asm b/evm/src/cpu/kernel/asm/fields/Fp6.asm index b39a8c24..739445e5 100644 --- a/evm/src/cpu/kernel/asm/fields/Fp6.asm +++ b/evm/src/cpu/kernel/asm/fields/Fp6.asm @@ -54,7 +54,7 @@ // stack: %endmacro -// cost: 49 +// cost: store (40) + i9 (9) = 49 %macro store_fp6_sh(offset) // stack: x0, x1, x2, x3, x4, x5 PUSH $offset