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.

gemm_beta.c 4.6 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  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 "common.h"
  39. int CNAME(BLASLONG m, BLASLONG n, BLASLONG dummy1, FLOAT beta,
  40. FLOAT *dummy2, BLASLONG dummy3, FLOAT *dummy4, BLASLONG dummy5,
  41. FLOAT *c, BLASLONG ldc){
  42. BLASLONG i, j;
  43. FLOAT *c_offset1, *c_offset;
  44. FLOAT ctemp1, ctemp2, ctemp3, ctemp4;
  45. FLOAT ctemp5, ctemp6, ctemp7, ctemp8;
  46. c_offset = c;
  47. if (beta == ZERO){
  48. j = n;
  49. do {
  50. c_offset1 = c_offset;
  51. c_offset += ldc;
  52. i = (m >> 3);
  53. if (i > 0){
  54. do {
  55. *(c_offset1 + 0) = ZERO;
  56. *(c_offset1 + 1) = ZERO;
  57. *(c_offset1 + 2) = ZERO;
  58. *(c_offset1 + 3) = ZERO;
  59. *(c_offset1 + 4) = ZERO;
  60. *(c_offset1 + 5) = ZERO;
  61. *(c_offset1 + 6) = ZERO;
  62. *(c_offset1 + 7) = ZERO;
  63. c_offset1 += 8;
  64. i --;
  65. } while (i > 0);
  66. }
  67. i = (m & 7);
  68. if (i > 0){
  69. do {
  70. *c_offset1 = ZERO;
  71. c_offset1 ++;
  72. i --;
  73. } while (i > 0);
  74. }
  75. j --;
  76. } while (j > 0);
  77. } else {
  78. j = n;
  79. do {
  80. c_offset1 = c_offset;
  81. c_offset += ldc;
  82. i = (m >> 3);
  83. if (i > 0){
  84. do {
  85. ctemp1 = *(c_offset1 + 0);
  86. ctemp2 = *(c_offset1 + 1);
  87. ctemp3 = *(c_offset1 + 2);
  88. ctemp4 = *(c_offset1 + 3);
  89. ctemp5 = *(c_offset1 + 4);
  90. ctemp6 = *(c_offset1 + 5);
  91. ctemp7 = *(c_offset1 + 6);
  92. ctemp8 = *(c_offset1 + 7);
  93. ctemp1 *= beta;
  94. ctemp2 *= beta;
  95. ctemp3 *= beta;
  96. ctemp4 *= beta;
  97. ctemp5 *= beta;
  98. ctemp6 *= beta;
  99. ctemp7 *= beta;
  100. ctemp8 *= beta;
  101. *(c_offset1 + 0) = ctemp1;
  102. *(c_offset1 + 1) = ctemp2;
  103. *(c_offset1 + 2) = ctemp3;
  104. *(c_offset1 + 3) = ctemp4;
  105. *(c_offset1 + 4) = ctemp5;
  106. *(c_offset1 + 5) = ctemp6;
  107. *(c_offset1 + 6) = ctemp7;
  108. *(c_offset1 + 7) = ctemp8;
  109. c_offset1 += 8;
  110. i --;
  111. } while (i > 0);
  112. }
  113. i = (m & 7);
  114. if (i > 0){
  115. do {
  116. ctemp1 = *c_offset1;
  117. ctemp1 *= beta;
  118. *c_offset1 = ctemp1;
  119. c_offset1 ++;
  120. i --;
  121. } while (i > 0);
  122. }
  123. j --;
  124. } while (j > 0);
  125. }
  126. return 0;
  127. };