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.

sgemv_t_8.c 17 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552
  1. /***************************************************************************
  2. Copyright (c) 2019, 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. /****Note***
  28. UnUsed kernel
  29. This kernel works. But it was not competitive enough to be added in production
  30. It could be used and tested in future or could be used as base for switching to inline assembly
  31. */
  32. #include "common.h"
  33. #include <stdio.h>
  34. #define NBMAX 4096
  35. #include <altivec.h>
  36. static void sgemv_kernel_8x8(BLASLONG n, BLASLONG lda, FLOAT *ap, FLOAT *x, FLOAT *y, FLOAT alpha) {
  37. BLASLONG i;
  38. FLOAT *a0, *a1, *a2, *a3, *a4, *a5, *a6, *a7;
  39. __vector float *va0, *va1, *va2, *va3, *va4, *va5, *va6, *va7, *v_x;
  40. register __vector float temp0 = {0,0,0,0};
  41. register __vector float temp1 = {0,0,0,0};
  42. register __vector float temp2 = {0,0,0,0};
  43. register __vector float temp3 = {0,0,0,0};
  44. register __vector float temp4 = {0,0,0,0};
  45. register __vector float temp5 = {0,0,0,0};
  46. register __vector float temp6 = {0,0,0,0};
  47. register __vector float temp7 = {0,0,0,0};
  48. a0 = ap;
  49. a1 = ap + lda;
  50. a2 = a1 + lda;
  51. a3 = a2 + lda;
  52. a4 = a3 + lda;
  53. a5 = a4 + lda;
  54. a6 = a5 + lda;
  55. a7 = a6 + lda;
  56. va0 = (__vector float*) a0;
  57. va1 = (__vector float*) a1;
  58. va2 = (__vector float*) a2;
  59. va3 = (__vector float*) a3;
  60. va4 = (__vector float*) a4;
  61. va5 = (__vector float*) a5;
  62. va6 = (__vector float*) a6;
  63. va7 = (__vector float*) a7;
  64. v_x = (__vector float*) x;
  65. for (i = 0; i < n/4; i +=2) {
  66. register __vector float vx1=v_x[i] ;
  67. register __vector float vx2=v_x[i+1] ;
  68. register __vector float va0_1=va0[i] ;
  69. register __vector float va0_2=va0[i+1] ;
  70. register __vector float va1_1=va1[i] ;
  71. register __vector float va1_2=va1[i+1] ;
  72. register __vector float va2_1=va2[i] ;
  73. register __vector float va2_2=va2[i+1] ;
  74. register __vector float va3_1=va3[i] ;
  75. register __vector float va3_2=va3[i+1] ;
  76. register __vector float va4_1=va4[i] ;
  77. register __vector float va4_2=va4[i+1] ;
  78. register __vector float va5_1=va5[i] ;
  79. register __vector float va5_2=va5[i+1] ;
  80. register __vector float va6_1=va6[i] ;
  81. register __vector float va6_2=va6[i+1] ;
  82. register __vector float va7_1=va7[i] ;
  83. register __vector float va7_2=va7[i+1] ;
  84. temp0 += vx1* va0_1 + vx2 * va0_2;
  85. temp1 += vx1* va1_1 + vx2 * va1_2;
  86. temp2 += vx1* va2_1 + vx2 * va2_2;
  87. temp3 += vx1* va3_1 + vx2 * va3_2;
  88. temp4 += vx1* va4_1 + vx2 * va4_2;
  89. temp5 += vx1* va5_1 + vx2 * va5_2;
  90. temp6 += vx1* va6_1 + vx2 * va6_2;
  91. temp7 += vx1* va7_1 + vx2 * va7_2;
  92. }
  93. #if defined(POWER8)
  94. y[0] += alpha * (temp0[0] + temp0[1]+temp0[2] + temp0[3]);
  95. y[1] += alpha * (temp1[0] + temp1[1]+temp1[2] + temp1[3]);
  96. y[2] += alpha * (temp2[0] + temp2[1]+temp2[2] + temp2[3]);
  97. y[3] += alpha * (temp3[0] + temp3[1]+temp3[2] + temp3[3]);
  98. y[4] += alpha * (temp4[0] + temp4[1]+temp4[2] + temp4[3]);
  99. y[5] += alpha * (temp5[0] + temp5[1]+temp5[2] + temp5[3]);
  100. y[6] += alpha * (temp6[0] + temp6[1]+temp6[2] + temp6[3]);
  101. y[7] += alpha * (temp7[0] + temp7[1]+temp7[2] + temp7[3]);
  102. #else
  103. register __vector float t0, t1, t2, t3;
  104. register __vector float a = { alpha, alpha, alpha, alpha };
  105. __vector float *v_y = (__vector float*) y;
  106. t0 = vec_mergeh(temp0, temp2);
  107. t1 = vec_mergel(temp0, temp2);
  108. t2 = vec_mergeh(temp1, temp3);
  109. t3 = vec_mergel(temp1, temp3);
  110. temp0 = vec_mergeh(t0, t2);
  111. temp1 = vec_mergel(t0, t2);
  112. temp2 = vec_mergeh(t1, t3);
  113. temp3 = vec_mergel(t1, t3);
  114. temp0 += temp1 + temp2 + temp3;
  115. t0 = vec_mergeh(temp4, temp6);
  116. t1 = vec_mergel(temp4, temp6);
  117. t2 = vec_mergeh(temp5, temp7);
  118. t3 = vec_mergel(temp5, temp7);
  119. temp4 = vec_mergeh(t0, t2);
  120. temp5 = vec_mergel(t0, t2);
  121. temp6 = vec_mergeh(t1, t3);
  122. temp7 = vec_mergel(t1, t3);
  123. temp4 += temp5 + temp6 + temp7;
  124. v_y[0] += a * temp0;
  125. v_y[1] += a * temp4;
  126. #endif
  127. }
  128. static void sgemv_kernel_8x4(BLASLONG n, BLASLONG lda, FLOAT *ap, FLOAT *x, FLOAT *y, FLOAT alpha) {
  129. BLASLONG i = 0;
  130. FLOAT *a0, *a1, *a2, *a3;
  131. a0 = ap;
  132. a1 = ap + lda;
  133. a2 = a1 + lda;
  134. a3 = a2 + lda;
  135. __vector float* va0 = (__vector float*) a0;
  136. __vector float* va1 = (__vector float*) a1;
  137. __vector float* va2 = (__vector float*) a2;
  138. __vector float* va3 = (__vector float*) a3;
  139. __vector float* v_x = (__vector float*) x;
  140. register __vector float temp0 = {0,0,0,0};
  141. register __vector float temp1 = {0,0,0,0};
  142. register __vector float temp2 = {0,0,0,0};
  143. register __vector float temp3 = {0,0,0,0};
  144. for (i = 0; i < n / 4; i +=2) {
  145. temp0 += v_x[i] * va0[i] + v_x[i+1] * va0[i+1];
  146. temp1 += v_x[i] * va1[i] + v_x[i+1] * va1[i+1];
  147. temp2 += v_x[i] * va2[i] + v_x[i+1] * va2[i+1];
  148. temp3 += v_x[i] * va3[i] + v_x[i+1] * va3[i+1];
  149. }
  150. #if defined(POWER8)
  151. y[0] += alpha * (temp0[0] + temp0[1]+temp0[2] + temp0[3]);
  152. y[1] += alpha * (temp1[0] + temp1[1]+temp1[2] + temp1[3]);
  153. y[2] += alpha * (temp2[0] + temp2[1]+temp2[2] + temp2[3]);
  154. y[3] += alpha * (temp3[0] + temp3[1]+temp3[2] + temp3[3]);
  155. #else
  156. register __vector float t0, t1, t2, t3;
  157. register __vector float a = { alpha, alpha, alpha, alpha };
  158. __vector float *v_y = (__vector float*) y;
  159. t0 = vec_mergeh(temp0, temp2);
  160. t1 = vec_mergel(temp0, temp2);
  161. t2 = vec_mergeh(temp1, temp3);
  162. t3 = vec_mergel(temp1, temp3);
  163. temp0 = vec_mergeh(t0, t2);
  164. temp1 = vec_mergel(t0, t2);
  165. temp2 = vec_mergeh(t1, t3);
  166. temp3 = vec_mergel(t1, t3);
  167. temp0 += temp1 + temp2 + temp3;
  168. v_y[0] += a * temp0;
  169. #endif
  170. }
  171. static void sgemv_kernel_8x2(BLASLONG n, BLASLONG lda, FLOAT *ap, FLOAT *x, FLOAT *y, FLOAT alpha, BLASLONG inc_y) {
  172. BLASLONG i;
  173. FLOAT *a0, *a1;
  174. a0 = ap;
  175. a1 = ap + lda;
  176. __vector float* va0 = (__vector float*) a0;
  177. __vector float* va1 = (__vector float*) a1;
  178. __vector float* v_x = (__vector float*) x;
  179. __vector float temp0 = {0,0,0,0};
  180. __vector float temp1 = {0,0,0,0};
  181. for (i = 0; i < n / 4; i +=2) {
  182. temp0 += v_x[i] * va0[i] + v_x[i+1] * va0[i+1];
  183. temp1 += v_x[i] * va1[i] + v_x[i+1] * va1[i+1];
  184. }
  185. y[0] += alpha * (temp0[0] + temp0[1]+temp0[2] + temp0[3]);
  186. y[inc_y] += alpha * (temp1[0] + temp1[1]+temp1[2] + temp1[3]);
  187. }
  188. static void sgemv_kernel_8x1(BLASLONG n, FLOAT *ap, FLOAT *x, FLOAT *y, FLOAT alpha) {
  189. BLASLONG i;
  190. FLOAT *a0;
  191. a0 = ap;
  192. __vector float* va0 = (__vector float*) a0;
  193. __vector float* v_x = (__vector float*) x;
  194. __vector float temp0 = {0,0,0,0};
  195. for (i = 0; i < n / 4; i +=2) {
  196. temp0 += v_x[i] * va0[i] + v_x[i+1] * va0[i+1];
  197. }
  198. y[0] += alpha * (temp0[0] + temp0[1]+temp0[2] + temp0[3]);
  199. }
  200. static void copy_x(BLASLONG n, FLOAT *src, FLOAT *dest, BLASLONG inc_src) {
  201. BLASLONG i;
  202. for (i = 0; i < n; i++) {
  203. *dest++ = *src;
  204. src += inc_src;
  205. }
  206. }
  207. int CNAME(BLASLONG m, BLASLONG n, BLASLONG dummy1, FLOAT alpha, FLOAT *a, BLASLONG lda, FLOAT *x, BLASLONG inc_x, FLOAT *y, BLASLONG inc_y, FLOAT *buffer) {
  208. BLASLONG i;
  209. BLASLONG j;
  210. FLOAT *a_ptr;
  211. FLOAT *x_ptr;
  212. FLOAT *y_ptr;
  213. BLASLONG n1;
  214. BLASLONG m1;
  215. BLASLONG m2;
  216. BLASLONG m3;
  217. BLASLONG n2;
  218. FLOAT ybuffer[8] __attribute__((aligned(16)));
  219. FLOAT *xbuffer;
  220. if (m < 1) return (0);
  221. if (n < 1) return (0);
  222. xbuffer = buffer;
  223. n1 = n >> 3;
  224. n2 = n & 7;
  225. m3 = m & 7;
  226. m1 = m - m3;
  227. m2 = (m & (NBMAX - 1)) - m3;
  228. BLASLONG NB = NBMAX;
  229. while (NB == NBMAX) {
  230. m1 -= NB;
  231. if (m1 < 0) {
  232. if (m2 == 0) break;
  233. NB = m2;
  234. }
  235. y_ptr = y;
  236. a_ptr = a;
  237. x_ptr = x;
  238. if (inc_x != 1)
  239. copy_x(NB, x_ptr, xbuffer, inc_x);
  240. else
  241. xbuffer = x_ptr;
  242. BLASLONG lda8 = lda << 3;
  243. if (inc_y == 1) {
  244. for (i = 0; i < n1; i++) {
  245. sgemv_kernel_8x8(NB, lda, a_ptr, xbuffer, y_ptr, alpha);
  246. y_ptr += 8;
  247. a_ptr += lda8;
  248. }
  249. } else {
  250. for (i = 0; i < n1; i++) {
  251. ybuffer[0] = 0;
  252. ybuffer[1] = 0;
  253. ybuffer[2] = 0;
  254. ybuffer[3] = 0;
  255. ybuffer[4] = 0;
  256. ybuffer[5] = 0;
  257. ybuffer[6] = 0;
  258. ybuffer[7] = 0;
  259. sgemv_kernel_8x8(NB, lda, a_ptr, xbuffer, ybuffer, alpha);
  260. *y_ptr += ybuffer[0];
  261. y_ptr += inc_y;
  262. *y_ptr += ybuffer[1];
  263. y_ptr += inc_y;
  264. *y_ptr += ybuffer[2];
  265. y_ptr += inc_y;
  266. *y_ptr += ybuffer[3];
  267. y_ptr += inc_y;
  268. *y_ptr += ybuffer[4];
  269. y_ptr += inc_y;
  270. *y_ptr += ybuffer[5];
  271. y_ptr += inc_y;
  272. *y_ptr += ybuffer[6];
  273. y_ptr += inc_y;
  274. *y_ptr += ybuffer[7];
  275. y_ptr += inc_y;
  276. a_ptr += lda8;
  277. }
  278. }
  279. if (n2 & 4) {
  280. ybuffer[0] = 0;
  281. ybuffer[1] = 0;
  282. ybuffer[2] = 0;
  283. ybuffer[3] = 0;
  284. sgemv_kernel_8x4(NB, lda, a_ptr, xbuffer, ybuffer, alpha);
  285. a_ptr += lda<<2;
  286. *y_ptr += ybuffer[0];
  287. y_ptr += inc_y;
  288. *y_ptr += ybuffer[1];
  289. y_ptr += inc_y;
  290. *y_ptr += ybuffer[2];
  291. y_ptr += inc_y;
  292. *y_ptr += ybuffer[3];
  293. y_ptr += inc_y;
  294. }
  295. if (n2 & 2) {
  296. sgemv_kernel_8x2(NB, lda, a_ptr, xbuffer, y_ptr, alpha, inc_y);
  297. a_ptr += lda << 1;
  298. y_ptr += 2 * inc_y;
  299. }
  300. if (n2 & 1) {
  301. sgemv_kernel_8x1(NB, a_ptr, xbuffer, y_ptr, alpha);
  302. a_ptr += lda;
  303. y_ptr += inc_y;
  304. }
  305. a += NB;
  306. x += NB * inc_x;
  307. }
  308. if (m3 == 0) return (0);
  309. x_ptr = x;
  310. a_ptr = a;
  311. if (m3 & 4) {
  312. FLOAT xtemp0 = *x_ptr * alpha;
  313. x_ptr += inc_x;
  314. FLOAT xtemp1 = *x_ptr * alpha;
  315. x_ptr += inc_x;
  316. FLOAT xtemp2 = *x_ptr * alpha;
  317. x_ptr += inc_x;
  318. FLOAT xtemp3 = *x_ptr * alpha;
  319. x_ptr += inc_x;
  320. FLOAT *aj = a_ptr;
  321. y_ptr = y;
  322. if (lda == 4 && inc_y == 1) {
  323. for (j = 0; j < (n & -4); j += 4) {
  324. y_ptr[j] += aj[0] * xtemp0 + aj[1] * xtemp1 + aj[2] * xtemp2 + aj[3] * xtemp3;
  325. y_ptr[j + 1] += aj[4] * xtemp0 + aj[5] * xtemp1 + aj[6] * xtemp2 + aj[7] * xtemp3;
  326. y_ptr[j + 2] += aj[8] * xtemp0 + aj[9] * xtemp1 + aj[10] * xtemp2 + aj[11] * xtemp3;
  327. y_ptr[j + 3] += aj[12] * xtemp0 + aj[13] * xtemp1 + aj[14] * xtemp2 + aj[15] * xtemp3;
  328. aj += 16;
  329. }
  330. for (; j < n; j++) {
  331. y_ptr[j] += aj[0] * xtemp0 + aj[1] * xtemp1 + aj[2] * xtemp2 + aj[3] * xtemp3;
  332. aj += 4;
  333. }
  334. } else if (inc_y == 1) {
  335. BLASLONG register lda2 = lda << 1;
  336. BLASLONG register lda4 = lda << 2;
  337. BLASLONG register lda3 = lda2 + lda;
  338. for (j = 0; j < (n & -4); j += 4) {
  339. y_ptr[j] += *aj * xtemp0 + *(aj + 1) * xtemp1 + *(aj + 2) * xtemp2 + *(aj + 3) * xtemp3;
  340. y_ptr[j + 1] += *(aj + lda) * xtemp0 + *(aj + lda + 1) * xtemp1 + *(aj + lda + 2) * xtemp2 + *(aj + lda +3) * xtemp3;
  341. y_ptr[j + 2] += *(aj + lda2) * xtemp0 + *(aj + lda2 + 1) * xtemp1 + *(aj + lda2 + 2) * xtemp2 + *(aj + lda2 +3) * xtemp3;
  342. y_ptr[j + 3] += *(aj + lda3) * xtemp0 + *(aj + lda3 + 1) * xtemp1 + *(aj + lda3 + 2) * xtemp2 + *(aj + lda3+3) * xtemp3;
  343. aj += lda4;
  344. }
  345. for (; j < n; j++) {
  346. y_ptr[j] += *aj * xtemp0 + *(aj + 1) * xtemp1 + *(aj + 2) * xtemp2+*(aj + 3) * xtemp3;
  347. aj += lda;
  348. }
  349. } else {
  350. for (j = 0; j < n; j++) {
  351. *y_ptr += *aj * xtemp0 + *(aj + 1) * xtemp1 + *(aj + 2) * xtemp2+ *(aj + 3) * xtemp3;
  352. y_ptr += inc_y;
  353. aj += lda;
  354. }
  355. }
  356. if (m3==4) return (0);
  357. a_ptr += 4;
  358. }
  359. if (m3 & 2 ) {
  360. FLOAT xtemp0 = *x_ptr * alpha;
  361. x_ptr += inc_x;
  362. FLOAT xtemp1 = *x_ptr * alpha;
  363. x_ptr += inc_x;
  364. FLOAT *aj = a_ptr;
  365. y_ptr = y;
  366. if (lda == 2 && inc_y == 1) {
  367. for (j = 0; j < (n & -4); j += 4) {
  368. y_ptr[j] += aj[0] * xtemp0 + aj[1] * xtemp1;
  369. y_ptr[j + 1] += aj[2] * xtemp0 + aj[3] * xtemp1;
  370. y_ptr[j + 2] += aj[4] * xtemp0 + aj[5] * xtemp1;
  371. y_ptr[j + 3] += aj[6] * xtemp0 + aj[7] * xtemp1;
  372. aj += 8;
  373. }
  374. for (; j < n; j++) {
  375. y_ptr[j] += aj[0] * xtemp0 + aj[1] * xtemp1;
  376. aj += 2;
  377. }
  378. } else {
  379. if (inc_y == 1) {
  380. BLASLONG register lda2 = lda << 1;
  381. BLASLONG register lda4 = lda << 2;
  382. BLASLONG register lda3 = lda2 + lda;
  383. for (j = 0; j < (n & -4); j += 4) {
  384. y_ptr[j] += *aj * xtemp0 + *(aj + 1) * xtemp1;
  385. y_ptr[j + 1] += *(aj + lda) * xtemp0 + *(aj + lda + 1) * xtemp1;
  386. y_ptr[j + 2] += *(aj + lda2) * xtemp0 + *(aj + lda2 + 1) * xtemp1;
  387. y_ptr[j + 3] += *(aj + lda3) * xtemp0 + *(aj + lda3 + 1) * xtemp1;
  388. aj += lda4;
  389. }
  390. for (; j < n; j++) {
  391. y_ptr[j] += *aj * xtemp0 + *(aj + 1) * xtemp1;
  392. aj += lda;
  393. }
  394. } else {
  395. for (j = 0; j < n; j++) {
  396. *y_ptr += *aj * xtemp0 + *(aj + 1) * xtemp1;
  397. y_ptr += inc_y;
  398. aj += lda;
  399. }
  400. }
  401. }
  402. if (m3==2) return (0);
  403. a_ptr += 2;
  404. }
  405. if (m3 & 1) {
  406. FLOAT xtemp = *x_ptr * alpha;
  407. x_ptr += inc_x;
  408. FLOAT *aj = a_ptr;
  409. y_ptr = y;
  410. if (lda == 1 && inc_y == 1) {
  411. for (j = 0; j < (n & -4); j += 4) {
  412. y_ptr[j] += aj[j] * xtemp;
  413. y_ptr[j + 1] += aj[j + 1] * xtemp;
  414. y_ptr[j + 2] += aj[j + 2] * xtemp;
  415. y_ptr[j + 3] += aj[j + 3] * xtemp;
  416. }
  417. for (; j < n; j++) {
  418. y_ptr[j] += aj[j] * xtemp;
  419. }
  420. } else {
  421. if (inc_y == 1) {
  422. BLASLONG register lda2 = lda << 1;
  423. BLASLONG register lda4 = lda << 2;
  424. BLASLONG register lda3 = lda2 + lda;
  425. for (j = 0; j < (n & -4); j += 4) {
  426. y_ptr[j] += *aj * xtemp;
  427. y_ptr[j + 1] += *(aj + lda) * xtemp;
  428. y_ptr[j + 2] += *(aj + lda2) * xtemp;
  429. y_ptr[j + 3] += *(aj + lda3) * xtemp;
  430. aj += lda4;
  431. }
  432. for (; j < n; j++) {
  433. y_ptr[j] += *aj * xtemp;
  434. aj += lda;
  435. }
  436. } else {
  437. for (j = 0; j < n; j++) {
  438. *y_ptr += *aj * xtemp;
  439. y_ptr += inc_y;
  440. aj += lda;
  441. }
  442. }
  443. }
  444. a_ptr += 1;
  445. }
  446. return (0);
  447. }