Add a C+intrinsics version of the SGEMM/skylakex kernel
for most sizes this is 1.2x to 1.4x faster than the current code
This commit is contained in:
parent
065763adde
commit
d4bad73834
|
@ -0,0 +1,150 @@
|
|||
/*********************************************************************/
|
||||
/* Copyright 2009, 2010 The University of Texas at Austin. */
|
||||
/* All rights reserved. */
|
||||
/* */
|
||||
/* Redistribution and use in source and binary forms, with or */
|
||||
/* without modification, are permitted provided that the following */
|
||||
/* conditions are met: */
|
||||
/* */
|
||||
/* 1. Redistributions of source code must retain the above */
|
||||
/* copyright notice, this list of conditions and the following */
|
||||
/* disclaimer. */
|
||||
/* */
|
||||
/* 2. Redistributions in binary form must reproduce the above */
|
||||
/* copyright notice, this list of conditions and the following */
|
||||
/* disclaimer in the documentation and/or other materials */
|
||||
/* provided with the distribution. */
|
||||
/* */
|
||||
/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */
|
||||
/* AUSTIN ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, */
|
||||
/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
|
||||
/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */
|
||||
/* DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OF TEXAS AT */
|
||||
/* AUSTIN OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, */
|
||||
/* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES */
|
||||
/* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE */
|
||||
/* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR */
|
||||
/* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF */
|
||||
/* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */
|
||||
/* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT */
|
||||
/* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
|
||||
/* POSSIBILITY OF SUCH DAMAGE. */
|
||||
/* */
|
||||
/* The views and conclusions contained in the software and */
|
||||
/* documentation are those of the authors and should not be */
|
||||
/* interpreted as representing official policies, either expressed */
|
||||
/* or implied, of The University of Texas at Austin. */
|
||||
/*********************************************************************/
|
||||
|
||||
#include "common.h"
|
||||
|
||||
#include <immintrin.h>
|
||||
|
||||
int CNAME(BLASLONG m, BLASLONG n, BLASLONG dummy1, FLOAT beta,
|
||||
FLOAT *dummy2, BLASLONG dummy3, FLOAT *dummy4, BLASLONG dummy5,
|
||||
FLOAT *c, BLASLONG ldc){
|
||||
|
||||
BLASLONG i, j;
|
||||
FLOAT *c_offset1, *c_offset;
|
||||
FLOAT ctemp1, ctemp2, ctemp3, ctemp4;
|
||||
FLOAT ctemp5, ctemp6, ctemp7, ctemp8;
|
||||
|
||||
/* fast path.. just zero the whole matrix */
|
||||
if (m == ldc && (unsigned long)beta == (unsigned long)ZERO) {
|
||||
memset(c, 0, m * n * sizeof(FLOAT));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
c_offset = c;
|
||||
|
||||
if (beta == ZERO){
|
||||
__m512 z_zero;
|
||||
|
||||
z_zero = _mm512_setzero_ps();
|
||||
j = n;
|
||||
do {
|
||||
c_offset1 = c_offset;
|
||||
c_offset += ldc;
|
||||
|
||||
i = m;
|
||||
|
||||
while (i > 32) {
|
||||
_mm512_storeu_ps(c_offset1, z_zero);
|
||||
_mm512_storeu_ps(c_offset1 + 8, z_zero);
|
||||
_mm512_storeu_ps(c_offset1 + 16, z_zero);
|
||||
_mm512_storeu_ps(c_offset1 + 24 , z_zero);
|
||||
c_offset1 += 32;
|
||||
i -= 32;
|
||||
}
|
||||
while (i > 8) {
|
||||
_mm512_storeu_ps(c_offset1, z_zero);
|
||||
c_offset1 += 8;
|
||||
i -= 8;
|
||||
}
|
||||
|
||||
while (i > 0) {
|
||||
*c_offset1 = ZERO;
|
||||
c_offset1 ++;
|
||||
i --;
|
||||
}
|
||||
j --;
|
||||
} while (j > 0);
|
||||
|
||||
} else {
|
||||
|
||||
j = n;
|
||||
do {
|
||||
c_offset1 = c_offset;
|
||||
c_offset += ldc;
|
||||
|
||||
i = (m >> 3);
|
||||
if (i > 0){
|
||||
do {
|
||||
ctemp1 = *(c_offset1 + 0);
|
||||
ctemp2 = *(c_offset1 + 1);
|
||||
ctemp3 = *(c_offset1 + 2);
|
||||
ctemp4 = *(c_offset1 + 3);
|
||||
ctemp5 = *(c_offset1 + 4);
|
||||
ctemp6 = *(c_offset1 + 5);
|
||||
ctemp7 = *(c_offset1 + 6);
|
||||
ctemp8 = *(c_offset1 + 7);
|
||||
|
||||
ctemp1 *= beta;
|
||||
ctemp2 *= beta;
|
||||
ctemp3 *= beta;
|
||||
ctemp4 *= beta;
|
||||
ctemp5 *= beta;
|
||||
ctemp6 *= beta;
|
||||
ctemp7 *= beta;
|
||||
ctemp8 *= beta;
|
||||
|
||||
*(c_offset1 + 0) = ctemp1;
|
||||
*(c_offset1 + 1) = ctemp2;
|
||||
*(c_offset1 + 2) = ctemp3;
|
||||
*(c_offset1 + 3) = ctemp4;
|
||||
*(c_offset1 + 4) = ctemp5;
|
||||
*(c_offset1 + 5) = ctemp6;
|
||||
*(c_offset1 + 6) = ctemp7;
|
||||
*(c_offset1 + 7) = ctemp8;
|
||||
c_offset1 += 8;
|
||||
i --;
|
||||
} while (i > 0);
|
||||
}
|
||||
|
||||
i = (m & 7);
|
||||
if (i > 0){
|
||||
do {
|
||||
ctemp1 = *c_offset1;
|
||||
ctemp1 *= beta;
|
||||
*c_offset1 = ctemp1;
|
||||
c_offset1 ++;
|
||||
i --;
|
||||
} while (i > 0);
|
||||
}
|
||||
j --;
|
||||
} while (j > 0);
|
||||
|
||||
}
|
||||
return 0;
|
||||
};
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,207 @@
|
|||
/*********************************************************************/
|
||||
/* Copyright 2009, 2010 The University of Texas at Austin. */
|
||||
/* All rights reserved. */
|
||||
/* */
|
||||
/* Redistribution and use in source and binary forms, with or */
|
||||
/* without modification, are permitted provided that the following */
|
||||
/* conditions are met: */
|
||||
/* */
|
||||
/* 1. Redistributions of source code must retain the above */
|
||||
/* copyright notice, this list of conditions and the following */
|
||||
/* disclaimer. */
|
||||
/* */
|
||||
/* 2. Redistributions in binary form must reproduce the above */
|
||||
/* copyright notice, this list of conditions and the following */
|
||||
/* disclaimer in the documentation and/or other materials */
|
||||
/* provided with the distribution. */
|
||||
/* */
|
||||
/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */
|
||||
/* AUSTIN ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, */
|
||||
/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
|
||||
/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */
|
||||
/* DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OF TEXAS AT */
|
||||
/* AUSTIN OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, */
|
||||
/* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES */
|
||||
/* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE */
|
||||
/* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR */
|
||||
/* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF */
|
||||
/* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */
|
||||
/* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT */
|
||||
/* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
|
||||
/* POSSIBILITY OF SUCH DAMAGE. */
|
||||
/* */
|
||||
/* The views and conclusions contained in the software and */
|
||||
/* documentation are those of the authors and should not be */
|
||||
/* interpreted as representing official policies, either expressed */
|
||||
/* or implied, of The University of Texas at Austin. */
|
||||
/*********************************************************************/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "common.h"
|
||||
|
||||
#include <immintrin.h>
|
||||
|
||||
|
||||
int CNAME(BLASLONG m, BLASLONG n, FLOAT * __restrict a, BLASLONG lda, FLOAT * __restrict b){
|
||||
BLASLONG i, j;
|
||||
|
||||
FLOAT *a_offset, *a_offset1, *a_offset2, *a_offset3, *a_offset4;
|
||||
FLOAT *b_offset;
|
||||
FLOAT ctemp1, ctemp2, ctemp3, ctemp4;
|
||||
FLOAT ctemp5, ctemp6, ctemp7, ctemp8;
|
||||
FLOAT ctemp9, ctemp10, ctemp11, ctemp12;
|
||||
FLOAT ctemp13, ctemp14, ctemp15, ctemp16;
|
||||
|
||||
a_offset = a;
|
||||
b_offset = b;
|
||||
|
||||
j = (n >> 2);
|
||||
if (j > 0){
|
||||
do{
|
||||
a_offset1 = a_offset;
|
||||
a_offset2 = a_offset1 + lda;
|
||||
a_offset3 = a_offset2 + lda;
|
||||
a_offset4 = a_offset3 + lda;
|
||||
a_offset += 4 * lda;
|
||||
|
||||
i = (m >> 2);
|
||||
if (i > 0){
|
||||
do{
|
||||
__m128 row0, row1, row2, row3;
|
||||
|
||||
row0 = _mm_loadu_ps(a_offset1);
|
||||
row1 = _mm_loadu_ps(a_offset2);
|
||||
row2 = _mm_loadu_ps(a_offset3);
|
||||
row3 = _mm_loadu_ps(a_offset4);
|
||||
|
||||
_MM_TRANSPOSE4_PS(row0, row1, row2, row3);
|
||||
|
||||
_mm_storeu_ps(b_offset + 0, row0);
|
||||
_mm_storeu_ps(b_offset + 4, row1);
|
||||
_mm_storeu_ps(b_offset + 8, row2);
|
||||
_mm_storeu_ps(b_offset + 12, row3);
|
||||
|
||||
a_offset1 += 4;
|
||||
a_offset2 += 4;
|
||||
a_offset3 += 4;
|
||||
a_offset4 += 4;
|
||||
|
||||
b_offset += 16;
|
||||
i --;
|
||||
}while(i > 0);
|
||||
}
|
||||
|
||||
i = (m & 3);
|
||||
if (i > 0){
|
||||
do{
|
||||
ctemp1 = *(a_offset1 + 0);
|
||||
ctemp5 = *(a_offset2 + 0);
|
||||
ctemp9 = *(a_offset3 + 0);
|
||||
ctemp13 = *(a_offset4 + 0);
|
||||
|
||||
*(b_offset + 0) = ctemp1;
|
||||
*(b_offset + 1) = ctemp5;
|
||||
*(b_offset + 2) = ctemp9;
|
||||
*(b_offset + 3) = ctemp13;
|
||||
|
||||
a_offset1 ++;
|
||||
a_offset2 ++;
|
||||
a_offset3 ++;
|
||||
a_offset4 ++;
|
||||
|
||||
b_offset += 4;
|
||||
i --;
|
||||
}while(i > 0);
|
||||
}
|
||||
j--;
|
||||
}while(j > 0);
|
||||
} /* end of if(j > 0) */
|
||||
|
||||
if (n & 2){
|
||||
a_offset1 = a_offset;
|
||||
a_offset2 = a_offset1 + lda;
|
||||
a_offset += 2 * lda;
|
||||
|
||||
i = (m >> 2);
|
||||
if (i > 0){
|
||||
do{
|
||||
ctemp1 = *(a_offset1 + 0);
|
||||
ctemp2 = *(a_offset1 + 1);
|
||||
ctemp3 = *(a_offset1 + 2);
|
||||
ctemp4 = *(a_offset1 + 3);
|
||||
|
||||
ctemp5 = *(a_offset2 + 0);
|
||||
ctemp6 = *(a_offset2 + 1);
|
||||
ctemp7 = *(a_offset2 + 2);
|
||||
ctemp8 = *(a_offset2 + 3);
|
||||
|
||||
*(b_offset + 0) = ctemp1;
|
||||
*(b_offset + 1) = ctemp5;
|
||||
*(b_offset + 2) = ctemp2;
|
||||
*(b_offset + 3) = ctemp6;
|
||||
|
||||
*(b_offset + 4) = ctemp3;
|
||||
*(b_offset + 5) = ctemp7;
|
||||
*(b_offset + 6) = ctemp4;
|
||||
*(b_offset + 7) = ctemp8;
|
||||
|
||||
a_offset1 += 4;
|
||||
a_offset2 += 4;
|
||||
b_offset += 8;
|
||||
i --;
|
||||
}while(i > 0);
|
||||
}
|
||||
|
||||
i = (m & 3);
|
||||
if (i > 0){
|
||||
do{
|
||||
ctemp1 = *(a_offset1 + 0);
|
||||
ctemp5 = *(a_offset2 + 0);
|
||||
|
||||
*(b_offset + 0) = ctemp1;
|
||||
*(b_offset + 1) = ctemp5;
|
||||
|
||||
a_offset1 ++;
|
||||
a_offset2 ++;
|
||||
b_offset += 2;
|
||||
i --;
|
||||
}while(i > 0);
|
||||
}
|
||||
} /* end of if(j > 0) */
|
||||
|
||||
if (n & 1){
|
||||
a_offset1 = a_offset;
|
||||
|
||||
i = (m >> 2);
|
||||
if (i > 0){
|
||||
do{
|
||||
ctemp1 = *(a_offset1 + 0);
|
||||
ctemp2 = *(a_offset1 + 1);
|
||||
ctemp3 = *(a_offset1 + 2);
|
||||
ctemp4 = *(a_offset1 + 3);
|
||||
|
||||
*(b_offset + 0) = ctemp1;
|
||||
*(b_offset + 1) = ctemp2;
|
||||
*(b_offset + 2) = ctemp3;
|
||||
*(b_offset + 3) = ctemp4;
|
||||
|
||||
a_offset1 += 4;
|
||||
b_offset += 4;
|
||||
i --;
|
||||
}while(i > 0);
|
||||
}
|
||||
|
||||
i = (m & 3);
|
||||
if (i > 0){
|
||||
do{
|
||||
ctemp1 = *(a_offset1 + 0);
|
||||
*(b_offset + 0) = ctemp1;
|
||||
a_offset1 ++;
|
||||
b_offset += 1;
|
||||
i --;
|
||||
}while(i > 0);
|
||||
}
|
||||
} /* end of if(j > 0) */
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,387 @@
|
|||
/*********************************************************************/
|
||||
/* Copyright 2009, 2010 The University of Texas at Austin. */
|
||||
/* All rights reserved. */
|
||||
/* */
|
||||
/* Redistribution and use in source and binary forms, with or */
|
||||
/* without modification, are permitted provided that the following */
|
||||
/* conditions are met: */
|
||||
/* */
|
||||
/* 1. Redistributions of source code must retain the above */
|
||||
/* copyright notice, this list of conditions and the following */
|
||||
/* disclaimer. */
|
||||
/* */
|
||||
/* 2. Redistributions in binary form must reproduce the above */
|
||||
/* copyright notice, this list of conditions and the following */
|
||||
/* disclaimer in the documentation and/or other materials */
|
||||
/* provided with the distribution. */
|
||||
/* */
|
||||
/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */
|
||||
/* AUSTIN ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, */
|
||||
/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
|
||||
/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */
|
||||
/* DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OF TEXAS AT */
|
||||
/* AUSTIN OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, */
|
||||
/* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES */
|
||||
/* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE */
|
||||
/* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR */
|
||||
/* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF */
|
||||
/* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */
|
||||
/* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT */
|
||||
/* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
|
||||
/* POSSIBILITY OF SUCH DAMAGE. */
|
||||
/* */
|
||||
/* The views and conclusions contained in the software and */
|
||||
/* documentation are those of the authors and should not be */
|
||||
/* interpreted as representing official policies, either expressed */
|
||||
/* or implied, of The University of Texas at Austin. */
|
||||
/*********************************************************************/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "common.h"
|
||||
|
||||
int CNAME(BLASLONG m, BLASLONG n, FLOAT * __restrict a, BLASLONG lda, FLOAT * __restrict b){
|
||||
|
||||
BLASLONG i, j;
|
||||
|
||||
FLOAT *aoffset;
|
||||
FLOAT *aoffset1, *aoffset2;
|
||||
FLOAT *boffset;
|
||||
|
||||
FLOAT ctemp01, ctemp02, ctemp03, ctemp04;
|
||||
FLOAT ctemp05, ctemp06, ctemp07, ctemp08;
|
||||
FLOAT ctemp09, ctemp10, ctemp11, ctemp12;
|
||||
FLOAT ctemp13, ctemp14, ctemp15, ctemp16;
|
||||
FLOAT ctemp17, ctemp18, ctemp19, ctemp20;
|
||||
FLOAT ctemp21, ctemp22, ctemp23, ctemp24;
|
||||
FLOAT ctemp25, ctemp26, ctemp27, ctemp28;
|
||||
FLOAT ctemp29, ctemp30, ctemp31, ctemp32;
|
||||
|
||||
aoffset = a;
|
||||
boffset = b;
|
||||
|
||||
#if 0
|
||||
fprintf(stderr, "m = %d n = %d\n", m, n);
|
||||
#endif
|
||||
|
||||
j = (n >> 4);
|
||||
if (j > 0){
|
||||
do{
|
||||
aoffset1 = aoffset;
|
||||
aoffset2 = aoffset + lda;
|
||||
aoffset += 16;
|
||||
|
||||
i = (m >> 1);
|
||||
if (i > 0){
|
||||
do{
|
||||
ctemp01 = *(aoffset1 + 0);
|
||||
ctemp02 = *(aoffset1 + 1);
|
||||
ctemp03 = *(aoffset1 + 2);
|
||||
ctemp04 = *(aoffset1 + 3);
|
||||
ctemp05 = *(aoffset1 + 4);
|
||||
ctemp06 = *(aoffset1 + 5);
|
||||
ctemp07 = *(aoffset1 + 6);
|
||||
ctemp08 = *(aoffset1 + 7);
|
||||
ctemp09 = *(aoffset1 + 8);
|
||||
ctemp10 = *(aoffset1 + 9);
|
||||
ctemp11 = *(aoffset1 + 10);
|
||||
ctemp12 = *(aoffset1 + 11);
|
||||
ctemp13 = *(aoffset1 + 12);
|
||||
ctemp14 = *(aoffset1 + 13);
|
||||
ctemp15 = *(aoffset1 + 14);
|
||||
ctemp16 = *(aoffset1 + 15);
|
||||
|
||||
ctemp17 = *(aoffset2 + 0);
|
||||
ctemp18 = *(aoffset2 + 1);
|
||||
ctemp19 = *(aoffset2 + 2);
|
||||
ctemp20 = *(aoffset2 + 3);
|
||||
ctemp21 = *(aoffset2 + 4);
|
||||
ctemp22 = *(aoffset2 + 5);
|
||||
ctemp23 = *(aoffset2 + 6);
|
||||
ctemp24 = *(aoffset2 + 7);
|
||||
ctemp25 = *(aoffset2 + 8);
|
||||
ctemp26 = *(aoffset2 + 9);
|
||||
ctemp27 = *(aoffset2 + 10);
|
||||
ctemp28 = *(aoffset2 + 11);
|
||||
ctemp29 = *(aoffset2 + 12);
|
||||
ctemp30 = *(aoffset2 + 13);
|
||||
ctemp31 = *(aoffset2 + 14);
|
||||
ctemp32 = *(aoffset2 + 15);
|
||||
|
||||
*(boffset + 0) = ctemp01;
|
||||
*(boffset + 1) = ctemp02;
|
||||
*(boffset + 2) = ctemp03;
|
||||
*(boffset + 3) = ctemp04;
|
||||
*(boffset + 4) = ctemp05;
|
||||
*(boffset + 5) = ctemp06;
|
||||
*(boffset + 6) = ctemp07;
|
||||
*(boffset + 7) = ctemp08;
|
||||
|
||||
*(boffset + 8) = ctemp09;
|
||||
*(boffset + 9) = ctemp10;
|
||||
*(boffset + 10) = ctemp11;
|
||||
*(boffset + 11) = ctemp12;
|
||||
*(boffset + 12) = ctemp13;
|
||||
*(boffset + 13) = ctemp14;
|
||||
*(boffset + 14) = ctemp15;
|
||||
*(boffset + 15) = ctemp16;
|
||||
|
||||
*(boffset + 16) = ctemp17;
|
||||
*(boffset + 17) = ctemp18;
|
||||
*(boffset + 18) = ctemp19;
|
||||
*(boffset + 19) = ctemp20;
|
||||
*(boffset + 20) = ctemp21;
|
||||
*(boffset + 21) = ctemp22;
|
||||
*(boffset + 22) = ctemp23;
|
||||
*(boffset + 23) = ctemp24;
|
||||
|
||||
*(boffset + 24) = ctemp25;
|
||||
*(boffset + 25) = ctemp26;
|
||||
*(boffset + 26) = ctemp27;
|
||||
*(boffset + 27) = ctemp28;
|
||||
*(boffset + 28) = ctemp29;
|
||||
*(boffset + 29) = ctemp30;
|
||||
*(boffset + 30) = ctemp31;
|
||||
*(boffset + 31) = ctemp32;
|
||||
|
||||
aoffset1 += 2 * lda;
|
||||
aoffset2 += 2 * lda;
|
||||
boffset += 32;
|
||||
|
||||
i --;
|
||||
}while(i > 0);
|
||||
}
|
||||
|
||||
if (m & 1){
|
||||
ctemp01 = *(aoffset1 + 0);
|
||||
ctemp02 = *(aoffset1 + 1);
|
||||
ctemp03 = *(aoffset1 + 2);
|
||||
ctemp04 = *(aoffset1 + 3);
|
||||
ctemp05 = *(aoffset1 + 4);
|
||||
ctemp06 = *(aoffset1 + 5);
|
||||
ctemp07 = *(aoffset1 + 6);
|
||||
ctemp08 = *(aoffset1 + 7);
|
||||
ctemp09 = *(aoffset1 + 8);
|
||||
ctemp10 = *(aoffset1 + 9);
|
||||
ctemp11 = *(aoffset1 + 10);
|
||||
ctemp12 = *(aoffset1 + 11);
|
||||
ctemp13 = *(aoffset1 + 12);
|
||||
ctemp14 = *(aoffset1 + 13);
|
||||
ctemp15 = *(aoffset1 + 14);
|
||||
ctemp16 = *(aoffset1 + 15);
|
||||
|
||||
*(boffset + 0) = ctemp01;
|
||||
*(boffset + 1) = ctemp02;
|
||||
*(boffset + 2) = ctemp03;
|
||||
*(boffset + 3) = ctemp04;
|
||||
*(boffset + 4) = ctemp05;
|
||||
*(boffset + 5) = ctemp06;
|
||||
*(boffset + 6) = ctemp07;
|
||||
*(boffset + 7) = ctemp08;
|
||||
|
||||
*(boffset + 8) = ctemp09;
|
||||
*(boffset + 9) = ctemp10;
|
||||
*(boffset + 10) = ctemp11;
|
||||
*(boffset + 11) = ctemp12;
|
||||
*(boffset + 12) = ctemp13;
|
||||
*(boffset + 13) = ctemp14;
|
||||
*(boffset + 14) = ctemp15;
|
||||
*(boffset + 15) = ctemp16;
|
||||
|
||||
boffset += 16;
|
||||
}
|
||||
|
||||
j--;
|
||||
}while(j > 0);
|
||||
} /* end of if(j > 0) */
|
||||
|
||||
if (n & 8){
|
||||
aoffset1 = aoffset;
|
||||
aoffset2 = aoffset + lda;
|
||||
aoffset += 8;
|
||||
|
||||
i = (m >> 1);
|
||||
if (i > 0){
|
||||
do{
|
||||
ctemp01 = *(aoffset1 + 0);
|
||||
ctemp02 = *(aoffset1 + 1);
|
||||
ctemp03 = *(aoffset1 + 2);
|
||||
ctemp04 = *(aoffset1 + 3);
|
||||
ctemp05 = *(aoffset1 + 4);
|
||||
ctemp06 = *(aoffset1 + 5);
|
||||
ctemp07 = *(aoffset1 + 6);
|
||||
ctemp08 = *(aoffset1 + 7);
|
||||
|
||||
ctemp09 = *(aoffset2 + 0);
|
||||
ctemp10 = *(aoffset2 + 1);
|
||||
ctemp11 = *(aoffset2 + 2);
|
||||
ctemp12 = *(aoffset2 + 3);
|
||||
ctemp13 = *(aoffset2 + 4);
|
||||
ctemp14 = *(aoffset2 + 5);
|
||||
ctemp15 = *(aoffset2 + 6);
|
||||
ctemp16 = *(aoffset2 + 7);
|
||||
|
||||
*(boffset + 0) = ctemp01;
|
||||
*(boffset + 1) = ctemp02;
|
||||
*(boffset + 2) = ctemp03;
|
||||
*(boffset + 3) = ctemp04;
|
||||
*(boffset + 4) = ctemp05;
|
||||
*(boffset + 5) = ctemp06;
|
||||
*(boffset + 6) = ctemp07;
|
||||
*(boffset + 7) = ctemp08;
|
||||
|
||||
*(boffset + 8) = ctemp09;
|
||||
*(boffset + 9) = ctemp10;
|
||||
*(boffset + 10) = ctemp11;
|
||||
*(boffset + 11) = ctemp12;
|
||||
*(boffset + 12) = ctemp13;
|
||||
*(boffset + 13) = ctemp14;
|
||||
*(boffset + 14) = ctemp15;
|
||||
*(boffset + 15) = ctemp16;
|
||||
|
||||
aoffset1 += 2 * lda;
|
||||
aoffset2 += 2 * lda;
|
||||
boffset += 16;
|
||||
|
||||
i --;
|
||||
}while(i > 0);
|
||||
}
|
||||
|
||||
if (m & 1){
|
||||
ctemp01 = *(aoffset1 + 0);
|
||||
ctemp02 = *(aoffset1 + 1);
|
||||
ctemp03 = *(aoffset1 + 2);
|
||||
ctemp04 = *(aoffset1 + 3);
|
||||
ctemp05 = *(aoffset1 + 4);
|
||||
ctemp06 = *(aoffset1 + 5);
|
||||
ctemp07 = *(aoffset1 + 6);
|
||||
ctemp08 = *(aoffset1 + 7);
|
||||
|
||||
*(boffset + 0) = ctemp01;
|
||||
*(boffset + 1) = ctemp02;
|
||||
*(boffset + 2) = ctemp03;
|
||||
*(boffset + 3) = ctemp04;
|
||||
*(boffset + 4) = ctemp05;
|
||||
*(boffset + 5) = ctemp06;
|
||||
*(boffset + 6) = ctemp07;
|
||||
*(boffset + 7) = ctemp08;
|
||||
|
||||
boffset += 8;
|
||||
}
|
||||
}
|
||||
|
||||
if (n & 4){
|
||||
aoffset1 = aoffset;
|
||||
aoffset2 = aoffset + lda;
|
||||
aoffset += 4;
|
||||
|
||||
i = (m >> 1);
|
||||
if (i > 0){
|
||||
do{
|
||||
ctemp01 = *(aoffset1 + 0);
|
||||
ctemp02 = *(aoffset1 + 1);
|
||||
ctemp03 = *(aoffset1 + 2);
|
||||
ctemp04 = *(aoffset1 + 3);
|
||||
|
||||
ctemp05 = *(aoffset2 + 0);
|
||||
ctemp06 = *(aoffset2 + 1);
|
||||
ctemp07 = *(aoffset2 + 2);
|
||||
ctemp08 = *(aoffset2 + 3);
|
||||
|
||||
*(boffset + 0) = ctemp01;
|
||||
*(boffset + 1) = ctemp02;
|
||||
*(boffset + 2) = ctemp03;
|
||||
*(boffset + 3) = ctemp04;
|
||||
*(boffset + 4) = ctemp05;
|
||||
*(boffset + 5) = ctemp06;
|
||||
*(boffset + 6) = ctemp07;
|
||||
*(boffset + 7) = ctemp08;
|
||||
|
||||
aoffset1 += 2 * lda;
|
||||
aoffset2 += 2 * lda;
|
||||
boffset += 8;
|
||||
|
||||
i --;
|
||||
}while(i > 0);
|
||||
}
|
||||
|
||||
if (m & 1){
|
||||
ctemp01 = *(aoffset1 + 0);
|
||||
ctemp02 = *(aoffset1 + 1);
|
||||
ctemp03 = *(aoffset1 + 2);
|
||||
ctemp04 = *(aoffset1 + 3);
|
||||
|
||||
*(boffset + 0) = ctemp01;
|
||||
*(boffset + 1) = ctemp02;
|
||||
*(boffset + 2) = ctemp03;
|
||||
*(boffset + 3) = ctemp04;
|
||||
|
||||
boffset += 4;
|
||||
}
|
||||
}
|
||||
|
||||
if (n & 2){
|
||||
aoffset1 = aoffset;
|
||||
aoffset2 = aoffset + lda;
|
||||
aoffset += 2;
|
||||
|
||||
i = (m >> 1);
|
||||
if (i > 0){
|
||||
do{
|
||||
ctemp01 = *(aoffset1 + 0);
|
||||
ctemp02 = *(aoffset1 + 1);
|
||||
ctemp03 = *(aoffset2 + 0);
|
||||
ctemp04 = *(aoffset2 + 1);
|
||||
|
||||
*(boffset + 0) = ctemp01;
|
||||
*(boffset + 1) = ctemp02;
|
||||
*(boffset + 2) = ctemp03;
|
||||
*(boffset + 3) = ctemp04;
|
||||
|
||||
aoffset1 += 2 * lda;
|
||||
aoffset2 += 2 * lda;
|
||||
boffset += 4;
|
||||
|
||||
i --;
|
||||
}while(i > 0);
|
||||
}
|
||||
|
||||
if (m & 1){
|
||||
ctemp01 = *(aoffset1 + 0);
|
||||
ctemp02 = *(aoffset1 + 1);
|
||||
|
||||
*(boffset + 0) = ctemp01;
|
||||
*(boffset + 1) = ctemp02;
|
||||
boffset += 2;
|
||||
}
|
||||
}
|
||||
|
||||
if (n & 1){
|
||||
aoffset1 = aoffset;
|
||||
aoffset2 = aoffset + lda;
|
||||
|
||||
i = (m >> 1);
|
||||
if (i > 0){
|
||||
do{
|
||||
ctemp01 = *(aoffset1 + 0);
|
||||
ctemp02 = *(aoffset2 + 0);
|
||||
|
||||
*(boffset + 0) = ctemp01;
|
||||
*(boffset + 1) = ctemp02;
|
||||
|
||||
aoffset1 += 2 * lda;
|
||||
aoffset2 += 2 * lda;
|
||||
boffset += 2;
|
||||
|
||||
i --;
|
||||
}while(i > 0);
|
||||
}
|
||||
|
||||
if (m & 1){
|
||||
ctemp01 = *(aoffset1 + 0);
|
||||
*(boffset + 0) = ctemp01;
|
||||
// boffset += 1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue