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.

swap_microk_power10.c 5.1 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. /***************************************************************************
  2. Copyright (c) 2021, 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_32 1
  28. #if defined(DOUBLE)
  29. static void dswap_kernel_32 (long n, double *x, double *y)
  30. #else
  31. static void sswap_kernel_32 (long n, float *x, float *y)
  32. #endif
  33. {
  34. __asm__
  35. (
  36. ".align 5 \n"
  37. "one%=: \n\t"
  38. "lxvp 32, 0(%4) \n\t"
  39. "lxvp 34, 32(%4) \n\t"
  40. "lxvp 36, 64(%4) \n\t"
  41. "lxvp 38, 96(%4) \n\t"
  42. "lxvp 40, 128(%4) \n\t"
  43. "lxvp 42, 160(%4) \n\t"
  44. "lxvp 44, 192(%4) \n\t"
  45. "lxvp 46, 224(%4) \n\t"
  46. "lxvp 48, 0(%3) \n\t"
  47. "lxvp 50, 32(%3) \n\t"
  48. "lxvp 52, 64(%3) \n\t"
  49. "lxvp 54, 96(%3) \n\t"
  50. "lxvp 56, 128(%3) \n\t"
  51. "lxvp 58, 160(%3) \n\t"
  52. "lxvp 60, 192(%3) \n\t"
  53. "lxvp 62, 224(%3) \n\t"
  54. #if (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)
  55. "stxv 32, 0(%3) \n\t"
  56. "stxv 33, 16(%3) \n\t"
  57. "stxv 34, 32(%3) \n\t"
  58. "stxv 35, 48(%3) \n\t"
  59. "stxv 36, 64(%3) \n\t"
  60. "stxv 37, 80(%3) \n\t"
  61. "stxv 38, 96(%3) \n\t"
  62. "stxv 39, 112(%3) \n\t"
  63. "stxv 40, 128(%3) \n\t"
  64. "stxv 41, 144(%3) \n\t"
  65. "stxv 42, 160(%3) \n\t"
  66. "stxv 43, 176(%3) \n\t"
  67. "stxv 44, 192(%3) \n\t"
  68. "stxv 45, 208(%3) \n\t"
  69. "stxv 46, 224(%3) \n\t"
  70. "stxv 47, 240(%3) \n\t"
  71. "stxv 48, 0(%4) \n\t"
  72. "stxv 49, 16(%4) \n\t"
  73. "stxv 50, 32(%4) \n\t"
  74. "stxv 51, 48(%4) \n\t"
  75. "stxv 52, 64(%4) \n\t"
  76. "stxv 53, 80(%4) \n\t"
  77. "stxv 54, 96(%4) \n\t"
  78. "stxv 55, 112(%4) \n\t"
  79. "stxv 56, 128(%4) \n\t"
  80. "stxv 57, 144(%4) \n\t"
  81. "stxv 58, 160(%4) \n\t"
  82. "stxv 59, 176(%4) \n\t"
  83. "stxv 60, 192(%4) \n\t"
  84. "stxv 61, 208(%4) \n\t"
  85. "stxv 62, 224(%4) \n\t"
  86. "stxv 63, 240(%4) \n\t"
  87. #else
  88. "stxv 33, 0(%3) \n\t"
  89. "stxv 32, 16(%3) \n\t"
  90. "stxv 35, 32(%3) \n\t"
  91. "stxv 34, 48(%3) \n\t"
  92. "stxv 37, 64(%3) \n\t"
  93. "stxv 36, 80(%3) \n\t"
  94. "stxv 39, 96(%3) \n\t"
  95. "stxv 38, 112(%3) \n\t"
  96. "stxv 41, 128(%3) \n\t"
  97. "stxv 40, 144(%3) \n\t"
  98. "stxv 43, 160(%3) \n\t"
  99. "stxv 42, 176(%3) \n\t"
  100. "stxv 45, 192(%3) \n\t"
  101. "stxv 44, 208(%3) \n\t"
  102. "stxv 47, 224(%3) \n\t"
  103. "stxv 46, 240(%3) \n\t"
  104. "stxv 49, 0(%4) \n\t"
  105. "stxv 48, 16(%4) \n\t"
  106. "stxv 51, 32(%4) \n\t"
  107. "stxv 50, 48(%4) \n\t"
  108. "stxv 53, 64(%4) \n\t"
  109. "stxv 52, 80(%4) \n\t"
  110. "stxv 55, 96(%4) \n\t"
  111. "stxv 54, 112(%4) \n\t"
  112. "stxv 57, 128(%4) \n\t"
  113. "stxv 56, 144(%4) \n\t"
  114. "stxv 59, 160(%4) \n\t"
  115. "stxv 58, 176(%4) \n\t"
  116. "stxv 61, 192(%4) \n\t"
  117. "stxv 60, 208(%4) \n\t"
  118. "stxv 63, 224(%4) \n\t"
  119. "stxv 62, 240(%4) \n\t"
  120. #endif
  121. "addi %4, %4, 256 \n\t"
  122. "addi %3, %3, 256 \n\t"
  123. #if defined(DOUBLE)
  124. "addic. %2, %2, -32 \n\t"
  125. #else
  126. "addic. %2, %2, -64 \n\t"
  127. #endif
  128. "bgt one%= \n"
  129. "#n=%2 x=%0=%3 y=%1=%4"
  130. :
  131. "+m" (*x),
  132. "+m" (*y),
  133. "+r" (n), // 2
  134. "+b" (x), // 3
  135. "+b" (y) // 4
  136. :
  137. :
  138. "cr0",
  139. "vs32","vs33","vs34","vs35","vs36","vs37","vs38","vs39",
  140. "vs40","vs41","vs42","vs43","vs44","vs45","vs46","vs47",
  141. "vs48","vs49","vs50","vs51","vs52","vs53","vs54","vs55",
  142. "vs56","vs57","vs58","vs59","vs60","vs61","vs62","vs63"
  143. );
  144. }