Skip to content

Commit 7f11e33

Browse files
authored
Merge pull request #3025 from TiredNotTear/develop
MIPS: Fix two bugs
2 parents 7834c10 + ad38bd0 commit 7f11e33

File tree

6 files changed

+98
-21
lines changed

6 files changed

+98
-21
lines changed

kernel/mips/cgemv_n_msa.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,11 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
5656
#if !defined(XCONJ)
5757
#define OP0 +=
5858
#define OP1 -=
59-
#define OP2 -=
59+
#define OP2 +=
6060
#else
6161
#define OP0 -=
6262
#define OP1 -=
63-
#define OP2 +=
63+
#define OP2 -=
6464
#endif
6565
#endif
6666

kernel/mips/cgemv_t_msa.c

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,26 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3232
#undef OP1
3333
#undef OP2
3434

35-
#if ( !defined(CONJ) && !defined(XCONJ) ) || ( defined(CONJ) && defined(XCONJ) )
36-
#define OP0 -=
37-
#define OP1 +=
38-
#define OP2 +=
35+
#if !defined(CONJ)
36+
#if !defined(XCONJ)
37+
#define OP0 -=
38+
#define OP1 +=
39+
#define OP2 +=
40+
#else
41+
#define OP0 +=
42+
#define OP1 +=
43+
#define OP2 -=
44+
#endif
3945
#else
40-
#define OP0 +=
41-
#define OP1 +=
42-
#define OP2 -=
46+
#if !defined(XCONJ)
47+
#define OP0 +=
48+
#define OP1 -=
49+
#define OP2 +=
50+
#else
51+
#define OP0 -=
52+
#define OP1 -=
53+
#define OP2 -=
54+
#endif
4355
#endif
4456

4557
#define CGEMV_T_8x4() \

kernel/mips/dswap_msa.c

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ int CNAME(BLASLONG n, BLASLONG dummy0, BLASLONG dummy1, FLOAT dummy3,
184184
}
185185
}
186186
}
187-
else
187+
else if ((inc_x != 0) && (inc_y != 0))
188188
{
189189
for (i = (n >> 3); i--;)
190190
{
@@ -248,6 +248,32 @@ int CNAME(BLASLONG n, BLASLONG dummy0, BLASLONG dummy1, FLOAT dummy3,
248248
}
249249
}
250250
}
251-
251+
else
252+
{
253+
if (inc_x == inc_y)
254+
{
255+
if (n & 1)
256+
{
257+
x0 = *srcx;
258+
*srcx = *srcy;
259+
*srcy = x0;
260+
}
261+
else
262+
return (0);
263+
}
264+
else
265+
{
266+
BLASLONG ix = 0, iy = 0;
267+
while (i < n)
268+
{
269+
x0 = srcx[ix];
270+
srcx[ix] = srcy[iy];
271+
srcy[iy] = x0;
272+
ix += inc_x;
273+
iy += inc_y;
274+
i++;
275+
}
276+
}
277+
}
252278
return (0);
253279
}

kernel/mips/sswap_msa.c

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ int CNAME(BLASLONG n, BLASLONG dummy0, BLASLONG dummy1, FLOAT dummy3,
198198
}
199199
}
200200
}
201-
else
201+
else if ((inc_x != 0) && (inc_y != 0))
202202
{
203203
for (i = (n >> 3); i--;)
204204
{
@@ -262,6 +262,33 @@ int CNAME(BLASLONG n, BLASLONG dummy0, BLASLONG dummy1, FLOAT dummy3,
262262
}
263263
}
264264
}
265+
else
266+
{
267+
if (inc_x == inc_y)
268+
{
269+
if (n & 1)
270+
{
271+
x0 = *srcx;
272+
*srcx = *srcy;
273+
*srcy = x0;
274+
}
275+
else
276+
return (0);
277+
}
278+
else
279+
{
280+
BLASLONG ix = 0, iy = 0;
281+
while (i < n)
282+
{
283+
x0 = srcx[ix];
284+
srcx[ix] = srcy[iy];
285+
srcy[iy] = x0;
286+
ix += inc_x;
287+
iy += inc_y;
288+
i++;
289+
}
290+
}
291+
}
265292

266293
return (0);
267294
}

kernel/mips/zgemv_n_msa.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,11 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
5656
#if !defined(XCONJ)
5757
#define OP0 +=
5858
#define OP1 -=
59-
#define OP2 -=
59+
#define OP2 +=
6060
#else
6161
#define OP0 -=
6262
#define OP1 -=
63-
#define OP2 +=
63+
#define OP2 -=
6464
#endif
6565
#endif
6666

kernel/mips/zgemv_t_msa.c

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,26 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3434
#undef OP3
3535
#undef OP4
3636

37-
#if ( !defined(CONJ) && !defined(XCONJ) ) || ( defined(CONJ) && defined(XCONJ) )
38-
#define OP0 -=
39-
#define OP1 +=
40-
#define OP2 +=
37+
#if !defined(CONJ)
38+
#if !defined(XCONJ)
39+
#define OP0 -=
40+
#define OP1 +=
41+
#define OP2 +=
42+
#else
43+
#define OP0 +=
44+
#define OP1 +=
45+
#define OP2 -=
46+
#endif
4147
#else
42-
#define OP0 +=
43-
#define OP1 +=
44-
#define OP2 -=
48+
#if !defined(XCONJ)
49+
#define OP0 +=
50+
#define OP1 -=
51+
#define OP2 +=
52+
#else
53+
#define OP0 -=
54+
#define OP1 -=
55+
#define OP2 -=
56+
#endif
4557
#endif
4658

4759
#define ZGEMV_T_8x1() \

0 commit comments

Comments
 (0)