srli.S 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. ; Copyright (C) 2012-2015 Free Software Foundation, Inc.
  2. ; Contributed by Red Hat.
  3. ;
  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 3, or (at your option) any
  7. ; later version.
  8. ;
  9. ; This file is distributed in the hope that it will be useful, but
  10. ; WITHOUT ANY WARRANTY; without even the implied warranty of
  11. ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. ; General Public License for more details.
  13. ;
  14. ; Under Section 7 of GPL version 3, you are granted additional
  15. ; permissions described in the GCC Runtime Library Exception, version
  16. ; 3.1, as published by the Free Software Foundation.
  17. ;
  18. ; You should have received a copy of the GNU General Public License and
  19. ; a copy of the GCC Runtime Library Exception along with this program;
  20. ; see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
  21. ; <http://www.gnu.org/licenses/>.
  22. .text
  23. .macro _srli n
  24. .global __mspabi_srli_\n
  25. __mspabi_srli_\n:
  26. CLRC
  27. RRC.W R12
  28. .endm
  29. /* Logical Right Shift - R12 -> R12 */
  30. _srli 15
  31. _srli 14
  32. _srli 13
  33. _srli 12
  34. _srli 11
  35. _srli 10
  36. _srli 9
  37. _srli 8
  38. _srli 7
  39. _srli 6
  40. _srli 5
  41. _srli 4
  42. _srli 3
  43. _srli 2
  44. _srli 1
  45. #ifdef __MSP430X_LARGE__
  46. RETA
  47. #else
  48. RET
  49. #endif
  50. 1: ADD.W #-1,R13
  51. CLRC
  52. RRC.W R12,R12
  53. .global __mspabi_srli
  54. __mspabi_srli:
  55. CMP #0,R13
  56. JNZ 1b
  57. #ifdef __MSP430X_LARGE__
  58. RETA
  59. #else
  60. RET
  61. #endif
  62. /* Logical Right Shift - R12:R13 -> R12:R13 */
  63. .macro _srll n
  64. .global __mspabi_srll_\n
  65. __mspabi_srll_\n:
  66. CLRC
  67. RRC.W R13
  68. RRC.W R12
  69. .endm
  70. _srll 15
  71. _srll 14
  72. _srll 13
  73. _srll 12
  74. _srll 11
  75. _srll 10
  76. _srll 9
  77. _srll 8
  78. _srll 7
  79. _srll 6
  80. _srll 5
  81. _srll 4
  82. _srll 3
  83. _srll 2
  84. _srll 1
  85. #ifdef __MSP430X_LARGE__
  86. RETA
  87. #else
  88. RET
  89. #endif
  90. 1: ADD.W #-1,R14
  91. CLRC
  92. RRC.W R13
  93. RRC.W R12
  94. .global __mspabi_srll
  95. __mspabi_srll:
  96. CMP #0,R14
  97. JNZ 1b
  98. #ifdef __MSP430X_LARGE__
  99. RETA
  100. #else
  101. RET
  102. #endif