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.

zscal_microk_power8.c 7.3 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239
  1. /***************************************************************************
  2. Copyright (c) 2013-2016, 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. /**************************************************************************************
  28. * 2016/03/25 Werner Saar (wernsaar@googlemail.com)
  29. *
  30. * I don't use fused multipy-add ( lapack precision problems )
  31. *
  32. * BLASTEST : OK
  33. * CTEST : OK
  34. * TEST : OK
  35. * LAPACK-TEST : OK
  36. **************************************************************************************/
  37. #define HAVE_KERNEL_8 1
  38. static void zscal_kernel_8 (long n, double *x, double alpha_r, double alpha_i)
  39. {
  40. __vector double t0;
  41. __vector double t1;
  42. __vector double t2;
  43. __vector double t3;
  44. __vector double t4;
  45. __vector double t5;
  46. __vector double t6;
  47. __vector double t7;
  48. __vector double t8;
  49. __vector double t9;
  50. __vector double t10;
  51. __vector double t11;
  52. __asm__
  53. (
  54. "dcbt 0, %2 \n\t"
  55. "xsnegdp 33, %x16 \n\t" // -alpha_i
  56. XXSPLTD_S(32,%x15,0) // alpha_r , alpha_r
  57. XXMRGHD_S(33,33,%x16) // -alpha_i , alpha_i
  58. "lxvd2x 40, 0, %2 \n\t" // x0_r, x0_i
  59. "lxvd2x 41, %17, %2 \n\t"
  60. "lxvd2x 42, %18, %2 \n\t"
  61. "lxvd2x 43, %19, %2 \n\t"
  62. "lxvd2x 44, %20, %2 \n\t"
  63. "lxvd2x 45, %21, %2 \n\t"
  64. "lxvd2x 46, %22, %2 \n\t"
  65. "lxvd2x 47, %23, %2 \n\t"
  66. "addi %2, %2, 128 \n\t"
  67. "addic. %1, %1, -8 \n\t"
  68. "ble two%= \n\t"
  69. ".align 5 \n"
  70. "one%=: \n\t"
  71. "xvmuldp 48, 40, 32 \n\t" // x0_r * alpha_r, x0_i * alpha_r
  72. "xvmuldp 49, 41, 32 \n\t"
  73. "xvmuldp 50, 42, 32 \n\t"
  74. "xvmuldp 51, 43, 32 \n\t"
  75. "xvmuldp %x3, 44, 32 \n\t"
  76. "xvmuldp %x4, 45, 32 \n\t"
  77. "xvmuldp %x5, 46, 32 \n\t"
  78. "xvmuldp %x6, 47, 32 \n\t"
  79. XXSWAPD_S(%x7,40)
  80. XXSWAPD_S(%x8,41)
  81. XXSWAPD_S(%x9,42)
  82. XXSWAPD_S(%x10,43)
  83. XXSWAPD_S(%x11,44)
  84. XXSWAPD_S(%x12,45)
  85. XXSWAPD_S(%x13,46)
  86. XXSWAPD_S(%x14,47)
  87. "xvmuldp %x7, %x7, 33 \n\t" // x0_i * -alpha_i, x0_r * alpha_i
  88. "xvmuldp %x8, %x8, 33 \n\t"
  89. "lxvd2x 40, 0, %2 \n\t" // x0_r, x0_i
  90. "lxvd2x 41, %17, %2 \n\t"
  91. "xvmuldp %x9, %x9, 33 \n\t"
  92. "xvmuldp %x10, %x10, 33 \n\t"
  93. "lxvd2x 42, %18, %2 \n\t"
  94. "lxvd2x 43, %19, %2 \n\t"
  95. "xvmuldp %x11, %x11, 33 \n\t"
  96. "xvmuldp %x12, %x12, 33 \n\t"
  97. "lxvd2x 44, %20, %2 \n\t"
  98. "lxvd2x 45, %21, %2 \n\t"
  99. "xvmuldp %x13, %x13, 33 \n\t"
  100. "xvmuldp %x14, %x14, 33 \n\t"
  101. "lxvd2x 46, %22, %2 \n\t"
  102. "lxvd2x 47, %23, %2 \n\t"
  103. "addi %2, %2, -128 \n\t"
  104. "xvadddp 48, 48, %x7 \n\t"
  105. "xvadddp 49, 49, %x8 \n\t"
  106. "xvadddp 50, 50, %x9 \n\t"
  107. "xvadddp 51, 51, %x10 \n\t"
  108. "stxvd2x 48, 0, %2 \n\t"
  109. "stxvd2x 49, %17, %2 \n\t"
  110. "xvadddp %x3, %x3, %x11 \n\t"
  111. "xvadddp %x4, %x4, %x12 \n\t"
  112. "stxvd2x 50, %18, %2 \n\t"
  113. "stxvd2x 51, %19, %2 \n\t"
  114. "xvadddp %x5, %x5, %x13 \n\t"
  115. "xvadddp %x6, %x6, %x14 \n\t"
  116. "stxvd2x %x3, %20, %2 \n\t"
  117. "stxvd2x %x4, %21, %2 \n\t"
  118. "stxvd2x %x5, %22, %2 \n\t"
  119. "stxvd2x %x6, %23, %2 \n\t"
  120. "addi %2, %2, 256 \n\t"
  121. "addic. %1, %1, -8 \n\t"
  122. "bgt one%= \n"
  123. "two%=: \n\t"
  124. "xvmuldp 48, 40, 32 \n\t" // x0_r * alpha_r, x0_i * alpha_r
  125. "xvmuldp 49, 41, 32 \n\t"
  126. "xvmuldp 50, 42, 32 \n\t"
  127. "xvmuldp 51, 43, 32 \n\t"
  128. "xvmuldp %x3, 44, 32 \n\t"
  129. "xvmuldp %x4, 45, 32 \n\t"
  130. "xvmuldp %x5, 46, 32 \n\t"
  131. "xvmuldp %x6, 47, 32 \n\t"
  132. XXSWAPD_S(%x7,40)
  133. XXSWAPD_S(%x8,41)
  134. XXSWAPD_S(%x9,42)
  135. XXSWAPD_S(%x10,43)
  136. XXSWAPD_S(%x11,44)
  137. XXSWAPD_S(%x12,45)
  138. XXSWAPD_S(%x13,46)
  139. XXSWAPD_S(%x14,47)
  140. "addi %2, %2, -128 \n\t"
  141. "xvmuldp %x7, %x7, 33 \n\t" // x0_i * -alpha_i, x0_r * alpha_i
  142. "xvmuldp %x8, %x8, 33 \n\t"
  143. "xvmuldp %x9, %x9, 33 \n\t"
  144. "xvmuldp %x10, %x10, 33 \n\t"
  145. "xvmuldp %x11, %x11, 33 \n\t"
  146. "xvmuldp %x12, %x12, 33 \n\t"
  147. "xvmuldp %x13, %x13, 33 \n\t"
  148. "xvmuldp %x14, %x14, 33 \n\t"
  149. "xvadddp 48, 48, %x7 \n\t"
  150. "xvadddp 49, 49, %x8 \n\t"
  151. "xvadddp 50, 50, %x9 \n\t"
  152. "xvadddp 51, 51, %x10 \n\t"
  153. "stxvd2x 48, 0, %2 \n\t"
  154. "stxvd2x 49, %17, %2 \n\t"
  155. "xvadddp %x3, %x3, %x11 \n\t"
  156. "xvadddp %x4, %x4, %x12 \n\t"
  157. "stxvd2x 50, %18, %2 \n\t"
  158. "stxvd2x 51, %19, %2 \n\t"
  159. "xvadddp %x5, %x5, %x13 \n\t"
  160. "xvadddp %x6, %x6, %x14 \n\t"
  161. "stxvd2x %x3, %20, %2 \n\t"
  162. "stxvd2x %x4, %21, %2 \n\t"
  163. "stxvd2x %x5, %22, %2 \n\t"
  164. "stxvd2x %x6, %23, %2 \n"
  165. "#n=%1 x=%0=%2 alpha=(%15,%16) o16=%17 o32=%18 o48=%19 o64=%20 o80=%21 o96=%22 o112=%23\n"
  166. "#t0=%x3 t1=%x4 t2=%x5 t3=%x6 t4=%x7 t5=%x8 t6=%x9 t7=%x10 t8=%x11 t9=%x12 t10=%x13 t11=%x14"
  167. :
  168. "+m" (*x),
  169. "+r" (n), // 1
  170. "+b" (x), // 2
  171. "=wa" (t0), // 3
  172. "=wa" (t1), // 4
  173. "=wa" (t2), // 5
  174. "=wa" (t3), // 6
  175. "=wa" (t4), // 7
  176. "=wa" (t5), // 8
  177. "=wa" (t6), // 9
  178. "=wa" (t7), // 10
  179. "=wa" (t8), // 11
  180. "=wa" (t9), // 12
  181. "=wa" (t10), // 13
  182. "=wa" (t11) // 14
  183. :
  184. "d" (alpha_r), // 15
  185. "d" (alpha_i), // 16
  186. "b" (16), // 17
  187. "b" (32), // 18
  188. "b" (48), // 19
  189. "b" (64), // 20
  190. "b" (80), // 21
  191. "b" (96), // 22
  192. "b" (112) // 23
  193. :
  194. "cr0",
  195. "vs32","vs33","vs34","vs35","vs36","vs37","vs38","vs39",
  196. "vs40","vs41","vs42","vs43","vs44","vs45","vs46","vs47",
  197. "vs48","vs49","vs50","vs51"
  198. );
  199. }