ashrsi3.S 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  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. !
  34. ! __ashrsi3
  35. !
  36. ! Entry:
  37. !
  38. ! r4: Value to shift
  39. ! r5: Shifts
  40. !
  41. ! Exit:
  42. !
  43. ! r0: Result
  44. !
  45. ! Destroys:
  46. !
  47. ! (none)
  48. !
  49. ! __ashrsi3_r0
  50. !
  51. ! Entry:
  52. !
  53. ! r4: Value to shift
  54. ! r0: Shifts
  55. !
  56. ! Exit:
  57. !
  58. ! r0: Result
  59. !
  60. ! Destroys:
  61. !
  62. ! (none)
  63. .global __ashrsi3
  64. .global __ashrsi3_r0
  65. .align 2
  66. __ashrsi3:
  67. mov r5,r0
  68. .align 2
  69. __ashrsi3_r0:
  70. and #31,r0
  71. mov.l r4,@-r15
  72. mov r0,r4
  73. mova ashrsi3_table,r0
  74. mov.b @(r0,r4),r4
  75. add r4,r0
  76. jmp @r0
  77. mov.l @r15+,r0
  78. .align 2
  79. ashrsi3_table:
  80. .byte ashrsi3_0-ashrsi3_table
  81. .byte ashrsi3_1-ashrsi3_table
  82. .byte ashrsi3_2-ashrsi3_table
  83. .byte ashrsi3_3-ashrsi3_table
  84. .byte ashrsi3_4-ashrsi3_table
  85. .byte ashrsi3_5-ashrsi3_table
  86. .byte ashrsi3_6-ashrsi3_table
  87. .byte ashrsi3_7-ashrsi3_table
  88. .byte ashrsi3_8-ashrsi3_table
  89. .byte ashrsi3_9-ashrsi3_table
  90. .byte ashrsi3_10-ashrsi3_table
  91. .byte ashrsi3_11-ashrsi3_table
  92. .byte ashrsi3_12-ashrsi3_table
  93. .byte ashrsi3_13-ashrsi3_table
  94. .byte ashrsi3_14-ashrsi3_table
  95. .byte ashrsi3_15-ashrsi3_table
  96. .byte ashrsi3_16-ashrsi3_table
  97. .byte ashrsi3_17-ashrsi3_table
  98. .byte ashrsi3_18-ashrsi3_table
  99. .byte ashrsi3_19-ashrsi3_table
  100. .byte ashrsi3_20-ashrsi3_table
  101. .byte ashrsi3_21-ashrsi3_table
  102. .byte ashrsi3_22-ashrsi3_table
  103. .byte ashrsi3_23-ashrsi3_table
  104. .byte ashrsi3_24-ashrsi3_table
  105. .byte ashrsi3_25-ashrsi3_table
  106. .byte ashrsi3_26-ashrsi3_table
  107. .byte ashrsi3_27-ashrsi3_table
  108. .byte ashrsi3_28-ashrsi3_table
  109. .byte ashrsi3_29-ashrsi3_table
  110. .byte ashrsi3_30-ashrsi3_table
  111. .byte ashrsi3_31-ashrsi3_table
  112. ashrsi3_31:
  113. rotcl r0
  114. rts
  115. subc r0,r0
  116. ashrsi3_30:
  117. shar r0
  118. ashrsi3_29:
  119. shar r0
  120. ashrsi3_28:
  121. shar r0
  122. ashrsi3_27:
  123. shar r0
  124. ashrsi3_26:
  125. shar r0
  126. ashrsi3_25:
  127. shar r0
  128. ashrsi3_24:
  129. shlr16 r0
  130. shlr8 r0
  131. rts
  132. exts.b r0,r0
  133. ashrsi3_23:
  134. shar r0
  135. ashrsi3_22:
  136. shar r0
  137. ashrsi3_21:
  138. shar r0
  139. ashrsi3_20:
  140. shar r0
  141. ashrsi3_19:
  142. shar r0
  143. ashrsi3_18:
  144. shar r0
  145. ashrsi3_17:
  146. shar r0
  147. ashrsi3_16:
  148. shlr16 r0
  149. rts
  150. exts.w r0,r0
  151. ashrsi3_15:
  152. shar r0
  153. ashrsi3_14:
  154. shar r0
  155. ashrsi3_13:
  156. shar r0
  157. ashrsi3_12:
  158. shar r0
  159. ashrsi3_11:
  160. shar r0
  161. ashrsi3_10:
  162. shar r0
  163. ashrsi3_9:
  164. shar r0
  165. ashrsi3_8:
  166. shar r0
  167. ashrsi3_7:
  168. shar r0
  169. ashrsi3_6:
  170. shar r0
  171. ashrsi3_5:
  172. shar r0
  173. ashrsi3_4:
  174. shar r0
  175. ashrsi3_3:
  176. shar r0
  177. ashrsi3_2:
  178. shar r0
  179. ashrsi3_1:
  180. rts
  181. shar r0
  182. ashrsi3_0:
  183. rts
  184. nop