You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

saxpy_microk_power10.c 7.3 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258
  1. /***************************************************************************
  2. Copyright (c) 2020, The OpenBLAS Project
  3. All rights reserved.
  4. Redistribution and use in source and binary forms, with or without
  5. modification, are permitted provided that the following conditions are
  6. met:
  7. 1. Redistributions of source code must retain the above copyright
  8. notice, this list of conditions and the following disclaimer.
  9. 2. Redistributions in binary form must reproduce the above copyright
  10. notice, this list of conditions and the following disclaimer in
  11. the documentation and/or other materials provided with the
  12. distribution.
  13. 3. Neither the name of the OpenBLAS project nor the names of
  14. its contributors may be used to endorse or promote products
  15. derived from this software without specific prior written permission.
  16. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  17. AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  18. IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  19. ARE DISCLAIMED. IN NO EVENT SHALL THE OPENBLAS PROJECT OR CONTRIBUTORS BE
  20. LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  21. DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  22. SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  23. CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  24. OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
  25. USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  26. *****************************************************************************/
  27. #define HAVE_KERNEL_8 1
  28. static void saxpy_kernel_64(long n, float *x, float *y, float alpha)
  29. {
  30. __vector float t0 = {alpha, alpha,alpha, alpha};
  31. __asm__
  32. (
  33. "dcbt 0, %2 \n\t"
  34. "dcbt 0, %3 \n\t"
  35. "lxvp 32, 0(%2) \n\t"
  36. "lxvp 34, 32(%2) \n\t"
  37. "lxvp 40, 64(%2) \n\t"
  38. "lxvp 42, 96(%2) \n\t"
  39. "lxvp 48, 128(%2) \n\t"
  40. "lxvp 50, 160(%2) \n\t"
  41. "lxvp 52, 192(%2) \n\t"
  42. "lxvp 54, 224(%2) \n\t"
  43. "lxvp 36, 0(%3) \n\t"
  44. "lxvp 38, 32(%3) \n\t"
  45. "lxvp 44, 64(%3) \n\t"
  46. "lxvp 46, 96(%3) \n\t"
  47. "lxvp 56, 128(%3) \n\t"
  48. "lxvp 58, 160(%3) \n\t"
  49. "lxvp 60, 192(%3) \n\t"
  50. "lxvp 62, 224(%3) \n\t"
  51. "addi %2, %2, 256 \n\t"
  52. "addic. %1, %1, -64 \n\t"
  53. "ble two%= \n\t"
  54. ".align 5 \n"
  55. "one%=: \n\t"
  56. "xvmaddasp 36, 32, %x4 \n\t"
  57. "xvmaddasp 37, 33, %x4 \n\t"
  58. "lxvp 32, 0(%2) \n\t"
  59. #if (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)
  60. "stxv 36, 0(%3) \n\t"
  61. "stxv 37, 16(%3) \n\t"
  62. #else
  63. "stxv 37, 0(%3) \n\t"
  64. "stxv 36, 16(%3) \n\t"
  65. #endif
  66. "xvmaddasp 38, 34, %x4 \n\t"
  67. "xvmaddasp 39, 35, %x4 \n\t"
  68. "lxvp 34, 32(%2) \n\t"
  69. #if (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)
  70. "stxv 38, 32(%3) \n\t"
  71. "stxv 39, 48(%3) \n\t"
  72. #else
  73. "stxv 39, 32(%3) \n\t"
  74. "stxv 38, 48(%3) \n\t"
  75. #endif
  76. "lxvp 36, 256(%3) \n\t"
  77. "lxvp 38, 288(%3) \n\t"
  78. "xvmaddasp 44, 40, %x4 \n\t"
  79. "xvmaddasp 45, 41, %x4 \n\t"
  80. "lxvp 40, 64(%2) \n\t"
  81. #if (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)
  82. "stxv 44, 64(%3) \n\t"
  83. "stxv 45, 80(%3) \n\t"
  84. #else
  85. "stxv 45, 64(%3) \n\t"
  86. "stxv 44, 80(%3) \n\t"
  87. #endif
  88. "xvmaddasp 46, 42, %x4 \n\t"
  89. "xvmaddasp 47, 43, %x4 \n\t"
  90. "lxvp 42, 96(%2) \n\t"
  91. #if (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)
  92. "stxv 46, 96(%3) \n\t"
  93. "stxv 47, 112(%3) \n\t"
  94. #else
  95. "stxv 47, 96(%3) \n\t"
  96. "stxv 46, 112(%3) \n\t"
  97. #endif
  98. "lxvp 44, 320(%3) \n\t"
  99. "lxvp 46, 352(%3) \n\t"
  100. "xvmaddasp 56, 48, %x4 \n\t"
  101. "xvmaddasp 57, 49, %x4 \n\t"
  102. "lxvp 48, 128(%2) \n\t"
  103. #if (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)
  104. "stxv 56, 128(%3) \n\t"
  105. "stxv 57, 144(%3) \n\t"
  106. #else
  107. "stxv 57, 128(%3) \n\t"
  108. "stxv 56, 144(%3) \n\t"
  109. #endif
  110. "xvmaddasp 58, 50, %x4 \n\t"
  111. "xvmaddasp 59, 51, %x4 \n\t"
  112. "lxvp 50, 160(%2) \n\t"
  113. #if (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)
  114. "stxv 58, 160(%3) \n\t"
  115. "stxv 59, 176(%3) \n\t"
  116. #else
  117. "stxv 59, 160(%3) \n\t"
  118. "stxv 58, 176(%3) \n\t"
  119. #endif
  120. "lxvp 56, 384(%3) \n\t"
  121. "lxvp 58, 416(%3) \n\t"
  122. "xvmaddasp 60, 52, %x4 \n\t"
  123. "xvmaddasp 61, 53, %x4 \n\t"
  124. "lxvp 52, 192(%2) \n\t"
  125. #if (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)
  126. "stxv 60, 192(%3) \n\t"
  127. "stxv 61, 208(%3) \n\t"
  128. #else
  129. "stxv 61, 192(%3) \n\t"
  130. "stxv 60, 208(%3) \n\t"
  131. #endif
  132. "xvmaddasp 62, 54, %x4 \n\t"
  133. "xvmaddasp 63, 55, %x4 \n\t"
  134. "lxvp 54, 224(%2) \n\t"
  135. #if (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)
  136. "stxv 62, 224(%3) \n\t"
  137. "stxv 63, 240(%3) \n\t"
  138. #else
  139. "stxv 63, 224(%3) \n\t"
  140. "stxv 62, 240(%3) \n\t"
  141. #endif
  142. "lxvp 60, 448(%3) \n\t"
  143. "lxvp 62, 480(%3) \n\t"
  144. "addi %2, %2, 256 \n\t"
  145. "addi %3, %3, 256 \n\t"
  146. "addic. %1, %1, -64 \n\t"
  147. "bgt one%= \n"
  148. "two%=: \n\t"
  149. "xvmaddasp 36, 32, %x4 \n\t"
  150. "xvmaddasp 37, 33, %x4 \n\t"
  151. "xvmaddasp 38, 34, %x4 \n\t"
  152. "xvmaddasp 39, 35, %x4 \n\t"
  153. "xvmaddasp 44, 40, %x4 \n\t"
  154. "xvmaddasp 45, 41, %x4 \n\t"
  155. "xvmaddasp 46, 42, %x4 \n\t"
  156. "xvmaddasp 47, 43, %x4 \n\t"
  157. "xvmaddasp 56, 48, %x4 \n\t"
  158. "xvmaddasp 57, 49, %x4 \n\t"
  159. "xvmaddasp 58, 50, %x4 \n\t"
  160. "xvmaddasp 59, 51, %x4 \n\t"
  161. "xvmaddasp 60, 52, %x4 \n\t"
  162. "xvmaddasp 61, 53, %x4 \n\t"
  163. "xvmaddasp 62, 54, %x4 \n\t"
  164. "xvmaddasp 63, 55, %x4 \n\t"
  165. #if (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)
  166. "stxv 36, 0(%3) \n\t"
  167. "stxv 37, 16(%3) \n\t"
  168. "stxv 38, 32(%3) \n\t"
  169. "stxv 39, 48(%3) \n\t"
  170. "stxv 44, 64(%3) \n\t"
  171. "stxv 45, 80(%3) \n\t"
  172. "stxv 46, 96(%3) \n\t"
  173. "stxv 47, 112(%3) \n\t"
  174. "stxv 56, 128(%3) \n\t"
  175. "stxv 57, 144(%3) \n\t"
  176. "stxv 58, 160(%3) \n\t"
  177. "stxv 59, 176(%3) \n\t"
  178. "stxv 60, 192(%3) \n\t"
  179. "stxv 61, 208(%3) \n\t"
  180. "stxv 62, 224(%3) \n\t"
  181. "stxv 63, 240(%3) \n\t"
  182. #else
  183. "stxv 37, 0(%3) \n\t"
  184. "stxv 36, 16(%3) \n\t"
  185. "stxv 39, 32(%3) \n\t"
  186. "stxv 38, 48(%3) \n\t"
  187. "stxv 45, 64(%3) \n\t"
  188. "stxv 44, 80(%3) \n\t"
  189. "stxv 47, 96(%3) \n\t"
  190. "stxv 46, 112(%3) \n\t"
  191. "stxv 57, 128(%3) \n\t"
  192. "stxv 56, 144(%3) \n\t"
  193. "stxv 59, 160(%3) \n\t"
  194. "stxv 58, 176(%3) \n\t"
  195. "stxv 61, 192(%3) \n\t"
  196. "stxv 60, 208(%3) \n\t"
  197. "stxv 63, 224(%3) \n\t"
  198. "stxv 62, 240(%3) \n\t"
  199. #endif
  200. "#n=%1 x=%5=%2 y=%0=%3 t0=%x4\n"
  201. :
  202. "+m" (*y),
  203. "+r" (n), // 1
  204. "+b" (x), // 2
  205. "+b" (y) // 3
  206. :
  207. "wa" (t0), // 4
  208. "m" (*x)
  209. :
  210. "cr0",
  211. "vs32","vs33","vs34","vs35","vs36","vs37", "vs38", "vs39",
  212. "vs40","vs41","vs42","vs43","vs44","vs45","vs46","vs47",
  213. "vs48","vs49","vs50","vs51","vs52","vs53","vs54","vs55",
  214. "vs56","vs57","vs58","vs59","vs60","vs61","vs62","vs63"
  215. );
  216. }