You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

153 lines
2.3 KiB

  1. // Copyright 2012 The Go Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style
  3. // license that can be found in the LICENSE file.
  4. // This code was translated into a form compatible with 6a from the public
  5. // domain sources in SUPERCOP: http://bench.cr.yp.to/supercop.html
  6. // +build amd64,!gccgo,!appengine
  7. // func square(out, in *[5]uint64)
  8. TEXT ·square(SB),7,$96-16
  9. MOVQ out+0(FP), DI
  10. MOVQ in+8(FP), SI
  11. MOVQ SP,R11
  12. MOVQ $31,CX
  13. NOTQ CX
  14. ANDQ CX,SP
  15. ADDQ $32, SP
  16. MOVQ R11,0(SP)
  17. MOVQ R12,8(SP)
  18. MOVQ R13,16(SP)
  19. MOVQ R14,24(SP)
  20. MOVQ R15,32(SP)
  21. MOVQ BX,40(SP)
  22. MOVQ BP,48(SP)
  23. MOVQ 0(SI),AX
  24. MULQ 0(SI)
  25. MOVQ AX,CX
  26. MOVQ DX,R8
  27. MOVQ 0(SI),AX
  28. SHLQ $1,AX
  29. MULQ 8(SI)
  30. MOVQ AX,R9
  31. MOVQ DX,R10
  32. MOVQ 0(SI),AX
  33. SHLQ $1,AX
  34. MULQ 16(SI)
  35. MOVQ AX,R11
  36. MOVQ DX,R12
  37. MOVQ 0(SI),AX
  38. SHLQ $1,AX
  39. MULQ 24(SI)
  40. MOVQ AX,R13
  41. MOVQ DX,R14
  42. MOVQ 0(SI),AX
  43. SHLQ $1,AX
  44. MULQ 32(SI)
  45. MOVQ AX,R15
  46. MOVQ DX,BX
  47. MOVQ 8(SI),AX
  48. MULQ 8(SI)
  49. ADDQ AX,R11
  50. ADCQ DX,R12
  51. MOVQ 8(SI),AX
  52. SHLQ $1,AX
  53. MULQ 16(SI)
  54. ADDQ AX,R13
  55. ADCQ DX,R14
  56. MOVQ 8(SI),AX
  57. SHLQ $1,AX
  58. MULQ 24(SI)
  59. ADDQ AX,R15
  60. ADCQ DX,BX
  61. MOVQ 8(SI),DX
  62. IMUL3Q $38,DX,AX
  63. MULQ 32(SI)
  64. ADDQ AX,CX
  65. ADCQ DX,R8
  66. MOVQ 16(SI),AX
  67. MULQ 16(SI)
  68. ADDQ AX,R15
  69. ADCQ DX,BX
  70. MOVQ 16(SI),DX
  71. IMUL3Q $38,DX,AX
  72. MULQ 24(SI)
  73. ADDQ AX,CX
  74. ADCQ DX,R8
  75. MOVQ 16(SI),DX
  76. IMUL3Q $38,DX,AX
  77. MULQ 32(SI)
  78. ADDQ AX,R9
  79. ADCQ DX,R10
  80. MOVQ 24(SI),DX
  81. IMUL3Q $19,DX,AX
  82. MULQ 24(SI)
  83. ADDQ AX,R9
  84. ADCQ DX,R10
  85. MOVQ 24(SI),DX
  86. IMUL3Q $38,DX,AX
  87. MULQ 32(SI)
  88. ADDQ AX,R11
  89. ADCQ DX,R12
  90. MOVQ 32(SI),DX
  91. IMUL3Q $19,DX,AX
  92. MULQ 32(SI)
  93. ADDQ AX,R13
  94. ADCQ DX,R14
  95. MOVQ ·REDMASK51(SB),SI
  96. SHLQ $13,R8:CX
  97. ANDQ SI,CX
  98. SHLQ $13,R10:R9
  99. ANDQ SI,R9
  100. ADDQ R8,R9
  101. SHLQ $13,R12:R11
  102. ANDQ SI,R11
  103. ADDQ R10,R11
  104. SHLQ $13,R14:R13
  105. ANDQ SI,R13
  106. ADDQ R12,R13
  107. SHLQ $13,BX:R15
  108. ANDQ SI,R15
  109. ADDQ R14,R15
  110. IMUL3Q $19,BX,DX
  111. ADDQ DX,CX
  112. MOVQ CX,DX
  113. SHRQ $51,DX
  114. ADDQ R9,DX
  115. ANDQ SI,CX
  116. MOVQ DX,R8
  117. SHRQ $51,DX
  118. ADDQ R11,DX
  119. ANDQ SI,R8
  120. MOVQ DX,R9
  121. SHRQ $51,DX
  122. ADDQ R13,DX
  123. ANDQ SI,R9
  124. MOVQ DX,AX
  125. SHRQ $51,DX
  126. ADDQ R15,DX
  127. ANDQ SI,AX
  128. MOVQ DX,R10
  129. SHRQ $51,DX
  130. IMUL3Q $19,DX,DX
  131. ADDQ DX,CX
  132. ANDQ SI,R10
  133. MOVQ CX,0(DI)
  134. MOVQ R8,8(DI)
  135. MOVQ R9,16(DI)
  136. MOVQ AX,24(DI)
  137. MOVQ R10,32(DI)
  138. MOVQ 0(SP),R11
  139. MOVQ 8(SP),R12
  140. MOVQ 16(SP),R13
  141. MOVQ 24(SP),R14
  142. MOVQ 32(SP),R15
  143. MOVQ 40(SP),BX
  144. MOVQ 48(SP),BP
  145. MOVQ R11,SP
  146. MOVQ DI,AX
  147. MOVQ SI,DX
  148. RET