darwin-vecsave.S 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. /* This file contains the vector save and restore routines.
  2. *
  3. * Copyright (C) 2004-2022 Free Software Foundation, Inc.
  4. *
  5. * This file is free software; you can redistribute it and/or modify it
  6. * under the terms of the GNU General Public License as published by the
  7. * Free Software Foundation; either version 3, or (at your option) any
  8. * later version.
  9. *
  10. * This file is distributed in the hope that it will be useful, but
  11. * WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  13. * General Public License for more details.
  14. *
  15. * Under Section 7 of GPL version 3, you are granted additional
  16. * permissions described in the GCC Runtime Library Exception, version
  17. * 3.1, as published by the Free Software Foundation.
  18. *
  19. * You should have received a copy of the GNU General Public License and
  20. * a copy of the GCC Runtime Library Exception along with this program;
  21. * see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
  22. * <http://www.gnu.org/licenses/>.
  23. */
  24. /* Vector save/restore routines for Darwin. Note that each vector
  25. save/restore requires 2 instructions (8 bytes.)
  26. THE SAVE AND RESTORE ROUTINES CAN HAVE ONLY ONE GLOBALLY VISIBLE
  27. ENTRY POINT - callers have to jump to "saveFP+60" to save f29..f31,
  28. for example. For FP reg saves/restores, it takes one instruction
  29. (4 bytes) to do the operation; for Vector regs, 2 instructions are
  30. required (8 bytes.). */
  31. /* With some assemblers, we need the correct machine directive to get the
  32. right CPU type / subtype in the file header. */
  33. #if __ppc64__
  34. .machine ppc64
  35. #else
  36. .machine ppc7400
  37. #endif
  38. .text
  39. .align 2
  40. .private_extern saveVEC
  41. saveVEC:
  42. li r11,-192
  43. stvx v20,r11,r0
  44. li r11,-176
  45. stvx v21,r11,r0
  46. li r11,-160
  47. stvx v22,r11,r0
  48. li r11,-144
  49. stvx v23,r11,r0
  50. li r11,-128
  51. stvx v24,r11,r0
  52. li r11,-112
  53. stvx v25,r11,r0
  54. li r11,-96
  55. stvx v26,r11,r0
  56. li r11,-80
  57. stvx v27,r11,r0
  58. li r11,-64
  59. stvx v28,r11,r0
  60. li r11,-48
  61. stvx v29,r11,r0
  62. li r11,-32
  63. stvx v30,r11,r0
  64. li r11,-16
  65. stvx v31,r11,r0
  66. blr
  67. .private_extern restVEC
  68. restVEC:
  69. li r11,-192
  70. lvx v20,r11,r0
  71. li r11,-176
  72. lvx v21,r11,r0
  73. li r11,-160
  74. lvx v22,r11,r0
  75. li r11,-144
  76. lvx v23,r11,r0
  77. li r11,-128
  78. lvx v24,r11,r0
  79. li r11,-112
  80. lvx v25,r11,r0
  81. li r11,-96
  82. lvx v26,r11,r0
  83. li r11,-80
  84. lvx v27,r11,r0
  85. li r11,-64
  86. lvx v28,r11,r0
  87. li r11,-48
  88. lvx v29,r11,r0
  89. li r11,-32
  90. lvx v30,r11,r0
  91. li r11,-16
  92. lvx v31,r11,r0
  93. blr
  94. /* saveVEC_vr11 -- as saveVEC but VRsave is returned in R11. */
  95. .private_extern saveVEC_vr11
  96. saveVEC_vr11:
  97. li r11,-192
  98. stvx v20,r11,r0
  99. li r11,-176
  100. stvx v21,r11,r0
  101. li r11,-160
  102. stvx v22,r11,r0
  103. li r11,-144
  104. stvx v23,r11,r0
  105. li r11,-128
  106. stvx v24,r11,r0
  107. li r11,-112
  108. stvx v25,r11,r0
  109. li r11,-96
  110. stvx v26,r11,r0
  111. li r11,-80
  112. stvx v27,r11,r0
  113. li r11,-64
  114. stvx v28,r11,r0
  115. li r11,-48
  116. stvx v29,r11,r0
  117. li r11,-32
  118. stvx v30,r11,r0
  119. li r11,-16
  120. stvx v31,r11,r0
  121. mfspr r11,VRsave
  122. blr
  123. /* As restVec, but the original VRsave value passed in R10. */
  124. .private_extern restVEC_vr10
  125. restVEC_vr10:
  126. li r11,-192
  127. lvx v20,r11,r0
  128. li r11,-176
  129. lvx v21,r11,r0
  130. li r11,-160
  131. lvx v22,r11,r0
  132. li r11,-144
  133. lvx v23,r11,r0
  134. li r11,-128
  135. lvx v24,r11,r0
  136. li r11,-112
  137. lvx v25,r11,r0
  138. li r11,-96
  139. lvx v26,r11,r0
  140. li r11,-80
  141. lvx v27,r11,r0
  142. li r11,-64
  143. lvx v28,r11,r0
  144. li r11,-48
  145. lvx v29,r11,r0
  146. li r11,-32
  147. lvx v30,r11,r0
  148. li r11,-16
  149. lvx v31,r11,r0
  150. /* restore VRsave from R10. */
  151. mtspr VRsave,r10
  152. blr