freeze_amd64.s 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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 freeze(inout *[5]uint64)
  8. TEXT ·freeze(SB),7,$0-8
  9. MOVQ inout+0(FP), DI
  10. MOVQ 0(DI),SI
  11. MOVQ 8(DI),DX
  12. MOVQ 16(DI),CX
  13. MOVQ 24(DI),R8
  14. MOVQ 32(DI),R9
  15. MOVQ ·REDMASK51(SB),AX
  16. MOVQ AX,R10
  17. SUBQ $18,R10
  18. MOVQ $3,R11
  19. REDUCELOOP:
  20. MOVQ SI,R12
  21. SHRQ $51,R12
  22. ANDQ AX,SI
  23. ADDQ R12,DX
  24. MOVQ DX,R12
  25. SHRQ $51,R12
  26. ANDQ AX,DX
  27. ADDQ R12,CX
  28. MOVQ CX,R12
  29. SHRQ $51,R12
  30. ANDQ AX,CX
  31. ADDQ R12,R8
  32. MOVQ R8,R12
  33. SHRQ $51,R12
  34. ANDQ AX,R8
  35. ADDQ R12,R9
  36. MOVQ R9,R12
  37. SHRQ $51,R12
  38. ANDQ AX,R9
  39. IMUL3Q $19,R12,R12
  40. ADDQ R12,SI
  41. SUBQ $1,R11
  42. JA REDUCELOOP
  43. MOVQ $1,R12
  44. CMPQ R10,SI
  45. CMOVQLT R11,R12
  46. CMPQ AX,DX
  47. CMOVQNE R11,R12
  48. CMPQ AX,CX
  49. CMOVQNE R11,R12
  50. CMPQ AX,R8
  51. CMOVQNE R11,R12
  52. CMPQ AX,R9
  53. CMOVQNE R11,R12
  54. NEGQ R12
  55. ANDQ R12,AX
  56. ANDQ R12,R10
  57. SUBQ R10,SI
  58. SUBQ AX,DX
  59. SUBQ AX,CX
  60. SUBQ AX,R8
  61. SUBQ AX,R9
  62. MOVQ SI,0(DI)
  63. MOVQ DX,8(DI)
  64. MOVQ CX,16(DI)
  65. MOVQ R8,24(DI)
  66. MOVQ R9,32(DI)
  67. RET