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

数学计算

开发平台:

Unix_Linux

  1. dnl  Alpha mpn_lshift -- Shift a number left.
  2. dnl  Copyright 1994, 1995, 2000, 2003, 2009 Free Software Foundation, Inc.
  3. dnl  This file is part of the GNU MP Library.
  4. dnl  The GNU MP Library is free software; you can redistribute it and/or modify
  5. dnl  it under the terms of the GNU Lesser General Public License as published
  6. dnl  by the Free Software Foundation; either version 3 of the License, or (at
  7. dnl  your option) any later version.
  8. dnl  The GNU MP Library is distributed in the hope that it will be useful, but
  9. dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
  10. dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
  11. dnl  License for more details.
  12. dnl  You should have received a copy of the GNU Lesser General Public License
  13. dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
  14. include(`../config.m4')
  15. C      cycles/limb
  16. C EV4:     ?
  17. C EV5:     3.25
  18. C EV6:     1.75
  19. C  INPUT PARAMETERS
  20. C  rp r16
  21. C  up r17
  22. C  n r18
  23. C  cnt r19
  24. ASM_START()
  25. PROLOGUE(mpn_lshift)
  26. s8addq r18,r17,r17 C make r17 point at end of s1
  27. ldq r4,-8(r17) C load first limb
  28. subq r31,r19,r20
  29. s8addq r18,r16,r16 C make r16 point at end of RES
  30. subq r18,1,r18
  31. and r18,4-1,r28 C number of limbs in first loop
  32. srl r4,r20,r0 C compute function result
  33. beq r28,L(L0)
  34. subq r18,r28,r18
  35. ALIGN(8)
  36. L(top0):
  37. ldq r3,-16(r17)
  38. subq r16,8,r16
  39. sll r4,r19,r5
  40. subq r17,8,r17
  41. subq r28,1,r28
  42. srl r3,r20,r6
  43. bis r3,r3,r4
  44. bis r5,r6,r8
  45. stq r8,0(r16)
  46. bne r28,L(top0)
  47. L(L0): sll r4,r19,r24
  48. beq r18,L(end)
  49. C warm up phase 1
  50. ldq r1,-16(r17)
  51. subq r18,4,r18
  52. ldq r2,-24(r17)
  53. ldq r3,-32(r17)
  54. ldq r4,-40(r17)
  55. C warm up phase 2
  56. srl r1,r20,r7
  57. sll r1,r19,r21
  58. srl r2,r20,r8
  59. beq r18,L(end1)
  60. ldq r1,-48(r17)
  61. sll r2,r19,r22
  62. ldq r2,-56(r17)
  63. srl r3,r20,r5
  64. bis r7,r24,r7
  65. sll r3,r19,r23
  66. bis r8,r21,r8
  67. srl r4,r20,r6
  68. ldq r3,-64(r17)
  69. sll r4,r19,r24
  70. ldq r4,-72(r17)
  71. subq r18,4,r18
  72. beq r18,L(end2)
  73. ALIGN(16)
  74. C main loop
  75. L(top): stq r7,-8(r16)
  76. bis r5,r22,r5
  77. stq r8,-16(r16)
  78. bis r6,r23,r6
  79. srl r1,r20,r7
  80. subq r18,4,r18
  81. sll r1,r19,r21
  82. unop C ldq r31,-96(r17)
  83. srl r2,r20,r8
  84. ldq r1,-80(r17)
  85. sll r2,r19,r22
  86. ldq r2,-88(r17)
  87. stq r5,-24(r16)
  88. bis r7,r24,r7
  89. stq r6,-32(r16)
  90. bis r8,r21,r8
  91. srl r3,r20,r5
  92. unop C ldq r31,-96(r17)
  93. sll r3,r19,r23
  94. subq r16,32,r16
  95. srl r4,r20,r6
  96. ldq r3,-96(r17)
  97. sll r4,r19,r24
  98. ldq r4,-104(r17)
  99. subq r17,32,r17
  100. bne r18,L(top)
  101. C cool down phase 2/1
  102. L(end2):
  103. stq r7,-8(r16)
  104. bis r5,r22,r5
  105. stq r8,-16(r16)
  106. bis r6,r23,r6
  107. srl r1,r20,r7
  108. sll r1,r19,r21
  109. srl r2,r20,r8
  110. sll r2,r19,r22
  111. stq r5,-24(r16)
  112. bis r7,r24,r7
  113. stq r6,-32(r16)
  114. bis r8,r21,r8
  115. srl r3,r20,r5
  116. sll r3,r19,r23
  117. srl r4,r20,r6
  118. sll r4,r19,r24
  119. C cool down phase 2/2
  120. stq r7,-40(r16)
  121. bis r5,r22,r5
  122. stq r8,-48(r16)
  123. bis r6,r23,r6
  124. stq r5,-56(r16)
  125. stq r6,-64(r16)
  126. C cool down phase 2/3
  127. stq r24,-72(r16)
  128. ret r31,(r26),1
  129. C cool down phase 1/1
  130. L(end1):
  131. sll r2,r19,r22
  132. srl r3,r20,r5
  133. bis r7,r24,r7
  134. sll r3,r19,r23
  135. bis r8,r21,r8
  136. srl r4,r20,r6
  137. sll r4,r19,r24
  138. C cool down phase 1/2
  139. stq r7,-8(r16)
  140. bis r5,r22,r5
  141. stq r8,-16(r16)
  142. bis r6,r23,r6
  143. stq r5,-24(r16)
  144. stq r6,-32(r16)
  145. stq r24,-40(r16)
  146. ret r31,(r26),1
  147. L(end): stq r24,-8(r16)
  148. ret r31,(r26),1
  149. EPILOGUE(mpn_lshift)
  150. ASM_END()