Fix failed sswap and dswap case by using msa optimization
The swap test case will call sswap_msa.c and dswap_msa.c files in MIPS environmnet. When inc_x or inc_y is equal to zero, the calculation result of the two functions will be wrong. This patch adds the processing of inc_x or inc_y equal to zero, and the swap test case has passed.
This commit is contained in:
parent
8fef5876d1
commit
47b639cc9b
|
@ -184,7 +184,7 @@ int CNAME(BLASLONG n, BLASLONG dummy0, BLASLONG dummy1, FLOAT dummy3,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else if ((inc_x != 0) && (inc_y != 0))
|
||||||
{
|
{
|
||||||
for (i = (n >> 3); i--;)
|
for (i = (n >> 3); i--;)
|
||||||
{
|
{
|
||||||
|
@ -248,6 +248,32 @@ int CNAME(BLASLONG n, BLASLONG dummy0, BLASLONG dummy1, FLOAT dummy3,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (inc_x == inc_y)
|
||||||
|
{
|
||||||
|
if (n & 1)
|
||||||
|
{
|
||||||
|
x0 = *srcx;
|
||||||
|
*srcx = *srcy;
|
||||||
|
*srcy = x0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
BLASLONG ix = 0, iy = 0;
|
||||||
|
while (i < n)
|
||||||
|
{
|
||||||
|
x0 = srcx[ix];
|
||||||
|
srcx[ix] = srcy[iy];
|
||||||
|
srcy[iy] = x0;
|
||||||
|
ix += inc_x;
|
||||||
|
iy += inc_y;
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -198,7 +198,7 @@ int CNAME(BLASLONG n, BLASLONG dummy0, BLASLONG dummy1, FLOAT dummy3,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else if ((inc_x != 0) && (inc_y != 0))
|
||||||
{
|
{
|
||||||
for (i = (n >> 3); i--;)
|
for (i = (n >> 3); i--;)
|
||||||
{
|
{
|
||||||
|
@ -262,6 +262,33 @@ int CNAME(BLASLONG n, BLASLONG dummy0, BLASLONG dummy1, FLOAT dummy3,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (inc_x == inc_y)
|
||||||
|
{
|
||||||
|
if (n & 1)
|
||||||
|
{
|
||||||
|
x0 = *srcx;
|
||||||
|
*srcx = *srcy;
|
||||||
|
*srcy = x0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
BLASLONG ix = 0, iy = 0;
|
||||||
|
while (i < n)
|
||||||
|
{
|
||||||
|
x0 = srcx[ix];
|
||||||
|
srcx[ix] = srcy[iy];
|
||||||
|
srcy[iy] = x0;
|
||||||
|
ix += inc_x;
|
||||||
|
iy += inc_y;
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue