addmul_4.asm
上传用户:qaz666999
上传日期:2022-08-06
资源大小:2570k
文件大小:4k
源码类别:

数学计算

开发平台:

Unix_Linux

  1. dnl  Alpha ev6 nails mpn_addmul_4.
  2. dnl  Copyright 2002, 2005, 2006 Free Software Foundation, Inc.
  3. dnl
  4. dnl  This file is part of the GNU MP Library.
  5. dnl
  6. dnl  The GNU MP Library is free software; you can redistribute it and/or
  7. dnl  modify it under the terms of the GNU Lesser General Public License as
  8. dnl  published by the Free Software Foundation; either version 3 of the
  9. dnl  License, or (at your option) any later version.
  10. dnl
  11. dnl  The GNU MP Library is distributed in the hope that it will be useful,
  12. dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  14. dnl  Lesser General Public License for more details.
  15. dnl
  16. dnl  You should have received a copy of the GNU Lesser General Public License
  17. dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
  18. include(`../config.m4')
  19. C Runs at 2.5 cycles/limb.
  20. C We should go for 2-way unrolling over 17 cycles, for 2.125 c/l corresponding
  21. C to 3.24 insn/cycle.
  22. C  INPUT PARAMETERS
  23. define(`rp',`r16')
  24. define(`up',`r17')
  25. define(`n',`r18')
  26. define(`vp',`r19')
  27. C  Useful register aliases
  28. define(`numb_mask',`r24')
  29. define(`ulimb',`r25')
  30. define(`rlimb',`r27')
  31. define(`m0a',`r0')
  32. define(`m0b',`r1')
  33. define(`m1a',`r2')
  34. define(`m1b',`r3')
  35. define(`m2a',`r20')
  36. define(`m2b',`r21')
  37. define(`m3a',`r12')
  38. define(`m3b',`r13')
  39. define(`acc0',`r4')
  40. define(`acc1',`r5')
  41. define(`acc2',`r22')
  42. define(`acc3',`r14')
  43. define(`v0',`r6')
  44. define(`v1',`r7')
  45. define(`v2',`r23')
  46. define(`v3',`r15')
  47. C Used for temps: r8 r19 r28
  48. define(`NAIL_BITS',`GMP_NAIL_BITS')
  49. define(`NUMB_BITS',`GMP_NUMB_BITS')
  50. C  This declaration is munged by configure
  51. NAILS_SUPPORT(4-63)
  52. ASM_START()
  53. PROLOGUE(mpn_addmul_4)
  54. lda r30, -240(r30)
  55. stq r12, 32(r30)
  56. stq r13, 40(r30)
  57. stq r14, 48(r30)
  58. stq r15, 56(r30)
  59. lda numb_mask,-1(r31)
  60. srl numb_mask,NAIL_BITS,numb_mask
  61. ldq v0, 0(vp)
  62. ldq v1, 8(vp)
  63. ldq v2, 16(vp)
  64. ldq v3, 24(vp)
  65. bis r31, r31, acc0 C zero acc0
  66. sll v0,NAIL_BITS, v0
  67. bis r31, r31, acc1 C zero acc1
  68. sll v1,NAIL_BITS, v1
  69. bis r31, r31, acc2 C zero acc2
  70. sll v2,NAIL_BITS, v2
  71. bis r31, r31, acc3 C zero acc3
  72. sll v3,NAIL_BITS, v3
  73. bis r31, r31, r19
  74. ldq ulimb, 0(up)
  75. lda up, 8(up)
  76. mulq v0, ulimb, m0a C U1
  77. umulh v0, ulimb, m0b C U1
  78. mulq v1, ulimb, m1a C U1
  79. umulh v1, ulimb, m1b C U1
  80. lda n, -1(n)
  81. mulq v2, ulimb, m2a C U1
  82. umulh v2, ulimb, m2b C U1
  83. mulq v3, ulimb, m3a C U1
  84. umulh v3, ulimb, m3b C U1
  85. beq n, L(end) C U0
  86. ALIGN(16)
  87. L(top): bis r31, r31, r31 C U1 nop
  88. ldq rlimb, 0(rp) C L0
  89. ldq ulimb, 0(up) C L1
  90. addq r19, acc0, acc0 C U0 propagate nail
  91. bis r31, r31, r31 C L0 nop
  92. bis r31, r31, r31 C U1 nop
  93. bis r31, r31, r31 C L1 nop
  94. bis r31, r31, r31 C U0 nop
  95. lda rp, 8(rp) C L0
  96. srl m0a,NAIL_BITS, r8 C U0
  97. lda up, 8(up) C L1
  98. mulq v0, ulimb, m0a C U1
  99. addq r8, acc0, r19 C U0
  100. addq m0b, acc1, acc0 C L0
  101. umulh v0, ulimb, m0b C U1
  102. bis r31, r31, r31 C L1 nop
  103. addq rlimb, r19, r19 C L0
  104. srl m1a,NAIL_BITS, r8 C U0
  105. bis r31, r31, r31 C L1 nop
  106. mulq v1, ulimb, m1a C U1
  107. addq r8, acc0, acc0 C U0
  108. addq m1b, acc2, acc1 C L0
  109. umulh v1, ulimb, m1b C U1
  110. and r19,numb_mask, r28 C L1 extract numb part
  111. bis r31, r31, r31 C L0 nop
  112. srl m2a,NAIL_BITS, r8 C U0
  113. lda n, -1(n) C L1
  114. mulq v2, ulimb, m2a C U1
  115. addq r8, acc1, acc1 C L1
  116. addq m2b, acc3, acc2 C L0
  117. umulh v2, ulimb, m2b C U1
  118. srl r19,NUMB_BITS, r19 C U0 extract nail part
  119. bis r31, r31, r31 C L0 nop
  120. srl m3a,NAIL_BITS, r8 C U0
  121. stq r28, -8(rp) C L1
  122. mulq v3, ulimb, m3a C U1
  123. addq r8, acc2, acc2 C L0
  124. bis r31, m3b, acc3 C L1
  125. umulh v3, ulimb, m3b C U1
  126. bne n, L(top) C U0
  127. L(end): ldq rlimb, 0(rp)
  128. addq r19, acc0, acc0 C propagate nail
  129. lda rp, 8(rp) C FIXME: DELETE
  130. srl m0a,NAIL_BITS, r8 C U0
  131. addq r8, acc0, r19
  132. addq m0b, acc1, acc0
  133. addq rlimb, r19, r19
  134. srl m1a,NAIL_BITS, r8 C U0
  135. addq r8, acc0, acc0
  136. addq m1b, acc2, acc1
  137. and r19,numb_mask, r28 C extract limb
  138. srl m2a,NAIL_BITS, r8 C U0
  139. addq r8, acc1, acc1
  140. addq m2b, acc3, acc2
  141. srl r19,NUMB_BITS, r19 C extract nail
  142. srl m3a,NAIL_BITS, r8 C U0
  143. stq r28, -8(rp)
  144. addq r8, acc2, acc2
  145. bis r31, m3b, acc3
  146. addq r19, acc0, acc0 C propagate nail
  147. and acc0,numb_mask, r28
  148. stq r28, 0(rp)
  149. srl acc0,NUMB_BITS, r19
  150. addq r19, acc1, acc1
  151. and acc1,numb_mask, r28
  152. stq r28, 8(rp)
  153. srl acc1,NUMB_BITS, r19
  154. addq r19, acc2, acc2
  155. and acc2,numb_mask, r28
  156. stq r28, 16(rp)
  157. srl acc2,NUMB_BITS, r19
  158. addq r19, acc3, r0
  159. ldq r12, 32(r30)
  160. ldq r13, 40(r30)
  161. ldq r14, 48(r30)
  162. ldq r15, 56(r30)
  163. lda r30, 240(r30)
  164. ret r31, (r26), 1
  165. EPILOGUE()
  166. ASM_END()