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.

zgemm_ncopy_8.c 6.4 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213
  1. /*********************************************************************/
  2. /* Copyright 2009, 2010 The University of Texas at Austin. */
  3. /* All rights reserved. */
  4. /* */
  5. /* Redistribution and use in source and binary forms, with or */
  6. /* without modification, are permitted provided that the following */
  7. /* conditions are met: */
  8. /* */
  9. /* 1. Redistributions of source code must retain the above */
  10. /* copyright notice, this list of conditions and the following */
  11. /* disclaimer. */
  12. /* */
  13. /* 2. Redistributions in binary form must reproduce the above */
  14. /* copyright notice, this list of conditions and the following */
  15. /* disclaimer in the documentation and/or other materials */
  16. /* provided with the distribution. */
  17. /* */
  18. /* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */
  19. /* AUSTIN ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, */
  20. /* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
  21. /* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */
  22. /* DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OF TEXAS AT */
  23. /* AUSTIN OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, */
  24. /* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES */
  25. /* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE */
  26. /* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR */
  27. /* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF */
  28. /* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */
  29. /* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT */
  30. /* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
  31. /* POSSIBILITY OF SUCH DAMAGE. */
  32. /* */
  33. /* The views and conclusions contained in the software and */
  34. /* documentation are those of the authors and should not be */
  35. /* interpreted as representing official policies, either expressed */
  36. /* or implied, of The University of Texas at Austin. */
  37. /*********************************************************************/
  38. #include <stdio.h>
  39. #include "common.h"
  40. int CNAME(BLASLONG m, BLASLONG n, FLOAT *a, BLASLONG lda, FLOAT *b){
  41. BLASLONG i, j;
  42. FLOAT *aoffset;
  43. FLOAT *aoffset1, *aoffset2, *aoffset3, *aoffset4;
  44. FLOAT *aoffset5, *aoffset6, *aoffset7, *aoffset8;
  45. FLOAT *boffset;
  46. FLOAT ctemp01, ctemp02, ctemp03, ctemp04;
  47. FLOAT ctemp05, ctemp06, ctemp07, ctemp08;
  48. FLOAT ctemp09, ctemp10, ctemp11, ctemp12;
  49. FLOAT ctemp13, ctemp14, ctemp15, ctemp16;
  50. aoffset = a;
  51. boffset = b;
  52. lda *= 2;
  53. j = (n >> 3);
  54. if (j > 0){
  55. do{
  56. aoffset1 = aoffset;
  57. aoffset2 = aoffset1 + lda;
  58. aoffset3 = aoffset2 + lda;
  59. aoffset4 = aoffset3 + lda;
  60. aoffset5 = aoffset4 + lda;
  61. aoffset6 = aoffset5 + lda;
  62. aoffset7 = aoffset6 + lda;
  63. aoffset8 = aoffset7 + lda;
  64. aoffset += 8 * lda;
  65. i = m;
  66. if (i > 0){
  67. do{
  68. ctemp01 = *(aoffset1 + 0);
  69. ctemp02 = *(aoffset1 + 1);
  70. ctemp03 = *(aoffset2 + 0);
  71. ctemp04 = *(aoffset2 + 1);
  72. ctemp05 = *(aoffset3 + 0);
  73. ctemp06 = *(aoffset3 + 1);
  74. ctemp07 = *(aoffset4 + 0);
  75. ctemp08 = *(aoffset4 + 1);
  76. ctemp09 = *(aoffset5 + 0);
  77. ctemp10 = *(aoffset5 + 1);
  78. ctemp11 = *(aoffset6 + 0);
  79. ctemp12 = *(aoffset6 + 1);
  80. ctemp13 = *(aoffset7 + 0);
  81. ctemp14 = *(aoffset7 + 1);
  82. ctemp15 = *(aoffset8 + 0);
  83. ctemp16 = *(aoffset8 + 1);
  84. *(boffset + 0) = ctemp01;
  85. *(boffset + 1) = ctemp02;
  86. *(boffset + 2) = ctemp03;
  87. *(boffset + 3) = ctemp04;
  88. *(boffset + 4) = ctemp05;
  89. *(boffset + 5) = ctemp06;
  90. *(boffset + 6) = ctemp07;
  91. *(boffset + 7) = ctemp08;
  92. *(boffset + 8) = ctemp09;
  93. *(boffset + 9) = ctemp10;
  94. *(boffset + 10) = ctemp11;
  95. *(boffset + 11) = ctemp12;
  96. *(boffset + 12) = ctemp13;
  97. *(boffset + 13) = ctemp14;
  98. *(boffset + 14) = ctemp15;
  99. *(boffset + 15) = ctemp16;
  100. aoffset1 += 2;
  101. aoffset2 += 2;
  102. aoffset3 += 2;
  103. aoffset4 += 2;
  104. aoffset5 += 2;
  105. aoffset6 += 2;
  106. aoffset7 += 2;
  107. aoffset8 += 2;
  108. boffset += 16;
  109. i --;
  110. }while(i > 0);
  111. }
  112. j--;
  113. }while(j > 0);
  114. } /* end of if(j > 0) */
  115. if (n & 4){
  116. aoffset1 = aoffset;
  117. aoffset2 = aoffset1 + lda;
  118. aoffset3 = aoffset2 + lda;
  119. aoffset4 = aoffset3 + lda;
  120. aoffset += 4 * lda;
  121. i = m;
  122. if (i > 0){
  123. do{
  124. ctemp01 = *(aoffset1 + 0);
  125. ctemp02 = *(aoffset1 + 1);
  126. ctemp03 = *(aoffset2 + 0);
  127. ctemp04 = *(aoffset2 + 1);
  128. ctemp05 = *(aoffset3 + 0);
  129. ctemp06 = *(aoffset3 + 1);
  130. ctemp07 = *(aoffset4 + 0);
  131. ctemp08 = *(aoffset4 + 1);
  132. *(boffset + 0) = ctemp01;
  133. *(boffset + 1) = ctemp02;
  134. *(boffset + 2) = ctemp03;
  135. *(boffset + 3) = ctemp04;
  136. *(boffset + 4) = ctemp05;
  137. *(boffset + 5) = ctemp06;
  138. *(boffset + 6) = ctemp07;
  139. *(boffset + 7) = ctemp08;
  140. aoffset1 += 2;
  141. aoffset2 += 2;
  142. aoffset3 += 2;
  143. aoffset4 += 2;
  144. boffset += 8;
  145. i --;
  146. }while(i > 0);
  147. }
  148. } /* end of if(j > 0) */
  149. if (n & 2){
  150. aoffset1 = aoffset;
  151. aoffset2 = aoffset1 + lda;
  152. aoffset += 2 * lda;
  153. i = m;
  154. if (i > 0){
  155. do{
  156. ctemp01 = *(aoffset1 + 0);
  157. ctemp02 = *(aoffset1 + 1);
  158. ctemp03 = *(aoffset2 + 0);
  159. ctemp04 = *(aoffset2 + 1);
  160. *(boffset + 0) = ctemp01;
  161. *(boffset + 1) = ctemp02;
  162. *(boffset + 2) = ctemp03;
  163. *(boffset + 3) = ctemp04;
  164. aoffset1 += 2;
  165. aoffset2 += 2;
  166. boffset += 4;
  167. i --;
  168. }while(i > 0);
  169. }
  170. } /* end of if(j > 0) */
  171. if (n & 1){
  172. aoffset1 = aoffset;
  173. i = m;
  174. if (i > 0){
  175. do{
  176. ctemp01 = *(aoffset1 + 0);
  177. ctemp02 = *(aoffset1 + 1);
  178. *(boffset + 0) = ctemp01;
  179. *(boffset + 1) = ctemp02;
  180. aoffset1 += 2;
  181. boffset += 2;
  182. i --;
  183. }while(i > 0);
  184. }
  185. } /* end of if(j > 0) */
  186. return 0;
  187. }