arnaucube
arnaucube/circomPublic Self-hosted repository
circom/ports/c/buildasm/utils.asm.ejs
ports/c/buildasm/utils.asm.ejsRaw
 1<% global.setTypeDest = function (t) {
 2return (
 3`        mov r11b, ${t}
 4        shl r11d, 24
 5        mov [rdi+4], r11d`);
 6} %>
 7
 8
 9<% global.toMont_a = function () {
10return (
11`        push rdi
12        mov  rdi, rsi
13        mov  rsi, rdx
14        call ${name}_toMontgomery
15        mov  rdx, rsi
16        mov  rsi, rdi
17        pop  rdi`);
18} %>
19
20<% global.toMont_b = function() {
21return (
22`        push rdi
23        mov  rdi, rdx
24        call ${name}_toMontgomery
25        mov  rdx, rdi
26        pop  rdi`);
27} %>
28
29<% global.fromMont_a = function () {
30return (
31`        push rdi
32        mov  rdi, rsi
33        mov  rsi, rdx
34        call ${name}_toNormal
35        mov  rdx, rsi
36        mov  rsi, rdi
37        pop  rdi`);
38} %>
39
40<% global.fromMont_b = function() {
41return (
42`        push rdi
43        mov  rdi, rdx
44        call ${name}_toNormal
45        mov  rdx, rdi
46        pop  rdi`);
47} %>
48
49<% global.toLong_a = function () {
50return (
51`        push  rdi
52        push  rdx
53        mov   rdi, rsi
54        movsx rsi, r8d
55        call  rawCopyS2L
56        mov   rsi, rdi
57        pop   rdx
58        pop   rdi`);
59} %>
60
61<% global.toLong_b = function() {
62return (
63`        push  rdi
64        push   rsi
65        mov   rdi, rdx
66        movsx rsi, r9d
67        call  rawCopyS2L
68        mov   rdx, rdi
69        pop   rsi
70        pop   rdi`);
71} %>
72