ull4_mul.S 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716
  1. # qhasm: int64 rp
  2. # qhasm: int64 xp
  3. # qhasm: int64 yp
  4. # qhasm: input rp
  5. # qhasm: input xp
  6. # qhasm: input yp
  7. # qhasm: int64 r0
  8. # qhasm: int64 r1
  9. # qhasm: int64 r2
  10. # qhasm: int64 r3
  11. # qhasm: int64 r4
  12. # qhasm: int64 r5
  13. # qhasm: int64 r6
  14. # qhasm: int64 r7
  15. # qhasm: int64 c
  16. # qhasm: int64 zero
  17. # qhasm: int64 rax
  18. # qhasm: int64 rdx
  19. # qhasm: int64 caller1
  20. # qhasm: int64 caller2
  21. # qhasm: int64 caller3
  22. # qhasm: int64 caller4
  23. # qhasm: int64 caller5
  24. # qhasm: int64 caller6
  25. # qhasm: int64 caller7
  26. # qhasm: caller caller1
  27. # qhasm: caller caller2
  28. # qhasm: caller caller3
  29. # qhasm: caller caller4
  30. # qhasm: caller caller5
  31. # qhasm: caller caller6
  32. # qhasm: caller caller7
  33. # qhasm: stack64 caller1_stack
  34. # qhasm: stack64 caller2_stack
  35. # qhasm: stack64 caller3_stack
  36. # qhasm: stack64 caller4_stack
  37. # qhasm: stack64 caller5_stack
  38. # qhasm: stack64 caller6_stack
  39. # qhasm: stack64 caller7_stack
  40. # qhasm: enter CRYPTO_NAMESPACE(ull4_mul)
  41. .text
  42. .p2align 5
  43. .globl _CRYPTO_NAMESPACE(ull4_mul)
  44. .globl CRYPTO_NAMESPACE(ull4_mul)
  45. _CRYPTO_NAMESPACE(ull4_mul):
  46. CRYPTO_NAMESPACE(ull4_mul):
  47. mov %rsp,%r11
  48. and $31,%r11
  49. add $64,%r11
  50. sub %r11,%rsp
  51. # qhasm: caller1_stack = caller1
  52. # asm 1: movq <caller1=int64#9,>caller1_stack=stack64#1
  53. # asm 2: movq <caller1=%r11,>caller1_stack=0(%rsp)
  54. movq %r11,0(%rsp)
  55. # qhasm: caller2_stack = caller2
  56. # asm 1: movq <caller2=int64#10,>caller2_stack=stack64#2
  57. # asm 2: movq <caller2=%r12,>caller2_stack=8(%rsp)
  58. movq %r12,8(%rsp)
  59. # qhasm: caller3_stack = caller3
  60. # asm 1: movq <caller3=int64#11,>caller3_stack=stack64#3
  61. # asm 2: movq <caller3=%r13,>caller3_stack=16(%rsp)
  62. movq %r13,16(%rsp)
  63. # qhasm: caller4_stack = caller4
  64. # asm 1: movq <caller4=int64#12,>caller4_stack=stack64#4
  65. # asm 2: movq <caller4=%r14,>caller4_stack=24(%rsp)
  66. movq %r14,24(%rsp)
  67. # qhasm: caller5_stack = caller5
  68. # asm 1: movq <caller5=int64#13,>caller5_stack=stack64#5
  69. # asm 2: movq <caller5=%r15,>caller5_stack=32(%rsp)
  70. movq %r15,32(%rsp)
  71. # qhasm: caller6_stack = caller6
  72. # asm 1: movq <caller6=int64#14,>caller6_stack=stack64#6
  73. # asm 2: movq <caller6=%rbx,>caller6_stack=40(%rsp)
  74. movq %rbx,40(%rsp)
  75. # qhasm: caller7_stack = caller7
  76. # asm 1: movq <caller7=int64#15,>caller7_stack=stack64#7
  77. # asm 2: movq <caller7=%rbp,>caller7_stack=48(%rsp)
  78. movq %rbp,48(%rsp)
  79. # qhasm: yp = yp
  80. # asm 1: mov <yp=int64#3,>yp=int64#4
  81. # asm 2: mov <yp=%rdx,>yp=%rcx
  82. mov %rdx,%rcx
  83. # qhasm: r4 = 0
  84. # asm 1: mov $0,>r4=int64#5
  85. # asm 2: mov $0,>r4=%r8
  86. mov $0,%r8
  87. # qhasm: r5 = 0
  88. # asm 1: mov $0,>r5=int64#6
  89. # asm 2: mov $0,>r5=%r9
  90. mov $0,%r9
  91. # qhasm: r6 = 0
  92. # asm 1: mov $0,>r6=int64#8
  93. # asm 2: mov $0,>r6=%r10
  94. mov $0,%r10
  95. # qhasm: r7 = 0
  96. # asm 1: mov $0,>r7=int64#9
  97. # asm 2: mov $0,>r7=%r11
  98. mov $0,%r11
  99. # qhasm: zero = 0
  100. # asm 1: mov $0,>zero=int64#10
  101. # asm 2: mov $0,>zero=%r12
  102. mov $0,%r12
  103. # qhasm: rax = *(uint64 *)(xp + 0)
  104. # asm 1: movq 0(<xp=int64#2),>rax=int64#7
  105. # asm 2: movq 0(<xp=%rsi),>rax=%rax
  106. movq 0(%rsi),%rax
  107. # qhasm: (uint128) rdx rax = rax * *(uint64 *)(yp + 0)
  108. # asm 1: mulq 0(<yp=int64#4)
  109. # asm 2: mulq 0(<yp=%rcx)
  110. mulq 0(%rcx)
  111. # qhasm: r0 = rax
  112. # asm 1: mov <rax=int64#7,>r0=int64#11
  113. # asm 2: mov <rax=%rax,>r0=%r13
  114. mov %rax,%r13
  115. # qhasm: c = rdx
  116. # asm 1: mov <rdx=int64#3,>c=int64#12
  117. # asm 2: mov <rdx=%rdx,>c=%r14
  118. mov %rdx,%r14
  119. # qhasm: rax = *(uint64 *)(xp + 0)
  120. # asm 1: movq 0(<xp=int64#2),>rax=int64#7
  121. # asm 2: movq 0(<xp=%rsi),>rax=%rax
  122. movq 0(%rsi),%rax
  123. # qhasm: (uint128) rdx rax = rax * *(uint64 *)(yp + 8)
  124. # asm 1: mulq 8(<yp=int64#4)
  125. # asm 2: mulq 8(<yp=%rcx)
  126. mulq 8(%rcx)
  127. # qhasm: r1 = rax
  128. # asm 1: mov <rax=int64#7,>r1=int64#13
  129. # asm 2: mov <rax=%rax,>r1=%r15
  130. mov %rax,%r15
  131. # qhasm: carry? r1 += c
  132. # asm 1: add <c=int64#12,<r1=int64#13
  133. # asm 2: add <c=%r14,<r1=%r15
  134. add %r14,%r15
  135. # qhasm: c = 0
  136. # asm 1: mov $0,>c=int64#12
  137. # asm 2: mov $0,>c=%r14
  138. mov $0,%r14
  139. # qhasm: c += rdx + carry
  140. # asm 1: adc <rdx=int64#3,<c=int64#12
  141. # asm 2: adc <rdx=%rdx,<c=%r14
  142. adc %rdx,%r14
  143. # qhasm: rax = *(uint64 *)(xp + 0)
  144. # asm 1: movq 0(<xp=int64#2),>rax=int64#7
  145. # asm 2: movq 0(<xp=%rsi),>rax=%rax
  146. movq 0(%rsi),%rax
  147. # qhasm: (uint128) rdx rax = rax * *(uint64 *)(yp + 16)
  148. # asm 1: mulq 16(<yp=int64#4)
  149. # asm 2: mulq 16(<yp=%rcx)
  150. mulq 16(%rcx)
  151. # qhasm: r2 = rax
  152. # asm 1: mov <rax=int64#7,>r2=int64#14
  153. # asm 2: mov <rax=%rax,>r2=%rbx
  154. mov %rax,%rbx
  155. # qhasm: carry? r2 += c
  156. # asm 1: add <c=int64#12,<r2=int64#14
  157. # asm 2: add <c=%r14,<r2=%rbx
  158. add %r14,%rbx
  159. # qhasm: c = 0
  160. # asm 1: mov $0,>c=int64#12
  161. # asm 2: mov $0,>c=%r14
  162. mov $0,%r14
  163. # qhasm: c += rdx + carry
  164. # asm 1: adc <rdx=int64#3,<c=int64#12
  165. # asm 2: adc <rdx=%rdx,<c=%r14
  166. adc %rdx,%r14
  167. # qhasm: rax = *(uint64 *)(xp + 0)
  168. # asm 1: movq 0(<xp=int64#2),>rax=int64#7
  169. # asm 2: movq 0(<xp=%rsi),>rax=%rax
  170. movq 0(%rsi),%rax
  171. # qhasm: (uint128) rdx rax = rax * *(uint64 *)(yp + 24)
  172. # asm 1: mulq 24(<yp=int64#4)
  173. # asm 2: mulq 24(<yp=%rcx)
  174. mulq 24(%rcx)
  175. # qhasm: r3 = rax
  176. # asm 1: mov <rax=int64#7,>r3=int64#15
  177. # asm 2: mov <rax=%rax,>r3=%rbp
  178. mov %rax,%rbp
  179. # qhasm: carry? r3 += c
  180. # asm 1: add <c=int64#12,<r3=int64#15
  181. # asm 2: add <c=%r14,<r3=%rbp
  182. add %r14,%rbp
  183. # qhasm: r4 += rdx + carry
  184. # asm 1: adc <rdx=int64#3,<r4=int64#5
  185. # asm 2: adc <rdx=%rdx,<r4=%r8
  186. adc %rdx,%r8
  187. # qhasm: rax = *(uint64 *)(xp + 8)
  188. # asm 1: movq 8(<xp=int64#2),>rax=int64#7
  189. # asm 2: movq 8(<xp=%rsi),>rax=%rax
  190. movq 8(%rsi),%rax
  191. # qhasm: (uint128) rdx rax = rax * *(uint64 *)(yp + 0)
  192. # asm 1: mulq 0(<yp=int64#4)
  193. # asm 2: mulq 0(<yp=%rcx)
  194. mulq 0(%rcx)
  195. # qhasm: carry? r1 += rax
  196. # asm 1: add <rax=int64#7,<r1=int64#13
  197. # asm 2: add <rax=%rax,<r1=%r15
  198. add %rax,%r15
  199. # qhasm: c = 0
  200. # asm 1: mov $0,>c=int64#12
  201. # asm 2: mov $0,>c=%r14
  202. mov $0,%r14
  203. # qhasm: c += rdx + carry
  204. # asm 1: adc <rdx=int64#3,<c=int64#12
  205. # asm 2: adc <rdx=%rdx,<c=%r14
  206. adc %rdx,%r14
  207. # qhasm: rax = *(uint64 *)(xp + 8)
  208. # asm 1: movq 8(<xp=int64#2),>rax=int64#7
  209. # asm 2: movq 8(<xp=%rsi),>rax=%rax
  210. movq 8(%rsi),%rax
  211. # qhasm: (uint128) rdx rax = rax * *(uint64 *)(yp + 8)
  212. # asm 1: mulq 8(<yp=int64#4)
  213. # asm 2: mulq 8(<yp=%rcx)
  214. mulq 8(%rcx)
  215. # qhasm: carry? r2 += rax
  216. # asm 1: add <rax=int64#7,<r2=int64#14
  217. # asm 2: add <rax=%rax,<r2=%rbx
  218. add %rax,%rbx
  219. # qhasm: rdx += zero + carry
  220. # asm 1: adc <zero=int64#10,<rdx=int64#3
  221. # asm 2: adc <zero=%r12,<rdx=%rdx
  222. adc %r12,%rdx
  223. # qhasm: carry? r2 += c
  224. # asm 1: add <c=int64#12,<r2=int64#14
  225. # asm 2: add <c=%r14,<r2=%rbx
  226. add %r14,%rbx
  227. # qhasm: c = 0
  228. # asm 1: mov $0,>c=int64#12
  229. # asm 2: mov $0,>c=%r14
  230. mov $0,%r14
  231. # qhasm: c += rdx + carry
  232. # asm 1: adc <rdx=int64#3,<c=int64#12
  233. # asm 2: adc <rdx=%rdx,<c=%r14
  234. adc %rdx,%r14
  235. # qhasm: rax = *(uint64 *)(xp + 8)
  236. # asm 1: movq 8(<xp=int64#2),>rax=int64#7
  237. # asm 2: movq 8(<xp=%rsi),>rax=%rax
  238. movq 8(%rsi),%rax
  239. # qhasm: (uint128) rdx rax = rax * *(uint64 *)(yp + 16)
  240. # asm 1: mulq 16(<yp=int64#4)
  241. # asm 2: mulq 16(<yp=%rcx)
  242. mulq 16(%rcx)
  243. # qhasm: carry? r3 += rax
  244. # asm 1: add <rax=int64#7,<r3=int64#15
  245. # asm 2: add <rax=%rax,<r3=%rbp
  246. add %rax,%rbp
  247. # qhasm: rdx += zero + carry
  248. # asm 1: adc <zero=int64#10,<rdx=int64#3
  249. # asm 2: adc <zero=%r12,<rdx=%rdx
  250. adc %r12,%rdx
  251. # qhasm: carry? r3 += c
  252. # asm 1: add <c=int64#12,<r3=int64#15
  253. # asm 2: add <c=%r14,<r3=%rbp
  254. add %r14,%rbp
  255. # qhasm: c = 0
  256. # asm 1: mov $0,>c=int64#12
  257. # asm 2: mov $0,>c=%r14
  258. mov $0,%r14
  259. # qhasm: c += rdx + carry
  260. # asm 1: adc <rdx=int64#3,<c=int64#12
  261. # asm 2: adc <rdx=%rdx,<c=%r14
  262. adc %rdx,%r14
  263. # qhasm: rax = *(uint64 *)(xp + 8)
  264. # asm 1: movq 8(<xp=int64#2),>rax=int64#7
  265. # asm 2: movq 8(<xp=%rsi),>rax=%rax
  266. movq 8(%rsi),%rax
  267. # qhasm: (uint128) rdx rax = rax * *(uint64 *)(yp + 24)
  268. # asm 1: mulq 24(<yp=int64#4)
  269. # asm 2: mulq 24(<yp=%rcx)
  270. mulq 24(%rcx)
  271. # qhasm: carry? r4 += rax
  272. # asm 1: add <rax=int64#7,<r4=int64#5
  273. # asm 2: add <rax=%rax,<r4=%r8
  274. add %rax,%r8
  275. # qhasm: rdx += zero + carry
  276. # asm 1: adc <zero=int64#10,<rdx=int64#3
  277. # asm 2: adc <zero=%r12,<rdx=%rdx
  278. adc %r12,%rdx
  279. # qhasm: carry? r4 += c
  280. # asm 1: add <c=int64#12,<r4=int64#5
  281. # asm 2: add <c=%r14,<r4=%r8
  282. add %r14,%r8
  283. # qhasm: r5 += rdx + carry
  284. # asm 1: adc <rdx=int64#3,<r5=int64#6
  285. # asm 2: adc <rdx=%rdx,<r5=%r9
  286. adc %rdx,%r9
  287. # qhasm: rax = *(uint64 *)(xp + 16)
  288. # asm 1: movq 16(<xp=int64#2),>rax=int64#7
  289. # asm 2: movq 16(<xp=%rsi),>rax=%rax
  290. movq 16(%rsi),%rax
  291. # qhasm: (uint128) rdx rax = rax * *(uint64 *)(yp + 0)
  292. # asm 1: mulq 0(<yp=int64#4)
  293. # asm 2: mulq 0(<yp=%rcx)
  294. mulq 0(%rcx)
  295. # qhasm: carry? r2 += rax
  296. # asm 1: add <rax=int64#7,<r2=int64#14
  297. # asm 2: add <rax=%rax,<r2=%rbx
  298. add %rax,%rbx
  299. # qhasm: c = 0
  300. # asm 1: mov $0,>c=int64#12
  301. # asm 2: mov $0,>c=%r14
  302. mov $0,%r14
  303. # qhasm: c += rdx + carry
  304. # asm 1: adc <rdx=int64#3,<c=int64#12
  305. # asm 2: adc <rdx=%rdx,<c=%r14
  306. adc %rdx,%r14
  307. # qhasm: rax = *(uint64 *)(xp + 16)
  308. # asm 1: movq 16(<xp=int64#2),>rax=int64#7
  309. # asm 2: movq 16(<xp=%rsi),>rax=%rax
  310. movq 16(%rsi),%rax
  311. # qhasm: (uint128) rdx rax = rax * *(uint64 *)(yp + 8)
  312. # asm 1: mulq 8(<yp=int64#4)
  313. # asm 2: mulq 8(<yp=%rcx)
  314. mulq 8(%rcx)
  315. # qhasm: carry? r3 += rax
  316. # asm 1: add <rax=int64#7,<r3=int64#15
  317. # asm 2: add <rax=%rax,<r3=%rbp
  318. add %rax,%rbp
  319. # qhasm: rdx += zero + carry
  320. # asm 1: adc <zero=int64#10,<rdx=int64#3
  321. # asm 2: adc <zero=%r12,<rdx=%rdx
  322. adc %r12,%rdx
  323. # qhasm: carry? r3 += c
  324. # asm 1: add <c=int64#12,<r3=int64#15
  325. # asm 2: add <c=%r14,<r3=%rbp
  326. add %r14,%rbp
  327. # qhasm: c = 0
  328. # asm 1: mov $0,>c=int64#12
  329. # asm 2: mov $0,>c=%r14
  330. mov $0,%r14
  331. # qhasm: c += rdx + carry
  332. # asm 1: adc <rdx=int64#3,<c=int64#12
  333. # asm 2: adc <rdx=%rdx,<c=%r14
  334. adc %rdx,%r14
  335. # qhasm: rax = *(uint64 *)(xp + 16)
  336. # asm 1: movq 16(<xp=int64#2),>rax=int64#7
  337. # asm 2: movq 16(<xp=%rsi),>rax=%rax
  338. movq 16(%rsi),%rax
  339. # qhasm: (uint128) rdx rax = rax * *(uint64 *)(yp + 16)
  340. # asm 1: mulq 16(<yp=int64#4)
  341. # asm 2: mulq 16(<yp=%rcx)
  342. mulq 16(%rcx)
  343. # qhasm: carry? r4 += rax
  344. # asm 1: add <rax=int64#7,<r4=int64#5
  345. # asm 2: add <rax=%rax,<r4=%r8
  346. add %rax,%r8
  347. # qhasm: rdx += zero + carry
  348. # asm 1: adc <zero=int64#10,<rdx=int64#3
  349. # asm 2: adc <zero=%r12,<rdx=%rdx
  350. adc %r12,%rdx
  351. # qhasm: carry? r4 += c
  352. # asm 1: add <c=int64#12,<r4=int64#5
  353. # asm 2: add <c=%r14,<r4=%r8
  354. add %r14,%r8
  355. # qhasm: c = 0
  356. # asm 1: mov $0,>c=int64#12
  357. # asm 2: mov $0,>c=%r14
  358. mov $0,%r14
  359. # qhasm: c += rdx + carry
  360. # asm 1: adc <rdx=int64#3,<c=int64#12
  361. # asm 2: adc <rdx=%rdx,<c=%r14
  362. adc %rdx,%r14
  363. # qhasm: rax = *(uint64 *)(xp + 16)
  364. # asm 1: movq 16(<xp=int64#2),>rax=int64#7
  365. # asm 2: movq 16(<xp=%rsi),>rax=%rax
  366. movq 16(%rsi),%rax
  367. # qhasm: (uint128) rdx rax = rax * *(uint64 *)(yp + 24)
  368. # asm 1: mulq 24(<yp=int64#4)
  369. # asm 2: mulq 24(<yp=%rcx)
  370. mulq 24(%rcx)
  371. # qhasm: carry? r5 += rax
  372. # asm 1: add <rax=int64#7,<r5=int64#6
  373. # asm 2: add <rax=%rax,<r5=%r9
  374. add %rax,%r9
  375. # qhasm: rdx += zero + carry
  376. # asm 1: adc <zero=int64#10,<rdx=int64#3
  377. # asm 2: adc <zero=%r12,<rdx=%rdx
  378. adc %r12,%rdx
  379. # qhasm: carry? r5 += c
  380. # asm 1: add <c=int64#12,<r5=int64#6
  381. # asm 2: add <c=%r14,<r5=%r9
  382. add %r14,%r9
  383. # qhasm: r6 += rdx + carry
  384. # asm 1: adc <rdx=int64#3,<r6=int64#8
  385. # asm 2: adc <rdx=%rdx,<r6=%r10
  386. adc %rdx,%r10
  387. # qhasm: rax = *(uint64 *)(xp + 24)
  388. # asm 1: movq 24(<xp=int64#2),>rax=int64#7
  389. # asm 2: movq 24(<xp=%rsi),>rax=%rax
  390. movq 24(%rsi),%rax
  391. # qhasm: (uint128) rdx rax = rax * *(uint64 *)(yp + 0)
  392. # asm 1: mulq 0(<yp=int64#4)
  393. # asm 2: mulq 0(<yp=%rcx)
  394. mulq 0(%rcx)
  395. # qhasm: carry? r3 += rax
  396. # asm 1: add <rax=int64#7,<r3=int64#15
  397. # asm 2: add <rax=%rax,<r3=%rbp
  398. add %rax,%rbp
  399. # qhasm: c = 0
  400. # asm 1: mov $0,>c=int64#12
  401. # asm 2: mov $0,>c=%r14
  402. mov $0,%r14
  403. # qhasm: c += rdx + carry
  404. # asm 1: adc <rdx=int64#3,<c=int64#12
  405. # asm 2: adc <rdx=%rdx,<c=%r14
  406. adc %rdx,%r14
  407. # qhasm: rax = *(uint64 *)(xp + 24)
  408. # asm 1: movq 24(<xp=int64#2),>rax=int64#7
  409. # asm 2: movq 24(<xp=%rsi),>rax=%rax
  410. movq 24(%rsi),%rax
  411. # qhasm: (uint128) rdx rax = rax * *(uint64 *)(yp + 8)
  412. # asm 1: mulq 8(<yp=int64#4)
  413. # asm 2: mulq 8(<yp=%rcx)
  414. mulq 8(%rcx)
  415. # qhasm: carry? r4 += rax
  416. # asm 1: add <rax=int64#7,<r4=int64#5
  417. # asm 2: add <rax=%rax,<r4=%r8
  418. add %rax,%r8
  419. # qhasm: rdx += zero + carry
  420. # asm 1: adc <zero=int64#10,<rdx=int64#3
  421. # asm 2: adc <zero=%r12,<rdx=%rdx
  422. adc %r12,%rdx
  423. # qhasm: carry? r4 += c
  424. # asm 1: add <c=int64#12,<r4=int64#5
  425. # asm 2: add <c=%r14,<r4=%r8
  426. add %r14,%r8
  427. # qhasm: c = 0
  428. # asm 1: mov $0,>c=int64#12
  429. # asm 2: mov $0,>c=%r14
  430. mov $0,%r14
  431. # qhasm: c += rdx + carry
  432. # asm 1: adc <rdx=int64#3,<c=int64#12
  433. # asm 2: adc <rdx=%rdx,<c=%r14
  434. adc %rdx,%r14
  435. # qhasm: rax = *(uint64 *)(xp + 24)
  436. # asm 1: movq 24(<xp=int64#2),>rax=int64#7
  437. # asm 2: movq 24(<xp=%rsi),>rax=%rax
  438. movq 24(%rsi),%rax
  439. # qhasm: (uint128) rdx rax = rax * *(uint64 *)(yp + 16)
  440. # asm 1: mulq 16(<yp=int64#4)
  441. # asm 2: mulq 16(<yp=%rcx)
  442. mulq 16(%rcx)
  443. # qhasm: carry? r5 += rax
  444. # asm 1: add <rax=int64#7,<r5=int64#6
  445. # asm 2: add <rax=%rax,<r5=%r9
  446. add %rax,%r9
  447. # qhasm: rdx += zero + carry
  448. # asm 1: adc <zero=int64#10,<rdx=int64#3
  449. # asm 2: adc <zero=%r12,<rdx=%rdx
  450. adc %r12,%rdx
  451. # qhasm: carry? r5 += c
  452. # asm 1: add <c=int64#12,<r5=int64#6
  453. # asm 2: add <c=%r14,<r5=%r9
  454. add %r14,%r9
  455. # qhasm: c = 0
  456. # asm 1: mov $0,>c=int64#12
  457. # asm 2: mov $0,>c=%r14
  458. mov $0,%r14
  459. # qhasm: c += rdx + carry
  460. # asm 1: adc <rdx=int64#3,<c=int64#12
  461. # asm 2: adc <rdx=%rdx,<c=%r14
  462. adc %rdx,%r14
  463. # qhasm: rax = *(uint64 *)(xp + 24)
  464. # asm 1: movq 24(<xp=int64#2),>rax=int64#7
  465. # asm 2: movq 24(<xp=%rsi),>rax=%rax
  466. movq 24(%rsi),%rax
  467. # qhasm: (uint128) rdx rax = rax * *(uint64 *)(yp + 24)
  468. # asm 1: mulq 24(<yp=int64#4)
  469. # asm 2: mulq 24(<yp=%rcx)
  470. mulq 24(%rcx)
  471. # qhasm: carry? r6 += rax
  472. # asm 1: add <rax=int64#7,<r6=int64#8
  473. # asm 2: add <rax=%rax,<r6=%r10
  474. add %rax,%r10
  475. # qhasm: rdx += zero + carry
  476. # asm 1: adc <zero=int64#10,<rdx=int64#3
  477. # asm 2: adc <zero=%r12,<rdx=%rdx
  478. adc %r12,%rdx
  479. # qhasm: carry? r6 += c
  480. # asm 1: add <c=int64#12,<r6=int64#8
  481. # asm 2: add <c=%r14,<r6=%r10
  482. add %r14,%r10
  483. # qhasm: r7 += rdx + carry
  484. # asm 1: adc <rdx=int64#3,<r7=int64#9
  485. # asm 2: adc <rdx=%rdx,<r7=%r11
  486. adc %rdx,%r11
  487. # qhasm: *(uint64 *)(rp + 0) = r0
  488. # asm 1: movq <r0=int64#11,0(<rp=int64#1)
  489. # asm 2: movq <r0=%r13,0(<rp=%rdi)
  490. movq %r13,0(%rdi)
  491. # qhasm: *(uint64 *)(rp + 8) = r1
  492. # asm 1: movq <r1=int64#13,8(<rp=int64#1)
  493. # asm 2: movq <r1=%r15,8(<rp=%rdi)
  494. movq %r15,8(%rdi)
  495. # qhasm: *(uint64 *)(rp + 16) = r2
  496. # asm 1: movq <r2=int64#14,16(<rp=int64#1)
  497. # asm 2: movq <r2=%rbx,16(<rp=%rdi)
  498. movq %rbx,16(%rdi)
  499. # qhasm: *(uint64 *)(rp + 24) = r3
  500. # asm 1: movq <r3=int64#15,24(<rp=int64#1)
  501. # asm 2: movq <r3=%rbp,24(<rp=%rdi)
  502. movq %rbp,24(%rdi)
  503. # qhasm: *(uint64 *)(rp + 32) = r4
  504. # asm 1: movq <r4=int64#5,32(<rp=int64#1)
  505. # asm 2: movq <r4=%r8,32(<rp=%rdi)
  506. movq %r8,32(%rdi)
  507. # qhasm: *(uint64 *)(rp + 40) = r5
  508. # asm 1: movq <r5=int64#6,40(<rp=int64#1)
  509. # asm 2: movq <r5=%r9,40(<rp=%rdi)
  510. movq %r9,40(%rdi)
  511. # qhasm: *(uint64 *)(rp + 48) = r6
  512. # asm 1: movq <r6=int64#8,48(<rp=int64#1)
  513. # asm 2: movq <r6=%r10,48(<rp=%rdi)
  514. movq %r10,48(%rdi)
  515. # qhasm: *(uint64 *)(rp + 56) = r7
  516. # asm 1: movq <r7=int64#9,56(<rp=int64#1)
  517. # asm 2: movq <r7=%r11,56(<rp=%rdi)
  518. movq %r11,56(%rdi)
  519. # qhasm: caller1 = caller1_stack
  520. # asm 1: movq <caller1_stack=stack64#1,>caller1=int64#9
  521. # asm 2: movq <caller1_stack=0(%rsp),>caller1=%r11
  522. movq 0(%rsp),%r11
  523. # qhasm: caller2 = caller2_stack
  524. # asm 1: movq <caller2_stack=stack64#2,>caller2=int64#10
  525. # asm 2: movq <caller2_stack=8(%rsp),>caller2=%r12
  526. movq 8(%rsp),%r12
  527. # qhasm: caller3 = caller3_stack
  528. # asm 1: movq <caller3_stack=stack64#3,>caller3=int64#11
  529. # asm 2: movq <caller3_stack=16(%rsp),>caller3=%r13
  530. movq 16(%rsp),%r13
  531. # qhasm: caller4 = caller4_stack
  532. # asm 1: movq <caller4_stack=stack64#4,>caller4=int64#12
  533. # asm 2: movq <caller4_stack=24(%rsp),>caller4=%r14
  534. movq 24(%rsp),%r14
  535. # qhasm: caller5 = caller5_stack
  536. # asm 1: movq <caller5_stack=stack64#5,>caller5=int64#13
  537. # asm 2: movq <caller5_stack=32(%rsp),>caller5=%r15
  538. movq 32(%rsp),%r15
  539. # qhasm: caller6 = caller6_stack
  540. # asm 1: movq <caller6_stack=stack64#6,>caller6=int64#14
  541. # asm 2: movq <caller6_stack=40(%rsp),>caller6=%rbx
  542. movq 40(%rsp),%rbx
  543. # qhasm: caller7 = caller7_stack
  544. # asm 1: movq <caller7_stack=stack64#7,>caller7=int64#15
  545. # asm 2: movq <caller7_stack=48(%rsp),>caller7=%rbp
  546. movq 48(%rsp),%rbp
  547. # qhasm: leave
  548. add %r11,%rsp
  549. mov %rdi,%rax
  550. mov %rsi,%rdx
  551. ret