lshrsi3.S 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  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. ! __lshrsi3
  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. ! __lshrsi3_r0
  50. !
  51. ! Entry:
  52. !
  53. ! r0: Value to shift
  54. ! r5: Shifts
  55. !
  56. ! Exit:
  57. !
  58. ! r0: Result
  59. !
  60. ! Destroys:
  61. !
  62. ! (none)
  63. !
  64. .global __lshrsi3
  65. .global __lshrsi3_r0
  66. .align 2
  67. __lshrsi3:
  68. mov r5,r0
  69. .align 2
  70. __lshrsi3_r0:
  71. and #31,r0
  72. mov.l r4,@-r15
  73. mov r0,r4
  74. mova lshrsi3_table,r0
  75. mov.b @(r0,r4),r4
  76. add r4,r0
  77. jmp @r0
  78. mov.l @r15+,r0
  79. .align 2
  80. lshrsi3_table:
  81. .byte lshrsi3_0-lshrsi3_table
  82. .byte lshrsi3_1-lshrsi3_table
  83. .byte lshrsi3_2-lshrsi3_table
  84. .byte lshrsi3_3-lshrsi3_table
  85. .byte lshrsi3_4-lshrsi3_table
  86. .byte lshrsi3_5-lshrsi3_table
  87. .byte lshrsi3_6-lshrsi3_table
  88. .byte lshrsi3_7-lshrsi3_table
  89. .byte lshrsi3_8-lshrsi3_table
  90. .byte lshrsi3_9-lshrsi3_table
  91. .byte lshrsi3_10-lshrsi3_table
  92. .byte lshrsi3_11-lshrsi3_table
  93. .byte lshrsi3_12-lshrsi3_table
  94. .byte lshrsi3_13-lshrsi3_table
  95. .byte lshrsi3_14-lshrsi3_table
  96. .byte lshrsi3_15-lshrsi3_table
  97. .byte lshrsi3_16-lshrsi3_table
  98. .byte lshrsi3_17-lshrsi3_table
  99. .byte lshrsi3_18-lshrsi3_table
  100. .byte lshrsi3_19-lshrsi3_table
  101. .byte lshrsi3_20-lshrsi3_table
  102. .byte lshrsi3_21-lshrsi3_table
  103. .byte lshrsi3_22-lshrsi3_table
  104. .byte lshrsi3_23-lshrsi3_table
  105. .byte lshrsi3_24-lshrsi3_table
  106. .byte lshrsi3_25-lshrsi3_table
  107. .byte lshrsi3_26-lshrsi3_table
  108. .byte lshrsi3_27-lshrsi3_table
  109. .byte lshrsi3_28-lshrsi3_table
  110. .byte lshrsi3_29-lshrsi3_table
  111. .byte lshrsi3_30-lshrsi3_table
  112. .byte lshrsi3_31-lshrsi3_table
  113. lshrsi3_6:
  114. shlr2 r0
  115. lshrsi3_4:
  116. shlr2 r0
  117. lshrsi3_2:
  118. rts
  119. shlr2 r0
  120. lshrsi3_7:
  121. shlr2 r0
  122. lshrsi3_5:
  123. shlr2 r0
  124. lshrsi3_3:
  125. shlr2 r0
  126. lshrsi3_1:
  127. rts
  128. shlr r0
  129. lshrsi3_14:
  130. shlr2 r0
  131. lshrsi3_12:
  132. shlr2 r0
  133. lshrsi3_10:
  134. shlr2 r0
  135. lshrsi3_8:
  136. rts
  137. shlr8 r0
  138. lshrsi3_15:
  139. shlr2 r0
  140. lshrsi3_13:
  141. shlr2 r0
  142. lshrsi3_11:
  143. shlr2 r0
  144. lshrsi3_9:
  145. shlr8 r0
  146. rts
  147. shlr r0
  148. lshrsi3_22:
  149. shlr2 r0
  150. lshrsi3_20:
  151. shlr2 r0
  152. lshrsi3_18:
  153. shlr2 r0
  154. lshrsi3_16:
  155. rts
  156. shlr16 r0
  157. lshrsi3_23:
  158. shlr2 r0
  159. lshrsi3_21:
  160. shlr2 r0
  161. lshrsi3_19:
  162. shlr2 r0
  163. lshrsi3_17:
  164. shlr16 r0
  165. rts
  166. shlr r0
  167. lshrsi3_30:
  168. shlr2 r0
  169. lshrsi3_28:
  170. shlr2 r0
  171. lshrsi3_26:
  172. shlr2 r0
  173. lshrsi3_24:
  174. shlr16 r0
  175. rts
  176. shlr8 r0
  177. lshrsi3_31:
  178. shlr2 r0
  179. lshrsi3_29:
  180. shlr2 r0
  181. lshrsi3_27:
  182. shlr2 r0
  183. lshrsi3_25:
  184. shlr16 r0
  185. shlr8 r0
  186. rts
  187. shlr r0
  188. lshrsi3_0:
  189. rts
  190. nop