ashrsi3.S 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  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. .global __ashrsi3
  50. .align 2
  51. __ashrsi3:
  52. mov #31,r0
  53. and r0,r5
  54. mova ashrsi3_table,r0
  55. mov.b @(r0,r5),r5
  56. #ifdef __sh1__
  57. add r5,r0
  58. jmp @r0
  59. #else
  60. braf r5
  61. #endif
  62. mov r4,r0
  63. .align 2
  64. ashrsi3_table:
  65. .byte ashrsi3_0-ashrsi3_table
  66. .byte ashrsi3_1-ashrsi3_table
  67. .byte ashrsi3_2-ashrsi3_table
  68. .byte ashrsi3_3-ashrsi3_table
  69. .byte ashrsi3_4-ashrsi3_table
  70. .byte ashrsi3_5-ashrsi3_table
  71. .byte ashrsi3_6-ashrsi3_table
  72. .byte ashrsi3_7-ashrsi3_table
  73. .byte ashrsi3_8-ashrsi3_table
  74. .byte ashrsi3_9-ashrsi3_table
  75. .byte ashrsi3_10-ashrsi3_table
  76. .byte ashrsi3_11-ashrsi3_table
  77. .byte ashrsi3_12-ashrsi3_table
  78. .byte ashrsi3_13-ashrsi3_table
  79. .byte ashrsi3_14-ashrsi3_table
  80. .byte ashrsi3_15-ashrsi3_table
  81. .byte ashrsi3_16-ashrsi3_table
  82. .byte ashrsi3_17-ashrsi3_table
  83. .byte ashrsi3_18-ashrsi3_table
  84. .byte ashrsi3_19-ashrsi3_table
  85. .byte ashrsi3_20-ashrsi3_table
  86. .byte ashrsi3_21-ashrsi3_table
  87. .byte ashrsi3_22-ashrsi3_table
  88. .byte ashrsi3_23-ashrsi3_table
  89. .byte ashrsi3_24-ashrsi3_table
  90. .byte ashrsi3_25-ashrsi3_table
  91. .byte ashrsi3_26-ashrsi3_table
  92. .byte ashrsi3_27-ashrsi3_table
  93. .byte ashrsi3_28-ashrsi3_table
  94. .byte ashrsi3_29-ashrsi3_table
  95. .byte ashrsi3_30-ashrsi3_table
  96. .byte ashrsi3_31-ashrsi3_table
  97. ashrsi3_31:
  98. rotcl r0
  99. rts
  100. subc r0,r0
  101. ashrsi3_30:
  102. shar r0
  103. ashrsi3_29:
  104. shar r0
  105. ashrsi3_28:
  106. shar r0
  107. ashrsi3_27:
  108. shar r0
  109. ashrsi3_26:
  110. shar r0
  111. ashrsi3_25:
  112. shar r0
  113. ashrsi3_24:
  114. shlr16 r0
  115. shlr8 r0
  116. rts
  117. exts.b r0,r0
  118. ashrsi3_23:
  119. shar r0
  120. ashrsi3_22:
  121. shar r0
  122. ashrsi3_21:
  123. shar r0
  124. ashrsi3_20:
  125. shar r0
  126. ashrsi3_19:
  127. shar r0
  128. ashrsi3_18:
  129. shar r0
  130. ashrsi3_17:
  131. shar r0
  132. ashrsi3_16:
  133. shlr16 r0
  134. rts
  135. exts.w r0,r0
  136. ashrsi3_15:
  137. shar r0
  138. ashrsi3_14:
  139. shar r0
  140. ashrsi3_13:
  141. shar r0
  142. ashrsi3_12:
  143. shar r0
  144. ashrsi3_11:
  145. shar r0
  146. ashrsi3_10:
  147. shar r0
  148. ashrsi3_9:
  149. shar r0
  150. ashrsi3_8:
  151. shar r0
  152. ashrsi3_7:
  153. shar r0
  154. ashrsi3_6:
  155. shar r0
  156. ashrsi3_5:
  157. shar r0
  158. ashrsi3_4:
  159. shar r0
  160. ashrsi3_3:
  161. shar r0
  162. ashrsi3_2:
  163. shar r0
  164. ashrsi3_1:
  165. rts
  166. shar r0
  167. ashrsi3_0:
  168. rts
  169. nop