movmem.S 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238
  1. /* Copyright (C) 1994, 1995, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
  2. 2004, 2005, 2006
  3. Free Software Foundation, Inc.
  4. This file is free software; you can redistribute it and/or modify it
  5. under the terms of the GNU General Public License as published by the
  6. Free Software Foundation; either version 2, or (at your option) any
  7. later version.
  8. In addition to the permissions in the GNU General Public License, the
  9. Free Software Foundation gives you unlimited permission to link the
  10. compiled version of this file into combinations with other programs,
  11. and to distribute those combinations without any restriction coming
  12. from the use of this file. (The General Public License restrictions
  13. do apply in other respects; for example, they cover modification of
  14. the file, and distribution when not linked into a combine
  15. executable.)
  16. This file is distributed in the hope that it will be useful, but
  17. WITHOUT ANY WARRANTY; without even the implied warranty of
  18. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  19. General Public License for more details.
  20. You should have received a copy of the GNU General Public License
  21. along with this program; see the file COPYING. If not, write to
  22. the Free Software Foundation, 51 Franklin Street, Fifth Floor,
  23. Boston, MA 02110-1301, USA. */
  24. !! libgcc routines for the Renesas / SuperH SH CPUs.
  25. !! Contributed by Steve Chamberlain.
  26. !! sac@cygnus.com
  27. !! ashiftrt_r4_x, ___ashrsi3, ___ashlsi3, ___lshrsi3 routines
  28. !! recoded in assembly by Toshiyasu Morita
  29. !! tm@netcom.com
  30. /* SH2 optimizations for ___ashrsi3, ___ashlsi3, ___lshrsi3 and
  31. ELF local label prefixes by J"orn Rennecke
  32. amylaar@cygnus.com */
  33. .text
  34. .balign 4
  35. .global __movmem
  36. .global __movstr
  37. .set __movstr, __movmem
  38. /* This would be a lot simpler if r6 contained the byte count
  39. minus 64, and we wouldn't be called here for a byte count of 64. */
  40. __movmem:
  41. sts.l pr,@-r15
  42. shll2 r6
  43. bsr __movmemSI52+2
  44. mov.l @(48,r5),r0
  45. .balign 4
  46. movmem_loop: /* Reached with rts */
  47. mov.l @(60,r5),r0
  48. add #-64,r6
  49. mov.l r0,@(60,r4)
  50. tst r6,r6
  51. mov.l @(56,r5),r0
  52. bt movmem_done
  53. mov.l r0,@(56,r4)
  54. cmp/pl r6
  55. mov.l @(52,r5),r0
  56. add #64,r5
  57. mov.l r0,@(52,r4)
  58. add #64,r4
  59. bt __movmemSI52
  60. ! done all the large groups, do the remainder
  61. ! jump to movmem+
  62. mova __movmemSI4+4,r0
  63. add r6,r0
  64. jmp @r0
  65. movmem_done: ! share slot insn, works out aligned.
  66. lds.l @r15+,pr
  67. mov.l r0,@(56,r4)
  68. mov.l @(52,r5),r0
  69. rts
  70. mov.l r0,@(52,r4)
  71. .balign 4
  72. .global __movmemSI64
  73. .global __movstrSI64
  74. .set __movstrSI64, __movmemSI64
  75. __movmemSI64:
  76. mov.l @(60,r5),r0
  77. mov.l r0,@(60,r4)
  78. .global __movmemSI60
  79. .global __movstrSI60
  80. .set __movstrSI60, __movmemSI60
  81. __movmemSI60:
  82. mov.l @(56,r5),r0
  83. mov.l r0,@(56,r4)
  84. .global __movmemSI56
  85. .global __movstrSI56
  86. .set __movstrSI56, __movmemSI56
  87. __movmemSI56:
  88. mov.l @(52,r5),r0
  89. mov.l r0,@(52,r4)
  90. .global __movmemSI52
  91. .global __movstrSI52
  92. .set __movstrSI52, __movmemSI52
  93. __movmemSI52:
  94. mov.l @(48,r5),r0
  95. mov.l r0,@(48,r4)
  96. .global __movmemSI48
  97. .global __movstrSI48
  98. .set __movstrSI48, __movmemSI48
  99. __movmemSI48:
  100. mov.l @(44,r5),r0
  101. mov.l r0,@(44,r4)
  102. .global __movmemSI44
  103. .global __movstrSI44
  104. .set __movstrSI44, __movmemSI44
  105. __movmemSI44:
  106. mov.l @(40,r5),r0
  107. mov.l r0,@(40,r4)
  108. .global __movmemSI40
  109. .global __movstrSI40
  110. .set __movstrSI40, __movmemSI40
  111. __movmemSI40:
  112. mov.l @(36,r5),r0
  113. mov.l r0,@(36,r4)
  114. .global __movmemSI36
  115. .global __movstrSI36
  116. .set __movstrSI36, __movmemSI36
  117. __movmemSI36:
  118. mov.l @(32,r5),r0
  119. mov.l r0,@(32,r4)
  120. .global __movmemSI32
  121. .global __movstrSI32
  122. .set __movstrSI32, __movmemSI32
  123. __movmemSI32:
  124. mov.l @(28,r5),r0
  125. mov.l r0,@(28,r4)
  126. .global __movmemSI28
  127. .global __movstrSI28
  128. .set __movstrSI28, __movmemSI28
  129. __movmemSI28:
  130. mov.l @(24,r5),r0
  131. mov.l r0,@(24,r4)
  132. .global __movmemSI24
  133. .global __movstrSI24
  134. .set __movstrSI24, __movmemSI24
  135. __movmemSI24:
  136. mov.l @(20,r5),r0
  137. mov.l r0,@(20,r4)
  138. .global __movmemSI20
  139. .global __movstrSI20
  140. .set __movstrSI20, __movmemSI20
  141. __movmemSI20:
  142. mov.l @(16,r5),r0
  143. mov.l r0,@(16,r4)
  144. .global __movmemSI16
  145. .global __movstrSI16
  146. .set __movstrSI16, __movmemSI16
  147. __movmemSI16:
  148. mov.l @(12,r5),r0
  149. mov.l r0,@(12,r4)
  150. .global __movmemSI12
  151. .global __movstrSI12
  152. .set __movstrSI12, __movmemSI12
  153. __movmemSI12:
  154. mov.l @(8,r5),r0
  155. mov.l r0,@(8,r4)
  156. .global __movmemSI8
  157. .global __movstrSI8
  158. .set __movstrSI8, __movmemSI8
  159. __movmemSI8:
  160. mov.l @(4,r5),r0
  161. mov.l r0,@(4,r4)
  162. .global __movmemSI4
  163. .global __movstrSI4
  164. .set __movstrSI4, __movmemSI4
  165. __movmemSI4:
  166. mov.l @(0,r5),r0
  167. rts
  168. mov.l r0,@(0,r4)
  169. .global __movmem_i4_even
  170. .global __movstr_i4_even
  171. .set __movstr_i4_even, __movmem_i4_even
  172. .global __movmem_i4_odd
  173. .global __movstr_i4_odd
  174. .set __movstr_i4_odd, __movmem_i4_odd
  175. .global __movmemSI12_i4
  176. .global __movstrSI12_i4
  177. .set __movstrSI12_i4, __movmemSI12_i4
  178. .p2align 5
  179. L_movmem_2mod4_end:
  180. mov.l r0,@(16,r4)
  181. rts
  182. mov.l r1,@(20,r4)
  183. .p2align 2
  184. __movmem_i4_even:
  185. mov.l @r5+,r0
  186. bra L_movmem_start_even
  187. mov.l @r5+,r1
  188. __movmem_i4_odd:
  189. mov.l @r5+,r1
  190. add #-4,r4
  191. mov.l @r5+,r2
  192. mov.l @r5+,r3
  193. mov.l r1,@(4,r4)
  194. mov.l r2,@(8,r4)
  195. L_movmem_loop:
  196. mov.l r3,@(12,r4)
  197. dt r6
  198. mov.l @r5+,r0
  199. bt/s L_movmem_2mod4_end
  200. mov.l @r5+,r1
  201. add #16,r4
  202. L_movmem_start_even:
  203. mov.l @r5+,r2
  204. mov.l @r5+,r3
  205. mov.l r0,@r4
  206. dt r6
  207. mov.l r1,@(4,r4)
  208. bf/s L_movmem_loop
  209. mov.l r2,@(8,r4)
  210. rts
  211. mov.l r3,@(12,r4)
  212. .p2align 4
  213. __movmemSI12_i4:
  214. mov.l @r5,r0
  215. mov.l @(4,r5),r1
  216. mov.l @(8,r5),r2
  217. mov.l r0,@r4
  218. mov.l r1,@(4,r4)
  219. rts
  220. mov.l r2,@(8,r4)