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.

daxpy_microk_power10.c 4.9 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  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 daxpy_kernel_8 (long n, double *x, double *y, double alpha)
  29. {
  30. __vector double t0;
  31. __asm__
  32. (
  33. XXSPLTD_S(%x4,%x6,0)
  34. "dcbt 0, %2 \n\t"
  35. "dcbt 0, %3 \n\t"
  36. "lxvp 32, 0(%2) \n\t"
  37. "lxvp 34, 32(%2) \n\t"
  38. "lxvp 40, 64(%2) \n\t"
  39. "lxvp 42, 96(%2) \n\t"
  40. "lxvp 36, 0(%3) \n\t"
  41. "lxvp 38, 32(%3) \n\t"
  42. "lxvp 44, 64(%3) \n\t"
  43. "lxvp 46, 96(%3) \n\t"
  44. "addi %2, %2, 128 \n\t"
  45. "addic. %1, %1, -16 \n\t"
  46. "ble two%= \n\t"
  47. ".align 5 \n"
  48. "one%=: \n\t"
  49. "xvmaddadp 36, 32, %x4 \n\t"
  50. "xvmaddadp 37, 33, %x4 \n\t"
  51. "lxvp 32, 0(%2) \n\t"
  52. #if (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)
  53. "stxv 36, 0(%3) \n\t"
  54. "stxv 37, 16(%3) \n\t"
  55. #else
  56. "stxv 37, 0(%3) \n\t"
  57. "stxv 36, 16(%3) \n\t"
  58. #endif
  59. "xvmaddadp 38, 34, %x4 \n\t"
  60. "xvmaddadp 39, 35, %x4 \n\t"
  61. "lxvp 34, 32(%2) \n\t"
  62. #if (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)
  63. "stxv 38, 32(%3) \n\t"
  64. "stxv 39, 48(%3) \n\t"
  65. #else
  66. "stxv 39, 32(%3) \n\t"
  67. "stxv 38, 48(%3) \n\t"
  68. #endif
  69. "lxvp 36, 128(%3) \n\t"
  70. "lxvp 38, 160(%3) \n\t"
  71. "xvmaddadp 44, 40, %x4 \n\t"
  72. "xvmaddadp 45, 41, %x4 \n\t"
  73. "lxvp 40, 64(%2) \n\t"
  74. #if (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)
  75. "stxv 44, 64(%3) \n\t"
  76. "stxv 45, 80(%3) \n\t"
  77. #else
  78. "stxv 45, 64(%3) \n\t"
  79. "stxv 44, 80(%3) \n\t"
  80. #endif
  81. "xvmaddadp 46, 42, %x4 \n\t"
  82. "xvmaddadp 47, 43, %x4 \n\t"
  83. "lxvp 42, 96(%2) \n\t"
  84. #if (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)
  85. "stxv 46, 96(%3) \n\t"
  86. "stxv 47, 112(%3) \n\t"
  87. #else
  88. "stxv 47, 96(%3) \n\t"
  89. "stxv 46, 112(%3) \n\t"
  90. #endif
  91. "addi %2, %2, 128 \n\t"
  92. "addi %3, %3, 128 \n\t"
  93. "lxvp 44, 64(%3) \n\t"
  94. "lxvp 46, 96(%3) \n\t"
  95. "addic. %1, %1, -16 \n\t"
  96. "bgt one%= \n"
  97. "two%=: \n\t"
  98. "xvmaddadp 36, 32, %x4 \n\t"
  99. "xvmaddadp 37, 33, %x4 \n\t"
  100. "xvmaddadp 38, 34, %x4 \n\t"
  101. "xvmaddadp 39, 35, %x4 \n\t"
  102. "xvmaddadp 44, 40, %x4 \n\t"
  103. "xvmaddadp 45, 41, %x4 \n\t"
  104. "xvmaddadp 46, 42, %x4 \n\t"
  105. "xvmaddadp 47, 43, %x4 \n\t"
  106. #if (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)
  107. "stxv 36, 0(%3) \n\t"
  108. "stxv 37, 16(%3) \n\t"
  109. "stxv 38, 32(%3) \n\t"
  110. "stxv 39, 48(%3) \n\t"
  111. "stxv 44, 64(%3) \n\t"
  112. "stxv 45, 80(%3) \n\t"
  113. "stxv 46, 96(%3) \n\t"
  114. "stxv 47, 112(%3) \n\t"
  115. #else
  116. "stxv 37, 0(%3) \n\t"
  117. "stxv 36, 16(%3) \n\t"
  118. "stxv 39, 32(%3) \n\t"
  119. "stxv 38, 48(%3) \n\t"
  120. "stxv 45, 64(%3) \n\t"
  121. "stxv 44, 80(%3) \n\t"
  122. "stxv 47, 96(%3) \n\t"
  123. "stxv 46, 112(%3) \n\t"
  124. #endif
  125. "#n=%1 x=%5=%2 y=%0=%3 alpha=%6 t0=%x4\n"
  126. :
  127. "+m" (*y),
  128. "+r" (n), // 1
  129. "+b" (x), // 2
  130. "+b" (y), // 3
  131. "=wa" (t0) // 4
  132. :
  133. "m" (*x),
  134. "d" (alpha) // 6
  135. :
  136. "cr0",
  137. "vs32","vs33","vs34","vs35","vs36","vs37", "vs38", "vs39",
  138. "vs40","vs41","vs42","vs43","vs44","vs45","vs46","vs47"
  139. );
  140. }