lshiftrt.S 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  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