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.

drot_microk_power10.c 5.7 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  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_16 1
  28. static void drot_kernel_16 (long n, double *x, double *y, double c, double s)
  29. {
  30. __asm__
  31. (
  32. XXSPLTD_S(36,%x5,0) // load c to both dwords
  33. XXSPLTD_S(37,%x6,0) // load s to both dwords
  34. "lxvp 32, 0(%3) \n\t" // load x
  35. "lxvp 34, 32(%3) \n\t"
  36. "lxvp 48, 0(%4) \n\t" // load y
  37. "lxvp 50, 32(%4) \n\t"
  38. "addic. %2, %2, -8 \n\t"
  39. "ble two%= \n\t"
  40. ".align 5 \n"
  41. "one%=: \n\t"
  42. "xvmuldp 40, 32, 36 \n\t" // c * x
  43. "xvmuldp 41, 33, 36 \n\t"
  44. "xvmuldp 42, 34, 36 \n\t"
  45. "xvmuldp 43, 35, 36 \n\t"
  46. "xvmuldp 44, 32, 37 \n\t" // s * x
  47. "xvmuldp 45, 33, 37 \n\t"
  48. "xvmuldp 46, 34, 37 \n\t"
  49. "xvmuldp 47, 35, 37 \n\t"
  50. "lxvp 32, 64(%3) \n\t" // load x
  51. "lxvp 34, 96(%3) \n\t"
  52. "xvmuldp 52, 48, 36 \n\t" // c * y
  53. "xvmuldp 53, 49, 36 \n\t"
  54. "xvmuldp 54, 50, 36 \n\t"
  55. "xvmuldp 55, 51, 36 \n\t"
  56. "xvmuldp 38, 48, 37 \n\t" // s * y
  57. "xvmuldp 39, 49, 37 \n\t"
  58. "xvmuldp 56, 50, 37 \n\t"
  59. "xvmuldp 57, 51, 37 \n\t"
  60. "lxvp 48, 64(%4) \n\t" // load y
  61. "lxvp 50, 96(%4) \n\t"
  62. "xvadddp 40, 40, 38 \n\t" // c * x + s * y
  63. "xvadddp 41, 41, 39 \n\t" // c * x + s * y
  64. "xvadddp 42, 42, 56 \n\t" // c * x + s * y
  65. "xvadddp 43, 43, 57 \n\t" // c * x + s * y
  66. "stxvp 40, 0(%3) \n\t" // store x
  67. "stxvp 42, 32(%3) \n\t"
  68. "xvsubdp 52, 52, 44 \n\t" // c * y - s * x
  69. "xvsubdp 53, 53, 45 \n\t" // c * y - s * x
  70. "xvsubdp 54, 54, 46 \n\t" // c * y - s * x
  71. "xvsubdp 55, 55, 47 \n\t" // c * y - s * x
  72. "stxvp 52, 0(%4) \n\t" // store y
  73. "stxvp 54, 32(%4) \n\t"
  74. "addi %3, %3, 64 \n\t"
  75. "addi %4, %4, 64 \n\t"
  76. "addic. %2, %2, -8 \n\t"
  77. "bgt one%= \n"
  78. "two%=: \n\t"
  79. "xvmuldp 40, 32, 36 \n\t" // c * x
  80. "xvmuldp 41, 33, 36 \n\t"
  81. "xvmuldp 42, 34, 36 \n\t"
  82. "xvmuldp 43, 35, 36 \n\t"
  83. "xvmuldp 52, 48, 36 \n\t" // c * y
  84. "xvmuldp 53, 49, 36 \n\t"
  85. "xvmuldp 54, 50, 36 \n\t"
  86. "xvmuldp 55, 51, 36 \n\t"
  87. "xvmuldp 44, 32, 37 \n\t" // s * x
  88. "xvmuldp 45, 33, 37 \n\t"
  89. "xvmuldp 46, 34, 37 \n\t"
  90. "xvmuldp 47, 35, 37 \n\t"
  91. "xvmuldp 38, 48, 37 \n\t" // s * y
  92. "xvmuldp 39, 49, 37 \n\t"
  93. "xvmuldp 56, 50, 37 \n\t"
  94. "xvmuldp 57, 51, 37 \n\t"
  95. "xvadddp 40, 40, 38 \n\t" // c * x + s * y
  96. "xvadddp 41, 41, 39 \n\t" // c * x + s * y
  97. "xvadddp 42, 42, 56 \n\t" // c * x + s * y
  98. "xvadddp 43, 43, 57 \n\t" // c * x + s * y
  99. "stxvp 40, 0(%3) \n\t" // store x
  100. "stxvp 42, 32(%3) \n\t"
  101. "xvsubdp 52, 52, 44 \n\t" // c * y - s * x
  102. "xvsubdp 53, 53, 45 \n\t" // c * y - s * x
  103. "xvsubdp 54, 54, 46 \n\t" // c * y - s * x
  104. "xvsubdp 55, 55, 47 \n\t" // c * y - s * x
  105. "stxvp 52, 0(%4) \n\t" // store y
  106. "stxvp 54, 32(%4) \n\t"
  107. "#n=%2 x=%0=%3 y=%1=%4 c=%5 s=%6\n"
  108. :
  109. "+m" (*x),
  110. "+m" (*y),
  111. "+r" (n), // 2
  112. "+b" (x), // 3
  113. "+b" (y) // 4
  114. :
  115. "d" (c), // 5
  116. "d" (s) // 6
  117. :
  118. "cr0",
  119. "vs32","vs33","vs34","vs35","vs36","vs37","vs38","vs39",
  120. "vs40","vs41","vs42","vs43","vs44","vs45","vs46","vs47",
  121. "vs48","vs49","vs50","vs51","vs52","vs53","vs54","vs55",
  122. "vs56","vs57"
  123. );
  124. }