sc25519_barrett.S 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188
  1. # qhasm: int64 rp
  2. # qhasm: int64 xp
  3. # qhasm: input rp
  4. # qhasm: input xp
  5. # qhasm: int64 caller1
  6. # qhasm: int64 caller2
  7. # qhasm: int64 caller3
  8. # qhasm: int64 caller4
  9. # qhasm: int64 caller5
  10. # qhasm: int64 caller6
  11. # qhasm: int64 caller7
  12. # qhasm: caller caller1
  13. # qhasm: caller caller2
  14. # qhasm: caller caller3
  15. # qhasm: caller caller4
  16. # qhasm: caller caller5
  17. # qhasm: caller caller6
  18. # qhasm: caller caller7
  19. # qhasm: stack64 caller1_stack
  20. # qhasm: stack64 caller2_stack
  21. # qhasm: stack64 caller3_stack
  22. # qhasm: stack64 caller4_stack
  23. # qhasm: stack64 caller5_stack
  24. # qhasm: stack64 caller6_stack
  25. # qhasm: stack64 caller7_stack
  26. # qhasm: int64 q23
  27. # qhasm: int64 q24
  28. # qhasm: int64 q30
  29. # qhasm: int64 q31
  30. # qhasm: int64 q32
  31. # qhasm: int64 q33
  32. # qhasm: int64 r20
  33. # qhasm: int64 r21
  34. # qhasm: int64 r22
  35. # qhasm: int64 r23
  36. # qhasm: int64 r24
  37. # qhasm: int64 r0
  38. # qhasm: int64 r1
  39. # qhasm: int64 r2
  40. # qhasm: int64 r3
  41. # qhasm: int64 t0
  42. # qhasm: int64 t1
  43. # qhasm: int64 t2
  44. # qhasm: int64 t3
  45. # qhasm: int64 rax
  46. # qhasm: int64 rdx
  47. # qhasm: int64 c
  48. # qhasm: int64 zero
  49. # qhasm: int64 mask
  50. # qhasm: int64 nmask
  51. # qhasm: stack64 q30_stack
  52. # qhasm: stack64 q31_stack
  53. # qhasm: stack64 q32_stack
  54. # qhasm: stack64 q33_stack
  55. # qhasm: enter CRYPTO_NAMESPACE(sc25519_barrett)
  56. .text
  57. .p2align 5
  58. .globl _CRYPTO_NAMESPACE(sc25519_barrett)
  59. .globl CRYPTO_NAMESPACE(sc25519_barrett)
  60. _CRYPTO_NAMESPACE(sc25519_barrett):
  61. CRYPTO_NAMESPACE(sc25519_barrett):
  62. mov %rsp,%r11
  63. and $31,%r11
  64. add $96,%r11
  65. sub %r11,%rsp
  66. # qhasm: caller1_stack = caller1
  67. # asm 1: movq <caller1=int64#9,>caller1_stack=stack64#1
  68. # asm 2: movq <caller1=%r11,>caller1_stack=0(%rsp)
  69. movq %r11,0(%rsp)
  70. # qhasm: caller2_stack = caller2
  71. # asm 1: movq <caller2=int64#10,>caller2_stack=stack64#2
  72. # asm 2: movq <caller2=%r12,>caller2_stack=8(%rsp)
  73. movq %r12,8(%rsp)
  74. # qhasm: caller3_stack = caller3
  75. # asm 1: movq <caller3=int64#11,>caller3_stack=stack64#3
  76. # asm 2: movq <caller3=%r13,>caller3_stack=16(%rsp)
  77. movq %r13,16(%rsp)
  78. # qhasm: caller4_stack = caller4
  79. # asm 1: movq <caller4=int64#12,>caller4_stack=stack64#4
  80. # asm 2: movq <caller4=%r14,>caller4_stack=24(%rsp)
  81. movq %r14,24(%rsp)
  82. # qhasm: caller5_stack = caller5
  83. # asm 1: movq <caller5=int64#13,>caller5_stack=stack64#5
  84. # asm 2: movq <caller5=%r15,>caller5_stack=32(%rsp)
  85. movq %r15,32(%rsp)
  86. # qhasm: caller6_stack = caller6
  87. # asm 1: movq <caller6=int64#14,>caller6_stack=stack64#6
  88. # asm 2: movq <caller6=%rbx,>caller6_stack=40(%rsp)
  89. movq %rbx,40(%rsp)
  90. # qhasm: caller7_stack = caller7
  91. # asm 1: movq <caller7=int64#15,>caller7_stack=stack64#7
  92. # asm 2: movq <caller7=%rbp,>caller7_stack=48(%rsp)
  93. movq %rbp,48(%rsp)
  94. # qhasm: zero ^= zero
  95. # asm 1: xor <zero=int64#4,<zero=int64#4
  96. # asm 2: xor <zero=%rcx,<zero=%rcx
  97. xor %rcx,%rcx
  98. # qhasm: q30 ^= q30
  99. # asm 1: xor <q30=int64#5,<q30=int64#5
  100. # asm 2: xor <q30=%r8,<q30=%r8
  101. xor %r8,%r8
  102. # qhasm: q31 ^= q31
  103. # asm 1: xor <q31=int64#6,<q31=int64#6
  104. # asm 2: xor <q31=%r9,<q31=%r9
  105. xor %r9,%r9
  106. # qhasm: q32 ^= q32
  107. # asm 1: xor <q32=int64#8,<q32=int64#8
  108. # asm 2: xor <q32=%r10,<q32=%r10
  109. xor %r10,%r10
  110. # qhasm: q33 ^= q33
  111. # asm 1: xor <q33=int64#9,<q33=int64#9
  112. # asm 2: xor <q33=%r11,<q33=%r11
  113. xor %r11,%r11
  114. # qhasm: rax = *(uint64 *)(xp + 24)
  115. # asm 1: movq 24(<xp=int64#2),>rax=int64#7
  116. # asm 2: movq 24(<xp=%rsi),>rax=%rax
  117. movq 24(%rsi),%rax
  118. # qhasm: (uint128) rdx rax = rax * *(uint64 *) &CRYPTO_NAMESPACE(MU3)
  119. mulq CRYPTO_NAMESPACE(MU3)(%rip)
  120. # qhasm: q23 = rax
  121. # asm 1: mov <rax=int64#7,>q23=int64#10
  122. # asm 2: mov <rax=%rax,>q23=%r12
  123. mov %rax,%r12
  124. # qhasm: c = rdx
  125. # asm 1: mov <rdx=int64#3,>c=int64#11
  126. # asm 2: mov <rdx=%rdx,>c=%r13
  127. mov %rdx,%r13
  128. # qhasm: rax = *(uint64 *)(xp + 24)
  129. # asm 1: movq 24(<xp=int64#2),>rax=int64#7
  130. # asm 2: movq 24(<xp=%rsi),>rax=%rax
  131. movq 24(%rsi),%rax
  132. # qhasm: (uint128) rdx rax = rax * *(uint64 *) &CRYPTO_NAMESPACE(MU4)
  133. mulq CRYPTO_NAMESPACE(MU4)(%rip)
  134. # qhasm: q24 = rax
  135. # asm 1: mov <rax=int64#7,>q24=int64#12
  136. # asm 2: mov <rax=%rax,>q24=%r14
  137. mov %rax,%r14
  138. # qhasm: carry? q24 += c
  139. # asm 1: add <c=int64#11,<q24=int64#12
  140. # asm 2: add <c=%r13,<q24=%r14
  141. add %r13,%r14
  142. # qhasm: q30 += rdx + carry
  143. # asm 1: adc <rdx=int64#3,<q30=int64#5
  144. # asm 2: adc <rdx=%rdx,<q30=%r8
  145. adc %rdx,%r8
  146. # qhasm: rax = *(uint64 *)(xp + 32)
  147. # asm 1: movq 32(<xp=int64#2),>rax=int64#7
  148. # asm 2: movq 32(<xp=%rsi),>rax=%rax
  149. movq 32(%rsi),%rax
  150. # qhasm: (uint128) rdx rax = rax * *(uint64 *) &CRYPTO_NAMESPACE(MU2)
  151. mulq CRYPTO_NAMESPACE(MU2)(%rip)
  152. # qhasm: carry? q23 += rax
  153. # asm 1: add <rax=int64#7,<q23=int64#10
  154. # asm 2: add <rax=%rax,<q23=%r12
  155. add %rax,%r12
  156. # qhasm: c = 0
  157. # asm 1: mov $0,>c=int64#11
  158. # asm 2: mov $0,>c=%r13
  159. mov $0,%r13
  160. # qhasm: c += rdx + carry
  161. # asm 1: adc <rdx=int64#3,<c=int64#11
  162. # asm 2: adc <rdx=%rdx,<c=%r13
  163. adc %rdx,%r13
  164. # qhasm: rax = *(uint64 *)(xp + 32)
  165. # asm 1: movq 32(<xp=int64#2),>rax=int64#7
  166. # asm 2: movq 32(<xp=%rsi),>rax=%rax
  167. movq 32(%rsi),%rax
  168. # qhasm: (uint128) rdx rax = rax * *(uint64 *) &CRYPTO_NAMESPACE(MU3)
  169. mulq CRYPTO_NAMESPACE(MU3)(%rip)
  170. # qhasm: carry? q24 += rax
  171. # asm 1: add <rax=int64#7,<q24=int64#12
  172. # asm 2: add <rax=%rax,<q24=%r14
  173. add %rax,%r14
  174. # qhasm: rdx += zero + carry
  175. # asm 1: adc <zero=int64#4,<rdx=int64#3
  176. # asm 2: adc <zero=%rcx,<rdx=%rdx
  177. adc %rcx,%rdx
  178. # qhasm: carry? q24 += c
  179. # asm 1: add <c=int64#11,<q24=int64#12
  180. # asm 2: add <c=%r13,<q24=%r14
  181. add %r13,%r14
  182. # qhasm: c = 0
  183. # asm 1: mov $0,>c=int64#11
  184. # asm 2: mov $0,>c=%r13
  185. mov $0,%r13
  186. # qhasm: c += rdx + carry
  187. # asm 1: adc <rdx=int64#3,<c=int64#11
  188. # asm 2: adc <rdx=%rdx,<c=%r13
  189. adc %rdx,%r13
  190. # qhasm: rax = *(uint64 *)(xp + 32)
  191. # asm 1: movq 32(<xp=int64#2),>rax=int64#7
  192. # asm 2: movq 32(<xp=%rsi),>rax=%rax
  193. movq 32(%rsi),%rax
  194. # qhasm: (uint128) rdx rax = rax * *(uint64 *) &CRYPTO_NAMESPACE(MU4)
  195. mulq CRYPTO_NAMESPACE(MU4)(%rip)
  196. # qhasm: carry? q30 += rax
  197. # asm 1: add <rax=int64#7,<q30=int64#5
  198. # asm 2: add <rax=%rax,<q30=%r8
  199. add %rax,%r8
  200. # qhasm: rdx += zero + carry
  201. # asm 1: adc <zero=int64#4,<rdx=int64#3
  202. # asm 2: adc <zero=%rcx,<rdx=%rdx
  203. adc %rcx,%rdx
  204. # qhasm: carry? q30 += c
  205. # asm 1: add <c=int64#11,<q30=int64#5
  206. # asm 2: add <c=%r13,<q30=%r8
  207. add %r13,%r8
  208. # qhasm: q31 += rdx + carry
  209. # asm 1: adc <rdx=int64#3,<q31=int64#6
  210. # asm 2: adc <rdx=%rdx,<q31=%r9
  211. adc %rdx,%r9
  212. # qhasm: rax = *(uint64 *)(xp + 40)
  213. # asm 1: movq 40(<xp=int64#2),>rax=int64#7
  214. # asm 2: movq 40(<xp=%rsi),>rax=%rax
  215. movq 40(%rsi),%rax
  216. # qhasm: (uint128) rdx rax = rax * *(uint64 *) &CRYPTO_NAMESPACE(MU1)
  217. mulq CRYPTO_NAMESPACE(MU1)(%rip)
  218. # qhasm: carry? q23 += rax
  219. # asm 1: add <rax=int64#7,<q23=int64#10
  220. # asm 2: add <rax=%rax,<q23=%r12
  221. add %rax,%r12
  222. # qhasm: c = 0
  223. # asm 1: mov $0,>c=int64#11
  224. # asm 2: mov $0,>c=%r13
  225. mov $0,%r13
  226. # qhasm: c += rdx + carry
  227. # asm 1: adc <rdx=int64#3,<c=int64#11
  228. # asm 2: adc <rdx=%rdx,<c=%r13
  229. adc %rdx,%r13
  230. # qhasm: rax = *(uint64 *)(xp + 40)
  231. # asm 1: movq 40(<xp=int64#2),>rax=int64#7
  232. # asm 2: movq 40(<xp=%rsi),>rax=%rax
  233. movq 40(%rsi),%rax
  234. # qhasm: (uint128) rdx rax = rax * *(uint64 *) &CRYPTO_NAMESPACE(MU2)
  235. mulq CRYPTO_NAMESPACE(MU2)(%rip)
  236. # qhasm: carry? q24 += rax
  237. # asm 1: add <rax=int64#7,<q24=int64#12
  238. # asm 2: add <rax=%rax,<q24=%r14
  239. add %rax,%r14
  240. # qhasm: rdx += zero + carry
  241. # asm 1: adc <zero=int64#4,<rdx=int64#3
  242. # asm 2: adc <zero=%rcx,<rdx=%rdx
  243. adc %rcx,%rdx
  244. # qhasm: carry? q24 += c
  245. # asm 1: add <c=int64#11,<q24=int64#12
  246. # asm 2: add <c=%r13,<q24=%r14
  247. add %r13,%r14
  248. # qhasm: c = 0
  249. # asm 1: mov $0,>c=int64#11
  250. # asm 2: mov $0,>c=%r13
  251. mov $0,%r13
  252. # qhasm: c += rdx + carry
  253. # asm 1: adc <rdx=int64#3,<c=int64#11
  254. # asm 2: adc <rdx=%rdx,<c=%r13
  255. adc %rdx,%r13
  256. # qhasm: rax = *(uint64 *)(xp + 40)
  257. # asm 1: movq 40(<xp=int64#2),>rax=int64#7
  258. # asm 2: movq 40(<xp=%rsi),>rax=%rax
  259. movq 40(%rsi),%rax
  260. # qhasm: (uint128) rdx rax = rax * *(uint64 *) &CRYPTO_NAMESPACE(MU3)
  261. mulq CRYPTO_NAMESPACE(MU3)(%rip)
  262. # qhasm: carry? q30 += rax
  263. # asm 1: add <rax=int64#7,<q30=int64#5
  264. # asm 2: add <rax=%rax,<q30=%r8
  265. add %rax,%r8
  266. # qhasm: rdx += zero + carry
  267. # asm 1: adc <zero=int64#4,<rdx=int64#3
  268. # asm 2: adc <zero=%rcx,<rdx=%rdx
  269. adc %rcx,%rdx
  270. # qhasm: carry? q30 += c
  271. # asm 1: add <c=int64#11,<q30=int64#5
  272. # asm 2: add <c=%r13,<q30=%r8
  273. add %r13,%r8
  274. # qhasm: c = 0
  275. # asm 1: mov $0,>c=int64#11
  276. # asm 2: mov $0,>c=%r13
  277. mov $0,%r13
  278. # qhasm: c += rdx + carry
  279. # asm 1: adc <rdx=int64#3,<c=int64#11
  280. # asm 2: adc <rdx=%rdx,<c=%r13
  281. adc %rdx,%r13
  282. # qhasm: rax = *(uint64 *)(xp + 40)
  283. # asm 1: movq 40(<xp=int64#2),>rax=int64#7
  284. # asm 2: movq 40(<xp=%rsi),>rax=%rax
  285. movq 40(%rsi),%rax
  286. # qhasm: (uint128) rdx rax = rax * *(uint64 *) &CRYPTO_NAMESPACE(MU4)
  287. mulq CRYPTO_NAMESPACE(MU4)(%rip)
  288. # qhasm: carry? q31 += rax
  289. # asm 1: add <rax=int64#7,<q31=int64#6
  290. # asm 2: add <rax=%rax,<q31=%r9
  291. add %rax,%r9
  292. # qhasm: rdx += zero + carry
  293. # asm 1: adc <zero=int64#4,<rdx=int64#3
  294. # asm 2: adc <zero=%rcx,<rdx=%rdx
  295. adc %rcx,%rdx
  296. # qhasm: carry? q31 += c
  297. # asm 1: add <c=int64#11,<q31=int64#6
  298. # asm 2: add <c=%r13,<q31=%r9
  299. add %r13,%r9
  300. # qhasm: q32 += rdx + carry
  301. # asm 1: adc <rdx=int64#3,<q32=int64#8
  302. # asm 2: adc <rdx=%rdx,<q32=%r10
  303. adc %rdx,%r10
  304. # qhasm: rax = *(uint64 *)(xp + 48)
  305. # asm 1: movq 48(<xp=int64#2),>rax=int64#7
  306. # asm 2: movq 48(<xp=%rsi),>rax=%rax
  307. movq 48(%rsi),%rax
  308. # qhasm: (uint128) rdx rax = rax * *(uint64 *) &CRYPTO_NAMESPACE(MU0)
  309. mulq CRYPTO_NAMESPACE(MU0)(%rip)
  310. # qhasm: carry? q23 += rax
  311. # asm 1: add <rax=int64#7,<q23=int64#10
  312. # asm 2: add <rax=%rax,<q23=%r12
  313. add %rax,%r12
  314. # qhasm: c = 0
  315. # asm 1: mov $0,>c=int64#10
  316. # asm 2: mov $0,>c=%r12
  317. mov $0,%r12
  318. # qhasm: c += rdx + carry
  319. # asm 1: adc <rdx=int64#3,<c=int64#10
  320. # asm 2: adc <rdx=%rdx,<c=%r12
  321. adc %rdx,%r12
  322. # qhasm: rax = *(uint64 *)(xp + 48)
  323. # asm 1: movq 48(<xp=int64#2),>rax=int64#7
  324. # asm 2: movq 48(<xp=%rsi),>rax=%rax
  325. movq 48(%rsi),%rax
  326. # qhasm: (uint128) rdx rax = rax * *(uint64 *) &CRYPTO_NAMESPACE(MU1)
  327. mulq CRYPTO_NAMESPACE(MU1)(%rip)
  328. # qhasm: carry? q24 += rax
  329. # asm 1: add <rax=int64#7,<q24=int64#12
  330. # asm 2: add <rax=%rax,<q24=%r14
  331. add %rax,%r14
  332. # qhasm: rdx += zero + carry
  333. # asm 1: adc <zero=int64#4,<rdx=int64#3
  334. # asm 2: adc <zero=%rcx,<rdx=%rdx
  335. adc %rcx,%rdx
  336. # qhasm: carry? q24 += c
  337. # asm 1: add <c=int64#10,<q24=int64#12
  338. # asm 2: add <c=%r12,<q24=%r14
  339. add %r12,%r14
  340. # qhasm: c = 0
  341. # asm 1: mov $0,>c=int64#10
  342. # asm 2: mov $0,>c=%r12
  343. mov $0,%r12
  344. # qhasm: c += rdx + carry
  345. # asm 1: adc <rdx=int64#3,<c=int64#10
  346. # asm 2: adc <rdx=%rdx,<c=%r12
  347. adc %rdx,%r12
  348. # qhasm: rax = *(uint64 *)(xp + 48)
  349. # asm 1: movq 48(<xp=int64#2),>rax=int64#7
  350. # asm 2: movq 48(<xp=%rsi),>rax=%rax
  351. movq 48(%rsi),%rax
  352. # qhasm: (uint128) rdx rax = rax * *(uint64 *) &CRYPTO_NAMESPACE(MU2)
  353. mulq CRYPTO_NAMESPACE(MU2)(%rip)
  354. # qhasm: carry? q30 += rax
  355. # asm 1: add <rax=int64#7,<q30=int64#5
  356. # asm 2: add <rax=%rax,<q30=%r8
  357. add %rax,%r8
  358. # qhasm: rdx += zero + carry
  359. # asm 1: adc <zero=int64#4,<rdx=int64#3
  360. # asm 2: adc <zero=%rcx,<rdx=%rdx
  361. adc %rcx,%rdx
  362. # qhasm: carry? q30 += c
  363. # asm 1: add <c=int64#10,<q30=int64#5
  364. # asm 2: add <c=%r12,<q30=%r8
  365. add %r12,%r8
  366. # qhasm: c = 0
  367. # asm 1: mov $0,>c=int64#10
  368. # asm 2: mov $0,>c=%r12
  369. mov $0,%r12
  370. # qhasm: c += rdx + carry
  371. # asm 1: adc <rdx=int64#3,<c=int64#10
  372. # asm 2: adc <rdx=%rdx,<c=%r12
  373. adc %rdx,%r12
  374. # qhasm: rax = *(uint64 *)(xp + 48)
  375. # asm 1: movq 48(<xp=int64#2),>rax=int64#7
  376. # asm 2: movq 48(<xp=%rsi),>rax=%rax
  377. movq 48(%rsi),%rax
  378. # qhasm: (uint128) rdx rax = rax * *(uint64 *) &CRYPTO_NAMESPACE(MU3)
  379. mulq CRYPTO_NAMESPACE(MU3)(%rip)
  380. # qhasm: carry? q31 += rax
  381. # asm 1: add <rax=int64#7,<q31=int64#6
  382. # asm 2: add <rax=%rax,<q31=%r9
  383. add %rax,%r9
  384. # qhasm: rdx += zero + carry
  385. # asm 1: adc <zero=int64#4,<rdx=int64#3
  386. # asm 2: adc <zero=%rcx,<rdx=%rdx
  387. adc %rcx,%rdx
  388. # qhasm: carry? q31 += c
  389. # asm 1: add <c=int64#10,<q31=int64#6
  390. # asm 2: add <c=%r12,<q31=%r9
  391. add %r12,%r9
  392. # qhasm: c = 0
  393. # asm 1: mov $0,>c=int64#10
  394. # asm 2: mov $0,>c=%r12
  395. mov $0,%r12
  396. # qhasm: c += rdx + carry
  397. # asm 1: adc <rdx=int64#3,<c=int64#10
  398. # asm 2: adc <rdx=%rdx,<c=%r12
  399. adc %rdx,%r12
  400. # qhasm: rax = *(uint64 *)(xp + 48)
  401. # asm 1: movq 48(<xp=int64#2),>rax=int64#7
  402. # asm 2: movq 48(<xp=%rsi),>rax=%rax
  403. movq 48(%rsi),%rax
  404. # qhasm: (uint128) rdx rax = rax * *(uint64 *) &CRYPTO_NAMESPACE(MU4)
  405. mulq CRYPTO_NAMESPACE(MU4)(%rip)
  406. # qhasm: carry? q32 += rax
  407. # asm 1: add <rax=int64#7,<q32=int64#8
  408. # asm 2: add <rax=%rax,<q32=%r10
  409. add %rax,%r10
  410. # qhasm: rdx += zero + carry
  411. # asm 1: adc <zero=int64#4,<rdx=int64#3
  412. # asm 2: adc <zero=%rcx,<rdx=%rdx
  413. adc %rcx,%rdx
  414. # qhasm: carry? q32 += c
  415. # asm 1: add <c=int64#10,<q32=int64#8
  416. # asm 2: add <c=%r12,<q32=%r10
  417. add %r12,%r10
  418. # qhasm: q33 += rdx + carry
  419. # asm 1: adc <rdx=int64#3,<q33=int64#9
  420. # asm 2: adc <rdx=%rdx,<q33=%r11
  421. adc %rdx,%r11
  422. # qhasm: rax = *(uint64 *)(xp + 56)
  423. # asm 1: movq 56(<xp=int64#2),>rax=int64#7
  424. # asm 2: movq 56(<xp=%rsi),>rax=%rax
  425. movq 56(%rsi),%rax
  426. # qhasm: (uint128) rdx rax = rax * *(uint64 *) &CRYPTO_NAMESPACE(MU0)
  427. mulq CRYPTO_NAMESPACE(MU0)(%rip)
  428. # qhasm: carry? q24 += rax
  429. # asm 1: add <rax=int64#7,<q24=int64#12
  430. # asm 2: add <rax=%rax,<q24=%r14
  431. add %rax,%r14
  432. # qhasm: free q24
  433. # qhasm: c = 0
  434. # asm 1: mov $0,>c=int64#10
  435. # asm 2: mov $0,>c=%r12
  436. mov $0,%r12
  437. # qhasm: c += rdx + carry
  438. # asm 1: adc <rdx=int64#3,<c=int64#10
  439. # asm 2: adc <rdx=%rdx,<c=%r12
  440. adc %rdx,%r12
  441. # qhasm: rax = *(uint64 *)(xp + 56)
  442. # asm 1: movq 56(<xp=int64#2),>rax=int64#7
  443. # asm 2: movq 56(<xp=%rsi),>rax=%rax
  444. movq 56(%rsi),%rax
  445. # qhasm: (uint128) rdx rax = rax * *(uint64 *) &CRYPTO_NAMESPACE(MU1)
  446. mulq CRYPTO_NAMESPACE(MU1)(%rip)
  447. # qhasm: carry? q30 += rax
  448. # asm 1: add <rax=int64#7,<q30=int64#5
  449. # asm 2: add <rax=%rax,<q30=%r8
  450. add %rax,%r8
  451. # qhasm: rdx += zero + carry
  452. # asm 1: adc <zero=int64#4,<rdx=int64#3
  453. # asm 2: adc <zero=%rcx,<rdx=%rdx
  454. adc %rcx,%rdx
  455. # qhasm: carry? q30 += c
  456. # asm 1: add <c=int64#10,<q30=int64#5
  457. # asm 2: add <c=%r12,<q30=%r8
  458. add %r12,%r8
  459. # qhasm: c = 0
  460. # asm 1: mov $0,>c=int64#10
  461. # asm 2: mov $0,>c=%r12
  462. mov $0,%r12
  463. # qhasm: c += rdx + carry
  464. # asm 1: adc <rdx=int64#3,<c=int64#10
  465. # asm 2: adc <rdx=%rdx,<c=%r12
  466. adc %rdx,%r12
  467. # qhasm: q30_stack = q30
  468. # asm 1: movq <q30=int64#5,>q30_stack=stack64#8
  469. # asm 2: movq <q30=%r8,>q30_stack=56(%rsp)
  470. movq %r8,56(%rsp)
  471. # qhasm: rax = *(uint64 *)(xp + 56)
  472. # asm 1: movq 56(<xp=int64#2),>rax=int64#7
  473. # asm 2: movq 56(<xp=%rsi),>rax=%rax
  474. movq 56(%rsi),%rax
  475. # qhasm: (uint128) rdx rax = rax * *(uint64 *) &CRYPTO_NAMESPACE(MU2)
  476. mulq CRYPTO_NAMESPACE(MU2)(%rip)
  477. # qhasm: carry? q31 += rax
  478. # asm 1: add <rax=int64#7,<q31=int64#6
  479. # asm 2: add <rax=%rax,<q31=%r9
  480. add %rax,%r9
  481. # qhasm: rdx += zero + carry
  482. # asm 1: adc <zero=int64#4,<rdx=int64#3
  483. # asm 2: adc <zero=%rcx,<rdx=%rdx
  484. adc %rcx,%rdx
  485. # qhasm: carry? q31 += c
  486. # asm 1: add <c=int64#10,<q31=int64#6
  487. # asm 2: add <c=%r12,<q31=%r9
  488. add %r12,%r9
  489. # qhasm: c = 0
  490. # asm 1: mov $0,>c=int64#5
  491. # asm 2: mov $0,>c=%r8
  492. mov $0,%r8
  493. # qhasm: c += rdx + carry
  494. # asm 1: adc <rdx=int64#3,<c=int64#5
  495. # asm 2: adc <rdx=%rdx,<c=%r8
  496. adc %rdx,%r8
  497. # qhasm: q31_stack = q31
  498. # asm 1: movq <q31=int64#6,>q31_stack=stack64#9
  499. # asm 2: movq <q31=%r9,>q31_stack=64(%rsp)
  500. movq %r9,64(%rsp)
  501. # qhasm: rax = *(uint64 *)(xp + 56)
  502. # asm 1: movq 56(<xp=int64#2),>rax=int64#7
  503. # asm 2: movq 56(<xp=%rsi),>rax=%rax
  504. movq 56(%rsi),%rax
  505. # qhasm: (uint128) rdx rax = rax * *(uint64 *) &CRYPTO_NAMESPACE(MU3)
  506. mulq CRYPTO_NAMESPACE(MU3)(%rip)
  507. # qhasm: carry? q32 += rax
  508. # asm 1: add <rax=int64#7,<q32=int64#8
  509. # asm 2: add <rax=%rax,<q32=%r10
  510. add %rax,%r10
  511. # qhasm: rdx += zero + carry
  512. # asm 1: adc <zero=int64#4,<rdx=int64#3
  513. # asm 2: adc <zero=%rcx,<rdx=%rdx
  514. adc %rcx,%rdx
  515. # qhasm: carry? q32 += c
  516. # asm 1: add <c=int64#5,<q32=int64#8
  517. # asm 2: add <c=%r8,<q32=%r10
  518. add %r8,%r10
  519. # qhasm: c = 0
  520. # asm 1: mov $0,>c=int64#5
  521. # asm 2: mov $0,>c=%r8
  522. mov $0,%r8
  523. # qhasm: c += rdx + carry
  524. # asm 1: adc <rdx=int64#3,<c=int64#5
  525. # asm 2: adc <rdx=%rdx,<c=%r8
  526. adc %rdx,%r8
  527. # qhasm: q32_stack = q32
  528. # asm 1: movq <q32=int64#8,>q32_stack=stack64#10
  529. # asm 2: movq <q32=%r10,>q32_stack=72(%rsp)
  530. movq %r10,72(%rsp)
  531. # qhasm: rax = *(uint64 *)(xp + 56)
  532. # asm 1: movq 56(<xp=int64#2),>rax=int64#7
  533. # asm 2: movq 56(<xp=%rsi),>rax=%rax
  534. movq 56(%rsi),%rax
  535. # qhasm: (uint128) rdx rax = rax * *(uint64 *) &CRYPTO_NAMESPACE(MU4)
  536. mulq CRYPTO_NAMESPACE(MU4)(%rip)
  537. # qhasm: carry? q33 += rax
  538. # asm 1: add <rax=int64#7,<q33=int64#9
  539. # asm 2: add <rax=%rax,<q33=%r11
  540. add %rax,%r11
  541. # qhasm: rdx += zero + carry
  542. # asm 1: adc <zero=int64#4,<rdx=int64#3
  543. # asm 2: adc <zero=%rcx,<rdx=%rdx
  544. adc %rcx,%rdx
  545. # qhasm: q33 += c
  546. # asm 1: add <c=int64#5,<q33=int64#9
  547. # asm 2: add <c=%r8,<q33=%r11
  548. add %r8,%r11
  549. # qhasm: q33_stack = q33
  550. # asm 1: movq <q33=int64#9,>q33_stack=stack64#11
  551. # asm 2: movq <q33=%r11,>q33_stack=80(%rsp)
  552. movq %r11,80(%rsp)
  553. # qhasm: rax = q30_stack
  554. # asm 1: movq <q30_stack=stack64#8,>rax=int64#7
  555. # asm 2: movq <q30_stack=56(%rsp),>rax=%rax
  556. movq 56(%rsp),%rax
  557. # qhasm: (uint128) rdx rax = rax * *(uint64 *) &CRYPTO_NAMESPACE(ORDER0)
  558. mulq CRYPTO_NAMESPACE(ORDER0)(%rip)
  559. # qhasm: r20 = rax
  560. # asm 1: mov <rax=int64#7,>r20=int64#5
  561. # asm 2: mov <rax=%rax,>r20=%r8
  562. mov %rax,%r8
  563. # qhasm: c = rdx
  564. # asm 1: mov <rdx=int64#3,>c=int64#6
  565. # asm 2: mov <rdx=%rdx,>c=%r9
  566. mov %rdx,%r9
  567. # qhasm: rax = q30_stack
  568. # asm 1: movq <q30_stack=stack64#8,>rax=int64#7
  569. # asm 2: movq <q30_stack=56(%rsp),>rax=%rax
  570. movq 56(%rsp),%rax
  571. # qhasm: (uint128) rdx rax = rax * *(uint64 *) &CRYPTO_NAMESPACE(ORDER1)
  572. mulq CRYPTO_NAMESPACE(ORDER1)(%rip)
  573. # qhasm: r21 = rax
  574. # asm 1: mov <rax=int64#7,>r21=int64#8
  575. # asm 2: mov <rax=%rax,>r21=%r10
  576. mov %rax,%r10
  577. # qhasm: carry? r21 += c
  578. # asm 1: add <c=int64#6,<r21=int64#8
  579. # asm 2: add <c=%r9,<r21=%r10
  580. add %r9,%r10
  581. # qhasm: c = 0
  582. # asm 1: mov $0,>c=int64#6
  583. # asm 2: mov $0,>c=%r9
  584. mov $0,%r9
  585. # qhasm: c += rdx + carry
  586. # asm 1: adc <rdx=int64#3,<c=int64#6
  587. # asm 2: adc <rdx=%rdx,<c=%r9
  588. adc %rdx,%r9
  589. # qhasm: rax = q30_stack
  590. # asm 1: movq <q30_stack=stack64#8,>rax=int64#7
  591. # asm 2: movq <q30_stack=56(%rsp),>rax=%rax
  592. movq 56(%rsp),%rax
  593. # qhasm: (uint128) rdx rax = rax * *(uint64 *) &CRYPTO_NAMESPACE(ORDER2)
  594. mulq CRYPTO_NAMESPACE(ORDER2)(%rip)
  595. # qhasm: r22 = rax
  596. # asm 1: mov <rax=int64#7,>r22=int64#9
  597. # asm 2: mov <rax=%rax,>r22=%r11
  598. mov %rax,%r11
  599. # qhasm: carry? r22 += c
  600. # asm 1: add <c=int64#6,<r22=int64#9
  601. # asm 2: add <c=%r9,<r22=%r11
  602. add %r9,%r11
  603. # qhasm: c = 0
  604. # asm 1: mov $0,>c=int64#6
  605. # asm 2: mov $0,>c=%r9
  606. mov $0,%r9
  607. # qhasm: c += rdx + carry
  608. # asm 1: adc <rdx=int64#3,<c=int64#6
  609. # asm 2: adc <rdx=%rdx,<c=%r9
  610. adc %rdx,%r9
  611. # qhasm: rax = q30_stack
  612. # asm 1: movq <q30_stack=stack64#8,>rax=int64#7
  613. # asm 2: movq <q30_stack=56(%rsp),>rax=%rax
  614. movq 56(%rsp),%rax
  615. # qhasm: (uint128) rdx rax = rax * *(uint64 *) &CRYPTO_NAMESPACE(ORDER3)
  616. mulq CRYPTO_NAMESPACE(ORDER3)(%rip)
  617. # qhasm: free rdx
  618. # qhasm: r23 = rax
  619. # asm 1: mov <rax=int64#7,>r23=int64#10
  620. # asm 2: mov <rax=%rax,>r23=%r12
  621. mov %rax,%r12
  622. # qhasm: r23 += c
  623. # asm 1: add <c=int64#6,<r23=int64#10
  624. # asm 2: add <c=%r9,<r23=%r12
  625. add %r9,%r12
  626. # qhasm: rax = q31_stack
  627. # asm 1: movq <q31_stack=stack64#9,>rax=int64#7
  628. # asm 2: movq <q31_stack=64(%rsp),>rax=%rax
  629. movq 64(%rsp),%rax
  630. # qhasm: (uint128) rdx rax = rax * *(uint64 *) &CRYPTO_NAMESPACE(ORDER0)
  631. mulq CRYPTO_NAMESPACE(ORDER0)(%rip)
  632. # qhasm: carry? r21 += rax
  633. # asm 1: add <rax=int64#7,<r21=int64#8
  634. # asm 2: add <rax=%rax,<r21=%r10
  635. add %rax,%r10
  636. # qhasm: c = 0
  637. # asm 1: mov $0,>c=int64#6
  638. # asm 2: mov $0,>c=%r9
  639. mov $0,%r9
  640. # qhasm: c += rdx + carry
  641. # asm 1: adc <rdx=int64#3,<c=int64#6
  642. # asm 2: adc <rdx=%rdx,<c=%r9
  643. adc %rdx,%r9
  644. # qhasm: rax = q31_stack
  645. # asm 1: movq <q31_stack=stack64#9,>rax=int64#7
  646. # asm 2: movq <q31_stack=64(%rsp),>rax=%rax
  647. movq 64(%rsp),%rax
  648. # qhasm: (uint128) rdx rax = rax * *(uint64 *) &CRYPTO_NAMESPACE(ORDER1)
  649. mulq CRYPTO_NAMESPACE(ORDER1)(%rip)
  650. # qhasm: carry? r22 += rax
  651. # asm 1: add <rax=int64#7,<r22=int64#9
  652. # asm 2: add <rax=%rax,<r22=%r11
  653. add %rax,%r11
  654. # qhasm: rdx += zero + carry
  655. # asm 1: adc <zero=int64#4,<rdx=int64#3
  656. # asm 2: adc <zero=%rcx,<rdx=%rdx
  657. adc %rcx,%rdx
  658. # qhasm: carry? r22 += c
  659. # asm 1: add <c=int64#6,<r22=int64#9
  660. # asm 2: add <c=%r9,<r22=%r11
  661. add %r9,%r11
  662. # qhasm: c = 0
  663. # asm 1: mov $0,>c=int64#4
  664. # asm 2: mov $0,>c=%rcx
  665. mov $0,%rcx
  666. # qhasm: c += rdx + carry
  667. # asm 1: adc <rdx=int64#3,<c=int64#4
  668. # asm 2: adc <rdx=%rdx,<c=%rcx
  669. adc %rdx,%rcx
  670. # qhasm: rax = q31_stack
  671. # asm 1: movq <q31_stack=stack64#9,>rax=int64#7
  672. # asm 2: movq <q31_stack=64(%rsp),>rax=%rax
  673. movq 64(%rsp),%rax
  674. # qhasm: (uint128) rdx rax = rax * *(uint64 *) &CRYPTO_NAMESPACE(ORDER2)
  675. mulq CRYPTO_NAMESPACE(ORDER2)(%rip)
  676. # qhasm: free rdx
  677. # qhasm: r23 += rax
  678. # asm 1: add <rax=int64#7,<r23=int64#10
  679. # asm 2: add <rax=%rax,<r23=%r12
  680. add %rax,%r12
  681. # qhasm: r23 += c
  682. # asm 1: add <c=int64#4,<r23=int64#10
  683. # asm 2: add <c=%rcx,<r23=%r12
  684. add %rcx,%r12
  685. # qhasm: rax = q32_stack
  686. # asm 1: movq <q32_stack=stack64#10,>rax=int64#7
  687. # asm 2: movq <q32_stack=72(%rsp),>rax=%rax
  688. movq 72(%rsp),%rax
  689. # qhasm: (uint128) rdx rax = rax * *(uint64 *) &CRYPTO_NAMESPACE(ORDER0)
  690. mulq CRYPTO_NAMESPACE(ORDER0)(%rip)
  691. # qhasm: carry? r22 += rax
  692. # asm 1: add <rax=int64#7,<r22=int64#9
  693. # asm 2: add <rax=%rax,<r22=%r11
  694. add %rax,%r11
  695. # qhasm: c = 0
  696. # asm 1: mov $0,>c=int64#4
  697. # asm 2: mov $0,>c=%rcx
  698. mov $0,%rcx
  699. # qhasm: c += rdx + carry
  700. # asm 1: adc <rdx=int64#3,<c=int64#4
  701. # asm 2: adc <rdx=%rdx,<c=%rcx
  702. adc %rdx,%rcx
  703. # qhasm: rax = q32_stack
  704. # asm 1: movq <q32_stack=stack64#10,>rax=int64#7
  705. # asm 2: movq <q32_stack=72(%rsp),>rax=%rax
  706. movq 72(%rsp),%rax
  707. # qhasm: (uint128) rdx rax = rax * *(uint64 *) &CRYPTO_NAMESPACE(ORDER1)
  708. mulq CRYPTO_NAMESPACE(ORDER1)(%rip)
  709. # qhasm: free rdx
  710. # qhasm: r23 += rax
  711. # asm 1: add <rax=int64#7,<r23=int64#10
  712. # asm 2: add <rax=%rax,<r23=%r12
  713. add %rax,%r12
  714. # qhasm: r23 += c
  715. # asm 1: add <c=int64#4,<r23=int64#10
  716. # asm 2: add <c=%rcx,<r23=%r12
  717. add %rcx,%r12
  718. # qhasm: rax = q33_stack
  719. # asm 1: movq <q33_stack=stack64#11,>rax=int64#7
  720. # asm 2: movq <q33_stack=80(%rsp),>rax=%rax
  721. movq 80(%rsp),%rax
  722. # qhasm: (uint128) rdx rax = rax * *(uint64 *) &CRYPTO_NAMESPACE(ORDER0)
  723. mulq CRYPTO_NAMESPACE(ORDER0)(%rip)
  724. # qhasm: free rdx
  725. # qhasm: r23 += rax
  726. # asm 1: add <rax=int64#7,<r23=int64#10
  727. # asm 2: add <rax=%rax,<r23=%r12
  728. add %rax,%r12
  729. # qhasm: r0 = *(uint64 *)(xp + 0)
  730. # asm 1: movq 0(<xp=int64#2),>r0=int64#3
  731. # asm 2: movq 0(<xp=%rsi),>r0=%rdx
  732. movq 0(%rsi),%rdx
  733. # qhasm: carry? r0 -= r20
  734. # asm 1: sub <r20=int64#5,<r0=int64#3
  735. # asm 2: sub <r20=%r8,<r0=%rdx
  736. sub %r8,%rdx
  737. # qhasm: t0 = r0
  738. # asm 1: mov <r0=int64#3,>t0=int64#4
  739. # asm 2: mov <r0=%rdx,>t0=%rcx
  740. mov %rdx,%rcx
  741. # qhasm: r1 = *(uint64 *)(xp + 8)
  742. # asm 1: movq 8(<xp=int64#2),>r1=int64#5
  743. # asm 2: movq 8(<xp=%rsi),>r1=%r8
  744. movq 8(%rsi),%r8
  745. # qhasm: carry? r1 -= r21 - carry
  746. # asm 1: sbb <r21=int64#8,<r1=int64#5
  747. # asm 2: sbb <r21=%r10,<r1=%r8
  748. sbb %r10,%r8
  749. # qhasm: t1 = r1
  750. # asm 1: mov <r1=int64#5,>t1=int64#6
  751. # asm 2: mov <r1=%r8,>t1=%r9
  752. mov %r8,%r9
  753. # qhasm: r2 = *(uint64 *)(xp + 16)
  754. # asm 1: movq 16(<xp=int64#2),>r2=int64#7
  755. # asm 2: movq 16(<xp=%rsi),>r2=%rax
  756. movq 16(%rsi),%rax
  757. # qhasm: carry? r2 -= r22 - carry
  758. # asm 1: sbb <r22=int64#9,<r2=int64#7
  759. # asm 2: sbb <r22=%r11,<r2=%rax
  760. sbb %r11,%rax
  761. # qhasm: t2 = r2
  762. # asm 1: mov <r2=int64#7,>t2=int64#8
  763. # asm 2: mov <r2=%rax,>t2=%r10
  764. mov %rax,%r10
  765. # qhasm: r3 = *(uint64 *)(xp + 24)
  766. # asm 1: movq 24(<xp=int64#2),>r3=int64#2
  767. # asm 2: movq 24(<xp=%rsi),>r3=%rsi
  768. movq 24(%rsi),%rsi
  769. # qhasm: r3 -= r23 - carry
  770. # asm 1: sbb <r23=int64#10,<r3=int64#2
  771. # asm 2: sbb <r23=%r12,<r3=%rsi
  772. sbb %r12,%rsi
  773. # qhasm: t3 = r3
  774. # asm 1: mov <r3=int64#2,>t3=int64#9
  775. # asm 2: mov <r3=%rsi,>t3=%r11
  776. mov %rsi,%r11
  777. # qhasm: carry? t0 -= *(uint64 *) &CRYPTO_NAMESPACE(ORDER0)
  778. # asm 1: sub CRYPTO_NAMESPACE(ORDER0),<t0=int64#4
  779. # asm 2: sub CRYPTO_NAMESPACE(ORDER0),<t0=%rcx
  780. sub CRYPTO_NAMESPACE(ORDER0)(%rip),%rcx
  781. # qhasm: carry? t1 -= *(uint64 *) &CRYPTO_NAMESPACE(ORDER1) - carry
  782. # asm 1: sbb CRYPTO_NAMESPACE(ORDER1),<t1=int64#6
  783. # asm 2: sbb CRYPTO_NAMESPACE(ORDER1),<t1=%r9
  784. sbb CRYPTO_NAMESPACE(ORDER1)(%rip),%r9
  785. # qhasm: carry? t2 -= *(uint64 *) &CRYPTO_NAMESPACE(ORDER2) - carry
  786. # asm 1: sbb CRYPTO_NAMESPACE(ORDER2),<t2=int64#8
  787. # asm 2: sbb CRYPTO_NAMESPACE(ORDER2),<t2=%r10
  788. sbb CRYPTO_NAMESPACE(ORDER2)(%rip),%r10
  789. # qhasm: unsigned<? t3 -= *(uint64 *) &CRYPTO_NAMESPACE(ORDER3) - carry
  790. # asm 1: sbb CRYPTO_NAMESPACE(ORDER3),<t3=int64#9
  791. # asm 2: sbb CRYPTO_NAMESPACE(ORDER3),<t3=%r11
  792. sbb CRYPTO_NAMESPACE(ORDER3)(%rip),%r11
  793. # qhasm: r0 = t0 if !unsigned<
  794. # asm 1: cmovae <t0=int64#4,<r0=int64#3
  795. # asm 2: cmovae <t0=%rcx,<r0=%rdx
  796. cmovae %rcx,%rdx
  797. # qhasm: t0 = r0
  798. # asm 1: mov <r0=int64#3,>t0=int64#4
  799. # asm 2: mov <r0=%rdx,>t0=%rcx
  800. mov %rdx,%rcx
  801. # qhasm: r1 = t1 if !unsigned<
  802. # asm 1: cmovae <t1=int64#6,<r1=int64#5
  803. # asm 2: cmovae <t1=%r9,<r1=%r8
  804. cmovae %r9,%r8
  805. # qhasm: t1 = r1
  806. # asm 1: mov <r1=int64#5,>t1=int64#6
  807. # asm 2: mov <r1=%r8,>t1=%r9
  808. mov %r8,%r9
  809. # qhasm: r2 = t2 if !unsigned<
  810. # asm 1: cmovae <t2=int64#8,<r2=int64#7
  811. # asm 2: cmovae <t2=%r10,<r2=%rax
  812. cmovae %r10,%rax
  813. # qhasm: t2 = r2
  814. # asm 1: mov <r2=int64#7,>t2=int64#8
  815. # asm 2: mov <r2=%rax,>t2=%r10
  816. mov %rax,%r10
  817. # qhasm: r3 = t3 if !unsigned<
  818. # asm 1: cmovae <t3=int64#9,<r3=int64#2
  819. # asm 2: cmovae <t3=%r11,<r3=%rsi
  820. cmovae %r11,%rsi
  821. # qhasm: t3 = r3
  822. # asm 1: mov <r3=int64#2,>t3=int64#9
  823. # asm 2: mov <r3=%rsi,>t3=%r11
  824. mov %rsi,%r11
  825. # qhasm: carry? t0 -= *(uint64 *) &CRYPTO_NAMESPACE(ORDER0)
  826. # asm 1: sub CRYPTO_NAMESPACE(ORDER0),<t0=int64#4
  827. # asm 2: sub CRYPTO_NAMESPACE(ORDER0),<t0=%rcx
  828. sub CRYPTO_NAMESPACE(ORDER0)(%rip),%rcx
  829. # qhasm: carry? t1 -= *(uint64 *) &CRYPTO_NAMESPACE(ORDER1) - carry
  830. # asm 1: sbb CRYPTO_NAMESPACE(ORDER1),<t1=int64#6
  831. # asm 2: sbb CRYPTO_NAMESPACE(ORDER1),<t1=%r9
  832. sbb CRYPTO_NAMESPACE(ORDER1)(%rip),%r9
  833. # qhasm: carry? t2 -= *(uint64 *) &CRYPTO_NAMESPACE(ORDER2) - carry
  834. # asm 1: sbb CRYPTO_NAMESPACE(ORDER2),<t2=int64#8
  835. # asm 2: sbb CRYPTO_NAMESPACE(ORDER2),<t2=%r10
  836. sbb CRYPTO_NAMESPACE(ORDER2)(%rip),%r10
  837. # qhasm: unsigned<? t3 -= *(uint64 *) &CRYPTO_NAMESPACE(ORDER3) - carry
  838. # asm 1: sbb CRYPTO_NAMESPACE(ORDER3),<t3=int64#9
  839. # asm 2: sbb CRYPTO_NAMESPACE(ORDER3),<t3=%r11
  840. sbb CRYPTO_NAMESPACE(ORDER3)(%rip),%r11
  841. # qhasm: r0 = t0 if !unsigned<
  842. # asm 1: cmovae <t0=int64#4,<r0=int64#3
  843. # asm 2: cmovae <t0=%rcx,<r0=%rdx
  844. cmovae %rcx,%rdx
  845. # qhasm: r1 = t1 if !unsigned<
  846. # asm 1: cmovae <t1=int64#6,<r1=int64#5
  847. # asm 2: cmovae <t1=%r9,<r1=%r8
  848. cmovae %r9,%r8
  849. # qhasm: r2 = t2 if !unsigned<
  850. # asm 1: cmovae <t2=int64#8,<r2=int64#7
  851. # asm 2: cmovae <t2=%r10,<r2=%rax
  852. cmovae %r10,%rax
  853. # qhasm: r3 = t3 if !unsigned<
  854. # asm 1: cmovae <t3=int64#9,<r3=int64#2
  855. # asm 2: cmovae <t3=%r11,<r3=%rsi
  856. cmovae %r11,%rsi
  857. # qhasm: *(uint64 *)(rp + 0) = r0
  858. # asm 1: movq <r0=int64#3,0(<rp=int64#1)
  859. # asm 2: movq <r0=%rdx,0(<rp=%rdi)
  860. movq %rdx,0(%rdi)
  861. # qhasm: *(uint64 *)(rp + 8) = r1
  862. # asm 1: movq <r1=int64#5,8(<rp=int64#1)
  863. # asm 2: movq <r1=%r8,8(<rp=%rdi)
  864. movq %r8,8(%rdi)
  865. # qhasm: *(uint64 *)(rp + 16) = r2
  866. # asm 1: movq <r2=int64#7,16(<rp=int64#1)
  867. # asm 2: movq <r2=%rax,16(<rp=%rdi)
  868. movq %rax,16(%rdi)
  869. # qhasm: *(uint64 *)(rp + 24) = r3
  870. # asm 1: movq <r3=int64#2,24(<rp=int64#1)
  871. # asm 2: movq <r3=%rsi,24(<rp=%rdi)
  872. movq %rsi,24(%rdi)
  873. # qhasm: caller1 = caller1_stack
  874. # asm 1: movq <caller1_stack=stack64#1,>caller1=int64#9
  875. # asm 2: movq <caller1_stack=0(%rsp),>caller1=%r11
  876. movq 0(%rsp),%r11
  877. # qhasm: caller2 = caller2_stack
  878. # asm 1: movq <caller2_stack=stack64#2,>caller2=int64#10
  879. # asm 2: movq <caller2_stack=8(%rsp),>caller2=%r12
  880. movq 8(%rsp),%r12
  881. # qhasm: caller3 = caller3_stack
  882. # asm 1: movq <caller3_stack=stack64#3,>caller3=int64#11
  883. # asm 2: movq <caller3_stack=16(%rsp),>caller3=%r13
  884. movq 16(%rsp),%r13
  885. # qhasm: caller4 = caller4_stack
  886. # asm 1: movq <caller4_stack=stack64#4,>caller4=int64#12
  887. # asm 2: movq <caller4_stack=24(%rsp),>caller4=%r14
  888. movq 24(%rsp),%r14
  889. # qhasm: caller5 = caller5_stack
  890. # asm 1: movq <caller5_stack=stack64#5,>caller5=int64#13
  891. # asm 2: movq <caller5_stack=32(%rsp),>caller5=%r15
  892. movq 32(%rsp),%r15
  893. # qhasm: caller6 = caller6_stack
  894. # asm 1: movq <caller6_stack=stack64#6,>caller6=int64#14
  895. # asm 2: movq <caller6_stack=40(%rsp),>caller6=%rbx
  896. movq 40(%rsp),%rbx
  897. # qhasm: caller7 = caller7_stack
  898. # asm 1: movq <caller7_stack=stack64#7,>caller7=int64#15
  899. # asm 2: movq <caller7_stack=48(%rsp),>caller7=%rbp
  900. movq 48(%rsp),%rbp
  901. # qhasm: leave
  902. add %r11,%rsp
  903. mov %rdi,%rax
  904. mov %rsi,%rdx
  905. ret