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.

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