bcopy.S 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. /* This is a generated file. DO NOT EDIT. */
  2. /*
  3. * Generated from:
  4. *
  5. * OpenBSD: bcopy.m4
  6. */
  7. /*
  8. * Copyright (c) 1999 Michael Shalayeff
  9. * All rights reserved.
  10. *
  11. * Redistribution and use in source and binary forms, with or without
  12. * modification, are permitted provided that the following conditions
  13. * are met:
  14. * 1. Redistributions of source code must retain the above copyright
  15. * notice, this list of conditions and the following disclaimer.
  16. * 2. Redistributions in binary form must reproduce the above copyright
  17. * notice, this list of conditions and the following disclaimer in the
  18. * documentation and/or other materials provided with the distribution.
  19. *
  20. * THIS SOFTWARE IS PROVIDED BY THE AUTHOR `AS IS' AND ANY EXPRESS OR
  21. * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  22. * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  23. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
  24. * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
  25. * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  26. * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  27. * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  28. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  29. * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  30. *
  31. */
  32. #undef _LOCORE
  33. #define _LOCORE
  34. #include <machine/asm.h>
  35. #include <machine/frame.h>
  36. LEAF_ENTRY(bcopy)
  37. copy arg0, ret0
  38. copy arg1, arg0
  39. copy ret0, arg1
  40. ALTENTRY(memmove)
  41. comb,>,n arg0, arg1, $bcopy.reverse
  42. ALTENTRY(memcpy)
  43. copy arg0, ret0
  44. comib,>=,n 15, arg2, $bcopy_f.byte
  45. extru arg1, 31, 2, t3
  46. extru arg0, 31, 2, t4
  47. add arg2, t4, arg2
  48. comb,<> t3, t4, $bcopy_f.unaligned
  49. dep r0, 31, 2, arg1
  50. addi -16, arg2, arg2
  51. $bcopy_f.loop16a
  52. ldws,ma 4(sr0, arg1), t1
  53. ldws,ma 4(sr0, arg1), t2
  54. ldws,ma 4(sr0, arg1), t3
  55. ldws,ma 4(sr0, arg1), t4
  56. stbys,b,m t1, 4(sr0, arg0)
  57. stws,ma t2, 4(sr0, arg0)
  58. stws,ma t3, 4(sr0, arg0)
  59. addib,>= -16, arg2, $bcopy_f.loop16a
  60. stws,ma t4, 4(sr0, arg0)
  61. addib,<,n 12, arg2, $bcopy_f.cleanup
  62. $bcopy_f.word
  63. ldws,ma 4(sr0, arg1), t1
  64. addib,>= -4, arg2, $bcopy_f.word
  65. stws,ma t1, 4(sr0, arg0)
  66. $bcopy_f.cleanup
  67. addib,=,n 4, arg2, $bcopy_f.done
  68. ldws 0(sr0, arg1), t1
  69. add arg0, arg2, arg0
  70. b $bcopy_f.done
  71. stbys,e t1, 0(sr0, arg0)
  72. $bcopy_f.unaligned
  73. sub,>= t4, t3, t2
  74. ldwm 4(sr0, arg1), ret1
  75. zdep t2, 28, 29, t1
  76. mtsar t1
  77. addi -16, arg2, arg2
  78. $bcopy_f.loop16u
  79. ldws,ma 4(sr0, arg1), t1
  80. ldws,ma 4(sr0, arg1), t2
  81. ldws,ma 4(sr0, arg1), t3
  82. ldws,ma 4(sr0, arg1), t4
  83. vshd ret1, t1, r31
  84. stbys,b,m r31, 4(sr0, arg0)
  85. vshd t1, t2, r31
  86. stws,ma r31, 4(sr0, arg0)
  87. vshd t2, t3, r31
  88. stws,ma r31, 4(sr0, arg0)
  89. vshd t3, t4, r31
  90. stws,ma r31, 4(sr0, arg0)
  91. addib,>= -16, arg2, $bcopy_f.loop16u
  92. copy t4, ret1
  93. addib,<,n 12, arg2, $bcopy_f.cleanup_un
  94. $bcopy_f.word_un
  95. ldws,ma 4(sr0, arg1), t1
  96. vshd ret1, t1, t2
  97. addib,< -4, arg2, $bcopy_f.cleanup1_un
  98. stws,ma t2, 4(sr0, arg0)
  99. ldws,ma 4(sr0, arg1), ret1
  100. vshd t1, ret1, t2
  101. addib,>= -4, arg2, $bcopy_f.word_un
  102. stws,ma t2, 4(sr0, arg0)
  103. $bcopy_f.cleanup_un
  104. addib,<=,n 4, arg2, $bcopy_f.done
  105. mfctl sar, t4
  106. add arg0, arg2, arg0
  107. extru t4, 28, 2, t4
  108. sub,<= arg2, t4, r0
  109. ldws,ma 4(sr0, arg1), t1
  110. vshd ret1, t1, t2
  111. b $bcopy_f.done
  112. stbys,e t2, 0(sr0, arg0)
  113. $bcopy_f.cleanup1_un
  114. b $bcopy_f.cleanup_un
  115. copy t1, ret1
  116. $bcopy_f.byte
  117. comb,>=,n r0, arg2, $bcopy_f.done
  118. $bcopy_f.byte_loop
  119. ldbs,ma 1(sr0, arg1), t1
  120. addib,<> -1, arg2, $bcopy_f.byte_loop
  121. stbs,ma t1, 1(sr0, arg0)
  122. $bcopy_f.done
  123. bv 0(rp)
  124. nop
  125. $bcopy.reverse
  126. copy arg0, ret0
  127. add arg1, arg2, arg1
  128. add arg0, arg2, arg0
  129. $bcopy_r.byte
  130. comb,>=,n r0, arg2, $bcopy_r.done
  131. $bcopy_r.byte_loop
  132. ldbs,mb -1(sr0, arg1), t1
  133. addib,<> -1, arg2, $bcopy_r.byte_loop
  134. stbs,mb t1, -1(sr0, arg0)
  135. $bcopy_r.done
  136. bv 0(rp)
  137. nop
  138. EXIT(bcopy)
  139. .end