movmem.S 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  1. /* SPDX-License-Identifier: GPL-2.0+ */
  2. /* Copyright (C) 1994, 1995, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
  3. 2004, 2005, 2006
  4. Free Software Foundation, Inc.
  5. */
  6. !! libgcc routines for the Renesas / SuperH SH CPUs.
  7. !! Contributed by Steve Chamberlain.
  8. !! sac@cygnus.com
  9. !! ashiftrt_r4_x, ___ashrsi3, ___ashlsi3, ___lshrsi3 routines
  10. !! recoded in assembly by Toshiyasu Morita
  11. !! tm@netcom.com
  12. /* SH2 optimizations for ___ashrsi3, ___ashlsi3, ___lshrsi3 and
  13. ELF local label prefixes by J"orn Rennecke
  14. amylaar@cygnus.com */
  15. .text
  16. .balign 4
  17. .global __movmem
  18. .global __movstr
  19. .set __movstr, __movmem
  20. /* This would be a lot simpler if r6 contained the byte count
  21. minus 64, and we wouldn't be called here for a byte count of 64. */
  22. __movmem:
  23. sts.l pr,@-r15
  24. shll2 r6
  25. bsr __movmemSI52+2
  26. mov.l @(48,r5),r0
  27. .balign 4
  28. movmem_loop: /* Reached with rts */
  29. mov.l @(60,r5),r0
  30. add #-64,r6
  31. mov.l r0,@(60,r4)
  32. tst r6,r6
  33. mov.l @(56,r5),r0
  34. bt movmem_done
  35. mov.l r0,@(56,r4)
  36. cmp/pl r6
  37. mov.l @(52,r5),r0
  38. add #64,r5
  39. mov.l r0,@(52,r4)
  40. add #64,r4
  41. bt __movmemSI52
  42. ! done all the large groups, do the remainder
  43. ! jump to movmem+
  44. mova __movmemSI4+4,r0
  45. add r6,r0
  46. jmp @r0
  47. movmem_done: ! share slot insn, works out aligned.
  48. lds.l @r15+,pr
  49. mov.l r0,@(56,r4)
  50. mov.l @(52,r5),r0
  51. rts
  52. mov.l r0,@(52,r4)
  53. .balign 4
  54. .global __movmemSI64
  55. .global __movstrSI64
  56. .set __movstrSI64, __movmemSI64
  57. __movmemSI64:
  58. mov.l @(60,r5),r0
  59. mov.l r0,@(60,r4)
  60. .global __movmemSI60
  61. .global __movstrSI60
  62. .set __movstrSI60, __movmemSI60
  63. __movmemSI60:
  64. mov.l @(56,r5),r0
  65. mov.l r0,@(56,r4)
  66. .global __movmemSI56
  67. .global __movstrSI56
  68. .set __movstrSI56, __movmemSI56
  69. __movmemSI56:
  70. mov.l @(52,r5),r0
  71. mov.l r0,@(52,r4)
  72. .global __movmemSI52
  73. .global __movstrSI52
  74. .set __movstrSI52, __movmemSI52
  75. __movmemSI52:
  76. mov.l @(48,r5),r0
  77. mov.l r0,@(48,r4)
  78. .global __movmemSI48
  79. .global __movstrSI48
  80. .set __movstrSI48, __movmemSI48
  81. __movmemSI48:
  82. mov.l @(44,r5),r0
  83. mov.l r0,@(44,r4)
  84. .global __movmemSI44
  85. .global __movstrSI44
  86. .set __movstrSI44, __movmemSI44
  87. __movmemSI44:
  88. mov.l @(40,r5),r0
  89. mov.l r0,@(40,r4)
  90. .global __movmemSI40
  91. .global __movstrSI40
  92. .set __movstrSI40, __movmemSI40
  93. __movmemSI40:
  94. mov.l @(36,r5),r0
  95. mov.l r0,@(36,r4)
  96. .global __movmemSI36
  97. .global __movstrSI36
  98. .set __movstrSI36, __movmemSI36
  99. __movmemSI36:
  100. mov.l @(32,r5),r0
  101. mov.l r0,@(32,r4)
  102. .global __movmemSI32
  103. .global __movstrSI32
  104. .set __movstrSI32, __movmemSI32
  105. __movmemSI32:
  106. mov.l @(28,r5),r0
  107. mov.l r0,@(28,r4)
  108. .global __movmemSI28
  109. .global __movstrSI28
  110. .set __movstrSI28, __movmemSI28
  111. __movmemSI28:
  112. mov.l @(24,r5),r0
  113. mov.l r0,@(24,r4)
  114. .global __movmemSI24
  115. .global __movstrSI24
  116. .set __movstrSI24, __movmemSI24
  117. __movmemSI24:
  118. mov.l @(20,r5),r0
  119. mov.l r0,@(20,r4)
  120. .global __movmemSI20
  121. .global __movstrSI20
  122. .set __movstrSI20, __movmemSI20
  123. __movmemSI20:
  124. mov.l @(16,r5),r0
  125. mov.l r0,@(16,r4)
  126. .global __movmemSI16
  127. .global __movstrSI16
  128. .set __movstrSI16, __movmemSI16
  129. __movmemSI16:
  130. mov.l @(12,r5),r0
  131. mov.l r0,@(12,r4)
  132. .global __movmemSI12
  133. .global __movstrSI12
  134. .set __movstrSI12, __movmemSI12
  135. __movmemSI12:
  136. mov.l @(8,r5),r0
  137. mov.l r0,@(8,r4)
  138. .global __movmemSI8
  139. .global __movstrSI8
  140. .set __movstrSI8, __movmemSI8
  141. __movmemSI8:
  142. mov.l @(4,r5),r0
  143. mov.l r0,@(4,r4)
  144. .global __movmemSI4
  145. .global __movstrSI4
  146. .set __movstrSI4, __movmemSI4
  147. __movmemSI4:
  148. mov.l @(0,r5),r0
  149. rts
  150. mov.l r0,@(0,r4)
  151. .global __movmem_i4_even
  152. .global __movstr_i4_even
  153. .set __movstr_i4_even, __movmem_i4_even
  154. .global __movmem_i4_odd
  155. .global __movstr_i4_odd
  156. .set __movstr_i4_odd, __movmem_i4_odd
  157. .global __movmemSI12_i4
  158. .global __movstrSI12_i4
  159. .set __movstrSI12_i4, __movmemSI12_i4
  160. .p2align 5
  161. L_movmem_2mod4_end:
  162. mov.l r0,@(16,r4)
  163. rts
  164. mov.l r1,@(20,r4)
  165. .p2align 2
  166. __movmem_i4_even:
  167. mov.l @r5+,r0
  168. bra L_movmem_start_even
  169. mov.l @r5+,r1
  170. __movmem_i4_odd:
  171. mov.l @r5+,r1
  172. add #-4,r4
  173. mov.l @r5+,r2
  174. mov.l @r5+,r3
  175. mov.l r1,@(4,r4)
  176. mov.l r2,@(8,r4)
  177. L_movmem_loop:
  178. mov.l r3,@(12,r4)
  179. dt r6
  180. mov.l @r5+,r0
  181. bt/s L_movmem_2mod4_end
  182. mov.l @r5+,r1
  183. add #16,r4
  184. L_movmem_start_even:
  185. mov.l @r5+,r2
  186. mov.l @r5+,r3
  187. mov.l r0,@r4
  188. dt r6
  189. mov.l r1,@(4,r4)
  190. bf/s L_movmem_loop
  191. mov.l r2,@(8,r4)
  192. rts
  193. mov.l r3,@(12,r4)
  194. .p2align 4
  195. __movmemSI12_i4:
  196. mov.l @r5,r0
  197. mov.l @(4,r5),r1
  198. mov.l @(8,r5),r2
  199. mov.l r0,@r4
  200. mov.l r1,@(4,r4)
  201. rts
  202. mov.l r2,@(8,r4)