lshrsi3.S 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  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. .global __lshrsi3
  50. .align 2
  51. __lshrsi3:
  52. mov #31,r0
  53. and r0,r5
  54. mova lshrsi3_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. lshrsi3_table:
  65. .byte lshrsi3_0-lshrsi3_table
  66. .byte lshrsi3_1-lshrsi3_table
  67. .byte lshrsi3_2-lshrsi3_table
  68. .byte lshrsi3_3-lshrsi3_table
  69. .byte lshrsi3_4-lshrsi3_table
  70. .byte lshrsi3_5-lshrsi3_table
  71. .byte lshrsi3_6-lshrsi3_table
  72. .byte lshrsi3_7-lshrsi3_table
  73. .byte lshrsi3_8-lshrsi3_table
  74. .byte lshrsi3_9-lshrsi3_table
  75. .byte lshrsi3_10-lshrsi3_table
  76. .byte lshrsi3_11-lshrsi3_table
  77. .byte lshrsi3_12-lshrsi3_table
  78. .byte lshrsi3_13-lshrsi3_table
  79. .byte lshrsi3_14-lshrsi3_table
  80. .byte lshrsi3_15-lshrsi3_table
  81. .byte lshrsi3_16-lshrsi3_table
  82. .byte lshrsi3_17-lshrsi3_table
  83. .byte lshrsi3_18-lshrsi3_table
  84. .byte lshrsi3_19-lshrsi3_table
  85. .byte lshrsi3_20-lshrsi3_table
  86. .byte lshrsi3_21-lshrsi3_table
  87. .byte lshrsi3_22-lshrsi3_table
  88. .byte lshrsi3_23-lshrsi3_table
  89. .byte lshrsi3_24-lshrsi3_table
  90. .byte lshrsi3_25-lshrsi3_table
  91. .byte lshrsi3_26-lshrsi3_table
  92. .byte lshrsi3_27-lshrsi3_table
  93. .byte lshrsi3_28-lshrsi3_table
  94. .byte lshrsi3_29-lshrsi3_table
  95. .byte lshrsi3_30-lshrsi3_table
  96. .byte lshrsi3_31-lshrsi3_table
  97. lshrsi3_6:
  98. shlr2 r0
  99. lshrsi3_4:
  100. shlr2 r0
  101. lshrsi3_2:
  102. rts
  103. shlr2 r0
  104. lshrsi3_7:
  105. shlr2 r0
  106. lshrsi3_5:
  107. shlr2 r0
  108. lshrsi3_3:
  109. shlr2 r0
  110. lshrsi3_1:
  111. rts
  112. shlr r0
  113. lshrsi3_14:
  114. shlr2 r0
  115. lshrsi3_12:
  116. shlr2 r0
  117. lshrsi3_10:
  118. shlr2 r0
  119. lshrsi3_8:
  120. rts
  121. shlr8 r0
  122. lshrsi3_15:
  123. shlr2 r0
  124. lshrsi3_13:
  125. shlr2 r0
  126. lshrsi3_11:
  127. shlr2 r0
  128. lshrsi3_9:
  129. shlr8 r0
  130. rts
  131. shlr r0
  132. lshrsi3_22:
  133. shlr2 r0
  134. lshrsi3_20:
  135. shlr2 r0
  136. lshrsi3_18:
  137. shlr2 r0
  138. lshrsi3_16:
  139. rts
  140. shlr16 r0
  141. lshrsi3_23:
  142. shlr2 r0
  143. lshrsi3_21:
  144. shlr2 r0
  145. lshrsi3_19:
  146. shlr2 r0
  147. lshrsi3_17:
  148. shlr16 r0
  149. rts
  150. shlr r0
  151. lshrsi3_30:
  152. shlr2 r0
  153. lshrsi3_28:
  154. shlr2 r0
  155. lshrsi3_26:
  156. shlr2 r0
  157. lshrsi3_24:
  158. shlr16 r0
  159. rts
  160. shlr8 r0
  161. lshrsi3_31:
  162. shlr2 r0
  163. lshrsi3_29:
  164. shlr2 r0
  165. lshrsi3_27:
  166. shlr2 r0
  167. lshrsi3_25:
  168. shlr16 r0
  169. shlr8 r0
  170. rts
  171. shlr r0
  172. lshrsi3_0:
  173. rts
  174. nop