bcopy.S 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. /* This is a generated file. DO NOT EDIT. */
  2. /*
  3. * Generated from:
  4. *
  5. * OpenBSD: bcopy.m4
  6. */
  7. /*
  8. * Copyright (c) 1999,2004 Michael Shalayeff
  9. * All rights reserved.
  10. *
  11. * Permission to use, copy, modify, and distribute this software for any
  12. * purpose with or without fee is hereby granted, provided that the above
  13. * copyright notice and this permission notice appear in all copies.
  14. *
  15. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  16. * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  17. * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  18. * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  19. * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER IN
  20. * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
  21. * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  22. */
  23. #undef _LOCORE
  24. #define _LOCORE
  25. #include <machine/asm.h>
  26. #include <machine/frame.h>
  27. LEAF_ENTRY(bcopy)
  28. copy %arg0, %ret0
  29. copy %arg1, %arg0
  30. copy %ret0, %arg1
  31. ALTENTRY(memmove)
  32. cmpb,*>,n %arg0, %arg1, $bcopy.reverse
  33. ALTENTRY(memcpy)
  34. copy %arg0, %ret0
  35. cmpib,*>=,n 15, %arg2, $bcopy_f.byte
  36. extrd,u %arg1, 63, 2, %r20
  37. extrd,u %arg0, 63, 2, %r19
  38. add %arg2, %r19, %arg2
  39. cmpb,*<> %r20, %r19, $bcopy_f.unaligned
  40. depd %r0, 63, 2, %arg1
  41. addi -16, %arg2, %arg2
  42. $bcopy_f.loop16a
  43. ldw 32(%sr0, %arg1), %r0
  44. ldw,ma 4(%sr0, %arg1), %r22
  45. ldw,ma 4(%sr0, %arg1), %r21
  46. ldw,ma 4(%sr0, %arg1), %r20
  47. ldw,ma 4(%sr0, %arg1), %r19
  48. stby,b,m %r22, 4(%sr0, %arg0)
  49. stw,ma %r21, 4(%sr0, %arg0)
  50. stw,ma %r20, 4(%sr0, %arg0)
  51. addib,*>= -16, %arg2, $bcopy_f.loop16a
  52. stw,ma %r19, 4(%sr0, %arg0)
  53. addib,*<,n 12, %arg2, $bcopy_f.cleanup
  54. $bcopy_f.word
  55. ldw,ma 4(%sr0, %arg1), %r22
  56. addib,*>= -4, %arg2, $bcopy_f.word
  57. stw,ma %r22, 4(%sr0, %arg0)
  58. $bcopy_f.cleanup
  59. addib,*=,n 4, %arg2, $bcopy_f.done
  60. ldw 0(%sr0, %arg1), %r22
  61. add %arg0, %arg2, %arg0
  62. b $bcopy_f.done
  63. stby,e %r22, 0(%sr0, %arg0)
  64. $bcopy_f.unaligned
  65. sub,*>= %r19, %r20, %r21
  66. ldw,ma 4(%sr0, %arg1), %ret1
  67. depd,z %r21, 60, 61, %r22
  68. mtsar %r22
  69. addi -16, %arg2, %arg2
  70. $bcopy_f.loop16u
  71. ldw 32(%sr0, %arg1), %r0
  72. ldw,ma 4(%sr0, %arg1), %r22
  73. ldw,ma 4(%sr0, %arg1), %r21
  74. ldw,ma 4(%sr0, %arg1), %r20
  75. ldw,ma 4(%sr0, %arg1), %r19
  76. shrpw %ret1, %r22, %sar, %r31
  77. stby,b,m %r31, 4(%sr0, %arg0)
  78. shrpw %r22, %r21, %sar, %r31
  79. stw,ma %r31, 4(%sr0, %arg0)
  80. shrpw %r21, %r20, %sar, %r31
  81. stw,ma %r31, 4(%sr0, %arg0)
  82. shrpw %r20, %r19, %sar, %r31
  83. stw,ma %r31, 4(%sr0, %arg0)
  84. addib,*>= -16, %arg2, $bcopy_f.loop16u
  85. copy %r19, %ret1
  86. addib,*<,n 12, %arg2, $bcopy_f.cleanup_un
  87. $bcopy_f.word_un
  88. ldw,ma 4(%sr0, %arg1), %r22
  89. shrpw %ret1, %r22, %sar, %r21
  90. addib,*< -4, %arg2, $bcopy_f.cleanup1_un
  91. stw,ma %r21, 4(%sr0, %arg0)
  92. ldw,ma 4(%sr0, %arg1), %ret1
  93. shrpw %r22, %ret1, %sar, %r21
  94. addib,*>= -4, %arg2, $bcopy_f.word_un
  95. stw,ma %r21, 4(%sr0, %arg0)
  96. $bcopy_f.cleanup_un
  97. addib,*<=,n 4, %arg2, $bcopy_f.done
  98. mfctl %sar, %r19
  99. add %arg0, %arg2, %arg0
  100. extrd,u %r19, 60, 2, %r19
  101. sub,*<= %arg2, %r19, %r0
  102. ldw,ma 4(%sr0, %arg1), %r22
  103. shrpw %ret1, %r22, %sar, %r21
  104. b $bcopy_f.done
  105. stby,e %r21, 0(%sr0, %arg0)
  106. $bcopy_f.cleanup1_un
  107. b $bcopy_f.cleanup_un
  108. copy %r22, %ret1
  109. $bcopy_f.byte
  110. cmpb,*>=,n %r0, %arg2, $bcopy_f.done
  111. $bcopy_f.byte_loop
  112. ldbs,ma 1(%sr0, %arg1), %r22
  113. addib,*<> -1, %arg2, $bcopy_f.byte_loop
  114. stbs,ma %r22, 1(%sr0, %arg0)
  115. $bcopy_f.done
  116. bv %r0(%rp)
  117. nop
  118. $bcopy.reverse
  119. copy %arg0, %ret0
  120. add %arg1, %arg2, %arg1
  121. add %arg0, %arg2, %arg0
  122. $bcopy_r.byte
  123. cmpb,*>=,n %r0, %arg2, $bcopy_r.done
  124. $bcopy_r.byte_loop
  125. ldbs,mb -1(%sr0, %arg1), %r22
  126. addib,*<> -1, %arg2, $bcopy_r.byte_loop
  127. stbs,mb %r22, -1(%sr0, %arg0)
  128. $bcopy_r.done
  129. bv %r0(%rp)
  130. nop
  131. EXIT(bcopy)
  132. .end