Skip to content

Commit

Permalink
Merge pull request OpenMathLib#4643 from XiWeiGu/mips64_bug_fix
Browse files Browse the repository at this point in the history
mips64: Fixed MSA optimization bugs for zgemv and cgemv
  • Loading branch information
martin-frbg authored Apr 15, 2024
2 parents 4c03ed4 + 9c39e96 commit 91a24b8
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 62 deletions.
81 changes: 41 additions & 40 deletions kernel/mips/cgemv_t_msa.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,27 +31,28 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#undef OP0
#undef OP1
#undef OP2
#undef OP3
#undef OP4
#undef OP5

#if (!defined(CONJ) && !defined(XCONJ)) || (defined(CONJ) && defined(XCONJ))
#define OP0 -=
#define OP1 +=
#define OP2 +=
#else
#define OP0 +=
#define OP1 +=
#define OP2 -=
#endif

#if !defined(CONJ)
#if !defined(XCONJ)
#define OP0 -=
#define OP1 +=
#define OP2 +=
#else
#define OP0 +=
#define OP1 +=
#define OP2 -=
#endif
#if !defined(XCONJ)
#define OP3 -=
#define OP4 +=
#define OP5 +=
#else
#if !defined(XCONJ)
#define OP0 +=
#define OP1 -=
#define OP2 +=
#else
#define OP0 -=
#define OP1 -=
#define OP2 -=
#endif
#define OP3 +=
#define OP4 -=
#define OP5 +=
#endif

#define CGEMV_T_8x4() \
Expand Down Expand Up @@ -268,22 +269,22 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
res3i = y[3 * inc_y2 + 1]; \
\
res0r += alphar * temp0r; \
res0r OP0 alphai * temp0i; \
res0r OP3 alphai * temp0i; \
res1r += alphar * temp1r; \
res1r OP0 alphai * temp1i; \
res1r OP3 alphai * temp1i; \
res2r += alphar * temp2r; \
res2r OP0 alphai * temp2i; \
res2r OP3 alphai * temp2i; \
res3r += alphar * temp3r; \
res3r OP0 alphai * temp3i; \
res3r OP3 alphai * temp3i; \
\
res0i OP1 alphar * temp0i; \
res0i OP2 alphai * temp0r; \
res1i OP1 alphar * temp1i; \
res1i OP2 alphai * temp1r; \
res2i OP1 alphar * temp2i; \
res2i OP2 alphai * temp2r; \
res3i OP1 alphar * temp3i; \
res3i OP2 alphai * temp3r; \
res0i OP4 alphar * temp0i; \
res0i OP5 alphai * temp0r; \
res1i OP4 alphar * temp1i; \
res1i OP5 alphai * temp1r; \
res2i OP4 alphar * temp2i; \
res2i OP5 alphai * temp2r; \
res3i OP4 alphar * temp3i; \
res3i OP5 alphai * temp3r; \
\
y[0 * inc_y2] = res0r; \
y[1 * inc_y2] = res1r; \
Expand All @@ -303,14 +304,14 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
res1i = y[1 * inc_y2 + 1]; \
\
res0r += alphar * temp0r; \
res0r OP0 alphai * temp0i; \
res0r OP3 alphai * temp0i; \
res1r += alphar * temp1r; \
res1r OP0 alphai * temp1i; \
res1r OP3 alphai * temp1i; \
\
res0i OP1 alphar * temp0i; \
res0i OP2 alphai * temp0r; \
res1i OP1 alphar * temp1i; \
res1i OP2 alphai * temp1r; \
res0i OP4 alphar * temp0i; \
res0i OP5 alphai * temp0r; \
res1i OP4 alphar * temp1i; \
res1i OP5 alphai * temp1r; \
\
y[0 * inc_y2] = res0r; \
y[1 * inc_y2] = res1r; \
Expand All @@ -324,10 +325,10 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
res0i = y[0 * inc_y2 + 1]; \
\
res0r += alphar * temp0r; \
res0r OP0 alphai * temp0i; \
res0r OP3 alphai * temp0i; \
\
res0i OP1 alphar * temp0i; \
res0i OP2 alphai * temp0r; \
res0i OP4 alphar * temp0i; \
res0i OP5 alphai * temp0r; \
\
y[0 * inc_y2] = res0r; \
y[0 * inc_y2 + 1] = res0i; \
Expand Down
43 changes: 21 additions & 22 deletions kernel/mips/zgemv_t_msa.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,27 +33,26 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#undef OP2
#undef OP3
#undef OP4
#undef OP5

#if !defined(CONJ)
#if !defined(XCONJ)
#define OP0 -=
#define OP1 +=
#define OP2 +=
#else
#define OP0 +=
#define OP1 +=
#define OP2 -=
#endif
#if (!defined(CONJ) && !defined(XCONJ)) || (defined(CONJ) && defined(XCONJ))
#define OP0 -=
#define OP1 +=
#define OP2 +=
#else
#if !defined(XCONJ)
#define OP0 +=
#define OP1 -=
#define OP2 +=
#else
#define OP0 -=
#define OP1 -=
#define OP2 -=
#endif
#define OP0 +=
#define OP1 +=
#define OP2 -=
#endif

#if !defined(XCONJ)
#define OP3 -=
#define OP4 +=
#define OP5 +=
#else
#define OP3 +=
#define OP4 -=
#define OP5 +=
#endif

#define ZGEMV_T_8x1() \
Expand Down Expand Up @@ -124,10 +123,10 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
res0i = y[0 * inc_y2 + 1]; \
\
res0r += alphar * temp0r; \
res0r OP0 alphai * temp0i; \
res0r OP3 alphai * temp0i; \
\
res0i OP1 alphar * temp0i; \
res0i OP2 alphai * temp0r; \
res0i OP4 alphar * temp0i; \
res0i OP5 alphai * temp0r; \
\
y[0 * inc_y2] = res0r; \
y[0 * inc_y2 + 1] = res0i; \
Expand Down

0 comments on commit 91a24b8

Please sign in to comment.