* [Qemu-devel] [PATCH 0/2] target/mips: Improve performance for MSA binary operations
@ 2019-03-04 16:51 Mateja Marjanovic
2019-03-04 16:51 ` [Qemu-devel] [PATCH 1/2] " Mateja Marjanovic
2019-03-04 16:51 ` [Qemu-devel] [PATCH 2/2] target/mips: Tests for binary integer MSA instruction (add, adds, hadd...) Mateja Marjanovic
0 siblings, 2 replies; 10+ messages in thread
From: Mateja Marjanovic @ 2019-03-04 16:51 UTC (permalink / raw)
To: qemu-devel; +Cc: aurelien, amarkovic, arikalo
From: Mateja Marjanovic <Mateja.Marjanovic@rt-rk.com>
Eliminate loops for better performance.
Regression tests are also included.
Mateja Marjanovic (2):
target/mips: Improve performance for MSA binary operations
target/mips: Tests for binary integer MSA instruction (add, adds,
hadd...)
target/mips/msa_helper.c | 43 ++++--
.../mips/user/ase/msa/int-add/test_msa_add_a_b.c | 151 +++++++++++++++++++++
.../mips/user/ase/msa/int-add/test_msa_add_a_d.c | 151 +++++++++++++++++++++
.../mips/user/ase/msa/int-add/test_msa_add_a_h.c | 151 +++++++++++++++++++++
.../mips/user/ase/msa/int-add/test_msa_add_a_w.c | 151 +++++++++++++++++++++
.../mips/user/ase/msa/int-add/test_msa_adds_a_b.c | 151 +++++++++++++++++++++
.../mips/user/ase/msa/int-add/test_msa_adds_a_d.c | 151 +++++++++++++++++++++
.../mips/user/ase/msa/int-add/test_msa_adds_a_h.c | 151 +++++++++++++++++++++
.../mips/user/ase/msa/int-add/test_msa_adds_a_w.c | 151 +++++++++++++++++++++
.../mips/user/ase/msa/int-add/test_msa_adds_s_b.c | 151 +++++++++++++++++++++
.../mips/user/ase/msa/int-add/test_msa_adds_s_d.c | 151 +++++++++++++++++++++
.../mips/user/ase/msa/int-add/test_msa_adds_s_h.c | 151 +++++++++++++++++++++
.../mips/user/ase/msa/int-add/test_msa_adds_s_w.c | 151 +++++++++++++++++++++
.../mips/user/ase/msa/int-add/test_msa_adds_u_b.c | 151 +++++++++++++++++++++
.../mips/user/ase/msa/int-add/test_msa_adds_u_d.c | 151 +++++++++++++++++++++
.../mips/user/ase/msa/int-add/test_msa_adds_u_h.c | 151 +++++++++++++++++++++
.../mips/user/ase/msa/int-add/test_msa_adds_u_w.c | 151 +++++++++++++++++++++
.../mips/user/ase/msa/int-add/test_msa_addv_b.c | 151 +++++++++++++++++++++
.../mips/user/ase/msa/int-add/test_msa_addv_d.c | 151 +++++++++++++++++++++
.../mips/user/ase/msa/int-add/test_msa_addv_h.c | 151 +++++++++++++++++++++
.../mips/user/ase/msa/int-add/test_msa_addv_w.c | 151 +++++++++++++++++++++
.../mips/user/ase/msa/int-add/test_msa_hadd_s_d.c | 151 +++++++++++++++++++++
.../mips/user/ase/msa/int-add/test_msa_hadd_s_h.c | 151 +++++++++++++++++++++
.../mips/user/ase/msa/int-add/test_msa_hadd_s_w.c | 151 +++++++++++++++++++++
.../mips/user/ase/msa/int-add/test_msa_hadd_u_d.c | 151 +++++++++++++++++++++
.../mips/user/ase/msa/int-add/test_msa_hadd_u_h.c | 151 +++++++++++++++++++++
.../mips/user/ase/msa/int-add/test_msa_hadd_u_w.c | 151 +++++++++++++++++++++
27 files changed, 3956 insertions(+), 13 deletions(-)
create mode 100644 tests/tcg/mips/user/ase/msa/int-add/test_msa_add_a_b.c
create mode 100644 tests/tcg/mips/user/ase/msa/int-add/test_msa_add_a_d.c
create mode 100644 tests/tcg/mips/user/ase/msa/int-add/test_msa_add_a_h.c
create mode 100644 tests/tcg/mips/user/ase/msa/int-add/test_msa_add_a_w.c
create mode 100644 tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_a_b.c
create mode 100644 tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_a_d.c
create mode 100644 tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_a_h.c
create mode 100644 tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_a_w.c
create mode 100644 tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_s_b.c
create mode 100644 tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_s_d.c
create mode 100644 tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_s_h.c
create mode 100644 tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_s_w.c
create mode 100644 tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_u_b.c
create mode 100644 tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_u_d.c
create mode 100644 tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_u_h.c
create mode 100644 tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_u_w.c
create mode 100644 tests/tcg/mips/user/ase/msa/int-add/test_msa_addv_b.c
create mode 100644 tests/tcg/mips/user/ase/msa/int-add/test_msa_addv_d.c
create mode 100644 tests/tcg/mips/user/ase/msa/int-add/test_msa_addv_h.c
create mode 100644 tests/tcg/mips/user/ase/msa/int-add/test_msa_addv_w.c
create mode 100644 tests/tcg/mips/user/ase/msa/int-add/test_msa_hadd_s_d.c
create mode 100644 tests/tcg/mips/user/ase/msa/int-add/test_msa_hadd_s_h.c
create mode 100644 tests/tcg/mips/user/ase/msa/int-add/test_msa_hadd_s_w.c
create mode 100644 tests/tcg/mips/user/ase/msa/int-add/test_msa_hadd_u_d.c
create mode 100644 tests/tcg/mips/user/ase/msa/int-add/test_msa_hadd_u_h.c
create mode 100644 tests/tcg/mips/user/ase/msa/int-add/test_msa_hadd_u_w.c
--
2.7.4
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Qemu-devel] [PATCH 1/2] target/mips: Improve performance for MSA binary operations
2019-03-04 16:51 [Qemu-devel] [PATCH 0/2] target/mips: Improve performance for MSA binary operations Mateja Marjanovic
@ 2019-03-04 16:51 ` Mateja Marjanovic
2019-06-01 14:16 ` Aleksandar Markovic
2019-06-02 13:22 ` Alex Bennée
2019-03-04 16:51 ` [Qemu-devel] [PATCH 2/2] target/mips: Tests for binary integer MSA instruction (add, adds, hadd...) Mateja Marjanovic
1 sibling, 2 replies; 10+ messages in thread
From: Mateja Marjanovic @ 2019-03-04 16:51 UTC (permalink / raw)
To: qemu-devel; +Cc: aurelien, amarkovic, arikalo
From: Mateja Marjanovic <Mateja.Marjanovic@rt-rk.com>
Eliminate loops for better performance.
Signed-off-by: Mateja Marjanovic <mateja.marjanovic@rt-rk.com>
---
target/mips/msa_helper.c | 43 ++++++++++++++++++++++++++++++-------------
1 file changed, 30 insertions(+), 13 deletions(-)
diff --git a/target/mips/msa_helper.c b/target/mips/msa_helper.c
index 4c7ec05..1152fda 100644
--- a/target/mips/msa_helper.c
+++ b/target/mips/msa_helper.c
@@ -804,28 +804,45 @@ void helper_msa_ ## func ## _df(CPUMIPSState *env, uint32_t df, \
wr_t *pwd = &(env->active_fpu.fpr[wd].wr); \
wr_t *pws = &(env->active_fpu.fpr[ws].wr); \
wr_t *pwt = &(env->active_fpu.fpr[wt].wr); \
- uint32_t i; \
\
switch (df) { \
case DF_BYTE: \
- for (i = 0; i < DF_ELEMENTS(DF_BYTE); i++) { \
- pwd->b[i] = msa_ ## func ## _df(df, pws->b[i], pwt->b[i]); \
- } \
+ pwd->b[0] = msa_ ## func ## _df(df, pws->b[0], pwt->b[0]); \
+ pwd->b[1] = msa_ ## func ## _df(df, pws->b[1], pwt->b[1]); \
+ pwd->b[2] = msa_ ## func ## _df(df, pws->b[2], pwt->b[2]); \
+ pwd->b[3] = msa_ ## func ## _df(df, pws->b[3], pwt->b[3]); \
+ pwd->b[4] = msa_ ## func ## _df(df, pws->b[4], pwt->b[4]); \
+ pwd->b[5] = msa_ ## func ## _df(df, pws->b[5], pwt->b[5]); \
+ pwd->b[6] = msa_ ## func ## _df(df, pws->b[6], pwt->b[6]); \
+ pwd->b[7] = msa_ ## func ## _df(df, pws->b[7], pwt->b[7]); \
+ pwd->b[8] = msa_ ## func ## _df(df, pws->b[8], pwt->b[8]); \
+ pwd->b[9] = msa_ ## func ## _df(df, pws->b[9], pwt->b[9]); \
+ pwd->b[10] = msa_ ## func ## _df(df, pws->b[10], pwt->b[10]); \
+ pwd->b[11] = msa_ ## func ## _df(df, pws->b[11], pwt->b[11]); \
+ pwd->b[12] = msa_ ## func ## _df(df, pws->b[12], pwt->b[12]); \
+ pwd->b[13] = msa_ ## func ## _df(df, pws->b[13], pwt->b[13]); \
+ pwd->b[14] = msa_ ## func ## _df(df, pws->b[14], pwt->b[14]); \
+ pwd->b[15] = msa_ ## func ## _df(df, pws->b[15], pwt->b[15]); \
break; \
case DF_HALF: \
- for (i = 0; i < DF_ELEMENTS(DF_HALF); i++) { \
- pwd->h[i] = msa_ ## func ## _df(df, pws->h[i], pwt->h[i]); \
- } \
+ pwd->h[0] = msa_ ## func ## _df(df, pws->h[0], pwt->h[0]); \
+ pwd->h[1] = msa_ ## func ## _df(df, pws->h[1], pwt->h[1]); \
+ pwd->h[2] = msa_ ## func ## _df(df, pws->h[2], pwt->h[2]); \
+ pwd->h[3] = msa_ ## func ## _df(df, pws->h[3], pwt->h[3]); \
+ pwd->h[4] = msa_ ## func ## _df(df, pws->h[4], pwt->h[4]); \
+ pwd->h[5] = msa_ ## func ## _df(df, pws->h[5], pwt->h[5]); \
+ pwd->h[6] = msa_ ## func ## _df(df, pws->h[6], pwt->h[6]); \
+ pwd->h[7] = msa_ ## func ## _df(df, pws->h[7], pwt->h[7]); \
break; \
case DF_WORD: \
- for (i = 0; i < DF_ELEMENTS(DF_WORD); i++) { \
- pwd->w[i] = msa_ ## func ## _df(df, pws->w[i], pwt->w[i]); \
- } \
+ pwd->w[0] = msa_ ## func ## _df(df, pws->w[0], pwt->w[0]); \
+ pwd->w[1] = msa_ ## func ## _df(df, pws->w[1], pwt->w[1]); \
+ pwd->w[2] = msa_ ## func ## _df(df, pws->w[2], pwt->w[2]); \
+ pwd->w[3] = msa_ ## func ## _df(df, pws->w[3], pwt->w[3]); \
break; \
case DF_DOUBLE: \
- for (i = 0; i < DF_ELEMENTS(DF_DOUBLE); i++) { \
- pwd->d[i] = msa_ ## func ## _df(df, pws->d[i], pwt->d[i]); \
- } \
+ pwd->d[0] = msa_ ## func ## _df(df, pws->d[0], pwt->d[0]); \
+ pwd->d[1] = msa_ ## func ## _df(df, pws->d[1], pwt->d[1]); \
break; \
default: \
assert(0); \
--
2.7.4
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [Qemu-devel] [PATCH 2/2] target/mips: Tests for binary integer MSA instruction (add, adds, hadd...)
2019-03-04 16:51 [Qemu-devel] [PATCH 0/2] target/mips: Improve performance for MSA binary operations Mateja Marjanovic
2019-03-04 16:51 ` [Qemu-devel] [PATCH 1/2] " Mateja Marjanovic
@ 2019-03-04 16:51 ` Mateja Marjanovic
2019-03-04 18:43 ` Aleksandar Markovic
1 sibling, 1 reply; 10+ messages in thread
From: Mateja Marjanovic @ 2019-03-04 16:51 UTC (permalink / raw)
To: qemu-devel; +Cc: aurelien, amarkovic, arikalo
From: Mateja Marjanovic <Mateja.Marjanovic@rt-rk.com>
These are the regression tests for MSA binary operations.
Various flavors of instruction add.
Signed-off-by: Mateja Marjanovic <mateja.marjanovic@rt-rk.com>
---
.../mips/user/ase/msa/int-add/test_msa_add_a_b.c | 151 +++++++++++++++++++++
.../mips/user/ase/msa/int-add/test_msa_add_a_d.c | 151 +++++++++++++++++++++
.../mips/user/ase/msa/int-add/test_msa_add_a_h.c | 151 +++++++++++++++++++++
.../mips/user/ase/msa/int-add/test_msa_add_a_w.c | 151 +++++++++++++++++++++
.../mips/user/ase/msa/int-add/test_msa_adds_a_b.c | 151 +++++++++++++++++++++
.../mips/user/ase/msa/int-add/test_msa_adds_a_d.c | 151 +++++++++++++++++++++
.../mips/user/ase/msa/int-add/test_msa_adds_a_h.c | 151 +++++++++++++++++++++
.../mips/user/ase/msa/int-add/test_msa_adds_a_w.c | 151 +++++++++++++++++++++
.../mips/user/ase/msa/int-add/test_msa_adds_s_b.c | 151 +++++++++++++++++++++
.../mips/user/ase/msa/int-add/test_msa_adds_s_d.c | 151 +++++++++++++++++++++
.../mips/user/ase/msa/int-add/test_msa_adds_s_h.c | 151 +++++++++++++++++++++
.../mips/user/ase/msa/int-add/test_msa_adds_s_w.c | 151 +++++++++++++++++++++
.../mips/user/ase/msa/int-add/test_msa_adds_u_b.c | 151 +++++++++++++++++++++
.../mips/user/ase/msa/int-add/test_msa_adds_u_d.c | 151 +++++++++++++++++++++
.../mips/user/ase/msa/int-add/test_msa_adds_u_h.c | 151 +++++++++++++++++++++
.../mips/user/ase/msa/int-add/test_msa_adds_u_w.c | 151 +++++++++++++++++++++
.../mips/user/ase/msa/int-add/test_msa_addv_b.c | 151 +++++++++++++++++++++
.../mips/user/ase/msa/int-add/test_msa_addv_d.c | 151 +++++++++++++++++++++
.../mips/user/ase/msa/int-add/test_msa_addv_h.c | 151 +++++++++++++++++++++
.../mips/user/ase/msa/int-add/test_msa_addv_w.c | 151 +++++++++++++++++++++
.../mips/user/ase/msa/int-add/test_msa_hadd_s_d.c | 151 +++++++++++++++++++++
.../mips/user/ase/msa/int-add/test_msa_hadd_s_h.c | 151 +++++++++++++++++++++
.../mips/user/ase/msa/int-add/test_msa_hadd_s_w.c | 151 +++++++++++++++++++++
.../mips/user/ase/msa/int-add/test_msa_hadd_u_d.c | 151 +++++++++++++++++++++
.../mips/user/ase/msa/int-add/test_msa_hadd_u_h.c | 151 +++++++++++++++++++++
.../mips/user/ase/msa/int-add/test_msa_hadd_u_w.c | 151 +++++++++++++++++++++
26 files changed, 3926 insertions(+)
create mode 100644 tests/tcg/mips/user/ase/msa/int-add/test_msa_add_a_b.c
create mode 100644 tests/tcg/mips/user/ase/msa/int-add/test_msa_add_a_d.c
create mode 100644 tests/tcg/mips/user/ase/msa/int-add/test_msa_add_a_h.c
create mode 100644 tests/tcg/mips/user/ase/msa/int-add/test_msa_add_a_w.c
create mode 100644 tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_a_b.c
create mode 100644 tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_a_d.c
create mode 100644 tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_a_h.c
create mode 100644 tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_a_w.c
create mode 100644 tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_s_b.c
create mode 100644 tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_s_d.c
create mode 100644 tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_s_h.c
create mode 100644 tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_s_w.c
create mode 100644 tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_u_b.c
create mode 100644 tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_u_d.c
create mode 100644 tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_u_h.c
create mode 100644 tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_u_w.c
create mode 100644 tests/tcg/mips/user/ase/msa/int-add/test_msa_addv_b.c
create mode 100644 tests/tcg/mips/user/ase/msa/int-add/test_msa_addv_d.c
create mode 100644 tests/tcg/mips/user/ase/msa/int-add/test_msa_addv_h.c
create mode 100644 tests/tcg/mips/user/ase/msa/int-add/test_msa_addv_w.c
create mode 100644 tests/tcg/mips/user/ase/msa/int-add/test_msa_hadd_s_d.c
create mode 100644 tests/tcg/mips/user/ase/msa/int-add/test_msa_hadd_s_h.c
create mode 100644 tests/tcg/mips/user/ase/msa/int-add/test_msa_hadd_s_w.c
create mode 100644 tests/tcg/mips/user/ase/msa/int-add/test_msa_hadd_u_d.c
create mode 100644 tests/tcg/mips/user/ase/msa/int-add/test_msa_hadd_u_h.c
create mode 100644 tests/tcg/mips/user/ase/msa/int-add/test_msa_hadd_u_w.c
diff --git a/tests/tcg/mips/user/ase/msa/int-add/test_msa_add_a_b.c b/tests/tcg/mips/user/ase/msa/int-add/test_msa_add_a_b.c
new file mode 100644
index 0000000..325c28c
--- /dev/null
+++ b/tests/tcg/mips/user/ase/msa/int-add/test_msa_add_a_b.c
@@ -0,0 +1,151 @@
+/*
+ * Test program for MSA instruction ADD_A.B
+ *
+ * Copyright (C) 2018 Wave Computing, Inc.
+ * Copyright (C) 2018 Aleksandar Markovic <amarkovic@wavecomp.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
+#include <sys/time.h>
+#include <stdint.h>
+
+#include "../../../../include/wrappers_msa.h"
+#include "../../../../include/test_inputs.h"
+#include "../../../../include/test_utils.h"
+
+#define TEST_COUNT_TOTAL ( \
+ (PATTERN_INPUTS_SHORT_COUNT) * (PATTERN_INPUTS_SHORT_COUNT) + \
+ (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT))
+
+
+int32_t main(void)
+{
+ char *instruction_name = "ADD_A.B";
+ int32_t ret;
+ uint32_t i, j;
+ struct timeval start, end;
+ double elapsed_time;
+
+ uint64_t b128_result[TEST_COUNT_TOTAL][2];
+ uint64_t b128_expect[TEST_COUNT_TOTAL][2] = {
+ { 0x0202020202020202ULL, 0x0202020202020202ULL, }, /* 0 */
+ { 0x0101010101010101ULL, 0x0101010101010101ULL, },
+ { 0x5757575757575757ULL, 0x5757575757575757ULL, },
+ { 0x5656565656565656ULL, 0x5656565656565656ULL, },
+ { 0x3535353535353535ULL, 0x3535353535353535ULL, },
+ { 0x3434343434343434ULL, 0x3434343434343434ULL, },
+ { 0x1e73391e73391e73ULL, 0x391e73391e73391eULL, },
+ { 0x1d723a1d723a1d72ULL, 0x3a1d723a1d723a1dULL, },
+ { 0x0101010101010101ULL, 0x0101010101010101ULL, }, /* 8 */
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0x5656565656565656ULL, 0x5656565656565656ULL, },
+ { 0x5555555555555555ULL, 0x5555555555555555ULL, },
+ { 0x3434343434343434ULL, 0x3434343434343434ULL, },
+ { 0x3333333333333333ULL, 0x3333333333333333ULL, },
+ { 0x1d72381d72381d72ULL, 0x381d72381d72381dULL, },
+ { 0x1c71391c71391c71ULL, 0x391c71391c71391cULL, },
+ { 0x5757575757575757ULL, 0x5757575757575757ULL, }, /* 16 */
+ { 0x5656565656565656ULL, 0x5656565656565656ULL, },
+ { 0xacacacacacacacacULL, 0xacacacacacacacacULL, },
+ { 0xababababababababULL, 0xababababababababULL, },
+ { 0x8a8a8a8a8a8a8a8aULL, 0x8a8a8a8a8a8a8a8aULL, },
+ { 0x8989898989898989ULL, 0x8989898989898989ULL, },
+ { 0x73c88e73c88e73c8ULL, 0x8e73c88e73c88e73ULL, },
+ { 0x72c78f72c78f72c7ULL, 0x8f72c78f72c78f72ULL, },
+ { 0x5656565656565656ULL, 0x5656565656565656ULL, }, /* 24 */
+ { 0x5555555555555555ULL, 0x5555555555555555ULL, },
+ { 0xababababababababULL, 0xababababababababULL, },
+ { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, },
+ { 0x8989898989898989ULL, 0x8989898989898989ULL, },
+ { 0x8888888888888888ULL, 0x8888888888888888ULL, },
+ { 0x72c78d72c78d72c7ULL, 0x8d72c78d72c78d72ULL, },
+ { 0x71c68e71c68e71c6ULL, 0x8e71c68e71c68e71ULL, },
+ { 0x3535353535353535ULL, 0x3535353535353535ULL, }, /* 32 */
+ { 0x3434343434343434ULL, 0x3434343434343434ULL, },
+ { 0x8a8a8a8a8a8a8a8aULL, 0x8a8a8a8a8a8a8a8aULL, },
+ { 0x8989898989898989ULL, 0x8989898989898989ULL, },
+ { 0x6868686868686868ULL, 0x6868686868686868ULL, },
+ { 0x6767676767676767ULL, 0x6767676767676767ULL, },
+ { 0x51a66c51a66c51a6ULL, 0x6c51a66c51a66c51ULL, },
+ { 0x50a56d50a56d50a5ULL, 0x6d50a56d50a56d50ULL, },
+ { 0x3434343434343434ULL, 0x3434343434343434ULL, }, /* 40 */
+ { 0x3333333333333333ULL, 0x3333333333333333ULL, },
+ { 0x8989898989898989ULL, 0x8989898989898989ULL, },
+ { 0x8888888888888888ULL, 0x8888888888888888ULL, },
+ { 0x6767676767676767ULL, 0x6767676767676767ULL, },
+ { 0x6666666666666666ULL, 0x6666666666666666ULL, },
+ { 0x50a56b50a56b50a5ULL, 0x6b50a56b50a56b50ULL, },
+ { 0x4fa46c4fa46c4fa4ULL, 0x6c4fa46c4fa46c4fULL, },
+ { 0x1e73391e73391e73ULL, 0x391e73391e73391eULL, }, /* 48 */
+ { 0x1d72381d72381d72ULL, 0x381d72381d72381dULL, },
+ { 0x73c88e73c88e73c8ULL, 0x8e73c88e73c88e73ULL, },
+ { 0x72c78d72c78d72c7ULL, 0x8d72c78d72c78d72ULL, },
+ { 0x51a66c51a66c51a6ULL, 0x6c51a66c51a66c51ULL, },
+ { 0x50a56b50a56b50a5ULL, 0x6b50a56b50a56b50ULL, },
+ { 0x3ae4703ae4703ae4ULL, 0x703ae4703ae4703aULL, },
+ { 0x39e37139e37139e3ULL, 0x7139e37139e37139ULL, },
+ { 0x1d723a1d723a1d72ULL, 0x3a1d723a1d723a1dULL, }, /* 56 */
+ { 0x1c71391c71391c71ULL, 0x391c71391c71391cULL, },
+ { 0x72c78f72c78f72c7ULL, 0x8f72c78f72c78f72ULL, },
+ { 0x71c68e71c68e71c6ULL, 0x8e71c68e71c68e71ULL, },
+ { 0x50a56d50a56d50a5ULL, 0x6d50a56d50a56d50ULL, },
+ { 0x4fa46c4fa46c4fa4ULL, 0x6c4fa46c4fa46c4fULL, },
+ { 0x39e37139e37139e3ULL, 0x7139e37139e37139ULL, },
+ { 0x38e27238e27238e2ULL, 0x7238e27238e27238ULL, },
+ { 0xf0d4346850c4aa80ULL, 0x96ce16bc04f6a018ULL, }, /* 64 */
+ { 0x7dac1a9775cf8e48ULL, 0x5d70507817baa210ULL, },
+ { 0xccc46c8a6f93cac0ULL, 0x728f455f57a67520ULL, },
+ { 0xe8b930818693738eULL, 0xbe76838659bd6e6cULL, },
+ { 0x7dac1a9775cf8e48ULL, 0x5d70507817baa210ULL, },
+ { 0x0a8400c69ada7210ULL, 0x24128a342a7ea408ULL, },
+ { 0x599c52b9949eae88ULL, 0x39317f1b6a6a7718ULL, },
+ { 0x759116b0ab9e5756ULL, 0x8518bd426c817064ULL, },
+ { 0xccc46c8a6f93cac0ULL, 0x728f455f57a67520ULL, }, /* 72 */
+ { 0x599c52b9949eae88ULL, 0x39317f1b6a6a7718ULL, },
+ { 0xa8b4a4ac8e62ea00ULL, 0x4e507402aa564a28ULL, },
+ { 0xc4a968a3a56293ceULL, 0x9a37b229ac6d4374ULL, },
+ { 0xe8b930818693738eULL, 0xbe76838659bd6e6cULL, },
+ { 0x759116b0ab9e5756ULL, 0x8518bd426c817064ULL, },
+};
+
+ gettimeofday(&start, NULL);
+
+ for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) {
+ do_msa_ADD_A_B(b128_pattern[i], b128_pattern[j],
+ b128_result[PATTERN_INPUTS_SHORT_COUNT * i + j]);
+ }
+ }
+
+ for (i = 0; i < RANDOM_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < RANDOM_INPUTS_SHORT_COUNT; j++) {
+ do_msa_ADD_A_B(b128_random[i], b128_random[j],
+ b128_result[((PATTERN_INPUTS_SHORT_COUNT) *
+ (PATTERN_INPUTS_SHORT_COUNT)) +
+ RANDOM_INPUTS_SHORT_COUNT * i + j]);
+ }
+ }
+
+ gettimeofday(&end, NULL);
+
+ elapsed_time = (end.tv_sec - start.tv_sec) * 1000.0;
+ elapsed_time += (end.tv_usec - start.tv_usec) / 1000.0;
+
+ ret = check_results(instruction_name, TEST_COUNT_TOTAL, elapsed_time,
+ &b128_result[0][0], &b128_expect[0][0]);
+
+ return ret;
+}
diff --git a/tests/tcg/mips/user/ase/msa/int-add/test_msa_add_a_d.c b/tests/tcg/mips/user/ase/msa/int-add/test_msa_add_a_d.c
new file mode 100644
index 0000000..7ca73f2
--- /dev/null
+++ b/tests/tcg/mips/user/ase/msa/int-add/test_msa_add_a_d.c
@@ -0,0 +1,151 @@
+/*
+ * Test program for MSA instruction ADD_A.D
+ *
+ * Copyright (C) 2018 Wave Computing, Inc.
+ * Copyright (C) 2018 Aleksandar Markovic <amarkovic@wavecomp.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
+#include <sys/time.h>
+#include <stdint.h>
+
+#include "../../../../include/wrappers_msa.h"
+#include "../../../../include/test_inputs.h"
+#include "../../../../include/test_utils.h"
+
+#define TEST_COUNT_TOTAL ( \
+ (PATTERN_INPUTS_SHORT_COUNT) * (PATTERN_INPUTS_SHORT_COUNT) + \
+ (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT))
+
+
+int32_t main(void)
+{
+ char *instruction_name = "ADD_A.D";
+ int32_t ret;
+ uint32_t i, j;
+ struct timeval start, end;
+ double elapsed_time;
+
+ uint64_t b128_result[TEST_COUNT_TOTAL][2];
+ uint64_t b128_expect[TEST_COUNT_TOTAL][2] = {
+ { 0x0000000000000002ULL, 0x0000000000000002ULL, }, /* 0 */
+ { 0x0000000000000001ULL, 0x0000000000000001ULL, },
+ { 0x5555555555555557ULL, 0x5555555555555557ULL, },
+ { 0x5555555555555556ULL, 0x5555555555555556ULL, },
+ { 0x3333333333333335ULL, 0x3333333333333335ULL, },
+ { 0x3333333333333334ULL, 0x3333333333333334ULL, },
+ { 0x1c71c71c71c71c73ULL, 0x38e38e38e38e38e4ULL, },
+ { 0x1c71c71c71c71c72ULL, 0x38e38e38e38e38e5ULL, },
+ { 0x0000000000000001ULL, 0x0000000000000001ULL, }, /* 8 */
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0x5555555555555556ULL, 0x5555555555555556ULL, },
+ { 0x5555555555555555ULL, 0x5555555555555555ULL, },
+ { 0x3333333333333334ULL, 0x3333333333333334ULL, },
+ { 0x3333333333333333ULL, 0x3333333333333333ULL, },
+ { 0x1c71c71c71c71c72ULL, 0x38e38e38e38e38e3ULL, },
+ { 0x1c71c71c71c71c71ULL, 0x38e38e38e38e38e4ULL, },
+ { 0x5555555555555557ULL, 0x5555555555555557ULL, }, /* 16 */
+ { 0x5555555555555556ULL, 0x5555555555555556ULL, },
+ { 0xaaaaaaaaaaaaaaacULL, 0xaaaaaaaaaaaaaaacULL, },
+ { 0xaaaaaaaaaaaaaaabULL, 0xaaaaaaaaaaaaaaabULL, },
+ { 0x888888888888888aULL, 0x888888888888888aULL, },
+ { 0x8888888888888889ULL, 0x8888888888888889ULL, },
+ { 0x71c71c71c71c71c8ULL, 0x8e38e38e38e38e39ULL, },
+ { 0x71c71c71c71c71c7ULL, 0x8e38e38e38e38e3aULL, },
+ { 0x5555555555555556ULL, 0x5555555555555556ULL, }, /* 24 */
+ { 0x5555555555555555ULL, 0x5555555555555555ULL, },
+ { 0xaaaaaaaaaaaaaaabULL, 0xaaaaaaaaaaaaaaabULL, },
+ { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, },
+ { 0x8888888888888889ULL, 0x8888888888888889ULL, },
+ { 0x8888888888888888ULL, 0x8888888888888888ULL, },
+ { 0x71c71c71c71c71c7ULL, 0x8e38e38e38e38e38ULL, },
+ { 0x71c71c71c71c71c6ULL, 0x8e38e38e38e38e39ULL, },
+ { 0x3333333333333335ULL, 0x3333333333333335ULL, }, /* 32 */
+ { 0x3333333333333334ULL, 0x3333333333333334ULL, },
+ { 0x888888888888888aULL, 0x888888888888888aULL, },
+ { 0x8888888888888889ULL, 0x8888888888888889ULL, },
+ { 0x6666666666666668ULL, 0x6666666666666668ULL, },
+ { 0x6666666666666667ULL, 0x6666666666666667ULL, },
+ { 0x4fa4fa4fa4fa4fa6ULL, 0x6c16c16c16c16c17ULL, },
+ { 0x4fa4fa4fa4fa4fa5ULL, 0x6c16c16c16c16c18ULL, },
+ { 0x3333333333333334ULL, 0x3333333333333334ULL, }, /* 40 */
+ { 0x3333333333333333ULL, 0x3333333333333333ULL, },
+ { 0x8888888888888889ULL, 0x8888888888888889ULL, },
+ { 0x8888888888888888ULL, 0x8888888888888888ULL, },
+ { 0x6666666666666667ULL, 0x6666666666666667ULL, },
+ { 0x6666666666666666ULL, 0x6666666666666666ULL, },
+ { 0x4fa4fa4fa4fa4fa5ULL, 0x6c16c16c16c16c16ULL, },
+ { 0x4fa4fa4fa4fa4fa4ULL, 0x6c16c16c16c16c17ULL, },
+ { 0x1c71c71c71c71c73ULL, 0x38e38e38e38e38e4ULL, }, /* 48 */
+ { 0x1c71c71c71c71c72ULL, 0x38e38e38e38e38e3ULL, },
+ { 0x71c71c71c71c71c8ULL, 0x8e38e38e38e38e39ULL, },
+ { 0x71c71c71c71c71c7ULL, 0x8e38e38e38e38e38ULL, },
+ { 0x4fa4fa4fa4fa4fa6ULL, 0x6c16c16c16c16c17ULL, },
+ { 0x4fa4fa4fa4fa4fa5ULL, 0x6c16c16c16c16c16ULL, },
+ { 0x38e38e38e38e38e4ULL, 0x71c71c71c71c71c6ULL, },
+ { 0x38e38e38e38e38e3ULL, 0x71c71c71c71c71c7ULL, },
+ { 0x1c71c71c71c71c72ULL, 0x38e38e38e38e38e5ULL, }, /* 56 */
+ { 0x1c71c71c71c71c71ULL, 0x38e38e38e38e38e4ULL, },
+ { 0x71c71c71c71c71c7ULL, 0x8e38e38e38e38e3aULL, },
+ { 0x71c71c71c71c71c6ULL, 0x8e38e38e38e38e39ULL, },
+ { 0x4fa4fa4fa4fa4fa5ULL, 0x6c16c16c16c16c18ULL, },
+ { 0x4fa4fa4fa4fa4fa4ULL, 0x6c16c16c16c16c17ULL, },
+ { 0x38e38e38e38e38e3ULL, 0x71c71c71c71c71c7ULL, },
+ { 0x38e38e38e38e38e2ULL, 0x71c71c71c71c71c8ULL, },
+ { 0xef2a3267af3b5580ULL, 0x96ce16bdfcf76018ULL, }, /* 64 */
+ { 0x7bd718d08a09e3b8ULL, 0x5e5ec67913bb0308ULL, },
+ { 0xcb3a6a891dce1f40ULL, 0x733fd25ea9a6d520ULL, },
+ { 0xe7e42f8135cf8d0eULL, 0xbd7582865538cd6cULL, },
+ { 0x7bd718d08a09e3b8ULL, 0x5e5ec67913bb0308ULL, },
+ { 0x0883ff3964d871f0ULL, 0x25ef76342a7ea5f8ULL, },
+ { 0x57e750f1f89cad78ULL, 0x3ad08219c06a7810ULL, },
+ { 0x749115ea109e1b46ULL, 0x850632416bfc705cULL, },
+ { 0xcb3a6a891dce1f40ULL, 0x733fd25ea9a6d520ULL, }, /* 72 */
+ { 0x57e750f1f89cad78ULL, 0x3ad08219c06a7810ULL, },
+ { 0xa74aa2aa8c60e900ULL, 0x4fb18dff56564a28ULL, },
+ { 0xc3f467a2a46256ceULL, 0x99e73e2701e84274ULL, },
+ { 0xe7e42f8135cf8d0eULL, 0xbd7582865538cd6cULL, },
+ { 0x749115ea109e1b46ULL, 0x850632416bfc705cULL, },
+};
+
+ gettimeofday(&start, NULL);
+
+ for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) {
+ do_msa_ADD_A_D(b128_pattern[i], b128_pattern[j],
+ b128_result[PATTERN_INPUTS_SHORT_COUNT * i + j]);
+ }
+ }
+
+ for (i = 0; i < RANDOM_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < RANDOM_INPUTS_SHORT_COUNT; j++) {
+ do_msa_ADD_A_D(b128_random[i], b128_random[j],
+ b128_result[((PATTERN_INPUTS_SHORT_COUNT) *
+ (PATTERN_INPUTS_SHORT_COUNT)) +
+ RANDOM_INPUTS_SHORT_COUNT * i + j]);
+ }
+ }
+
+ gettimeofday(&end, NULL);
+
+ elapsed_time = (end.tv_sec - start.tv_sec) * 1000.0;
+ elapsed_time += (end.tv_usec - start.tv_usec) / 1000.0;
+
+ ret = check_results(instruction_name, TEST_COUNT_TOTAL, elapsed_time,
+ &b128_result[0][0], &b128_expect[0][0]);
+
+ return ret;
+}
diff --git a/tests/tcg/mips/user/ase/msa/int-add/test_msa_add_a_h.c b/tests/tcg/mips/user/ase/msa/int-add/test_msa_add_a_h.c
new file mode 100644
index 0000000..e35483c
--- /dev/null
+++ b/tests/tcg/mips/user/ase/msa/int-add/test_msa_add_a_h.c
@@ -0,0 +1,151 @@
+/*
+ * Test program for MSA instruction ADD_A.H
+ *
+ * Copyright (C) 2018 Wave Computing, Inc.
+ * Copyright (C) 2018 Aleksandar Markovic <amarkovic@wavecomp.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
+#include <sys/time.h>
+#include <stdint.h>
+
+#include "../../../../include/wrappers_msa.h"
+#include "../../../../include/test_inputs.h"
+#include "../../../../include/test_utils.h"
+
+#define TEST_COUNT_TOTAL ( \
+ (PATTERN_INPUTS_SHORT_COUNT) * (PATTERN_INPUTS_SHORT_COUNT) + \
+ (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT))
+
+
+int32_t main(void)
+{
+ char *instruction_name = "ADD_A.H";
+ int32_t ret;
+ uint32_t i, j;
+ struct timeval start, end;
+ double elapsed_time;
+
+ uint64_t b128_result[TEST_COUNT_TOTAL][2];
+ uint64_t b128_expect[TEST_COUNT_TOTAL][2] = {
+ { 0x0002000200020002ULL, 0x0002000200020002ULL, }, /* 0 */
+ { 0x0001000100010001ULL, 0x0001000100010001ULL, },
+ { 0x5557555755575557ULL, 0x5557555755575557ULL, },
+ { 0x5556555655565556ULL, 0x5556555655565556ULL, },
+ { 0x3335333533353335ULL, 0x3335333533353335ULL, },
+ { 0x3334333433343334ULL, 0x3334333433343334ULL, },
+ { 0x1c7338e471c91c73ULL, 0x38e471c91c7338e4ULL, },
+ { 0x1c7238e571c81c72ULL, 0x38e571c81c7238e5ULL, },
+ { 0x0001000100010001ULL, 0x0001000100010001ULL, }, /* 8 */
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0x5556555655565556ULL, 0x5556555655565556ULL, },
+ { 0x5555555555555555ULL, 0x5555555555555555ULL, },
+ { 0x3334333433343334ULL, 0x3334333433343334ULL, },
+ { 0x3333333333333333ULL, 0x3333333333333333ULL, },
+ { 0x1c7238e371c81c72ULL, 0x38e371c81c7238e3ULL, },
+ { 0x1c7138e471c71c71ULL, 0x38e471c71c7138e4ULL, },
+ { 0x5557555755575557ULL, 0x5557555755575557ULL, }, /* 16 */
+ { 0x5556555655565556ULL, 0x5556555655565556ULL, },
+ { 0xaaacaaacaaacaaacULL, 0xaaacaaacaaacaaacULL, },
+ { 0xaaabaaabaaabaaabULL, 0xaaabaaabaaabaaabULL, },
+ { 0x888a888a888a888aULL, 0x888a888a888a888aULL, },
+ { 0x8889888988898889ULL, 0x8889888988898889ULL, },
+ { 0x71c88e39c71e71c8ULL, 0x8e39c71e71c88e39ULL, },
+ { 0x71c78e3ac71d71c7ULL, 0x8e3ac71d71c78e3aULL, },
+ { 0x5556555655565556ULL, 0x5556555655565556ULL, }, /* 24 */
+ { 0x5555555555555555ULL, 0x5555555555555555ULL, },
+ { 0xaaabaaabaaabaaabULL, 0xaaabaaabaaabaaabULL, },
+ { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, },
+ { 0x8889888988898889ULL, 0x8889888988898889ULL, },
+ { 0x8888888888888888ULL, 0x8888888888888888ULL, },
+ { 0x71c78e38c71d71c7ULL, 0x8e38c71d71c78e38ULL, },
+ { 0x71c68e39c71c71c6ULL, 0x8e39c71c71c68e39ULL, },
+ { 0x3335333533353335ULL, 0x3335333533353335ULL, }, /* 32 */
+ { 0x3334333433343334ULL, 0x3334333433343334ULL, },
+ { 0x888a888a888a888aULL, 0x888a888a888a888aULL, },
+ { 0x8889888988898889ULL, 0x8889888988898889ULL, },
+ { 0x6668666866686668ULL, 0x6668666866686668ULL, },
+ { 0x6667666766676667ULL, 0x6667666766676667ULL, },
+ { 0x4fa66c17a4fc4fa6ULL, 0x6c17a4fc4fa66c17ULL, },
+ { 0x4fa56c18a4fb4fa5ULL, 0x6c18a4fb4fa56c18ULL, },
+ { 0x3334333433343334ULL, 0x3334333433343334ULL, }, /* 40 */
+ { 0x3333333333333333ULL, 0x3333333333333333ULL, },
+ { 0x8889888988898889ULL, 0x8889888988898889ULL, },
+ { 0x8888888888888888ULL, 0x8888888888888888ULL, },
+ { 0x6667666766676667ULL, 0x6667666766676667ULL, },
+ { 0x6666666666666666ULL, 0x6666666666666666ULL, },
+ { 0x4fa56c16a4fb4fa5ULL, 0x6c16a4fb4fa56c16ULL, },
+ { 0x4fa46c17a4fa4fa4ULL, 0x6c17a4fa4fa46c17ULL, },
+ { 0x1c7338e471c91c73ULL, 0x38e471c91c7338e4ULL, }, /* 48 */
+ { 0x1c7238e371c81c72ULL, 0x38e371c81c7238e3ULL, },
+ { 0x71c88e39c71e71c8ULL, 0x8e39c71e71c88e39ULL, },
+ { 0x71c78e38c71d71c7ULL, 0x8e38c71d71c78e38ULL, },
+ { 0x4fa66c17a4fc4fa6ULL, 0x6c17a4fc4fa66c17ULL, },
+ { 0x4fa56c16a4fb4fa5ULL, 0x6c16a4fb4fa56c16ULL, },
+ { 0x38e471c6e39038e4ULL, 0x71c6e39038e471c6ULL, },
+ { 0x38e371c7e38f38e3ULL, 0x71c7e38f38e371c7ULL, },
+ { 0x1c7238e571c81c72ULL, 0x38e571c81c7238e5ULL, }, /* 56 */
+ { 0x1c7138e471c71c71ULL, 0x38e471c71c7138e4ULL, },
+ { 0x71c78e3ac71d71c7ULL, 0x8e3ac71d71c78e3aULL, },
+ { 0x71c68e39c71c71c6ULL, 0x8e39c71c71c68e39ULL, },
+ { 0x4fa56c18a4fb4fa5ULL, 0x6c18a4fb4fa56c18ULL, },
+ { 0x4fa46c17a4fa4fa4ULL, 0x6c17a4fa4fa46c17ULL, },
+ { 0x38e371c7e38f38e3ULL, 0x71c7e38f38e371c7ULL, },
+ { 0x38e271c8e38e38e2ULL, 0x71c8e38e38e271c8ULL, },
+ { 0xef2c326850c4aa80ULL, 0x96ce16bc030a9fe8ULL, }, /* 64 */
+ { 0x7bd8199775f58e38ULL, 0x5e5e504416c4a2f0ULL, },
+ { 0xcb3c6a8a6e93c9c0ULL, 0x733f445f565a7508ULL, },
+ { 0xe7e52f81869372f2ULL, 0xbd76828658436d54ULL, },
+ { 0x7bd8199775f58e38ULL, 0x5e5e504416c4a2f0ULL, },
+ { 0x088400c69b2671f0ULL, 0x25ee89cc2a7ea5f8ULL, },
+ { 0x57e851b993c4ad78ULL, 0x3acf7de76a147810ULL, },
+ { 0x749116b0abc456aaULL, 0x8506bc0e6bfd705cULL, },
+ { 0xcb3c6a8a6e93c9c0ULL, 0x733f445f565a7508ULL, }, /* 72 */
+ { 0x57e851b993c4ad78ULL, 0x3acf7de76a147810ULL, },
+ { 0xa74ca2ac8c62e900ULL, 0x4fb07202a9aa4a28ULL, },
+ { 0xc3f567a3a4629232ULL, 0x99e7b029ab934274ULL, },
+ { 0xe7e52f81869372f2ULL, 0xbd76828658436d54ULL, },
+ { 0x749116b0abc456aaULL, 0x8506bc0e6bfd705cULL, },
+};
+
+ gettimeofday(&start, NULL);
+
+ for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) {
+ do_msa_ADD_A_H(b128_pattern[i], b128_pattern[j],
+ b128_result[PATTERN_INPUTS_SHORT_COUNT * i + j]);
+ }
+ }
+
+ for (i = 0; i < RANDOM_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < RANDOM_INPUTS_SHORT_COUNT; j++) {
+ do_msa_ADD_A_H(b128_random[i], b128_random[j],
+ b128_result[((PATTERN_INPUTS_SHORT_COUNT) *
+ (PATTERN_INPUTS_SHORT_COUNT)) +
+ RANDOM_INPUTS_SHORT_COUNT * i + j]);
+ }
+ }
+
+ gettimeofday(&end, NULL);
+
+ elapsed_time = (end.tv_sec - start.tv_sec) * 1000.0;
+ elapsed_time += (end.tv_usec - start.tv_usec) / 1000.0;
+
+ ret = check_results(instruction_name, TEST_COUNT_TOTAL, elapsed_time,
+ &b128_result[0][0], &b128_expect[0][0]);
+
+ return ret;
+}
diff --git a/tests/tcg/mips/user/ase/msa/int-add/test_msa_add_a_w.c b/tests/tcg/mips/user/ase/msa/int-add/test_msa_add_a_w.c
new file mode 100644
index 0000000..040cadb
--- /dev/null
+++ b/tests/tcg/mips/user/ase/msa/int-add/test_msa_add_a_w.c
@@ -0,0 +1,151 @@
+/*
+ * Test program for MSA instruction ADD_A.W
+ *
+ * Copyright (C) 2018 Wave Computing, Inc.
+ * Copyright (C) 2018 Aleksandar Markovic <amarkovic@wavecomp.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
+#include <sys/time.h>
+#include <stdint.h>
+
+#include "../../../../include/wrappers_msa.h"
+#include "../../../../include/test_inputs.h"
+#include "../../../../include/test_utils.h"
+
+#define TEST_COUNT_TOTAL ( \
+ (PATTERN_INPUTS_SHORT_COUNT) * (PATTERN_INPUTS_SHORT_COUNT) + \
+ (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT))
+
+
+int32_t main(void)
+{
+ char *instruction_name = "ADD_A.W";
+ int32_t ret;
+ uint32_t i, j;
+ struct timeval start, end;
+ double elapsed_time;
+
+ uint64_t b128_result[TEST_COUNT_TOTAL][2];
+ uint64_t b128_expect[TEST_COUNT_TOTAL][2] = {
+ { 0x0000000200000002ULL, 0x0000000200000002ULL, }, /* 0 */
+ { 0x0000000100000001ULL, 0x0000000100000001ULL, },
+ { 0x5555555755555557ULL, 0x5555555755555557ULL, },
+ { 0x5555555655555556ULL, 0x5555555655555556ULL, },
+ { 0x3333333533333335ULL, 0x3333333533333335ULL, },
+ { 0x3333333433333334ULL, 0x3333333433333334ULL, },
+ { 0x1c71c71e71c71c73ULL, 0x38e38e391c71c71eULL, },
+ { 0x1c71c71d71c71c72ULL, 0x38e38e3a1c71c71dULL, },
+ { 0x0000000100000001ULL, 0x0000000100000001ULL, }, /* 8 */
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0x5555555655555556ULL, 0x5555555655555556ULL, },
+ { 0x5555555555555555ULL, 0x5555555555555555ULL, },
+ { 0x3333333433333334ULL, 0x3333333433333334ULL, },
+ { 0x3333333333333333ULL, 0x3333333333333333ULL, },
+ { 0x1c71c71d71c71c72ULL, 0x38e38e381c71c71dULL, },
+ { 0x1c71c71c71c71c71ULL, 0x38e38e391c71c71cULL, },
+ { 0x5555555755555557ULL, 0x5555555755555557ULL, }, /* 16 */
+ { 0x5555555655555556ULL, 0x5555555655555556ULL, },
+ { 0xaaaaaaacaaaaaaacULL, 0xaaaaaaacaaaaaaacULL, },
+ { 0xaaaaaaabaaaaaaabULL, 0xaaaaaaabaaaaaaabULL, },
+ { 0x8888888a8888888aULL, 0x8888888a8888888aULL, },
+ { 0x8888888988888889ULL, 0x8888888988888889ULL, },
+ { 0x71c71c73c71c71c8ULL, 0x8e38e38e71c71c73ULL, },
+ { 0x71c71c72c71c71c7ULL, 0x8e38e38f71c71c72ULL, },
+ { 0x5555555655555556ULL, 0x5555555655555556ULL, }, /* 24 */
+ { 0x5555555555555555ULL, 0x5555555555555555ULL, },
+ { 0xaaaaaaabaaaaaaabULL, 0xaaaaaaabaaaaaaabULL, },
+ { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, },
+ { 0x8888888988888889ULL, 0x8888888988888889ULL, },
+ { 0x8888888888888888ULL, 0x8888888888888888ULL, },
+ { 0x71c71c72c71c71c7ULL, 0x8e38e38d71c71c72ULL, },
+ { 0x71c71c71c71c71c6ULL, 0x8e38e38e71c71c71ULL, },
+ { 0x3333333533333335ULL, 0x3333333533333335ULL, }, /* 32 */
+ { 0x3333333433333334ULL, 0x3333333433333334ULL, },
+ { 0x8888888a8888888aULL, 0x8888888a8888888aULL, },
+ { 0x8888888988888889ULL, 0x8888888988888889ULL, },
+ { 0x6666666866666668ULL, 0x6666666866666668ULL, },
+ { 0x6666666766666667ULL, 0x6666666766666667ULL, },
+ { 0x4fa4fa51a4fa4fa6ULL, 0x6c16c16c4fa4fa51ULL, },
+ { 0x4fa4fa50a4fa4fa5ULL, 0x6c16c16d4fa4fa50ULL, },
+ { 0x3333333433333334ULL, 0x3333333433333334ULL, }, /* 40 */
+ { 0x3333333333333333ULL, 0x3333333333333333ULL, },
+ { 0x8888888988888889ULL, 0x8888888988888889ULL, },
+ { 0x8888888888888888ULL, 0x8888888888888888ULL, },
+ { 0x6666666766666667ULL, 0x6666666766666667ULL, },
+ { 0x6666666666666666ULL, 0x6666666666666666ULL, },
+ { 0x4fa4fa50a4fa4fa5ULL, 0x6c16c16b4fa4fa50ULL, },
+ { 0x4fa4fa4fa4fa4fa4ULL, 0x6c16c16c4fa4fa4fULL, },
+ { 0x1c71c71e71c71c73ULL, 0x38e38e391c71c71eULL, }, /* 48 */
+ { 0x1c71c71d71c71c72ULL, 0x38e38e381c71c71dULL, },
+ { 0x71c71c73c71c71c8ULL, 0x8e38e38e71c71c73ULL, },
+ { 0x71c71c72c71c71c7ULL, 0x8e38e38d71c71c72ULL, },
+ { 0x4fa4fa51a4fa4fa6ULL, 0x6c16c16c4fa4fa51ULL, },
+ { 0x4fa4fa50a4fa4fa5ULL, 0x6c16c16b4fa4fa50ULL, },
+ { 0x38e38e3ae38e38e4ULL, 0x71c71c7038e38e3aULL, },
+ { 0x38e38e39e38e38e3ULL, 0x71c71c7138e38e39ULL, },
+ { 0x1c71c71d71c71c72ULL, 0x38e38e3a1c71c71dULL, }, /* 56 */
+ { 0x1c71c71c71c71c71ULL, 0x38e38e391c71c71cULL, },
+ { 0x71c71c72c71c71c7ULL, 0x8e38e38f71c71c72ULL, },
+ { 0x71c71c71c71c71c6ULL, 0x8e38e38e71c71c71ULL, },
+ { 0x4fa4fa50a4fa4fa5ULL, 0x6c16c16d4fa4fa50ULL, },
+ { 0x4fa4fa4fa4fa4fa4ULL, 0x6c16c16c4fa4fa4fULL, },
+ { 0x38e38e39e38e38e3ULL, 0x71c71c7138e38e39ULL, },
+ { 0x38e38e38e38e38e2ULL, 0x71c71c7238e38e38ULL, },
+ { 0xef2a326850c4aa80ULL, 0x96ce16bc03089fe8ULL, }, /* 64 */
+ { 0x7bd718d175f61c48ULL, 0x5e5ec67816c3a2f0ULL, },
+ { 0xcb3a6a8a6e92c9c0ULL, 0x733fd25d56592ae0ULL, },
+ { 0xe7e42f818694378eULL, 0xbd75828658416d54ULL, },
+ { 0x7bd718d175f61c48ULL, 0x5e5ec67816c3a2f0ULL, },
+ { 0x0883ff3a9b278e10ULL, 0x25ef76342a7ea5f8ULL, },
+ { 0x57e750f393c43b88ULL, 0x3ad082196a142de8ULL, },
+ { 0x749115eaabc5a956ULL, 0x850632426bfc705cULL, },
+ { 0xcb3a6a8a6e92c9c0ULL, 0x733fd25d56592ae0ULL, }, /* 72 */
+ { 0x57e750f393c43b88ULL, 0x3ad082196a142de8ULL, },
+ { 0xa74aa2ac8c60e900ULL, 0x4fb18dfea9a9b5d8ULL, },
+ { 0xc3f467a3a46256ceULL, 0x99e73e27ab91f84cULL, },
+ { 0xe7e42f818694378eULL, 0xbd75828658416d54ULL, },
+ { 0x749115eaabc5a956ULL, 0x850632426bfc705cULL, },
+};
+
+ gettimeofday(&start, NULL);
+
+ for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) {
+ do_msa_ADD_A_W(b128_pattern[i], b128_pattern[j],
+ b128_result[PATTERN_INPUTS_SHORT_COUNT * i + j]);
+ }
+ }
+
+ for (i = 0; i < RANDOM_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < RANDOM_INPUTS_SHORT_COUNT; j++) {
+ do_msa_ADD_A_W(b128_random[i], b128_random[j],
+ b128_result[((PATTERN_INPUTS_SHORT_COUNT) *
+ (PATTERN_INPUTS_SHORT_COUNT)) +
+ RANDOM_INPUTS_SHORT_COUNT * i + j]);
+ }
+ }
+
+ gettimeofday(&end, NULL);
+
+ elapsed_time = (end.tv_sec - start.tv_sec) * 1000.0;
+ elapsed_time += (end.tv_usec - start.tv_usec) / 1000.0;
+
+ ret = check_results(instruction_name, TEST_COUNT_TOTAL, elapsed_time,
+ &b128_result[0][0], &b128_expect[0][0]);
+
+ return ret;
+}
diff --git a/tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_a_b.c b/tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_a_b.c
new file mode 100644
index 0000000..7f8a595
--- /dev/null
+++ b/tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_a_b.c
@@ -0,0 +1,151 @@
+/*
+ * Test program for MSA instruction ADDS_A.B
+ *
+ * Copyright (C) 2018 Wave Computing, Inc.
+ * Copyright (C) 2018 Aleksandar Markovic <amarkovic@wavecomp.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
+#include <sys/time.h>
+#include <stdint.h>
+
+#include "../../../../include/wrappers_msa.h"
+#include "../../../../include/test_inputs.h"
+#include "../../../../include/test_utils.h"
+
+#define TEST_COUNT_TOTAL ( \
+ (PATTERN_INPUTS_SHORT_COUNT) * (PATTERN_INPUTS_SHORT_COUNT) + \
+ (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT))
+
+
+int32_t main(void)
+{
+ char *instruction_name = "ADDS_A.B";
+ int32_t ret;
+ uint32_t i, j;
+ struct timeval start, end;
+ double elapsed_time;
+
+ uint64_t b128_result[TEST_COUNT_TOTAL][2];
+ uint64_t b128_expect[TEST_COUNT_TOTAL][2] = {
+ { 0x0202020202020202ULL, 0x0202020202020202ULL, }, /* 0 */
+ { 0x0101010101010101ULL, 0x0101010101010101ULL, },
+ { 0x5757575757575757ULL, 0x5757575757575757ULL, },
+ { 0x5656565656565656ULL, 0x5656565656565656ULL, },
+ { 0x3535353535353535ULL, 0x3535353535353535ULL, },
+ { 0x3434343434343434ULL, 0x3434343434343434ULL, },
+ { 0x1e73391e73391e73ULL, 0x391e73391e73391eULL, },
+ { 0x1d723a1d723a1d72ULL, 0x3a1d723a1d723a1dULL, },
+ { 0x0101010101010101ULL, 0x0101010101010101ULL, }, /* 8 */
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0x5656565656565656ULL, 0x5656565656565656ULL, },
+ { 0x5555555555555555ULL, 0x5555555555555555ULL, },
+ { 0x3434343434343434ULL, 0x3434343434343434ULL, },
+ { 0x3333333333333333ULL, 0x3333333333333333ULL, },
+ { 0x1d72381d72381d72ULL, 0x381d72381d72381dULL, },
+ { 0x1c71391c71391c71ULL, 0x391c71391c71391cULL, },
+ { 0x5757575757575757ULL, 0x5757575757575757ULL, }, /* 16 */
+ { 0x5656565656565656ULL, 0x5656565656565656ULL, },
+ { 0x7f7f7f7f7f7f7f7fULL, 0x7f7f7f7f7f7f7f7fULL, },
+ { 0x7f7f7f7f7f7f7f7fULL, 0x7f7f7f7f7f7f7f7fULL, },
+ { 0x7f7f7f7f7f7f7f7fULL, 0x7f7f7f7f7f7f7f7fULL, },
+ { 0x7f7f7f7f7f7f7f7fULL, 0x7f7f7f7f7f7f7f7fULL, },
+ { 0x737f7f737f7f737fULL, 0x7f737f7f737f7f73ULL, },
+ { 0x727f7f727f7f727fULL, 0x7f727f7f727f7f72ULL, },
+ { 0x5656565656565656ULL, 0x5656565656565656ULL, }, /* 24 */
+ { 0x5555555555555555ULL, 0x5555555555555555ULL, },
+ { 0x7f7f7f7f7f7f7f7fULL, 0x7f7f7f7f7f7f7f7fULL, },
+ { 0x7f7f7f7f7f7f7f7fULL, 0x7f7f7f7f7f7f7f7fULL, },
+ { 0x7f7f7f7f7f7f7f7fULL, 0x7f7f7f7f7f7f7f7fULL, },
+ { 0x7f7f7f7f7f7f7f7fULL, 0x7f7f7f7f7f7f7f7fULL, },
+ { 0x727f7f727f7f727fULL, 0x7f727f7f727f7f72ULL, },
+ { 0x717f7f717f7f717fULL, 0x7f717f7f717f7f71ULL, },
+ { 0x3535353535353535ULL, 0x3535353535353535ULL, }, /* 32 */
+ { 0x3434343434343434ULL, 0x3434343434343434ULL, },
+ { 0x7f7f7f7f7f7f7f7fULL, 0x7f7f7f7f7f7f7f7fULL, },
+ { 0x7f7f7f7f7f7f7f7fULL, 0x7f7f7f7f7f7f7f7fULL, },
+ { 0x6868686868686868ULL, 0x6868686868686868ULL, },
+ { 0x6767676767676767ULL, 0x6767676767676767ULL, },
+ { 0x517f6c517f6c517fULL, 0x6c517f6c517f6c51ULL, },
+ { 0x507f6d507f6d507fULL, 0x6d507f6d507f6d50ULL, },
+ { 0x3434343434343434ULL, 0x3434343434343434ULL, }, /* 40 */
+ { 0x3333333333333333ULL, 0x3333333333333333ULL, },
+ { 0x7f7f7f7f7f7f7f7fULL, 0x7f7f7f7f7f7f7f7fULL, },
+ { 0x7f7f7f7f7f7f7f7fULL, 0x7f7f7f7f7f7f7f7fULL, },
+ { 0x6767676767676767ULL, 0x6767676767676767ULL, },
+ { 0x6666666666666666ULL, 0x6666666666666666ULL, },
+ { 0x507f6b507f6b507fULL, 0x6b507f6b507f6b50ULL, },
+ { 0x4f7f6c4f7f6c4f7fULL, 0x6c4f7f6c4f7f6c4fULL, },
+ { 0x1e73391e73391e73ULL, 0x391e73391e73391eULL, }, /* 48 */
+ { 0x1d72381d72381d72ULL, 0x381d72381d72381dULL, },
+ { 0x737f7f737f7f737fULL, 0x7f737f7f737f7f73ULL, },
+ { 0x727f7f727f7f727fULL, 0x7f727f7f727f7f72ULL, },
+ { 0x517f6c517f6c517fULL, 0x6c517f6c517f6c51ULL, },
+ { 0x507f6b507f6b507fULL, 0x6b507f6b507f6b50ULL, },
+ { 0x3a7f703a7f703a7fULL, 0x703a7f703a7f703aULL, },
+ { 0x397f71397f71397fULL, 0x71397f71397f7139ULL, },
+ { 0x1d723a1d723a1d72ULL, 0x3a1d723a1d723a1dULL, }, /* 56 */
+ { 0x1c71391c71391c71ULL, 0x391c71391c71391cULL, },
+ { 0x727f7f727f7f727fULL, 0x7f727f7f727f7f72ULL, },
+ { 0x717f7f717f7f717fULL, 0x7f717f7f717f7f71ULL, },
+ { 0x507f6d507f6d507fULL, 0x6d507f6d507f6d50ULL, },
+ { 0x4f7f6c4f7f6c4f7fULL, 0x6c4f7f6c4f7f6c4fULL, },
+ { 0x397f71397f71397fULL, 0x71397f71397f7139ULL, },
+ { 0x387f72387f72387fULL, 0x72387f72387f7238ULL, },
+ { 0x7f7f3468507f7f7fULL, 0x7f7f167f047f7f18ULL, }, /* 64 */
+ { 0x7d7f1a7f757f7f48ULL, 0x5d705078177f7f10ULL, },
+ { 0x7f7f6c7f6f7f7f7fULL, 0x727f455f577f7520ULL, },
+ { 0x7f7f307f7f7f737fULL, 0x7f767f7f597f6e6cULL, },
+ { 0x7d7f1a7f757f7f48ULL, 0x5d705078177f7f10ULL, },
+ { 0x0a7f007f7f7f7210ULL, 0x24127f342a7e7f08ULL, },
+ { 0x597f527f7f7f7f7fULL, 0x39317f1b6a6a7718ULL, },
+ { 0x757f167f7f7f5756ULL, 0x7f187f426c7f7064ULL, },
+ { 0x7f7f6c7f6f7f7f7fULL, 0x727f455f577f7520ULL, }, /* 72 */
+ { 0x597f527f7f7f7f7fULL, 0x39317f1b6a6a7718ULL, },
+ { 0x7f7f7f7f7f627f7fULL, 0x4e5074027f564a28ULL, },
+ { 0x7f7f687f7f627f7fULL, 0x7f377f297f6d4374ULL, },
+ { 0x7f7f307f7f7f737fULL, 0x7f767f7f597f6e6cULL, },
+ { 0x757f167f7f7f5756ULL, 0x7f187f426c7f7064ULL, },
+};
+
+ gettimeofday(&start, NULL);
+
+ for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) {
+ do_msa_ADDS_A_B(b128_pattern[i], b128_pattern[j],
+ b128_result[PATTERN_INPUTS_SHORT_COUNT * i + j]);
+ }
+ }
+
+ for (i = 0; i < RANDOM_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < RANDOM_INPUTS_SHORT_COUNT; j++) {
+ do_msa_ADDS_A_B(b128_random[i], b128_random[j],
+ b128_result[((PATTERN_INPUTS_SHORT_COUNT) *
+ (PATTERN_INPUTS_SHORT_COUNT)) +
+ RANDOM_INPUTS_SHORT_COUNT * i + j]);
+ }
+ }
+
+ gettimeofday(&end, NULL);
+
+ elapsed_time = (end.tv_sec - start.tv_sec) * 1000.0;
+ elapsed_time += (end.tv_usec - start.tv_usec) / 1000.0;
+
+ ret = check_results(instruction_name, TEST_COUNT_TOTAL, elapsed_time,
+ &b128_result[0][0], &b128_expect[0][0]);
+
+ return ret;
+}
diff --git a/tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_a_d.c b/tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_a_d.c
new file mode 100644
index 0000000..2b38b0d
--- /dev/null
+++ b/tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_a_d.c
@@ -0,0 +1,151 @@
+/*
+ * Test program for MSA instruction ADDS_A.D
+ *
+ * Copyright (C) 2018 Wave Computing, Inc.
+ * Copyright (C) 2018 Aleksandar Markovic <amarkovic@wavecomp.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
+#include <sys/time.h>
+#include <stdint.h>
+
+#include "../../../../include/wrappers_msa.h"
+#include "../../../../include/test_inputs.h"
+#include "../../../../include/test_utils.h"
+
+#define TEST_COUNT_TOTAL ( \
+ (PATTERN_INPUTS_SHORT_COUNT) * (PATTERN_INPUTS_SHORT_COUNT) + \
+ (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT))
+
+
+int32_t main(void)
+{
+ char *instruction_name = "ADDS_A.D";
+ int32_t ret;
+ uint32_t i, j;
+ struct timeval start, end;
+ double elapsed_time;
+
+ uint64_t b128_result[TEST_COUNT_TOTAL][2];
+ uint64_t b128_expect[TEST_COUNT_TOTAL][2] = {
+ { 0x0000000000000002ULL, 0x0000000000000002ULL, }, /* 0 */
+ { 0x0000000000000001ULL, 0x0000000000000001ULL, },
+ { 0x5555555555555557ULL, 0x5555555555555557ULL, },
+ { 0x5555555555555556ULL, 0x5555555555555556ULL, },
+ { 0x3333333333333335ULL, 0x3333333333333335ULL, },
+ { 0x3333333333333334ULL, 0x3333333333333334ULL, },
+ { 0x1c71c71c71c71c73ULL, 0x38e38e38e38e38e4ULL, },
+ { 0x1c71c71c71c71c72ULL, 0x38e38e38e38e38e5ULL, },
+ { 0x0000000000000001ULL, 0x0000000000000001ULL, }, /* 8 */
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0x5555555555555556ULL, 0x5555555555555556ULL, },
+ { 0x5555555555555555ULL, 0x5555555555555555ULL, },
+ { 0x3333333333333334ULL, 0x3333333333333334ULL, },
+ { 0x3333333333333333ULL, 0x3333333333333333ULL, },
+ { 0x1c71c71c71c71c72ULL, 0x38e38e38e38e38e3ULL, },
+ { 0x1c71c71c71c71c71ULL, 0x38e38e38e38e38e4ULL, },
+ { 0x5555555555555557ULL, 0x5555555555555557ULL, }, /* 16 */
+ { 0x5555555555555556ULL, 0x5555555555555556ULL, },
+ { 0x7fffffffffffffffULL, 0x7fffffffffffffffULL, },
+ { 0x7fffffffffffffffULL, 0x7fffffffffffffffULL, },
+ { 0x7fffffffffffffffULL, 0x7fffffffffffffffULL, },
+ { 0x7fffffffffffffffULL, 0x7fffffffffffffffULL, },
+ { 0x71c71c71c71c71c8ULL, 0x7fffffffffffffffULL, },
+ { 0x71c71c71c71c71c7ULL, 0x7fffffffffffffffULL, },
+ { 0x5555555555555556ULL, 0x5555555555555556ULL, }, /* 24 */
+ { 0x5555555555555555ULL, 0x5555555555555555ULL, },
+ { 0x7fffffffffffffffULL, 0x7fffffffffffffffULL, },
+ { 0x7fffffffffffffffULL, 0x7fffffffffffffffULL, },
+ { 0x7fffffffffffffffULL, 0x7fffffffffffffffULL, },
+ { 0x7fffffffffffffffULL, 0x7fffffffffffffffULL, },
+ { 0x71c71c71c71c71c7ULL, 0x7fffffffffffffffULL, },
+ { 0x71c71c71c71c71c6ULL, 0x7fffffffffffffffULL, },
+ { 0x3333333333333335ULL, 0x3333333333333335ULL, }, /* 32 */
+ { 0x3333333333333334ULL, 0x3333333333333334ULL, },
+ { 0x7fffffffffffffffULL, 0x7fffffffffffffffULL, },
+ { 0x7fffffffffffffffULL, 0x7fffffffffffffffULL, },
+ { 0x6666666666666668ULL, 0x6666666666666668ULL, },
+ { 0x6666666666666667ULL, 0x6666666666666667ULL, },
+ { 0x4fa4fa4fa4fa4fa6ULL, 0x6c16c16c16c16c17ULL, },
+ { 0x4fa4fa4fa4fa4fa5ULL, 0x6c16c16c16c16c18ULL, },
+ { 0x3333333333333334ULL, 0x3333333333333334ULL, }, /* 40 */
+ { 0x3333333333333333ULL, 0x3333333333333333ULL, },
+ { 0x7fffffffffffffffULL, 0x7fffffffffffffffULL, },
+ { 0x7fffffffffffffffULL, 0x7fffffffffffffffULL, },
+ { 0x6666666666666667ULL, 0x6666666666666667ULL, },
+ { 0x6666666666666666ULL, 0x6666666666666666ULL, },
+ { 0x4fa4fa4fa4fa4fa5ULL, 0x6c16c16c16c16c16ULL, },
+ { 0x4fa4fa4fa4fa4fa4ULL, 0x6c16c16c16c16c17ULL, },
+ { 0x1c71c71c71c71c73ULL, 0x38e38e38e38e38e4ULL, }, /* 48 */
+ { 0x1c71c71c71c71c72ULL, 0x38e38e38e38e38e3ULL, },
+ { 0x71c71c71c71c71c8ULL, 0x7fffffffffffffffULL, },
+ { 0x71c71c71c71c71c7ULL, 0x7fffffffffffffffULL, },
+ { 0x4fa4fa4fa4fa4fa6ULL, 0x6c16c16c16c16c17ULL, },
+ { 0x4fa4fa4fa4fa4fa5ULL, 0x6c16c16c16c16c16ULL, },
+ { 0x38e38e38e38e38e4ULL, 0x71c71c71c71c71c6ULL, },
+ { 0x38e38e38e38e38e3ULL, 0x71c71c71c71c71c7ULL, },
+ { 0x1c71c71c71c71c72ULL, 0x38e38e38e38e38e5ULL, }, /* 56 */
+ { 0x1c71c71c71c71c71ULL, 0x38e38e38e38e38e4ULL, },
+ { 0x71c71c71c71c71c7ULL, 0x7fffffffffffffffULL, },
+ { 0x71c71c71c71c71c6ULL, 0x7fffffffffffffffULL, },
+ { 0x4fa4fa4fa4fa4fa5ULL, 0x6c16c16c16c16c18ULL, },
+ { 0x4fa4fa4fa4fa4fa4ULL, 0x6c16c16c16c16c17ULL, },
+ { 0x38e38e38e38e38e3ULL, 0x71c71c71c71c71c7ULL, },
+ { 0x38e38e38e38e38e2ULL, 0x71c71c71c71c71c8ULL, },
+ { 0x7fffffffffffffffULL, 0x7fffffffffffffffULL, }, /* 64 */
+ { 0x7bd718d08a09e3b8ULL, 0x5e5ec67913bb0308ULL, },
+ { 0x7fffffffffffffffULL, 0x733fd25ea9a6d520ULL, },
+ { 0x7fffffffffffffffULL, 0x7fffffffffffffffULL, },
+ { 0x7bd718d08a09e3b8ULL, 0x5e5ec67913bb0308ULL, },
+ { 0x0883ff3964d871f0ULL, 0x25ef76342a7ea5f8ULL, },
+ { 0x57e750f1f89cad78ULL, 0x3ad08219c06a7810ULL, },
+ { 0x749115ea109e1b46ULL, 0x7fffffffffffffffULL, },
+ { 0x7fffffffffffffffULL, 0x733fd25ea9a6d520ULL, }, /* 72 */
+ { 0x57e750f1f89cad78ULL, 0x3ad08219c06a7810ULL, },
+ { 0x7fffffffffffffffULL, 0x4fb18dff56564a28ULL, },
+ { 0x7fffffffffffffffULL, 0x7fffffffffffffffULL, },
+ { 0x7fffffffffffffffULL, 0x7fffffffffffffffULL, },
+ { 0x749115ea109e1b46ULL, 0x7fffffffffffffffULL, },
+};
+
+ gettimeofday(&start, NULL);
+
+ for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) {
+ do_msa_ADDS_A_D(b128_pattern[i], b128_pattern[j],
+ b128_result[PATTERN_INPUTS_SHORT_COUNT * i + j]);
+ }
+ }
+
+ for (i = 0; i < RANDOM_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < RANDOM_INPUTS_SHORT_COUNT; j++) {
+ do_msa_ADDS_A_D(b128_random[i], b128_random[j],
+ b128_result[((PATTERN_INPUTS_SHORT_COUNT) *
+ (PATTERN_INPUTS_SHORT_COUNT)) +
+ RANDOM_INPUTS_SHORT_COUNT * i + j]);
+ }
+ }
+
+ gettimeofday(&end, NULL);
+
+ elapsed_time = (end.tv_sec - start.tv_sec) * 1000.0;
+ elapsed_time += (end.tv_usec - start.tv_usec) / 1000.0;
+
+ ret = check_results(instruction_name, TEST_COUNT_TOTAL, elapsed_time,
+ &b128_result[0][0], &b128_expect[0][0]);
+
+ return ret;
+}
diff --git a/tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_a_h.c b/tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_a_h.c
new file mode 100644
index 0000000..424f7d3
--- /dev/null
+++ b/tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_a_h.c
@@ -0,0 +1,151 @@
+/*
+ * Test program for MSA instruction ADDS_A.H
+ *
+ * Copyright (C) 2018 Wave Computing, Inc.
+ * Copyright (C) 2018 Aleksandar Markovic <amarkovic@wavecomp.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
+#include <sys/time.h>
+#include <stdint.h>
+
+#include "../../../../include/wrappers_msa.h"
+#include "../../../../include/test_inputs.h"
+#include "../../../../include/test_utils.h"
+
+#define TEST_COUNT_TOTAL ( \
+ (PATTERN_INPUTS_SHORT_COUNT) * (PATTERN_INPUTS_SHORT_COUNT) + \
+ (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT))
+
+
+int32_t main(void)
+{
+ char *instruction_name = "ADDS_A.H";
+ int32_t ret;
+ uint32_t i, j;
+ struct timeval start, end;
+ double elapsed_time;
+
+ uint64_t b128_result[TEST_COUNT_TOTAL][2];
+ uint64_t b128_expect[TEST_COUNT_TOTAL][2] = {
+ { 0x0002000200020002ULL, 0x0002000200020002ULL, }, /* 0 */
+ { 0x0001000100010001ULL, 0x0001000100010001ULL, },
+ { 0x5557555755575557ULL, 0x5557555755575557ULL, },
+ { 0x5556555655565556ULL, 0x5556555655565556ULL, },
+ { 0x3335333533353335ULL, 0x3335333533353335ULL, },
+ { 0x3334333433343334ULL, 0x3334333433343334ULL, },
+ { 0x1c7338e471c91c73ULL, 0x38e471c91c7338e4ULL, },
+ { 0x1c7238e571c81c72ULL, 0x38e571c81c7238e5ULL, },
+ { 0x0001000100010001ULL, 0x0001000100010001ULL, }, /* 8 */
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0x5556555655565556ULL, 0x5556555655565556ULL, },
+ { 0x5555555555555555ULL, 0x5555555555555555ULL, },
+ { 0x3334333433343334ULL, 0x3334333433343334ULL, },
+ { 0x3333333333333333ULL, 0x3333333333333333ULL, },
+ { 0x1c7238e371c81c72ULL, 0x38e371c81c7238e3ULL, },
+ { 0x1c7138e471c71c71ULL, 0x38e471c71c7138e4ULL, },
+ { 0x5557555755575557ULL, 0x5557555755575557ULL, }, /* 16 */
+ { 0x5556555655565556ULL, 0x5556555655565556ULL, },
+ { 0x7fff7fff7fff7fffULL, 0x7fff7fff7fff7fffULL, },
+ { 0x7fff7fff7fff7fffULL, 0x7fff7fff7fff7fffULL, },
+ { 0x7fff7fff7fff7fffULL, 0x7fff7fff7fff7fffULL, },
+ { 0x7fff7fff7fff7fffULL, 0x7fff7fff7fff7fffULL, },
+ { 0x71c87fff7fff71c8ULL, 0x7fff7fff71c87fffULL, },
+ { 0x71c77fff7fff71c7ULL, 0x7fff7fff71c77fffULL, },
+ { 0x5556555655565556ULL, 0x5556555655565556ULL, }, /* 24 */
+ { 0x5555555555555555ULL, 0x5555555555555555ULL, },
+ { 0x7fff7fff7fff7fffULL, 0x7fff7fff7fff7fffULL, },
+ { 0x7fff7fff7fff7fffULL, 0x7fff7fff7fff7fffULL, },
+ { 0x7fff7fff7fff7fffULL, 0x7fff7fff7fff7fffULL, },
+ { 0x7fff7fff7fff7fffULL, 0x7fff7fff7fff7fffULL, },
+ { 0x71c77fff7fff71c7ULL, 0x7fff7fff71c77fffULL, },
+ { 0x71c67fff7fff71c6ULL, 0x7fff7fff71c67fffULL, },
+ { 0x3335333533353335ULL, 0x3335333533353335ULL, }, /* 32 */
+ { 0x3334333433343334ULL, 0x3334333433343334ULL, },
+ { 0x7fff7fff7fff7fffULL, 0x7fff7fff7fff7fffULL, },
+ { 0x7fff7fff7fff7fffULL, 0x7fff7fff7fff7fffULL, },
+ { 0x6668666866686668ULL, 0x6668666866686668ULL, },
+ { 0x6667666766676667ULL, 0x6667666766676667ULL, },
+ { 0x4fa66c177fff4fa6ULL, 0x6c177fff4fa66c17ULL, },
+ { 0x4fa56c187fff4fa5ULL, 0x6c187fff4fa56c18ULL, },
+ { 0x3334333433343334ULL, 0x3334333433343334ULL, }, /* 40 */
+ { 0x3333333333333333ULL, 0x3333333333333333ULL, },
+ { 0x7fff7fff7fff7fffULL, 0x7fff7fff7fff7fffULL, },
+ { 0x7fff7fff7fff7fffULL, 0x7fff7fff7fff7fffULL, },
+ { 0x6667666766676667ULL, 0x6667666766676667ULL, },
+ { 0x6666666666666666ULL, 0x6666666666666666ULL, },
+ { 0x4fa56c167fff4fa5ULL, 0x6c167fff4fa56c16ULL, },
+ { 0x4fa46c177fff4fa4ULL, 0x6c177fff4fa46c17ULL, },
+ { 0x1c7338e471c91c73ULL, 0x38e471c91c7338e4ULL, }, /* 48 */
+ { 0x1c7238e371c81c72ULL, 0x38e371c81c7238e3ULL, },
+ { 0x71c87fff7fff71c8ULL, 0x7fff7fff71c87fffULL, },
+ { 0x71c77fff7fff71c7ULL, 0x7fff7fff71c77fffULL, },
+ { 0x4fa66c177fff4fa6ULL, 0x6c177fff4fa66c17ULL, },
+ { 0x4fa56c167fff4fa5ULL, 0x6c167fff4fa56c16ULL, },
+ { 0x38e471c67fff38e4ULL, 0x71c67fff38e471c6ULL, },
+ { 0x38e371c77fff38e3ULL, 0x71c77fff38e371c7ULL, },
+ { 0x1c7238e571c81c72ULL, 0x38e571c81c7238e5ULL, }, /* 56 */
+ { 0x1c7138e471c71c71ULL, 0x38e471c71c7138e4ULL, },
+ { 0x71c77fff7fff71c7ULL, 0x7fff7fff71c77fffULL, },
+ { 0x71c67fff7fff71c6ULL, 0x7fff7fff71c67fffULL, },
+ { 0x4fa56c187fff4fa5ULL, 0x6c187fff4fa56c18ULL, },
+ { 0x4fa46c177fff4fa4ULL, 0x6c177fff4fa46c17ULL, },
+ { 0x38e371c77fff38e3ULL, 0x71c77fff38e371c7ULL, },
+ { 0x38e271c87fff38e2ULL, 0x71c87fff38e271c8ULL, },
+ { 0x7fff326850c47fffULL, 0x7fff16bc030a7fffULL, }, /* 64 */
+ { 0x7bd8199775f57fffULL, 0x5e5e504416c47fffULL, },
+ { 0x7fff6a8a6e937fffULL, 0x733f445f565a7508ULL, },
+ { 0x7fff2f817fff72f2ULL, 0x7fff7fff58436d54ULL, },
+ { 0x7bd8199775f57fffULL, 0x5e5e504416c47fffULL, },
+ { 0x088400c67fff71f0ULL, 0x25ee7fff2a7e7fffULL, },
+ { 0x57e851b97fff7fffULL, 0x3acf7de76a147810ULL, },
+ { 0x749116b07fff56aaULL, 0x7fff7fff6bfd705cULL, },
+ { 0x7fff6a8a6e937fffULL, 0x733f445f565a7508ULL, }, /* 72 */
+ { 0x57e851b97fff7fffULL, 0x3acf7de76a147810ULL, },
+ { 0x7fff7fff7fff7fffULL, 0x4fb072027fff4a28ULL, },
+ { 0x7fff67a37fff7fffULL, 0x7fff7fff7fff4274ULL, },
+ { 0x7fff2f817fff72f2ULL, 0x7fff7fff58436d54ULL, },
+ { 0x749116b07fff56aaULL, 0x7fff7fff6bfd705cULL, },
+};
+
+ gettimeofday(&start, NULL);
+
+ for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) {
+ do_msa_ADDS_A_H(b128_pattern[i], b128_pattern[j],
+ b128_result[PATTERN_INPUTS_SHORT_COUNT * i + j]);
+ }
+ }
+
+ for (i = 0; i < RANDOM_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < RANDOM_INPUTS_SHORT_COUNT; j++) {
+ do_msa_ADDS_A_H(b128_random[i], b128_random[j],
+ b128_result[((PATTERN_INPUTS_SHORT_COUNT) *
+ (PATTERN_INPUTS_SHORT_COUNT)) +
+ RANDOM_INPUTS_SHORT_COUNT * i + j]);
+ }
+ }
+
+ gettimeofday(&end, NULL);
+
+ elapsed_time = (end.tv_sec - start.tv_sec) * 1000.0;
+ elapsed_time += (end.tv_usec - start.tv_usec) / 1000.0;
+
+ ret = check_results(instruction_name, TEST_COUNT_TOTAL, elapsed_time,
+ &b128_result[0][0], &b128_expect[0][0]);
+
+ return ret;
+}
diff --git a/tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_a_w.c b/tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_a_w.c
new file mode 100644
index 0000000..c389e46
--- /dev/null
+++ b/tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_a_w.c
@@ -0,0 +1,151 @@
+/*
+ * Test program for MSA instruction ADDS_A.W
+ *
+ * Copyright (C) 2018 Wave Computing, Inc.
+ * Copyright (C) 2018 Aleksandar Markovic <amarkovic@wavecomp.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
+#include <sys/time.h>
+#include <stdint.h>
+
+#include "../../../../include/wrappers_msa.h"
+#include "../../../../include/test_inputs.h"
+#include "../../../../include/test_utils.h"
+
+#define TEST_COUNT_TOTAL ( \
+ (PATTERN_INPUTS_SHORT_COUNT) * (PATTERN_INPUTS_SHORT_COUNT) + \
+ (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT))
+
+
+int32_t main(void)
+{
+ char *instruction_name = "ADDS_A.W";
+ int32_t ret;
+ uint32_t i, j;
+ struct timeval start, end;
+ double elapsed_time;
+
+ uint64_t b128_result[TEST_COUNT_TOTAL][2];
+ uint64_t b128_expect[TEST_COUNT_TOTAL][2] = {
+ { 0x0000000200000002ULL, 0x0000000200000002ULL, }, /* 0 */
+ { 0x0000000100000001ULL, 0x0000000100000001ULL, },
+ { 0x5555555755555557ULL, 0x5555555755555557ULL, },
+ { 0x5555555655555556ULL, 0x5555555655555556ULL, },
+ { 0x3333333533333335ULL, 0x3333333533333335ULL, },
+ { 0x3333333433333334ULL, 0x3333333433333334ULL, },
+ { 0x1c71c71e71c71c73ULL, 0x38e38e391c71c71eULL, },
+ { 0x1c71c71d71c71c72ULL, 0x38e38e3a1c71c71dULL, },
+ { 0x0000000100000001ULL, 0x0000000100000001ULL, }, /* 8 */
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0x5555555655555556ULL, 0x5555555655555556ULL, },
+ { 0x5555555555555555ULL, 0x5555555555555555ULL, },
+ { 0x3333333433333334ULL, 0x3333333433333334ULL, },
+ { 0x3333333333333333ULL, 0x3333333333333333ULL, },
+ { 0x1c71c71d71c71c72ULL, 0x38e38e381c71c71dULL, },
+ { 0x1c71c71c71c71c71ULL, 0x38e38e391c71c71cULL, },
+ { 0x5555555755555557ULL, 0x5555555755555557ULL, }, /* 16 */
+ { 0x5555555655555556ULL, 0x5555555655555556ULL, },
+ { 0x7fffffff7fffffffULL, 0x7fffffff7fffffffULL, },
+ { 0x7fffffff7fffffffULL, 0x7fffffff7fffffffULL, },
+ { 0x7fffffff7fffffffULL, 0x7fffffff7fffffffULL, },
+ { 0x7fffffff7fffffffULL, 0x7fffffff7fffffffULL, },
+ { 0x71c71c737fffffffULL, 0x7fffffff71c71c73ULL, },
+ { 0x71c71c727fffffffULL, 0x7fffffff71c71c72ULL, },
+ { 0x5555555655555556ULL, 0x5555555655555556ULL, }, /* 24 */
+ { 0x5555555555555555ULL, 0x5555555555555555ULL, },
+ { 0x7fffffff7fffffffULL, 0x7fffffff7fffffffULL, },
+ { 0x7fffffff7fffffffULL, 0x7fffffff7fffffffULL, },
+ { 0x7fffffff7fffffffULL, 0x7fffffff7fffffffULL, },
+ { 0x7fffffff7fffffffULL, 0x7fffffff7fffffffULL, },
+ { 0x71c71c727fffffffULL, 0x7fffffff71c71c72ULL, },
+ { 0x71c71c717fffffffULL, 0x7fffffff71c71c71ULL, },
+ { 0x3333333533333335ULL, 0x3333333533333335ULL, }, /* 32 */
+ { 0x3333333433333334ULL, 0x3333333433333334ULL, },
+ { 0x7fffffff7fffffffULL, 0x7fffffff7fffffffULL, },
+ { 0x7fffffff7fffffffULL, 0x7fffffff7fffffffULL, },
+ { 0x6666666866666668ULL, 0x6666666866666668ULL, },
+ { 0x6666666766666667ULL, 0x6666666766666667ULL, },
+ { 0x4fa4fa517fffffffULL, 0x6c16c16c4fa4fa51ULL, },
+ { 0x4fa4fa507fffffffULL, 0x6c16c16d4fa4fa50ULL, },
+ { 0x3333333433333334ULL, 0x3333333433333334ULL, }, /* 40 */
+ { 0x3333333333333333ULL, 0x3333333333333333ULL, },
+ { 0x7fffffff7fffffffULL, 0x7fffffff7fffffffULL, },
+ { 0x7fffffff7fffffffULL, 0x7fffffff7fffffffULL, },
+ { 0x6666666766666667ULL, 0x6666666766666667ULL, },
+ { 0x6666666666666666ULL, 0x6666666666666666ULL, },
+ { 0x4fa4fa507fffffffULL, 0x6c16c16b4fa4fa50ULL, },
+ { 0x4fa4fa4f7fffffffULL, 0x6c16c16c4fa4fa4fULL, },
+ { 0x1c71c71e71c71c73ULL, 0x38e38e391c71c71eULL, }, /* 48 */
+ { 0x1c71c71d71c71c72ULL, 0x38e38e381c71c71dULL, },
+ { 0x71c71c737fffffffULL, 0x7fffffff71c71c73ULL, },
+ { 0x71c71c727fffffffULL, 0x7fffffff71c71c72ULL, },
+ { 0x4fa4fa517fffffffULL, 0x6c16c16c4fa4fa51ULL, },
+ { 0x4fa4fa507fffffffULL, 0x6c16c16b4fa4fa50ULL, },
+ { 0x38e38e3a7fffffffULL, 0x71c71c7038e38e3aULL, },
+ { 0x38e38e397fffffffULL, 0x71c71c7138e38e39ULL, },
+ { 0x1c71c71d71c71c72ULL, 0x38e38e3a1c71c71dULL, }, /* 56 */
+ { 0x1c71c71c71c71c71ULL, 0x38e38e391c71c71cULL, },
+ { 0x71c71c727fffffffULL, 0x7fffffff71c71c72ULL, },
+ { 0x71c71c717fffffffULL, 0x7fffffff71c71c71ULL, },
+ { 0x4fa4fa507fffffffULL, 0x6c16c16d4fa4fa50ULL, },
+ { 0x4fa4fa4f7fffffffULL, 0x6c16c16c4fa4fa4fULL, },
+ { 0x38e38e397fffffffULL, 0x71c71c7138e38e39ULL, },
+ { 0x38e38e387fffffffULL, 0x71c71c7238e38e38ULL, },
+ { 0x7fffffff50c4aa80ULL, 0x7fffffff03089fe8ULL, }, /* 64 */
+ { 0x7bd718d175f61c48ULL, 0x5e5ec67816c3a2f0ULL, },
+ { 0x7fffffff6e92c9c0ULL, 0x733fd25d56592ae0ULL, },
+ { 0x7fffffff7fffffffULL, 0x7fffffff58416d54ULL, },
+ { 0x7bd718d175f61c48ULL, 0x5e5ec67816c3a2f0ULL, },
+ { 0x0883ff3a7fffffffULL, 0x25ef76342a7ea5f8ULL, },
+ { 0x57e750f37fffffffULL, 0x3ad082196a142de8ULL, },
+ { 0x749115ea7fffffffULL, 0x7fffffff6bfc705cULL, },
+ { 0x7fffffff6e92c9c0ULL, 0x733fd25d56592ae0ULL, }, /* 72 */
+ { 0x57e750f37fffffffULL, 0x3ad082196a142de8ULL, },
+ { 0x7fffffff7fffffffULL, 0x4fb18dfe7fffffffULL, },
+ { 0x7fffffff7fffffffULL, 0x7fffffff7fffffffULL, },
+ { 0x7fffffff7fffffffULL, 0x7fffffff58416d54ULL, },
+ { 0x749115ea7fffffffULL, 0x7fffffff6bfc705cULL, },
+};
+
+ gettimeofday(&start, NULL);
+
+ for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) {
+ do_msa_ADDS_A_W(b128_pattern[i], b128_pattern[j],
+ b128_result[PATTERN_INPUTS_SHORT_COUNT * i + j]);
+ }
+ }
+
+ for (i = 0; i < RANDOM_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < RANDOM_INPUTS_SHORT_COUNT; j++) {
+ do_msa_ADDS_A_W(b128_random[i], b128_random[j],
+ b128_result[((PATTERN_INPUTS_SHORT_COUNT) *
+ (PATTERN_INPUTS_SHORT_COUNT)) +
+ RANDOM_INPUTS_SHORT_COUNT * i + j]);
+ }
+ }
+
+ gettimeofday(&end, NULL);
+
+ elapsed_time = (end.tv_sec - start.tv_sec) * 1000.0;
+ elapsed_time += (end.tv_usec - start.tv_usec) / 1000.0;
+
+ ret = check_results(instruction_name, TEST_COUNT_TOTAL, elapsed_time,
+ &b128_result[0][0], &b128_expect[0][0]);
+
+ return ret;
+}
diff --git a/tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_s_b.c b/tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_s_b.c
new file mode 100644
index 0000000..5b1d9e0
--- /dev/null
+++ b/tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_s_b.c
@@ -0,0 +1,151 @@
+/*
+ * Test program for MSA instruction ADDS_S.B
+ *
+ * Copyright (C) 2018 Wave Computing, Inc.
+ * Copyright (C) 2018 Aleksandar Markovic <amarkovic@wavecomp.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
+#include <sys/time.h>
+#include <stdint.h>
+
+#include "../../../../include/wrappers_msa.h"
+#include "../../../../include/test_inputs.h"
+#include "../../../../include/test_utils.h"
+
+#define TEST_COUNT_TOTAL ( \
+ (PATTERN_INPUTS_SHORT_COUNT) * (PATTERN_INPUTS_SHORT_COUNT) + \
+ (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT))
+
+
+int32_t main(void)
+{
+ char *instruction_name = "ADDS_S.B";
+ int32_t ret;
+ uint32_t i, j;
+ struct timeval start, end;
+ double elapsed_time;
+
+ uint64_t b128_result[TEST_COUNT_TOTAL][2];
+ uint64_t b128_expect[TEST_COUNT_TOTAL][2] = {
+ { 0xfefefefefefefefeULL, 0xfefefefefefefefeULL, }, /* 0 */
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xa9a9a9a9a9a9a9a9ULL, 0xa9a9a9a9a9a9a9a9ULL, },
+ { 0x5454545454545454ULL, 0x5454545454545454ULL, },
+ { 0xcbcbcbcbcbcbcbcbULL, 0xcbcbcbcbcbcbcbcbULL, },
+ { 0x3232323232323232ULL, 0x3232323232323232ULL, },
+ { 0xe28d37e28d37e28dULL, 0x37e28d37e28d37e2ULL, },
+ { 0x1b70c61b70c61b70ULL, 0xc61b70c61b70c61bULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 8 */
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, },
+ { 0x5555555555555555ULL, 0x5555555555555555ULL, },
+ { 0xccccccccccccccccULL, 0xccccccccccccccccULL, },
+ { 0x3333333333333333ULL, 0x3333333333333333ULL, },
+ { 0xe38e38e38e38e38eULL, 0x38e38e38e38e38e3ULL, },
+ { 0x1c71c71c71c71c71ULL, 0xc71c71c71c71c71cULL, },
+ { 0xa9a9a9a9a9a9a9a9ULL, 0xa9a9a9a9a9a9a9a9ULL, }, /* 16 */
+ { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, },
+ { 0x8080808080808080ULL, 0x8080808080808080ULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0x8080808080808080ULL, 0x8080808080808080ULL, },
+ { 0xddddddddddddddddULL, 0xddddddddddddddddULL, },
+ { 0x8d80e28d80e28d80ULL, 0xe28d80e28d80e28dULL, },
+ { 0xc61b80c61b80c61bULL, 0x80c61b80c61b80c6ULL, },
+ { 0x5454545454545454ULL, 0x5454545454545454ULL, }, /* 24 */
+ { 0x5555555555555555ULL, 0x5555555555555555ULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0x7f7f7f7f7f7f7f7fULL, 0x7f7f7f7f7f7f7f7fULL, },
+ { 0x2121212121212121ULL, 0x2121212121212121ULL, },
+ { 0x7f7f7f7f7f7f7f7fULL, 0x7f7f7f7f7f7f7f7fULL, },
+ { 0x38e37f38e37f38e3ULL, 0x7f38e37f38e37f38ULL, },
+ { 0x717f1c717f1c717fULL, 0x1c717f1c717f1c71ULL, },
+ { 0xcbcbcbcbcbcbcbcbULL, 0xcbcbcbcbcbcbcbcbULL, }, /* 32 */
+ { 0xccccccccccccccccULL, 0xccccccccccccccccULL, },
+ { 0x8080808080808080ULL, 0x8080808080808080ULL, },
+ { 0x2121212121212121ULL, 0x2121212121212121ULL, },
+ { 0x9898989898989898ULL, 0x9898989898989898ULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xaf8004af8004af80ULL, 0x04af8004af8004afULL, },
+ { 0xe83d93e83d93e83dULL, 0x93e83d93e83d93e8ULL, },
+ { 0x3232323232323232ULL, 0x3232323232323232ULL, }, /* 40 */
+ { 0x3333333333333333ULL, 0x3333333333333333ULL, },
+ { 0xddddddddddddddddULL, 0xddddddddddddddddULL, },
+ { 0x7f7f7f7f7f7f7f7fULL, 0x7f7f7f7f7f7f7f7fULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0x6666666666666666ULL, 0x6666666666666666ULL, },
+ { 0x16c16b16c16b16c1ULL, 0x6b16c16b16c16b16ULL, },
+ { 0x4f7ffa4f7ffa4f7fULL, 0xfa4f7ffa4f7ffa4fULL, },
+ { 0xe28d37e28d37e28dULL, 0x37e28d37e28d37e2ULL, }, /* 48 */
+ { 0xe38e38e38e38e38eULL, 0x38e38e38e38e38e3ULL, },
+ { 0x8d80e28d80e28d80ULL, 0xe28d80e28d80e28dULL, },
+ { 0x38e37f38e37f38e3ULL, 0x7f38e37f38e37f38ULL, },
+ { 0xaf8004af8004af80ULL, 0x04af8004af8004afULL, },
+ { 0x16c16b16c16b16c1ULL, 0x6b16c16b16c16b16ULL, },
+ { 0xc68070c68070c680ULL, 0x70c68070c68070c6ULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0x1b70c61b70c61b70ULL, 0xc61b70c61b70c61bULL, }, /* 56 */
+ { 0x1c71c71c71c71c71ULL, 0xc71c71c71c71c71cULL, },
+ { 0xc61b80c61b80c61bULL, 0x80c61b80c61b80c6ULL, },
+ { 0x717f1c717f1c717fULL, 0x1c717f1c717f1c71ULL, },
+ { 0xe83d93e83d93e83dULL, 0x93e83d93e83d93e8ULL, },
+ { 0x4f7ffa4f7ffa4f7fULL, 0xfa4f7ffa4f7ffa4fULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0x387f8e387f8e387fULL, 0x8e387f8e387f8e38ULL, },
+ { 0x807fcc98507f7f7fULL, 0x7f7f167ffc7f8018ULL, }, /* 64 */
+ { 0x8328e62f75f51c48ULL, 0x5d5ec678137f0208ULL, },
+ { 0x807f9480e131e0c0ULL, 0x723fd15da97fd520ULL, },
+ { 0xf87ffc197f7f377fULL, 0xd8589336a77f92acULL, },
+ { 0x8328e62f75f51c48ULL, 0x5d5ec678137f0208ULL, },
+ { 0xf680007f7f808e10ULL, 0x24ee80342a7e7ff8ULL, },
+ { 0xa718ae0d06808088ULL, 0x39cf8119c06a7710ULL, },
+ { 0x6b0d167f7fc4a956ULL, 0x9fe880f2be7f349cULL, },
+ { 0x807f9480e131e0c0ULL, 0x723fd15da97fd520ULL, }, /* 72 */
+ { 0xa718ae0d06808088ULL, 0x39cf8119c06a7710ULL, },
+ { 0x807f8080809e8080ULL, 0x4eb08cfe80564a28ULL, },
+ { 0x1c7fc4f7170080ceULL, 0xb4c980d7806d07b4ULL, },
+ { 0xf87ffc197f7f377fULL, 0xd8589336a77f92acULL, },
+ { 0x6b0d167f7fc4a956ULL, 0x9fe880f2be7f349cULL, },
+};
+
+ gettimeofday(&start, NULL);
+
+ for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) {
+ do_msa_ADDS_S_B(b128_pattern[i], b128_pattern[j],
+ b128_result[PATTERN_INPUTS_SHORT_COUNT * i + j]);
+ }
+ }
+
+ for (i = 0; i < RANDOM_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < RANDOM_INPUTS_SHORT_COUNT; j++) {
+ do_msa_ADDS_S_B(b128_random[i], b128_random[j],
+ b128_result[((PATTERN_INPUTS_SHORT_COUNT) *
+ (PATTERN_INPUTS_SHORT_COUNT)) +
+ RANDOM_INPUTS_SHORT_COUNT * i + j]);
+ }
+ }
+
+ gettimeofday(&end, NULL);
+
+ elapsed_time = (end.tv_sec - start.tv_sec) * 1000.0;
+ elapsed_time += (end.tv_usec - start.tv_usec) / 1000.0;
+
+ ret = check_results(instruction_name, TEST_COUNT_TOTAL, elapsed_time,
+ &b128_result[0][0], &b128_expect[0][0]);
+
+ return ret;
+}
diff --git a/tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_s_d.c b/tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_s_d.c
new file mode 100644
index 0000000..d37773e
--- /dev/null
+++ b/tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_s_d.c
@@ -0,0 +1,151 @@
+/*
+ * Test program for MSA instruction ADDS_S.D
+ *
+ * Copyright (C) 2018 Wave Computing, Inc.
+ * Copyright (C) 2018 Aleksandar Markovic <amarkovic@wavecomp.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
+#include <sys/time.h>
+#include <stdint.h>
+
+#include "../../../../include/wrappers_msa.h"
+#include "../../../../include/test_inputs.h"
+#include "../../../../include/test_utils.h"
+
+#define TEST_COUNT_TOTAL ( \
+ (PATTERN_INPUTS_SHORT_COUNT) * (PATTERN_INPUTS_SHORT_COUNT) + \
+ (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT))
+
+
+int32_t main(void)
+{
+ char *instruction_name = "ADDS_S.D";
+ int32_t ret;
+ uint32_t i, j;
+ struct timeval start, end;
+ double elapsed_time;
+
+ uint64_t b128_result[TEST_COUNT_TOTAL][2];
+ uint64_t b128_expect[TEST_COUNT_TOTAL][2] = {
+ { 0xfffffffffffffffeULL, 0xfffffffffffffffeULL, }, /* 0 */
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xaaaaaaaaaaaaaaa9ULL, 0xaaaaaaaaaaaaaaa9ULL, },
+ { 0x5555555555555554ULL, 0x5555555555555554ULL, },
+ { 0xcccccccccccccccbULL, 0xcccccccccccccccbULL, },
+ { 0x3333333333333332ULL, 0x3333333333333332ULL, },
+ { 0xe38e38e38e38e38dULL, 0x38e38e38e38e38e2ULL, },
+ { 0x1c71c71c71c71c70ULL, 0xc71c71c71c71c71bULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 8 */
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, },
+ { 0x5555555555555555ULL, 0x5555555555555555ULL, },
+ { 0xccccccccccccccccULL, 0xccccccccccccccccULL, },
+ { 0x3333333333333333ULL, 0x3333333333333333ULL, },
+ { 0xe38e38e38e38e38eULL, 0x38e38e38e38e38e3ULL, },
+ { 0x1c71c71c71c71c71ULL, 0xc71c71c71c71c71cULL, },
+ { 0xaaaaaaaaaaaaaaa9ULL, 0xaaaaaaaaaaaaaaa9ULL, }, /* 16 */
+ { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, },
+ { 0x8000000000000000ULL, 0x8000000000000000ULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0x8000000000000000ULL, 0x8000000000000000ULL, },
+ { 0xddddddddddddddddULL, 0xddddddddddddddddULL, },
+ { 0x8e38e38e38e38e38ULL, 0xe38e38e38e38e38dULL, },
+ { 0xc71c71c71c71c71bULL, 0x8000000000000000ULL, },
+ { 0x5555555555555554ULL, 0x5555555555555554ULL, }, /* 24 */
+ { 0x5555555555555555ULL, 0x5555555555555555ULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0x7fffffffffffffffULL, 0x7fffffffffffffffULL, },
+ { 0x2222222222222221ULL, 0x2222222222222221ULL, },
+ { 0x7fffffffffffffffULL, 0x7fffffffffffffffULL, },
+ { 0x38e38e38e38e38e3ULL, 0x7fffffffffffffffULL, },
+ { 0x71c71c71c71c71c6ULL, 0x1c71c71c71c71c71ULL, },
+ { 0xcccccccccccccccbULL, 0xcccccccccccccccbULL, }, /* 32 */
+ { 0xccccccccccccccccULL, 0xccccccccccccccccULL, },
+ { 0x8000000000000000ULL, 0x8000000000000000ULL, },
+ { 0x2222222222222221ULL, 0x2222222222222221ULL, },
+ { 0x9999999999999998ULL, 0x9999999999999998ULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xb05b05b05b05b05aULL, 0x05b05b05b05b05afULL, },
+ { 0xe93e93e93e93e93dULL, 0x93e93e93e93e93e8ULL, },
+ { 0x3333333333333332ULL, 0x3333333333333332ULL, }, /* 40 */
+ { 0x3333333333333333ULL, 0x3333333333333333ULL, },
+ { 0xddddddddddddddddULL, 0xddddddddddddddddULL, },
+ { 0x7fffffffffffffffULL, 0x7fffffffffffffffULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0x6666666666666666ULL, 0x6666666666666666ULL, },
+ { 0x16c16c16c16c16c1ULL, 0x6c16c16c16c16c16ULL, },
+ { 0x4fa4fa4fa4fa4fa4ULL, 0xfa4fa4fa4fa4fa4fULL, },
+ { 0xe38e38e38e38e38dULL, 0x38e38e38e38e38e2ULL, }, /* 48 */
+ { 0xe38e38e38e38e38eULL, 0x38e38e38e38e38e3ULL, },
+ { 0x8e38e38e38e38e38ULL, 0xe38e38e38e38e38dULL, },
+ { 0x38e38e38e38e38e3ULL, 0x7fffffffffffffffULL, },
+ { 0xb05b05b05b05b05aULL, 0x05b05b05b05b05afULL, },
+ { 0x16c16c16c16c16c1ULL, 0x6c16c16c16c16c16ULL, },
+ { 0xc71c71c71c71c71cULL, 0x71c71c71c71c71c6ULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0x1c71c71c71c71c70ULL, 0xc71c71c71c71c71bULL, }, /* 56 */
+ { 0x1c71c71c71c71c71ULL, 0xc71c71c71c71c71cULL, },
+ { 0xc71c71c71c71c71bULL, 0x8000000000000000ULL, },
+ { 0x71c71c71c71c71c6ULL, 0x1c71c71c71c71c71ULL, },
+ { 0xe93e93e93e93e93dULL, 0x93e93e93e93e93e8ULL, },
+ { 0x4fa4fa4fa4fa4fa4ULL, 0xfa4fa4fa4fa4fa4fULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0x38e38e38e38e38e2ULL, 0x8e38e38e38e38e38ULL, },
+ { 0x8000000000000000ULL, 0x7fffffffffffffffULL, }, /* 64 */
+ { 0x8428e72f75f61c48ULL, 0x5e5ec67913bb0308ULL, },
+ { 0x8000000000000000ULL, 0x733fd25ea9a6d520ULL, },
+ { 0xf8b9fd198694378eULL, 0xd9589437a7be92acULL, },
+ { 0x8428e72f75f61c48ULL, 0x5e5ec67913bb0308ULL, },
+ { 0xf77c00c69b278e10ULL, 0x25ef76342a7ea5f8ULL, },
+ { 0xa818af0e07635288ULL, 0x3ad08219c06a7810ULL, },
+ { 0x6c0d16b0abc5a956ULL, 0xa0e943f2be82359cULL, },
+ { 0x8000000000000000ULL, 0x733fd25ea9a6d520ULL, }, /* 72 */
+ { 0xa818af0e07635288ULL, 0x3ad08219c06a7810ULL, },
+ { 0x8000000000000000ULL, 0x4fb18dff56564a28ULL, },
+ { 0x1ca9c4f818016dceULL, 0xb5ca4fd8546e07b4ULL, },
+ { 0xf8b9fd198694378eULL, 0xd9589437a7be92acULL, },
+ { 0x6c0d16b0abc5a956ULL, 0xa0e943f2be82359cULL, },
+};
+
+ gettimeofday(&start, NULL);
+
+ for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) {
+ do_msa_ADDS_S_D(b128_pattern[i], b128_pattern[j],
+ b128_result[PATTERN_INPUTS_SHORT_COUNT * i + j]);
+ }
+ }
+
+ for (i = 0; i < RANDOM_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < RANDOM_INPUTS_SHORT_COUNT; j++) {
+ do_msa_ADDS_S_D(b128_random[i], b128_random[j],
+ b128_result[((PATTERN_INPUTS_SHORT_COUNT) *
+ (PATTERN_INPUTS_SHORT_COUNT)) +
+ RANDOM_INPUTS_SHORT_COUNT * i + j]);
+ }
+ }
+
+ gettimeofday(&end, NULL);
+
+ elapsed_time = (end.tv_sec - start.tv_sec) * 1000.0;
+ elapsed_time += (end.tv_usec - start.tv_usec) / 1000.0;
+
+ ret = check_results(instruction_name, TEST_COUNT_TOTAL, elapsed_time,
+ &b128_result[0][0], &b128_expect[0][0]);
+
+ return ret;
+}
diff --git a/tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_s_h.c b/tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_s_h.c
new file mode 100644
index 0000000..eb5afe1
--- /dev/null
+++ b/tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_s_h.c
@@ -0,0 +1,151 @@
+/*
+ * Test program for MSA instruction ADDS_S.H
+ *
+ * Copyright (C) 2018 Wave Computing, Inc.
+ * Copyright (C) 2018 Aleksandar Markovic <amarkovic@wavecomp.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
+#include <sys/time.h>
+#include <stdint.h>
+
+#include "../../../../include/wrappers_msa.h"
+#include "../../../../include/test_inputs.h"
+#include "../../../../include/test_utils.h"
+
+#define TEST_COUNT_TOTAL ( \
+ (PATTERN_INPUTS_SHORT_COUNT) * (PATTERN_INPUTS_SHORT_COUNT) + \
+ (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT))
+
+
+int32_t main(void)
+{
+ char *instruction_name = "ADDS_S.H";
+ int32_t ret;
+ uint32_t i, j;
+ struct timeval start, end;
+ double elapsed_time;
+
+ uint64_t b128_result[TEST_COUNT_TOTAL][2];
+ uint64_t b128_expect[TEST_COUNT_TOTAL][2] = {
+ { 0xfffefffefffefffeULL, 0xfffefffefffefffeULL, }, /* 0 */
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xaaa9aaa9aaa9aaa9ULL, 0xaaa9aaa9aaa9aaa9ULL, },
+ { 0x5554555455545554ULL, 0x5554555455545554ULL, },
+ { 0xcccbcccbcccbcccbULL, 0xcccbcccbcccbcccbULL, },
+ { 0x3332333233323332ULL, 0x3332333233323332ULL, },
+ { 0xe38d38e28e37e38dULL, 0x38e28e37e38d38e2ULL, },
+ { 0x1c70c71b71c61c70ULL, 0xc71b71c61c70c71bULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 8 */
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, },
+ { 0x5555555555555555ULL, 0x5555555555555555ULL, },
+ { 0xccccccccccccccccULL, 0xccccccccccccccccULL, },
+ { 0x3333333333333333ULL, 0x3333333333333333ULL, },
+ { 0xe38e38e38e38e38eULL, 0x38e38e38e38e38e3ULL, },
+ { 0x1c71c71c71c71c71ULL, 0xc71c71c71c71c71cULL, },
+ { 0xaaa9aaa9aaa9aaa9ULL, 0xaaa9aaa9aaa9aaa9ULL, }, /* 16 */
+ { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, },
+ { 0x8000800080008000ULL, 0x8000800080008000ULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0x8000800080008000ULL, 0x8000800080008000ULL, },
+ { 0xddddddddddddddddULL, 0xddddddddddddddddULL, },
+ { 0x8e38e38d80008e38ULL, 0xe38d80008e38e38dULL, },
+ { 0xc71b80001c71c71bULL, 0x80001c71c71b8000ULL, },
+ { 0x5554555455545554ULL, 0x5554555455545554ULL, }, /* 24 */
+ { 0x5555555555555555ULL, 0x5555555555555555ULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0x7fff7fff7fff7fffULL, 0x7fff7fff7fff7fffULL, },
+ { 0x2221222122212221ULL, 0x2221222122212221ULL, },
+ { 0x7fff7fff7fff7fffULL, 0x7fff7fff7fff7fffULL, },
+ { 0x38e37fffe38d38e3ULL, 0x7fffe38d38e37fffULL, },
+ { 0x71c61c717fff71c6ULL, 0x1c717fff71c61c71ULL, },
+ { 0xcccbcccbcccbcccbULL, 0xcccbcccbcccbcccbULL, }, /* 32 */
+ { 0xccccccccccccccccULL, 0xccccccccccccccccULL, },
+ { 0x8000800080008000ULL, 0x8000800080008000ULL, },
+ { 0x2221222122212221ULL, 0x2221222122212221ULL, },
+ { 0x9998999899989998ULL, 0x9998999899989998ULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xb05a05af8000b05aULL, 0x05af8000b05a05afULL, },
+ { 0xe93d93e83e93e93dULL, 0x93e83e93e93d93e8ULL, },
+ { 0x3332333233323332ULL, 0x3332333233323332ULL, }, /* 40 */
+ { 0x3333333333333333ULL, 0x3333333333333333ULL, },
+ { 0xddddddddddddddddULL, 0xddddddddddddddddULL, },
+ { 0x7fff7fff7fff7fffULL, 0x7fff7fff7fff7fffULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0x6666666666666666ULL, 0x6666666666666666ULL, },
+ { 0x16c16c16c16b16c1ULL, 0x6c16c16b16c16c16ULL, },
+ { 0x4fa4fa4f7fff4fa4ULL, 0xfa4f7fff4fa4fa4fULL, },
+ { 0xe38d38e28e37e38dULL, 0x38e28e37e38d38e2ULL, }, /* 48 */
+ { 0xe38e38e38e38e38eULL, 0x38e38e38e38e38e3ULL, },
+ { 0x8e38e38d80008e38ULL, 0xe38d80008e38e38dULL, },
+ { 0x38e37fffe38d38e3ULL, 0x7fffe38d38e37fffULL, },
+ { 0xb05a05af8000b05aULL, 0x05af8000b05a05afULL, },
+ { 0x16c16c16c16b16c1ULL, 0x6c16c16b16c16c16ULL, },
+ { 0xc71c71c68000c71cULL, 0x71c68000c71c71c6ULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0x1c70c71b71c61c70ULL, 0xc71b71c61c70c71bULL, }, /* 56 */
+ { 0x1c71c71c71c71c71ULL, 0xc71c71c71c71c71cULL, },
+ { 0xc71b80001c71c71bULL, 0x80001c71c71b8000ULL, },
+ { 0x71c61c717fff71c6ULL, 0x1c717fff71c61c71ULL, },
+ { 0xe93d93e83e93e93dULL, 0x93e83e93e93d93e8ULL, },
+ { 0x4fa4fa4f7fff4fa4ULL, 0xfa4f7fff4fa4fa4fULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0x38e28e387fff38e2ULL, 0x8e387fff38e28e38ULL, },
+ { 0x8000cd9850c47fffULL, 0x7fff16bcfcf68000ULL, }, /* 64 */
+ { 0x8428e72f75f51c48ULL, 0x5e5ec67813ba0308ULL, },
+ { 0x80009576e231e0c0ULL, 0x733fd25da9a6d520ULL, },
+ { 0xf8b9fd197fff378eULL, 0xd9589436a7bd92acULL, },
+ { 0x8428e72f75f51c48ULL, 0x5e5ec67813ba0308ULL, },
+ { 0xf77c00c67fff8e10ULL, 0x25ee80002a7e7fffULL, },
+ { 0xa818af0d07628000ULL, 0x3acf8219c06a7810ULL, },
+ { 0x6c0d16b07fffa956ULL, 0xa0e88000be81359cULL, },
+ { 0x80009576e231e0c0ULL, 0x733fd25da9a6d520ULL, }, /* 72 */
+ { 0xa818af0d07628000ULL, 0x3acf8219c06a7810ULL, },
+ { 0x8000800080008000ULL, 0x4fb08dfe80004a28ULL, },
+ { 0x1ca9c4f718008000ULL, 0xb5c98000800007b4ULL, },
+ { 0xf8b9fd197fff378eULL, 0xd9589436a7bd92acULL, },
+ { 0x6c0d16b07fffa956ULL, 0xa0e88000be81359cULL, },
+};
+
+ gettimeofday(&start, NULL);
+
+ for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) {
+ do_msa_ADDS_S_H(b128_pattern[i], b128_pattern[j],
+ b128_result[PATTERN_INPUTS_SHORT_COUNT * i + j]);
+ }
+ }
+
+ for (i = 0; i < RANDOM_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < RANDOM_INPUTS_SHORT_COUNT; j++) {
+ do_msa_ADDS_S_H(b128_random[i], b128_random[j],
+ b128_result[((PATTERN_INPUTS_SHORT_COUNT) *
+ (PATTERN_INPUTS_SHORT_COUNT)) +
+ RANDOM_INPUTS_SHORT_COUNT * i + j]);
+ }
+ }
+
+ gettimeofday(&end, NULL);
+
+ elapsed_time = (end.tv_sec - start.tv_sec) * 1000.0;
+ elapsed_time += (end.tv_usec - start.tv_usec) / 1000.0;
+
+ ret = check_results(instruction_name, TEST_COUNT_TOTAL, elapsed_time,
+ &b128_result[0][0], &b128_expect[0][0]);
+
+ return ret;
+}
diff --git a/tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_s_w.c b/tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_s_w.c
new file mode 100644
index 0000000..3e1aa30
--- /dev/null
+++ b/tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_s_w.c
@@ -0,0 +1,151 @@
+/*
+ * Test program for MSA instruction ADDS_S.W
+ *
+ * Copyright (C) 2018 Wave Computing, Inc.
+ * Copyright (C) 2018 Aleksandar Markovic <amarkovic@wavecomp.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
+#include <sys/time.h>
+#include <stdint.h>
+
+#include "../../../../include/wrappers_msa.h"
+#include "../../../../include/test_inputs.h"
+#include "../../../../include/test_utils.h"
+
+#define TEST_COUNT_TOTAL ( \
+ (PATTERN_INPUTS_SHORT_COUNT) * (PATTERN_INPUTS_SHORT_COUNT) + \
+ (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT))
+
+
+int32_t main(void)
+{
+ char *instruction_name = "ADDS_S.W";
+ int32_t ret;
+ uint32_t i, j;
+ struct timeval start, end;
+ double elapsed_time;
+
+ uint64_t b128_result[TEST_COUNT_TOTAL][2];
+ uint64_t b128_expect[TEST_COUNT_TOTAL][2] = {
+ { 0xfffffffefffffffeULL, 0xfffffffefffffffeULL, }, /* 0 */
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xaaaaaaa9aaaaaaa9ULL, 0xaaaaaaa9aaaaaaa9ULL, },
+ { 0x5555555455555554ULL, 0x5555555455555554ULL, },
+ { 0xcccccccbcccccccbULL, 0xcccccccbcccccccbULL, },
+ { 0x3333333233333332ULL, 0x3333333233333332ULL, },
+ { 0xe38e38e28e38e38dULL, 0x38e38e37e38e38e2ULL, },
+ { 0x1c71c71b71c71c70ULL, 0xc71c71c61c71c71bULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 8 */
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, },
+ { 0x5555555555555555ULL, 0x5555555555555555ULL, },
+ { 0xccccccccccccccccULL, 0xccccccccccccccccULL, },
+ { 0x3333333333333333ULL, 0x3333333333333333ULL, },
+ { 0xe38e38e38e38e38eULL, 0x38e38e38e38e38e3ULL, },
+ { 0x1c71c71c71c71c71ULL, 0xc71c71c71c71c71cULL, },
+ { 0xaaaaaaa9aaaaaaa9ULL, 0xaaaaaaa9aaaaaaa9ULL, }, /* 16 */
+ { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, },
+ { 0x8000000080000000ULL, 0x8000000080000000ULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0x8000000080000000ULL, 0x8000000080000000ULL, },
+ { 0xddddddddddddddddULL, 0xddddddddddddddddULL, },
+ { 0x8e38e38d80000000ULL, 0xe38e38e28e38e38dULL, },
+ { 0xc71c71c61c71c71bULL, 0x80000000c71c71c6ULL, },
+ { 0x5555555455555554ULL, 0x5555555455555554ULL, }, /* 24 */
+ { 0x5555555555555555ULL, 0x5555555555555555ULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0x7fffffff7fffffffULL, 0x7fffffff7fffffffULL, },
+ { 0x2222222122222221ULL, 0x2222222122222221ULL, },
+ { 0x7fffffff7fffffffULL, 0x7fffffff7fffffffULL, },
+ { 0x38e38e38e38e38e3ULL, 0x7fffffff38e38e38ULL, },
+ { 0x71c71c717fffffffULL, 0x1c71c71c71c71c71ULL, },
+ { 0xcccccccbcccccccbULL, 0xcccccccbcccccccbULL, }, /* 32 */
+ { 0xccccccccccccccccULL, 0xccccccccccccccccULL, },
+ { 0x8000000080000000ULL, 0x8000000080000000ULL, },
+ { 0x2222222122222221ULL, 0x2222222122222221ULL, },
+ { 0x9999999899999998ULL, 0x9999999899999998ULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xb05b05af80000000ULL, 0x05b05b04b05b05afULL, },
+ { 0xe93e93e83e93e93dULL, 0x93e93e93e93e93e8ULL, },
+ { 0x3333333233333332ULL, 0x3333333233333332ULL, }, /* 40 */
+ { 0x3333333333333333ULL, 0x3333333333333333ULL, },
+ { 0xddddddddddddddddULL, 0xddddddddddddddddULL, },
+ { 0x7fffffff7fffffffULL, 0x7fffffff7fffffffULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0x6666666666666666ULL, 0x6666666666666666ULL, },
+ { 0x16c16c16c16c16c1ULL, 0x6c16c16b16c16c16ULL, },
+ { 0x4fa4fa4f7fffffffULL, 0xfa4fa4fa4fa4fa4fULL, },
+ { 0xe38e38e28e38e38dULL, 0x38e38e37e38e38e2ULL, }, /* 48 */
+ { 0xe38e38e38e38e38eULL, 0x38e38e38e38e38e3ULL, },
+ { 0x8e38e38d80000000ULL, 0xe38e38e28e38e38dULL, },
+ { 0x38e38e38e38e38e3ULL, 0x7fffffff38e38e38ULL, },
+ { 0xb05b05af80000000ULL, 0x05b05b04b05b05afULL, },
+ { 0x16c16c16c16c16c1ULL, 0x6c16c16b16c16c16ULL, },
+ { 0xc71c71c680000000ULL, 0x71c71c70c71c71c6ULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0x1c71c71b71c71c70ULL, 0xc71c71c61c71c71bULL, }, /* 56 */
+ { 0x1c71c71c71c71c71ULL, 0xc71c71c71c71c71cULL, },
+ { 0xc71c71c61c71c71bULL, 0x80000000c71c71c6ULL, },
+ { 0x71c71c717fffffffULL, 0x1c71c71c71c71c71ULL, },
+ { 0xe93e93e83e93e93dULL, 0x93e93e93e93e93e8ULL, },
+ { 0x4fa4fa4f7fffffffULL, 0xfa4fa4fa4fa4fa4fULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0x38e38e387fffffffULL, 0x8e38e38e38e38e38ULL, },
+ { 0x8000000050c4aa80ULL, 0x7ffffffffcf76018ULL, }, /* 64 */
+ { 0x8428e72f75f61c48ULL, 0x5e5ec67813bb0308ULL, },
+ { 0x80000000e231e0c0ULL, 0x733fd25da9a6d520ULL, },
+ { 0xf8b9fd197fffffffULL, 0xd9589436a7be92acULL, },
+ { 0x8428e72f75f61c48ULL, 0x5e5ec67813bb0308ULL, },
+ { 0xf77c00c67fffffffULL, 0x25ef76342a7ea5f8ULL, },
+ { 0xa818af0d07635288ULL, 0x3ad08219c06a7810ULL, },
+ { 0x6c0d16b07fffffffULL, 0xa0e943f2be82359cULL, },
+ { 0x80000000e231e0c0ULL, 0x733fd25da9a6d520ULL, }, /* 72 */
+ { 0xa818af0d07635288ULL, 0x3ad08219c06a7810ULL, },
+ { 0x8000000080000000ULL, 0x4fb18dfe80000000ULL, },
+ { 0x1ca9c4f718016dceULL, 0xb5ca4fd780000000ULL, },
+ { 0xf8b9fd197fffffffULL, 0xd9589436a7be92acULL, },
+ { 0x6c0d16b07fffffffULL, 0xa0e943f2be82359cULL, },
+};
+
+ gettimeofday(&start, NULL);
+
+ for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) {
+ do_msa_ADDS_S_W(b128_pattern[i], b128_pattern[j],
+ b128_result[PATTERN_INPUTS_SHORT_COUNT * i + j]);
+ }
+ }
+
+ for (i = 0; i < RANDOM_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < RANDOM_INPUTS_SHORT_COUNT; j++) {
+ do_msa_ADDS_S_W(b128_random[i], b128_random[j],
+ b128_result[((PATTERN_INPUTS_SHORT_COUNT) *
+ (PATTERN_INPUTS_SHORT_COUNT)) +
+ RANDOM_INPUTS_SHORT_COUNT * i + j]);
+ }
+ }
+
+ gettimeofday(&end, NULL);
+
+ elapsed_time = (end.tv_sec - start.tv_sec) * 1000.0;
+ elapsed_time += (end.tv_usec - start.tv_usec) / 1000.0;
+
+ ret = check_results(instruction_name, TEST_COUNT_TOTAL, elapsed_time,
+ &b128_result[0][0], &b128_expect[0][0]);
+
+ return ret;
+}
diff --git a/tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_u_b.c b/tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_u_b.c
new file mode 100644
index 0000000..995da29
--- /dev/null
+++ b/tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_u_b.c
@@ -0,0 +1,151 @@
+/*
+ * Test program for MSA instruction ADDS_U.B
+ *
+ * Copyright (C) 2018 Wave Computing, Inc.
+ * Copyright (C) 2018 Aleksandar Markovic <amarkovic@wavecomp.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
+#include <sys/time.h>
+#include <stdint.h>
+
+#include "../../../../include/wrappers_msa.h"
+#include "../../../../include/test_inputs.h"
+#include "../../../../include/test_utils.h"
+
+#define TEST_COUNT_TOTAL ( \
+ (PATTERN_INPUTS_SHORT_COUNT) * (PATTERN_INPUTS_SHORT_COUNT) + \
+ (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT))
+
+
+int32_t main(void)
+{
+ char *instruction_name = "ADDS_U.B";
+ int32_t ret;
+ uint32_t i, j;
+ struct timeval start, end;
+ double elapsed_time;
+
+ uint64_t b128_result[TEST_COUNT_TOTAL][2];
+ uint64_t b128_expect[TEST_COUNT_TOTAL][2] = {
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 0 */
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 8 */
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, },
+ { 0x5555555555555555ULL, 0x5555555555555555ULL, },
+ { 0xccccccccccccccccULL, 0xccccccccccccccccULL, },
+ { 0x3333333333333333ULL, 0x3333333333333333ULL, },
+ { 0xe38e38e38e38e38eULL, 0x38e38e38e38e38e3ULL, },
+ { 0x1c71c71c71c71c71ULL, 0xc71c71c71c71c71cULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 16 */
+ { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xddddddddddddddddULL, 0xddddddddddddddddULL, },
+ { 0xffffe2ffffe2ffffULL, 0xe2ffffe2ffffe2ffULL, },
+ { 0xc6ffffc6ffffc6ffULL, 0xffc6ffffc6ffffc6ULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 24 */
+ { 0x5555555555555555ULL, 0x5555555555555555ULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0x8888888888888888ULL, 0x8888888888888888ULL, },
+ { 0xffe38dffe38dffe3ULL, 0x8dffe38dffe38dffULL, },
+ { 0x71c6ff71c6ff71c6ULL, 0xff71c6ff71c6ff71ULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 32 */
+ { 0xccccccccccccccccULL, 0xccccccccccccccccULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xe8ffffe8ffffe8ffULL, 0xffe8ffffe8ffffe8ULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 40 */
+ { 0x3333333333333333ULL, 0x3333333333333333ULL, },
+ { 0xddddddddddddddddULL, 0xddddddddddddddddULL, },
+ { 0x8888888888888888ULL, 0x8888888888888888ULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0x6666666666666666ULL, 0x6666666666666666ULL, },
+ { 0xffc16bffc16bffc1ULL, 0x6bffc16bffc16bffULL, },
+ { 0x4fa4fa4fa4fa4fa4ULL, 0xfa4fa4fa4fa4fa4fULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 48 */
+ { 0xe38e38e38e38e38eULL, 0x38e38e38e38e38e3ULL, },
+ { 0xffffe2ffffe2ffffULL, 0xe2ffffe2ffffe2ffULL, },
+ { 0xffe38dffe38dffe3ULL, 0x8dffe38dffe38dffULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xffc16bffc16bffc1ULL, 0x6bffc16bffc16bffULL, },
+ { 0xffff70ffff70ffffULL, 0x70ffff70ffff70ffULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 56 */
+ { 0x1c71c71c71c71c71ULL, 0xc71c71c71c71c71cULL, },
+ { 0xc6ffffc6ffffc6ffULL, 0xffc6ffffc6ffffc6ULL, },
+ { 0x71c6ff71c6ff71c6ULL, 0xff71c6ff71c6ff71ULL, },
+ { 0xe8ffffe8ffffe8ffULL, 0xffe8ffffe8ffffe8ULL, },
+ { 0x4fa4fa4fa4fa4fa4ULL, 0xfa4fa4fa4fa4fa4fULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0x38e2ff38e2ff38e2ULL, 0xff38e2ff38e2ff38ULL, },
+ { 0xffd4ffff50c4aa80ULL, 0x96ce16bcfff6ff18ULL, }, /* 64 */
+ { 0xffffe6ff75f5ff48ULL, 0x5dffc678ffbaffffULL, },
+ { 0xffc4ffffe1ffe0c0ULL, 0x72ffd1ffffa6d520ULL, },
+ { 0xf8b9fcff8693ff8eULL, 0xd8ff93ffffbdffacULL, },
+ { 0xffffe6ff75f5ff48ULL, 0x5dffc678ffbaffffULL, },
+ { 0xffff00c69affff10ULL, 0x24ffff342a7ea4ffULL, },
+ { 0xffffaeffffffff88ULL, 0x39ffffffc06a77ffULL, },
+ { 0xffff16b0abc4ff56ULL, 0x9ffffff2be81ffffULL, },
+ { 0xffc4ffffe1ffe0c0ULL, 0x72ffd1ffffa6d520ULL, }, /* 72 */
+ { 0xffffaeffffffff88ULL, 0x39ffffffc06a77ffULL, },
+ { 0xffb4ffffffffffffULL, 0x4effffffff564a28ULL, },
+ { 0xffa9c4f7ffffffceULL, 0xb4ffffffff6dffb4ULL, },
+ { 0xf8b9fcff8693ff8eULL, 0xd8ff93ffffbdffacULL, },
+ { 0xffff16b0abc4ff56ULL, 0x9ffffff2be81ffffULL, },
+};
+
+ gettimeofday(&start, NULL);
+
+ for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) {
+ do_msa_ADDS_U_B(b128_pattern[i], b128_pattern[j],
+ b128_result[PATTERN_INPUTS_SHORT_COUNT * i + j]);
+ }
+ }
+
+ for (i = 0; i < RANDOM_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < RANDOM_INPUTS_SHORT_COUNT; j++) {
+ do_msa_ADDS_U_B(b128_random[i], b128_random[j],
+ b128_result[((PATTERN_INPUTS_SHORT_COUNT) *
+ (PATTERN_INPUTS_SHORT_COUNT)) +
+ RANDOM_INPUTS_SHORT_COUNT * i + j]);
+ }
+ }
+
+ gettimeofday(&end, NULL);
+
+ elapsed_time = (end.tv_sec - start.tv_sec) * 1000.0;
+ elapsed_time += (end.tv_usec - start.tv_usec) / 1000.0;
+
+ ret = check_results(instruction_name, TEST_COUNT_TOTAL, elapsed_time,
+ &b128_result[0][0], &b128_expect[0][0]);
+
+ return ret;
+}
diff --git a/tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_u_d.c b/tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_u_d.c
new file mode 100644
index 0000000..2e32380
--- /dev/null
+++ b/tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_u_d.c
@@ -0,0 +1,151 @@
+/*
+ * Test program for MSA instruction ADDS_U.D
+ *
+ * Copyright (C) 2018 Wave Computing, Inc.
+ * Copyright (C) 2018 Aleksandar Markovic <amarkovic@wavecomp.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
+#include <sys/time.h>
+#include <stdint.h>
+
+#include "../../../../include/wrappers_msa.h"
+#include "../../../../include/test_inputs.h"
+#include "../../../../include/test_utils.h"
+
+#define TEST_COUNT_TOTAL ( \
+ (PATTERN_INPUTS_SHORT_COUNT) * (PATTERN_INPUTS_SHORT_COUNT) + \
+ (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT))
+
+
+int32_t main(void)
+{
+ char *instruction_name = "ADDS_U.D";
+ int32_t ret;
+ uint32_t i, j;
+ struct timeval start, end;
+ double elapsed_time;
+
+ uint64_t b128_result[TEST_COUNT_TOTAL][2];
+ uint64_t b128_expect[TEST_COUNT_TOTAL][2] = {
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 0 */
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 8 */
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, },
+ { 0x5555555555555555ULL, 0x5555555555555555ULL, },
+ { 0xccccccccccccccccULL, 0xccccccccccccccccULL, },
+ { 0x3333333333333333ULL, 0x3333333333333333ULL, },
+ { 0xe38e38e38e38e38eULL, 0x38e38e38e38e38e3ULL, },
+ { 0x1c71c71c71c71c71ULL, 0xc71c71c71c71c71cULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 16 */
+ { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xddddddddddddddddULL, 0xddddddddddddddddULL, },
+ { 0xffffffffffffffffULL, 0xe38e38e38e38e38dULL, },
+ { 0xc71c71c71c71c71bULL, 0xffffffffffffffffULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 24 */
+ { 0x5555555555555555ULL, 0x5555555555555555ULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0x8888888888888888ULL, 0x8888888888888888ULL, },
+ { 0xffffffffffffffffULL, 0x8e38e38e38e38e38ULL, },
+ { 0x71c71c71c71c71c6ULL, 0xffffffffffffffffULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 32 */
+ { 0xccccccccccccccccULL, 0xccccccccccccccccULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xe93e93e93e93e93dULL, 0xffffffffffffffffULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 40 */
+ { 0x3333333333333333ULL, 0x3333333333333333ULL, },
+ { 0xddddddddddddddddULL, 0xddddddddddddddddULL, },
+ { 0x8888888888888888ULL, 0x8888888888888888ULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0x6666666666666666ULL, 0x6666666666666666ULL, },
+ { 0xffffffffffffffffULL, 0x6c16c16c16c16c16ULL, },
+ { 0x4fa4fa4fa4fa4fa4ULL, 0xfa4fa4fa4fa4fa4fULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 48 */
+ { 0xe38e38e38e38e38eULL, 0x38e38e38e38e38e3ULL, },
+ { 0xffffffffffffffffULL, 0xe38e38e38e38e38dULL, },
+ { 0xffffffffffffffffULL, 0x8e38e38e38e38e38ULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xffffffffffffffffULL, 0x6c16c16c16c16c16ULL, },
+ { 0xffffffffffffffffULL, 0x71c71c71c71c71c6ULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 56 */
+ { 0x1c71c71c71c71c71ULL, 0xc71c71c71c71c71cULL, },
+ { 0xc71c71c71c71c71bULL, 0xffffffffffffffffULL, },
+ { 0x71c71c71c71c71c6ULL, 0xffffffffffffffffULL, },
+ { 0xe93e93e93e93e93dULL, 0xffffffffffffffffULL, },
+ { 0x4fa4fa4fa4fa4fa4ULL, 0xfa4fa4fa4fa4fa4fULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0x38e38e38e38e38e2ULL, 0xffffffffffffffffULL, },
+ { 0xffffffffffffffffULL, 0x96ce16bdfcf76018ULL, }, /* 64 */
+ { 0xffffffffffffffffULL, 0x5e5ec67913bb0308ULL, },
+ { 0xffffffffffffffffULL, 0x733fd25ea9a6d520ULL, },
+ { 0xf8b9fd198694378eULL, 0xd9589437a7be92acULL, },
+ { 0xffffffffffffffffULL, 0x5e5ec67913bb0308ULL, },
+ { 0xffffffffffffffffULL, 0x25ef76342a7ea5f8ULL, },
+ { 0xffffffffffffffffULL, 0x3ad08219c06a7810ULL, },
+ { 0xffffffffffffffffULL, 0xa0e943f2be82359cULL, },
+ { 0xffffffffffffffffULL, 0x733fd25ea9a6d520ULL, }, /* 72 */
+ { 0xffffffffffffffffULL, 0x3ad08219c06a7810ULL, },
+ { 0xffffffffffffffffULL, 0x4fb18dff56564a28ULL, },
+ { 0xffffffffffffffffULL, 0xb5ca4fd8546e07b4ULL, },
+ { 0xf8b9fd198694378eULL, 0xd9589437a7be92acULL, },
+ { 0xffffffffffffffffULL, 0xa0e943f2be82359cULL, },
+};
+
+ gettimeofday(&start, NULL);
+
+ for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) {
+ do_msa_ADDS_U_D(b128_pattern[i], b128_pattern[j],
+ b128_result[PATTERN_INPUTS_SHORT_COUNT * i + j]);
+ }
+ }
+
+ for (i = 0; i < RANDOM_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < RANDOM_INPUTS_SHORT_COUNT; j++) {
+ do_msa_ADDS_U_D(b128_random[i], b128_random[j],
+ b128_result[((PATTERN_INPUTS_SHORT_COUNT) *
+ (PATTERN_INPUTS_SHORT_COUNT)) +
+ RANDOM_INPUTS_SHORT_COUNT * i + j]);
+ }
+ }
+
+ gettimeofday(&end, NULL);
+
+ elapsed_time = (end.tv_sec - start.tv_sec) * 1000.0;
+ elapsed_time += (end.tv_usec - start.tv_usec) / 1000.0;
+
+ ret = check_results(instruction_name, TEST_COUNT_TOTAL, elapsed_time,
+ &b128_result[0][0], &b128_expect[0][0]);
+
+ return ret;
+}
diff --git a/tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_u_h.c b/tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_u_h.c
new file mode 100644
index 0000000..4c2e982
--- /dev/null
+++ b/tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_u_h.c
@@ -0,0 +1,151 @@
+/*
+ * Test program for MSA instruction ADDS_U.H
+ *
+ * Copyright (C) 2018 Wave Computing, Inc.
+ * Copyright (C) 2018 Aleksandar Markovic <amarkovic@wavecomp.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
+#include <sys/time.h>
+#include <stdint.h>
+
+#include "../../../../include/wrappers_msa.h"
+#include "../../../../include/test_inputs.h"
+#include "../../../../include/test_utils.h"
+
+#define TEST_COUNT_TOTAL ( \
+ (PATTERN_INPUTS_SHORT_COUNT) * (PATTERN_INPUTS_SHORT_COUNT) + \
+ (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT))
+
+
+int32_t main(void)
+{
+ char *instruction_name = "ADDS_U.H";
+ int32_t ret;
+ uint32_t i, j;
+ struct timeval start, end;
+ double elapsed_time;
+
+ uint64_t b128_result[TEST_COUNT_TOTAL][2];
+ uint64_t b128_expect[TEST_COUNT_TOTAL][2] = {
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 0 */
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 8 */
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, },
+ { 0x5555555555555555ULL, 0x5555555555555555ULL, },
+ { 0xccccccccccccccccULL, 0xccccccccccccccccULL, },
+ { 0x3333333333333333ULL, 0x3333333333333333ULL, },
+ { 0xe38e38e38e38e38eULL, 0x38e38e38e38e38e3ULL, },
+ { 0x1c71c71c71c71c71ULL, 0xc71c71c71c71c71cULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 16 */
+ { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xddddddddddddddddULL, 0xddddddddddddddddULL, },
+ { 0xffffe38dffffffffULL, 0xe38dffffffffe38dULL, },
+ { 0xc71bffffffffc71bULL, 0xffffffffc71bffffULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 24 */
+ { 0x5555555555555555ULL, 0x5555555555555555ULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0x8888888888888888ULL, 0x8888888888888888ULL, },
+ { 0xffff8e38e38dffffULL, 0x8e38e38dffff8e38ULL, },
+ { 0x71c6ffffc71c71c6ULL, 0xffffc71c71c6ffffULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 32 */
+ { 0xccccccccccccccccULL, 0xccccccccccccccccULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xe93dffffffffe93dULL, 0xffffffffe93dffffULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 40 */
+ { 0x3333333333333333ULL, 0x3333333333333333ULL, },
+ { 0xddddddddddddddddULL, 0xddddddddddddddddULL, },
+ { 0x8888888888888888ULL, 0x8888888888888888ULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0x6666666666666666ULL, 0x6666666666666666ULL, },
+ { 0xffff6c16c16bffffULL, 0x6c16c16bffff6c16ULL, },
+ { 0x4fa4fa4fa4fa4fa4ULL, 0xfa4fa4fa4fa4fa4fULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 48 */
+ { 0xe38e38e38e38e38eULL, 0x38e38e38e38e38e3ULL, },
+ { 0xffffe38dffffffffULL, 0xe38dffffffffe38dULL, },
+ { 0xffff8e38e38dffffULL, 0x8e38e38dffff8e38ULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xffff6c16c16bffffULL, 0x6c16c16bffff6c16ULL, },
+ { 0xffff71c6ffffffffULL, 0x71c6ffffffff71c6ULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 56 */
+ { 0x1c71c71c71c71c71ULL, 0xc71c71c71c71c71cULL, },
+ { 0xc71bffffffffc71bULL, 0xffffffffc71bffffULL, },
+ { 0x71c6ffffc71c71c6ULL, 0xffffc71c71c6ffffULL, },
+ { 0xe93dffffffffe93dULL, 0xffffffffe93dffffULL, },
+ { 0x4fa4fa4fa4fa4fa4ULL, 0xfa4fa4fa4fa4fa4fULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0x38e2ffffe38e38e2ULL, 0xffffe38e38e2ffffULL, },
+ { 0xffffffff50c4aa80ULL, 0x96ce16bcffffffffULL, }, /* 64 */
+ { 0xffffe72f75f5ffffULL, 0x5e5ec678ffffffffULL, },
+ { 0xffffffffe231e0c0ULL, 0x733fd25dffffd520ULL, },
+ { 0xf8b9fd198693ffffULL, 0xd9589436ffffffffULL, },
+ { 0xffffe72f75f5ffffULL, 0x5e5ec678ffffffffULL, },
+ { 0xffff00c69b26ffffULL, 0x25eeffff2a7ea5f8ULL, },
+ { 0xffffaf0dffffffffULL, 0x3acfffffc06a7810ULL, },
+ { 0xffff16b0abc4ffffULL, 0xa0e8ffffbe81ffffULL, },
+ { 0xffffffffe231e0c0ULL, 0x733fd25dffffd520ULL, }, /* 72 */
+ { 0xffffaf0dffffffffULL, 0x3acfffffc06a7810ULL, },
+ { 0xffffffffffffffffULL, 0x4fb0ffffffff4a28ULL, },
+ { 0xffffc4f7ffffffffULL, 0xb5c9ffffffffffffULL, },
+ { 0xf8b9fd198693ffffULL, 0xd9589436ffffffffULL, },
+ { 0xffff16b0abc4ffffULL, 0xa0e8ffffbe81ffffULL, },
+};
+
+ gettimeofday(&start, NULL);
+
+ for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) {
+ do_msa_ADDS_U_H(b128_pattern[i], b128_pattern[j],
+ b128_result[PATTERN_INPUTS_SHORT_COUNT * i + j]);
+ }
+ }
+
+ for (i = 0; i < RANDOM_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < RANDOM_INPUTS_SHORT_COUNT; j++) {
+ do_msa_ADDS_U_H(b128_random[i], b128_random[j],
+ b128_result[((PATTERN_INPUTS_SHORT_COUNT) *
+ (PATTERN_INPUTS_SHORT_COUNT)) +
+ RANDOM_INPUTS_SHORT_COUNT * i + j]);
+ }
+ }
+
+ gettimeofday(&end, NULL);
+
+ elapsed_time = (end.tv_sec - start.tv_sec) * 1000.0;
+ elapsed_time += (end.tv_usec - start.tv_usec) / 1000.0;
+
+ ret = check_results(instruction_name, TEST_COUNT_TOTAL, elapsed_time,
+ &b128_result[0][0], &b128_expect[0][0]);
+
+ return ret;
+}
diff --git a/tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_u_w.c b/tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_u_w.c
new file mode 100644
index 0000000..8cf0741
--- /dev/null
+++ b/tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_u_w.c
@@ -0,0 +1,151 @@
+/*
+ * Test program for MSA instruction ADDS_U.W
+ *
+ * Copyright (C) 2018 Wave Computing, Inc.
+ * Copyright (C) 2018 Aleksandar Markovic <amarkovic@wavecomp.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
+#include <sys/time.h>
+#include <stdint.h>
+
+#include "../../../../include/wrappers_msa.h"
+#include "../../../../include/test_inputs.h"
+#include "../../../../include/test_utils.h"
+
+#define TEST_COUNT_TOTAL ( \
+ (PATTERN_INPUTS_SHORT_COUNT) * (PATTERN_INPUTS_SHORT_COUNT) + \
+ (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT))
+
+
+int32_t main(void)
+{
+ char *instruction_name = "ADDS_U.W";
+ int32_t ret;
+ uint32_t i, j;
+ struct timeval start, end;
+ double elapsed_time;
+
+ uint64_t b128_result[TEST_COUNT_TOTAL][2];
+ uint64_t b128_expect[TEST_COUNT_TOTAL][2] = {
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 0 */
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 8 */
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, },
+ { 0x5555555555555555ULL, 0x5555555555555555ULL, },
+ { 0xccccccccccccccccULL, 0xccccccccccccccccULL, },
+ { 0x3333333333333333ULL, 0x3333333333333333ULL, },
+ { 0xe38e38e38e38e38eULL, 0x38e38e38e38e38e3ULL, },
+ { 0x1c71c71c71c71c71ULL, 0xc71c71c71c71c71cULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 16 */
+ { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xddddddddddddddddULL, 0xddddddddddddddddULL, },
+ { 0xffffffffffffffffULL, 0xe38e38e2ffffffffULL, },
+ { 0xc71c71c6ffffffffULL, 0xffffffffc71c71c6ULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 24 */
+ { 0x5555555555555555ULL, 0x5555555555555555ULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0x8888888888888888ULL, 0x8888888888888888ULL, },
+ { 0xffffffffe38e38e3ULL, 0x8e38e38dffffffffULL, },
+ { 0x71c71c71c71c71c6ULL, 0xffffffff71c71c71ULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 32 */
+ { 0xccccccccccccccccULL, 0xccccccccccccccccULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xe93e93e8ffffffffULL, 0xffffffffe93e93e8ULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 40 */
+ { 0x3333333333333333ULL, 0x3333333333333333ULL, },
+ { 0xddddddddddddddddULL, 0xddddddddddddddddULL, },
+ { 0x8888888888888888ULL, 0x8888888888888888ULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0x6666666666666666ULL, 0x6666666666666666ULL, },
+ { 0xffffffffc16c16c1ULL, 0x6c16c16bffffffffULL, },
+ { 0x4fa4fa4fa4fa4fa4ULL, 0xfa4fa4fa4fa4fa4fULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 48 */
+ { 0xe38e38e38e38e38eULL, 0x38e38e38e38e38e3ULL, },
+ { 0xffffffffffffffffULL, 0xe38e38e2ffffffffULL, },
+ { 0xffffffffe38e38e3ULL, 0x8e38e38dffffffffULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xffffffffc16c16c1ULL, 0x6c16c16bffffffffULL, },
+ { 0xffffffffffffffffULL, 0x71c71c70ffffffffULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 56 */
+ { 0x1c71c71c71c71c71ULL, 0xc71c71c71c71c71cULL, },
+ { 0xc71c71c6ffffffffULL, 0xffffffffc71c71c6ULL, },
+ { 0x71c71c71c71c71c6ULL, 0xffffffff71c71c71ULL, },
+ { 0xe93e93e8ffffffffULL, 0xffffffffe93e93e8ULL, },
+ { 0x4fa4fa4fa4fa4fa4ULL, 0xfa4fa4fa4fa4fa4fULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0x38e38e38e38e38e2ULL, 0xffffffff38e38e38ULL, },
+ { 0xffffffff50c4aa80ULL, 0x96ce16bcffffffffULL, }, /* 64 */
+ { 0xffffffff75f61c48ULL, 0x5e5ec678ffffffffULL, },
+ { 0xffffffffe231e0c0ULL, 0x733fd25dffffffffULL, },
+ { 0xf8b9fd198694378eULL, 0xd9589436ffffffffULL, },
+ { 0xffffffff75f61c48ULL, 0x5e5ec678ffffffffULL, },
+ { 0xffffffff9b278e10ULL, 0x25ef76342a7ea5f8ULL, },
+ { 0xffffffffffffffffULL, 0x3ad08219c06a7810ULL, },
+ { 0xffffffffabc5a956ULL, 0xa0e943f2be82359cULL, },
+ { 0xffffffffe231e0c0ULL, 0x733fd25dffffffffULL, }, /* 72 */
+ { 0xffffffffffffffffULL, 0x3ad08219c06a7810ULL, },
+ { 0xffffffffffffffffULL, 0x4fb18dfeffffffffULL, },
+ { 0xffffffffffffffffULL, 0xb5ca4fd7ffffffffULL, },
+ { 0xf8b9fd198694378eULL, 0xd9589436ffffffffULL, },
+ { 0xffffffffabc5a956ULL, 0xa0e943f2be82359cULL, },
+};
+
+ gettimeofday(&start, NULL);
+
+ for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) {
+ do_msa_ADDS_U_W(b128_pattern[i], b128_pattern[j],
+ b128_result[PATTERN_INPUTS_SHORT_COUNT * i + j]);
+ }
+ }
+
+ for (i = 0; i < RANDOM_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < RANDOM_INPUTS_SHORT_COUNT; j++) {
+ do_msa_ADDS_U_W(b128_random[i], b128_random[j],
+ b128_result[((PATTERN_INPUTS_SHORT_COUNT) *
+ (PATTERN_INPUTS_SHORT_COUNT)) +
+ RANDOM_INPUTS_SHORT_COUNT * i + j]);
+ }
+ }
+
+ gettimeofday(&end, NULL);
+
+ elapsed_time = (end.tv_sec - start.tv_sec) * 1000.0;
+ elapsed_time += (end.tv_usec - start.tv_usec) / 1000.0;
+
+ ret = check_results(instruction_name, TEST_COUNT_TOTAL, elapsed_time,
+ &b128_result[0][0], &b128_expect[0][0]);
+
+ return ret;
+}
diff --git a/tests/tcg/mips/user/ase/msa/int-add/test_msa_addv_b.c b/tests/tcg/mips/user/ase/msa/int-add/test_msa_addv_b.c
new file mode 100644
index 0000000..44d8921
--- /dev/null
+++ b/tests/tcg/mips/user/ase/msa/int-add/test_msa_addv_b.c
@@ -0,0 +1,151 @@
+/*
+ * Test program for MSA instruction ADDV.B
+ *
+ * Copyright (C) 2018 Wave Computing, Inc.
+ * Copyright (C) 2018 Aleksandar Markovic <amarkovic@wavecomp.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
+#include <sys/time.h>
+#include <stdint.h>
+
+#include "../../../../include/wrappers_msa.h"
+#include "../../../../include/test_inputs.h"
+#include "../../../../include/test_utils.h"
+
+#define TEST_COUNT_TOTAL ( \
+ (PATTERN_INPUTS_SHORT_COUNT) * (PATTERN_INPUTS_SHORT_COUNT) + \
+ (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT))
+
+
+int32_t main(void)
+{
+ char *instruction_name = "ADDV.B";
+ int32_t ret;
+ uint32_t i, j;
+ struct timeval start, end;
+ double elapsed_time;
+
+ uint64_t b128_result[TEST_COUNT_TOTAL][2];
+ uint64_t b128_expect[TEST_COUNT_TOTAL][2] = {
+ { 0xfefefefefefefefeULL, 0xfefefefefefefefeULL, }, /* 0 */
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xa9a9a9a9a9a9a9a9ULL, 0xa9a9a9a9a9a9a9a9ULL, },
+ { 0x5454545454545454ULL, 0x5454545454545454ULL, },
+ { 0xcbcbcbcbcbcbcbcbULL, 0xcbcbcbcbcbcbcbcbULL, },
+ { 0x3232323232323232ULL, 0x3232323232323232ULL, },
+ { 0xe28d37e28d37e28dULL, 0x37e28d37e28d37e2ULL, },
+ { 0x1b70c61b70c61b70ULL, 0xc61b70c61b70c61bULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 8 */
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, },
+ { 0x5555555555555555ULL, 0x5555555555555555ULL, },
+ { 0xccccccccccccccccULL, 0xccccccccccccccccULL, },
+ { 0x3333333333333333ULL, 0x3333333333333333ULL, },
+ { 0xe38e38e38e38e38eULL, 0x38e38e38e38e38e3ULL, },
+ { 0x1c71c71c71c71c71ULL, 0xc71c71c71c71c71cULL, },
+ { 0xa9a9a9a9a9a9a9a9ULL, 0xa9a9a9a9a9a9a9a9ULL, }, /* 16 */
+ { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, },
+ { 0x5454545454545454ULL, 0x5454545454545454ULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0x7676767676767676ULL, 0x7676767676767676ULL, },
+ { 0xddddddddddddddddULL, 0xddddddddddddddddULL, },
+ { 0x8d38e28d38e28d38ULL, 0xe28d38e28d38e28dULL, },
+ { 0xc61b71c61b71c61bULL, 0x71c61b71c61b71c6ULL, },
+ { 0x5454545454545454ULL, 0x5454545454545454ULL, }, /* 24 */
+ { 0x5555555555555555ULL, 0x5555555555555555ULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, },
+ { 0x2121212121212121ULL, 0x2121212121212121ULL, },
+ { 0x8888888888888888ULL, 0x8888888888888888ULL, },
+ { 0x38e38d38e38d38e3ULL, 0x8d38e38d38e38d38ULL, },
+ { 0x71c61c71c61c71c6ULL, 0x1c71c61c71c61c71ULL, },
+ { 0xcbcbcbcbcbcbcbcbULL, 0xcbcbcbcbcbcbcbcbULL, }, /* 32 */
+ { 0xccccccccccccccccULL, 0xccccccccccccccccULL, },
+ { 0x7676767676767676ULL, 0x7676767676767676ULL, },
+ { 0x2121212121212121ULL, 0x2121212121212121ULL, },
+ { 0x9898989898989898ULL, 0x9898989898989898ULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xaf5a04af5a04af5aULL, 0x04af5a04af5a04afULL, },
+ { 0xe83d93e83d93e83dULL, 0x93e83d93e83d93e8ULL, },
+ { 0x3232323232323232ULL, 0x3232323232323232ULL, }, /* 40 */
+ { 0x3333333333333333ULL, 0x3333333333333333ULL, },
+ { 0xddddddddddddddddULL, 0xddddddddddddddddULL, },
+ { 0x8888888888888888ULL, 0x8888888888888888ULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0x6666666666666666ULL, 0x6666666666666666ULL, },
+ { 0x16c16b16c16b16c1ULL, 0x6b16c16b16c16b16ULL, },
+ { 0x4fa4fa4fa4fa4fa4ULL, 0xfa4fa4fa4fa4fa4fULL, },
+ { 0xe28d37e28d37e28dULL, 0x37e28d37e28d37e2ULL, }, /* 48 */
+ { 0xe38e38e38e38e38eULL, 0x38e38e38e38e38e3ULL, },
+ { 0x8d38e28d38e28d38ULL, 0xe28d38e28d38e28dULL, },
+ { 0x38e38d38e38d38e3ULL, 0x8d38e38d38e38d38ULL, },
+ { 0xaf5a04af5a04af5aULL, 0x04af5a04af5a04afULL, },
+ { 0x16c16b16c16b16c1ULL, 0x6b16c16b16c16b16ULL, },
+ { 0xc61c70c61c70c61cULL, 0x70c61c70c61c70c6ULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0x1b70c61b70c61b70ULL, 0xc61b70c61b70c61bULL, }, /* 56 */
+ { 0x1c71c71c71c71c71ULL, 0xc71c71c71c71c71cULL, },
+ { 0xc61b71c61b71c61bULL, 0x71c61b71c61b71c6ULL, },
+ { 0x71c61c71c61c71c6ULL, 0x1c71c61c71c61c71ULL, },
+ { 0xe83d93e83d93e83dULL, 0x93e83d93e83d93e8ULL, },
+ { 0x4fa4fa4fa4fa4fa4ULL, 0xfa4fa4fa4fa4fa4fULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0x38e28e38e28e38e2ULL, 0x8e38e28e38e28e38ULL, },
+ { 0x10d4cc9850c4aa80ULL, 0x96ce16bcfcf66018ULL, }, /* 64 */
+ { 0x8328e62f75f51c48ULL, 0x5d5ec67813ba0208ULL, },
+ { 0x34c49476e131e0c0ULL, 0x723fd15da9a6d520ULL, },
+ { 0xf8b9fc198693378eULL, 0xd8589336a7bd92acULL, },
+ { 0x8328e62f75f51c48ULL, 0x5d5ec67813ba0208ULL, },
+ { 0xf67c00c69a268e10ULL, 0x24ee76342a7ea4f8ULL, },
+ { 0xa718ae0d06625288ULL, 0x39cf8119c06a7710ULL, },
+ { 0x6b0d16b0abc4a956ULL, 0x9fe843f2be81349cULL, },
+ { 0x34c49476e131e0c0ULL, 0x723fd15da9a6d520ULL, }, /* 72 */
+ { 0xa718ae0d06625288ULL, 0x39cf8119c06a7710ULL, },
+ { 0x58b45c54729e1600ULL, 0x4eb08cfe56564a28ULL, },
+ { 0x1ca9c4f717006dceULL, 0xb4c94ed7546d07b4ULL, },
+ { 0xf8b9fc198693378eULL, 0xd8589336a7bd92acULL, },
+ { 0x6b0d16b0abc4a956ULL, 0x9fe843f2be81349cULL, },
+};
+
+ gettimeofday(&start, NULL);
+
+ for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) {
+ do_msa_ADDV_B(b128_pattern[i], b128_pattern[j],
+ b128_result[PATTERN_INPUTS_SHORT_COUNT * i + j]);
+ }
+ }
+
+ for (i = 0; i < RANDOM_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < RANDOM_INPUTS_SHORT_COUNT; j++) {
+ do_msa_ADDV_B(b128_random[i], b128_random[j],
+ b128_result[((PATTERN_INPUTS_SHORT_COUNT) *
+ (PATTERN_INPUTS_SHORT_COUNT)) +
+ RANDOM_INPUTS_SHORT_COUNT * i + j]);
+ }
+ }
+
+ gettimeofday(&end, NULL);
+
+ elapsed_time = (end.tv_sec - start.tv_sec) * 1000.0;
+ elapsed_time += (end.tv_usec - start.tv_usec) / 1000.0;
+
+ ret = check_results(instruction_name, TEST_COUNT_TOTAL, elapsed_time,
+ &b128_result[0][0], &b128_expect[0][0]);
+
+ return ret;
+}
diff --git a/tests/tcg/mips/user/ase/msa/int-add/test_msa_addv_d.c b/tests/tcg/mips/user/ase/msa/int-add/test_msa_addv_d.c
new file mode 100644
index 0000000..858258b
--- /dev/null
+++ b/tests/tcg/mips/user/ase/msa/int-add/test_msa_addv_d.c
@@ -0,0 +1,151 @@
+/*
+ * Test program for MSA instruction ADDV.D
+ *
+ * Copyright (C) 2018 Wave Computing, Inc.
+ * Copyright (C) 2018 Aleksandar Markovic <amarkovic@wavecomp.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
+#include <sys/time.h>
+#include <stdint.h>
+
+#include "../../../../include/wrappers_msa.h"
+#include "../../../../include/test_inputs.h"
+#include "../../../../include/test_utils.h"
+
+#define TEST_COUNT_TOTAL ( \
+ (PATTERN_INPUTS_SHORT_COUNT) * (PATTERN_INPUTS_SHORT_COUNT) + \
+ (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT))
+
+
+int32_t main(void)
+{
+ char *instruction_name = "ADDV.D";
+ int32_t ret;
+ uint32_t i, j;
+ struct timeval start, end;
+ double elapsed_time;
+
+ uint64_t b128_result[TEST_COUNT_TOTAL][2];
+ uint64_t b128_expect[TEST_COUNT_TOTAL][2] = {
+ { 0xfffffffffffffffeULL, 0xfffffffffffffffeULL, }, /* 0 */
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xaaaaaaaaaaaaaaa9ULL, 0xaaaaaaaaaaaaaaa9ULL, },
+ { 0x5555555555555554ULL, 0x5555555555555554ULL, },
+ { 0xcccccccccccccccbULL, 0xcccccccccccccccbULL, },
+ { 0x3333333333333332ULL, 0x3333333333333332ULL, },
+ { 0xe38e38e38e38e38dULL, 0x38e38e38e38e38e2ULL, },
+ { 0x1c71c71c71c71c70ULL, 0xc71c71c71c71c71bULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 8 */
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, },
+ { 0x5555555555555555ULL, 0x5555555555555555ULL, },
+ { 0xccccccccccccccccULL, 0xccccccccccccccccULL, },
+ { 0x3333333333333333ULL, 0x3333333333333333ULL, },
+ { 0xe38e38e38e38e38eULL, 0x38e38e38e38e38e3ULL, },
+ { 0x1c71c71c71c71c71ULL, 0xc71c71c71c71c71cULL, },
+ { 0xaaaaaaaaaaaaaaa9ULL, 0xaaaaaaaaaaaaaaa9ULL, }, /* 16 */
+ { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, },
+ { 0x5555555555555554ULL, 0x5555555555555554ULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0x7777777777777776ULL, 0x7777777777777776ULL, },
+ { 0xddddddddddddddddULL, 0xddddddddddddddddULL, },
+ { 0x8e38e38e38e38e38ULL, 0xe38e38e38e38e38dULL, },
+ { 0xc71c71c71c71c71bULL, 0x71c71c71c71c71c6ULL, },
+ { 0x5555555555555554ULL, 0x5555555555555554ULL, }, /* 24 */
+ { 0x5555555555555555ULL, 0x5555555555555555ULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, },
+ { 0x2222222222222221ULL, 0x2222222222222221ULL, },
+ { 0x8888888888888888ULL, 0x8888888888888888ULL, },
+ { 0x38e38e38e38e38e3ULL, 0x8e38e38e38e38e38ULL, },
+ { 0x71c71c71c71c71c6ULL, 0x1c71c71c71c71c71ULL, },
+ { 0xcccccccccccccccbULL, 0xcccccccccccccccbULL, }, /* 32 */
+ { 0xccccccccccccccccULL, 0xccccccccccccccccULL, },
+ { 0x7777777777777776ULL, 0x7777777777777776ULL, },
+ { 0x2222222222222221ULL, 0x2222222222222221ULL, },
+ { 0x9999999999999998ULL, 0x9999999999999998ULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xb05b05b05b05b05aULL, 0x05b05b05b05b05afULL, },
+ { 0xe93e93e93e93e93dULL, 0x93e93e93e93e93e8ULL, },
+ { 0x3333333333333332ULL, 0x3333333333333332ULL, }, /* 40 */
+ { 0x3333333333333333ULL, 0x3333333333333333ULL, },
+ { 0xddddddddddddddddULL, 0xddddddddddddddddULL, },
+ { 0x8888888888888888ULL, 0x8888888888888888ULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0x6666666666666666ULL, 0x6666666666666666ULL, },
+ { 0x16c16c16c16c16c1ULL, 0x6c16c16c16c16c16ULL, },
+ { 0x4fa4fa4fa4fa4fa4ULL, 0xfa4fa4fa4fa4fa4fULL, },
+ { 0xe38e38e38e38e38dULL, 0x38e38e38e38e38e2ULL, }, /* 48 */
+ { 0xe38e38e38e38e38eULL, 0x38e38e38e38e38e3ULL, },
+ { 0x8e38e38e38e38e38ULL, 0xe38e38e38e38e38dULL, },
+ { 0x38e38e38e38e38e3ULL, 0x8e38e38e38e38e38ULL, },
+ { 0xb05b05b05b05b05aULL, 0x05b05b05b05b05afULL, },
+ { 0x16c16c16c16c16c1ULL, 0x6c16c16c16c16c16ULL, },
+ { 0xc71c71c71c71c71cULL, 0x71c71c71c71c71c6ULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0x1c71c71c71c71c70ULL, 0xc71c71c71c71c71bULL, }, /* 56 */
+ { 0x1c71c71c71c71c71ULL, 0xc71c71c71c71c71cULL, },
+ { 0xc71c71c71c71c71bULL, 0x71c71c71c71c71c6ULL, },
+ { 0x71c71c71c71c71c6ULL, 0x1c71c71c71c71c71ULL, },
+ { 0xe93e93e93e93e93dULL, 0x93e93e93e93e93e8ULL, },
+ { 0x4fa4fa4fa4fa4fa4ULL, 0xfa4fa4fa4fa4fa4fULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0x38e38e38e38e38e2ULL, 0x8e38e38e38e38e38ULL, },
+ { 0x10d5cd9850c4aa80ULL, 0x96ce16bdfcf76018ULL, }, /* 64 */
+ { 0x8428e72f75f61c48ULL, 0x5e5ec67913bb0308ULL, },
+ { 0x34c59576e231e0c0ULL, 0x733fd25ea9a6d520ULL, },
+ { 0xf8b9fd198694378eULL, 0xd9589437a7be92acULL, },
+ { 0x8428e72f75f61c48ULL, 0x5e5ec67913bb0308ULL, },
+ { 0xf77c00c69b278e10ULL, 0x25ef76342a7ea5f8ULL, },
+ { 0xa818af0e07635288ULL, 0x3ad08219c06a7810ULL, },
+ { 0x6c0d16b0abc5a956ULL, 0xa0e943f2be82359cULL, },
+ { 0x34c59576e231e0c0ULL, 0x733fd25ea9a6d520ULL, }, /* 72 */
+ { 0xa818af0e07635288ULL, 0x3ad08219c06a7810ULL, },
+ { 0x58b55d55739f1700ULL, 0x4fb18dff56564a28ULL, },
+ { 0x1ca9c4f818016dceULL, 0xb5ca4fd8546e07b4ULL, },
+ { 0xf8b9fd198694378eULL, 0xd9589437a7be92acULL, },
+ { 0x6c0d16b0abc5a956ULL, 0xa0e943f2be82359cULL, },
+};
+
+ gettimeofday(&start, NULL);
+
+ for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) {
+ do_msa_ADDV_D(b128_pattern[i], b128_pattern[j],
+ b128_result[PATTERN_INPUTS_SHORT_COUNT * i + j]);
+ }
+ }
+
+ for (i = 0; i < RANDOM_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < RANDOM_INPUTS_SHORT_COUNT; j++) {
+ do_msa_ADDV_D(b128_random[i], b128_random[j],
+ b128_result[((PATTERN_INPUTS_SHORT_COUNT) *
+ (PATTERN_INPUTS_SHORT_COUNT)) +
+ RANDOM_INPUTS_SHORT_COUNT * i + j]);
+ }
+ }
+
+ gettimeofday(&end, NULL);
+
+ elapsed_time = (end.tv_sec - start.tv_sec) * 1000.0;
+ elapsed_time += (end.tv_usec - start.tv_usec) / 1000.0;
+
+ ret = check_results(instruction_name, TEST_COUNT_TOTAL, elapsed_time,
+ &b128_result[0][0], &b128_expect[0][0]);
+
+ return ret;
+}
diff --git a/tests/tcg/mips/user/ase/msa/int-add/test_msa_addv_h.c b/tests/tcg/mips/user/ase/msa/int-add/test_msa_addv_h.c
new file mode 100644
index 0000000..5daf7fc
--- /dev/null
+++ b/tests/tcg/mips/user/ase/msa/int-add/test_msa_addv_h.c
@@ -0,0 +1,151 @@
+/*
+ * Test program for MSA instruction ADDV.H
+ *
+ * Copyright (C) 2018 Wave Computing, Inc.
+ * Copyright (C) 2018 Aleksandar Markovic <amarkovic@wavecomp.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
+#include <sys/time.h>
+#include <stdint.h>
+
+#include "../../../../include/wrappers_msa.h"
+#include "../../../../include/test_inputs.h"
+#include "../../../../include/test_utils.h"
+
+#define TEST_COUNT_TOTAL ( \
+ (PATTERN_INPUTS_SHORT_COUNT) * (PATTERN_INPUTS_SHORT_COUNT) + \
+ (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT))
+
+
+int32_t main(void)
+{
+ char *instruction_name = "ADDV.H";
+ int32_t ret;
+ uint32_t i, j;
+ struct timeval start, end;
+ double elapsed_time;
+
+ uint64_t b128_result[TEST_COUNT_TOTAL][2];
+ uint64_t b128_expect[TEST_COUNT_TOTAL][2] = {
+ { 0xfffefffefffefffeULL, 0xfffefffefffefffeULL, }, /* 0 */
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xaaa9aaa9aaa9aaa9ULL, 0xaaa9aaa9aaa9aaa9ULL, },
+ { 0x5554555455545554ULL, 0x5554555455545554ULL, },
+ { 0xcccbcccbcccbcccbULL, 0xcccbcccbcccbcccbULL, },
+ { 0x3332333233323332ULL, 0x3332333233323332ULL, },
+ { 0xe38d38e28e37e38dULL, 0x38e28e37e38d38e2ULL, },
+ { 0x1c70c71b71c61c70ULL, 0xc71b71c61c70c71bULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 8 */
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, },
+ { 0x5555555555555555ULL, 0x5555555555555555ULL, },
+ { 0xccccccccccccccccULL, 0xccccccccccccccccULL, },
+ { 0x3333333333333333ULL, 0x3333333333333333ULL, },
+ { 0xe38e38e38e38e38eULL, 0x38e38e38e38e38e3ULL, },
+ { 0x1c71c71c71c71c71ULL, 0xc71c71c71c71c71cULL, },
+ { 0xaaa9aaa9aaa9aaa9ULL, 0xaaa9aaa9aaa9aaa9ULL, }, /* 16 */
+ { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, },
+ { 0x5554555455545554ULL, 0x5554555455545554ULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0x7776777677767776ULL, 0x7776777677767776ULL, },
+ { 0xddddddddddddddddULL, 0xddddddddddddddddULL, },
+ { 0x8e38e38d38e28e38ULL, 0xe38d38e28e38e38dULL, },
+ { 0xc71b71c61c71c71bULL, 0x71c61c71c71b71c6ULL, },
+ { 0x5554555455545554ULL, 0x5554555455545554ULL, }, /* 24 */
+ { 0x5555555555555555ULL, 0x5555555555555555ULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, },
+ { 0x2221222122212221ULL, 0x2221222122212221ULL, },
+ { 0x8888888888888888ULL, 0x8888888888888888ULL, },
+ { 0x38e38e38e38d38e3ULL, 0x8e38e38d38e38e38ULL, },
+ { 0x71c61c71c71c71c6ULL, 0x1c71c71c71c61c71ULL, },
+ { 0xcccbcccbcccbcccbULL, 0xcccbcccbcccbcccbULL, }, /* 32 */
+ { 0xccccccccccccccccULL, 0xccccccccccccccccULL, },
+ { 0x7776777677767776ULL, 0x7776777677767776ULL, },
+ { 0x2221222122212221ULL, 0x2221222122212221ULL, },
+ { 0x9998999899989998ULL, 0x9998999899989998ULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xb05a05af5b04b05aULL, 0x05af5b04b05a05afULL, },
+ { 0xe93d93e83e93e93dULL, 0x93e83e93e93d93e8ULL, },
+ { 0x3332333233323332ULL, 0x3332333233323332ULL, }, /* 40 */
+ { 0x3333333333333333ULL, 0x3333333333333333ULL, },
+ { 0xddddddddddddddddULL, 0xddddddddddddddddULL, },
+ { 0x8888888888888888ULL, 0x8888888888888888ULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0x6666666666666666ULL, 0x6666666666666666ULL, },
+ { 0x16c16c16c16b16c1ULL, 0x6c16c16b16c16c16ULL, },
+ { 0x4fa4fa4fa4fa4fa4ULL, 0xfa4fa4fa4fa4fa4fULL, },
+ { 0xe38d38e28e37e38dULL, 0x38e28e37e38d38e2ULL, }, /* 48 */
+ { 0xe38e38e38e38e38eULL, 0x38e38e38e38e38e3ULL, },
+ { 0x8e38e38d38e28e38ULL, 0xe38d38e28e38e38dULL, },
+ { 0x38e38e38e38d38e3ULL, 0x8e38e38d38e38e38ULL, },
+ { 0xb05a05af5b04b05aULL, 0x05af5b04b05a05afULL, },
+ { 0x16c16c16c16b16c1ULL, 0x6c16c16b16c16c16ULL, },
+ { 0xc71c71c61c70c71cULL, 0x71c61c70c71c71c6ULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0x1c70c71b71c61c70ULL, 0xc71b71c61c70c71bULL, }, /* 56 */
+ { 0x1c71c71c71c71c71ULL, 0xc71c71c71c71c71cULL, },
+ { 0xc71b71c61c71c71bULL, 0x71c61c71c71b71c6ULL, },
+ { 0x71c61c71c71c71c6ULL, 0x1c71c71c71c61c71ULL, },
+ { 0xe93d93e83e93e93dULL, 0x93e83e93e93d93e8ULL, },
+ { 0x4fa4fa4fa4fa4fa4ULL, 0xfa4fa4fa4fa4fa4fULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0x38e28e38e38e38e2ULL, 0x8e38e38e38e28e38ULL, },
+ { 0x10d4cd9850c4aa80ULL, 0x96ce16bcfcf66018ULL, }, /* 64 */
+ { 0x8428e72f75f51c48ULL, 0x5e5ec67813ba0308ULL, },
+ { 0x34c49576e231e0c0ULL, 0x733fd25da9a6d520ULL, },
+ { 0xf8b9fd198693378eULL, 0xd9589436a7bd92acULL, },
+ { 0x8428e72f75f51c48ULL, 0x5e5ec67813ba0308ULL, },
+ { 0xf77c00c69b268e10ULL, 0x25ee76342a7ea5f8ULL, },
+ { 0xa818af0d07625288ULL, 0x3acf8219c06a7810ULL, },
+ { 0x6c0d16b0abc4a956ULL, 0xa0e843f2be81359cULL, },
+ { 0x34c49576e231e0c0ULL, 0x733fd25da9a6d520ULL, }, /* 72 */
+ { 0xa818af0d07625288ULL, 0x3acf8219c06a7810ULL, },
+ { 0x58b45d54739e1700ULL, 0x4fb08dfe56564a28ULL, },
+ { 0x1ca9c4f718006dceULL, 0xb5c94fd7546d07b4ULL, },
+ { 0xf8b9fd198693378eULL, 0xd9589436a7bd92acULL, },
+ { 0x6c0d16b0abc4a956ULL, 0xa0e843f2be81359cULL, },
+};
+
+ gettimeofday(&start, NULL);
+
+ for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) {
+ do_msa_ADDV_H(b128_pattern[i], b128_pattern[j],
+ b128_result[PATTERN_INPUTS_SHORT_COUNT * i + j]);
+ }
+ }
+
+ for (i = 0; i < RANDOM_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < RANDOM_INPUTS_SHORT_COUNT; j++) {
+ do_msa_ADDV_H(b128_random[i], b128_random[j],
+ b128_result[((PATTERN_INPUTS_SHORT_COUNT) *
+ (PATTERN_INPUTS_SHORT_COUNT)) +
+ RANDOM_INPUTS_SHORT_COUNT * i + j]);
+ }
+ }
+
+ gettimeofday(&end, NULL);
+
+ elapsed_time = (end.tv_sec - start.tv_sec) * 1000.0;
+ elapsed_time += (end.tv_usec - start.tv_usec) / 1000.0;
+
+ ret = check_results(instruction_name, TEST_COUNT_TOTAL, elapsed_time,
+ &b128_result[0][0], &b128_expect[0][0]);
+
+ return ret;
+}
diff --git a/tests/tcg/mips/user/ase/msa/int-add/test_msa_addv_w.c b/tests/tcg/mips/user/ase/msa/int-add/test_msa_addv_w.c
new file mode 100644
index 0000000..b1e42ec
--- /dev/null
+++ b/tests/tcg/mips/user/ase/msa/int-add/test_msa_addv_w.c
@@ -0,0 +1,151 @@
+/*
+ * Test program for MSA instruction ADDV.W
+ *
+ * Copyright (C) 2018 Wave Computing, Inc.
+ * Copyright (C) 2018 Aleksandar Markovic <amarkovic@wavecomp.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
+#include <sys/time.h>
+#include <stdint.h>
+
+#include "../../../../include/wrappers_msa.h"
+#include "../../../../include/test_inputs.h"
+#include "../../../../include/test_utils.h"
+
+#define TEST_COUNT_TOTAL ( \
+ (PATTERN_INPUTS_SHORT_COUNT) * (PATTERN_INPUTS_SHORT_COUNT) + \
+ (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT))
+
+
+int32_t main(void)
+{
+ char *instruction_name = "ADDV.W";
+ int32_t ret;
+ uint32_t i, j;
+ struct timeval start, end;
+ double elapsed_time;
+
+ uint64_t b128_result[TEST_COUNT_TOTAL][2];
+ uint64_t b128_expect[TEST_COUNT_TOTAL][2] = {
+ { 0xfffffffefffffffeULL, 0xfffffffefffffffeULL, }, /* 0 */
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xaaaaaaa9aaaaaaa9ULL, 0xaaaaaaa9aaaaaaa9ULL, },
+ { 0x5555555455555554ULL, 0x5555555455555554ULL, },
+ { 0xcccccccbcccccccbULL, 0xcccccccbcccccccbULL, },
+ { 0x3333333233333332ULL, 0x3333333233333332ULL, },
+ { 0xe38e38e28e38e38dULL, 0x38e38e37e38e38e2ULL, },
+ { 0x1c71c71b71c71c70ULL, 0xc71c71c61c71c71bULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 8 */
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, },
+ { 0x5555555555555555ULL, 0x5555555555555555ULL, },
+ { 0xccccccccccccccccULL, 0xccccccccccccccccULL, },
+ { 0x3333333333333333ULL, 0x3333333333333333ULL, },
+ { 0xe38e38e38e38e38eULL, 0x38e38e38e38e38e3ULL, },
+ { 0x1c71c71c71c71c71ULL, 0xc71c71c71c71c71cULL, },
+ { 0xaaaaaaa9aaaaaaa9ULL, 0xaaaaaaa9aaaaaaa9ULL, }, /* 16 */
+ { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, },
+ { 0x5555555455555554ULL, 0x5555555455555554ULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0x7777777677777776ULL, 0x7777777677777776ULL, },
+ { 0xddddddddddddddddULL, 0xddddddddddddddddULL, },
+ { 0x8e38e38d38e38e38ULL, 0xe38e38e28e38e38dULL, },
+ { 0xc71c71c61c71c71bULL, 0x71c71c71c71c71c6ULL, },
+ { 0x5555555455555554ULL, 0x5555555455555554ULL, }, /* 24 */
+ { 0x5555555555555555ULL, 0x5555555555555555ULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, },
+ { 0x2222222122222221ULL, 0x2222222122222221ULL, },
+ { 0x8888888888888888ULL, 0x8888888888888888ULL, },
+ { 0x38e38e38e38e38e3ULL, 0x8e38e38d38e38e38ULL, },
+ { 0x71c71c71c71c71c6ULL, 0x1c71c71c71c71c71ULL, },
+ { 0xcccccccbcccccccbULL, 0xcccccccbcccccccbULL, }, /* 32 */
+ { 0xccccccccccccccccULL, 0xccccccccccccccccULL, },
+ { 0x7777777677777776ULL, 0x7777777677777776ULL, },
+ { 0x2222222122222221ULL, 0x2222222122222221ULL, },
+ { 0x9999999899999998ULL, 0x9999999899999998ULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xb05b05af5b05b05aULL, 0x05b05b04b05b05afULL, },
+ { 0xe93e93e83e93e93dULL, 0x93e93e93e93e93e8ULL, },
+ { 0x3333333233333332ULL, 0x3333333233333332ULL, }, /* 40 */
+ { 0x3333333333333333ULL, 0x3333333333333333ULL, },
+ { 0xddddddddddddddddULL, 0xddddddddddddddddULL, },
+ { 0x8888888888888888ULL, 0x8888888888888888ULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0x6666666666666666ULL, 0x6666666666666666ULL, },
+ { 0x16c16c16c16c16c1ULL, 0x6c16c16b16c16c16ULL, },
+ { 0x4fa4fa4fa4fa4fa4ULL, 0xfa4fa4fa4fa4fa4fULL, },
+ { 0xe38e38e28e38e38dULL, 0x38e38e37e38e38e2ULL, }, /* 48 */
+ { 0xe38e38e38e38e38eULL, 0x38e38e38e38e38e3ULL, },
+ { 0x8e38e38d38e38e38ULL, 0xe38e38e28e38e38dULL, },
+ { 0x38e38e38e38e38e3ULL, 0x8e38e38d38e38e38ULL, },
+ { 0xb05b05af5b05b05aULL, 0x05b05b04b05b05afULL, },
+ { 0x16c16c16c16c16c1ULL, 0x6c16c16b16c16c16ULL, },
+ { 0xc71c71c61c71c71cULL, 0x71c71c70c71c71c6ULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0x1c71c71b71c71c70ULL, 0xc71c71c61c71c71bULL, }, /* 56 */
+ { 0x1c71c71c71c71c71ULL, 0xc71c71c71c71c71cULL, },
+ { 0xc71c71c61c71c71bULL, 0x71c71c71c71c71c6ULL, },
+ { 0x71c71c71c71c71c6ULL, 0x1c71c71c71c71c71ULL, },
+ { 0xe93e93e83e93e93dULL, 0x93e93e93e93e93e8ULL, },
+ { 0x4fa4fa4fa4fa4fa4ULL, 0xfa4fa4fa4fa4fa4fULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0x38e38e38e38e38e2ULL, 0x8e38e38e38e38e38ULL, },
+ { 0x10d5cd9850c4aa80ULL, 0x96ce16bcfcf76018ULL, }, /* 64 */
+ { 0x8428e72f75f61c48ULL, 0x5e5ec67813bb0308ULL, },
+ { 0x34c59576e231e0c0ULL, 0x733fd25da9a6d520ULL, },
+ { 0xf8b9fd198694378eULL, 0xd9589436a7be92acULL, },
+ { 0x8428e72f75f61c48ULL, 0x5e5ec67813bb0308ULL, },
+ { 0xf77c00c69b278e10ULL, 0x25ef76342a7ea5f8ULL, },
+ { 0xa818af0d07635288ULL, 0x3ad08219c06a7810ULL, },
+ { 0x6c0d16b0abc5a956ULL, 0xa0e943f2be82359cULL, },
+ { 0x34c59576e231e0c0ULL, 0x733fd25da9a6d520ULL, }, /* 72 */
+ { 0xa818af0d07635288ULL, 0x3ad08219c06a7810ULL, },
+ { 0x58b55d54739f1700ULL, 0x4fb18dfe56564a28ULL, },
+ { 0x1ca9c4f718016dceULL, 0xb5ca4fd7546e07b4ULL, },
+ { 0xf8b9fd198694378eULL, 0xd9589436a7be92acULL, },
+ { 0x6c0d16b0abc5a956ULL, 0xa0e943f2be82359cULL, },
+};
+
+ gettimeofday(&start, NULL);
+
+ for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) {
+ do_msa_ADDV_W(b128_pattern[i], b128_pattern[j],
+ b128_result[PATTERN_INPUTS_SHORT_COUNT * i + j]);
+ }
+ }
+
+ for (i = 0; i < RANDOM_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < RANDOM_INPUTS_SHORT_COUNT; j++) {
+ do_msa_ADDV_W(b128_random[i], b128_random[j],
+ b128_result[((PATTERN_INPUTS_SHORT_COUNT) *
+ (PATTERN_INPUTS_SHORT_COUNT)) +
+ RANDOM_INPUTS_SHORT_COUNT * i + j]);
+ }
+ }
+
+ gettimeofday(&end, NULL);
+
+ elapsed_time = (end.tv_sec - start.tv_sec) * 1000.0;
+ elapsed_time += (end.tv_usec - start.tv_usec) / 1000.0;
+
+ ret = check_results(instruction_name, TEST_COUNT_TOTAL, elapsed_time,
+ &b128_result[0][0], &b128_expect[0][0]);
+
+ return ret;
+}
diff --git a/tests/tcg/mips/user/ase/msa/int-add/test_msa_hadd_s_d.c b/tests/tcg/mips/user/ase/msa/int-add/test_msa_hadd_s_d.c
new file mode 100644
index 0000000..5a923d6
--- /dev/null
+++ b/tests/tcg/mips/user/ase/msa/int-add/test_msa_hadd_s_d.c
@@ -0,0 +1,151 @@
+/*
+ * Test program for MSA instruction HADD_S.D
+ *
+ * Copyright (C) 2018 Wave Computing, Inc.
+ * Copyright (C) 2018 Aleksandar Markovic <amarkovic@wavecomp.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
+#include <sys/time.h>
+#include <stdint.h>
+
+#include "../../../../include/wrappers_msa.h"
+#include "../../../../include/test_inputs.h"
+#include "../../../../include/test_utils.h"
+
+#define TEST_COUNT_TOTAL ( \
+ (PATTERN_INPUTS_SHORT_COUNT) * (PATTERN_INPUTS_SHORT_COUNT) + \
+ (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT))
+
+
+int32_t main(void)
+{
+ char *instruction_name = "HADD_S.D";
+ int32_t ret;
+ uint32_t i, j;
+ struct timeval start, end;
+ double elapsed_time;
+
+ uint64_t b128_result[TEST_COUNT_TOTAL][2];
+ uint64_t b128_expect[TEST_COUNT_TOTAL][2] = {
+ { 0xfffffffffffffffeULL, 0xfffffffffffffffeULL, }, /* 0 */
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xffffffffaaaaaaa9ULL, 0xffffffffaaaaaaa9ULL, },
+ { 0x0000000055555554ULL, 0x0000000055555554ULL, },
+ { 0xffffffffcccccccbULL, 0xffffffffcccccccbULL, },
+ { 0x0000000033333332ULL, 0x0000000033333332ULL, },
+ { 0xffffffff8e38e38dULL, 0xffffffffe38e38e2ULL, },
+ { 0x0000000071c71c70ULL, 0x000000001c71c71bULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 8 */
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0xffffffffaaaaaaaaULL, 0xffffffffaaaaaaaaULL, },
+ { 0x0000000055555555ULL, 0x0000000055555555ULL, },
+ { 0xffffffffccccccccULL, 0xffffffffccccccccULL, },
+ { 0x0000000033333333ULL, 0x0000000033333333ULL, },
+ { 0xffffffff8e38e38eULL, 0xffffffffe38e38e3ULL, },
+ { 0x0000000071c71c71ULL, 0x000000001c71c71cULL, },
+ { 0xffffffffaaaaaaa9ULL, 0xffffffffaaaaaaa9ULL, }, /* 16 */
+ { 0xffffffffaaaaaaaaULL, 0xffffffffaaaaaaaaULL, },
+ { 0xffffffff55555554ULL, 0xffffffff55555554ULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xffffffff77777776ULL, 0xffffffff77777776ULL, },
+ { 0xffffffffddddddddULL, 0xffffffffddddddddULL, },
+ { 0xffffffff38e38e38ULL, 0xffffffff8e38e38dULL, },
+ { 0x000000001c71c71bULL, 0xffffffffc71c71c6ULL, },
+ { 0x0000000055555554ULL, 0x0000000055555554ULL, }, /* 24 */
+ { 0x0000000055555555ULL, 0x0000000055555555ULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0x00000000aaaaaaaaULL, 0x00000000aaaaaaaaULL, },
+ { 0x0000000022222221ULL, 0x0000000022222221ULL, },
+ { 0x0000000088888888ULL, 0x0000000088888888ULL, },
+ { 0xffffffffe38e38e3ULL, 0x0000000038e38e38ULL, },
+ { 0x00000000c71c71c6ULL, 0x0000000071c71c71ULL, },
+ { 0xffffffffcccccccbULL, 0xffffffffcccccccbULL, }, /* 32 */
+ { 0xffffffffccccccccULL, 0xffffffffccccccccULL, },
+ { 0xffffffff77777776ULL, 0xffffffff77777776ULL, },
+ { 0x0000000022222221ULL, 0x0000000022222221ULL, },
+ { 0xffffffff99999998ULL, 0xffffffff99999998ULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xffffffff5b05b05aULL, 0xffffffffb05b05afULL, },
+ { 0x000000003e93e93dULL, 0xffffffffe93e93e8ULL, },
+ { 0x0000000033333332ULL, 0x0000000033333332ULL, }, /* 40 */
+ { 0x0000000033333333ULL, 0x0000000033333333ULL, },
+ { 0xffffffffddddddddULL, 0xffffffffddddddddULL, },
+ { 0x0000000088888888ULL, 0x0000000088888888ULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0x0000000066666666ULL, 0x0000000066666666ULL, },
+ { 0xffffffffc16c16c1ULL, 0x0000000016c16c16ULL, },
+ { 0x00000000a4fa4fa4ULL, 0x000000004fa4fa4fULL, },
+ { 0xffffffffe38e38e2ULL, 0x0000000038e38e37ULL, }, /* 48 */
+ { 0xffffffffe38e38e3ULL, 0x0000000038e38e38ULL, },
+ { 0xffffffff8e38e38dULL, 0xffffffffe38e38e2ULL, },
+ { 0x0000000038e38e38ULL, 0x000000008e38e38dULL, },
+ { 0xffffffffb05b05afULL, 0x0000000005b05b04ULL, },
+ { 0x0000000016c16c16ULL, 0x000000006c16c16bULL, },
+ { 0xffffffff71c71c71ULL, 0x000000001c71c71bULL, },
+ { 0x0000000055555554ULL, 0x0000000055555554ULL, },
+ { 0x000000001c71c71bULL, 0xffffffffc71c71c6ULL, }, /* 56 */
+ { 0x000000001c71c71cULL, 0xffffffffc71c71c7ULL, },
+ { 0xffffffffc71c71c6ULL, 0xffffffff71c71c71ULL, },
+ { 0x0000000071c71c71ULL, 0x000000001c71c71cULL, },
+ { 0xffffffffe93e93e8ULL, 0xffffffff93e93e93ULL, },
+ { 0x000000004fa4fa4fULL, 0xfffffffffa4fa4faULL, },
+ { 0xffffffffaaaaaaaaULL, 0xffffffffaaaaaaaaULL, },
+ { 0x000000008e38e38dULL, 0xffffffffe38e38e3ULL, },
+ { 0xffffffffb0cd3c0cULL, 0x0000000049e2bb6aULL, }, /* 64 */
+ { 0xffffffffd5feadd4ULL, 0x0000000060a65e5aULL, },
+ { 0xffffffff423a724cULL, 0xfffffffff6923072ULL, },
+ { 0xffffffffe69cc91aULL, 0xfffffffff4a9edfeULL, },
+ { 0x00000000242055a3ULL, 0x0000000011736b26ULL, },
+ { 0x000000004951c76bULL, 0x0000000028370e16ULL, },
+ { 0xffffffffb58d8be3ULL, 0xffffffffbe22e02eULL, },
+ { 0x0000000059efe2b1ULL, 0xffffffffbc3a9dbaULL, },
+ { 0xffffffffd4bd03eaULL, 0x000000002654770bULL, }, /* 72 */
+ { 0xfffffffff9ee75b2ULL, 0x000000003d1819fbULL, },
+ { 0xffffffff662a3a2aULL, 0xffffffffd303ec13ULL, },
+ { 0x000000000a8c90f8ULL, 0xffffffffd11ba99fULL, },
+ { 0x0000000098b16b8dULL, 0xffffffff8c6d38e4ULL, },
+ { 0x00000000bde2dd55ULL, 0xffffffffa330dbd4ULL, },
+};
+
+ gettimeofday(&start, NULL);
+
+ for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) {
+ do_msa_HADD_S_D(b128_pattern[i], b128_pattern[j],
+ b128_result[PATTERN_INPUTS_SHORT_COUNT * i + j]);
+ }
+ }
+
+ for (i = 0; i < RANDOM_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < RANDOM_INPUTS_SHORT_COUNT; j++) {
+ do_msa_HADD_S_D(b128_random[i], b128_random[j],
+ b128_result[((PATTERN_INPUTS_SHORT_COUNT) *
+ (PATTERN_INPUTS_SHORT_COUNT)) +
+ RANDOM_INPUTS_SHORT_COUNT * i + j]);
+ }
+ }
+
+ gettimeofday(&end, NULL);
+
+ elapsed_time = (end.tv_sec - start.tv_sec) * 1000.0;
+ elapsed_time += (end.tv_usec - start.tv_usec) / 1000.0;
+
+ ret = check_results(instruction_name, TEST_COUNT_TOTAL, elapsed_time,
+ &b128_result[0][0], &b128_expect[0][0]);
+
+ return ret;
+}
diff --git a/tests/tcg/mips/user/ase/msa/int-add/test_msa_hadd_s_h.c b/tests/tcg/mips/user/ase/msa/int-add/test_msa_hadd_s_h.c
new file mode 100644
index 0000000..4b14853
--- /dev/null
+++ b/tests/tcg/mips/user/ase/msa/int-add/test_msa_hadd_s_h.c
@@ -0,0 +1,151 @@
+/*
+ * Test program for MSA instruction HADD_S.H
+ *
+ * Copyright (C) 2018 Wave Computing, Inc.
+ * Copyright (C) 2018 Aleksandar Markovic <amarkovic@wavecomp.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
+#include <sys/time.h>
+#include <stdint.h>
+
+#include "../../../../include/wrappers_msa.h"
+#include "../../../../include/test_inputs.h"
+#include "../../../../include/test_utils.h"
+
+#define TEST_COUNT_TOTAL ( \
+ (PATTERN_INPUTS_SHORT_COUNT) * (PATTERN_INPUTS_SHORT_COUNT) + \
+ (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT))
+
+
+int32_t main(void)
+{
+ char *instruction_name = "HADD_S.H";
+ int32_t ret;
+ uint32_t i, j;
+ struct timeval start, end;
+ double elapsed_time;
+
+ uint64_t b128_result[TEST_COUNT_TOTAL][2];
+ uint64_t b128_expect[TEST_COUNT_TOTAL][2] = {
+ { 0xfffefffefffefffeULL, 0xfffefffefffefffeULL, }, /* 0 */
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xffa9ffa9ffa9ffa9ULL, 0xffa9ffa9ffa9ffa9ULL, },
+ { 0x0054005400540054ULL, 0x0054005400540054ULL, },
+ { 0xffcbffcbffcbffcbULL, 0xffcbffcbffcbffcbULL, },
+ { 0x0032003200320032ULL, 0x0032003200320032ULL, },
+ { 0xff8dffe20037ff8dULL, 0xffe20037ff8dffe2ULL, },
+ { 0x0070001bffc60070ULL, 0x001bffc60070001bULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 8 */
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0xffaaffaaffaaffaaULL, 0xffaaffaaffaaffaaULL, },
+ { 0x0055005500550055ULL, 0x0055005500550055ULL, },
+ { 0xffccffccffccffccULL, 0xffccffccffccffccULL, },
+ { 0x0033003300330033ULL, 0x0033003300330033ULL, },
+ { 0xff8effe30038ff8eULL, 0xffe30038ff8effe3ULL, },
+ { 0x0071001cffc70071ULL, 0x001cffc70071001cULL, },
+ { 0xffa9ffa9ffa9ffa9ULL, 0xffa9ffa9ffa9ffa9ULL, }, /* 16 */
+ { 0xffaaffaaffaaffaaULL, 0xffaaffaaffaaffaaULL, },
+ { 0xff54ff54ff54ff54ULL, 0xff54ff54ff54ff54ULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xff76ff76ff76ff76ULL, 0xff76ff76ff76ff76ULL, },
+ { 0xffddffddffddffddULL, 0xffddffddffddffddULL, },
+ { 0xff38ff8dffe2ff38ULL, 0xff8dffe2ff38ff8dULL, },
+ { 0x001bffc6ff71001bULL, 0xffc6ff71001bffc6ULL, },
+ { 0x0054005400540054ULL, 0x0054005400540054ULL, }, /* 24 */
+ { 0x0055005500550055ULL, 0x0055005500550055ULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0x00aa00aa00aa00aaULL, 0x00aa00aa00aa00aaULL, },
+ { 0x0021002100210021ULL, 0x0021002100210021ULL, },
+ { 0x0088008800880088ULL, 0x0088008800880088ULL, },
+ { 0xffe30038008dffe3ULL, 0x0038008dffe30038ULL, },
+ { 0x00c60071001c00c6ULL, 0x0071001c00c60071ULL, },
+ { 0xffcbffcbffcbffcbULL, 0xffcbffcbffcbffcbULL, }, /* 32 */
+ { 0xffccffccffccffccULL, 0xffccffccffccffccULL, },
+ { 0xff76ff76ff76ff76ULL, 0xff76ff76ff76ff76ULL, },
+ { 0x0021002100210021ULL, 0x0021002100210021ULL, },
+ { 0xff98ff98ff98ff98ULL, 0xff98ff98ff98ff98ULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xff5affaf0004ff5aULL, 0xffaf0004ff5affafULL, },
+ { 0x003dffe8ff93003dULL, 0xffe8ff93003dffe8ULL, },
+ { 0x0032003200320032ULL, 0x0032003200320032ULL, }, /* 40 */
+ { 0x0033003300330033ULL, 0x0033003300330033ULL, },
+ { 0xffddffddffddffddULL, 0xffddffddffddffddULL, },
+ { 0x0088008800880088ULL, 0x0088008800880088ULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0x0066006600660066ULL, 0x0066006600660066ULL, },
+ { 0xffc10016006bffc1ULL, 0x0016006bffc10016ULL, },
+ { 0x00a4004ffffa00a4ULL, 0x004ffffa00a4004fULL, },
+ { 0xffe20037ff8dffe2ULL, 0x0037ff8dffe20037ULL, }, /* 48 */
+ { 0xffe30038ff8effe3ULL, 0x0038ff8effe30038ULL, },
+ { 0xff8dffe2ff38ff8dULL, 0xffe2ff38ff8dffe2ULL, },
+ { 0x0038008dffe30038ULL, 0x008dffe30038008dULL, },
+ { 0xffaf0004ff5affafULL, 0x0004ff5affaf0004ULL, },
+ { 0x0016006bffc10016ULL, 0x006bffc10016006bULL, },
+ { 0xff71001bffc6ff71ULL, 0x001bffc6ff71001bULL, },
+ { 0x00540054ff550054ULL, 0x0054ff5500540054ULL, },
+ { 0x001bffc60070001bULL, 0xffc60070001bffc6ULL, }, /* 56 */
+ { 0x001cffc70071001cULL, 0xffc70071001cffc7ULL, },
+ { 0xffc6ff71001bffc6ULL, 0xff71001bffc6ff71ULL, },
+ { 0x0071001c00c60071ULL, 0x001c00c60071001cULL, },
+ { 0xffe8ff93003dffe8ULL, 0xff93003dffe8ff93ULL, },
+ { 0x004ffffa00a4004fULL, 0xfffa00a4004ffffaULL, },
+ { 0xffaaffaa00a9ffaaULL, 0xffaa00a9ffaaffaaULL, },
+ { 0x008dffe30038008dULL, 0xffe30038008dffe3ULL, },
+ { 0xfff2ffb2008a0095ULL, 0x00b200690079ffbcULL, }, /* 64 */
+ { 0xff460049ffbb005dULL, 0x00420025003dffacULL, },
+ { 0xffe2ff90fff7ffd5ULL, 0x0023000a0029ffc4ULL, },
+ { 0xffd70033005900a3ULL, 0x003cffe30040ff50ULL, },
+ { 0x0065ffcc00af0007ULL, 0x007900190090005eULL, },
+ { 0xffb90063ffe0ffcfULL, 0x0009ffd50054004eULL, },
+ { 0x0055ffaa001cff47ULL, 0xffeaffba00400066ULL, },
+ { 0x004a004d007e0015ULL, 0x0003ff930057fff2ULL, },
+ { 0x0016ff7a001bffcbULL, 0x008e002400260031ULL, }, /* 72 */
+ { 0xff6a0011ff4cff93ULL, 0x001effe0ffea0021ULL, },
+ { 0x0006ff58ff88ff0bULL, 0xffffffc5ffd60039ULL, },
+ { 0xfffbfffbffeaffd9ULL, 0x0018ff9effedffc5ULL, },
+ { 0x00daffe200c00022ULL, 0xfff4ffe60024ffeeULL, },
+ { 0x002e0079fff1ffeaULL, 0xff84ffa2ffe8ffdeULL, },
+};
+
+ gettimeofday(&start, NULL);
+
+ for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) {
+ do_msa_HADD_S_H(b128_pattern[i], b128_pattern[j],
+ b128_result[PATTERN_INPUTS_SHORT_COUNT * i + j]);
+ }
+ }
+
+ for (i = 0; i < RANDOM_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < RANDOM_INPUTS_SHORT_COUNT; j++) {
+ do_msa_HADD_S_H(b128_random[i], b128_random[j],
+ b128_result[((PATTERN_INPUTS_SHORT_COUNT) *
+ (PATTERN_INPUTS_SHORT_COUNT)) +
+ RANDOM_INPUTS_SHORT_COUNT * i + j]);
+ }
+ }
+
+ gettimeofday(&end, NULL);
+
+ elapsed_time = (end.tv_sec - start.tv_sec) * 1000.0;
+ elapsed_time += (end.tv_usec - start.tv_usec) / 1000.0;
+
+ ret = check_results(instruction_name, TEST_COUNT_TOTAL, elapsed_time,
+ &b128_result[0][0], &b128_expect[0][0]);
+
+ return ret;
+}
diff --git a/tests/tcg/mips/user/ase/msa/int-add/test_msa_hadd_s_w.c b/tests/tcg/mips/user/ase/msa/int-add/test_msa_hadd_s_w.c
new file mode 100644
index 0000000..26508ea
--- /dev/null
+++ b/tests/tcg/mips/user/ase/msa/int-add/test_msa_hadd_s_w.c
@@ -0,0 +1,151 @@
+/*
+ * Test program for MSA instruction HADD_S.W
+ *
+ * Copyright (C) 2018 Wave Computing, Inc.
+ * Copyright (C) 2018 Aleksandar Markovic <amarkovic@wavecomp.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
+#include <sys/time.h>
+#include <stdint.h>
+
+#include "../../../../include/wrappers_msa.h"
+#include "../../../../include/test_inputs.h"
+#include "../../../../include/test_utils.h"
+
+#define TEST_COUNT_TOTAL ( \
+ (PATTERN_INPUTS_SHORT_COUNT) * (PATTERN_INPUTS_SHORT_COUNT) + \
+ (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT))
+
+
+int32_t main(void)
+{
+ char *instruction_name = "HADD_S.W";
+ int32_t ret;
+ uint32_t i, j;
+ struct timeval start, end;
+ double elapsed_time;
+
+ uint64_t b128_result[TEST_COUNT_TOTAL][2];
+ uint64_t b128_expect[TEST_COUNT_TOTAL][2] = {
+ { 0xfffffffefffffffeULL, 0xfffffffefffffffeULL, }, /* 0 */
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xffffaaa9ffffaaa9ULL, 0xffffaaa9ffffaaa9ULL, },
+ { 0x0000555400005554ULL, 0x0000555400005554ULL, },
+ { 0xffffcccbffffcccbULL, 0xffffcccbffffcccbULL, },
+ { 0x0000333200003332ULL, 0x0000333200003332ULL, },
+ { 0x000038e2ffffe38dULL, 0xffff8e37000038e2ULL, },
+ { 0xffffc71b00001c70ULL, 0x000071c6ffffc71bULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 8 */
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0xffffaaaaffffaaaaULL, 0xffffaaaaffffaaaaULL, },
+ { 0x0000555500005555ULL, 0x0000555500005555ULL, },
+ { 0xffffccccffffccccULL, 0xffffccccffffccccULL, },
+ { 0x0000333300003333ULL, 0x0000333300003333ULL, },
+ { 0x000038e3ffffe38eULL, 0xffff8e38000038e3ULL, },
+ { 0xffffc71c00001c71ULL, 0x000071c7ffffc71cULL, },
+ { 0xffffaaa9ffffaaa9ULL, 0xffffaaa9ffffaaa9ULL, }, /* 16 */
+ { 0xffffaaaaffffaaaaULL, 0xffffaaaaffffaaaaULL, },
+ { 0xffff5554ffff5554ULL, 0xffff5554ffff5554ULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xffff7776ffff7776ULL, 0xffff7776ffff7776ULL, },
+ { 0xffffddddffffddddULL, 0xffffddddffffddddULL, },
+ { 0xffffe38dffff8e38ULL, 0xffff38e2ffffe38dULL, },
+ { 0xffff71c6ffffc71bULL, 0x00001c71ffff71c6ULL, },
+ { 0x0000555400005554ULL, 0x0000555400005554ULL, }, /* 24 */
+ { 0x0000555500005555ULL, 0x0000555500005555ULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0x0000aaaa0000aaaaULL, 0x0000aaaa0000aaaaULL, },
+ { 0x0000222100002221ULL, 0x0000222100002221ULL, },
+ { 0x0000888800008888ULL, 0x0000888800008888ULL, },
+ { 0x00008e38000038e3ULL, 0xffffe38d00008e38ULL, },
+ { 0x00001c71000071c6ULL, 0x0000c71c00001c71ULL, },
+ { 0xffffcccbffffcccbULL, 0xffffcccbffffcccbULL, }, /* 32 */
+ { 0xffffccccffffccccULL, 0xffffccccffffccccULL, },
+ { 0xffff7776ffff7776ULL, 0xffff7776ffff7776ULL, },
+ { 0x0000222100002221ULL, 0x0000222100002221ULL, },
+ { 0xffff9998ffff9998ULL, 0xffff9998ffff9998ULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0x000005afffffb05aULL, 0xffff5b04000005afULL, },
+ { 0xffff93e8ffffe93dULL, 0x00003e93ffff93e8ULL, },
+ { 0x0000333200003332ULL, 0x0000333200003332ULL, }, /* 40 */
+ { 0x0000333300003333ULL, 0x0000333300003333ULL, },
+ { 0xffffddddffffddddULL, 0xffffddddffffddddULL, },
+ { 0x0000888800008888ULL, 0x0000888800008888ULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0x0000666600006666ULL, 0x0000666600006666ULL, },
+ { 0x00006c16000016c1ULL, 0xffffc16b00006c16ULL, },
+ { 0xfffffa4f00004fa4ULL, 0x0000a4fafffffa4fULL, },
+ { 0xffffe38dffff8e37ULL, 0x000038e2ffffe38dULL, }, /* 48 */
+ { 0xffffe38effff8e38ULL, 0x000038e3ffffe38eULL, },
+ { 0xffff8e38ffff38e2ULL, 0xffffe38dffff8e38ULL, },
+ { 0x000038e3ffffe38dULL, 0x00008e38000038e3ULL, },
+ { 0xffffb05affff5b04ULL, 0x000005afffffb05aULL, },
+ { 0x000016c1ffffc16bULL, 0x00006c16000016c1ULL, },
+ { 0x00001c71ffff71c6ULL, 0xffffc71b00001c71ULL, },
+ { 0xffffaaaaffffaaa9ULL, 0x0000aaaaffffaaaaULL, },
+ { 0x00001c70000071c6ULL, 0xffffc71b00001c70ULL, }, /* 56 */
+ { 0x00001c71000071c7ULL, 0xffffc71c00001c71ULL, },
+ { 0xffffc71b00001c71ULL, 0xffff71c6ffffc71bULL, },
+ { 0x000071c60000c71cULL, 0x00001c71000071c6ULL, },
+ { 0xffffe93d00003e93ULL, 0xffff93e8ffffe93dULL, },
+ { 0x00004fa40000a4faULL, 0xfffffa4f00004fa4ULL, },
+ { 0x0000555400005555ULL, 0xffff555400005554ULL, },
+ { 0xffffe38d00008e38ULL, 0x000038e3ffffe38dULL, },
+ { 0xffff6f3600007da2ULL, 0x000056c5ffffae87ULL, }, /* 64 */
+ { 0xffff88cdffffef6aULL, 0x0000068100005177ULL, },
+ { 0xffff3714ffffb3e2ULL, 0x000012660000238fULL, },
+ { 0xffff9eb700000ab0ULL, 0xffffd43fffffe11bULL, },
+ { 0xffffe28a0000a2d3ULL, 0x00001e55ffffc54bULL, },
+ { 0xfffffc210000149bULL, 0xffffce110000683bULL, },
+ { 0xffffaa68ffffd913ULL, 0xffffd9f600003a53ULL, },
+ { 0x0000120b00002fe1ULL, 0xffff9bcffffff7dfULL, },
+ { 0xffff932600000f0fULL, 0x00003336ffff5b37ULL, }, /* 72 */
+ { 0xffffacbdffff80d7ULL, 0xffffe2f2fffffe27ULL, },
+ { 0xffff5b04ffff454fULL, 0xffffeed7ffffd03fULL, },
+ { 0xffffc2a7ffff9c1dULL, 0xffffb0b0ffff8dcbULL, },
+ { 0x0000571b0000b371ULL, 0xffff994fffff594eULL, },
+ { 0x000070b200002539ULL, 0xffff490bfffffc3eULL, },
+};
+
+ gettimeofday(&start, NULL);
+
+ for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) {
+ do_msa_HADD_S_W(b128_pattern[i], b128_pattern[j],
+ b128_result[PATTERN_INPUTS_SHORT_COUNT * i + j]);
+ }
+ }
+
+ for (i = 0; i < RANDOM_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < RANDOM_INPUTS_SHORT_COUNT; j++) {
+ do_msa_HADD_S_W(b128_random[i], b128_random[j],
+ b128_result[((PATTERN_INPUTS_SHORT_COUNT) *
+ (PATTERN_INPUTS_SHORT_COUNT)) +
+ RANDOM_INPUTS_SHORT_COUNT * i + j]);
+ }
+ }
+
+ gettimeofday(&end, NULL);
+
+ elapsed_time = (end.tv_sec - start.tv_sec) * 1000.0;
+ elapsed_time += (end.tv_usec - start.tv_usec) / 1000.0;
+
+ ret = check_results(instruction_name, TEST_COUNT_TOTAL, elapsed_time,
+ &b128_result[0][0], &b128_expect[0][0]);
+
+ return ret;
+}
diff --git a/tests/tcg/mips/user/ase/msa/int-add/test_msa_hadd_u_d.c b/tests/tcg/mips/user/ase/msa/int-add/test_msa_hadd_u_d.c
new file mode 100644
index 0000000..76f36a7
--- /dev/null
+++ b/tests/tcg/mips/user/ase/msa/int-add/test_msa_hadd_u_d.c
@@ -0,0 +1,151 @@
+/*
+ * Test program for MSA instruction HADD_U.D
+ *
+ * Copyright (C) 2018 Wave Computing, Inc.
+ * Copyright (C) 2018 Aleksandar Markovic <amarkovic@wavecomp.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
+#include <sys/time.h>
+#include <stdint.h>
+
+#include "../../../../include/wrappers_msa.h"
+#include "../../../../include/test_inputs.h"
+#include "../../../../include/test_utils.h"
+
+#define TEST_COUNT_TOTAL ( \
+ (PATTERN_INPUTS_SHORT_COUNT) * (PATTERN_INPUTS_SHORT_COUNT) + \
+ (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT))
+
+
+int32_t main(void)
+{
+ char *instruction_name = "HADD_U.D";
+ int32_t ret;
+ uint32_t i, j;
+ struct timeval start, end;
+ double elapsed_time;
+
+ uint64_t b128_result[TEST_COUNT_TOTAL][2];
+ uint64_t b128_expect[TEST_COUNT_TOTAL][2] = {
+ { 0x00000001fffffffeULL, 0x00000001fffffffeULL, }, /* 0 */
+ { 0x00000000ffffffffULL, 0x00000000ffffffffULL, },
+ { 0x00000001aaaaaaa9ULL, 0x00000001aaaaaaa9ULL, },
+ { 0x0000000155555554ULL, 0x0000000155555554ULL, },
+ { 0x00000001cccccccbULL, 0x00000001cccccccbULL, },
+ { 0x0000000133333332ULL, 0x0000000133333332ULL, },
+ { 0x000000018e38e38dULL, 0x00000001e38e38e2ULL, },
+ { 0x0000000171c71c70ULL, 0x000000011c71c71bULL, },
+ { 0x00000000ffffffffULL, 0x00000000ffffffffULL, }, /* 8 */
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0x00000000aaaaaaaaULL, 0x00000000aaaaaaaaULL, },
+ { 0x0000000055555555ULL, 0x0000000055555555ULL, },
+ { 0x00000000ccccccccULL, 0x00000000ccccccccULL, },
+ { 0x0000000033333333ULL, 0x0000000033333333ULL, },
+ { 0x000000008e38e38eULL, 0x00000000e38e38e3ULL, },
+ { 0x0000000071c71c71ULL, 0x000000001c71c71cULL, },
+ { 0x00000001aaaaaaa9ULL, 0x00000001aaaaaaa9ULL, }, /* 16 */
+ { 0x00000000aaaaaaaaULL, 0x00000000aaaaaaaaULL, },
+ { 0x0000000155555554ULL, 0x0000000155555554ULL, },
+ { 0x00000000ffffffffULL, 0x00000000ffffffffULL, },
+ { 0x0000000177777776ULL, 0x0000000177777776ULL, },
+ { 0x00000000ddddddddULL, 0x00000000ddddddddULL, },
+ { 0x0000000138e38e38ULL, 0x000000018e38e38dULL, },
+ { 0x000000011c71c71bULL, 0x00000000c71c71c6ULL, },
+ { 0x0000000155555554ULL, 0x0000000155555554ULL, }, /* 24 */
+ { 0x0000000055555555ULL, 0x0000000055555555ULL, },
+ { 0x00000000ffffffffULL, 0x00000000ffffffffULL, },
+ { 0x00000000aaaaaaaaULL, 0x00000000aaaaaaaaULL, },
+ { 0x0000000122222221ULL, 0x0000000122222221ULL, },
+ { 0x0000000088888888ULL, 0x0000000088888888ULL, },
+ { 0x00000000e38e38e3ULL, 0x0000000138e38e38ULL, },
+ { 0x00000000c71c71c6ULL, 0x0000000071c71c71ULL, },
+ { 0x00000001cccccccbULL, 0x00000001cccccccbULL, }, /* 32 */
+ { 0x00000000ccccccccULL, 0x00000000ccccccccULL, },
+ { 0x0000000177777776ULL, 0x0000000177777776ULL, },
+ { 0x0000000122222221ULL, 0x0000000122222221ULL, },
+ { 0x0000000199999998ULL, 0x0000000199999998ULL, },
+ { 0x00000000ffffffffULL, 0x00000000ffffffffULL, },
+ { 0x000000015b05b05aULL, 0x00000001b05b05afULL, },
+ { 0x000000013e93e93dULL, 0x00000000e93e93e8ULL, },
+ { 0x0000000133333332ULL, 0x0000000133333332ULL, }, /* 40 */
+ { 0x0000000033333333ULL, 0x0000000033333333ULL, },
+ { 0x00000000ddddddddULL, 0x00000000ddddddddULL, },
+ { 0x0000000088888888ULL, 0x0000000088888888ULL, },
+ { 0x00000000ffffffffULL, 0x00000000ffffffffULL, },
+ { 0x0000000066666666ULL, 0x0000000066666666ULL, },
+ { 0x00000000c16c16c1ULL, 0x0000000116c16c16ULL, },
+ { 0x00000000a4fa4fa4ULL, 0x000000004fa4fa4fULL, },
+ { 0x00000001e38e38e2ULL, 0x0000000138e38e37ULL, }, /* 48 */
+ { 0x00000000e38e38e3ULL, 0x0000000038e38e38ULL, },
+ { 0x000000018e38e38dULL, 0x00000000e38e38e2ULL, },
+ { 0x0000000138e38e38ULL, 0x000000008e38e38dULL, },
+ { 0x00000001b05b05afULL, 0x0000000105b05b04ULL, },
+ { 0x0000000116c16c16ULL, 0x000000006c16c16bULL, },
+ { 0x0000000171c71c71ULL, 0x000000011c71c71bULL, },
+ { 0x0000000155555554ULL, 0x0000000055555554ULL, },
+ { 0x000000011c71c71bULL, 0x00000001c71c71c6ULL, }, /* 56 */
+ { 0x000000001c71c71cULL, 0x00000000c71c71c7ULL, },
+ { 0x00000000c71c71c6ULL, 0x0000000171c71c71ULL, },
+ { 0x0000000071c71c71ULL, 0x000000011c71c71cULL, },
+ { 0x00000000e93e93e8ULL, 0x0000000193e93e93ULL, },
+ { 0x000000004fa4fa4fULL, 0x00000000fa4fa4faULL, },
+ { 0x00000000aaaaaaaaULL, 0x00000001aaaaaaaaULL, },
+ { 0x000000008e38e38dULL, 0x00000000e38e38e3ULL, },
+ { 0x00000000b0cd3c0cULL, 0x0000000149e2bb6aULL, }, /* 64 */
+ { 0x00000000d5feadd4ULL, 0x0000000060a65e5aULL, },
+ { 0x00000001423a724cULL, 0x00000000f6923072ULL, },
+ { 0x00000000e69cc91aULL, 0x00000000f4a9edfeULL, },
+ { 0x00000001242055a3ULL, 0x0000000111736b26ULL, },
+ { 0x000000014951c76bULL, 0x0000000028370e16ULL, },
+ { 0x00000001b58d8be3ULL, 0x00000000be22e02eULL, },
+ { 0x0000000159efe2b1ULL, 0x00000000bc3a9dbaULL, },
+ { 0x00000000d4bd03eaULL, 0x000000012654770bULL, }, /* 72 */
+ { 0x00000000f9ee75b2ULL, 0x000000003d1819fbULL, },
+ { 0x00000001662a3a2aULL, 0x00000000d303ec13ULL, },
+ { 0x000000010a8c90f8ULL, 0x00000000d11ba99fULL, },
+ { 0x0000000098b16b8dULL, 0x000000018c6d38e4ULL, },
+ { 0x00000000bde2dd55ULL, 0x00000000a330dbd4ULL, },
+};
+
+ gettimeofday(&start, NULL);
+
+ for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) {
+ do_msa_HADD_U_D(b128_pattern[i], b128_pattern[j],
+ b128_result[PATTERN_INPUTS_SHORT_COUNT * i + j]);
+ }
+ }
+
+ for (i = 0; i < RANDOM_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < RANDOM_INPUTS_SHORT_COUNT; j++) {
+ do_msa_HADD_U_D(b128_random[i], b128_random[j],
+ b128_result[((PATTERN_INPUTS_SHORT_COUNT) *
+ (PATTERN_INPUTS_SHORT_COUNT)) +
+ RANDOM_INPUTS_SHORT_COUNT * i + j]);
+ }
+ }
+
+ gettimeofday(&end, NULL);
+
+ elapsed_time = (end.tv_sec - start.tv_sec) * 1000.0;
+ elapsed_time += (end.tv_usec - start.tv_usec) / 1000.0;
+
+ ret = check_results(instruction_name, TEST_COUNT_TOTAL, elapsed_time,
+ &b128_result[0][0], &b128_expect[0][0]);
+
+ return ret;
+}
diff --git a/tests/tcg/mips/user/ase/msa/int-add/test_msa_hadd_u_h.c b/tests/tcg/mips/user/ase/msa/int-add/test_msa_hadd_u_h.c
new file mode 100644
index 0000000..a377c10
--- /dev/null
+++ b/tests/tcg/mips/user/ase/msa/int-add/test_msa_hadd_u_h.c
@@ -0,0 +1,151 @@
+/*
+ * Test program for MSA instruction HADD_U.H
+ *
+ * Copyright (C) 2018 Wave Computing, Inc.
+ * Copyright (C) 2018 Aleksandar Markovic <amarkovic@wavecomp.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
+#include <sys/time.h>
+#include <stdint.h>
+
+#include "../../../../include/wrappers_msa.h"
+#include "../../../../include/test_inputs.h"
+#include "../../../../include/test_utils.h"
+
+#define TEST_COUNT_TOTAL ( \
+ (PATTERN_INPUTS_SHORT_COUNT) * (PATTERN_INPUTS_SHORT_COUNT) + \
+ (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT))
+
+
+int32_t main(void)
+{
+ char *instruction_name = "HADD_U.H";
+ int32_t ret;
+ uint32_t i, j;
+ struct timeval start, end;
+ double elapsed_time;
+
+ uint64_t b128_result[TEST_COUNT_TOTAL][2];
+ uint64_t b128_expect[TEST_COUNT_TOTAL][2] = {
+ { 0x01fe01fe01fe01feULL, 0x01fe01fe01fe01feULL, }, /* 0 */
+ { 0x00ff00ff00ff00ffULL, 0x00ff00ff00ff00ffULL, },
+ { 0x01a901a901a901a9ULL, 0x01a901a901a901a9ULL, },
+ { 0x0154015401540154ULL, 0x0154015401540154ULL, },
+ { 0x01cb01cb01cb01cbULL, 0x01cb01cb01cb01cbULL, },
+ { 0x0132013201320132ULL, 0x0132013201320132ULL, },
+ { 0x018d01e20137018dULL, 0x01e20137018d01e2ULL, },
+ { 0x0170011b01c60170ULL, 0x011b01c60170011bULL, },
+ { 0x00ff00ff00ff00ffULL, 0x00ff00ff00ff00ffULL, }, /* 8 */
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0x00aa00aa00aa00aaULL, 0x00aa00aa00aa00aaULL, },
+ { 0x0055005500550055ULL, 0x0055005500550055ULL, },
+ { 0x00cc00cc00cc00ccULL, 0x00cc00cc00cc00ccULL, },
+ { 0x0033003300330033ULL, 0x0033003300330033ULL, },
+ { 0x008e00e30038008eULL, 0x00e30038008e00e3ULL, },
+ { 0x0071001c00c70071ULL, 0x001c00c70071001cULL, },
+ { 0x01a901a901a901a9ULL, 0x01a901a901a901a9ULL, }, /* 16 */
+ { 0x00aa00aa00aa00aaULL, 0x00aa00aa00aa00aaULL, },
+ { 0x0154015401540154ULL, 0x0154015401540154ULL, },
+ { 0x00ff00ff00ff00ffULL, 0x00ff00ff00ff00ffULL, },
+ { 0x0176017601760176ULL, 0x0176017601760176ULL, },
+ { 0x00dd00dd00dd00ddULL, 0x00dd00dd00dd00ddULL, },
+ { 0x0138018d00e20138ULL, 0x018d00e20138018dULL, },
+ { 0x011b00c60171011bULL, 0x00c60171011b00c6ULL, },
+ { 0x0154015401540154ULL, 0x0154015401540154ULL, }, /* 24 */
+ { 0x0055005500550055ULL, 0x0055005500550055ULL, },
+ { 0x00ff00ff00ff00ffULL, 0x00ff00ff00ff00ffULL, },
+ { 0x00aa00aa00aa00aaULL, 0x00aa00aa00aa00aaULL, },
+ { 0x0121012101210121ULL, 0x0121012101210121ULL, },
+ { 0x0088008800880088ULL, 0x0088008800880088ULL, },
+ { 0x00e30138008d00e3ULL, 0x0138008d00e30138ULL, },
+ { 0x00c60071011c00c6ULL, 0x0071011c00c60071ULL, },
+ { 0x01cb01cb01cb01cbULL, 0x01cb01cb01cb01cbULL, }, /* 32 */
+ { 0x00cc00cc00cc00ccULL, 0x00cc00cc00cc00ccULL, },
+ { 0x0176017601760176ULL, 0x0176017601760176ULL, },
+ { 0x0121012101210121ULL, 0x0121012101210121ULL, },
+ { 0x0198019801980198ULL, 0x0198019801980198ULL, },
+ { 0x00ff00ff00ff00ffULL, 0x00ff00ff00ff00ffULL, },
+ { 0x015a01af0104015aULL, 0x01af0104015a01afULL, },
+ { 0x013d00e80193013dULL, 0x00e80193013d00e8ULL, },
+ { 0x0132013201320132ULL, 0x0132013201320132ULL, }, /* 40 */
+ { 0x0033003300330033ULL, 0x0033003300330033ULL, },
+ { 0x00dd00dd00dd00ddULL, 0x00dd00dd00dd00ddULL, },
+ { 0x0088008800880088ULL, 0x0088008800880088ULL, },
+ { 0x00ff00ff00ff00ffULL, 0x00ff00ff00ff00ffULL, },
+ { 0x0066006600660066ULL, 0x0066006600660066ULL, },
+ { 0x00c10116006b00c1ULL, 0x0116006b00c10116ULL, },
+ { 0x00a4004f00fa00a4ULL, 0x004f00fa00a4004fULL, },
+ { 0x01e20137018d01e2ULL, 0x0137018d01e20137ULL, }, /* 48 */
+ { 0x00e30038008e00e3ULL, 0x0038008e00e30038ULL, },
+ { 0x018d00e20138018dULL, 0x00e20138018d00e2ULL, },
+ { 0x0138008d00e30138ULL, 0x008d00e30138008dULL, },
+ { 0x01af0104015a01afULL, 0x0104015a01af0104ULL, },
+ { 0x0116006b00c10116ULL, 0x006b00c10116006bULL, },
+ { 0x0171011b00c60171ULL, 0x011b00c60171011bULL, },
+ { 0x0154005401550154ULL, 0x0054015501540054ULL, },
+ { 0x011b01c60170011bULL, 0x01c60170011b01c6ULL, }, /* 56 */
+ { 0x001c00c70071001cULL, 0x00c70071001c00c7ULL, },
+ { 0x00c60171011b00c6ULL, 0x0171011b00c60171ULL, },
+ { 0x0071011c00c60071ULL, 0x011c00c60071011cULL, },
+ { 0x00e80193013d00e8ULL, 0x0193013d00e80193ULL, },
+ { 0x004f00fa00a4004fULL, 0x00fa00a4004f00faULL, },
+ { 0x00aa01aa00a900aaULL, 0x01aa00a900aa01aaULL, },
+ { 0x008d00e30138008dULL, 0x00e30138008d00e3ULL, },
+ { 0x00f201b2008a0095ULL, 0x00b20069017900bcULL, }, /* 64 */
+ { 0x0146014900bb005dULL, 0x01420025013d01acULL, },
+ { 0x00e2019000f700d5ULL, 0x0123010a012900c4ULL, },
+ { 0x00d70133005900a3ULL, 0x013c00e301400150ULL, },
+ { 0x016500cc00af0107ULL, 0x007901190090005eULL, },
+ { 0x01b9006300e000cfULL, 0x010900d50054014eULL, },
+ { 0x015500aa011c0147ULL, 0x00ea01ba00400066ULL, },
+ { 0x014a004d007e0115ULL, 0x01030193005700f2ULL, },
+ { 0x0116017a011b00cbULL, 0x008e012401260031ULL, }, /* 72 */
+ { 0x016a0111014c0093ULL, 0x011e00e000ea0121ULL, },
+ { 0x010601580188010bULL, 0x00ff01c500d60039ULL, },
+ { 0x00fb00fb00ea00d9ULL, 0x0118019e00ed00c5ULL, },
+ { 0x00da00e200c00122ULL, 0x00f400e6012400eeULL, },
+ { 0x012e007900f100eaULL, 0x018400a200e801deULL, },
+};
+
+ gettimeofday(&start, NULL);
+
+ for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) {
+ do_msa_HADD_U_H(b128_pattern[i], b128_pattern[j],
+ b128_result[PATTERN_INPUTS_SHORT_COUNT * i + j]);
+ }
+ }
+
+ for (i = 0; i < RANDOM_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < RANDOM_INPUTS_SHORT_COUNT; j++) {
+ do_msa_HADD_U_H(b128_random[i], b128_random[j],
+ b128_result[((PATTERN_INPUTS_SHORT_COUNT) *
+ (PATTERN_INPUTS_SHORT_COUNT)) +
+ RANDOM_INPUTS_SHORT_COUNT * i + j]);
+ }
+ }
+
+ gettimeofday(&end, NULL);
+
+ elapsed_time = (end.tv_sec - start.tv_sec) * 1000.0;
+ elapsed_time += (end.tv_usec - start.tv_usec) / 1000.0;
+
+ ret = check_results(instruction_name, TEST_COUNT_TOTAL, elapsed_time,
+ &b128_result[0][0], &b128_expect[0][0]);
+
+ return ret;
+}
diff --git a/tests/tcg/mips/user/ase/msa/int-add/test_msa_hadd_u_w.c b/tests/tcg/mips/user/ase/msa/int-add/test_msa_hadd_u_w.c
new file mode 100644
index 0000000..4f4c54a
--- /dev/null
+++ b/tests/tcg/mips/user/ase/msa/int-add/test_msa_hadd_u_w.c
@@ -0,0 +1,151 @@
+/*
+ * Test program for MSA instruction HADD_U.W
+ *
+ * Copyright (C) 2018 Wave Computing, Inc.
+ * Copyright (C) 2018 Aleksandar Markovic <amarkovic@wavecomp.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
+#include <sys/time.h>
+#include <stdint.h>
+
+#include "../../../../include/wrappers_msa.h"
+#include "../../../../include/test_inputs.h"
+#include "../../../../include/test_utils.h"
+
+#define TEST_COUNT_TOTAL ( \
+ (PATTERN_INPUTS_SHORT_COUNT) * (PATTERN_INPUTS_SHORT_COUNT) + \
+ (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT))
+
+
+int32_t main(void)
+{
+ char *instruction_name = "HADD_U.W";
+ int32_t ret;
+ uint32_t i, j;
+ struct timeval start, end;
+ double elapsed_time;
+
+ uint64_t b128_result[TEST_COUNT_TOTAL][2];
+ uint64_t b128_expect[TEST_COUNT_TOTAL][2] = {
+ { 0x0001fffe0001fffeULL, 0x0001fffe0001fffeULL, }, /* 0 */
+ { 0x0000ffff0000ffffULL, 0x0000ffff0000ffffULL, },
+ { 0x0001aaa90001aaa9ULL, 0x0001aaa90001aaa9ULL, },
+ { 0x0001555400015554ULL, 0x0001555400015554ULL, },
+ { 0x0001cccb0001cccbULL, 0x0001cccb0001cccbULL, },
+ { 0x0001333200013332ULL, 0x0001333200013332ULL, },
+ { 0x000138e20001e38dULL, 0x00018e37000138e2ULL, },
+ { 0x0001c71b00011c70ULL, 0x000171c60001c71bULL, },
+ { 0x0000ffff0000ffffULL, 0x0000ffff0000ffffULL, }, /* 8 */
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0x0000aaaa0000aaaaULL, 0x0000aaaa0000aaaaULL, },
+ { 0x0000555500005555ULL, 0x0000555500005555ULL, },
+ { 0x0000cccc0000ccccULL, 0x0000cccc0000ccccULL, },
+ { 0x0000333300003333ULL, 0x0000333300003333ULL, },
+ { 0x000038e30000e38eULL, 0x00008e38000038e3ULL, },
+ { 0x0000c71c00001c71ULL, 0x000071c70000c71cULL, },
+ { 0x0001aaa90001aaa9ULL, 0x0001aaa90001aaa9ULL, }, /* 16 */
+ { 0x0000aaaa0000aaaaULL, 0x0000aaaa0000aaaaULL, },
+ { 0x0001555400015554ULL, 0x0001555400015554ULL, },
+ { 0x0000ffff0000ffffULL, 0x0000ffff0000ffffULL, },
+ { 0x0001777600017776ULL, 0x0001777600017776ULL, },
+ { 0x0000dddd0000ddddULL, 0x0000dddd0000ddddULL, },
+ { 0x0000e38d00018e38ULL, 0x000138e20000e38dULL, },
+ { 0x000171c60000c71bULL, 0x00011c71000171c6ULL, },
+ { 0x0001555400015554ULL, 0x0001555400015554ULL, }, /* 24 */
+ { 0x0000555500005555ULL, 0x0000555500005555ULL, },
+ { 0x0000ffff0000ffffULL, 0x0000ffff0000ffffULL, },
+ { 0x0000aaaa0000aaaaULL, 0x0000aaaa0000aaaaULL, },
+ { 0x0001222100012221ULL, 0x0001222100012221ULL, },
+ { 0x0000888800008888ULL, 0x0000888800008888ULL, },
+ { 0x00008e38000138e3ULL, 0x0000e38d00008e38ULL, },
+ { 0x00011c71000071c6ULL, 0x0000c71c00011c71ULL, },
+ { 0x0001cccb0001cccbULL, 0x0001cccb0001cccbULL, }, /* 32 */
+ { 0x0000cccc0000ccccULL, 0x0000cccc0000ccccULL, },
+ { 0x0001777600017776ULL, 0x0001777600017776ULL, },
+ { 0x0001222100012221ULL, 0x0001222100012221ULL, },
+ { 0x0001999800019998ULL, 0x0001999800019998ULL, },
+ { 0x0000ffff0000ffffULL, 0x0000ffff0000ffffULL, },
+ { 0x000105af0001b05aULL, 0x00015b04000105afULL, },
+ { 0x000193e80000e93dULL, 0x00013e93000193e8ULL, },
+ { 0x0001333200013332ULL, 0x0001333200013332ULL, }, /* 40 */
+ { 0x0000333300003333ULL, 0x0000333300003333ULL, },
+ { 0x0000dddd0000ddddULL, 0x0000dddd0000ddddULL, },
+ { 0x0000888800008888ULL, 0x0000888800008888ULL, },
+ { 0x0000ffff0000ffffULL, 0x0000ffff0000ffffULL, },
+ { 0x0000666600006666ULL, 0x0000666600006666ULL, },
+ { 0x00006c16000116c1ULL, 0x0000c16b00006c16ULL, },
+ { 0x0000fa4f00004fa4ULL, 0x0000a4fa0000fa4fULL, },
+ { 0x0001e38d00018e37ULL, 0x000138e20001e38dULL, }, /* 48 */
+ { 0x0000e38e00008e38ULL, 0x000038e30000e38eULL, },
+ { 0x00018e38000138e2ULL, 0x0000e38d00018e38ULL, },
+ { 0x000138e30000e38dULL, 0x00008e38000138e3ULL, },
+ { 0x0001b05a00015b04ULL, 0x000105af0001b05aULL, },
+ { 0x000116c10000c16bULL, 0x00006c16000116c1ULL, },
+ { 0x00011c71000171c6ULL, 0x0000c71b00011c71ULL, },
+ { 0x0001aaaa0000aaa9ULL, 0x0000aaaa0001aaaaULL, },
+ { 0x00011c70000171c6ULL, 0x0001c71b00011c70ULL, }, /* 56 */
+ { 0x00001c71000071c7ULL, 0x0000c71c00001c71ULL, },
+ { 0x0000c71b00011c71ULL, 0x000171c60000c71bULL, },
+ { 0x000071c60000c71cULL, 0x00011c71000071c6ULL, },
+ { 0x0000e93d00013e93ULL, 0x000193e80000e93dULL, },
+ { 0x00004fa40000a4faULL, 0x0000fa4f00004fa4ULL, },
+ { 0x0000555400015555ULL, 0x0001555400005554ULL, },
+ { 0x0000e38d00008e38ULL, 0x000138e30000e38dULL, },
+ { 0x00016f3600007da2ULL, 0x000056c50001ae87ULL, }, /* 64 */
+ { 0x000088cd0000ef6aULL, 0x0001068100015177ULL, },
+ { 0x000137140000b3e2ULL, 0x000112660001238fULL, },
+ { 0x00009eb700010ab0ULL, 0x0000d43f0001e11bULL, },
+ { 0x0001e28a0000a2d3ULL, 0x00001e550000c54bULL, },
+ { 0x0000fc210001149bULL, 0x0000ce110000683bULL, },
+ { 0x0001aa680000d913ULL, 0x0000d9f600003a53ULL, },
+ { 0x0001120b00012fe1ULL, 0x00009bcf0000f7dfULL, },
+ { 0x0001932600010f0fULL, 0x0000333600015b37ULL, }, /* 72 */
+ { 0x0000acbd000180d7ULL, 0x0000e2f20000fe27ULL, },
+ { 0x00015b040001454fULL, 0x0000eed70000d03fULL, },
+ { 0x0000c2a700019c1dULL, 0x0000b0b000018dcbULL, },
+ { 0x0001571b0000b371ULL, 0x0000994f0001594eULL, },
+ { 0x000070b200012539ULL, 0x0001490b0000fc3eULL, },
+};
+
+ gettimeofday(&start, NULL);
+
+ for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) {
+ do_msa_HADD_U_W(b128_pattern[i], b128_pattern[j],
+ b128_result[PATTERN_INPUTS_SHORT_COUNT * i + j]);
+ }
+ }
+
+ for (i = 0; i < RANDOM_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < RANDOM_INPUTS_SHORT_COUNT; j++) {
+ do_msa_HADD_U_W(b128_random[i], b128_random[j],
+ b128_result[((PATTERN_INPUTS_SHORT_COUNT) *
+ (PATTERN_INPUTS_SHORT_COUNT)) +
+ RANDOM_INPUTS_SHORT_COUNT * i + j]);
+ }
+ }
+
+ gettimeofday(&end, NULL);
+
+ elapsed_time = (end.tv_sec - start.tv_sec) * 1000.0;
+ elapsed_time += (end.tv_usec - start.tv_usec) / 1000.0;
+
+ ret = check_results(instruction_name, TEST_COUNT_TOTAL, elapsed_time,
+ &b128_result[0][0], &b128_expect[0][0]);
+
+ return ret;
+}
--
2.7.4
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [Qemu-devel] [PATCH 2/2] target/mips: Tests for binary integer MSA instruction (add, adds, hadd...)
2019-03-04 16:51 ` [Qemu-devel] [PATCH 2/2] target/mips: Tests for binary integer MSA instruction (add, adds, hadd...) Mateja Marjanovic
@ 2019-03-04 18:43 ` Aleksandar Markovic
0 siblings, 0 replies; 10+ messages in thread
From: Aleksandar Markovic @ 2019-03-04 18:43 UTC (permalink / raw)
To: Mateja Marjanovic, qemu-devel; +Cc: aurelien, Aleksandar Rikalo
> From: Mateja Marjanovic <mateja.marjanovic@rt-rk.com>
> Subject: [PATCH 2/2] target/mips: Tests for binary integer MSA instruction (add, adds, hadd...)
>
> From: Mateja Marjanovic <Mateja.Marjanovic@rt-rk.com>
>
> These are the regression tests for MSA binary operations.
> Various flavors of instruction add.
The commit message should be a little improved, otherwise:
Reviewed-by: Aleksandar Markovic <amarkovic@wavecomp.com>
________________________________________
From: Mateja Marjanovic <mateja.marjanovic@rt-rk.com>
Sent: Monday, March 4, 2019 5:51:23 PM
To: qemu-devel@nongnu.org
Cc: aurelien@aurel32.net; Aleksandar Markovic; Aleksandar Rikalo
Subject: [PATCH 2/2] target/mips: Tests for binary integer MSA instruction (add, adds, hadd...)
From: Mateja Marjanovic <Mateja.Marjanovic@rt-rk.com>
These are the regression tests for MSA binary operations.
Various flavors of instruction add.
Signed-off-by: Mateja Marjanovic <mateja.marjanovic@rt-rk.com>
---
.../mips/user/ase/msa/int-add/test_msa_add_a_b.c | 151 +++++++++++++++++++++
.../mips/user/ase/msa/int-add/test_msa_add_a_d.c | 151 +++++++++++++++++++++
.../mips/user/ase/msa/int-add/test_msa_add_a_h.c | 151 +++++++++++++++++++++
.../mips/user/ase/msa/int-add/test_msa_add_a_w.c | 151 +++++++++++++++++++++
.../mips/user/ase/msa/int-add/test_msa_adds_a_b.c | 151 +++++++++++++++++++++
.../mips/user/ase/msa/int-add/test_msa_adds_a_d.c | 151 +++++++++++++++++++++
.../mips/user/ase/msa/int-add/test_msa_adds_a_h.c | 151 +++++++++++++++++++++
.../mips/user/ase/msa/int-add/test_msa_adds_a_w.c | 151 +++++++++++++++++++++
.../mips/user/ase/msa/int-add/test_msa_adds_s_b.c | 151 +++++++++++++++++++++
.../mips/user/ase/msa/int-add/test_msa_adds_s_d.c | 151 +++++++++++++++++++++
.../mips/user/ase/msa/int-add/test_msa_adds_s_h.c | 151 +++++++++++++++++++++
.../mips/user/ase/msa/int-add/test_msa_adds_s_w.c | 151 +++++++++++++++++++++
.../mips/user/ase/msa/int-add/test_msa_adds_u_b.c | 151 +++++++++++++++++++++
.../mips/user/ase/msa/int-add/test_msa_adds_u_d.c | 151 +++++++++++++++++++++
.../mips/user/ase/msa/int-add/test_msa_adds_u_h.c | 151 +++++++++++++++++++++
.../mips/user/ase/msa/int-add/test_msa_adds_u_w.c | 151 +++++++++++++++++++++
.../mips/user/ase/msa/int-add/test_msa_addv_b.c | 151 +++++++++++++++++++++
.../mips/user/ase/msa/int-add/test_msa_addv_d.c | 151 +++++++++++++++++++++
.../mips/user/ase/msa/int-add/test_msa_addv_h.c | 151 +++++++++++++++++++++
.../mips/user/ase/msa/int-add/test_msa_addv_w.c | 151 +++++++++++++++++++++
.../mips/user/ase/msa/int-add/test_msa_hadd_s_d.c | 151 +++++++++++++++++++++
.../mips/user/ase/msa/int-add/test_msa_hadd_s_h.c | 151 +++++++++++++++++++++
.../mips/user/ase/msa/int-add/test_msa_hadd_s_w.c | 151 +++++++++++++++++++++
.../mips/user/ase/msa/int-add/test_msa_hadd_u_d.c | 151 +++++++++++++++++++++
.../mips/user/ase/msa/int-add/test_msa_hadd_u_h.c | 151 +++++++++++++++++++++
.../mips/user/ase/msa/int-add/test_msa_hadd_u_w.c | 151 +++++++++++++++++++++
26 files changed, 3926 insertions(+)
create mode 100644 tests/tcg/mips/user/ase/msa/int-add/test_msa_add_a_b.c
create mode 100644 tests/tcg/mips/user/ase/msa/int-add/test_msa_add_a_d.c
create mode 100644 tests/tcg/mips/user/ase/msa/int-add/test_msa_add_a_h.c
create mode 100644 tests/tcg/mips/user/ase/msa/int-add/test_msa_add_a_w.c
create mode 100644 tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_a_b.c
create mode 100644 tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_a_d.c
create mode 100644 tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_a_h.c
create mode 100644 tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_a_w.c
create mode 100644 tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_s_b.c
create mode 100644 tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_s_d.c
create mode 100644 tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_s_h.c
create mode 100644 tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_s_w.c
create mode 100644 tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_u_b.c
create mode 100644 tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_u_d.c
create mode 100644 tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_u_h.c
create mode 100644 tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_u_w.c
create mode 100644 tests/tcg/mips/user/ase/msa/int-add/test_msa_addv_b.c
create mode 100644 tests/tcg/mips/user/ase/msa/int-add/test_msa_addv_d.c
create mode 100644 tests/tcg/mips/user/ase/msa/int-add/test_msa_addv_h.c
create mode 100644 tests/tcg/mips/user/ase/msa/int-add/test_msa_addv_w.c
create mode 100644 tests/tcg/mips/user/ase/msa/int-add/test_msa_hadd_s_d.c
create mode 100644 tests/tcg/mips/user/ase/msa/int-add/test_msa_hadd_s_h.c
create mode 100644 tests/tcg/mips/user/ase/msa/int-add/test_msa_hadd_s_w.c
create mode 100644 tests/tcg/mips/user/ase/msa/int-add/test_msa_hadd_u_d.c
create mode 100644 tests/tcg/mips/user/ase/msa/int-add/test_msa_hadd_u_h.c
create mode 100644 tests/tcg/mips/user/ase/msa/int-add/test_msa_hadd_u_w.c
diff --git a/tests/tcg/mips/user/ase/msa/int-add/test_msa_add_a_b.c b/tests/tcg/mips/user/ase/msa/int-add/test_msa_add_a_b.c
new file mode 100644
index 0000000..325c28c
--- /dev/null
+++ b/tests/tcg/mips/user/ase/msa/int-add/test_msa_add_a_b.c
@@ -0,0 +1,151 @@
+/*
+ * Test program for MSA instruction ADD_A.B
+ *
+ * Copyright (C) 2018 Wave Computing, Inc.
+ * Copyright (C) 2018 Aleksandar Markovic <amarkovic@wavecomp.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
+#include <sys/time.h>
+#include <stdint.h>
+
+#include "../../../../include/wrappers_msa.h"
+#include "../../../../include/test_inputs.h"
+#include "../../../../include/test_utils.h"
+
+#define TEST_COUNT_TOTAL ( \
+ (PATTERN_INPUTS_SHORT_COUNT) * (PATTERN_INPUTS_SHORT_COUNT) + \
+ (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT))
+
+
+int32_t main(void)
+{
+ char *instruction_name = "ADD_A.B";
+ int32_t ret;
+ uint32_t i, j;
+ struct timeval start, end;
+ double elapsed_time;
+
+ uint64_t b128_result[TEST_COUNT_TOTAL][2];
+ uint64_t b128_expect[TEST_COUNT_TOTAL][2] = {
+ { 0x0202020202020202ULL, 0x0202020202020202ULL, }, /* 0 */
+ { 0x0101010101010101ULL, 0x0101010101010101ULL, },
+ { 0x5757575757575757ULL, 0x5757575757575757ULL, },
+ { 0x5656565656565656ULL, 0x5656565656565656ULL, },
+ { 0x3535353535353535ULL, 0x3535353535353535ULL, },
+ { 0x3434343434343434ULL, 0x3434343434343434ULL, },
+ { 0x1e73391e73391e73ULL, 0x391e73391e73391eULL, },
+ { 0x1d723a1d723a1d72ULL, 0x3a1d723a1d723a1dULL, },
+ { 0x0101010101010101ULL, 0x0101010101010101ULL, }, /* 8 */
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0x5656565656565656ULL, 0x5656565656565656ULL, },
+ { 0x5555555555555555ULL, 0x5555555555555555ULL, },
+ { 0x3434343434343434ULL, 0x3434343434343434ULL, },
+ { 0x3333333333333333ULL, 0x3333333333333333ULL, },
+ { 0x1d72381d72381d72ULL, 0x381d72381d72381dULL, },
+ { 0x1c71391c71391c71ULL, 0x391c71391c71391cULL, },
+ { 0x5757575757575757ULL, 0x5757575757575757ULL, }, /* 16 */
+ { 0x5656565656565656ULL, 0x5656565656565656ULL, },
+ { 0xacacacacacacacacULL, 0xacacacacacacacacULL, },
+ { 0xababababababababULL, 0xababababababababULL, },
+ { 0x8a8a8a8a8a8a8a8aULL, 0x8a8a8a8a8a8a8a8aULL, },
+ { 0x8989898989898989ULL, 0x8989898989898989ULL, },
+ { 0x73c88e73c88e73c8ULL, 0x8e73c88e73c88e73ULL, },
+ { 0x72c78f72c78f72c7ULL, 0x8f72c78f72c78f72ULL, },
+ { 0x5656565656565656ULL, 0x5656565656565656ULL, }, /* 24 */
+ { 0x5555555555555555ULL, 0x5555555555555555ULL, },
+ { 0xababababababababULL, 0xababababababababULL, },
+ { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, },
+ { 0x8989898989898989ULL, 0x8989898989898989ULL, },
+ { 0x8888888888888888ULL, 0x8888888888888888ULL, },
+ { 0x72c78d72c78d72c7ULL, 0x8d72c78d72c78d72ULL, },
+ { 0x71c68e71c68e71c6ULL, 0x8e71c68e71c68e71ULL, },
+ { 0x3535353535353535ULL, 0x3535353535353535ULL, }, /* 32 */
+ { 0x3434343434343434ULL, 0x3434343434343434ULL, },
+ { 0x8a8a8a8a8a8a8a8aULL, 0x8a8a8a8a8a8a8a8aULL, },
+ { 0x8989898989898989ULL, 0x8989898989898989ULL, },
+ { 0x6868686868686868ULL, 0x6868686868686868ULL, },
+ { 0x6767676767676767ULL, 0x6767676767676767ULL, },
+ { 0x51a66c51a66c51a6ULL, 0x6c51a66c51a66c51ULL, },
+ { 0x50a56d50a56d50a5ULL, 0x6d50a56d50a56d50ULL, },
+ { 0x3434343434343434ULL, 0x3434343434343434ULL, }, /* 40 */
+ { 0x3333333333333333ULL, 0x3333333333333333ULL, },
+ { 0x8989898989898989ULL, 0x8989898989898989ULL, },
+ { 0x8888888888888888ULL, 0x8888888888888888ULL, },
+ { 0x6767676767676767ULL, 0x6767676767676767ULL, },
+ { 0x6666666666666666ULL, 0x6666666666666666ULL, },
+ { 0x50a56b50a56b50a5ULL, 0x6b50a56b50a56b50ULL, },
+ { 0x4fa46c4fa46c4fa4ULL, 0x6c4fa46c4fa46c4fULL, },
+ { 0x1e73391e73391e73ULL, 0x391e73391e73391eULL, }, /* 48 */
+ { 0x1d72381d72381d72ULL, 0x381d72381d72381dULL, },
+ { 0x73c88e73c88e73c8ULL, 0x8e73c88e73c88e73ULL, },
+ { 0x72c78d72c78d72c7ULL, 0x8d72c78d72c78d72ULL, },
+ { 0x51a66c51a66c51a6ULL, 0x6c51a66c51a66c51ULL, },
+ { 0x50a56b50a56b50a5ULL, 0x6b50a56b50a56b50ULL, },
+ { 0x3ae4703ae4703ae4ULL, 0x703ae4703ae4703aULL, },
+ { 0x39e37139e37139e3ULL, 0x7139e37139e37139ULL, },
+ { 0x1d723a1d723a1d72ULL, 0x3a1d723a1d723a1dULL, }, /* 56 */
+ { 0x1c71391c71391c71ULL, 0x391c71391c71391cULL, },
+ { 0x72c78f72c78f72c7ULL, 0x8f72c78f72c78f72ULL, },
+ { 0x71c68e71c68e71c6ULL, 0x8e71c68e71c68e71ULL, },
+ { 0x50a56d50a56d50a5ULL, 0x6d50a56d50a56d50ULL, },
+ { 0x4fa46c4fa46c4fa4ULL, 0x6c4fa46c4fa46c4fULL, },
+ { 0x39e37139e37139e3ULL, 0x7139e37139e37139ULL, },
+ { 0x38e27238e27238e2ULL, 0x7238e27238e27238ULL, },
+ { 0xf0d4346850c4aa80ULL, 0x96ce16bc04f6a018ULL, }, /* 64 */
+ { 0x7dac1a9775cf8e48ULL, 0x5d70507817baa210ULL, },
+ { 0xccc46c8a6f93cac0ULL, 0x728f455f57a67520ULL, },
+ { 0xe8b930818693738eULL, 0xbe76838659bd6e6cULL, },
+ { 0x7dac1a9775cf8e48ULL, 0x5d70507817baa210ULL, },
+ { 0x0a8400c69ada7210ULL, 0x24128a342a7ea408ULL, },
+ { 0x599c52b9949eae88ULL, 0x39317f1b6a6a7718ULL, },
+ { 0x759116b0ab9e5756ULL, 0x8518bd426c817064ULL, },
+ { 0xccc46c8a6f93cac0ULL, 0x728f455f57a67520ULL, }, /* 72 */
+ { 0x599c52b9949eae88ULL, 0x39317f1b6a6a7718ULL, },
+ { 0xa8b4a4ac8e62ea00ULL, 0x4e507402aa564a28ULL, },
+ { 0xc4a968a3a56293ceULL, 0x9a37b229ac6d4374ULL, },
+ { 0xe8b930818693738eULL, 0xbe76838659bd6e6cULL, },
+ { 0x759116b0ab9e5756ULL, 0x8518bd426c817064ULL, },
+};
+
+ gettimeofday(&start, NULL);
+
+ for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) {
+ do_msa_ADD_A_B(b128_pattern[i], b128_pattern[j],
+ b128_result[PATTERN_INPUTS_SHORT_COUNT * i + j]);
+ }
+ }
+
+ for (i = 0; i < RANDOM_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < RANDOM_INPUTS_SHORT_COUNT; j++) {
+ do_msa_ADD_A_B(b128_random[i], b128_random[j],
+ b128_result[((PATTERN_INPUTS_SHORT_COUNT) *
+ (PATTERN_INPUTS_SHORT_COUNT)) +
+ RANDOM_INPUTS_SHORT_COUNT * i + j]);
+ }
+ }
+
+ gettimeofday(&end, NULL);
+
+ elapsed_time = (end.tv_sec - start.tv_sec) * 1000.0;
+ elapsed_time += (end.tv_usec - start.tv_usec) / 1000.0;
+
+ ret = check_results(instruction_name, TEST_COUNT_TOTAL, elapsed_time,
+ &b128_result[0][0], &b128_expect[0][0]);
+
+ return ret;
+}
diff --git a/tests/tcg/mips/user/ase/msa/int-add/test_msa_add_a_d.c b/tests/tcg/mips/user/ase/msa/int-add/test_msa_add_a_d.c
new file mode 100644
index 0000000..7ca73f2
--- /dev/null
+++ b/tests/tcg/mips/user/ase/msa/int-add/test_msa_add_a_d.c
@@ -0,0 +1,151 @@
+/*
+ * Test program for MSA instruction ADD_A.D
+ *
+ * Copyright (C) 2018 Wave Computing, Inc.
+ * Copyright (C) 2018 Aleksandar Markovic <amarkovic@wavecomp.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
+#include <sys/time.h>
+#include <stdint.h>
+
+#include "../../../../include/wrappers_msa.h"
+#include "../../../../include/test_inputs.h"
+#include "../../../../include/test_utils.h"
+
+#define TEST_COUNT_TOTAL ( \
+ (PATTERN_INPUTS_SHORT_COUNT) * (PATTERN_INPUTS_SHORT_COUNT) + \
+ (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT))
+
+
+int32_t main(void)
+{
+ char *instruction_name = "ADD_A.D";
+ int32_t ret;
+ uint32_t i, j;
+ struct timeval start, end;
+ double elapsed_time;
+
+ uint64_t b128_result[TEST_COUNT_TOTAL][2];
+ uint64_t b128_expect[TEST_COUNT_TOTAL][2] = {
+ { 0x0000000000000002ULL, 0x0000000000000002ULL, }, /* 0 */
+ { 0x0000000000000001ULL, 0x0000000000000001ULL, },
+ { 0x5555555555555557ULL, 0x5555555555555557ULL, },
+ { 0x5555555555555556ULL, 0x5555555555555556ULL, },
+ { 0x3333333333333335ULL, 0x3333333333333335ULL, },
+ { 0x3333333333333334ULL, 0x3333333333333334ULL, },
+ { 0x1c71c71c71c71c73ULL, 0x38e38e38e38e38e4ULL, },
+ { 0x1c71c71c71c71c72ULL, 0x38e38e38e38e38e5ULL, },
+ { 0x0000000000000001ULL, 0x0000000000000001ULL, }, /* 8 */
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0x5555555555555556ULL, 0x5555555555555556ULL, },
+ { 0x5555555555555555ULL, 0x5555555555555555ULL, },
+ { 0x3333333333333334ULL, 0x3333333333333334ULL, },
+ { 0x3333333333333333ULL, 0x3333333333333333ULL, },
+ { 0x1c71c71c71c71c72ULL, 0x38e38e38e38e38e3ULL, },
+ { 0x1c71c71c71c71c71ULL, 0x38e38e38e38e38e4ULL, },
+ { 0x5555555555555557ULL, 0x5555555555555557ULL, }, /* 16 */
+ { 0x5555555555555556ULL, 0x5555555555555556ULL, },
+ { 0xaaaaaaaaaaaaaaacULL, 0xaaaaaaaaaaaaaaacULL, },
+ { 0xaaaaaaaaaaaaaaabULL, 0xaaaaaaaaaaaaaaabULL, },
+ { 0x888888888888888aULL, 0x888888888888888aULL, },
+ { 0x8888888888888889ULL, 0x8888888888888889ULL, },
+ { 0x71c71c71c71c71c8ULL, 0x8e38e38e38e38e39ULL, },
+ { 0x71c71c71c71c71c7ULL, 0x8e38e38e38e38e3aULL, },
+ { 0x5555555555555556ULL, 0x5555555555555556ULL, }, /* 24 */
+ { 0x5555555555555555ULL, 0x5555555555555555ULL, },
+ { 0xaaaaaaaaaaaaaaabULL, 0xaaaaaaaaaaaaaaabULL, },
+ { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, },
+ { 0x8888888888888889ULL, 0x8888888888888889ULL, },
+ { 0x8888888888888888ULL, 0x8888888888888888ULL, },
+ { 0x71c71c71c71c71c7ULL, 0x8e38e38e38e38e38ULL, },
+ { 0x71c71c71c71c71c6ULL, 0x8e38e38e38e38e39ULL, },
+ { 0x3333333333333335ULL, 0x3333333333333335ULL, }, /* 32 */
+ { 0x3333333333333334ULL, 0x3333333333333334ULL, },
+ { 0x888888888888888aULL, 0x888888888888888aULL, },
+ { 0x8888888888888889ULL, 0x8888888888888889ULL, },
+ { 0x6666666666666668ULL, 0x6666666666666668ULL, },
+ { 0x6666666666666667ULL, 0x6666666666666667ULL, },
+ { 0x4fa4fa4fa4fa4fa6ULL, 0x6c16c16c16c16c17ULL, },
+ { 0x4fa4fa4fa4fa4fa5ULL, 0x6c16c16c16c16c18ULL, },
+ { 0x3333333333333334ULL, 0x3333333333333334ULL, }, /* 40 */
+ { 0x3333333333333333ULL, 0x3333333333333333ULL, },
+ { 0x8888888888888889ULL, 0x8888888888888889ULL, },
+ { 0x8888888888888888ULL, 0x8888888888888888ULL, },
+ { 0x6666666666666667ULL, 0x6666666666666667ULL, },
+ { 0x6666666666666666ULL, 0x6666666666666666ULL, },
+ { 0x4fa4fa4fa4fa4fa5ULL, 0x6c16c16c16c16c16ULL, },
+ { 0x4fa4fa4fa4fa4fa4ULL, 0x6c16c16c16c16c17ULL, },
+ { 0x1c71c71c71c71c73ULL, 0x38e38e38e38e38e4ULL, }, /* 48 */
+ { 0x1c71c71c71c71c72ULL, 0x38e38e38e38e38e3ULL, },
+ { 0x71c71c71c71c71c8ULL, 0x8e38e38e38e38e39ULL, },
+ { 0x71c71c71c71c71c7ULL, 0x8e38e38e38e38e38ULL, },
+ { 0x4fa4fa4fa4fa4fa6ULL, 0x6c16c16c16c16c17ULL, },
+ { 0x4fa4fa4fa4fa4fa5ULL, 0x6c16c16c16c16c16ULL, },
+ { 0x38e38e38e38e38e4ULL, 0x71c71c71c71c71c6ULL, },
+ { 0x38e38e38e38e38e3ULL, 0x71c71c71c71c71c7ULL, },
+ { 0x1c71c71c71c71c72ULL, 0x38e38e38e38e38e5ULL, }, /* 56 */
+ { 0x1c71c71c71c71c71ULL, 0x38e38e38e38e38e4ULL, },
+ { 0x71c71c71c71c71c7ULL, 0x8e38e38e38e38e3aULL, },
+ { 0x71c71c71c71c71c6ULL, 0x8e38e38e38e38e39ULL, },
+ { 0x4fa4fa4fa4fa4fa5ULL, 0x6c16c16c16c16c18ULL, },
+ { 0x4fa4fa4fa4fa4fa4ULL, 0x6c16c16c16c16c17ULL, },
+ { 0x38e38e38e38e38e3ULL, 0x71c71c71c71c71c7ULL, },
+ { 0x38e38e38e38e38e2ULL, 0x71c71c71c71c71c8ULL, },
+ { 0xef2a3267af3b5580ULL, 0x96ce16bdfcf76018ULL, }, /* 64 */
+ { 0x7bd718d08a09e3b8ULL, 0x5e5ec67913bb0308ULL, },
+ { 0xcb3a6a891dce1f40ULL, 0x733fd25ea9a6d520ULL, },
+ { 0xe7e42f8135cf8d0eULL, 0xbd7582865538cd6cULL, },
+ { 0x7bd718d08a09e3b8ULL, 0x5e5ec67913bb0308ULL, },
+ { 0x0883ff3964d871f0ULL, 0x25ef76342a7ea5f8ULL, },
+ { 0x57e750f1f89cad78ULL, 0x3ad08219c06a7810ULL, },
+ { 0x749115ea109e1b46ULL, 0x850632416bfc705cULL, },
+ { 0xcb3a6a891dce1f40ULL, 0x733fd25ea9a6d520ULL, }, /* 72 */
+ { 0x57e750f1f89cad78ULL, 0x3ad08219c06a7810ULL, },
+ { 0xa74aa2aa8c60e900ULL, 0x4fb18dff56564a28ULL, },
+ { 0xc3f467a2a46256ceULL, 0x99e73e2701e84274ULL, },
+ { 0xe7e42f8135cf8d0eULL, 0xbd7582865538cd6cULL, },
+ { 0x749115ea109e1b46ULL, 0x850632416bfc705cULL, },
+};
+
+ gettimeofday(&start, NULL);
+
+ for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) {
+ do_msa_ADD_A_D(b128_pattern[i], b128_pattern[j],
+ b128_result[PATTERN_INPUTS_SHORT_COUNT * i + j]);
+ }
+ }
+
+ for (i = 0; i < RANDOM_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < RANDOM_INPUTS_SHORT_COUNT; j++) {
+ do_msa_ADD_A_D(b128_random[i], b128_random[j],
+ b128_result[((PATTERN_INPUTS_SHORT_COUNT) *
+ (PATTERN_INPUTS_SHORT_COUNT)) +
+ RANDOM_INPUTS_SHORT_COUNT * i + j]);
+ }
+ }
+
+ gettimeofday(&end, NULL);
+
+ elapsed_time = (end.tv_sec - start.tv_sec) * 1000.0;
+ elapsed_time += (end.tv_usec - start.tv_usec) / 1000.0;
+
+ ret = check_results(instruction_name, TEST_COUNT_TOTAL, elapsed_time,
+ &b128_result[0][0], &b128_expect[0][0]);
+
+ return ret;
+}
diff --git a/tests/tcg/mips/user/ase/msa/int-add/test_msa_add_a_h.c b/tests/tcg/mips/user/ase/msa/int-add/test_msa_add_a_h.c
new file mode 100644
index 0000000..e35483c
--- /dev/null
+++ b/tests/tcg/mips/user/ase/msa/int-add/test_msa_add_a_h.c
@@ -0,0 +1,151 @@
+/*
+ * Test program for MSA instruction ADD_A.H
+ *
+ * Copyright (C) 2018 Wave Computing, Inc.
+ * Copyright (C) 2018 Aleksandar Markovic <amarkovic@wavecomp.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
+#include <sys/time.h>
+#include <stdint.h>
+
+#include "../../../../include/wrappers_msa.h"
+#include "../../../../include/test_inputs.h"
+#include "../../../../include/test_utils.h"
+
+#define TEST_COUNT_TOTAL ( \
+ (PATTERN_INPUTS_SHORT_COUNT) * (PATTERN_INPUTS_SHORT_COUNT) + \
+ (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT))
+
+
+int32_t main(void)
+{
+ char *instruction_name = "ADD_A.H";
+ int32_t ret;
+ uint32_t i, j;
+ struct timeval start, end;
+ double elapsed_time;
+
+ uint64_t b128_result[TEST_COUNT_TOTAL][2];
+ uint64_t b128_expect[TEST_COUNT_TOTAL][2] = {
+ { 0x0002000200020002ULL, 0x0002000200020002ULL, }, /* 0 */
+ { 0x0001000100010001ULL, 0x0001000100010001ULL, },
+ { 0x5557555755575557ULL, 0x5557555755575557ULL, },
+ { 0x5556555655565556ULL, 0x5556555655565556ULL, },
+ { 0x3335333533353335ULL, 0x3335333533353335ULL, },
+ { 0x3334333433343334ULL, 0x3334333433343334ULL, },
+ { 0x1c7338e471c91c73ULL, 0x38e471c91c7338e4ULL, },
+ { 0x1c7238e571c81c72ULL, 0x38e571c81c7238e5ULL, },
+ { 0x0001000100010001ULL, 0x0001000100010001ULL, }, /* 8 */
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0x5556555655565556ULL, 0x5556555655565556ULL, },
+ { 0x5555555555555555ULL, 0x5555555555555555ULL, },
+ { 0x3334333433343334ULL, 0x3334333433343334ULL, },
+ { 0x3333333333333333ULL, 0x3333333333333333ULL, },
+ { 0x1c7238e371c81c72ULL, 0x38e371c81c7238e3ULL, },
+ { 0x1c7138e471c71c71ULL, 0x38e471c71c7138e4ULL, },
+ { 0x5557555755575557ULL, 0x5557555755575557ULL, }, /* 16 */
+ { 0x5556555655565556ULL, 0x5556555655565556ULL, },
+ { 0xaaacaaacaaacaaacULL, 0xaaacaaacaaacaaacULL, },
+ { 0xaaabaaabaaabaaabULL, 0xaaabaaabaaabaaabULL, },
+ { 0x888a888a888a888aULL, 0x888a888a888a888aULL, },
+ { 0x8889888988898889ULL, 0x8889888988898889ULL, },
+ { 0x71c88e39c71e71c8ULL, 0x8e39c71e71c88e39ULL, },
+ { 0x71c78e3ac71d71c7ULL, 0x8e3ac71d71c78e3aULL, },
+ { 0x5556555655565556ULL, 0x5556555655565556ULL, }, /* 24 */
+ { 0x5555555555555555ULL, 0x5555555555555555ULL, },
+ { 0xaaabaaabaaabaaabULL, 0xaaabaaabaaabaaabULL, },
+ { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, },
+ { 0x8889888988898889ULL, 0x8889888988898889ULL, },
+ { 0x8888888888888888ULL, 0x8888888888888888ULL, },
+ { 0x71c78e38c71d71c7ULL, 0x8e38c71d71c78e38ULL, },
+ { 0x71c68e39c71c71c6ULL, 0x8e39c71c71c68e39ULL, },
+ { 0x3335333533353335ULL, 0x3335333533353335ULL, }, /* 32 */
+ { 0x3334333433343334ULL, 0x3334333433343334ULL, },
+ { 0x888a888a888a888aULL, 0x888a888a888a888aULL, },
+ { 0x8889888988898889ULL, 0x8889888988898889ULL, },
+ { 0x6668666866686668ULL, 0x6668666866686668ULL, },
+ { 0x6667666766676667ULL, 0x6667666766676667ULL, },
+ { 0x4fa66c17a4fc4fa6ULL, 0x6c17a4fc4fa66c17ULL, },
+ { 0x4fa56c18a4fb4fa5ULL, 0x6c18a4fb4fa56c18ULL, },
+ { 0x3334333433343334ULL, 0x3334333433343334ULL, }, /* 40 */
+ { 0x3333333333333333ULL, 0x3333333333333333ULL, },
+ { 0x8889888988898889ULL, 0x8889888988898889ULL, },
+ { 0x8888888888888888ULL, 0x8888888888888888ULL, },
+ { 0x6667666766676667ULL, 0x6667666766676667ULL, },
+ { 0x6666666666666666ULL, 0x6666666666666666ULL, },
+ { 0x4fa56c16a4fb4fa5ULL, 0x6c16a4fb4fa56c16ULL, },
+ { 0x4fa46c17a4fa4fa4ULL, 0x6c17a4fa4fa46c17ULL, },
+ { 0x1c7338e471c91c73ULL, 0x38e471c91c7338e4ULL, }, /* 48 */
+ { 0x1c7238e371c81c72ULL, 0x38e371c81c7238e3ULL, },
+ { 0x71c88e39c71e71c8ULL, 0x8e39c71e71c88e39ULL, },
+ { 0x71c78e38c71d71c7ULL, 0x8e38c71d71c78e38ULL, },
+ { 0x4fa66c17a4fc4fa6ULL, 0x6c17a4fc4fa66c17ULL, },
+ { 0x4fa56c16a4fb4fa5ULL, 0x6c16a4fb4fa56c16ULL, },
+ { 0x38e471c6e39038e4ULL, 0x71c6e39038e471c6ULL, },
+ { 0x38e371c7e38f38e3ULL, 0x71c7e38f38e371c7ULL, },
+ { 0x1c7238e571c81c72ULL, 0x38e571c81c7238e5ULL, }, /* 56 */
+ { 0x1c7138e471c71c71ULL, 0x38e471c71c7138e4ULL, },
+ { 0x71c78e3ac71d71c7ULL, 0x8e3ac71d71c78e3aULL, },
+ { 0x71c68e39c71c71c6ULL, 0x8e39c71c71c68e39ULL, },
+ { 0x4fa56c18a4fb4fa5ULL, 0x6c18a4fb4fa56c18ULL, },
+ { 0x4fa46c17a4fa4fa4ULL, 0x6c17a4fa4fa46c17ULL, },
+ { 0x38e371c7e38f38e3ULL, 0x71c7e38f38e371c7ULL, },
+ { 0x38e271c8e38e38e2ULL, 0x71c8e38e38e271c8ULL, },
+ { 0xef2c326850c4aa80ULL, 0x96ce16bc030a9fe8ULL, }, /* 64 */
+ { 0x7bd8199775f58e38ULL, 0x5e5e504416c4a2f0ULL, },
+ { 0xcb3c6a8a6e93c9c0ULL, 0x733f445f565a7508ULL, },
+ { 0xe7e52f81869372f2ULL, 0xbd76828658436d54ULL, },
+ { 0x7bd8199775f58e38ULL, 0x5e5e504416c4a2f0ULL, },
+ { 0x088400c69b2671f0ULL, 0x25ee89cc2a7ea5f8ULL, },
+ { 0x57e851b993c4ad78ULL, 0x3acf7de76a147810ULL, },
+ { 0x749116b0abc456aaULL, 0x8506bc0e6bfd705cULL, },
+ { 0xcb3c6a8a6e93c9c0ULL, 0x733f445f565a7508ULL, }, /* 72 */
+ { 0x57e851b993c4ad78ULL, 0x3acf7de76a147810ULL, },
+ { 0xa74ca2ac8c62e900ULL, 0x4fb07202a9aa4a28ULL, },
+ { 0xc3f567a3a4629232ULL, 0x99e7b029ab934274ULL, },
+ { 0xe7e52f81869372f2ULL, 0xbd76828658436d54ULL, },
+ { 0x749116b0abc456aaULL, 0x8506bc0e6bfd705cULL, },
+};
+
+ gettimeofday(&start, NULL);
+
+ for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) {
+ do_msa_ADD_A_H(b128_pattern[i], b128_pattern[j],
+ b128_result[PATTERN_INPUTS_SHORT_COUNT * i + j]);
+ }
+ }
+
+ for (i = 0; i < RANDOM_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < RANDOM_INPUTS_SHORT_COUNT; j++) {
+ do_msa_ADD_A_H(b128_random[i], b128_random[j],
+ b128_result[((PATTERN_INPUTS_SHORT_COUNT) *
+ (PATTERN_INPUTS_SHORT_COUNT)) +
+ RANDOM_INPUTS_SHORT_COUNT * i + j]);
+ }
+ }
+
+ gettimeofday(&end, NULL);
+
+ elapsed_time = (end.tv_sec - start.tv_sec) * 1000.0;
+ elapsed_time += (end.tv_usec - start.tv_usec) / 1000.0;
+
+ ret = check_results(instruction_name, TEST_COUNT_TOTAL, elapsed_time,
+ &b128_result[0][0], &b128_expect[0][0]);
+
+ return ret;
+}
diff --git a/tests/tcg/mips/user/ase/msa/int-add/test_msa_add_a_w.c b/tests/tcg/mips/user/ase/msa/int-add/test_msa_add_a_w.c
new file mode 100644
index 0000000..040cadb
--- /dev/null
+++ b/tests/tcg/mips/user/ase/msa/int-add/test_msa_add_a_w.c
@@ -0,0 +1,151 @@
+/*
+ * Test program for MSA instruction ADD_A.W
+ *
+ * Copyright (C) 2018 Wave Computing, Inc.
+ * Copyright (C) 2018 Aleksandar Markovic <amarkovic@wavecomp.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
+#include <sys/time.h>
+#include <stdint.h>
+
+#include "../../../../include/wrappers_msa.h"
+#include "../../../../include/test_inputs.h"
+#include "../../../../include/test_utils.h"
+
+#define TEST_COUNT_TOTAL ( \
+ (PATTERN_INPUTS_SHORT_COUNT) * (PATTERN_INPUTS_SHORT_COUNT) + \
+ (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT))
+
+
+int32_t main(void)
+{
+ char *instruction_name = "ADD_A.W";
+ int32_t ret;
+ uint32_t i, j;
+ struct timeval start, end;
+ double elapsed_time;
+
+ uint64_t b128_result[TEST_COUNT_TOTAL][2];
+ uint64_t b128_expect[TEST_COUNT_TOTAL][2] = {
+ { 0x0000000200000002ULL, 0x0000000200000002ULL, }, /* 0 */
+ { 0x0000000100000001ULL, 0x0000000100000001ULL, },
+ { 0x5555555755555557ULL, 0x5555555755555557ULL, },
+ { 0x5555555655555556ULL, 0x5555555655555556ULL, },
+ { 0x3333333533333335ULL, 0x3333333533333335ULL, },
+ { 0x3333333433333334ULL, 0x3333333433333334ULL, },
+ { 0x1c71c71e71c71c73ULL, 0x38e38e391c71c71eULL, },
+ { 0x1c71c71d71c71c72ULL, 0x38e38e3a1c71c71dULL, },
+ { 0x0000000100000001ULL, 0x0000000100000001ULL, }, /* 8 */
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0x5555555655555556ULL, 0x5555555655555556ULL, },
+ { 0x5555555555555555ULL, 0x5555555555555555ULL, },
+ { 0x3333333433333334ULL, 0x3333333433333334ULL, },
+ { 0x3333333333333333ULL, 0x3333333333333333ULL, },
+ { 0x1c71c71d71c71c72ULL, 0x38e38e381c71c71dULL, },
+ { 0x1c71c71c71c71c71ULL, 0x38e38e391c71c71cULL, },
+ { 0x5555555755555557ULL, 0x5555555755555557ULL, }, /* 16 */
+ { 0x5555555655555556ULL, 0x5555555655555556ULL, },
+ { 0xaaaaaaacaaaaaaacULL, 0xaaaaaaacaaaaaaacULL, },
+ { 0xaaaaaaabaaaaaaabULL, 0xaaaaaaabaaaaaaabULL, },
+ { 0x8888888a8888888aULL, 0x8888888a8888888aULL, },
+ { 0x8888888988888889ULL, 0x8888888988888889ULL, },
+ { 0x71c71c73c71c71c8ULL, 0x8e38e38e71c71c73ULL, },
+ { 0x71c71c72c71c71c7ULL, 0x8e38e38f71c71c72ULL, },
+ { 0x5555555655555556ULL, 0x5555555655555556ULL, }, /* 24 */
+ { 0x5555555555555555ULL, 0x5555555555555555ULL, },
+ { 0xaaaaaaabaaaaaaabULL, 0xaaaaaaabaaaaaaabULL, },
+ { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, },
+ { 0x8888888988888889ULL, 0x8888888988888889ULL, },
+ { 0x8888888888888888ULL, 0x8888888888888888ULL, },
+ { 0x71c71c72c71c71c7ULL, 0x8e38e38d71c71c72ULL, },
+ { 0x71c71c71c71c71c6ULL, 0x8e38e38e71c71c71ULL, },
+ { 0x3333333533333335ULL, 0x3333333533333335ULL, }, /* 32 */
+ { 0x3333333433333334ULL, 0x3333333433333334ULL, },
+ { 0x8888888a8888888aULL, 0x8888888a8888888aULL, },
+ { 0x8888888988888889ULL, 0x8888888988888889ULL, },
+ { 0x6666666866666668ULL, 0x6666666866666668ULL, },
+ { 0x6666666766666667ULL, 0x6666666766666667ULL, },
+ { 0x4fa4fa51a4fa4fa6ULL, 0x6c16c16c4fa4fa51ULL, },
+ { 0x4fa4fa50a4fa4fa5ULL, 0x6c16c16d4fa4fa50ULL, },
+ { 0x3333333433333334ULL, 0x3333333433333334ULL, }, /* 40 */
+ { 0x3333333333333333ULL, 0x3333333333333333ULL, },
+ { 0x8888888988888889ULL, 0x8888888988888889ULL, },
+ { 0x8888888888888888ULL, 0x8888888888888888ULL, },
+ { 0x6666666766666667ULL, 0x6666666766666667ULL, },
+ { 0x6666666666666666ULL, 0x6666666666666666ULL, },
+ { 0x4fa4fa50a4fa4fa5ULL, 0x6c16c16b4fa4fa50ULL, },
+ { 0x4fa4fa4fa4fa4fa4ULL, 0x6c16c16c4fa4fa4fULL, },
+ { 0x1c71c71e71c71c73ULL, 0x38e38e391c71c71eULL, }, /* 48 */
+ { 0x1c71c71d71c71c72ULL, 0x38e38e381c71c71dULL, },
+ { 0x71c71c73c71c71c8ULL, 0x8e38e38e71c71c73ULL, },
+ { 0x71c71c72c71c71c7ULL, 0x8e38e38d71c71c72ULL, },
+ { 0x4fa4fa51a4fa4fa6ULL, 0x6c16c16c4fa4fa51ULL, },
+ { 0x4fa4fa50a4fa4fa5ULL, 0x6c16c16b4fa4fa50ULL, },
+ { 0x38e38e3ae38e38e4ULL, 0x71c71c7038e38e3aULL, },
+ { 0x38e38e39e38e38e3ULL, 0x71c71c7138e38e39ULL, },
+ { 0x1c71c71d71c71c72ULL, 0x38e38e3a1c71c71dULL, }, /* 56 */
+ { 0x1c71c71c71c71c71ULL, 0x38e38e391c71c71cULL, },
+ { 0x71c71c72c71c71c7ULL, 0x8e38e38f71c71c72ULL, },
+ { 0x71c71c71c71c71c6ULL, 0x8e38e38e71c71c71ULL, },
+ { 0x4fa4fa50a4fa4fa5ULL, 0x6c16c16d4fa4fa50ULL, },
+ { 0x4fa4fa4fa4fa4fa4ULL, 0x6c16c16c4fa4fa4fULL, },
+ { 0x38e38e39e38e38e3ULL, 0x71c71c7138e38e39ULL, },
+ { 0x38e38e38e38e38e2ULL, 0x71c71c7238e38e38ULL, },
+ { 0xef2a326850c4aa80ULL, 0x96ce16bc03089fe8ULL, }, /* 64 */
+ { 0x7bd718d175f61c48ULL, 0x5e5ec67816c3a2f0ULL, },
+ { 0xcb3a6a8a6e92c9c0ULL, 0x733fd25d56592ae0ULL, },
+ { 0xe7e42f818694378eULL, 0xbd75828658416d54ULL, },
+ { 0x7bd718d175f61c48ULL, 0x5e5ec67816c3a2f0ULL, },
+ { 0x0883ff3a9b278e10ULL, 0x25ef76342a7ea5f8ULL, },
+ { 0x57e750f393c43b88ULL, 0x3ad082196a142de8ULL, },
+ { 0x749115eaabc5a956ULL, 0x850632426bfc705cULL, },
+ { 0xcb3a6a8a6e92c9c0ULL, 0x733fd25d56592ae0ULL, }, /* 72 */
+ { 0x57e750f393c43b88ULL, 0x3ad082196a142de8ULL, },
+ { 0xa74aa2ac8c60e900ULL, 0x4fb18dfea9a9b5d8ULL, },
+ { 0xc3f467a3a46256ceULL, 0x99e73e27ab91f84cULL, },
+ { 0xe7e42f818694378eULL, 0xbd75828658416d54ULL, },
+ { 0x749115eaabc5a956ULL, 0x850632426bfc705cULL, },
+};
+
+ gettimeofday(&start, NULL);
+
+ for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) {
+ do_msa_ADD_A_W(b128_pattern[i], b128_pattern[j],
+ b128_result[PATTERN_INPUTS_SHORT_COUNT * i + j]);
+ }
+ }
+
+ for (i = 0; i < RANDOM_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < RANDOM_INPUTS_SHORT_COUNT; j++) {
+ do_msa_ADD_A_W(b128_random[i], b128_random[j],
+ b128_result[((PATTERN_INPUTS_SHORT_COUNT) *
+ (PATTERN_INPUTS_SHORT_COUNT)) +
+ RANDOM_INPUTS_SHORT_COUNT * i + j]);
+ }
+ }
+
+ gettimeofday(&end, NULL);
+
+ elapsed_time = (end.tv_sec - start.tv_sec) * 1000.0;
+ elapsed_time += (end.tv_usec - start.tv_usec) / 1000.0;
+
+ ret = check_results(instruction_name, TEST_COUNT_TOTAL, elapsed_time,
+ &b128_result[0][0], &b128_expect[0][0]);
+
+ return ret;
+}
diff --git a/tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_a_b.c b/tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_a_b.c
new file mode 100644
index 0000000..7f8a595
--- /dev/null
+++ b/tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_a_b.c
@@ -0,0 +1,151 @@
+/*
+ * Test program for MSA instruction ADDS_A.B
+ *
+ * Copyright (C) 2018 Wave Computing, Inc.
+ * Copyright (C) 2018 Aleksandar Markovic <amarkovic@wavecomp.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
+#include <sys/time.h>
+#include <stdint.h>
+
+#include "../../../../include/wrappers_msa.h"
+#include "../../../../include/test_inputs.h"
+#include "../../../../include/test_utils.h"
+
+#define TEST_COUNT_TOTAL ( \
+ (PATTERN_INPUTS_SHORT_COUNT) * (PATTERN_INPUTS_SHORT_COUNT) + \
+ (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT))
+
+
+int32_t main(void)
+{
+ char *instruction_name = "ADDS_A.B";
+ int32_t ret;
+ uint32_t i, j;
+ struct timeval start, end;
+ double elapsed_time;
+
+ uint64_t b128_result[TEST_COUNT_TOTAL][2];
+ uint64_t b128_expect[TEST_COUNT_TOTAL][2] = {
+ { 0x0202020202020202ULL, 0x0202020202020202ULL, }, /* 0 */
+ { 0x0101010101010101ULL, 0x0101010101010101ULL, },
+ { 0x5757575757575757ULL, 0x5757575757575757ULL, },
+ { 0x5656565656565656ULL, 0x5656565656565656ULL, },
+ { 0x3535353535353535ULL, 0x3535353535353535ULL, },
+ { 0x3434343434343434ULL, 0x3434343434343434ULL, },
+ { 0x1e73391e73391e73ULL, 0x391e73391e73391eULL, },
+ { 0x1d723a1d723a1d72ULL, 0x3a1d723a1d723a1dULL, },
+ { 0x0101010101010101ULL, 0x0101010101010101ULL, }, /* 8 */
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0x5656565656565656ULL, 0x5656565656565656ULL, },
+ { 0x5555555555555555ULL, 0x5555555555555555ULL, },
+ { 0x3434343434343434ULL, 0x3434343434343434ULL, },
+ { 0x3333333333333333ULL, 0x3333333333333333ULL, },
+ { 0x1d72381d72381d72ULL, 0x381d72381d72381dULL, },
+ { 0x1c71391c71391c71ULL, 0x391c71391c71391cULL, },
+ { 0x5757575757575757ULL, 0x5757575757575757ULL, }, /* 16 */
+ { 0x5656565656565656ULL, 0x5656565656565656ULL, },
+ { 0x7f7f7f7f7f7f7f7fULL, 0x7f7f7f7f7f7f7f7fULL, },
+ { 0x7f7f7f7f7f7f7f7fULL, 0x7f7f7f7f7f7f7f7fULL, },
+ { 0x7f7f7f7f7f7f7f7fULL, 0x7f7f7f7f7f7f7f7fULL, },
+ { 0x7f7f7f7f7f7f7f7fULL, 0x7f7f7f7f7f7f7f7fULL, },
+ { 0x737f7f737f7f737fULL, 0x7f737f7f737f7f73ULL, },
+ { 0x727f7f727f7f727fULL, 0x7f727f7f727f7f72ULL, },
+ { 0x5656565656565656ULL, 0x5656565656565656ULL, }, /* 24 */
+ { 0x5555555555555555ULL, 0x5555555555555555ULL, },
+ { 0x7f7f7f7f7f7f7f7fULL, 0x7f7f7f7f7f7f7f7fULL, },
+ { 0x7f7f7f7f7f7f7f7fULL, 0x7f7f7f7f7f7f7f7fULL, },
+ { 0x7f7f7f7f7f7f7f7fULL, 0x7f7f7f7f7f7f7f7fULL, },
+ { 0x7f7f7f7f7f7f7f7fULL, 0x7f7f7f7f7f7f7f7fULL, },
+ { 0x727f7f727f7f727fULL, 0x7f727f7f727f7f72ULL, },
+ { 0x717f7f717f7f717fULL, 0x7f717f7f717f7f71ULL, },
+ { 0x3535353535353535ULL, 0x3535353535353535ULL, }, /* 32 */
+ { 0x3434343434343434ULL, 0x3434343434343434ULL, },
+ { 0x7f7f7f7f7f7f7f7fULL, 0x7f7f7f7f7f7f7f7fULL, },
+ { 0x7f7f7f7f7f7f7f7fULL, 0x7f7f7f7f7f7f7f7fULL, },
+ { 0x6868686868686868ULL, 0x6868686868686868ULL, },
+ { 0x6767676767676767ULL, 0x6767676767676767ULL, },
+ { 0x517f6c517f6c517fULL, 0x6c517f6c517f6c51ULL, },
+ { 0x507f6d507f6d507fULL, 0x6d507f6d507f6d50ULL, },
+ { 0x3434343434343434ULL, 0x3434343434343434ULL, }, /* 40 */
+ { 0x3333333333333333ULL, 0x3333333333333333ULL, },
+ { 0x7f7f7f7f7f7f7f7fULL, 0x7f7f7f7f7f7f7f7fULL, },
+ { 0x7f7f7f7f7f7f7f7fULL, 0x7f7f7f7f7f7f7f7fULL, },
+ { 0x6767676767676767ULL, 0x6767676767676767ULL, },
+ { 0x6666666666666666ULL, 0x6666666666666666ULL, },
+ { 0x507f6b507f6b507fULL, 0x6b507f6b507f6b50ULL, },
+ { 0x4f7f6c4f7f6c4f7fULL, 0x6c4f7f6c4f7f6c4fULL, },
+ { 0x1e73391e73391e73ULL, 0x391e73391e73391eULL, }, /* 48 */
+ { 0x1d72381d72381d72ULL, 0x381d72381d72381dULL, },
+ { 0x737f7f737f7f737fULL, 0x7f737f7f737f7f73ULL, },
+ { 0x727f7f727f7f727fULL, 0x7f727f7f727f7f72ULL, },
+ { 0x517f6c517f6c517fULL, 0x6c517f6c517f6c51ULL, },
+ { 0x507f6b507f6b507fULL, 0x6b507f6b507f6b50ULL, },
+ { 0x3a7f703a7f703a7fULL, 0x703a7f703a7f703aULL, },
+ { 0x397f71397f71397fULL, 0x71397f71397f7139ULL, },
+ { 0x1d723a1d723a1d72ULL, 0x3a1d723a1d723a1dULL, }, /* 56 */
+ { 0x1c71391c71391c71ULL, 0x391c71391c71391cULL, },
+ { 0x727f7f727f7f727fULL, 0x7f727f7f727f7f72ULL, },
+ { 0x717f7f717f7f717fULL, 0x7f717f7f717f7f71ULL, },
+ { 0x507f6d507f6d507fULL, 0x6d507f6d507f6d50ULL, },
+ { 0x4f7f6c4f7f6c4f7fULL, 0x6c4f7f6c4f7f6c4fULL, },
+ { 0x397f71397f71397fULL, 0x71397f71397f7139ULL, },
+ { 0x387f72387f72387fULL, 0x72387f72387f7238ULL, },
+ { 0x7f7f3468507f7f7fULL, 0x7f7f167f047f7f18ULL, }, /* 64 */
+ { 0x7d7f1a7f757f7f48ULL, 0x5d705078177f7f10ULL, },
+ { 0x7f7f6c7f6f7f7f7fULL, 0x727f455f577f7520ULL, },
+ { 0x7f7f307f7f7f737fULL, 0x7f767f7f597f6e6cULL, },
+ { 0x7d7f1a7f757f7f48ULL, 0x5d705078177f7f10ULL, },
+ { 0x0a7f007f7f7f7210ULL, 0x24127f342a7e7f08ULL, },
+ { 0x597f527f7f7f7f7fULL, 0x39317f1b6a6a7718ULL, },
+ { 0x757f167f7f7f5756ULL, 0x7f187f426c7f7064ULL, },
+ { 0x7f7f6c7f6f7f7f7fULL, 0x727f455f577f7520ULL, }, /* 72 */
+ { 0x597f527f7f7f7f7fULL, 0x39317f1b6a6a7718ULL, },
+ { 0x7f7f7f7f7f627f7fULL, 0x4e5074027f564a28ULL, },
+ { 0x7f7f687f7f627f7fULL, 0x7f377f297f6d4374ULL, },
+ { 0x7f7f307f7f7f737fULL, 0x7f767f7f597f6e6cULL, },
+ { 0x757f167f7f7f5756ULL, 0x7f187f426c7f7064ULL, },
+};
+
+ gettimeofday(&start, NULL);
+
+ for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) {
+ do_msa_ADDS_A_B(b128_pattern[i], b128_pattern[j],
+ b128_result[PATTERN_INPUTS_SHORT_COUNT * i + j]);
+ }
+ }
+
+ for (i = 0; i < RANDOM_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < RANDOM_INPUTS_SHORT_COUNT; j++) {
+ do_msa_ADDS_A_B(b128_random[i], b128_random[j],
+ b128_result[((PATTERN_INPUTS_SHORT_COUNT) *
+ (PATTERN_INPUTS_SHORT_COUNT)) +
+ RANDOM_INPUTS_SHORT_COUNT * i + j]);
+ }
+ }
+
+ gettimeofday(&end, NULL);
+
+ elapsed_time = (end.tv_sec - start.tv_sec) * 1000.0;
+ elapsed_time += (end.tv_usec - start.tv_usec) / 1000.0;
+
+ ret = check_results(instruction_name, TEST_COUNT_TOTAL, elapsed_time,
+ &b128_result[0][0], &b128_expect[0][0]);
+
+ return ret;
+}
diff --git a/tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_a_d.c b/tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_a_d.c
new file mode 100644
index 0000000..2b38b0d
--- /dev/null
+++ b/tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_a_d.c
@@ -0,0 +1,151 @@
+/*
+ * Test program for MSA instruction ADDS_A.D
+ *
+ * Copyright (C) 2018 Wave Computing, Inc.
+ * Copyright (C) 2018 Aleksandar Markovic <amarkovic@wavecomp.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
+#include <sys/time.h>
+#include <stdint.h>
+
+#include "../../../../include/wrappers_msa.h"
+#include "../../../../include/test_inputs.h"
+#include "../../../../include/test_utils.h"
+
+#define TEST_COUNT_TOTAL ( \
+ (PATTERN_INPUTS_SHORT_COUNT) * (PATTERN_INPUTS_SHORT_COUNT) + \
+ (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT))
+
+
+int32_t main(void)
+{
+ char *instruction_name = "ADDS_A.D";
+ int32_t ret;
+ uint32_t i, j;
+ struct timeval start, end;
+ double elapsed_time;
+
+ uint64_t b128_result[TEST_COUNT_TOTAL][2];
+ uint64_t b128_expect[TEST_COUNT_TOTAL][2] = {
+ { 0x0000000000000002ULL, 0x0000000000000002ULL, }, /* 0 */
+ { 0x0000000000000001ULL, 0x0000000000000001ULL, },
+ { 0x5555555555555557ULL, 0x5555555555555557ULL, },
+ { 0x5555555555555556ULL, 0x5555555555555556ULL, },
+ { 0x3333333333333335ULL, 0x3333333333333335ULL, },
+ { 0x3333333333333334ULL, 0x3333333333333334ULL, },
+ { 0x1c71c71c71c71c73ULL, 0x38e38e38e38e38e4ULL, },
+ { 0x1c71c71c71c71c72ULL, 0x38e38e38e38e38e5ULL, },
+ { 0x0000000000000001ULL, 0x0000000000000001ULL, }, /* 8 */
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0x5555555555555556ULL, 0x5555555555555556ULL, },
+ { 0x5555555555555555ULL, 0x5555555555555555ULL, },
+ { 0x3333333333333334ULL, 0x3333333333333334ULL, },
+ { 0x3333333333333333ULL, 0x3333333333333333ULL, },
+ { 0x1c71c71c71c71c72ULL, 0x38e38e38e38e38e3ULL, },
+ { 0x1c71c71c71c71c71ULL, 0x38e38e38e38e38e4ULL, },
+ { 0x5555555555555557ULL, 0x5555555555555557ULL, }, /* 16 */
+ { 0x5555555555555556ULL, 0x5555555555555556ULL, },
+ { 0x7fffffffffffffffULL, 0x7fffffffffffffffULL, },
+ { 0x7fffffffffffffffULL, 0x7fffffffffffffffULL, },
+ { 0x7fffffffffffffffULL, 0x7fffffffffffffffULL, },
+ { 0x7fffffffffffffffULL, 0x7fffffffffffffffULL, },
+ { 0x71c71c71c71c71c8ULL, 0x7fffffffffffffffULL, },
+ { 0x71c71c71c71c71c7ULL, 0x7fffffffffffffffULL, },
+ { 0x5555555555555556ULL, 0x5555555555555556ULL, }, /* 24 */
+ { 0x5555555555555555ULL, 0x5555555555555555ULL, },
+ { 0x7fffffffffffffffULL, 0x7fffffffffffffffULL, },
+ { 0x7fffffffffffffffULL, 0x7fffffffffffffffULL, },
+ { 0x7fffffffffffffffULL, 0x7fffffffffffffffULL, },
+ { 0x7fffffffffffffffULL, 0x7fffffffffffffffULL, },
+ { 0x71c71c71c71c71c7ULL, 0x7fffffffffffffffULL, },
+ { 0x71c71c71c71c71c6ULL, 0x7fffffffffffffffULL, },
+ { 0x3333333333333335ULL, 0x3333333333333335ULL, }, /* 32 */
+ { 0x3333333333333334ULL, 0x3333333333333334ULL, },
+ { 0x7fffffffffffffffULL, 0x7fffffffffffffffULL, },
+ { 0x7fffffffffffffffULL, 0x7fffffffffffffffULL, },
+ { 0x6666666666666668ULL, 0x6666666666666668ULL, },
+ { 0x6666666666666667ULL, 0x6666666666666667ULL, },
+ { 0x4fa4fa4fa4fa4fa6ULL, 0x6c16c16c16c16c17ULL, },
+ { 0x4fa4fa4fa4fa4fa5ULL, 0x6c16c16c16c16c18ULL, },
+ { 0x3333333333333334ULL, 0x3333333333333334ULL, }, /* 40 */
+ { 0x3333333333333333ULL, 0x3333333333333333ULL, },
+ { 0x7fffffffffffffffULL, 0x7fffffffffffffffULL, },
+ { 0x7fffffffffffffffULL, 0x7fffffffffffffffULL, },
+ { 0x6666666666666667ULL, 0x6666666666666667ULL, },
+ { 0x6666666666666666ULL, 0x6666666666666666ULL, },
+ { 0x4fa4fa4fa4fa4fa5ULL, 0x6c16c16c16c16c16ULL, },
+ { 0x4fa4fa4fa4fa4fa4ULL, 0x6c16c16c16c16c17ULL, },
+ { 0x1c71c71c71c71c73ULL, 0x38e38e38e38e38e4ULL, }, /* 48 */
+ { 0x1c71c71c71c71c72ULL, 0x38e38e38e38e38e3ULL, },
+ { 0x71c71c71c71c71c8ULL, 0x7fffffffffffffffULL, },
+ { 0x71c71c71c71c71c7ULL, 0x7fffffffffffffffULL, },
+ { 0x4fa4fa4fa4fa4fa6ULL, 0x6c16c16c16c16c17ULL, },
+ { 0x4fa4fa4fa4fa4fa5ULL, 0x6c16c16c16c16c16ULL, },
+ { 0x38e38e38e38e38e4ULL, 0x71c71c71c71c71c6ULL, },
+ { 0x38e38e38e38e38e3ULL, 0x71c71c71c71c71c7ULL, },
+ { 0x1c71c71c71c71c72ULL, 0x38e38e38e38e38e5ULL, }, /* 56 */
+ { 0x1c71c71c71c71c71ULL, 0x38e38e38e38e38e4ULL, },
+ { 0x71c71c71c71c71c7ULL, 0x7fffffffffffffffULL, },
+ { 0x71c71c71c71c71c6ULL, 0x7fffffffffffffffULL, },
+ { 0x4fa4fa4fa4fa4fa5ULL, 0x6c16c16c16c16c18ULL, },
+ { 0x4fa4fa4fa4fa4fa4ULL, 0x6c16c16c16c16c17ULL, },
+ { 0x38e38e38e38e38e3ULL, 0x71c71c71c71c71c7ULL, },
+ { 0x38e38e38e38e38e2ULL, 0x71c71c71c71c71c8ULL, },
+ { 0x7fffffffffffffffULL, 0x7fffffffffffffffULL, }, /* 64 */
+ { 0x7bd718d08a09e3b8ULL, 0x5e5ec67913bb0308ULL, },
+ { 0x7fffffffffffffffULL, 0x733fd25ea9a6d520ULL, },
+ { 0x7fffffffffffffffULL, 0x7fffffffffffffffULL, },
+ { 0x7bd718d08a09e3b8ULL, 0x5e5ec67913bb0308ULL, },
+ { 0x0883ff3964d871f0ULL, 0x25ef76342a7ea5f8ULL, },
+ { 0x57e750f1f89cad78ULL, 0x3ad08219c06a7810ULL, },
+ { 0x749115ea109e1b46ULL, 0x7fffffffffffffffULL, },
+ { 0x7fffffffffffffffULL, 0x733fd25ea9a6d520ULL, }, /* 72 */
+ { 0x57e750f1f89cad78ULL, 0x3ad08219c06a7810ULL, },
+ { 0x7fffffffffffffffULL, 0x4fb18dff56564a28ULL, },
+ { 0x7fffffffffffffffULL, 0x7fffffffffffffffULL, },
+ { 0x7fffffffffffffffULL, 0x7fffffffffffffffULL, },
+ { 0x749115ea109e1b46ULL, 0x7fffffffffffffffULL, },
+};
+
+ gettimeofday(&start, NULL);
+
+ for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) {
+ do_msa_ADDS_A_D(b128_pattern[i], b128_pattern[j],
+ b128_result[PATTERN_INPUTS_SHORT_COUNT * i + j]);
+ }
+ }
+
+ for (i = 0; i < RANDOM_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < RANDOM_INPUTS_SHORT_COUNT; j++) {
+ do_msa_ADDS_A_D(b128_random[i], b128_random[j],
+ b128_result[((PATTERN_INPUTS_SHORT_COUNT) *
+ (PATTERN_INPUTS_SHORT_COUNT)) +
+ RANDOM_INPUTS_SHORT_COUNT * i + j]);
+ }
+ }
+
+ gettimeofday(&end, NULL);
+
+ elapsed_time = (end.tv_sec - start.tv_sec) * 1000.0;
+ elapsed_time += (end.tv_usec - start.tv_usec) / 1000.0;
+
+ ret = check_results(instruction_name, TEST_COUNT_TOTAL, elapsed_time,
+ &b128_result[0][0], &b128_expect[0][0]);
+
+ return ret;
+}
diff --git a/tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_a_h.c b/tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_a_h.c
new file mode 100644
index 0000000..424f7d3
--- /dev/null
+++ b/tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_a_h.c
@@ -0,0 +1,151 @@
+/*
+ * Test program for MSA instruction ADDS_A.H
+ *
+ * Copyright (C) 2018 Wave Computing, Inc.
+ * Copyright (C) 2018 Aleksandar Markovic <amarkovic@wavecomp.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
+#include <sys/time.h>
+#include <stdint.h>
+
+#include "../../../../include/wrappers_msa.h"
+#include "../../../../include/test_inputs.h"
+#include "../../../../include/test_utils.h"
+
+#define TEST_COUNT_TOTAL ( \
+ (PATTERN_INPUTS_SHORT_COUNT) * (PATTERN_INPUTS_SHORT_COUNT) + \
+ (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT))
+
+
+int32_t main(void)
+{
+ char *instruction_name = "ADDS_A.H";
+ int32_t ret;
+ uint32_t i, j;
+ struct timeval start, end;
+ double elapsed_time;
+
+ uint64_t b128_result[TEST_COUNT_TOTAL][2];
+ uint64_t b128_expect[TEST_COUNT_TOTAL][2] = {
+ { 0x0002000200020002ULL, 0x0002000200020002ULL, }, /* 0 */
+ { 0x0001000100010001ULL, 0x0001000100010001ULL, },
+ { 0x5557555755575557ULL, 0x5557555755575557ULL, },
+ { 0x5556555655565556ULL, 0x5556555655565556ULL, },
+ { 0x3335333533353335ULL, 0x3335333533353335ULL, },
+ { 0x3334333433343334ULL, 0x3334333433343334ULL, },
+ { 0x1c7338e471c91c73ULL, 0x38e471c91c7338e4ULL, },
+ { 0x1c7238e571c81c72ULL, 0x38e571c81c7238e5ULL, },
+ { 0x0001000100010001ULL, 0x0001000100010001ULL, }, /* 8 */
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0x5556555655565556ULL, 0x5556555655565556ULL, },
+ { 0x5555555555555555ULL, 0x5555555555555555ULL, },
+ { 0x3334333433343334ULL, 0x3334333433343334ULL, },
+ { 0x3333333333333333ULL, 0x3333333333333333ULL, },
+ { 0x1c7238e371c81c72ULL, 0x38e371c81c7238e3ULL, },
+ { 0x1c7138e471c71c71ULL, 0x38e471c71c7138e4ULL, },
+ { 0x5557555755575557ULL, 0x5557555755575557ULL, }, /* 16 */
+ { 0x5556555655565556ULL, 0x5556555655565556ULL, },
+ { 0x7fff7fff7fff7fffULL, 0x7fff7fff7fff7fffULL, },
+ { 0x7fff7fff7fff7fffULL, 0x7fff7fff7fff7fffULL, },
+ { 0x7fff7fff7fff7fffULL, 0x7fff7fff7fff7fffULL, },
+ { 0x7fff7fff7fff7fffULL, 0x7fff7fff7fff7fffULL, },
+ { 0x71c87fff7fff71c8ULL, 0x7fff7fff71c87fffULL, },
+ { 0x71c77fff7fff71c7ULL, 0x7fff7fff71c77fffULL, },
+ { 0x5556555655565556ULL, 0x5556555655565556ULL, }, /* 24 */
+ { 0x5555555555555555ULL, 0x5555555555555555ULL, },
+ { 0x7fff7fff7fff7fffULL, 0x7fff7fff7fff7fffULL, },
+ { 0x7fff7fff7fff7fffULL, 0x7fff7fff7fff7fffULL, },
+ { 0x7fff7fff7fff7fffULL, 0x7fff7fff7fff7fffULL, },
+ { 0x7fff7fff7fff7fffULL, 0x7fff7fff7fff7fffULL, },
+ { 0x71c77fff7fff71c7ULL, 0x7fff7fff71c77fffULL, },
+ { 0x71c67fff7fff71c6ULL, 0x7fff7fff71c67fffULL, },
+ { 0x3335333533353335ULL, 0x3335333533353335ULL, }, /* 32 */
+ { 0x3334333433343334ULL, 0x3334333433343334ULL, },
+ { 0x7fff7fff7fff7fffULL, 0x7fff7fff7fff7fffULL, },
+ { 0x7fff7fff7fff7fffULL, 0x7fff7fff7fff7fffULL, },
+ { 0x6668666866686668ULL, 0x6668666866686668ULL, },
+ { 0x6667666766676667ULL, 0x6667666766676667ULL, },
+ { 0x4fa66c177fff4fa6ULL, 0x6c177fff4fa66c17ULL, },
+ { 0x4fa56c187fff4fa5ULL, 0x6c187fff4fa56c18ULL, },
+ { 0x3334333433343334ULL, 0x3334333433343334ULL, }, /* 40 */
+ { 0x3333333333333333ULL, 0x3333333333333333ULL, },
+ { 0x7fff7fff7fff7fffULL, 0x7fff7fff7fff7fffULL, },
+ { 0x7fff7fff7fff7fffULL, 0x7fff7fff7fff7fffULL, },
+ { 0x6667666766676667ULL, 0x6667666766676667ULL, },
+ { 0x6666666666666666ULL, 0x6666666666666666ULL, },
+ { 0x4fa56c167fff4fa5ULL, 0x6c167fff4fa56c16ULL, },
+ { 0x4fa46c177fff4fa4ULL, 0x6c177fff4fa46c17ULL, },
+ { 0x1c7338e471c91c73ULL, 0x38e471c91c7338e4ULL, }, /* 48 */
+ { 0x1c7238e371c81c72ULL, 0x38e371c81c7238e3ULL, },
+ { 0x71c87fff7fff71c8ULL, 0x7fff7fff71c87fffULL, },
+ { 0x71c77fff7fff71c7ULL, 0x7fff7fff71c77fffULL, },
+ { 0x4fa66c177fff4fa6ULL, 0x6c177fff4fa66c17ULL, },
+ { 0x4fa56c167fff4fa5ULL, 0x6c167fff4fa56c16ULL, },
+ { 0x38e471c67fff38e4ULL, 0x71c67fff38e471c6ULL, },
+ { 0x38e371c77fff38e3ULL, 0x71c77fff38e371c7ULL, },
+ { 0x1c7238e571c81c72ULL, 0x38e571c81c7238e5ULL, }, /* 56 */
+ { 0x1c7138e471c71c71ULL, 0x38e471c71c7138e4ULL, },
+ { 0x71c77fff7fff71c7ULL, 0x7fff7fff71c77fffULL, },
+ { 0x71c67fff7fff71c6ULL, 0x7fff7fff71c67fffULL, },
+ { 0x4fa56c187fff4fa5ULL, 0x6c187fff4fa56c18ULL, },
+ { 0x4fa46c177fff4fa4ULL, 0x6c177fff4fa46c17ULL, },
+ { 0x38e371c77fff38e3ULL, 0x71c77fff38e371c7ULL, },
+ { 0x38e271c87fff38e2ULL, 0x71c87fff38e271c8ULL, },
+ { 0x7fff326850c47fffULL, 0x7fff16bc030a7fffULL, }, /* 64 */
+ { 0x7bd8199775f57fffULL, 0x5e5e504416c47fffULL, },
+ { 0x7fff6a8a6e937fffULL, 0x733f445f565a7508ULL, },
+ { 0x7fff2f817fff72f2ULL, 0x7fff7fff58436d54ULL, },
+ { 0x7bd8199775f57fffULL, 0x5e5e504416c47fffULL, },
+ { 0x088400c67fff71f0ULL, 0x25ee7fff2a7e7fffULL, },
+ { 0x57e851b97fff7fffULL, 0x3acf7de76a147810ULL, },
+ { 0x749116b07fff56aaULL, 0x7fff7fff6bfd705cULL, },
+ { 0x7fff6a8a6e937fffULL, 0x733f445f565a7508ULL, }, /* 72 */
+ { 0x57e851b97fff7fffULL, 0x3acf7de76a147810ULL, },
+ { 0x7fff7fff7fff7fffULL, 0x4fb072027fff4a28ULL, },
+ { 0x7fff67a37fff7fffULL, 0x7fff7fff7fff4274ULL, },
+ { 0x7fff2f817fff72f2ULL, 0x7fff7fff58436d54ULL, },
+ { 0x749116b07fff56aaULL, 0x7fff7fff6bfd705cULL, },
+};
+
+ gettimeofday(&start, NULL);
+
+ for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) {
+ do_msa_ADDS_A_H(b128_pattern[i], b128_pattern[j],
+ b128_result[PATTERN_INPUTS_SHORT_COUNT * i + j]);
+ }
+ }
+
+ for (i = 0; i < RANDOM_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < RANDOM_INPUTS_SHORT_COUNT; j++) {
+ do_msa_ADDS_A_H(b128_random[i], b128_random[j],
+ b128_result[((PATTERN_INPUTS_SHORT_COUNT) *
+ (PATTERN_INPUTS_SHORT_COUNT)) +
+ RANDOM_INPUTS_SHORT_COUNT * i + j]);
+ }
+ }
+
+ gettimeofday(&end, NULL);
+
+ elapsed_time = (end.tv_sec - start.tv_sec) * 1000.0;
+ elapsed_time += (end.tv_usec - start.tv_usec) / 1000.0;
+
+ ret = check_results(instruction_name, TEST_COUNT_TOTAL, elapsed_time,
+ &b128_result[0][0], &b128_expect[0][0]);
+
+ return ret;
+}
diff --git a/tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_a_w.c b/tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_a_w.c
new file mode 100644
index 0000000..c389e46
--- /dev/null
+++ b/tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_a_w.c
@@ -0,0 +1,151 @@
+/*
+ * Test program for MSA instruction ADDS_A.W
+ *
+ * Copyright (C) 2018 Wave Computing, Inc.
+ * Copyright (C) 2018 Aleksandar Markovic <amarkovic@wavecomp.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
+#include <sys/time.h>
+#include <stdint.h>
+
+#include "../../../../include/wrappers_msa.h"
+#include "../../../../include/test_inputs.h"
+#include "../../../../include/test_utils.h"
+
+#define TEST_COUNT_TOTAL ( \
+ (PATTERN_INPUTS_SHORT_COUNT) * (PATTERN_INPUTS_SHORT_COUNT) + \
+ (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT))
+
+
+int32_t main(void)
+{
+ char *instruction_name = "ADDS_A.W";
+ int32_t ret;
+ uint32_t i, j;
+ struct timeval start, end;
+ double elapsed_time;
+
+ uint64_t b128_result[TEST_COUNT_TOTAL][2];
+ uint64_t b128_expect[TEST_COUNT_TOTAL][2] = {
+ { 0x0000000200000002ULL, 0x0000000200000002ULL, }, /* 0 */
+ { 0x0000000100000001ULL, 0x0000000100000001ULL, },
+ { 0x5555555755555557ULL, 0x5555555755555557ULL, },
+ { 0x5555555655555556ULL, 0x5555555655555556ULL, },
+ { 0x3333333533333335ULL, 0x3333333533333335ULL, },
+ { 0x3333333433333334ULL, 0x3333333433333334ULL, },
+ { 0x1c71c71e71c71c73ULL, 0x38e38e391c71c71eULL, },
+ { 0x1c71c71d71c71c72ULL, 0x38e38e3a1c71c71dULL, },
+ { 0x0000000100000001ULL, 0x0000000100000001ULL, }, /* 8 */
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0x5555555655555556ULL, 0x5555555655555556ULL, },
+ { 0x5555555555555555ULL, 0x5555555555555555ULL, },
+ { 0x3333333433333334ULL, 0x3333333433333334ULL, },
+ { 0x3333333333333333ULL, 0x3333333333333333ULL, },
+ { 0x1c71c71d71c71c72ULL, 0x38e38e381c71c71dULL, },
+ { 0x1c71c71c71c71c71ULL, 0x38e38e391c71c71cULL, },
+ { 0x5555555755555557ULL, 0x5555555755555557ULL, }, /* 16 */
+ { 0x5555555655555556ULL, 0x5555555655555556ULL, },
+ { 0x7fffffff7fffffffULL, 0x7fffffff7fffffffULL, },
+ { 0x7fffffff7fffffffULL, 0x7fffffff7fffffffULL, },
+ { 0x7fffffff7fffffffULL, 0x7fffffff7fffffffULL, },
+ { 0x7fffffff7fffffffULL, 0x7fffffff7fffffffULL, },
+ { 0x71c71c737fffffffULL, 0x7fffffff71c71c73ULL, },
+ { 0x71c71c727fffffffULL, 0x7fffffff71c71c72ULL, },
+ { 0x5555555655555556ULL, 0x5555555655555556ULL, }, /* 24 */
+ { 0x5555555555555555ULL, 0x5555555555555555ULL, },
+ { 0x7fffffff7fffffffULL, 0x7fffffff7fffffffULL, },
+ { 0x7fffffff7fffffffULL, 0x7fffffff7fffffffULL, },
+ { 0x7fffffff7fffffffULL, 0x7fffffff7fffffffULL, },
+ { 0x7fffffff7fffffffULL, 0x7fffffff7fffffffULL, },
+ { 0x71c71c727fffffffULL, 0x7fffffff71c71c72ULL, },
+ { 0x71c71c717fffffffULL, 0x7fffffff71c71c71ULL, },
+ { 0x3333333533333335ULL, 0x3333333533333335ULL, }, /* 32 */
+ { 0x3333333433333334ULL, 0x3333333433333334ULL, },
+ { 0x7fffffff7fffffffULL, 0x7fffffff7fffffffULL, },
+ { 0x7fffffff7fffffffULL, 0x7fffffff7fffffffULL, },
+ { 0x6666666866666668ULL, 0x6666666866666668ULL, },
+ { 0x6666666766666667ULL, 0x6666666766666667ULL, },
+ { 0x4fa4fa517fffffffULL, 0x6c16c16c4fa4fa51ULL, },
+ { 0x4fa4fa507fffffffULL, 0x6c16c16d4fa4fa50ULL, },
+ { 0x3333333433333334ULL, 0x3333333433333334ULL, }, /* 40 */
+ { 0x3333333333333333ULL, 0x3333333333333333ULL, },
+ { 0x7fffffff7fffffffULL, 0x7fffffff7fffffffULL, },
+ { 0x7fffffff7fffffffULL, 0x7fffffff7fffffffULL, },
+ { 0x6666666766666667ULL, 0x6666666766666667ULL, },
+ { 0x6666666666666666ULL, 0x6666666666666666ULL, },
+ { 0x4fa4fa507fffffffULL, 0x6c16c16b4fa4fa50ULL, },
+ { 0x4fa4fa4f7fffffffULL, 0x6c16c16c4fa4fa4fULL, },
+ { 0x1c71c71e71c71c73ULL, 0x38e38e391c71c71eULL, }, /* 48 */
+ { 0x1c71c71d71c71c72ULL, 0x38e38e381c71c71dULL, },
+ { 0x71c71c737fffffffULL, 0x7fffffff71c71c73ULL, },
+ { 0x71c71c727fffffffULL, 0x7fffffff71c71c72ULL, },
+ { 0x4fa4fa517fffffffULL, 0x6c16c16c4fa4fa51ULL, },
+ { 0x4fa4fa507fffffffULL, 0x6c16c16b4fa4fa50ULL, },
+ { 0x38e38e3a7fffffffULL, 0x71c71c7038e38e3aULL, },
+ { 0x38e38e397fffffffULL, 0x71c71c7138e38e39ULL, },
+ { 0x1c71c71d71c71c72ULL, 0x38e38e3a1c71c71dULL, }, /* 56 */
+ { 0x1c71c71c71c71c71ULL, 0x38e38e391c71c71cULL, },
+ { 0x71c71c727fffffffULL, 0x7fffffff71c71c72ULL, },
+ { 0x71c71c717fffffffULL, 0x7fffffff71c71c71ULL, },
+ { 0x4fa4fa507fffffffULL, 0x6c16c16d4fa4fa50ULL, },
+ { 0x4fa4fa4f7fffffffULL, 0x6c16c16c4fa4fa4fULL, },
+ { 0x38e38e397fffffffULL, 0x71c71c7138e38e39ULL, },
+ { 0x38e38e387fffffffULL, 0x71c71c7238e38e38ULL, },
+ { 0x7fffffff50c4aa80ULL, 0x7fffffff03089fe8ULL, }, /* 64 */
+ { 0x7bd718d175f61c48ULL, 0x5e5ec67816c3a2f0ULL, },
+ { 0x7fffffff6e92c9c0ULL, 0x733fd25d56592ae0ULL, },
+ { 0x7fffffff7fffffffULL, 0x7fffffff58416d54ULL, },
+ { 0x7bd718d175f61c48ULL, 0x5e5ec67816c3a2f0ULL, },
+ { 0x0883ff3a7fffffffULL, 0x25ef76342a7ea5f8ULL, },
+ { 0x57e750f37fffffffULL, 0x3ad082196a142de8ULL, },
+ { 0x749115ea7fffffffULL, 0x7fffffff6bfc705cULL, },
+ { 0x7fffffff6e92c9c0ULL, 0x733fd25d56592ae0ULL, }, /* 72 */
+ { 0x57e750f37fffffffULL, 0x3ad082196a142de8ULL, },
+ { 0x7fffffff7fffffffULL, 0x4fb18dfe7fffffffULL, },
+ { 0x7fffffff7fffffffULL, 0x7fffffff7fffffffULL, },
+ { 0x7fffffff7fffffffULL, 0x7fffffff58416d54ULL, },
+ { 0x749115ea7fffffffULL, 0x7fffffff6bfc705cULL, },
+};
+
+ gettimeofday(&start, NULL);
+
+ for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) {
+ do_msa_ADDS_A_W(b128_pattern[i], b128_pattern[j],
+ b128_result[PATTERN_INPUTS_SHORT_COUNT * i + j]);
+ }
+ }
+
+ for (i = 0; i < RANDOM_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < RANDOM_INPUTS_SHORT_COUNT; j++) {
+ do_msa_ADDS_A_W(b128_random[i], b128_random[j],
+ b128_result[((PATTERN_INPUTS_SHORT_COUNT) *
+ (PATTERN_INPUTS_SHORT_COUNT)) +
+ RANDOM_INPUTS_SHORT_COUNT * i + j]);
+ }
+ }
+
+ gettimeofday(&end, NULL);
+
+ elapsed_time = (end.tv_sec - start.tv_sec) * 1000.0;
+ elapsed_time += (end.tv_usec - start.tv_usec) / 1000.0;
+
+ ret = check_results(instruction_name, TEST_COUNT_TOTAL, elapsed_time,
+ &b128_result[0][0], &b128_expect[0][0]);
+
+ return ret;
+}
diff --git a/tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_s_b.c b/tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_s_b.c
new file mode 100644
index 0000000..5b1d9e0
--- /dev/null
+++ b/tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_s_b.c
@@ -0,0 +1,151 @@
+/*
+ * Test program for MSA instruction ADDS_S.B
+ *
+ * Copyright (C) 2018 Wave Computing, Inc.
+ * Copyright (C) 2018 Aleksandar Markovic <amarkovic@wavecomp.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
+#include <sys/time.h>
+#include <stdint.h>
+
+#include "../../../../include/wrappers_msa.h"
+#include "../../../../include/test_inputs.h"
+#include "../../../../include/test_utils.h"
+
+#define TEST_COUNT_TOTAL ( \
+ (PATTERN_INPUTS_SHORT_COUNT) * (PATTERN_INPUTS_SHORT_COUNT) + \
+ (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT))
+
+
+int32_t main(void)
+{
+ char *instruction_name = "ADDS_S.B";
+ int32_t ret;
+ uint32_t i, j;
+ struct timeval start, end;
+ double elapsed_time;
+
+ uint64_t b128_result[TEST_COUNT_TOTAL][2];
+ uint64_t b128_expect[TEST_COUNT_TOTAL][2] = {
+ { 0xfefefefefefefefeULL, 0xfefefefefefefefeULL, }, /* 0 */
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xa9a9a9a9a9a9a9a9ULL, 0xa9a9a9a9a9a9a9a9ULL, },
+ { 0x5454545454545454ULL, 0x5454545454545454ULL, },
+ { 0xcbcbcbcbcbcbcbcbULL, 0xcbcbcbcbcbcbcbcbULL, },
+ { 0x3232323232323232ULL, 0x3232323232323232ULL, },
+ { 0xe28d37e28d37e28dULL, 0x37e28d37e28d37e2ULL, },
+ { 0x1b70c61b70c61b70ULL, 0xc61b70c61b70c61bULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 8 */
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, },
+ { 0x5555555555555555ULL, 0x5555555555555555ULL, },
+ { 0xccccccccccccccccULL, 0xccccccccccccccccULL, },
+ { 0x3333333333333333ULL, 0x3333333333333333ULL, },
+ { 0xe38e38e38e38e38eULL, 0x38e38e38e38e38e3ULL, },
+ { 0x1c71c71c71c71c71ULL, 0xc71c71c71c71c71cULL, },
+ { 0xa9a9a9a9a9a9a9a9ULL, 0xa9a9a9a9a9a9a9a9ULL, }, /* 16 */
+ { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, },
+ { 0x8080808080808080ULL, 0x8080808080808080ULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0x8080808080808080ULL, 0x8080808080808080ULL, },
+ { 0xddddddddddddddddULL, 0xddddddddddddddddULL, },
+ { 0x8d80e28d80e28d80ULL, 0xe28d80e28d80e28dULL, },
+ { 0xc61b80c61b80c61bULL, 0x80c61b80c61b80c6ULL, },
+ { 0x5454545454545454ULL, 0x5454545454545454ULL, }, /* 24 */
+ { 0x5555555555555555ULL, 0x5555555555555555ULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0x7f7f7f7f7f7f7f7fULL, 0x7f7f7f7f7f7f7f7fULL, },
+ { 0x2121212121212121ULL, 0x2121212121212121ULL, },
+ { 0x7f7f7f7f7f7f7f7fULL, 0x7f7f7f7f7f7f7f7fULL, },
+ { 0x38e37f38e37f38e3ULL, 0x7f38e37f38e37f38ULL, },
+ { 0x717f1c717f1c717fULL, 0x1c717f1c717f1c71ULL, },
+ { 0xcbcbcbcbcbcbcbcbULL, 0xcbcbcbcbcbcbcbcbULL, }, /* 32 */
+ { 0xccccccccccccccccULL, 0xccccccccccccccccULL, },
+ { 0x8080808080808080ULL, 0x8080808080808080ULL, },
+ { 0x2121212121212121ULL, 0x2121212121212121ULL, },
+ { 0x9898989898989898ULL, 0x9898989898989898ULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xaf8004af8004af80ULL, 0x04af8004af8004afULL, },
+ { 0xe83d93e83d93e83dULL, 0x93e83d93e83d93e8ULL, },
+ { 0x3232323232323232ULL, 0x3232323232323232ULL, }, /* 40 */
+ { 0x3333333333333333ULL, 0x3333333333333333ULL, },
+ { 0xddddddddddddddddULL, 0xddddddddddddddddULL, },
+ { 0x7f7f7f7f7f7f7f7fULL, 0x7f7f7f7f7f7f7f7fULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0x6666666666666666ULL, 0x6666666666666666ULL, },
+ { 0x16c16b16c16b16c1ULL, 0x6b16c16b16c16b16ULL, },
+ { 0x4f7ffa4f7ffa4f7fULL, 0xfa4f7ffa4f7ffa4fULL, },
+ { 0xe28d37e28d37e28dULL, 0x37e28d37e28d37e2ULL, }, /* 48 */
+ { 0xe38e38e38e38e38eULL, 0x38e38e38e38e38e3ULL, },
+ { 0x8d80e28d80e28d80ULL, 0xe28d80e28d80e28dULL, },
+ { 0x38e37f38e37f38e3ULL, 0x7f38e37f38e37f38ULL, },
+ { 0xaf8004af8004af80ULL, 0x04af8004af8004afULL, },
+ { 0x16c16b16c16b16c1ULL, 0x6b16c16b16c16b16ULL, },
+ { 0xc68070c68070c680ULL, 0x70c68070c68070c6ULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0x1b70c61b70c61b70ULL, 0xc61b70c61b70c61bULL, }, /* 56 */
+ { 0x1c71c71c71c71c71ULL, 0xc71c71c71c71c71cULL, },
+ { 0xc61b80c61b80c61bULL, 0x80c61b80c61b80c6ULL, },
+ { 0x717f1c717f1c717fULL, 0x1c717f1c717f1c71ULL, },
+ { 0xe83d93e83d93e83dULL, 0x93e83d93e83d93e8ULL, },
+ { 0x4f7ffa4f7ffa4f7fULL, 0xfa4f7ffa4f7ffa4fULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0x387f8e387f8e387fULL, 0x8e387f8e387f8e38ULL, },
+ { 0x807fcc98507f7f7fULL, 0x7f7f167ffc7f8018ULL, }, /* 64 */
+ { 0x8328e62f75f51c48ULL, 0x5d5ec678137f0208ULL, },
+ { 0x807f9480e131e0c0ULL, 0x723fd15da97fd520ULL, },
+ { 0xf87ffc197f7f377fULL, 0xd8589336a77f92acULL, },
+ { 0x8328e62f75f51c48ULL, 0x5d5ec678137f0208ULL, },
+ { 0xf680007f7f808e10ULL, 0x24ee80342a7e7ff8ULL, },
+ { 0xa718ae0d06808088ULL, 0x39cf8119c06a7710ULL, },
+ { 0x6b0d167f7fc4a956ULL, 0x9fe880f2be7f349cULL, },
+ { 0x807f9480e131e0c0ULL, 0x723fd15da97fd520ULL, }, /* 72 */
+ { 0xa718ae0d06808088ULL, 0x39cf8119c06a7710ULL, },
+ { 0x807f8080809e8080ULL, 0x4eb08cfe80564a28ULL, },
+ { 0x1c7fc4f7170080ceULL, 0xb4c980d7806d07b4ULL, },
+ { 0xf87ffc197f7f377fULL, 0xd8589336a77f92acULL, },
+ { 0x6b0d167f7fc4a956ULL, 0x9fe880f2be7f349cULL, },
+};
+
+ gettimeofday(&start, NULL);
+
+ for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) {
+ do_msa_ADDS_S_B(b128_pattern[i], b128_pattern[j],
+ b128_result[PATTERN_INPUTS_SHORT_COUNT * i + j]);
+ }
+ }
+
+ for (i = 0; i < RANDOM_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < RANDOM_INPUTS_SHORT_COUNT; j++) {
+ do_msa_ADDS_S_B(b128_random[i], b128_random[j],
+ b128_result[((PATTERN_INPUTS_SHORT_COUNT) *
+ (PATTERN_INPUTS_SHORT_COUNT)) +
+ RANDOM_INPUTS_SHORT_COUNT * i + j]);
+ }
+ }
+
+ gettimeofday(&end, NULL);
+
+ elapsed_time = (end.tv_sec - start.tv_sec) * 1000.0;
+ elapsed_time += (end.tv_usec - start.tv_usec) / 1000.0;
+
+ ret = check_results(instruction_name, TEST_COUNT_TOTAL, elapsed_time,
+ &b128_result[0][0], &b128_expect[0][0]);
+
+ return ret;
+}
diff --git a/tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_s_d.c b/tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_s_d.c
new file mode 100644
index 0000000..d37773e
--- /dev/null
+++ b/tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_s_d.c
@@ -0,0 +1,151 @@
+/*
+ * Test program for MSA instruction ADDS_S.D
+ *
+ * Copyright (C) 2018 Wave Computing, Inc.
+ * Copyright (C) 2018 Aleksandar Markovic <amarkovic@wavecomp.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
+#include <sys/time.h>
+#include <stdint.h>
+
+#include "../../../../include/wrappers_msa.h"
+#include "../../../../include/test_inputs.h"
+#include "../../../../include/test_utils.h"
+
+#define TEST_COUNT_TOTAL ( \
+ (PATTERN_INPUTS_SHORT_COUNT) * (PATTERN_INPUTS_SHORT_COUNT) + \
+ (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT))
+
+
+int32_t main(void)
+{
+ char *instruction_name = "ADDS_S.D";
+ int32_t ret;
+ uint32_t i, j;
+ struct timeval start, end;
+ double elapsed_time;
+
+ uint64_t b128_result[TEST_COUNT_TOTAL][2];
+ uint64_t b128_expect[TEST_COUNT_TOTAL][2] = {
+ { 0xfffffffffffffffeULL, 0xfffffffffffffffeULL, }, /* 0 */
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xaaaaaaaaaaaaaaa9ULL, 0xaaaaaaaaaaaaaaa9ULL, },
+ { 0x5555555555555554ULL, 0x5555555555555554ULL, },
+ { 0xcccccccccccccccbULL, 0xcccccccccccccccbULL, },
+ { 0x3333333333333332ULL, 0x3333333333333332ULL, },
+ { 0xe38e38e38e38e38dULL, 0x38e38e38e38e38e2ULL, },
+ { 0x1c71c71c71c71c70ULL, 0xc71c71c71c71c71bULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 8 */
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, },
+ { 0x5555555555555555ULL, 0x5555555555555555ULL, },
+ { 0xccccccccccccccccULL, 0xccccccccccccccccULL, },
+ { 0x3333333333333333ULL, 0x3333333333333333ULL, },
+ { 0xe38e38e38e38e38eULL, 0x38e38e38e38e38e3ULL, },
+ { 0x1c71c71c71c71c71ULL, 0xc71c71c71c71c71cULL, },
+ { 0xaaaaaaaaaaaaaaa9ULL, 0xaaaaaaaaaaaaaaa9ULL, }, /* 16 */
+ { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, },
+ { 0x8000000000000000ULL, 0x8000000000000000ULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0x8000000000000000ULL, 0x8000000000000000ULL, },
+ { 0xddddddddddddddddULL, 0xddddddddddddddddULL, },
+ { 0x8e38e38e38e38e38ULL, 0xe38e38e38e38e38dULL, },
+ { 0xc71c71c71c71c71bULL, 0x8000000000000000ULL, },
+ { 0x5555555555555554ULL, 0x5555555555555554ULL, }, /* 24 */
+ { 0x5555555555555555ULL, 0x5555555555555555ULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0x7fffffffffffffffULL, 0x7fffffffffffffffULL, },
+ { 0x2222222222222221ULL, 0x2222222222222221ULL, },
+ { 0x7fffffffffffffffULL, 0x7fffffffffffffffULL, },
+ { 0x38e38e38e38e38e3ULL, 0x7fffffffffffffffULL, },
+ { 0x71c71c71c71c71c6ULL, 0x1c71c71c71c71c71ULL, },
+ { 0xcccccccccccccccbULL, 0xcccccccccccccccbULL, }, /* 32 */
+ { 0xccccccccccccccccULL, 0xccccccccccccccccULL, },
+ { 0x8000000000000000ULL, 0x8000000000000000ULL, },
+ { 0x2222222222222221ULL, 0x2222222222222221ULL, },
+ { 0x9999999999999998ULL, 0x9999999999999998ULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xb05b05b05b05b05aULL, 0x05b05b05b05b05afULL, },
+ { 0xe93e93e93e93e93dULL, 0x93e93e93e93e93e8ULL, },
+ { 0x3333333333333332ULL, 0x3333333333333332ULL, }, /* 40 */
+ { 0x3333333333333333ULL, 0x3333333333333333ULL, },
+ { 0xddddddddddddddddULL, 0xddddddddddddddddULL, },
+ { 0x7fffffffffffffffULL, 0x7fffffffffffffffULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0x6666666666666666ULL, 0x6666666666666666ULL, },
+ { 0x16c16c16c16c16c1ULL, 0x6c16c16c16c16c16ULL, },
+ { 0x4fa4fa4fa4fa4fa4ULL, 0xfa4fa4fa4fa4fa4fULL, },
+ { 0xe38e38e38e38e38dULL, 0x38e38e38e38e38e2ULL, }, /* 48 */
+ { 0xe38e38e38e38e38eULL, 0x38e38e38e38e38e3ULL, },
+ { 0x8e38e38e38e38e38ULL, 0xe38e38e38e38e38dULL, },
+ { 0x38e38e38e38e38e3ULL, 0x7fffffffffffffffULL, },
+ { 0xb05b05b05b05b05aULL, 0x05b05b05b05b05afULL, },
+ { 0x16c16c16c16c16c1ULL, 0x6c16c16c16c16c16ULL, },
+ { 0xc71c71c71c71c71cULL, 0x71c71c71c71c71c6ULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0x1c71c71c71c71c70ULL, 0xc71c71c71c71c71bULL, }, /* 56 */
+ { 0x1c71c71c71c71c71ULL, 0xc71c71c71c71c71cULL, },
+ { 0xc71c71c71c71c71bULL, 0x8000000000000000ULL, },
+ { 0x71c71c71c71c71c6ULL, 0x1c71c71c71c71c71ULL, },
+ { 0xe93e93e93e93e93dULL, 0x93e93e93e93e93e8ULL, },
+ { 0x4fa4fa4fa4fa4fa4ULL, 0xfa4fa4fa4fa4fa4fULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0x38e38e38e38e38e2ULL, 0x8e38e38e38e38e38ULL, },
+ { 0x8000000000000000ULL, 0x7fffffffffffffffULL, }, /* 64 */
+ { 0x8428e72f75f61c48ULL, 0x5e5ec67913bb0308ULL, },
+ { 0x8000000000000000ULL, 0x733fd25ea9a6d520ULL, },
+ { 0xf8b9fd198694378eULL, 0xd9589437a7be92acULL, },
+ { 0x8428e72f75f61c48ULL, 0x5e5ec67913bb0308ULL, },
+ { 0xf77c00c69b278e10ULL, 0x25ef76342a7ea5f8ULL, },
+ { 0xa818af0e07635288ULL, 0x3ad08219c06a7810ULL, },
+ { 0x6c0d16b0abc5a956ULL, 0xa0e943f2be82359cULL, },
+ { 0x8000000000000000ULL, 0x733fd25ea9a6d520ULL, }, /* 72 */
+ { 0xa818af0e07635288ULL, 0x3ad08219c06a7810ULL, },
+ { 0x8000000000000000ULL, 0x4fb18dff56564a28ULL, },
+ { 0x1ca9c4f818016dceULL, 0xb5ca4fd8546e07b4ULL, },
+ { 0xf8b9fd198694378eULL, 0xd9589437a7be92acULL, },
+ { 0x6c0d16b0abc5a956ULL, 0xa0e943f2be82359cULL, },
+};
+
+ gettimeofday(&start, NULL);
+
+ for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) {
+ do_msa_ADDS_S_D(b128_pattern[i], b128_pattern[j],
+ b128_result[PATTERN_INPUTS_SHORT_COUNT * i + j]);
+ }
+ }
+
+ for (i = 0; i < RANDOM_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < RANDOM_INPUTS_SHORT_COUNT; j++) {
+ do_msa_ADDS_S_D(b128_random[i], b128_random[j],
+ b128_result[((PATTERN_INPUTS_SHORT_COUNT) *
+ (PATTERN_INPUTS_SHORT_COUNT)) +
+ RANDOM_INPUTS_SHORT_COUNT * i + j]);
+ }
+ }
+
+ gettimeofday(&end, NULL);
+
+ elapsed_time = (end.tv_sec - start.tv_sec) * 1000.0;
+ elapsed_time += (end.tv_usec - start.tv_usec) / 1000.0;
+
+ ret = check_results(instruction_name, TEST_COUNT_TOTAL, elapsed_time,
+ &b128_result[0][0], &b128_expect[0][0]);
+
+ return ret;
+}
diff --git a/tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_s_h.c b/tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_s_h.c
new file mode 100644
index 0000000..eb5afe1
--- /dev/null
+++ b/tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_s_h.c
@@ -0,0 +1,151 @@
+/*
+ * Test program for MSA instruction ADDS_S.H
+ *
+ * Copyright (C) 2018 Wave Computing, Inc.
+ * Copyright (C) 2018 Aleksandar Markovic <amarkovic@wavecomp.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
+#include <sys/time.h>
+#include <stdint.h>
+
+#include "../../../../include/wrappers_msa.h"
+#include "../../../../include/test_inputs.h"
+#include "../../../../include/test_utils.h"
+
+#define TEST_COUNT_TOTAL ( \
+ (PATTERN_INPUTS_SHORT_COUNT) * (PATTERN_INPUTS_SHORT_COUNT) + \
+ (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT))
+
+
+int32_t main(void)
+{
+ char *instruction_name = "ADDS_S.H";
+ int32_t ret;
+ uint32_t i, j;
+ struct timeval start, end;
+ double elapsed_time;
+
+ uint64_t b128_result[TEST_COUNT_TOTAL][2];
+ uint64_t b128_expect[TEST_COUNT_TOTAL][2] = {
+ { 0xfffefffefffefffeULL, 0xfffefffefffefffeULL, }, /* 0 */
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xaaa9aaa9aaa9aaa9ULL, 0xaaa9aaa9aaa9aaa9ULL, },
+ { 0x5554555455545554ULL, 0x5554555455545554ULL, },
+ { 0xcccbcccbcccbcccbULL, 0xcccbcccbcccbcccbULL, },
+ { 0x3332333233323332ULL, 0x3332333233323332ULL, },
+ { 0xe38d38e28e37e38dULL, 0x38e28e37e38d38e2ULL, },
+ { 0x1c70c71b71c61c70ULL, 0xc71b71c61c70c71bULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 8 */
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, },
+ { 0x5555555555555555ULL, 0x5555555555555555ULL, },
+ { 0xccccccccccccccccULL, 0xccccccccccccccccULL, },
+ { 0x3333333333333333ULL, 0x3333333333333333ULL, },
+ { 0xe38e38e38e38e38eULL, 0x38e38e38e38e38e3ULL, },
+ { 0x1c71c71c71c71c71ULL, 0xc71c71c71c71c71cULL, },
+ { 0xaaa9aaa9aaa9aaa9ULL, 0xaaa9aaa9aaa9aaa9ULL, }, /* 16 */
+ { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, },
+ { 0x8000800080008000ULL, 0x8000800080008000ULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0x8000800080008000ULL, 0x8000800080008000ULL, },
+ { 0xddddddddddddddddULL, 0xddddddddddddddddULL, },
+ { 0x8e38e38d80008e38ULL, 0xe38d80008e38e38dULL, },
+ { 0xc71b80001c71c71bULL, 0x80001c71c71b8000ULL, },
+ { 0x5554555455545554ULL, 0x5554555455545554ULL, }, /* 24 */
+ { 0x5555555555555555ULL, 0x5555555555555555ULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0x7fff7fff7fff7fffULL, 0x7fff7fff7fff7fffULL, },
+ { 0x2221222122212221ULL, 0x2221222122212221ULL, },
+ { 0x7fff7fff7fff7fffULL, 0x7fff7fff7fff7fffULL, },
+ { 0x38e37fffe38d38e3ULL, 0x7fffe38d38e37fffULL, },
+ { 0x71c61c717fff71c6ULL, 0x1c717fff71c61c71ULL, },
+ { 0xcccbcccbcccbcccbULL, 0xcccbcccbcccbcccbULL, }, /* 32 */
+ { 0xccccccccccccccccULL, 0xccccccccccccccccULL, },
+ { 0x8000800080008000ULL, 0x8000800080008000ULL, },
+ { 0x2221222122212221ULL, 0x2221222122212221ULL, },
+ { 0x9998999899989998ULL, 0x9998999899989998ULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xb05a05af8000b05aULL, 0x05af8000b05a05afULL, },
+ { 0xe93d93e83e93e93dULL, 0x93e83e93e93d93e8ULL, },
+ { 0x3332333233323332ULL, 0x3332333233323332ULL, }, /* 40 */
+ { 0x3333333333333333ULL, 0x3333333333333333ULL, },
+ { 0xddddddddddddddddULL, 0xddddddddddddddddULL, },
+ { 0x7fff7fff7fff7fffULL, 0x7fff7fff7fff7fffULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0x6666666666666666ULL, 0x6666666666666666ULL, },
+ { 0x16c16c16c16b16c1ULL, 0x6c16c16b16c16c16ULL, },
+ { 0x4fa4fa4f7fff4fa4ULL, 0xfa4f7fff4fa4fa4fULL, },
+ { 0xe38d38e28e37e38dULL, 0x38e28e37e38d38e2ULL, }, /* 48 */
+ { 0xe38e38e38e38e38eULL, 0x38e38e38e38e38e3ULL, },
+ { 0x8e38e38d80008e38ULL, 0xe38d80008e38e38dULL, },
+ { 0x38e37fffe38d38e3ULL, 0x7fffe38d38e37fffULL, },
+ { 0xb05a05af8000b05aULL, 0x05af8000b05a05afULL, },
+ { 0x16c16c16c16b16c1ULL, 0x6c16c16b16c16c16ULL, },
+ { 0xc71c71c68000c71cULL, 0x71c68000c71c71c6ULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0x1c70c71b71c61c70ULL, 0xc71b71c61c70c71bULL, }, /* 56 */
+ { 0x1c71c71c71c71c71ULL, 0xc71c71c71c71c71cULL, },
+ { 0xc71b80001c71c71bULL, 0x80001c71c71b8000ULL, },
+ { 0x71c61c717fff71c6ULL, 0x1c717fff71c61c71ULL, },
+ { 0xe93d93e83e93e93dULL, 0x93e83e93e93d93e8ULL, },
+ { 0x4fa4fa4f7fff4fa4ULL, 0xfa4f7fff4fa4fa4fULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0x38e28e387fff38e2ULL, 0x8e387fff38e28e38ULL, },
+ { 0x8000cd9850c47fffULL, 0x7fff16bcfcf68000ULL, }, /* 64 */
+ { 0x8428e72f75f51c48ULL, 0x5e5ec67813ba0308ULL, },
+ { 0x80009576e231e0c0ULL, 0x733fd25da9a6d520ULL, },
+ { 0xf8b9fd197fff378eULL, 0xd9589436a7bd92acULL, },
+ { 0x8428e72f75f51c48ULL, 0x5e5ec67813ba0308ULL, },
+ { 0xf77c00c67fff8e10ULL, 0x25ee80002a7e7fffULL, },
+ { 0xa818af0d07628000ULL, 0x3acf8219c06a7810ULL, },
+ { 0x6c0d16b07fffa956ULL, 0xa0e88000be81359cULL, },
+ { 0x80009576e231e0c0ULL, 0x733fd25da9a6d520ULL, }, /* 72 */
+ { 0xa818af0d07628000ULL, 0x3acf8219c06a7810ULL, },
+ { 0x8000800080008000ULL, 0x4fb08dfe80004a28ULL, },
+ { 0x1ca9c4f718008000ULL, 0xb5c98000800007b4ULL, },
+ { 0xf8b9fd197fff378eULL, 0xd9589436a7bd92acULL, },
+ { 0x6c0d16b07fffa956ULL, 0xa0e88000be81359cULL, },
+};
+
+ gettimeofday(&start, NULL);
+
+ for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) {
+ do_msa_ADDS_S_H(b128_pattern[i], b128_pattern[j],
+ b128_result[PATTERN_INPUTS_SHORT_COUNT * i + j]);
+ }
+ }
+
+ for (i = 0; i < RANDOM_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < RANDOM_INPUTS_SHORT_COUNT; j++) {
+ do_msa_ADDS_S_H(b128_random[i], b128_random[j],
+ b128_result[((PATTERN_INPUTS_SHORT_COUNT) *
+ (PATTERN_INPUTS_SHORT_COUNT)) +
+ RANDOM_INPUTS_SHORT_COUNT * i + j]);
+ }
+ }
+
+ gettimeofday(&end, NULL);
+
+ elapsed_time = (end.tv_sec - start.tv_sec) * 1000.0;
+ elapsed_time += (end.tv_usec - start.tv_usec) / 1000.0;
+
+ ret = check_results(instruction_name, TEST_COUNT_TOTAL, elapsed_time,
+ &b128_result[0][0], &b128_expect[0][0]);
+
+ return ret;
+}
diff --git a/tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_s_w.c b/tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_s_w.c
new file mode 100644
index 0000000..3e1aa30
--- /dev/null
+++ b/tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_s_w.c
@@ -0,0 +1,151 @@
+/*
+ * Test program for MSA instruction ADDS_S.W
+ *
+ * Copyright (C) 2018 Wave Computing, Inc.
+ * Copyright (C) 2018 Aleksandar Markovic <amarkovic@wavecomp.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
+#include <sys/time.h>
+#include <stdint.h>
+
+#include "../../../../include/wrappers_msa.h"
+#include "../../../../include/test_inputs.h"
+#include "../../../../include/test_utils.h"
+
+#define TEST_COUNT_TOTAL ( \
+ (PATTERN_INPUTS_SHORT_COUNT) * (PATTERN_INPUTS_SHORT_COUNT) + \
+ (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT))
+
+
+int32_t main(void)
+{
+ char *instruction_name = "ADDS_S.W";
+ int32_t ret;
+ uint32_t i, j;
+ struct timeval start, end;
+ double elapsed_time;
+
+ uint64_t b128_result[TEST_COUNT_TOTAL][2];
+ uint64_t b128_expect[TEST_COUNT_TOTAL][2] = {
+ { 0xfffffffefffffffeULL, 0xfffffffefffffffeULL, }, /* 0 */
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xaaaaaaa9aaaaaaa9ULL, 0xaaaaaaa9aaaaaaa9ULL, },
+ { 0x5555555455555554ULL, 0x5555555455555554ULL, },
+ { 0xcccccccbcccccccbULL, 0xcccccccbcccccccbULL, },
+ { 0x3333333233333332ULL, 0x3333333233333332ULL, },
+ { 0xe38e38e28e38e38dULL, 0x38e38e37e38e38e2ULL, },
+ { 0x1c71c71b71c71c70ULL, 0xc71c71c61c71c71bULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 8 */
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, },
+ { 0x5555555555555555ULL, 0x5555555555555555ULL, },
+ { 0xccccccccccccccccULL, 0xccccccccccccccccULL, },
+ { 0x3333333333333333ULL, 0x3333333333333333ULL, },
+ { 0xe38e38e38e38e38eULL, 0x38e38e38e38e38e3ULL, },
+ { 0x1c71c71c71c71c71ULL, 0xc71c71c71c71c71cULL, },
+ { 0xaaaaaaa9aaaaaaa9ULL, 0xaaaaaaa9aaaaaaa9ULL, }, /* 16 */
+ { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, },
+ { 0x8000000080000000ULL, 0x8000000080000000ULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0x8000000080000000ULL, 0x8000000080000000ULL, },
+ { 0xddddddddddddddddULL, 0xddddddddddddddddULL, },
+ { 0x8e38e38d80000000ULL, 0xe38e38e28e38e38dULL, },
+ { 0xc71c71c61c71c71bULL, 0x80000000c71c71c6ULL, },
+ { 0x5555555455555554ULL, 0x5555555455555554ULL, }, /* 24 */
+ { 0x5555555555555555ULL, 0x5555555555555555ULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0x7fffffff7fffffffULL, 0x7fffffff7fffffffULL, },
+ { 0x2222222122222221ULL, 0x2222222122222221ULL, },
+ { 0x7fffffff7fffffffULL, 0x7fffffff7fffffffULL, },
+ { 0x38e38e38e38e38e3ULL, 0x7fffffff38e38e38ULL, },
+ { 0x71c71c717fffffffULL, 0x1c71c71c71c71c71ULL, },
+ { 0xcccccccbcccccccbULL, 0xcccccccbcccccccbULL, }, /* 32 */
+ { 0xccccccccccccccccULL, 0xccccccccccccccccULL, },
+ { 0x8000000080000000ULL, 0x8000000080000000ULL, },
+ { 0x2222222122222221ULL, 0x2222222122222221ULL, },
+ { 0x9999999899999998ULL, 0x9999999899999998ULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xb05b05af80000000ULL, 0x05b05b04b05b05afULL, },
+ { 0xe93e93e83e93e93dULL, 0x93e93e93e93e93e8ULL, },
+ { 0x3333333233333332ULL, 0x3333333233333332ULL, }, /* 40 */
+ { 0x3333333333333333ULL, 0x3333333333333333ULL, },
+ { 0xddddddddddddddddULL, 0xddddddddddddddddULL, },
+ { 0x7fffffff7fffffffULL, 0x7fffffff7fffffffULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0x6666666666666666ULL, 0x6666666666666666ULL, },
+ { 0x16c16c16c16c16c1ULL, 0x6c16c16b16c16c16ULL, },
+ { 0x4fa4fa4f7fffffffULL, 0xfa4fa4fa4fa4fa4fULL, },
+ { 0xe38e38e28e38e38dULL, 0x38e38e37e38e38e2ULL, }, /* 48 */
+ { 0xe38e38e38e38e38eULL, 0x38e38e38e38e38e3ULL, },
+ { 0x8e38e38d80000000ULL, 0xe38e38e28e38e38dULL, },
+ { 0x38e38e38e38e38e3ULL, 0x7fffffff38e38e38ULL, },
+ { 0xb05b05af80000000ULL, 0x05b05b04b05b05afULL, },
+ { 0x16c16c16c16c16c1ULL, 0x6c16c16b16c16c16ULL, },
+ { 0xc71c71c680000000ULL, 0x71c71c70c71c71c6ULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0x1c71c71b71c71c70ULL, 0xc71c71c61c71c71bULL, }, /* 56 */
+ { 0x1c71c71c71c71c71ULL, 0xc71c71c71c71c71cULL, },
+ { 0xc71c71c61c71c71bULL, 0x80000000c71c71c6ULL, },
+ { 0x71c71c717fffffffULL, 0x1c71c71c71c71c71ULL, },
+ { 0xe93e93e83e93e93dULL, 0x93e93e93e93e93e8ULL, },
+ { 0x4fa4fa4f7fffffffULL, 0xfa4fa4fa4fa4fa4fULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0x38e38e387fffffffULL, 0x8e38e38e38e38e38ULL, },
+ { 0x8000000050c4aa80ULL, 0x7ffffffffcf76018ULL, }, /* 64 */
+ { 0x8428e72f75f61c48ULL, 0x5e5ec67813bb0308ULL, },
+ { 0x80000000e231e0c0ULL, 0x733fd25da9a6d520ULL, },
+ { 0xf8b9fd197fffffffULL, 0xd9589436a7be92acULL, },
+ { 0x8428e72f75f61c48ULL, 0x5e5ec67813bb0308ULL, },
+ { 0xf77c00c67fffffffULL, 0x25ef76342a7ea5f8ULL, },
+ { 0xa818af0d07635288ULL, 0x3ad08219c06a7810ULL, },
+ { 0x6c0d16b07fffffffULL, 0xa0e943f2be82359cULL, },
+ { 0x80000000e231e0c0ULL, 0x733fd25da9a6d520ULL, }, /* 72 */
+ { 0xa818af0d07635288ULL, 0x3ad08219c06a7810ULL, },
+ { 0x8000000080000000ULL, 0x4fb18dfe80000000ULL, },
+ { 0x1ca9c4f718016dceULL, 0xb5ca4fd780000000ULL, },
+ { 0xf8b9fd197fffffffULL, 0xd9589436a7be92acULL, },
+ { 0x6c0d16b07fffffffULL, 0xa0e943f2be82359cULL, },
+};
+
+ gettimeofday(&start, NULL);
+
+ for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) {
+ do_msa_ADDS_S_W(b128_pattern[i], b128_pattern[j],
+ b128_result[PATTERN_INPUTS_SHORT_COUNT * i + j]);
+ }
+ }
+
+ for (i = 0; i < RANDOM_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < RANDOM_INPUTS_SHORT_COUNT; j++) {
+ do_msa_ADDS_S_W(b128_random[i], b128_random[j],
+ b128_result[((PATTERN_INPUTS_SHORT_COUNT) *
+ (PATTERN_INPUTS_SHORT_COUNT)) +
+ RANDOM_INPUTS_SHORT_COUNT * i + j]);
+ }
+ }
+
+ gettimeofday(&end, NULL);
+
+ elapsed_time = (end.tv_sec - start.tv_sec) * 1000.0;
+ elapsed_time += (end.tv_usec - start.tv_usec) / 1000.0;
+
+ ret = check_results(instruction_name, TEST_COUNT_TOTAL, elapsed_time,
+ &b128_result[0][0], &b128_expect[0][0]);
+
+ return ret;
+}
diff --git a/tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_u_b.c b/tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_u_b.c
new file mode 100644
index 0000000..995da29
--- /dev/null
+++ b/tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_u_b.c
@@ -0,0 +1,151 @@
+/*
+ * Test program for MSA instruction ADDS_U.B
+ *
+ * Copyright (C) 2018 Wave Computing, Inc.
+ * Copyright (C) 2018 Aleksandar Markovic <amarkovic@wavecomp.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
+#include <sys/time.h>
+#include <stdint.h>
+
+#include "../../../../include/wrappers_msa.h"
+#include "../../../../include/test_inputs.h"
+#include "../../../../include/test_utils.h"
+
+#define TEST_COUNT_TOTAL ( \
+ (PATTERN_INPUTS_SHORT_COUNT) * (PATTERN_INPUTS_SHORT_COUNT) + \
+ (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT))
+
+
+int32_t main(void)
+{
+ char *instruction_name = "ADDS_U.B";
+ int32_t ret;
+ uint32_t i, j;
+ struct timeval start, end;
+ double elapsed_time;
+
+ uint64_t b128_result[TEST_COUNT_TOTAL][2];
+ uint64_t b128_expect[TEST_COUNT_TOTAL][2] = {
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 0 */
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 8 */
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, },
+ { 0x5555555555555555ULL, 0x5555555555555555ULL, },
+ { 0xccccccccccccccccULL, 0xccccccccccccccccULL, },
+ { 0x3333333333333333ULL, 0x3333333333333333ULL, },
+ { 0xe38e38e38e38e38eULL, 0x38e38e38e38e38e3ULL, },
+ { 0x1c71c71c71c71c71ULL, 0xc71c71c71c71c71cULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 16 */
+ { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xddddddddddddddddULL, 0xddddddddddddddddULL, },
+ { 0xffffe2ffffe2ffffULL, 0xe2ffffe2ffffe2ffULL, },
+ { 0xc6ffffc6ffffc6ffULL, 0xffc6ffffc6ffffc6ULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 24 */
+ { 0x5555555555555555ULL, 0x5555555555555555ULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0x8888888888888888ULL, 0x8888888888888888ULL, },
+ { 0xffe38dffe38dffe3ULL, 0x8dffe38dffe38dffULL, },
+ { 0x71c6ff71c6ff71c6ULL, 0xff71c6ff71c6ff71ULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 32 */
+ { 0xccccccccccccccccULL, 0xccccccccccccccccULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xe8ffffe8ffffe8ffULL, 0xffe8ffffe8ffffe8ULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 40 */
+ { 0x3333333333333333ULL, 0x3333333333333333ULL, },
+ { 0xddddddddddddddddULL, 0xddddddddddddddddULL, },
+ { 0x8888888888888888ULL, 0x8888888888888888ULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0x6666666666666666ULL, 0x6666666666666666ULL, },
+ { 0xffc16bffc16bffc1ULL, 0x6bffc16bffc16bffULL, },
+ { 0x4fa4fa4fa4fa4fa4ULL, 0xfa4fa4fa4fa4fa4fULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 48 */
+ { 0xe38e38e38e38e38eULL, 0x38e38e38e38e38e3ULL, },
+ { 0xffffe2ffffe2ffffULL, 0xe2ffffe2ffffe2ffULL, },
+ { 0xffe38dffe38dffe3ULL, 0x8dffe38dffe38dffULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xffc16bffc16bffc1ULL, 0x6bffc16bffc16bffULL, },
+ { 0xffff70ffff70ffffULL, 0x70ffff70ffff70ffULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 56 */
+ { 0x1c71c71c71c71c71ULL, 0xc71c71c71c71c71cULL, },
+ { 0xc6ffffc6ffffc6ffULL, 0xffc6ffffc6ffffc6ULL, },
+ { 0x71c6ff71c6ff71c6ULL, 0xff71c6ff71c6ff71ULL, },
+ { 0xe8ffffe8ffffe8ffULL, 0xffe8ffffe8ffffe8ULL, },
+ { 0x4fa4fa4fa4fa4fa4ULL, 0xfa4fa4fa4fa4fa4fULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0x38e2ff38e2ff38e2ULL, 0xff38e2ff38e2ff38ULL, },
+ { 0xffd4ffff50c4aa80ULL, 0x96ce16bcfff6ff18ULL, }, /* 64 */
+ { 0xffffe6ff75f5ff48ULL, 0x5dffc678ffbaffffULL, },
+ { 0xffc4ffffe1ffe0c0ULL, 0x72ffd1ffffa6d520ULL, },
+ { 0xf8b9fcff8693ff8eULL, 0xd8ff93ffffbdffacULL, },
+ { 0xffffe6ff75f5ff48ULL, 0x5dffc678ffbaffffULL, },
+ { 0xffff00c69affff10ULL, 0x24ffff342a7ea4ffULL, },
+ { 0xffffaeffffffff88ULL, 0x39ffffffc06a77ffULL, },
+ { 0xffff16b0abc4ff56ULL, 0x9ffffff2be81ffffULL, },
+ { 0xffc4ffffe1ffe0c0ULL, 0x72ffd1ffffa6d520ULL, }, /* 72 */
+ { 0xffffaeffffffff88ULL, 0x39ffffffc06a77ffULL, },
+ { 0xffb4ffffffffffffULL, 0x4effffffff564a28ULL, },
+ { 0xffa9c4f7ffffffceULL, 0xb4ffffffff6dffb4ULL, },
+ { 0xf8b9fcff8693ff8eULL, 0xd8ff93ffffbdffacULL, },
+ { 0xffff16b0abc4ff56ULL, 0x9ffffff2be81ffffULL, },
+};
+
+ gettimeofday(&start, NULL);
+
+ for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) {
+ do_msa_ADDS_U_B(b128_pattern[i], b128_pattern[j],
+ b128_result[PATTERN_INPUTS_SHORT_COUNT * i + j]);
+ }
+ }
+
+ for (i = 0; i < RANDOM_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < RANDOM_INPUTS_SHORT_COUNT; j++) {
+ do_msa_ADDS_U_B(b128_random[i], b128_random[j],
+ b128_result[((PATTERN_INPUTS_SHORT_COUNT) *
+ (PATTERN_INPUTS_SHORT_COUNT)) +
+ RANDOM_INPUTS_SHORT_COUNT * i + j]);
+ }
+ }
+
+ gettimeofday(&end, NULL);
+
+ elapsed_time = (end.tv_sec - start.tv_sec) * 1000.0;
+ elapsed_time += (end.tv_usec - start.tv_usec) / 1000.0;
+
+ ret = check_results(instruction_name, TEST_COUNT_TOTAL, elapsed_time,
+ &b128_result[0][0], &b128_expect[0][0]);
+
+ return ret;
+}
diff --git a/tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_u_d.c b/tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_u_d.c
new file mode 100644
index 0000000..2e32380
--- /dev/null
+++ b/tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_u_d.c
@@ -0,0 +1,151 @@
+/*
+ * Test program for MSA instruction ADDS_U.D
+ *
+ * Copyright (C) 2018 Wave Computing, Inc.
+ * Copyright (C) 2018 Aleksandar Markovic <amarkovic@wavecomp.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
+#include <sys/time.h>
+#include <stdint.h>
+
+#include "../../../../include/wrappers_msa.h"
+#include "../../../../include/test_inputs.h"
+#include "../../../../include/test_utils.h"
+
+#define TEST_COUNT_TOTAL ( \
+ (PATTERN_INPUTS_SHORT_COUNT) * (PATTERN_INPUTS_SHORT_COUNT) + \
+ (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT))
+
+
+int32_t main(void)
+{
+ char *instruction_name = "ADDS_U.D";
+ int32_t ret;
+ uint32_t i, j;
+ struct timeval start, end;
+ double elapsed_time;
+
+ uint64_t b128_result[TEST_COUNT_TOTAL][2];
+ uint64_t b128_expect[TEST_COUNT_TOTAL][2] = {
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 0 */
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 8 */
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, },
+ { 0x5555555555555555ULL, 0x5555555555555555ULL, },
+ { 0xccccccccccccccccULL, 0xccccccccccccccccULL, },
+ { 0x3333333333333333ULL, 0x3333333333333333ULL, },
+ { 0xe38e38e38e38e38eULL, 0x38e38e38e38e38e3ULL, },
+ { 0x1c71c71c71c71c71ULL, 0xc71c71c71c71c71cULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 16 */
+ { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xddddddddddddddddULL, 0xddddddddddddddddULL, },
+ { 0xffffffffffffffffULL, 0xe38e38e38e38e38dULL, },
+ { 0xc71c71c71c71c71bULL, 0xffffffffffffffffULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 24 */
+ { 0x5555555555555555ULL, 0x5555555555555555ULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0x8888888888888888ULL, 0x8888888888888888ULL, },
+ { 0xffffffffffffffffULL, 0x8e38e38e38e38e38ULL, },
+ { 0x71c71c71c71c71c6ULL, 0xffffffffffffffffULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 32 */
+ { 0xccccccccccccccccULL, 0xccccccccccccccccULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xe93e93e93e93e93dULL, 0xffffffffffffffffULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 40 */
+ { 0x3333333333333333ULL, 0x3333333333333333ULL, },
+ { 0xddddddddddddddddULL, 0xddddddddddddddddULL, },
+ { 0x8888888888888888ULL, 0x8888888888888888ULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0x6666666666666666ULL, 0x6666666666666666ULL, },
+ { 0xffffffffffffffffULL, 0x6c16c16c16c16c16ULL, },
+ { 0x4fa4fa4fa4fa4fa4ULL, 0xfa4fa4fa4fa4fa4fULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 48 */
+ { 0xe38e38e38e38e38eULL, 0x38e38e38e38e38e3ULL, },
+ { 0xffffffffffffffffULL, 0xe38e38e38e38e38dULL, },
+ { 0xffffffffffffffffULL, 0x8e38e38e38e38e38ULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xffffffffffffffffULL, 0x6c16c16c16c16c16ULL, },
+ { 0xffffffffffffffffULL, 0x71c71c71c71c71c6ULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 56 */
+ { 0x1c71c71c71c71c71ULL, 0xc71c71c71c71c71cULL, },
+ { 0xc71c71c71c71c71bULL, 0xffffffffffffffffULL, },
+ { 0x71c71c71c71c71c6ULL, 0xffffffffffffffffULL, },
+ { 0xe93e93e93e93e93dULL, 0xffffffffffffffffULL, },
+ { 0x4fa4fa4fa4fa4fa4ULL, 0xfa4fa4fa4fa4fa4fULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0x38e38e38e38e38e2ULL, 0xffffffffffffffffULL, },
+ { 0xffffffffffffffffULL, 0x96ce16bdfcf76018ULL, }, /* 64 */
+ { 0xffffffffffffffffULL, 0x5e5ec67913bb0308ULL, },
+ { 0xffffffffffffffffULL, 0x733fd25ea9a6d520ULL, },
+ { 0xf8b9fd198694378eULL, 0xd9589437a7be92acULL, },
+ { 0xffffffffffffffffULL, 0x5e5ec67913bb0308ULL, },
+ { 0xffffffffffffffffULL, 0x25ef76342a7ea5f8ULL, },
+ { 0xffffffffffffffffULL, 0x3ad08219c06a7810ULL, },
+ { 0xffffffffffffffffULL, 0xa0e943f2be82359cULL, },
+ { 0xffffffffffffffffULL, 0x733fd25ea9a6d520ULL, }, /* 72 */
+ { 0xffffffffffffffffULL, 0x3ad08219c06a7810ULL, },
+ { 0xffffffffffffffffULL, 0x4fb18dff56564a28ULL, },
+ { 0xffffffffffffffffULL, 0xb5ca4fd8546e07b4ULL, },
+ { 0xf8b9fd198694378eULL, 0xd9589437a7be92acULL, },
+ { 0xffffffffffffffffULL, 0xa0e943f2be82359cULL, },
+};
+
+ gettimeofday(&start, NULL);
+
+ for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) {
+ do_msa_ADDS_U_D(b128_pattern[i], b128_pattern[j],
+ b128_result[PATTERN_INPUTS_SHORT_COUNT * i + j]);
+ }
+ }
+
+ for (i = 0; i < RANDOM_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < RANDOM_INPUTS_SHORT_COUNT; j++) {
+ do_msa_ADDS_U_D(b128_random[i], b128_random[j],
+ b128_result[((PATTERN_INPUTS_SHORT_COUNT) *
+ (PATTERN_INPUTS_SHORT_COUNT)) +
+ RANDOM_INPUTS_SHORT_COUNT * i + j]);
+ }
+ }
+
+ gettimeofday(&end, NULL);
+
+ elapsed_time = (end.tv_sec - start.tv_sec) * 1000.0;
+ elapsed_time += (end.tv_usec - start.tv_usec) / 1000.0;
+
+ ret = check_results(instruction_name, TEST_COUNT_TOTAL, elapsed_time,
+ &b128_result[0][0], &b128_expect[0][0]);
+
+ return ret;
+}
diff --git a/tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_u_h.c b/tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_u_h.c
new file mode 100644
index 0000000..4c2e982
--- /dev/null
+++ b/tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_u_h.c
@@ -0,0 +1,151 @@
+/*
+ * Test program for MSA instruction ADDS_U.H
+ *
+ * Copyright (C) 2018 Wave Computing, Inc.
+ * Copyright (C) 2018 Aleksandar Markovic <amarkovic@wavecomp.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
+#include <sys/time.h>
+#include <stdint.h>
+
+#include "../../../../include/wrappers_msa.h"
+#include "../../../../include/test_inputs.h"
+#include "../../../../include/test_utils.h"
+
+#define TEST_COUNT_TOTAL ( \
+ (PATTERN_INPUTS_SHORT_COUNT) * (PATTERN_INPUTS_SHORT_COUNT) + \
+ (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT))
+
+
+int32_t main(void)
+{
+ char *instruction_name = "ADDS_U.H";
+ int32_t ret;
+ uint32_t i, j;
+ struct timeval start, end;
+ double elapsed_time;
+
+ uint64_t b128_result[TEST_COUNT_TOTAL][2];
+ uint64_t b128_expect[TEST_COUNT_TOTAL][2] = {
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 0 */
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 8 */
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, },
+ { 0x5555555555555555ULL, 0x5555555555555555ULL, },
+ { 0xccccccccccccccccULL, 0xccccccccccccccccULL, },
+ { 0x3333333333333333ULL, 0x3333333333333333ULL, },
+ { 0xe38e38e38e38e38eULL, 0x38e38e38e38e38e3ULL, },
+ { 0x1c71c71c71c71c71ULL, 0xc71c71c71c71c71cULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 16 */
+ { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xddddddddddddddddULL, 0xddddddddddddddddULL, },
+ { 0xffffe38dffffffffULL, 0xe38dffffffffe38dULL, },
+ { 0xc71bffffffffc71bULL, 0xffffffffc71bffffULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 24 */
+ { 0x5555555555555555ULL, 0x5555555555555555ULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0x8888888888888888ULL, 0x8888888888888888ULL, },
+ { 0xffff8e38e38dffffULL, 0x8e38e38dffff8e38ULL, },
+ { 0x71c6ffffc71c71c6ULL, 0xffffc71c71c6ffffULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 32 */
+ { 0xccccccccccccccccULL, 0xccccccccccccccccULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xe93dffffffffe93dULL, 0xffffffffe93dffffULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 40 */
+ { 0x3333333333333333ULL, 0x3333333333333333ULL, },
+ { 0xddddddddddddddddULL, 0xddddddddddddddddULL, },
+ { 0x8888888888888888ULL, 0x8888888888888888ULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0x6666666666666666ULL, 0x6666666666666666ULL, },
+ { 0xffff6c16c16bffffULL, 0x6c16c16bffff6c16ULL, },
+ { 0x4fa4fa4fa4fa4fa4ULL, 0xfa4fa4fa4fa4fa4fULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 48 */
+ { 0xe38e38e38e38e38eULL, 0x38e38e38e38e38e3ULL, },
+ { 0xffffe38dffffffffULL, 0xe38dffffffffe38dULL, },
+ { 0xffff8e38e38dffffULL, 0x8e38e38dffff8e38ULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xffff6c16c16bffffULL, 0x6c16c16bffff6c16ULL, },
+ { 0xffff71c6ffffffffULL, 0x71c6ffffffff71c6ULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 56 */
+ { 0x1c71c71c71c71c71ULL, 0xc71c71c71c71c71cULL, },
+ { 0xc71bffffffffc71bULL, 0xffffffffc71bffffULL, },
+ { 0x71c6ffffc71c71c6ULL, 0xffffc71c71c6ffffULL, },
+ { 0xe93dffffffffe93dULL, 0xffffffffe93dffffULL, },
+ { 0x4fa4fa4fa4fa4fa4ULL, 0xfa4fa4fa4fa4fa4fULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0x38e2ffffe38e38e2ULL, 0xffffe38e38e2ffffULL, },
+ { 0xffffffff50c4aa80ULL, 0x96ce16bcffffffffULL, }, /* 64 */
+ { 0xffffe72f75f5ffffULL, 0x5e5ec678ffffffffULL, },
+ { 0xffffffffe231e0c0ULL, 0x733fd25dffffd520ULL, },
+ { 0xf8b9fd198693ffffULL, 0xd9589436ffffffffULL, },
+ { 0xffffe72f75f5ffffULL, 0x5e5ec678ffffffffULL, },
+ { 0xffff00c69b26ffffULL, 0x25eeffff2a7ea5f8ULL, },
+ { 0xffffaf0dffffffffULL, 0x3acfffffc06a7810ULL, },
+ { 0xffff16b0abc4ffffULL, 0xa0e8ffffbe81ffffULL, },
+ { 0xffffffffe231e0c0ULL, 0x733fd25dffffd520ULL, }, /* 72 */
+ { 0xffffaf0dffffffffULL, 0x3acfffffc06a7810ULL, },
+ { 0xffffffffffffffffULL, 0x4fb0ffffffff4a28ULL, },
+ { 0xffffc4f7ffffffffULL, 0xb5c9ffffffffffffULL, },
+ { 0xf8b9fd198693ffffULL, 0xd9589436ffffffffULL, },
+ { 0xffff16b0abc4ffffULL, 0xa0e8ffffbe81ffffULL, },
+};
+
+ gettimeofday(&start, NULL);
+
+ for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) {
+ do_msa_ADDS_U_H(b128_pattern[i], b128_pattern[j],
+ b128_result[PATTERN_INPUTS_SHORT_COUNT * i + j]);
+ }
+ }
+
+ for (i = 0; i < RANDOM_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < RANDOM_INPUTS_SHORT_COUNT; j++) {
+ do_msa_ADDS_U_H(b128_random[i], b128_random[j],
+ b128_result[((PATTERN_INPUTS_SHORT_COUNT) *
+ (PATTERN_INPUTS_SHORT_COUNT)) +
+ RANDOM_INPUTS_SHORT_COUNT * i + j]);
+ }
+ }
+
+ gettimeofday(&end, NULL);
+
+ elapsed_time = (end.tv_sec - start.tv_sec) * 1000.0;
+ elapsed_time += (end.tv_usec - start.tv_usec) / 1000.0;
+
+ ret = check_results(instruction_name, TEST_COUNT_TOTAL, elapsed_time,
+ &b128_result[0][0], &b128_expect[0][0]);
+
+ return ret;
+}
diff --git a/tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_u_w.c b/tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_u_w.c
new file mode 100644
index 0000000..8cf0741
--- /dev/null
+++ b/tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_u_w.c
@@ -0,0 +1,151 @@
+/*
+ * Test program for MSA instruction ADDS_U.W
+ *
+ * Copyright (C) 2018 Wave Computing, Inc.
+ * Copyright (C) 2018 Aleksandar Markovic <amarkovic@wavecomp.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
+#include <sys/time.h>
+#include <stdint.h>
+
+#include "../../../../include/wrappers_msa.h"
+#include "../../../../include/test_inputs.h"
+#include "../../../../include/test_utils.h"
+
+#define TEST_COUNT_TOTAL ( \
+ (PATTERN_INPUTS_SHORT_COUNT) * (PATTERN_INPUTS_SHORT_COUNT) + \
+ (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT))
+
+
+int32_t main(void)
+{
+ char *instruction_name = "ADDS_U.W";
+ int32_t ret;
+ uint32_t i, j;
+ struct timeval start, end;
+ double elapsed_time;
+
+ uint64_t b128_result[TEST_COUNT_TOTAL][2];
+ uint64_t b128_expect[TEST_COUNT_TOTAL][2] = {
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 0 */
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 8 */
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, },
+ { 0x5555555555555555ULL, 0x5555555555555555ULL, },
+ { 0xccccccccccccccccULL, 0xccccccccccccccccULL, },
+ { 0x3333333333333333ULL, 0x3333333333333333ULL, },
+ { 0xe38e38e38e38e38eULL, 0x38e38e38e38e38e3ULL, },
+ { 0x1c71c71c71c71c71ULL, 0xc71c71c71c71c71cULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 16 */
+ { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xddddddddddddddddULL, 0xddddddddddddddddULL, },
+ { 0xffffffffffffffffULL, 0xe38e38e2ffffffffULL, },
+ { 0xc71c71c6ffffffffULL, 0xffffffffc71c71c6ULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 24 */
+ { 0x5555555555555555ULL, 0x5555555555555555ULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0x8888888888888888ULL, 0x8888888888888888ULL, },
+ { 0xffffffffe38e38e3ULL, 0x8e38e38dffffffffULL, },
+ { 0x71c71c71c71c71c6ULL, 0xffffffff71c71c71ULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 32 */
+ { 0xccccccccccccccccULL, 0xccccccccccccccccULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xe93e93e8ffffffffULL, 0xffffffffe93e93e8ULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 40 */
+ { 0x3333333333333333ULL, 0x3333333333333333ULL, },
+ { 0xddddddddddddddddULL, 0xddddddddddddddddULL, },
+ { 0x8888888888888888ULL, 0x8888888888888888ULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0x6666666666666666ULL, 0x6666666666666666ULL, },
+ { 0xffffffffc16c16c1ULL, 0x6c16c16bffffffffULL, },
+ { 0x4fa4fa4fa4fa4fa4ULL, 0xfa4fa4fa4fa4fa4fULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 48 */
+ { 0xe38e38e38e38e38eULL, 0x38e38e38e38e38e3ULL, },
+ { 0xffffffffffffffffULL, 0xe38e38e2ffffffffULL, },
+ { 0xffffffffe38e38e3ULL, 0x8e38e38dffffffffULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xffffffffc16c16c1ULL, 0x6c16c16bffffffffULL, },
+ { 0xffffffffffffffffULL, 0x71c71c70ffffffffULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 56 */
+ { 0x1c71c71c71c71c71ULL, 0xc71c71c71c71c71cULL, },
+ { 0xc71c71c6ffffffffULL, 0xffffffffc71c71c6ULL, },
+ { 0x71c71c71c71c71c6ULL, 0xffffffff71c71c71ULL, },
+ { 0xe93e93e8ffffffffULL, 0xffffffffe93e93e8ULL, },
+ { 0x4fa4fa4fa4fa4fa4ULL, 0xfa4fa4fa4fa4fa4fULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0x38e38e38e38e38e2ULL, 0xffffffff38e38e38ULL, },
+ { 0xffffffff50c4aa80ULL, 0x96ce16bcffffffffULL, }, /* 64 */
+ { 0xffffffff75f61c48ULL, 0x5e5ec678ffffffffULL, },
+ { 0xffffffffe231e0c0ULL, 0x733fd25dffffffffULL, },
+ { 0xf8b9fd198694378eULL, 0xd9589436ffffffffULL, },
+ { 0xffffffff75f61c48ULL, 0x5e5ec678ffffffffULL, },
+ { 0xffffffff9b278e10ULL, 0x25ef76342a7ea5f8ULL, },
+ { 0xffffffffffffffffULL, 0x3ad08219c06a7810ULL, },
+ { 0xffffffffabc5a956ULL, 0xa0e943f2be82359cULL, },
+ { 0xffffffffe231e0c0ULL, 0x733fd25dffffffffULL, }, /* 72 */
+ { 0xffffffffffffffffULL, 0x3ad08219c06a7810ULL, },
+ { 0xffffffffffffffffULL, 0x4fb18dfeffffffffULL, },
+ { 0xffffffffffffffffULL, 0xb5ca4fd7ffffffffULL, },
+ { 0xf8b9fd198694378eULL, 0xd9589436ffffffffULL, },
+ { 0xffffffffabc5a956ULL, 0xa0e943f2be82359cULL, },
+};
+
+ gettimeofday(&start, NULL);
+
+ for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) {
+ do_msa_ADDS_U_W(b128_pattern[i], b128_pattern[j],
+ b128_result[PATTERN_INPUTS_SHORT_COUNT * i + j]);
+ }
+ }
+
+ for (i = 0; i < RANDOM_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < RANDOM_INPUTS_SHORT_COUNT; j++) {
+ do_msa_ADDS_U_W(b128_random[i], b128_random[j],
+ b128_result[((PATTERN_INPUTS_SHORT_COUNT) *
+ (PATTERN_INPUTS_SHORT_COUNT)) +
+ RANDOM_INPUTS_SHORT_COUNT * i + j]);
+ }
+ }
+
+ gettimeofday(&end, NULL);
+
+ elapsed_time = (end.tv_sec - start.tv_sec) * 1000.0;
+ elapsed_time += (end.tv_usec - start.tv_usec) / 1000.0;
+
+ ret = check_results(instruction_name, TEST_COUNT_TOTAL, elapsed_time,
+ &b128_result[0][0], &b128_expect[0][0]);
+
+ return ret;
+}
diff --git a/tests/tcg/mips/user/ase/msa/int-add/test_msa_addv_b.c b/tests/tcg/mips/user/ase/msa/int-add/test_msa_addv_b.c
new file mode 100644
index 0000000..44d8921
--- /dev/null
+++ b/tests/tcg/mips/user/ase/msa/int-add/test_msa_addv_b.c
@@ -0,0 +1,151 @@
+/*
+ * Test program for MSA instruction ADDV.B
+ *
+ * Copyright (C) 2018 Wave Computing, Inc.
+ * Copyright (C) 2018 Aleksandar Markovic <amarkovic@wavecomp.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
+#include <sys/time.h>
+#include <stdint.h>
+
+#include "../../../../include/wrappers_msa.h"
+#include "../../../../include/test_inputs.h"
+#include "../../../../include/test_utils.h"
+
+#define TEST_COUNT_TOTAL ( \
+ (PATTERN_INPUTS_SHORT_COUNT) * (PATTERN_INPUTS_SHORT_COUNT) + \
+ (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT))
+
+
+int32_t main(void)
+{
+ char *instruction_name = "ADDV.B";
+ int32_t ret;
+ uint32_t i, j;
+ struct timeval start, end;
+ double elapsed_time;
+
+ uint64_t b128_result[TEST_COUNT_TOTAL][2];
+ uint64_t b128_expect[TEST_COUNT_TOTAL][2] = {
+ { 0xfefefefefefefefeULL, 0xfefefefefefefefeULL, }, /* 0 */
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xa9a9a9a9a9a9a9a9ULL, 0xa9a9a9a9a9a9a9a9ULL, },
+ { 0x5454545454545454ULL, 0x5454545454545454ULL, },
+ { 0xcbcbcbcbcbcbcbcbULL, 0xcbcbcbcbcbcbcbcbULL, },
+ { 0x3232323232323232ULL, 0x3232323232323232ULL, },
+ { 0xe28d37e28d37e28dULL, 0x37e28d37e28d37e2ULL, },
+ { 0x1b70c61b70c61b70ULL, 0xc61b70c61b70c61bULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 8 */
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, },
+ { 0x5555555555555555ULL, 0x5555555555555555ULL, },
+ { 0xccccccccccccccccULL, 0xccccccccccccccccULL, },
+ { 0x3333333333333333ULL, 0x3333333333333333ULL, },
+ { 0xe38e38e38e38e38eULL, 0x38e38e38e38e38e3ULL, },
+ { 0x1c71c71c71c71c71ULL, 0xc71c71c71c71c71cULL, },
+ { 0xa9a9a9a9a9a9a9a9ULL, 0xa9a9a9a9a9a9a9a9ULL, }, /* 16 */
+ { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, },
+ { 0x5454545454545454ULL, 0x5454545454545454ULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0x7676767676767676ULL, 0x7676767676767676ULL, },
+ { 0xddddddddddddddddULL, 0xddddddddddddddddULL, },
+ { 0x8d38e28d38e28d38ULL, 0xe28d38e28d38e28dULL, },
+ { 0xc61b71c61b71c61bULL, 0x71c61b71c61b71c6ULL, },
+ { 0x5454545454545454ULL, 0x5454545454545454ULL, }, /* 24 */
+ { 0x5555555555555555ULL, 0x5555555555555555ULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, },
+ { 0x2121212121212121ULL, 0x2121212121212121ULL, },
+ { 0x8888888888888888ULL, 0x8888888888888888ULL, },
+ { 0x38e38d38e38d38e3ULL, 0x8d38e38d38e38d38ULL, },
+ { 0x71c61c71c61c71c6ULL, 0x1c71c61c71c61c71ULL, },
+ { 0xcbcbcbcbcbcbcbcbULL, 0xcbcbcbcbcbcbcbcbULL, }, /* 32 */
+ { 0xccccccccccccccccULL, 0xccccccccccccccccULL, },
+ { 0x7676767676767676ULL, 0x7676767676767676ULL, },
+ { 0x2121212121212121ULL, 0x2121212121212121ULL, },
+ { 0x9898989898989898ULL, 0x9898989898989898ULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xaf5a04af5a04af5aULL, 0x04af5a04af5a04afULL, },
+ { 0xe83d93e83d93e83dULL, 0x93e83d93e83d93e8ULL, },
+ { 0x3232323232323232ULL, 0x3232323232323232ULL, }, /* 40 */
+ { 0x3333333333333333ULL, 0x3333333333333333ULL, },
+ { 0xddddddddddddddddULL, 0xddddddddddddddddULL, },
+ { 0x8888888888888888ULL, 0x8888888888888888ULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0x6666666666666666ULL, 0x6666666666666666ULL, },
+ { 0x16c16b16c16b16c1ULL, 0x6b16c16b16c16b16ULL, },
+ { 0x4fa4fa4fa4fa4fa4ULL, 0xfa4fa4fa4fa4fa4fULL, },
+ { 0xe28d37e28d37e28dULL, 0x37e28d37e28d37e2ULL, }, /* 48 */
+ { 0xe38e38e38e38e38eULL, 0x38e38e38e38e38e3ULL, },
+ { 0x8d38e28d38e28d38ULL, 0xe28d38e28d38e28dULL, },
+ { 0x38e38d38e38d38e3ULL, 0x8d38e38d38e38d38ULL, },
+ { 0xaf5a04af5a04af5aULL, 0x04af5a04af5a04afULL, },
+ { 0x16c16b16c16b16c1ULL, 0x6b16c16b16c16b16ULL, },
+ { 0xc61c70c61c70c61cULL, 0x70c61c70c61c70c6ULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0x1b70c61b70c61b70ULL, 0xc61b70c61b70c61bULL, }, /* 56 */
+ { 0x1c71c71c71c71c71ULL, 0xc71c71c71c71c71cULL, },
+ { 0xc61b71c61b71c61bULL, 0x71c61b71c61b71c6ULL, },
+ { 0x71c61c71c61c71c6ULL, 0x1c71c61c71c61c71ULL, },
+ { 0xe83d93e83d93e83dULL, 0x93e83d93e83d93e8ULL, },
+ { 0x4fa4fa4fa4fa4fa4ULL, 0xfa4fa4fa4fa4fa4fULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0x38e28e38e28e38e2ULL, 0x8e38e28e38e28e38ULL, },
+ { 0x10d4cc9850c4aa80ULL, 0x96ce16bcfcf66018ULL, }, /* 64 */
+ { 0x8328e62f75f51c48ULL, 0x5d5ec67813ba0208ULL, },
+ { 0x34c49476e131e0c0ULL, 0x723fd15da9a6d520ULL, },
+ { 0xf8b9fc198693378eULL, 0xd8589336a7bd92acULL, },
+ { 0x8328e62f75f51c48ULL, 0x5d5ec67813ba0208ULL, },
+ { 0xf67c00c69a268e10ULL, 0x24ee76342a7ea4f8ULL, },
+ { 0xa718ae0d06625288ULL, 0x39cf8119c06a7710ULL, },
+ { 0x6b0d16b0abc4a956ULL, 0x9fe843f2be81349cULL, },
+ { 0x34c49476e131e0c0ULL, 0x723fd15da9a6d520ULL, }, /* 72 */
+ { 0xa718ae0d06625288ULL, 0x39cf8119c06a7710ULL, },
+ { 0x58b45c54729e1600ULL, 0x4eb08cfe56564a28ULL, },
+ { 0x1ca9c4f717006dceULL, 0xb4c94ed7546d07b4ULL, },
+ { 0xf8b9fc198693378eULL, 0xd8589336a7bd92acULL, },
+ { 0x6b0d16b0abc4a956ULL, 0x9fe843f2be81349cULL, },
+};
+
+ gettimeofday(&start, NULL);
+
+ for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) {
+ do_msa_ADDV_B(b128_pattern[i], b128_pattern[j],
+ b128_result[PATTERN_INPUTS_SHORT_COUNT * i + j]);
+ }
+ }
+
+ for (i = 0; i < RANDOM_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < RANDOM_INPUTS_SHORT_COUNT; j++) {
+ do_msa_ADDV_B(b128_random[i], b128_random[j],
+ b128_result[((PATTERN_INPUTS_SHORT_COUNT) *
+ (PATTERN_INPUTS_SHORT_COUNT)) +
+ RANDOM_INPUTS_SHORT_COUNT * i + j]);
+ }
+ }
+
+ gettimeofday(&end, NULL);
+
+ elapsed_time = (end.tv_sec - start.tv_sec) * 1000.0;
+ elapsed_time += (end.tv_usec - start.tv_usec) / 1000.0;
+
+ ret = check_results(instruction_name, TEST_COUNT_TOTAL, elapsed_time,
+ &b128_result[0][0], &b128_expect[0][0]);
+
+ return ret;
+}
diff --git a/tests/tcg/mips/user/ase/msa/int-add/test_msa_addv_d.c b/tests/tcg/mips/user/ase/msa/int-add/test_msa_addv_d.c
new file mode 100644
index 0000000..858258b
--- /dev/null
+++ b/tests/tcg/mips/user/ase/msa/int-add/test_msa_addv_d.c
@@ -0,0 +1,151 @@
+/*
+ * Test program for MSA instruction ADDV.D
+ *
+ * Copyright (C) 2018 Wave Computing, Inc.
+ * Copyright (C) 2018 Aleksandar Markovic <amarkovic@wavecomp.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
+#include <sys/time.h>
+#include <stdint.h>
+
+#include "../../../../include/wrappers_msa.h"
+#include "../../../../include/test_inputs.h"
+#include "../../../../include/test_utils.h"
+
+#define TEST_COUNT_TOTAL ( \
+ (PATTERN_INPUTS_SHORT_COUNT) * (PATTERN_INPUTS_SHORT_COUNT) + \
+ (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT))
+
+
+int32_t main(void)
+{
+ char *instruction_name = "ADDV.D";
+ int32_t ret;
+ uint32_t i, j;
+ struct timeval start, end;
+ double elapsed_time;
+
+ uint64_t b128_result[TEST_COUNT_TOTAL][2];
+ uint64_t b128_expect[TEST_COUNT_TOTAL][2] = {
+ { 0xfffffffffffffffeULL, 0xfffffffffffffffeULL, }, /* 0 */
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xaaaaaaaaaaaaaaa9ULL, 0xaaaaaaaaaaaaaaa9ULL, },
+ { 0x5555555555555554ULL, 0x5555555555555554ULL, },
+ { 0xcccccccccccccccbULL, 0xcccccccccccccccbULL, },
+ { 0x3333333333333332ULL, 0x3333333333333332ULL, },
+ { 0xe38e38e38e38e38dULL, 0x38e38e38e38e38e2ULL, },
+ { 0x1c71c71c71c71c70ULL, 0xc71c71c71c71c71bULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 8 */
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, },
+ { 0x5555555555555555ULL, 0x5555555555555555ULL, },
+ { 0xccccccccccccccccULL, 0xccccccccccccccccULL, },
+ { 0x3333333333333333ULL, 0x3333333333333333ULL, },
+ { 0xe38e38e38e38e38eULL, 0x38e38e38e38e38e3ULL, },
+ { 0x1c71c71c71c71c71ULL, 0xc71c71c71c71c71cULL, },
+ { 0xaaaaaaaaaaaaaaa9ULL, 0xaaaaaaaaaaaaaaa9ULL, }, /* 16 */
+ { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, },
+ { 0x5555555555555554ULL, 0x5555555555555554ULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0x7777777777777776ULL, 0x7777777777777776ULL, },
+ { 0xddddddddddddddddULL, 0xddddddddddddddddULL, },
+ { 0x8e38e38e38e38e38ULL, 0xe38e38e38e38e38dULL, },
+ { 0xc71c71c71c71c71bULL, 0x71c71c71c71c71c6ULL, },
+ { 0x5555555555555554ULL, 0x5555555555555554ULL, }, /* 24 */
+ { 0x5555555555555555ULL, 0x5555555555555555ULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, },
+ { 0x2222222222222221ULL, 0x2222222222222221ULL, },
+ { 0x8888888888888888ULL, 0x8888888888888888ULL, },
+ { 0x38e38e38e38e38e3ULL, 0x8e38e38e38e38e38ULL, },
+ { 0x71c71c71c71c71c6ULL, 0x1c71c71c71c71c71ULL, },
+ { 0xcccccccccccccccbULL, 0xcccccccccccccccbULL, }, /* 32 */
+ { 0xccccccccccccccccULL, 0xccccccccccccccccULL, },
+ { 0x7777777777777776ULL, 0x7777777777777776ULL, },
+ { 0x2222222222222221ULL, 0x2222222222222221ULL, },
+ { 0x9999999999999998ULL, 0x9999999999999998ULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xb05b05b05b05b05aULL, 0x05b05b05b05b05afULL, },
+ { 0xe93e93e93e93e93dULL, 0x93e93e93e93e93e8ULL, },
+ { 0x3333333333333332ULL, 0x3333333333333332ULL, }, /* 40 */
+ { 0x3333333333333333ULL, 0x3333333333333333ULL, },
+ { 0xddddddddddddddddULL, 0xddddddddddddddddULL, },
+ { 0x8888888888888888ULL, 0x8888888888888888ULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0x6666666666666666ULL, 0x6666666666666666ULL, },
+ { 0x16c16c16c16c16c1ULL, 0x6c16c16c16c16c16ULL, },
+ { 0x4fa4fa4fa4fa4fa4ULL, 0xfa4fa4fa4fa4fa4fULL, },
+ { 0xe38e38e38e38e38dULL, 0x38e38e38e38e38e2ULL, }, /* 48 */
+ { 0xe38e38e38e38e38eULL, 0x38e38e38e38e38e3ULL, },
+ { 0x8e38e38e38e38e38ULL, 0xe38e38e38e38e38dULL, },
+ { 0x38e38e38e38e38e3ULL, 0x8e38e38e38e38e38ULL, },
+ { 0xb05b05b05b05b05aULL, 0x05b05b05b05b05afULL, },
+ { 0x16c16c16c16c16c1ULL, 0x6c16c16c16c16c16ULL, },
+ { 0xc71c71c71c71c71cULL, 0x71c71c71c71c71c6ULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0x1c71c71c71c71c70ULL, 0xc71c71c71c71c71bULL, }, /* 56 */
+ { 0x1c71c71c71c71c71ULL, 0xc71c71c71c71c71cULL, },
+ { 0xc71c71c71c71c71bULL, 0x71c71c71c71c71c6ULL, },
+ { 0x71c71c71c71c71c6ULL, 0x1c71c71c71c71c71ULL, },
+ { 0xe93e93e93e93e93dULL, 0x93e93e93e93e93e8ULL, },
+ { 0x4fa4fa4fa4fa4fa4ULL, 0xfa4fa4fa4fa4fa4fULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0x38e38e38e38e38e2ULL, 0x8e38e38e38e38e38ULL, },
+ { 0x10d5cd9850c4aa80ULL, 0x96ce16bdfcf76018ULL, }, /* 64 */
+ { 0x8428e72f75f61c48ULL, 0x5e5ec67913bb0308ULL, },
+ { 0x34c59576e231e0c0ULL, 0x733fd25ea9a6d520ULL, },
+ { 0xf8b9fd198694378eULL, 0xd9589437a7be92acULL, },
+ { 0x8428e72f75f61c48ULL, 0x5e5ec67913bb0308ULL, },
+ { 0xf77c00c69b278e10ULL, 0x25ef76342a7ea5f8ULL, },
+ { 0xa818af0e07635288ULL, 0x3ad08219c06a7810ULL, },
+ { 0x6c0d16b0abc5a956ULL, 0xa0e943f2be82359cULL, },
+ { 0x34c59576e231e0c0ULL, 0x733fd25ea9a6d520ULL, }, /* 72 */
+ { 0xa818af0e07635288ULL, 0x3ad08219c06a7810ULL, },
+ { 0x58b55d55739f1700ULL, 0x4fb18dff56564a28ULL, },
+ { 0x1ca9c4f818016dceULL, 0xb5ca4fd8546e07b4ULL, },
+ { 0xf8b9fd198694378eULL, 0xd9589437a7be92acULL, },
+ { 0x6c0d16b0abc5a956ULL, 0xa0e943f2be82359cULL, },
+};
+
+ gettimeofday(&start, NULL);
+
+ for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) {
+ do_msa_ADDV_D(b128_pattern[i], b128_pattern[j],
+ b128_result[PATTERN_INPUTS_SHORT_COUNT * i + j]);
+ }
+ }
+
+ for (i = 0; i < RANDOM_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < RANDOM_INPUTS_SHORT_COUNT; j++) {
+ do_msa_ADDV_D(b128_random[i], b128_random[j],
+ b128_result[((PATTERN_INPUTS_SHORT_COUNT) *
+ (PATTERN_INPUTS_SHORT_COUNT)) +
+ RANDOM_INPUTS_SHORT_COUNT * i + j]);
+ }
+ }
+
+ gettimeofday(&end, NULL);
+
+ elapsed_time = (end.tv_sec - start.tv_sec) * 1000.0;
+ elapsed_time += (end.tv_usec - start.tv_usec) / 1000.0;
+
+ ret = check_results(instruction_name, TEST_COUNT_TOTAL, elapsed_time,
+ &b128_result[0][0], &b128_expect[0][0]);
+
+ return ret;
+}
diff --git a/tests/tcg/mips/user/ase/msa/int-add/test_msa_addv_h.c b/tests/tcg/mips/user/ase/msa/int-add/test_msa_addv_h.c
new file mode 100644
index 0000000..5daf7fc
--- /dev/null
+++ b/tests/tcg/mips/user/ase/msa/int-add/test_msa_addv_h.c
@@ -0,0 +1,151 @@
+/*
+ * Test program for MSA instruction ADDV.H
+ *
+ * Copyright (C) 2018 Wave Computing, Inc.
+ * Copyright (C) 2018 Aleksandar Markovic <amarkovic@wavecomp.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
+#include <sys/time.h>
+#include <stdint.h>
+
+#include "../../../../include/wrappers_msa.h"
+#include "../../../../include/test_inputs.h"
+#include "../../../../include/test_utils.h"
+
+#define TEST_COUNT_TOTAL ( \
+ (PATTERN_INPUTS_SHORT_COUNT) * (PATTERN_INPUTS_SHORT_COUNT) + \
+ (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT))
+
+
+int32_t main(void)
+{
+ char *instruction_name = "ADDV.H";
+ int32_t ret;
+ uint32_t i, j;
+ struct timeval start, end;
+ double elapsed_time;
+
+ uint64_t b128_result[TEST_COUNT_TOTAL][2];
+ uint64_t b128_expect[TEST_COUNT_TOTAL][2] = {
+ { 0xfffefffefffefffeULL, 0xfffefffefffefffeULL, }, /* 0 */
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xaaa9aaa9aaa9aaa9ULL, 0xaaa9aaa9aaa9aaa9ULL, },
+ { 0x5554555455545554ULL, 0x5554555455545554ULL, },
+ { 0xcccbcccbcccbcccbULL, 0xcccbcccbcccbcccbULL, },
+ { 0x3332333233323332ULL, 0x3332333233323332ULL, },
+ { 0xe38d38e28e37e38dULL, 0x38e28e37e38d38e2ULL, },
+ { 0x1c70c71b71c61c70ULL, 0xc71b71c61c70c71bULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 8 */
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, },
+ { 0x5555555555555555ULL, 0x5555555555555555ULL, },
+ { 0xccccccccccccccccULL, 0xccccccccccccccccULL, },
+ { 0x3333333333333333ULL, 0x3333333333333333ULL, },
+ { 0xe38e38e38e38e38eULL, 0x38e38e38e38e38e3ULL, },
+ { 0x1c71c71c71c71c71ULL, 0xc71c71c71c71c71cULL, },
+ { 0xaaa9aaa9aaa9aaa9ULL, 0xaaa9aaa9aaa9aaa9ULL, }, /* 16 */
+ { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, },
+ { 0x5554555455545554ULL, 0x5554555455545554ULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0x7776777677767776ULL, 0x7776777677767776ULL, },
+ { 0xddddddddddddddddULL, 0xddddddddddddddddULL, },
+ { 0x8e38e38d38e28e38ULL, 0xe38d38e28e38e38dULL, },
+ { 0xc71b71c61c71c71bULL, 0x71c61c71c71b71c6ULL, },
+ { 0x5554555455545554ULL, 0x5554555455545554ULL, }, /* 24 */
+ { 0x5555555555555555ULL, 0x5555555555555555ULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, },
+ { 0x2221222122212221ULL, 0x2221222122212221ULL, },
+ { 0x8888888888888888ULL, 0x8888888888888888ULL, },
+ { 0x38e38e38e38d38e3ULL, 0x8e38e38d38e38e38ULL, },
+ { 0x71c61c71c71c71c6ULL, 0x1c71c71c71c61c71ULL, },
+ { 0xcccbcccbcccbcccbULL, 0xcccbcccbcccbcccbULL, }, /* 32 */
+ { 0xccccccccccccccccULL, 0xccccccccccccccccULL, },
+ { 0x7776777677767776ULL, 0x7776777677767776ULL, },
+ { 0x2221222122212221ULL, 0x2221222122212221ULL, },
+ { 0x9998999899989998ULL, 0x9998999899989998ULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xb05a05af5b04b05aULL, 0x05af5b04b05a05afULL, },
+ { 0xe93d93e83e93e93dULL, 0x93e83e93e93d93e8ULL, },
+ { 0x3332333233323332ULL, 0x3332333233323332ULL, }, /* 40 */
+ { 0x3333333333333333ULL, 0x3333333333333333ULL, },
+ { 0xddddddddddddddddULL, 0xddddddddddddddddULL, },
+ { 0x8888888888888888ULL, 0x8888888888888888ULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0x6666666666666666ULL, 0x6666666666666666ULL, },
+ { 0x16c16c16c16b16c1ULL, 0x6c16c16b16c16c16ULL, },
+ { 0x4fa4fa4fa4fa4fa4ULL, 0xfa4fa4fa4fa4fa4fULL, },
+ { 0xe38d38e28e37e38dULL, 0x38e28e37e38d38e2ULL, }, /* 48 */
+ { 0xe38e38e38e38e38eULL, 0x38e38e38e38e38e3ULL, },
+ { 0x8e38e38d38e28e38ULL, 0xe38d38e28e38e38dULL, },
+ { 0x38e38e38e38d38e3ULL, 0x8e38e38d38e38e38ULL, },
+ { 0xb05a05af5b04b05aULL, 0x05af5b04b05a05afULL, },
+ { 0x16c16c16c16b16c1ULL, 0x6c16c16b16c16c16ULL, },
+ { 0xc71c71c61c70c71cULL, 0x71c61c70c71c71c6ULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0x1c70c71b71c61c70ULL, 0xc71b71c61c70c71bULL, }, /* 56 */
+ { 0x1c71c71c71c71c71ULL, 0xc71c71c71c71c71cULL, },
+ { 0xc71b71c61c71c71bULL, 0x71c61c71c71b71c6ULL, },
+ { 0x71c61c71c71c71c6ULL, 0x1c71c71c71c61c71ULL, },
+ { 0xe93d93e83e93e93dULL, 0x93e83e93e93d93e8ULL, },
+ { 0x4fa4fa4fa4fa4fa4ULL, 0xfa4fa4fa4fa4fa4fULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0x38e28e38e38e38e2ULL, 0x8e38e38e38e28e38ULL, },
+ { 0x10d4cd9850c4aa80ULL, 0x96ce16bcfcf66018ULL, }, /* 64 */
+ { 0x8428e72f75f51c48ULL, 0x5e5ec67813ba0308ULL, },
+ { 0x34c49576e231e0c0ULL, 0x733fd25da9a6d520ULL, },
+ { 0xf8b9fd198693378eULL, 0xd9589436a7bd92acULL, },
+ { 0x8428e72f75f51c48ULL, 0x5e5ec67813ba0308ULL, },
+ { 0xf77c00c69b268e10ULL, 0x25ee76342a7ea5f8ULL, },
+ { 0xa818af0d07625288ULL, 0x3acf8219c06a7810ULL, },
+ { 0x6c0d16b0abc4a956ULL, 0xa0e843f2be81359cULL, },
+ { 0x34c49576e231e0c0ULL, 0x733fd25da9a6d520ULL, }, /* 72 */
+ { 0xa818af0d07625288ULL, 0x3acf8219c06a7810ULL, },
+ { 0x58b45d54739e1700ULL, 0x4fb08dfe56564a28ULL, },
+ { 0x1ca9c4f718006dceULL, 0xb5c94fd7546d07b4ULL, },
+ { 0xf8b9fd198693378eULL, 0xd9589436a7bd92acULL, },
+ { 0x6c0d16b0abc4a956ULL, 0xa0e843f2be81359cULL, },
+};
+
+ gettimeofday(&start, NULL);
+
+ for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) {
+ do_msa_ADDV_H(b128_pattern[i], b128_pattern[j],
+ b128_result[PATTERN_INPUTS_SHORT_COUNT * i + j]);
+ }
+ }
+
+ for (i = 0; i < RANDOM_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < RANDOM_INPUTS_SHORT_COUNT; j++) {
+ do_msa_ADDV_H(b128_random[i], b128_random[j],
+ b128_result[((PATTERN_INPUTS_SHORT_COUNT) *
+ (PATTERN_INPUTS_SHORT_COUNT)) +
+ RANDOM_INPUTS_SHORT_COUNT * i + j]);
+ }
+ }
+
+ gettimeofday(&end, NULL);
+
+ elapsed_time = (end.tv_sec - start.tv_sec) * 1000.0;
+ elapsed_time += (end.tv_usec - start.tv_usec) / 1000.0;
+
+ ret = check_results(instruction_name, TEST_COUNT_TOTAL, elapsed_time,
+ &b128_result[0][0], &b128_expect[0][0]);
+
+ return ret;
+}
diff --git a/tests/tcg/mips/user/ase/msa/int-add/test_msa_addv_w.c b/tests/tcg/mips/user/ase/msa/int-add/test_msa_addv_w.c
new file mode 100644
index 0000000..b1e42ec
--- /dev/null
+++ b/tests/tcg/mips/user/ase/msa/int-add/test_msa_addv_w.c
@@ -0,0 +1,151 @@
+/*
+ * Test program for MSA instruction ADDV.W
+ *
+ * Copyright (C) 2018 Wave Computing, Inc.
+ * Copyright (C) 2018 Aleksandar Markovic <amarkovic@wavecomp.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
+#include <sys/time.h>
+#include <stdint.h>
+
+#include "../../../../include/wrappers_msa.h"
+#include "../../../../include/test_inputs.h"
+#include "../../../../include/test_utils.h"
+
+#define TEST_COUNT_TOTAL ( \
+ (PATTERN_INPUTS_SHORT_COUNT) * (PATTERN_INPUTS_SHORT_COUNT) + \
+ (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT))
+
+
+int32_t main(void)
+{
+ char *instruction_name = "ADDV.W";
+ int32_t ret;
+ uint32_t i, j;
+ struct timeval start, end;
+ double elapsed_time;
+
+ uint64_t b128_result[TEST_COUNT_TOTAL][2];
+ uint64_t b128_expect[TEST_COUNT_TOTAL][2] = {
+ { 0xfffffffefffffffeULL, 0xfffffffefffffffeULL, }, /* 0 */
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xaaaaaaa9aaaaaaa9ULL, 0xaaaaaaa9aaaaaaa9ULL, },
+ { 0x5555555455555554ULL, 0x5555555455555554ULL, },
+ { 0xcccccccbcccccccbULL, 0xcccccccbcccccccbULL, },
+ { 0x3333333233333332ULL, 0x3333333233333332ULL, },
+ { 0xe38e38e28e38e38dULL, 0x38e38e37e38e38e2ULL, },
+ { 0x1c71c71b71c71c70ULL, 0xc71c71c61c71c71bULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 8 */
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, },
+ { 0x5555555555555555ULL, 0x5555555555555555ULL, },
+ { 0xccccccccccccccccULL, 0xccccccccccccccccULL, },
+ { 0x3333333333333333ULL, 0x3333333333333333ULL, },
+ { 0xe38e38e38e38e38eULL, 0x38e38e38e38e38e3ULL, },
+ { 0x1c71c71c71c71c71ULL, 0xc71c71c71c71c71cULL, },
+ { 0xaaaaaaa9aaaaaaa9ULL, 0xaaaaaaa9aaaaaaa9ULL, }, /* 16 */
+ { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, },
+ { 0x5555555455555554ULL, 0x5555555455555554ULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0x7777777677777776ULL, 0x7777777677777776ULL, },
+ { 0xddddddddddddddddULL, 0xddddddddddddddddULL, },
+ { 0x8e38e38d38e38e38ULL, 0xe38e38e28e38e38dULL, },
+ { 0xc71c71c61c71c71bULL, 0x71c71c71c71c71c6ULL, },
+ { 0x5555555455555554ULL, 0x5555555455555554ULL, }, /* 24 */
+ { 0x5555555555555555ULL, 0x5555555555555555ULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, },
+ { 0x2222222122222221ULL, 0x2222222122222221ULL, },
+ { 0x8888888888888888ULL, 0x8888888888888888ULL, },
+ { 0x38e38e38e38e38e3ULL, 0x8e38e38d38e38e38ULL, },
+ { 0x71c71c71c71c71c6ULL, 0x1c71c71c71c71c71ULL, },
+ { 0xcccccccbcccccccbULL, 0xcccccccbcccccccbULL, }, /* 32 */
+ { 0xccccccccccccccccULL, 0xccccccccccccccccULL, },
+ { 0x7777777677777776ULL, 0x7777777677777776ULL, },
+ { 0x2222222122222221ULL, 0x2222222122222221ULL, },
+ { 0x9999999899999998ULL, 0x9999999899999998ULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xb05b05af5b05b05aULL, 0x05b05b04b05b05afULL, },
+ { 0xe93e93e83e93e93dULL, 0x93e93e93e93e93e8ULL, },
+ { 0x3333333233333332ULL, 0x3333333233333332ULL, }, /* 40 */
+ { 0x3333333333333333ULL, 0x3333333333333333ULL, },
+ { 0xddddddddddddddddULL, 0xddddddddddddddddULL, },
+ { 0x8888888888888888ULL, 0x8888888888888888ULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0x6666666666666666ULL, 0x6666666666666666ULL, },
+ { 0x16c16c16c16c16c1ULL, 0x6c16c16b16c16c16ULL, },
+ { 0x4fa4fa4fa4fa4fa4ULL, 0xfa4fa4fa4fa4fa4fULL, },
+ { 0xe38e38e28e38e38dULL, 0x38e38e37e38e38e2ULL, }, /* 48 */
+ { 0xe38e38e38e38e38eULL, 0x38e38e38e38e38e3ULL, },
+ { 0x8e38e38d38e38e38ULL, 0xe38e38e28e38e38dULL, },
+ { 0x38e38e38e38e38e3ULL, 0x8e38e38d38e38e38ULL, },
+ { 0xb05b05af5b05b05aULL, 0x05b05b04b05b05afULL, },
+ { 0x16c16c16c16c16c1ULL, 0x6c16c16b16c16c16ULL, },
+ { 0xc71c71c61c71c71cULL, 0x71c71c70c71c71c6ULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0x1c71c71b71c71c70ULL, 0xc71c71c61c71c71bULL, }, /* 56 */
+ { 0x1c71c71c71c71c71ULL, 0xc71c71c71c71c71cULL, },
+ { 0xc71c71c61c71c71bULL, 0x71c71c71c71c71c6ULL, },
+ { 0x71c71c71c71c71c6ULL, 0x1c71c71c71c71c71ULL, },
+ { 0xe93e93e83e93e93dULL, 0x93e93e93e93e93e8ULL, },
+ { 0x4fa4fa4fa4fa4fa4ULL, 0xfa4fa4fa4fa4fa4fULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0x38e38e38e38e38e2ULL, 0x8e38e38e38e38e38ULL, },
+ { 0x10d5cd9850c4aa80ULL, 0x96ce16bcfcf76018ULL, }, /* 64 */
+ { 0x8428e72f75f61c48ULL, 0x5e5ec67813bb0308ULL, },
+ { 0x34c59576e231e0c0ULL, 0x733fd25da9a6d520ULL, },
+ { 0xf8b9fd198694378eULL, 0xd9589436a7be92acULL, },
+ { 0x8428e72f75f61c48ULL, 0x5e5ec67813bb0308ULL, },
+ { 0xf77c00c69b278e10ULL, 0x25ef76342a7ea5f8ULL, },
+ { 0xa818af0d07635288ULL, 0x3ad08219c06a7810ULL, },
+ { 0x6c0d16b0abc5a956ULL, 0xa0e943f2be82359cULL, },
+ { 0x34c59576e231e0c0ULL, 0x733fd25da9a6d520ULL, }, /* 72 */
+ { 0xa818af0d07635288ULL, 0x3ad08219c06a7810ULL, },
+ { 0x58b55d54739f1700ULL, 0x4fb18dfe56564a28ULL, },
+ { 0x1ca9c4f718016dceULL, 0xb5ca4fd7546e07b4ULL, },
+ { 0xf8b9fd198694378eULL, 0xd9589436a7be92acULL, },
+ { 0x6c0d16b0abc5a956ULL, 0xa0e943f2be82359cULL, },
+};
+
+ gettimeofday(&start, NULL);
+
+ for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) {
+ do_msa_ADDV_W(b128_pattern[i], b128_pattern[j],
+ b128_result[PATTERN_INPUTS_SHORT_COUNT * i + j]);
+ }
+ }
+
+ for (i = 0; i < RANDOM_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < RANDOM_INPUTS_SHORT_COUNT; j++) {
+ do_msa_ADDV_W(b128_random[i], b128_random[j],
+ b128_result[((PATTERN_INPUTS_SHORT_COUNT) *
+ (PATTERN_INPUTS_SHORT_COUNT)) +
+ RANDOM_INPUTS_SHORT_COUNT * i + j]);
+ }
+ }
+
+ gettimeofday(&end, NULL);
+
+ elapsed_time = (end.tv_sec - start.tv_sec) * 1000.0;
+ elapsed_time += (end.tv_usec - start.tv_usec) / 1000.0;
+
+ ret = check_results(instruction_name, TEST_COUNT_TOTAL, elapsed_time,
+ &b128_result[0][0], &b128_expect[0][0]);
+
+ return ret;
+}
diff --git a/tests/tcg/mips/user/ase/msa/int-add/test_msa_hadd_s_d.c b/tests/tcg/mips/user/ase/msa/int-add/test_msa_hadd_s_d.c
new file mode 100644
index 0000000..5a923d6
--- /dev/null
+++ b/tests/tcg/mips/user/ase/msa/int-add/test_msa_hadd_s_d.c
@@ -0,0 +1,151 @@
+/*
+ * Test program for MSA instruction HADD_S.D
+ *
+ * Copyright (C) 2018 Wave Computing, Inc.
+ * Copyright (C) 2018 Aleksandar Markovic <amarkovic@wavecomp.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
+#include <sys/time.h>
+#include <stdint.h>
+
+#include "../../../../include/wrappers_msa.h"
+#include "../../../../include/test_inputs.h"
+#include "../../../../include/test_utils.h"
+
+#define TEST_COUNT_TOTAL ( \
+ (PATTERN_INPUTS_SHORT_COUNT) * (PATTERN_INPUTS_SHORT_COUNT) + \
+ (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT))
+
+
+int32_t main(void)
+{
+ char *instruction_name = "HADD_S.D";
+ int32_t ret;
+ uint32_t i, j;
+ struct timeval start, end;
+ double elapsed_time;
+
+ uint64_t b128_result[TEST_COUNT_TOTAL][2];
+ uint64_t b128_expect[TEST_COUNT_TOTAL][2] = {
+ { 0xfffffffffffffffeULL, 0xfffffffffffffffeULL, }, /* 0 */
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xffffffffaaaaaaa9ULL, 0xffffffffaaaaaaa9ULL, },
+ { 0x0000000055555554ULL, 0x0000000055555554ULL, },
+ { 0xffffffffcccccccbULL, 0xffffffffcccccccbULL, },
+ { 0x0000000033333332ULL, 0x0000000033333332ULL, },
+ { 0xffffffff8e38e38dULL, 0xffffffffe38e38e2ULL, },
+ { 0x0000000071c71c70ULL, 0x000000001c71c71bULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 8 */
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0xffffffffaaaaaaaaULL, 0xffffffffaaaaaaaaULL, },
+ { 0x0000000055555555ULL, 0x0000000055555555ULL, },
+ { 0xffffffffccccccccULL, 0xffffffffccccccccULL, },
+ { 0x0000000033333333ULL, 0x0000000033333333ULL, },
+ { 0xffffffff8e38e38eULL, 0xffffffffe38e38e3ULL, },
+ { 0x0000000071c71c71ULL, 0x000000001c71c71cULL, },
+ { 0xffffffffaaaaaaa9ULL, 0xffffffffaaaaaaa9ULL, }, /* 16 */
+ { 0xffffffffaaaaaaaaULL, 0xffffffffaaaaaaaaULL, },
+ { 0xffffffff55555554ULL, 0xffffffff55555554ULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xffffffff77777776ULL, 0xffffffff77777776ULL, },
+ { 0xffffffffddddddddULL, 0xffffffffddddddddULL, },
+ { 0xffffffff38e38e38ULL, 0xffffffff8e38e38dULL, },
+ { 0x000000001c71c71bULL, 0xffffffffc71c71c6ULL, },
+ { 0x0000000055555554ULL, 0x0000000055555554ULL, }, /* 24 */
+ { 0x0000000055555555ULL, 0x0000000055555555ULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0x00000000aaaaaaaaULL, 0x00000000aaaaaaaaULL, },
+ { 0x0000000022222221ULL, 0x0000000022222221ULL, },
+ { 0x0000000088888888ULL, 0x0000000088888888ULL, },
+ { 0xffffffffe38e38e3ULL, 0x0000000038e38e38ULL, },
+ { 0x00000000c71c71c6ULL, 0x0000000071c71c71ULL, },
+ { 0xffffffffcccccccbULL, 0xffffffffcccccccbULL, }, /* 32 */
+ { 0xffffffffccccccccULL, 0xffffffffccccccccULL, },
+ { 0xffffffff77777776ULL, 0xffffffff77777776ULL, },
+ { 0x0000000022222221ULL, 0x0000000022222221ULL, },
+ { 0xffffffff99999998ULL, 0xffffffff99999998ULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xffffffff5b05b05aULL, 0xffffffffb05b05afULL, },
+ { 0x000000003e93e93dULL, 0xffffffffe93e93e8ULL, },
+ { 0x0000000033333332ULL, 0x0000000033333332ULL, }, /* 40 */
+ { 0x0000000033333333ULL, 0x0000000033333333ULL, },
+ { 0xffffffffddddddddULL, 0xffffffffddddddddULL, },
+ { 0x0000000088888888ULL, 0x0000000088888888ULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0x0000000066666666ULL, 0x0000000066666666ULL, },
+ { 0xffffffffc16c16c1ULL, 0x0000000016c16c16ULL, },
+ { 0x00000000a4fa4fa4ULL, 0x000000004fa4fa4fULL, },
+ { 0xffffffffe38e38e2ULL, 0x0000000038e38e37ULL, }, /* 48 */
+ { 0xffffffffe38e38e3ULL, 0x0000000038e38e38ULL, },
+ { 0xffffffff8e38e38dULL, 0xffffffffe38e38e2ULL, },
+ { 0x0000000038e38e38ULL, 0x000000008e38e38dULL, },
+ { 0xffffffffb05b05afULL, 0x0000000005b05b04ULL, },
+ { 0x0000000016c16c16ULL, 0x000000006c16c16bULL, },
+ { 0xffffffff71c71c71ULL, 0x000000001c71c71bULL, },
+ { 0x0000000055555554ULL, 0x0000000055555554ULL, },
+ { 0x000000001c71c71bULL, 0xffffffffc71c71c6ULL, }, /* 56 */
+ { 0x000000001c71c71cULL, 0xffffffffc71c71c7ULL, },
+ { 0xffffffffc71c71c6ULL, 0xffffffff71c71c71ULL, },
+ { 0x0000000071c71c71ULL, 0x000000001c71c71cULL, },
+ { 0xffffffffe93e93e8ULL, 0xffffffff93e93e93ULL, },
+ { 0x000000004fa4fa4fULL, 0xfffffffffa4fa4faULL, },
+ { 0xffffffffaaaaaaaaULL, 0xffffffffaaaaaaaaULL, },
+ { 0x000000008e38e38dULL, 0xffffffffe38e38e3ULL, },
+ { 0xffffffffb0cd3c0cULL, 0x0000000049e2bb6aULL, }, /* 64 */
+ { 0xffffffffd5feadd4ULL, 0x0000000060a65e5aULL, },
+ { 0xffffffff423a724cULL, 0xfffffffff6923072ULL, },
+ { 0xffffffffe69cc91aULL, 0xfffffffff4a9edfeULL, },
+ { 0x00000000242055a3ULL, 0x0000000011736b26ULL, },
+ { 0x000000004951c76bULL, 0x0000000028370e16ULL, },
+ { 0xffffffffb58d8be3ULL, 0xffffffffbe22e02eULL, },
+ { 0x0000000059efe2b1ULL, 0xffffffffbc3a9dbaULL, },
+ { 0xffffffffd4bd03eaULL, 0x000000002654770bULL, }, /* 72 */
+ { 0xfffffffff9ee75b2ULL, 0x000000003d1819fbULL, },
+ { 0xffffffff662a3a2aULL, 0xffffffffd303ec13ULL, },
+ { 0x000000000a8c90f8ULL, 0xffffffffd11ba99fULL, },
+ { 0x0000000098b16b8dULL, 0xffffffff8c6d38e4ULL, },
+ { 0x00000000bde2dd55ULL, 0xffffffffa330dbd4ULL, },
+};
+
+ gettimeofday(&start, NULL);
+
+ for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) {
+ do_msa_HADD_S_D(b128_pattern[i], b128_pattern[j],
+ b128_result[PATTERN_INPUTS_SHORT_COUNT * i + j]);
+ }
+ }
+
+ for (i = 0; i < RANDOM_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < RANDOM_INPUTS_SHORT_COUNT; j++) {
+ do_msa_HADD_S_D(b128_random[i], b128_random[j],
+ b128_result[((PATTERN_INPUTS_SHORT_COUNT) *
+ (PATTERN_INPUTS_SHORT_COUNT)) +
+ RANDOM_INPUTS_SHORT_COUNT * i + j]);
+ }
+ }
+
+ gettimeofday(&end, NULL);
+
+ elapsed_time = (end.tv_sec - start.tv_sec) * 1000.0;
+ elapsed_time += (end.tv_usec - start.tv_usec) / 1000.0;
+
+ ret = check_results(instruction_name, TEST_COUNT_TOTAL, elapsed_time,
+ &b128_result[0][0], &b128_expect[0][0]);
+
+ return ret;
+}
diff --git a/tests/tcg/mips/user/ase/msa/int-add/test_msa_hadd_s_h.c b/tests/tcg/mips/user/ase/msa/int-add/test_msa_hadd_s_h.c
new file mode 100644
index 0000000..4b14853
--- /dev/null
+++ b/tests/tcg/mips/user/ase/msa/int-add/test_msa_hadd_s_h.c
@@ -0,0 +1,151 @@
+/*
+ * Test program for MSA instruction HADD_S.H
+ *
+ * Copyright (C) 2018 Wave Computing, Inc.
+ * Copyright (C) 2018 Aleksandar Markovic <amarkovic@wavecomp.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
+#include <sys/time.h>
+#include <stdint.h>
+
+#include "../../../../include/wrappers_msa.h"
+#include "../../../../include/test_inputs.h"
+#include "../../../../include/test_utils.h"
+
+#define TEST_COUNT_TOTAL ( \
+ (PATTERN_INPUTS_SHORT_COUNT) * (PATTERN_INPUTS_SHORT_COUNT) + \
+ (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT))
+
+
+int32_t main(void)
+{
+ char *instruction_name = "HADD_S.H";
+ int32_t ret;
+ uint32_t i, j;
+ struct timeval start, end;
+ double elapsed_time;
+
+ uint64_t b128_result[TEST_COUNT_TOTAL][2];
+ uint64_t b128_expect[TEST_COUNT_TOTAL][2] = {
+ { 0xfffefffefffefffeULL, 0xfffefffefffefffeULL, }, /* 0 */
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xffa9ffa9ffa9ffa9ULL, 0xffa9ffa9ffa9ffa9ULL, },
+ { 0x0054005400540054ULL, 0x0054005400540054ULL, },
+ { 0xffcbffcbffcbffcbULL, 0xffcbffcbffcbffcbULL, },
+ { 0x0032003200320032ULL, 0x0032003200320032ULL, },
+ { 0xff8dffe20037ff8dULL, 0xffe20037ff8dffe2ULL, },
+ { 0x0070001bffc60070ULL, 0x001bffc60070001bULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 8 */
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0xffaaffaaffaaffaaULL, 0xffaaffaaffaaffaaULL, },
+ { 0x0055005500550055ULL, 0x0055005500550055ULL, },
+ { 0xffccffccffccffccULL, 0xffccffccffccffccULL, },
+ { 0x0033003300330033ULL, 0x0033003300330033ULL, },
+ { 0xff8effe30038ff8eULL, 0xffe30038ff8effe3ULL, },
+ { 0x0071001cffc70071ULL, 0x001cffc70071001cULL, },
+ { 0xffa9ffa9ffa9ffa9ULL, 0xffa9ffa9ffa9ffa9ULL, }, /* 16 */
+ { 0xffaaffaaffaaffaaULL, 0xffaaffaaffaaffaaULL, },
+ { 0xff54ff54ff54ff54ULL, 0xff54ff54ff54ff54ULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xff76ff76ff76ff76ULL, 0xff76ff76ff76ff76ULL, },
+ { 0xffddffddffddffddULL, 0xffddffddffddffddULL, },
+ { 0xff38ff8dffe2ff38ULL, 0xff8dffe2ff38ff8dULL, },
+ { 0x001bffc6ff71001bULL, 0xffc6ff71001bffc6ULL, },
+ { 0x0054005400540054ULL, 0x0054005400540054ULL, }, /* 24 */
+ { 0x0055005500550055ULL, 0x0055005500550055ULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0x00aa00aa00aa00aaULL, 0x00aa00aa00aa00aaULL, },
+ { 0x0021002100210021ULL, 0x0021002100210021ULL, },
+ { 0x0088008800880088ULL, 0x0088008800880088ULL, },
+ { 0xffe30038008dffe3ULL, 0x0038008dffe30038ULL, },
+ { 0x00c60071001c00c6ULL, 0x0071001c00c60071ULL, },
+ { 0xffcbffcbffcbffcbULL, 0xffcbffcbffcbffcbULL, }, /* 32 */
+ { 0xffccffccffccffccULL, 0xffccffccffccffccULL, },
+ { 0xff76ff76ff76ff76ULL, 0xff76ff76ff76ff76ULL, },
+ { 0x0021002100210021ULL, 0x0021002100210021ULL, },
+ { 0xff98ff98ff98ff98ULL, 0xff98ff98ff98ff98ULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xff5affaf0004ff5aULL, 0xffaf0004ff5affafULL, },
+ { 0x003dffe8ff93003dULL, 0xffe8ff93003dffe8ULL, },
+ { 0x0032003200320032ULL, 0x0032003200320032ULL, }, /* 40 */
+ { 0x0033003300330033ULL, 0x0033003300330033ULL, },
+ { 0xffddffddffddffddULL, 0xffddffddffddffddULL, },
+ { 0x0088008800880088ULL, 0x0088008800880088ULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0x0066006600660066ULL, 0x0066006600660066ULL, },
+ { 0xffc10016006bffc1ULL, 0x0016006bffc10016ULL, },
+ { 0x00a4004ffffa00a4ULL, 0x004ffffa00a4004fULL, },
+ { 0xffe20037ff8dffe2ULL, 0x0037ff8dffe20037ULL, }, /* 48 */
+ { 0xffe30038ff8effe3ULL, 0x0038ff8effe30038ULL, },
+ { 0xff8dffe2ff38ff8dULL, 0xffe2ff38ff8dffe2ULL, },
+ { 0x0038008dffe30038ULL, 0x008dffe30038008dULL, },
+ { 0xffaf0004ff5affafULL, 0x0004ff5affaf0004ULL, },
+ { 0x0016006bffc10016ULL, 0x006bffc10016006bULL, },
+ { 0xff71001bffc6ff71ULL, 0x001bffc6ff71001bULL, },
+ { 0x00540054ff550054ULL, 0x0054ff5500540054ULL, },
+ { 0x001bffc60070001bULL, 0xffc60070001bffc6ULL, }, /* 56 */
+ { 0x001cffc70071001cULL, 0xffc70071001cffc7ULL, },
+ { 0xffc6ff71001bffc6ULL, 0xff71001bffc6ff71ULL, },
+ { 0x0071001c00c60071ULL, 0x001c00c60071001cULL, },
+ { 0xffe8ff93003dffe8ULL, 0xff93003dffe8ff93ULL, },
+ { 0x004ffffa00a4004fULL, 0xfffa00a4004ffffaULL, },
+ { 0xffaaffaa00a9ffaaULL, 0xffaa00a9ffaaffaaULL, },
+ { 0x008dffe30038008dULL, 0xffe30038008dffe3ULL, },
+ { 0xfff2ffb2008a0095ULL, 0x00b200690079ffbcULL, }, /* 64 */
+ { 0xff460049ffbb005dULL, 0x00420025003dffacULL, },
+ { 0xffe2ff90fff7ffd5ULL, 0x0023000a0029ffc4ULL, },
+ { 0xffd70033005900a3ULL, 0x003cffe30040ff50ULL, },
+ { 0x0065ffcc00af0007ULL, 0x007900190090005eULL, },
+ { 0xffb90063ffe0ffcfULL, 0x0009ffd50054004eULL, },
+ { 0x0055ffaa001cff47ULL, 0xffeaffba00400066ULL, },
+ { 0x004a004d007e0015ULL, 0x0003ff930057fff2ULL, },
+ { 0x0016ff7a001bffcbULL, 0x008e002400260031ULL, }, /* 72 */
+ { 0xff6a0011ff4cff93ULL, 0x001effe0ffea0021ULL, },
+ { 0x0006ff58ff88ff0bULL, 0xffffffc5ffd60039ULL, },
+ { 0xfffbfffbffeaffd9ULL, 0x0018ff9effedffc5ULL, },
+ { 0x00daffe200c00022ULL, 0xfff4ffe60024ffeeULL, },
+ { 0x002e0079fff1ffeaULL, 0xff84ffa2ffe8ffdeULL, },
+};
+
+ gettimeofday(&start, NULL);
+
+ for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) {
+ do_msa_HADD_S_H(b128_pattern[i], b128_pattern[j],
+ b128_result[PATTERN_INPUTS_SHORT_COUNT * i + j]);
+ }
+ }
+
+ for (i = 0; i < RANDOM_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < RANDOM_INPUTS_SHORT_COUNT; j++) {
+ do_msa_HADD_S_H(b128_random[i], b128_random[j],
+ b128_result[((PATTERN_INPUTS_SHORT_COUNT) *
+ (PATTERN_INPUTS_SHORT_COUNT)) +
+ RANDOM_INPUTS_SHORT_COUNT * i + j]);
+ }
+ }
+
+ gettimeofday(&end, NULL);
+
+ elapsed_time = (end.tv_sec - start.tv_sec) * 1000.0;
+ elapsed_time += (end.tv_usec - start.tv_usec) / 1000.0;
+
+ ret = check_results(instruction_name, TEST_COUNT_TOTAL, elapsed_time,
+ &b128_result[0][0], &b128_expect[0][0]);
+
+ return ret;
+}
diff --git a/tests/tcg/mips/user/ase/msa/int-add/test_msa_hadd_s_w.c b/tests/tcg/mips/user/ase/msa/int-add/test_msa_hadd_s_w.c
new file mode 100644
index 0000000..26508ea
--- /dev/null
+++ b/tests/tcg/mips/user/ase/msa/int-add/test_msa_hadd_s_w.c
@@ -0,0 +1,151 @@
+/*
+ * Test program for MSA instruction HADD_S.W
+ *
+ * Copyright (C) 2018 Wave Computing, Inc.
+ * Copyright (C) 2018 Aleksandar Markovic <amarkovic@wavecomp.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
+#include <sys/time.h>
+#include <stdint.h>
+
+#include "../../../../include/wrappers_msa.h"
+#include "../../../../include/test_inputs.h"
+#include "../../../../include/test_utils.h"
+
+#define TEST_COUNT_TOTAL ( \
+ (PATTERN_INPUTS_SHORT_COUNT) * (PATTERN_INPUTS_SHORT_COUNT) + \
+ (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT))
+
+
+int32_t main(void)
+{
+ char *instruction_name = "HADD_S.W";
+ int32_t ret;
+ uint32_t i, j;
+ struct timeval start, end;
+ double elapsed_time;
+
+ uint64_t b128_result[TEST_COUNT_TOTAL][2];
+ uint64_t b128_expect[TEST_COUNT_TOTAL][2] = {
+ { 0xfffffffefffffffeULL, 0xfffffffefffffffeULL, }, /* 0 */
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xffffaaa9ffffaaa9ULL, 0xffffaaa9ffffaaa9ULL, },
+ { 0x0000555400005554ULL, 0x0000555400005554ULL, },
+ { 0xffffcccbffffcccbULL, 0xffffcccbffffcccbULL, },
+ { 0x0000333200003332ULL, 0x0000333200003332ULL, },
+ { 0x000038e2ffffe38dULL, 0xffff8e37000038e2ULL, },
+ { 0xffffc71b00001c70ULL, 0x000071c6ffffc71bULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 8 */
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0xffffaaaaffffaaaaULL, 0xffffaaaaffffaaaaULL, },
+ { 0x0000555500005555ULL, 0x0000555500005555ULL, },
+ { 0xffffccccffffccccULL, 0xffffccccffffccccULL, },
+ { 0x0000333300003333ULL, 0x0000333300003333ULL, },
+ { 0x000038e3ffffe38eULL, 0xffff8e38000038e3ULL, },
+ { 0xffffc71c00001c71ULL, 0x000071c7ffffc71cULL, },
+ { 0xffffaaa9ffffaaa9ULL, 0xffffaaa9ffffaaa9ULL, }, /* 16 */
+ { 0xffffaaaaffffaaaaULL, 0xffffaaaaffffaaaaULL, },
+ { 0xffff5554ffff5554ULL, 0xffff5554ffff5554ULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xffff7776ffff7776ULL, 0xffff7776ffff7776ULL, },
+ { 0xffffddddffffddddULL, 0xffffddddffffddddULL, },
+ { 0xffffe38dffff8e38ULL, 0xffff38e2ffffe38dULL, },
+ { 0xffff71c6ffffc71bULL, 0x00001c71ffff71c6ULL, },
+ { 0x0000555400005554ULL, 0x0000555400005554ULL, }, /* 24 */
+ { 0x0000555500005555ULL, 0x0000555500005555ULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0x0000aaaa0000aaaaULL, 0x0000aaaa0000aaaaULL, },
+ { 0x0000222100002221ULL, 0x0000222100002221ULL, },
+ { 0x0000888800008888ULL, 0x0000888800008888ULL, },
+ { 0x00008e38000038e3ULL, 0xffffe38d00008e38ULL, },
+ { 0x00001c71000071c6ULL, 0x0000c71c00001c71ULL, },
+ { 0xffffcccbffffcccbULL, 0xffffcccbffffcccbULL, }, /* 32 */
+ { 0xffffccccffffccccULL, 0xffffccccffffccccULL, },
+ { 0xffff7776ffff7776ULL, 0xffff7776ffff7776ULL, },
+ { 0x0000222100002221ULL, 0x0000222100002221ULL, },
+ { 0xffff9998ffff9998ULL, 0xffff9998ffff9998ULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0x000005afffffb05aULL, 0xffff5b04000005afULL, },
+ { 0xffff93e8ffffe93dULL, 0x00003e93ffff93e8ULL, },
+ { 0x0000333200003332ULL, 0x0000333200003332ULL, }, /* 40 */
+ { 0x0000333300003333ULL, 0x0000333300003333ULL, },
+ { 0xffffddddffffddddULL, 0xffffddddffffddddULL, },
+ { 0x0000888800008888ULL, 0x0000888800008888ULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0x0000666600006666ULL, 0x0000666600006666ULL, },
+ { 0x00006c16000016c1ULL, 0xffffc16b00006c16ULL, },
+ { 0xfffffa4f00004fa4ULL, 0x0000a4fafffffa4fULL, },
+ { 0xffffe38dffff8e37ULL, 0x000038e2ffffe38dULL, }, /* 48 */
+ { 0xffffe38effff8e38ULL, 0x000038e3ffffe38eULL, },
+ { 0xffff8e38ffff38e2ULL, 0xffffe38dffff8e38ULL, },
+ { 0x000038e3ffffe38dULL, 0x00008e38000038e3ULL, },
+ { 0xffffb05affff5b04ULL, 0x000005afffffb05aULL, },
+ { 0x000016c1ffffc16bULL, 0x00006c16000016c1ULL, },
+ { 0x00001c71ffff71c6ULL, 0xffffc71b00001c71ULL, },
+ { 0xffffaaaaffffaaa9ULL, 0x0000aaaaffffaaaaULL, },
+ { 0x00001c70000071c6ULL, 0xffffc71b00001c70ULL, }, /* 56 */
+ { 0x00001c71000071c7ULL, 0xffffc71c00001c71ULL, },
+ { 0xffffc71b00001c71ULL, 0xffff71c6ffffc71bULL, },
+ { 0x000071c60000c71cULL, 0x00001c71000071c6ULL, },
+ { 0xffffe93d00003e93ULL, 0xffff93e8ffffe93dULL, },
+ { 0x00004fa40000a4faULL, 0xfffffa4f00004fa4ULL, },
+ { 0x0000555400005555ULL, 0xffff555400005554ULL, },
+ { 0xffffe38d00008e38ULL, 0x000038e3ffffe38dULL, },
+ { 0xffff6f3600007da2ULL, 0x000056c5ffffae87ULL, }, /* 64 */
+ { 0xffff88cdffffef6aULL, 0x0000068100005177ULL, },
+ { 0xffff3714ffffb3e2ULL, 0x000012660000238fULL, },
+ { 0xffff9eb700000ab0ULL, 0xffffd43fffffe11bULL, },
+ { 0xffffe28a0000a2d3ULL, 0x00001e55ffffc54bULL, },
+ { 0xfffffc210000149bULL, 0xffffce110000683bULL, },
+ { 0xffffaa68ffffd913ULL, 0xffffd9f600003a53ULL, },
+ { 0x0000120b00002fe1ULL, 0xffff9bcffffff7dfULL, },
+ { 0xffff932600000f0fULL, 0x00003336ffff5b37ULL, }, /* 72 */
+ { 0xffffacbdffff80d7ULL, 0xffffe2f2fffffe27ULL, },
+ { 0xffff5b04ffff454fULL, 0xffffeed7ffffd03fULL, },
+ { 0xffffc2a7ffff9c1dULL, 0xffffb0b0ffff8dcbULL, },
+ { 0x0000571b0000b371ULL, 0xffff994fffff594eULL, },
+ { 0x000070b200002539ULL, 0xffff490bfffffc3eULL, },
+};
+
+ gettimeofday(&start, NULL);
+
+ for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) {
+ do_msa_HADD_S_W(b128_pattern[i], b128_pattern[j],
+ b128_result[PATTERN_INPUTS_SHORT_COUNT * i + j]);
+ }
+ }
+
+ for (i = 0; i < RANDOM_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < RANDOM_INPUTS_SHORT_COUNT; j++) {
+ do_msa_HADD_S_W(b128_random[i], b128_random[j],
+ b128_result[((PATTERN_INPUTS_SHORT_COUNT) *
+ (PATTERN_INPUTS_SHORT_COUNT)) +
+ RANDOM_INPUTS_SHORT_COUNT * i + j]);
+ }
+ }
+
+ gettimeofday(&end, NULL);
+
+ elapsed_time = (end.tv_sec - start.tv_sec) * 1000.0;
+ elapsed_time += (end.tv_usec - start.tv_usec) / 1000.0;
+
+ ret = check_results(instruction_name, TEST_COUNT_TOTAL, elapsed_time,
+ &b128_result[0][0], &b128_expect[0][0]);
+
+ return ret;
+}
diff --git a/tests/tcg/mips/user/ase/msa/int-add/test_msa_hadd_u_d.c b/tests/tcg/mips/user/ase/msa/int-add/test_msa_hadd_u_d.c
new file mode 100644
index 0000000..76f36a7
--- /dev/null
+++ b/tests/tcg/mips/user/ase/msa/int-add/test_msa_hadd_u_d.c
@@ -0,0 +1,151 @@
+/*
+ * Test program for MSA instruction HADD_U.D
+ *
+ * Copyright (C) 2018 Wave Computing, Inc.
+ * Copyright (C) 2018 Aleksandar Markovic <amarkovic@wavecomp.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
+#include <sys/time.h>
+#include <stdint.h>
+
+#include "../../../../include/wrappers_msa.h"
+#include "../../../../include/test_inputs.h"
+#include "../../../../include/test_utils.h"
+
+#define TEST_COUNT_TOTAL ( \
+ (PATTERN_INPUTS_SHORT_COUNT) * (PATTERN_INPUTS_SHORT_COUNT) + \
+ (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT))
+
+
+int32_t main(void)
+{
+ char *instruction_name = "HADD_U.D";
+ int32_t ret;
+ uint32_t i, j;
+ struct timeval start, end;
+ double elapsed_time;
+
+ uint64_t b128_result[TEST_COUNT_TOTAL][2];
+ uint64_t b128_expect[TEST_COUNT_TOTAL][2] = {
+ { 0x00000001fffffffeULL, 0x00000001fffffffeULL, }, /* 0 */
+ { 0x00000000ffffffffULL, 0x00000000ffffffffULL, },
+ { 0x00000001aaaaaaa9ULL, 0x00000001aaaaaaa9ULL, },
+ { 0x0000000155555554ULL, 0x0000000155555554ULL, },
+ { 0x00000001cccccccbULL, 0x00000001cccccccbULL, },
+ { 0x0000000133333332ULL, 0x0000000133333332ULL, },
+ { 0x000000018e38e38dULL, 0x00000001e38e38e2ULL, },
+ { 0x0000000171c71c70ULL, 0x000000011c71c71bULL, },
+ { 0x00000000ffffffffULL, 0x00000000ffffffffULL, }, /* 8 */
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0x00000000aaaaaaaaULL, 0x00000000aaaaaaaaULL, },
+ { 0x0000000055555555ULL, 0x0000000055555555ULL, },
+ { 0x00000000ccccccccULL, 0x00000000ccccccccULL, },
+ { 0x0000000033333333ULL, 0x0000000033333333ULL, },
+ { 0x000000008e38e38eULL, 0x00000000e38e38e3ULL, },
+ { 0x0000000071c71c71ULL, 0x000000001c71c71cULL, },
+ { 0x00000001aaaaaaa9ULL, 0x00000001aaaaaaa9ULL, }, /* 16 */
+ { 0x00000000aaaaaaaaULL, 0x00000000aaaaaaaaULL, },
+ { 0x0000000155555554ULL, 0x0000000155555554ULL, },
+ { 0x00000000ffffffffULL, 0x00000000ffffffffULL, },
+ { 0x0000000177777776ULL, 0x0000000177777776ULL, },
+ { 0x00000000ddddddddULL, 0x00000000ddddddddULL, },
+ { 0x0000000138e38e38ULL, 0x000000018e38e38dULL, },
+ { 0x000000011c71c71bULL, 0x00000000c71c71c6ULL, },
+ { 0x0000000155555554ULL, 0x0000000155555554ULL, }, /* 24 */
+ { 0x0000000055555555ULL, 0x0000000055555555ULL, },
+ { 0x00000000ffffffffULL, 0x00000000ffffffffULL, },
+ { 0x00000000aaaaaaaaULL, 0x00000000aaaaaaaaULL, },
+ { 0x0000000122222221ULL, 0x0000000122222221ULL, },
+ { 0x0000000088888888ULL, 0x0000000088888888ULL, },
+ { 0x00000000e38e38e3ULL, 0x0000000138e38e38ULL, },
+ { 0x00000000c71c71c6ULL, 0x0000000071c71c71ULL, },
+ { 0x00000001cccccccbULL, 0x00000001cccccccbULL, }, /* 32 */
+ { 0x00000000ccccccccULL, 0x00000000ccccccccULL, },
+ { 0x0000000177777776ULL, 0x0000000177777776ULL, },
+ { 0x0000000122222221ULL, 0x0000000122222221ULL, },
+ { 0x0000000199999998ULL, 0x0000000199999998ULL, },
+ { 0x00000000ffffffffULL, 0x00000000ffffffffULL, },
+ { 0x000000015b05b05aULL, 0x00000001b05b05afULL, },
+ { 0x000000013e93e93dULL, 0x00000000e93e93e8ULL, },
+ { 0x0000000133333332ULL, 0x0000000133333332ULL, }, /* 40 */
+ { 0x0000000033333333ULL, 0x0000000033333333ULL, },
+ { 0x00000000ddddddddULL, 0x00000000ddddddddULL, },
+ { 0x0000000088888888ULL, 0x0000000088888888ULL, },
+ { 0x00000000ffffffffULL, 0x00000000ffffffffULL, },
+ { 0x0000000066666666ULL, 0x0000000066666666ULL, },
+ { 0x00000000c16c16c1ULL, 0x0000000116c16c16ULL, },
+ { 0x00000000a4fa4fa4ULL, 0x000000004fa4fa4fULL, },
+ { 0x00000001e38e38e2ULL, 0x0000000138e38e37ULL, }, /* 48 */
+ { 0x00000000e38e38e3ULL, 0x0000000038e38e38ULL, },
+ { 0x000000018e38e38dULL, 0x00000000e38e38e2ULL, },
+ { 0x0000000138e38e38ULL, 0x000000008e38e38dULL, },
+ { 0x00000001b05b05afULL, 0x0000000105b05b04ULL, },
+ { 0x0000000116c16c16ULL, 0x000000006c16c16bULL, },
+ { 0x0000000171c71c71ULL, 0x000000011c71c71bULL, },
+ { 0x0000000155555554ULL, 0x0000000055555554ULL, },
+ { 0x000000011c71c71bULL, 0x00000001c71c71c6ULL, }, /* 56 */
+ { 0x000000001c71c71cULL, 0x00000000c71c71c7ULL, },
+ { 0x00000000c71c71c6ULL, 0x0000000171c71c71ULL, },
+ { 0x0000000071c71c71ULL, 0x000000011c71c71cULL, },
+ { 0x00000000e93e93e8ULL, 0x0000000193e93e93ULL, },
+ { 0x000000004fa4fa4fULL, 0x00000000fa4fa4faULL, },
+ { 0x00000000aaaaaaaaULL, 0x00000001aaaaaaaaULL, },
+ { 0x000000008e38e38dULL, 0x00000000e38e38e3ULL, },
+ { 0x00000000b0cd3c0cULL, 0x0000000149e2bb6aULL, }, /* 64 */
+ { 0x00000000d5feadd4ULL, 0x0000000060a65e5aULL, },
+ { 0x00000001423a724cULL, 0x00000000f6923072ULL, },
+ { 0x00000000e69cc91aULL, 0x00000000f4a9edfeULL, },
+ { 0x00000001242055a3ULL, 0x0000000111736b26ULL, },
+ { 0x000000014951c76bULL, 0x0000000028370e16ULL, },
+ { 0x00000001b58d8be3ULL, 0x00000000be22e02eULL, },
+ { 0x0000000159efe2b1ULL, 0x00000000bc3a9dbaULL, },
+ { 0x00000000d4bd03eaULL, 0x000000012654770bULL, }, /* 72 */
+ { 0x00000000f9ee75b2ULL, 0x000000003d1819fbULL, },
+ { 0x00000001662a3a2aULL, 0x00000000d303ec13ULL, },
+ { 0x000000010a8c90f8ULL, 0x00000000d11ba99fULL, },
+ { 0x0000000098b16b8dULL, 0x000000018c6d38e4ULL, },
+ { 0x00000000bde2dd55ULL, 0x00000000a330dbd4ULL, },
+};
+
+ gettimeofday(&start, NULL);
+
+ for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) {
+ do_msa_HADD_U_D(b128_pattern[i], b128_pattern[j],
+ b128_result[PATTERN_INPUTS_SHORT_COUNT * i + j]);
+ }
+ }
+
+ for (i = 0; i < RANDOM_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < RANDOM_INPUTS_SHORT_COUNT; j++) {
+ do_msa_HADD_U_D(b128_random[i], b128_random[j],
+ b128_result[((PATTERN_INPUTS_SHORT_COUNT) *
+ (PATTERN_INPUTS_SHORT_COUNT)) +
+ RANDOM_INPUTS_SHORT_COUNT * i + j]);
+ }
+ }
+
+ gettimeofday(&end, NULL);
+
+ elapsed_time = (end.tv_sec - start.tv_sec) * 1000.0;
+ elapsed_time += (end.tv_usec - start.tv_usec) / 1000.0;
+
+ ret = check_results(instruction_name, TEST_COUNT_TOTAL, elapsed_time,
+ &b128_result[0][0], &b128_expect[0][0]);
+
+ return ret;
+}
diff --git a/tests/tcg/mips/user/ase/msa/int-add/test_msa_hadd_u_h.c b/tests/tcg/mips/user/ase/msa/int-add/test_msa_hadd_u_h.c
new file mode 100644
index 0000000..a377c10
--- /dev/null
+++ b/tests/tcg/mips/user/ase/msa/int-add/test_msa_hadd_u_h.c
@@ -0,0 +1,151 @@
+/*
+ * Test program for MSA instruction HADD_U.H
+ *
+ * Copyright (C) 2018 Wave Computing, Inc.
+ * Copyright (C) 2018 Aleksandar Markovic <amarkovic@wavecomp.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
+#include <sys/time.h>
+#include <stdint.h>
+
+#include "../../../../include/wrappers_msa.h"
+#include "../../../../include/test_inputs.h"
+#include "../../../../include/test_utils.h"
+
+#define TEST_COUNT_TOTAL ( \
+ (PATTERN_INPUTS_SHORT_COUNT) * (PATTERN_INPUTS_SHORT_COUNT) + \
+ (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT))
+
+
+int32_t main(void)
+{
+ char *instruction_name = "HADD_U.H";
+ int32_t ret;
+ uint32_t i, j;
+ struct timeval start, end;
+ double elapsed_time;
+
+ uint64_t b128_result[TEST_COUNT_TOTAL][2];
+ uint64_t b128_expect[TEST_COUNT_TOTAL][2] = {
+ { 0x01fe01fe01fe01feULL, 0x01fe01fe01fe01feULL, }, /* 0 */
+ { 0x00ff00ff00ff00ffULL, 0x00ff00ff00ff00ffULL, },
+ { 0x01a901a901a901a9ULL, 0x01a901a901a901a9ULL, },
+ { 0x0154015401540154ULL, 0x0154015401540154ULL, },
+ { 0x01cb01cb01cb01cbULL, 0x01cb01cb01cb01cbULL, },
+ { 0x0132013201320132ULL, 0x0132013201320132ULL, },
+ { 0x018d01e20137018dULL, 0x01e20137018d01e2ULL, },
+ { 0x0170011b01c60170ULL, 0x011b01c60170011bULL, },
+ { 0x00ff00ff00ff00ffULL, 0x00ff00ff00ff00ffULL, }, /* 8 */
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0x00aa00aa00aa00aaULL, 0x00aa00aa00aa00aaULL, },
+ { 0x0055005500550055ULL, 0x0055005500550055ULL, },
+ { 0x00cc00cc00cc00ccULL, 0x00cc00cc00cc00ccULL, },
+ { 0x0033003300330033ULL, 0x0033003300330033ULL, },
+ { 0x008e00e30038008eULL, 0x00e30038008e00e3ULL, },
+ { 0x0071001c00c70071ULL, 0x001c00c70071001cULL, },
+ { 0x01a901a901a901a9ULL, 0x01a901a901a901a9ULL, }, /* 16 */
+ { 0x00aa00aa00aa00aaULL, 0x00aa00aa00aa00aaULL, },
+ { 0x0154015401540154ULL, 0x0154015401540154ULL, },
+ { 0x00ff00ff00ff00ffULL, 0x00ff00ff00ff00ffULL, },
+ { 0x0176017601760176ULL, 0x0176017601760176ULL, },
+ { 0x00dd00dd00dd00ddULL, 0x00dd00dd00dd00ddULL, },
+ { 0x0138018d00e20138ULL, 0x018d00e20138018dULL, },
+ { 0x011b00c60171011bULL, 0x00c60171011b00c6ULL, },
+ { 0x0154015401540154ULL, 0x0154015401540154ULL, }, /* 24 */
+ { 0x0055005500550055ULL, 0x0055005500550055ULL, },
+ { 0x00ff00ff00ff00ffULL, 0x00ff00ff00ff00ffULL, },
+ { 0x00aa00aa00aa00aaULL, 0x00aa00aa00aa00aaULL, },
+ { 0x0121012101210121ULL, 0x0121012101210121ULL, },
+ { 0x0088008800880088ULL, 0x0088008800880088ULL, },
+ { 0x00e30138008d00e3ULL, 0x0138008d00e30138ULL, },
+ { 0x00c60071011c00c6ULL, 0x0071011c00c60071ULL, },
+ { 0x01cb01cb01cb01cbULL, 0x01cb01cb01cb01cbULL, }, /* 32 */
+ { 0x00cc00cc00cc00ccULL, 0x00cc00cc00cc00ccULL, },
+ { 0x0176017601760176ULL, 0x0176017601760176ULL, },
+ { 0x0121012101210121ULL, 0x0121012101210121ULL, },
+ { 0x0198019801980198ULL, 0x0198019801980198ULL, },
+ { 0x00ff00ff00ff00ffULL, 0x00ff00ff00ff00ffULL, },
+ { 0x015a01af0104015aULL, 0x01af0104015a01afULL, },
+ { 0x013d00e80193013dULL, 0x00e80193013d00e8ULL, },
+ { 0x0132013201320132ULL, 0x0132013201320132ULL, }, /* 40 */
+ { 0x0033003300330033ULL, 0x0033003300330033ULL, },
+ { 0x00dd00dd00dd00ddULL, 0x00dd00dd00dd00ddULL, },
+ { 0x0088008800880088ULL, 0x0088008800880088ULL, },
+ { 0x00ff00ff00ff00ffULL, 0x00ff00ff00ff00ffULL, },
+ { 0x0066006600660066ULL, 0x0066006600660066ULL, },
+ { 0x00c10116006b00c1ULL, 0x0116006b00c10116ULL, },
+ { 0x00a4004f00fa00a4ULL, 0x004f00fa00a4004fULL, },
+ { 0x01e20137018d01e2ULL, 0x0137018d01e20137ULL, }, /* 48 */
+ { 0x00e30038008e00e3ULL, 0x0038008e00e30038ULL, },
+ { 0x018d00e20138018dULL, 0x00e20138018d00e2ULL, },
+ { 0x0138008d00e30138ULL, 0x008d00e30138008dULL, },
+ { 0x01af0104015a01afULL, 0x0104015a01af0104ULL, },
+ { 0x0116006b00c10116ULL, 0x006b00c10116006bULL, },
+ { 0x0171011b00c60171ULL, 0x011b00c60171011bULL, },
+ { 0x0154005401550154ULL, 0x0054015501540054ULL, },
+ { 0x011b01c60170011bULL, 0x01c60170011b01c6ULL, }, /* 56 */
+ { 0x001c00c70071001cULL, 0x00c70071001c00c7ULL, },
+ { 0x00c60171011b00c6ULL, 0x0171011b00c60171ULL, },
+ { 0x0071011c00c60071ULL, 0x011c00c60071011cULL, },
+ { 0x00e80193013d00e8ULL, 0x0193013d00e80193ULL, },
+ { 0x004f00fa00a4004fULL, 0x00fa00a4004f00faULL, },
+ { 0x00aa01aa00a900aaULL, 0x01aa00a900aa01aaULL, },
+ { 0x008d00e30138008dULL, 0x00e30138008d00e3ULL, },
+ { 0x00f201b2008a0095ULL, 0x00b20069017900bcULL, }, /* 64 */
+ { 0x0146014900bb005dULL, 0x01420025013d01acULL, },
+ { 0x00e2019000f700d5ULL, 0x0123010a012900c4ULL, },
+ { 0x00d70133005900a3ULL, 0x013c00e301400150ULL, },
+ { 0x016500cc00af0107ULL, 0x007901190090005eULL, },
+ { 0x01b9006300e000cfULL, 0x010900d50054014eULL, },
+ { 0x015500aa011c0147ULL, 0x00ea01ba00400066ULL, },
+ { 0x014a004d007e0115ULL, 0x01030193005700f2ULL, },
+ { 0x0116017a011b00cbULL, 0x008e012401260031ULL, }, /* 72 */
+ { 0x016a0111014c0093ULL, 0x011e00e000ea0121ULL, },
+ { 0x010601580188010bULL, 0x00ff01c500d60039ULL, },
+ { 0x00fb00fb00ea00d9ULL, 0x0118019e00ed00c5ULL, },
+ { 0x00da00e200c00122ULL, 0x00f400e6012400eeULL, },
+ { 0x012e007900f100eaULL, 0x018400a200e801deULL, },
+};
+
+ gettimeofday(&start, NULL);
+
+ for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) {
+ do_msa_HADD_U_H(b128_pattern[i], b128_pattern[j],
+ b128_result[PATTERN_INPUTS_SHORT_COUNT * i + j]);
+ }
+ }
+
+ for (i = 0; i < RANDOM_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < RANDOM_INPUTS_SHORT_COUNT; j++) {
+ do_msa_HADD_U_H(b128_random[i], b128_random[j],
+ b128_result[((PATTERN_INPUTS_SHORT_COUNT) *
+ (PATTERN_INPUTS_SHORT_COUNT)) +
+ RANDOM_INPUTS_SHORT_COUNT * i + j]);
+ }
+ }
+
+ gettimeofday(&end, NULL);
+
+ elapsed_time = (end.tv_sec - start.tv_sec) * 1000.0;
+ elapsed_time += (end.tv_usec - start.tv_usec) / 1000.0;
+
+ ret = check_results(instruction_name, TEST_COUNT_TOTAL, elapsed_time,
+ &b128_result[0][0], &b128_expect[0][0]);
+
+ return ret;
+}
diff --git a/tests/tcg/mips/user/ase/msa/int-add/test_msa_hadd_u_w.c b/tests/tcg/mips/user/ase/msa/int-add/test_msa_hadd_u_w.c
new file mode 100644
index 0000000..4f4c54a
--- /dev/null
+++ b/tests/tcg/mips/user/ase/msa/int-add/test_msa_hadd_u_w.c
@@ -0,0 +1,151 @@
+/*
+ * Test program for MSA instruction HADD_U.W
+ *
+ * Copyright (C) 2018 Wave Computing, Inc.
+ * Copyright (C) 2018 Aleksandar Markovic <amarkovic@wavecomp.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
+#include <sys/time.h>
+#include <stdint.h>
+
+#include "../../../../include/wrappers_msa.h"
+#include "../../../../include/test_inputs.h"
+#include "../../../../include/test_utils.h"
+
+#define TEST_COUNT_TOTAL ( \
+ (PATTERN_INPUTS_SHORT_COUNT) * (PATTERN_INPUTS_SHORT_COUNT) + \
+ (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT))
+
+
+int32_t main(void)
+{
+ char *instruction_name = "HADD_U.W";
+ int32_t ret;
+ uint32_t i, j;
+ struct timeval start, end;
+ double elapsed_time;
+
+ uint64_t b128_result[TEST_COUNT_TOTAL][2];
+ uint64_t b128_expect[TEST_COUNT_TOTAL][2] = {
+ { 0x0001fffe0001fffeULL, 0x0001fffe0001fffeULL, }, /* 0 */
+ { 0x0000ffff0000ffffULL, 0x0000ffff0000ffffULL, },
+ { 0x0001aaa90001aaa9ULL, 0x0001aaa90001aaa9ULL, },
+ { 0x0001555400015554ULL, 0x0001555400015554ULL, },
+ { 0x0001cccb0001cccbULL, 0x0001cccb0001cccbULL, },
+ { 0x0001333200013332ULL, 0x0001333200013332ULL, },
+ { 0x000138e20001e38dULL, 0x00018e37000138e2ULL, },
+ { 0x0001c71b00011c70ULL, 0x000171c60001c71bULL, },
+ { 0x0000ffff0000ffffULL, 0x0000ffff0000ffffULL, }, /* 8 */
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0x0000aaaa0000aaaaULL, 0x0000aaaa0000aaaaULL, },
+ { 0x0000555500005555ULL, 0x0000555500005555ULL, },
+ { 0x0000cccc0000ccccULL, 0x0000cccc0000ccccULL, },
+ { 0x0000333300003333ULL, 0x0000333300003333ULL, },
+ { 0x000038e30000e38eULL, 0x00008e38000038e3ULL, },
+ { 0x0000c71c00001c71ULL, 0x000071c70000c71cULL, },
+ { 0x0001aaa90001aaa9ULL, 0x0001aaa90001aaa9ULL, }, /* 16 */
+ { 0x0000aaaa0000aaaaULL, 0x0000aaaa0000aaaaULL, },
+ { 0x0001555400015554ULL, 0x0001555400015554ULL, },
+ { 0x0000ffff0000ffffULL, 0x0000ffff0000ffffULL, },
+ { 0x0001777600017776ULL, 0x0001777600017776ULL, },
+ { 0x0000dddd0000ddddULL, 0x0000dddd0000ddddULL, },
+ { 0x0000e38d00018e38ULL, 0x000138e20000e38dULL, },
+ { 0x000171c60000c71bULL, 0x00011c71000171c6ULL, },
+ { 0x0001555400015554ULL, 0x0001555400015554ULL, }, /* 24 */
+ { 0x0000555500005555ULL, 0x0000555500005555ULL, },
+ { 0x0000ffff0000ffffULL, 0x0000ffff0000ffffULL, },
+ { 0x0000aaaa0000aaaaULL, 0x0000aaaa0000aaaaULL, },
+ { 0x0001222100012221ULL, 0x0001222100012221ULL, },
+ { 0x0000888800008888ULL, 0x0000888800008888ULL, },
+ { 0x00008e38000138e3ULL, 0x0000e38d00008e38ULL, },
+ { 0x00011c71000071c6ULL, 0x0000c71c00011c71ULL, },
+ { 0x0001cccb0001cccbULL, 0x0001cccb0001cccbULL, }, /* 32 */
+ { 0x0000cccc0000ccccULL, 0x0000cccc0000ccccULL, },
+ { 0x0001777600017776ULL, 0x0001777600017776ULL, },
+ { 0x0001222100012221ULL, 0x0001222100012221ULL, },
+ { 0x0001999800019998ULL, 0x0001999800019998ULL, },
+ { 0x0000ffff0000ffffULL, 0x0000ffff0000ffffULL, },
+ { 0x000105af0001b05aULL, 0x00015b04000105afULL, },
+ { 0x000193e80000e93dULL, 0x00013e93000193e8ULL, },
+ { 0x0001333200013332ULL, 0x0001333200013332ULL, }, /* 40 */
+ { 0x0000333300003333ULL, 0x0000333300003333ULL, },
+ { 0x0000dddd0000ddddULL, 0x0000dddd0000ddddULL, },
+ { 0x0000888800008888ULL, 0x0000888800008888ULL, },
+ { 0x0000ffff0000ffffULL, 0x0000ffff0000ffffULL, },
+ { 0x0000666600006666ULL, 0x0000666600006666ULL, },
+ { 0x00006c16000116c1ULL, 0x0000c16b00006c16ULL, },
+ { 0x0000fa4f00004fa4ULL, 0x0000a4fa0000fa4fULL, },
+ { 0x0001e38d00018e37ULL, 0x000138e20001e38dULL, }, /* 48 */
+ { 0x0000e38e00008e38ULL, 0x000038e30000e38eULL, },
+ { 0x00018e38000138e2ULL, 0x0000e38d00018e38ULL, },
+ { 0x000138e30000e38dULL, 0x00008e38000138e3ULL, },
+ { 0x0001b05a00015b04ULL, 0x000105af0001b05aULL, },
+ { 0x000116c10000c16bULL, 0x00006c16000116c1ULL, },
+ { 0x00011c71000171c6ULL, 0x0000c71b00011c71ULL, },
+ { 0x0001aaaa0000aaa9ULL, 0x0000aaaa0001aaaaULL, },
+ { 0x00011c70000171c6ULL, 0x0001c71b00011c70ULL, }, /* 56 */
+ { 0x00001c71000071c7ULL, 0x0000c71c00001c71ULL, },
+ { 0x0000c71b00011c71ULL, 0x000171c60000c71bULL, },
+ { 0x000071c60000c71cULL, 0x00011c71000071c6ULL, },
+ { 0x0000e93d00013e93ULL, 0x000193e80000e93dULL, },
+ { 0x00004fa40000a4faULL, 0x0000fa4f00004fa4ULL, },
+ { 0x0000555400015555ULL, 0x0001555400005554ULL, },
+ { 0x0000e38d00008e38ULL, 0x000138e30000e38dULL, },
+ { 0x00016f3600007da2ULL, 0x000056c50001ae87ULL, }, /* 64 */
+ { 0x000088cd0000ef6aULL, 0x0001068100015177ULL, },
+ { 0x000137140000b3e2ULL, 0x000112660001238fULL, },
+ { 0x00009eb700010ab0ULL, 0x0000d43f0001e11bULL, },
+ { 0x0001e28a0000a2d3ULL, 0x00001e550000c54bULL, },
+ { 0x0000fc210001149bULL, 0x0000ce110000683bULL, },
+ { 0x0001aa680000d913ULL, 0x0000d9f600003a53ULL, },
+ { 0x0001120b00012fe1ULL, 0x00009bcf0000f7dfULL, },
+ { 0x0001932600010f0fULL, 0x0000333600015b37ULL, }, /* 72 */
+ { 0x0000acbd000180d7ULL, 0x0000e2f20000fe27ULL, },
+ { 0x00015b040001454fULL, 0x0000eed70000d03fULL, },
+ { 0x0000c2a700019c1dULL, 0x0000b0b000018dcbULL, },
+ { 0x0001571b0000b371ULL, 0x0000994f0001594eULL, },
+ { 0x000070b200012539ULL, 0x0001490b0000fc3eULL, },
+};
+
+ gettimeofday(&start, NULL);
+
+ for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) {
+ do_msa_HADD_U_W(b128_pattern[i], b128_pattern[j],
+ b128_result[PATTERN_INPUTS_SHORT_COUNT * i + j]);
+ }
+ }
+
+ for (i = 0; i < RANDOM_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < RANDOM_INPUTS_SHORT_COUNT; j++) {
+ do_msa_HADD_U_W(b128_random[i], b128_random[j],
+ b128_result[((PATTERN_INPUTS_SHORT_COUNT) *
+ (PATTERN_INPUTS_SHORT_COUNT)) +
+ RANDOM_INPUTS_SHORT_COUNT * i + j]);
+ }
+ }
+
+ gettimeofday(&end, NULL);
+
+ elapsed_time = (end.tv_sec - start.tv_sec) * 1000.0;
+ elapsed_time += (end.tv_usec - start.tv_usec) / 1000.0;
+
+ ret = check_results(instruction_name, TEST_COUNT_TOTAL, elapsed_time,
+ &b128_result[0][0], &b128_expect[0][0]);
+
+ return ret;
+}
--
2.7.4
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [Qemu-devel] [PATCH 1/2] target/mips: Improve performance for MSA binary operations
2019-03-04 16:51 ` [Qemu-devel] [PATCH 1/2] " Mateja Marjanovic
@ 2019-06-01 14:16 ` Aleksandar Markovic
2019-06-02 7:06 ` Aleksandar Markovic
2019-06-02 13:22 ` Alex Bennée
1 sibling, 1 reply; 10+ messages in thread
From: Aleksandar Markovic @ 2019-06-01 14:16 UTC (permalink / raw)
To: Mateja Marjanovic, qemu-devel; +Cc: Aleksandar Rikalo, aurelien
> From: Mateja Marjanovic <mateja.marjanovic@rt-rk.com>
> Sent: Monday, March 4, 2019 5:51 PM
> To: qemu-devel@nongnu.org
> Cc: aurelien@aurel32.net; Aleksandar Markovic; Aleksandar Rikalo
> Subject: [PATCH 1/2] target/mips: Improve performance for MSA binary operations
>
> From: Mateja Marjanovic <Mateja.Marjanovic@rt-rk.com>
>
> Eliminate loops for better performance.
>
> Signed-off-by: Mateja Marjanovic <mateja.marjanovic@rt-rk.com>
> ---
> target/mips/msa_helper.c | 43 ++++++++++++++++++++++++++++++-------------
> 1 file changed, 30 insertions(+), 13 deletions(-)
>
The commit message should be a little bit more informative - for example,
it could list the affected instructions. Please consider other groups of
MSA instructions that are implemented via helpers that use similar "for"
loops. Otherwise:
Reviewed-by: Aleksandar Markovic <amarkovic@wavecomp.com>
> diff --git a/target/mips/msa_helper.c b/target/mips/msa_helper.c
> index 4c7ec05..1152fda 100644
> --- a/target/mips/msa_helper.c
> +++ b/target/mips/msa_helper.c
> @@ -804,28 +804,45 @@ void helper_msa_ ## func ## _df(CPUMIPSState *env, uint32_t > df, \
> wr_t *pwd = &(env->active_fpu.fpr[wd].wr); \
> wr_t *pws = &(env->active_fpu.fpr[ws].wr); \
> wr_t *pwt = &(env->active_fpu.fpr[wt].wr); \
> - uint32_t i; \
> \
> switch (df) { \
> case DF_BYTE: \
> - for (i = 0; i < DF_ELEMENTS(DF_BYTE); i++) { \
> - pwd->b[i] = msa_ ## func ## _df(df, pws->b[i], pwt->b[i]); \
> - } \
> + pwd->b[0] = msa_ ## func ## _df(df, pws->b[0], pwt->b[0]); \
> + pwd->b[1] = msa_ ## func ## _df(df, pws->b[1], pwt->b[1]); \
> + pwd->b[2] = msa_ ## func ## _df(df, pws->b[2], pwt->b[2]); \
> + pwd->b[3] = msa_ ## func ## _df(df, pws->b[3], pwt->b[3]); \
> + pwd->b[4] = msa_ ## func ## _df(df, pws->b[4], pwt->b[4]); \
> + pwd->b[5] = msa_ ## func ## _df(df, pws->b[5], pwt->b[5]); \
> + pwd->b[6] = msa_ ## func ## _df(df, pws->b[6], pwt->b[6]); \
> + pwd->b[7] = msa_ ## func ## _df(df, pws->b[7], pwt->b[7]); \
> + pwd->b[8] = msa_ ## func ## _df(df, pws->b[8], pwt->b[8]); \
> + pwd->b[9] = msa_ ## func ## _df(df, pws->b[9], pwt->b[9]); \
> + pwd->b[10] = msa_ ## func ## _df(df, pws->b[10], pwt->b[10]); \
> + pwd->b[11] = msa_ ## func ## _df(df, pws->b[11], pwt->b[11]); \
> + pwd->b[12] = msa_ ## func ## _df(df, pws->b[12], pwt->b[12]); \
> + pwd->b[13] = msa_ ## func ## _df(df, pws->b[13], pwt->b[13]); \
> + pwd->b[14] = msa_ ## func ## _df(df, pws->b[14], pwt->b[14]); \
> + pwd->b[15] = msa_ ## func ## _df(df, pws->b[15], pwt->b[15]); \
> break; \
> case DF_HALF: \
> - for (i = 0; i < DF_ELEMENTS(DF_HALF); i++) { \
> - pwd->h[i] = msa_ ## func ## _df(df, pws->h[i], pwt->h[i]); \
> - } \
> + pwd->h[0] = msa_ ## func ## _df(df, pws->h[0], pwt->h[0]); \
> + pwd->h[1] = msa_ ## func ## _df(df, pws->h[1], pwt->h[1]); \
> + pwd->h[2] = msa_ ## func ## _df(df, pws->h[2], pwt->h[2]); \
> + pwd->h[3] = msa_ ## func ## _df(df, pws->h[3], pwt->h[3]); \
> + pwd->h[4] = msa_ ## func ## _df(df, pws->h[4], pwt->h[4]); \
> + pwd->h[5] = msa_ ## func ## _df(df, pws->h[5], pwt->h[5]); \
> + pwd->h[6] = msa_ ## func ## _df(df, pws->h[6], pwt->h[6]); \
> + pwd->h[7] = msa_ ## func ## _df(df, pws->h[7], pwt->h[7]); \
> break; \
> case DF_WORD: \
> - for (i = 0; i < DF_ELEMENTS(DF_WORD); i++) { \
> - pwd->w[i] = msa_ ## func ## _df(df, pws->w[i], pwt->w[i]); \
> - } \
> + pwd->w[0] = msa_ ## func ## _df(df, pws->w[0], pwt->w[0]); \
> + pwd->w[1] = msa_ ## func ## _df(df, pws->w[1], pwt->w[1]); \
> + pwd->w[2] = msa_ ## func ## _df(df, pws->w[2], pwt->w[2]); \
> + pwd->w[3] = msa_ ## func ## _df(df, pws->w[3], pwt->w[3]); \
> break; \
> case DF_DOUBLE: \
> - for (i = 0; i < DF_ELEMENTS(DF_DOUBLE); i++) { \
> - pwd->d[i] = msa_ ## func ## _df(df, pws->d[i], pwt->d[i]); \
> - } \
> + pwd->d[0] = msa_ ## func ## _df(df, pws->d[0], pwt->d[0]); \
> + pwd->d[1] = msa_ ## func ## _df(df, pws->d[1], pwt->d[1]); \
> break; \
> default: \
> assert(0); \
> --
> 2.7.4
>
>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Qemu-devel] [PATCH 1/2] target/mips: Improve performance for MSA binary operations
2019-06-01 14:16 ` Aleksandar Markovic
@ 2019-06-02 7:06 ` Aleksandar Markovic
2019-06-03 9:46 ` Mateja Marjanovic
0 siblings, 1 reply; 10+ messages in thread
From: Aleksandar Markovic @ 2019-06-02 7:06 UTC (permalink / raw)
To: Aleksandar Markovic
Cc: Aleksandar Rikalo, aurelien, Mateja Marjanovic, qemu-devel
On Jun 1, 2019 4:16 PM, "Aleksandar Markovic" <amarkovic@wavecomp.com>
wrote:
>
> > From: Mateja Marjanovic <mateja.marjanovic@rt-rk.com>
> > Sent: Monday, March 4, 2019 5:51 PM
> > To: qemu-devel@nongnu.org
> > Cc: aurelien@aurel32.net; Aleksandar Markovic; Aleksandar Rikalo
> > Subject: [PATCH 1/2] target/mips: Improve performance for MSA binary
operations
> >
> > From: Mateja Marjanovic <Mateja.Marjanovic@rt-rk.com>
> >
> > Eliminate loops for better performance.
> >
> > Signed-off-by: Mateja Marjanovic <mateja.marjanovic@rt-rk.com>
> > ---
> > target/mips/msa_helper.c | 43
++++++++++++++++++++++++++++++-------------
> > 1 file changed, 30 insertions(+), 13 deletions(-)
> >
>
> The commit message should be a little bit more informative - for example,
> it could list the affected instructions. Please consider other groups of
> MSA instructions that are implemented via helpers that use similar "for"
> loops. Otherwise:
>
> Reviewed-by: Aleksandar Markovic <amarkovic@wavecomp.com>
>
Mateja, you don't need to do anything regarding this patch, I am going to
fix the issues while appying.
Thanks, Aleksandar
> > diff --git a/target/mips/msa_helper.c b/target/mips/msa_helper.c
> > index 4c7ec05..1152fda 100644
> > --- a/target/mips/msa_helper.c
> > +++ b/target/mips/msa_helper.c
> > @@ -804,28 +804,45 @@ void helper_msa_ ## func ## _df(CPUMIPSState
*env, uint32_t > df, \
> > wr_t *pwd = &(env->active_fpu.fpr[wd].wr);
\
> > wr_t *pws = &(env->active_fpu.fpr[ws].wr);
\
> > wr_t *pwt = &(env->active_fpu.fpr[wt].wr);
\
> > - uint32_t i;
\
> >
\
> > switch (df) {
\
> > case DF_BYTE:
\
> > - for (i = 0; i < DF_ELEMENTS(DF_BYTE); i++) {
\
> > - pwd->b[i] = msa_ ## func ## _df(df, pws->b[i],
pwt->b[i]); \
> > - }
\
> > + pwd->b[0] = msa_ ## func ## _df(df, pws->b[0], pwt->b[0]);
\
> > + pwd->b[1] = msa_ ## func ## _df(df, pws->b[1], pwt->b[1]);
\
> > + pwd->b[2] = msa_ ## func ## _df(df, pws->b[2], pwt->b[2]);
\
> > + pwd->b[3] = msa_ ## func ## _df(df, pws->b[3], pwt->b[3]);
\
> > + pwd->b[4] = msa_ ## func ## _df(df, pws->b[4], pwt->b[4]);
\
> > + pwd->b[5] = msa_ ## func ## _df(df, pws->b[5], pwt->b[5]);
\
> > + pwd->b[6] = msa_ ## func ## _df(df, pws->b[6], pwt->b[6]);
\
> > + pwd->b[7] = msa_ ## func ## _df(df, pws->b[7], pwt->b[7]);
\
> > + pwd->b[8] = msa_ ## func ## _df(df, pws->b[8], pwt->b[8]);
\
> > + pwd->b[9] = msa_ ## func ## _df(df, pws->b[9], pwt->b[9]);
\
> > + pwd->b[10] = msa_ ## func ## _df(df, pws->b[10], pwt->b[10]);
\
> > + pwd->b[11] = msa_ ## func ## _df(df, pws->b[11], pwt->b[11]);
\
> > + pwd->b[12] = msa_ ## func ## _df(df, pws->b[12], pwt->b[12]);
\
> > + pwd->b[13] = msa_ ## func ## _df(df, pws->b[13], pwt->b[13]);
\
> > + pwd->b[14] = msa_ ## func ## _df(df, pws->b[14], pwt->b[14]);
\
> > + pwd->b[15] = msa_ ## func ## _df(df, pws->b[15], pwt->b[15]);
\
> > break;
\
> > case DF_HALF:
\
> > - for (i = 0; i < DF_ELEMENTS(DF_HALF); i++) {
\
> > - pwd->h[i] = msa_ ## func ## _df(df, pws->h[i],
pwt->h[i]); \
> > - }
\
> > + pwd->h[0] = msa_ ## func ## _df(df, pws->h[0], pwt->h[0]);
\
> > + pwd->h[1] = msa_ ## func ## _df(df, pws->h[1], pwt->h[1]);
\
> > + pwd->h[2] = msa_ ## func ## _df(df, pws->h[2], pwt->h[2]);
\
> > + pwd->h[3] = msa_ ## func ## _df(df, pws->h[3], pwt->h[3]);
\
> > + pwd->h[4] = msa_ ## func ## _df(df, pws->h[4], pwt->h[4]);
\
> > + pwd->h[5] = msa_ ## func ## _df(df, pws->h[5], pwt->h[5]);
\
> > + pwd->h[6] = msa_ ## func ## _df(df, pws->h[6], pwt->h[6]);
\
> > + pwd->h[7] = msa_ ## func ## _df(df, pws->h[7], pwt->h[7]);
\
> > break;
\
> > case DF_WORD:
\
> > - for (i = 0; i < DF_ELEMENTS(DF_WORD); i++) {
\
> > - pwd->w[i] = msa_ ## func ## _df(df, pws->w[i],
pwt->w[i]); \
> > - }
\
> > + pwd->w[0] = msa_ ## func ## _df(df, pws->w[0], pwt->w[0]);
\
> > + pwd->w[1] = msa_ ## func ## _df(df, pws->w[1], pwt->w[1]);
\
> > + pwd->w[2] = msa_ ## func ## _df(df, pws->w[2], pwt->w[2]);
\
> > + pwd->w[3] = msa_ ## func ## _df(df, pws->w[3], pwt->w[3]);
\
> > break;
\
> > case DF_DOUBLE:
\
> > - for (i = 0; i < DF_ELEMENTS(DF_DOUBLE); i++) {
\
> > - pwd->d[i] = msa_ ## func ## _df(df, pws->d[i],
pwt->d[i]); \
> > - }
\
> > + pwd->d[0] = msa_ ## func ## _df(df, pws->d[0], pwt->d[0]);
\
> > + pwd->d[1] = msa_ ## func ## _df(df, pws->d[1], pwt->d[1]);
\
> > break;
\
> > default:
\
> > assert(0);
\
> > --
> > 2.7.4
> >
> >
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Qemu-devel] [PATCH 1/2] target/mips: Improve performance for MSA binary operations
2019-03-04 16:51 ` [Qemu-devel] [PATCH 1/2] " Mateja Marjanovic
2019-06-01 14:16 ` Aleksandar Markovic
@ 2019-06-02 13:22 ` Alex Bennée
2019-06-03 13:10 ` Aleksandar Markovic
1 sibling, 1 reply; 10+ messages in thread
From: Alex Bennée @ 2019-06-02 13:22 UTC (permalink / raw)
To: qemu-devel; +Cc: arikalo, aurelien, amarkovic
Mateja Marjanovic <mateja.marjanovic@rt-rk.com> writes:
> From: Mateja Marjanovic <Mateja.Marjanovic@rt-rk.com>
>
> Eliminate loops for better performance.
Have you done any measurements of the bellow loop unrolling? Because
this is something that maybe we can achieve and let the compiler make
the choice.
>
> Signed-off-by: Mateja Marjanovic <mateja.marjanovic@rt-rk.com>
> ---
> target/mips/msa_helper.c | 43 ++++++++++++++++++++++++++++++-------------
> 1 file changed, 30 insertions(+), 13 deletions(-)
>
> diff --git a/target/mips/msa_helper.c b/target/mips/msa_helper.c
> index 4c7ec05..1152fda 100644
> --- a/target/mips/msa_helper.c
> +++ b/target/mips/msa_helper.c
> @@ -804,28 +804,45 @@ void helper_msa_ ## func ## _df(CPUMIPSState *env, uint32_t df, \
> wr_t *pwd = &(env->active_fpu.fpr[wd].wr); \
> wr_t *pws = &(env->active_fpu.fpr[ws].wr); \
> wr_t *pwt = &(env->active_fpu.fpr[wt].wr);
> \
If we can ensure alignment for the various vector registers then the
compiler always has the option of using host vectors (certainly for int
and logic operations).
> - uint32_t i; \
> \
> switch (df) { \
> case DF_BYTE: \
> - for (i = 0; i < DF_ELEMENTS(DF_BYTE); i++) { \
> - pwd->b[i] = msa_ ## func ## _df(df, pws->b[i], pwt->b[i]); \
> - } \
> + pwd->b[0] = msa_ ## func ## _df(df, pws->b[0], pwt->b[0]); \
> + pwd->b[1] = msa_ ## func ## _df(df, pws->b[1], pwt->b[1]); \
> + pwd->b[2] = msa_ ## func ## _df(df, pws->b[2], pwt->b[2]); \
> + pwd->b[3] = msa_ ## func ## _df(df, pws->b[3], pwt->b[3]); \
> + pwd->b[4] = msa_ ## func ## _df(df, pws->b[4], pwt->b[4]); \
> + pwd->b[5] = msa_ ## func ## _df(df, pws->b[5], pwt->b[5]); \
> + pwd->b[6] = msa_ ## func ## _df(df, pws->b[6], pwt->b[6]); \
> + pwd->b[7] = msa_ ## func ## _df(df, pws->b[7], pwt->b[7]); \
> + pwd->b[8] = msa_ ## func ## _df(df, pws->b[8], pwt->b[8]); \
> + pwd->b[9] = msa_ ## func ## _df(df, pws->b[9], pwt->b[9]); \
> + pwd->b[10] = msa_ ## func ## _df(df, pws->b[10], pwt->b[10]); \
> + pwd->b[11] = msa_ ## func ## _df(df, pws->b[11], pwt->b[11]); \
> + pwd->b[12] = msa_ ## func ## _df(df, pws->b[12], pwt->b[12]); \
> + pwd->b[13] = msa_ ## func ## _df(df, pws->b[13], pwt->b[13]); \
> + pwd->b[14] = msa_ ## func ## _df(df, pws->b[14], pwt->b[14]); \
> + pwd->b[15] = msa_ ## func ## _df(df, pws->b[15], pwt->b[15]); \
> break; \
> case DF_HALF: \
> - for (i = 0; i < DF_ELEMENTS(DF_HALF); i++) { \
> - pwd->h[i] = msa_ ## func ## _df(df, pws->h[i], pwt->h[i]); \
> - } \
> + pwd->h[0] = msa_ ## func ## _df(df, pws->h[0], pwt->h[0]); \
> + pwd->h[1] = msa_ ## func ## _df(df, pws->h[1], pwt->h[1]); \
> + pwd->h[2] = msa_ ## func ## _df(df, pws->h[2], pwt->h[2]); \
> + pwd->h[3] = msa_ ## func ## _df(df, pws->h[3], pwt->h[3]); \
> + pwd->h[4] = msa_ ## func ## _df(df, pws->h[4], pwt->h[4]); \
> + pwd->h[5] = msa_ ## func ## _df(df, pws->h[5], pwt->h[5]); \
> + pwd->h[6] = msa_ ## func ## _df(df, pws->h[6], pwt->h[6]); \
> + pwd->h[7] = msa_ ## func ## _df(df, pws->h[7], pwt->h[7]); \
> break; \
> case DF_WORD: \
> - for (i = 0; i < DF_ELEMENTS(DF_WORD); i++) { \
> - pwd->w[i] = msa_ ## func ## _df(df, pws->w[i], pwt->w[i]); \
> - } \
> + pwd->w[0] = msa_ ## func ## _df(df, pws->w[0], pwt->w[0]); \
> + pwd->w[1] = msa_ ## func ## _df(df, pws->w[1], pwt->w[1]); \
> + pwd->w[2] = msa_ ## func ## _df(df, pws->w[2], pwt->w[2]); \
> + pwd->w[3] = msa_ ## func ## _df(df, pws->w[3], pwt->w[3]); \
> break; \
> case DF_DOUBLE: \
> - for (i = 0; i < DF_ELEMENTS(DF_DOUBLE); i++) { \
> - pwd->d[i] = msa_ ## func ## _df(df, pws->d[i], pwt->d[i]); \
> - } \
> + pwd->d[0] = msa_ ## func ## _df(df, pws->d[0], pwt->d[0]); \
> + pwd->d[1] = msa_ ## func ## _df(df, pws->d[1], pwt->d[1]); \
> break; \
> default: \
> assert(0); \
--
Alex Bennée
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Qemu-devel] [PATCH 1/2] target/mips: Improve performance for MSA binary operations
2019-06-02 7:06 ` Aleksandar Markovic
@ 2019-06-03 9:46 ` Mateja Marjanovic
0 siblings, 0 replies; 10+ messages in thread
From: Mateja Marjanovic @ 2019-06-03 9:46 UTC (permalink / raw)
To: Aleksandar Markovic, Aleksandar Markovic
Cc: Aleksandar Rikalo, qemu-devel, aurelien
On 2.6.19. 09:06, Aleksandar Markovic wrote:
>
>
> On Jun 1, 2019 4:16 PM, "Aleksandar Markovic" <amarkovic@wavecomp.com
> <mailto:amarkovic@wavecomp.com>> wrote:
> >
> > > From: Mateja Marjanovic <mateja.marjanovic@rt-rk.com
> <mailto:mateja.marjanovic@rt-rk.com>>
> > > Sent: Monday, March 4, 2019 5:51 PM
> > > To: qemu-devel@nongnu.org <mailto:qemu-devel@nongnu.org>
> > > Cc: aurelien@aurel32.net <mailto:aurelien@aurel32.net>; Aleksandar
> Markovic; Aleksandar Rikalo
> > > Subject: [PATCH 1/2] target/mips: Improve performance for MSA
> binary operations
> > >
> > > From: Mateja Marjanovic <Mateja.Marjanovic@rt-rk.com
> <mailto:Mateja.Marjanovic@rt-rk.com>>
> > >
> > > Eliminate loops for better performance.
> > >
> > > Signed-off-by: Mateja Marjanovic <mateja.marjanovic@rt-rk.com
> <mailto:mateja.marjanovic@rt-rk.com>>
> > > ---
> > > target/mips/msa_helper.c | 43
> ++++++++++++++++++++++++++++++-------------
> > > 1 file changed, 30 insertions(+), 13 deletions(-)
> > >
> >
> > The commit message should be a little bit more informative - for
> example,
> > it could list the affected instructions. Please consider other groups of
> > MSA instructions that are implemented via helpers that use similar "for"
> > loops. Otherwise:
> >
> > Reviewed-by: Aleksandar Markovic <amarkovic@wavecomp.com
> <mailto:amarkovic@wavecomp.com>>
> >
>
> Mateja, you don't need to do anything regarding this patch, I am going
> to fix the issues while appying.
>
Alright, thanks. :)
Regards,
Mateja
>
> Thanks, Aleksandar
>
> > > diff --git a/target/mips/msa_helper.c b/target/mips/msa_helper.c
> > > index 4c7ec05..1152fda 100644
> > > --- a/target/mips/msa_helper.c
> > > +++ b/target/mips/msa_helper.c
> > > @@ -804,28 +804,45 @@ void helper_msa_ ## func ## _df(CPUMIPSState
> *env, uint32_t > df, \
> > > wr_t *pwd = &(env->active_fpu.fpr[wd].wr);
> \
> > > wr_t *pws = &(env->active_fpu.fpr[ws].wr);
> \
> > > wr_t *pwt = &(env->active_fpu.fpr[wt].wr);
> \
> > > - uint32_t i; \
> > > \
> > > switch (df) { \
> > > case DF_BYTE: \
> > > - for (i = 0; i < DF_ELEMENTS(DF_BYTE); i++) {
> \
> > > - pwd->b[i] = msa_ ## func ## _df(df, pws->b[i],
> pwt->b[i]); \
> > > - } \
> > > + pwd->b[0] = msa_ ## func ## _df(df, pws->b[0],
> pwt->b[0]); \
> > > + pwd->b[1] = msa_ ## func ## _df(df, pws->b[1],
> pwt->b[1]); \
> > > + pwd->b[2] = msa_ ## func ## _df(df, pws->b[2],
> pwt->b[2]); \
> > > + pwd->b[3] = msa_ ## func ## _df(df, pws->b[3],
> pwt->b[3]); \
> > > + pwd->b[4] = msa_ ## func ## _df(df, pws->b[4],
> pwt->b[4]); \
> > > + pwd->b[5] = msa_ ## func ## _df(df, pws->b[5],
> pwt->b[5]); \
> > > + pwd->b[6] = msa_ ## func ## _df(df, pws->b[6],
> pwt->b[6]); \
> > > + pwd->b[7] = msa_ ## func ## _df(df, pws->b[7],
> pwt->b[7]); \
> > > + pwd->b[8] = msa_ ## func ## _df(df, pws->b[8],
> pwt->b[8]); \
> > > + pwd->b[9] = msa_ ## func ## _df(df, pws->b[9],
> pwt->b[9]); \
> > > + pwd->b[10] = msa_ ## func ## _df(df, pws->b[10],
> pwt->b[10]); \
> > > + pwd->b[11] = msa_ ## func ## _df(df, pws->b[11],
> pwt->b[11]); \
> > > + pwd->b[12] = msa_ ## func ## _df(df, pws->b[12],
> pwt->b[12]); \
> > > + pwd->b[13] = msa_ ## func ## _df(df, pws->b[13],
> pwt->b[13]); \
> > > + pwd->b[14] = msa_ ## func ## _df(df, pws->b[14],
> pwt->b[14]); \
> > > + pwd->b[15] = msa_ ## func ## _df(df, pws->b[15],
> pwt->b[15]); \
> > > break; \
> > > case DF_HALF: \
> > > - for (i = 0; i < DF_ELEMENTS(DF_HALF); i++) {
> \
> > > - pwd->h[i] = msa_ ## func ## _df(df, pws->h[i],
> pwt->h[i]); \
> > > - } \
> > > + pwd->h[0] = msa_ ## func ## _df(df, pws->h[0],
> pwt->h[0]); \
> > > + pwd->h[1] = msa_ ## func ## _df(df, pws->h[1],
> pwt->h[1]); \
> > > + pwd->h[2] = msa_ ## func ## _df(df, pws->h[2],
> pwt->h[2]); \
> > > + pwd->h[3] = msa_ ## func ## _df(df, pws->h[3],
> pwt->h[3]); \
> > > + pwd->h[4] = msa_ ## func ## _df(df, pws->h[4],
> pwt->h[4]); \
> > > + pwd->h[5] = msa_ ## func ## _df(df, pws->h[5],
> pwt->h[5]); \
> > > + pwd->h[6] = msa_ ## func ## _df(df, pws->h[6],
> pwt->h[6]); \
> > > + pwd->h[7] = msa_ ## func ## _df(df, pws->h[7],
> pwt->h[7]); \
> > > break; \
> > > case DF_WORD: \
> > > - for (i = 0; i < DF_ELEMENTS(DF_WORD); i++) {
> \
> > > - pwd->w[i] = msa_ ## func ## _df(df, pws->w[i],
> pwt->w[i]); \
> > > - } \
> > > + pwd->w[0] = msa_ ## func ## _df(df, pws->w[0],
> pwt->w[0]); \
> > > + pwd->w[1] = msa_ ## func ## _df(df, pws->w[1],
> pwt->w[1]); \
> > > + pwd->w[2] = msa_ ## func ## _df(df, pws->w[2],
> pwt->w[2]); \
> > > + pwd->w[3] = msa_ ## func ## _df(df, pws->w[3],
> pwt->w[3]); \
> > > break; \
> > > case DF_DOUBLE: \
> > > - for (i = 0; i < DF_ELEMENTS(DF_DOUBLE); i++) {
> \
> > > - pwd->d[i] = msa_ ## func ## _df(df, pws->d[i],
> pwt->d[i]); \
> > > - } \
> > > + pwd->d[0] = msa_ ## func ## _df(df, pws->d[0],
> pwt->d[0]); \
> > > + pwd->d[1] = msa_ ## func ## _df(df, pws->d[1],
> pwt->d[1]); \
> > > break; \
> > > default: \
> > > assert(0); \
> > > --
> > > 2.7.4
> > >
> > >
>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Qemu-devel] [PATCH 1/2] target/mips: Improve performance for MSA binary operations
2019-06-02 13:22 ` Alex Bennée
@ 2019-06-03 13:10 ` Aleksandar Markovic
2019-06-03 13:29 ` Mateja Marjanovic
0 siblings, 1 reply; 10+ messages in thread
From: Aleksandar Markovic @ 2019-06-03 13:10 UTC (permalink / raw)
To: Alex Bennée, qemu-devel, Mateja Marjanovic
Cc: Aleksandar Rikalo, aurelien
> From: Alex Bennée <alex.bennee@linaro.org>
> Sent: Sunday, June 2, 2019 3:22 PM
> To: qemu-devel@nongnu.org
> Cc: Aleksandar Rikalo; Aleksandar Markovic; aurelien@aurel32.net
> Subject: Re: [Qemu-devel] [PATCH 1/2] target/mips: Improve performance for MSA binary operations
> Mateja Marjanovic <mateja.marjanovic@rt-rk.com> writes:
> > From: Mateja Marjanovic <Mateja.Marjanovic@rt-rk.com>
> >
> > Eliminate loops for better performance.
> Have you done any measurements of the bellow loop unrolling? Because
> this is something that maybe we can achieve and let the compiler make
> the choice.
I know that Mateja did extensive performance measurements, and I am
asking him to give us some samples.
As for code generation, here are disassemblies of function
helper_msa_add_a_df() before and after this patch:
(it is visible the compiler did not perform unrolling loops by itself)
BEFORE:
Dump of assembler code for function helper_msa_add_a_df:
0x00000000001500b0 <+0>: cmp $0x1,%esi
0x00000000001500b3 <+3>: je 0x150258 <helper_msa_add_a_df+424>
0x00000000001500b9 <+9>: jb 0x1501e8 <helper_msa_add_a_df+312>
0x00000000001500bf <+15>: cmp $0x2,%esi
0x00000000001500c2 <+18>: je 0x150180 <helper_msa_add_a_df+208>
0x00000000001500c8 <+24>: cmp $0x3,%esi
0x00000000001500cb <+27>: jne 0x1502c2 <helper_msa_add_a_df+530>
0x00000000001500d1 <+33>: mov %ecx,%ecx
0x00000000001500d3 <+35>: mov %edx,%edx
0x00000000001500d5 <+37>: lea 0x22(%rcx),%rax
0x00000000001500d9 <+41>: lea 0x22(%rdx),%r10
0x00000000001500dd <+45>: shl $0x4,%rcx
0x00000000001500e1 <+49>: add %rdi,%rcx
0x00000000001500e4 <+52>: shl $0x4,%rdx
0x00000000001500e8 <+56>: shl $0x4,%rax
0x00000000001500ec <+60>: shl $0x4,%r10
0x00000000001500f0 <+64>: add %rdi,%rax
0x00000000001500f3 <+67>: mov 0x8(%rax),%r9
0x00000000001500f7 <+71>: mov 0x8(%rax),%rsi
0x00000000001500fb <+75>: mov %r8d,%eax
0x00000000001500fe <+78>: sar $0x3f,%r9
0x0000000000150102 <+82>: xor %r9,%rsi
0x0000000000150105 <+85>: sub %r9,%rsi
0x0000000000150108 <+88>: mov %rsi,%r9
0x000000000015010b <+91>: lea 0x22(%rax),%rsi
0x000000000015010f <+95>: shl $0x4,%rax
0x0000000000150113 <+99>: lea (%rdi,%rax,1),%rax
0x0000000000150117 <+103>: shl $0x4,%rsi
0x000000000015011b <+107>: add %rdi,%rsi
0x000000000015011e <+110>: mov 0x8(%rsi),%r8
0x0000000000150122 <+114>: mov 0x8(%rsi),%r11
0x0000000000150126 <+118>: sar $0x3f,%r8
0x000000000015012a <+122>: xor %r8,%r11
0x000000000015012d <+125>: mov %r11,%rsi
0x0000000000150130 <+128>: sub %r8,%rsi
0x0000000000150133 <+131>: add %r9,%rsi
0x0000000000150136 <+134>: mov %rsi,0x8(%rdi,%r10,1)
0x000000000015013b <+139>: mov 0x230(%rcx),%rsi
0x0000000000150142 <+146>: mov 0x230(%rcx),%r8
0x0000000000150149 <+153>: sar $0x3f,%rsi
0x000000000015014d <+157>: xor %rsi,%r8
0x0000000000150150 <+160>: mov %r8,%rcx
0x0000000000150153 <+163>: mov 0x230(%rax),%r8
0x000000000015015a <+170>: sub %rsi,%rcx
0x000000000015015d <+173>: mov 0x230(%rax),%rsi
0x0000000000150164 <+180>: sar $0x3f,%rsi
0x0000000000150168 <+184>: xor %rsi,%r8
0x000000000015016b <+187>: mov %r8,%rax
0x000000000015016e <+190>: sub %rsi,%rax
0x0000000000150171 <+193>: add %rcx,%rax
0x0000000000150174 <+196>: mov %rax,0x230(%rdi,%rdx,1)
0x000000000015017c <+204>: retq
0x000000000015017d <+205>: nopl (%rax)
0x0000000000150180 <+208>: mov %r8d,%r8d
0x0000000000150183 <+211>: mov %ecx,%ecx
0x0000000000150185 <+213>: mov %edx,%edx
0x0000000000150187 <+215>: mov %r8,%rax
0x000000000015018a <+218>: neg %r8
0x000000000015018d <+221>: shl $0x4,%rcx
0x0000000000150191 <+225>: shl $0x4,%rax
0x0000000000150195 <+229>: shl $0x4,%r8
0x0000000000150199 <+233>: shl $0x4,%rdx
0x000000000015019d <+237>: lea 0x228(%rdi,%rax,1),%r9
0x00000000001501a5 <+245>: lea 0x238(%rdi,%rax,1),%rdi
0x00000000001501ad <+253>: lea (%r9,%r8,1),%r10
0x00000000001501b1 <+257>: add $0x4,%r9
0x00000000001501b5 <+261>: movslq (%r10,%rcx,1),%rax
0x00000000001501b9 <+265>: mov %rax,%rsi
0x00000000001501bc <+268>: sar $0x3f,%rsi
0x00000000001501c0 <+272>: xor %rsi,%rax
0x00000000001501c3 <+275>: sub %rsi,%rax
0x00000000001501c6 <+278>: movslq -0x4(%r9),%rsi
0x00000000001501ca <+282>: mov %rsi,%r11
0x00000000001501cd <+285>: sar $0x3f,%r11
0x00000000001501d1 <+289>: xor %r11,%rsi
0x00000000001501d4 <+292>: sub %r11,%rsi
0x00000000001501d7 <+295>: add %rsi,%rax
0x00000000001501da <+298>: cmp %rdi,%r9
0x00000000001501dd <+301>: mov %eax,(%r10,%rdx,1)
0x00000000001501e1 <+305>: jne 0x1501ad <helper_msa_add_a_df+253>
0x00000000001501e3 <+307>: repz retq
0x00000000001501e5 <+309>: nopl (%rax)
0x00000000001501e8 <+312>: mov %r8d,%r8d
0x00000000001501eb <+315>: mov %ecx,%ecx
0x00000000001501ed <+317>: mov %edx,%edx
0x00000000001501ef <+319>: mov %r8,%rax
0x00000000001501f2 <+322>: neg %r8
0x00000000001501f5 <+325>: shl $0x4,%rcx
0x00000000001501f9 <+329>: shl $0x4,%rax
0x00000000001501fd <+333>: shl $0x4,%r8
0x0000000000150201 <+337>: shl $0x4,%rdx
0x0000000000150205 <+341>: lea 0x228(%rdi,%rax,1),%r9
0x000000000015020d <+349>: lea 0x238(%rdi,%rax,1),%r11
0x0000000000150215 <+357>: nopl (%rax)
0x0000000000150218 <+360>: lea (%r8,%r9,1),%rdi
0x000000000015021c <+364>: add $0x1,%r9
0x0000000000150220 <+368>: movsbq (%rdi,%rcx,1),%rax
0x0000000000150225 <+373>: mov %rax,%rsi
0x0000000000150228 <+376>: sar $0x3f,%rsi
0x000000000015022c <+380>: xor %rsi,%rax
0x000000000015022f <+383>: sub %rsi,%rax
0x0000000000150232 <+386>: movsbq -0x1(%r9),%rsi
0x0000000000150237 <+391>: mov %rsi,%r10
0x000000000015023a <+394>: sar $0x3f,%r10
0x000000000015023e <+398>: xor %r10,%rsi
0x0000000000150241 <+401>: sub %r10,%rsi
0x0000000000150244 <+404>: add %rsi,%rax
0x0000000000150247 <+407>: cmp %r9,%r11
0x000000000015024a <+410>: mov %al,(%rdi,%rdx,1)
0x000000000015024d <+413>: jne 0x150218 <helper_msa_add_a_df+360>
0x000000000015024f <+415>: repz retq
0x0000000000150251 <+417>: nopl 0x0(%rax)
0x0000000000150258 <+424>: mov %r8d,%r8d
0x000000000015025b <+427>: mov %ecx,%ecx
0x000000000015025d <+429>: mov %edx,%edx
0x000000000015025f <+431>: mov %r8,%rax
0x0000000000150262 <+434>: neg %r8
0x0000000000150265 <+437>: shl $0x4,%rcx
0x0000000000150269 <+441>: shl $0x4,%rax
0x000000000015026d <+445>: shl $0x4,%r8
0x0000000000150271 <+449>: shl $0x4,%rdx
0x0000000000150275 <+453>: lea 0x228(%rdi,%rax,1),%r9
0x000000000015027d <+461>: lea 0x238(%rdi,%rax,1),%r10
0x0000000000150285 <+469>: nopl (%rax)
0x0000000000150288 <+472>: lea (%r8,%r9,1),%rdi
0x000000000015028c <+476>: add $0x2,%r9
0x0000000000150290 <+480>: movswq (%rdi,%rcx,1),%rax
0x0000000000150295 <+485>: mov %rax,%rsi
0x0000000000150298 <+488>: sar $0x3f,%rsi
0x000000000015029c <+492>: xor %rsi,%rax
0x000000000015029f <+495>: sub %rsi,%rax
0x00000000001502a2 <+498>: movswq -0x2(%r9),%rsi
0x00000000001502a7 <+503>: mov %rsi,%r11
0x00000000001502aa <+506>: sar $0x3f,%r11
0x00000000001502ae <+510>: xor %r11,%rsi
0x00000000001502b1 <+513>: sub %r11,%rsi
0x00000000001502b4 <+516>: add %rsi,%rax
0x00000000001502b7 <+519>: cmp %r10,%r9
0x00000000001502ba <+522>: mov %ax,(%rdi,%rdx,1)
0x00000000001502be <+526>: jne 0x150288 <helper_msa_add_a_df+472>
0x00000000001502c0 <+528>: repz retq
0x00000000001502c2 <+530>: lea 0x13c3b7(%rip),%rcx # 0x28c680 <__PRETTY_FUNCTION__.26062>
0x00000000001502c9 <+537>: lea 0x13b830(%rip),%rsi # 0x28bb00
0x00000000001502d0 <+544>: lea 0x1c7204(%rip),%rdi # 0x3174db
0x00000000001502d7 <+551>: sub $0x8,%rsp
0x00000000001502db <+555>: mov $0x357,%edx
0x00000000001502e0 <+560>: callq 0x8eeb8
End of assembler dump.
AFTER:
0x00000000001548d0 <+0>: cmp $0x1,%esi
0x00000000001548d3 <+3>: je 0x154e00 <helper_msa_add_a_df+1328>
0x00000000001548d9 <+9>: jb 0x154a98 <helper_msa_add_a_df+456>
0x00000000001548df <+15>: cmp $0x2,%esi
0x00000000001548e2 <+18>: je 0x1549a0 <helper_msa_add_a_df+208>
0x00000000001548e8 <+24>: cmp $0x3,%esi
0x00000000001548eb <+27>: jne 0x154fd1 <helper_msa_add_a_df+1793>
0x00000000001548f1 <+33>: mov %ecx,%eax
0x00000000001548f3 <+35>: mov %r8d,%r8d
0x00000000001548f6 <+38>: mov %edx,%edx
0x00000000001548f8 <+40>: lea 0x22(%rax),%rcx
0x00000000001548fc <+44>: lea 0x22(%rdx),%r9
0x0000000000154900 <+48>: shl $0x4,%rax
0x0000000000154904 <+52>: add %rdi,%rax
0x0000000000154907 <+55>: shl $0x4,%rdx
0x000000000015490b <+59>: shl $0x4,%rcx
0x000000000015490f <+63>: shl $0x4,%r9
0x0000000000154913 <+67>: add %rdi,%rcx
0x0000000000154916 <+70>: mov 0x8(%rcx),%rsi
0x000000000015491a <+74>: mov 0x8(%rcx),%r11
0x000000000015491e <+78>: sar $0x3f,%rsi
0x0000000000154922 <+82>: xor %rsi,%r11
0x0000000000154925 <+85>: mov %r11,%rcx
0x0000000000154928 <+88>: sub %rsi,%rcx
0x000000000015492b <+91>: mov %rcx,%rsi
0x000000000015492e <+94>: lea 0x22(%r8),%rcx
0x0000000000154932 <+98>: shl $0x4,%r8
0x0000000000154936 <+102>: add %rdi,%r8
0x0000000000154939 <+105>: shl $0x4,%rcx
0x000000000015493d <+109>: add %rdi,%rcx
0x0000000000154940 <+112>: mov 0x8(%rcx),%r10
0x0000000000154944 <+116>: mov 0x8(%rcx),%r11
0x0000000000154948 <+120>: sar $0x3f,%r10
0x000000000015494c <+124>: xor %r10,%r11
0x000000000015494f <+127>: mov %r11,%rcx
0x0000000000154952 <+130>: sub %r10,%rcx
0x0000000000154955 <+133>: add %rsi,%rcx
0x0000000000154958 <+136>: mov %rcx,0x8(%rdi,%r9,1)
0x000000000015495d <+141>: mov 0x230(%rax),%rcx
0x0000000000154964 <+148>: mov 0x230(%rax),%rsi
0x000000000015496b <+155>: sar $0x3f,%rcx
0x000000000015496f <+159>: xor %rcx,%rsi
0x0000000000154972 <+162>: mov %rsi,%rax
0x0000000000154975 <+165>: mov 0x230(%r8),%rsi
0x000000000015497c <+172>: sub %rcx,%rax
0x000000000015497f <+175>: mov %rax,%rcx
0x0000000000154982 <+178>: mov 0x230(%r8),%rax
0x0000000000154989 <+185>: sar $0x3f,%rsi
0x000000000015498d <+189>: xor %rsi,%rax
0x0000000000154990 <+192>: sub %rsi,%rax
0x0000000000154993 <+195>: add %rcx,%rax
0x0000000000154996 <+198>: mov %rax,0x230(%rdi,%rdx,1)
0x000000000015499e <+206>: retq
0x000000000015499f <+207>: nop
0x00000000001549a0 <+208>: mov %ecx,%ecx
0x00000000001549a2 <+210>: mov %r8d,%r8d
0x00000000001549a5 <+213>: mov %edx,%edx
0x00000000001549a7 <+215>: lea 0x22(%rcx),%rax
0x00000000001549ab <+219>: lea 0x22(%rdx),%r9
0x00000000001549af <+223>: shl $0x4,%rcx
0x00000000001549b3 <+227>: add %rdi,%rcx
0x00000000001549b6 <+230>: shl $0x4,%rdx
0x00000000001549ba <+234>: shl $0x4,%rax
0x00000000001549be <+238>: shl $0x4,%r9
0x00000000001549c2 <+242>: add %rdi,%rdx
0x00000000001549c5 <+245>: movslq 0x8(%rdi,%rax,1),%rax
0x00000000001549ca <+250>: mov %rax,%rsi
0x00000000001549cd <+253>: sar $0x3f,%rsi
0x00000000001549d1 <+257>: xor %rsi,%rax
0x00000000001549d4 <+260>: sub %rsi,%rax
0x00000000001549d7 <+263>: lea 0x22(%r8),%rsi
0x00000000001549db <+267>: shl $0x4,%r8
0x00000000001549df <+271>: shl $0x4,%rsi
0x00000000001549e3 <+275>: movslq 0x8(%rdi,%rsi,1),%rsi
0x00000000001549e8 <+280>: mov %rsi,%r10
0x00000000001549eb <+283>: sar $0x3f,%r10
0x00000000001549ef <+287>: xor %r10,%rsi
0x00000000001549f2 <+290>: sub %r10,%rsi
0x00000000001549f5 <+293>: add %rsi,%rax
0x00000000001549f8 <+296>: mov %eax,0x8(%rdi,%r9,1)
0x00000000001549fd <+301>: movslq 0x22c(%rcx),%rax
0x0000000000154a04 <+308>: add %r8,%rdi
0x0000000000154a07 <+311>: mov %rax,%rsi
0x0000000000154a0a <+314>: sar $0x3f,%rsi
0x0000000000154a0e <+318>: xor %rsi,%rax
0x0000000000154a11 <+321>: sub %rsi,%rax
0x0000000000154a14 <+324>: movslq 0x22c(%rdi),%rsi
0x0000000000154a1b <+331>: mov %rsi,%r8
0x0000000000154a1e <+334>: sar $0x3f,%r8
0x0000000000154a22 <+338>: xor %r8,%rsi
0x0000000000154a25 <+341>: sub %r8,%rsi
0x0000000000154a28 <+344>: add %rsi,%rax
0x0000000000154a2b <+347>: mov %eax,0x22c(%rdx)
0x0000000000154a31 <+353>: movslq 0x230(%rcx),%rax
0x0000000000154a38 <+360>: mov %rax,%rsi
0x0000000000154a3b <+363>: sar $0x3f,%rsi
0x0000000000154a3f <+367>: xor %rsi,%rax
0x0000000000154a42 <+370>: sub %rsi,%rax
0x0000000000154a45 <+373>: movslq 0x230(%rdi),%rsi
0x0000000000154a4c <+380>: mov %rsi,%r8
0x0000000000154a4f <+383>: sar $0x3f,%r8
0x0000000000154a53 <+387>: xor %r8,%rsi
0x0000000000154a56 <+390>: sub %r8,%rsi
0x0000000000154a59 <+393>: add %rsi,%rax
0x0000000000154a5c <+396>: mov %eax,0x230(%rdx)
0x0000000000154a62 <+402>: movslq 0x234(%rcx),%rax
0x0000000000154a69 <+409>: mov %rax,%rcx
0x0000000000154a6c <+412>: sar $0x3f,%rcx
0x0000000000154a70 <+416>: xor %rcx,%rax
0x0000000000154a73 <+419>: sub %rcx,%rax
0x0000000000154a76 <+422>: movslq 0x234(%rdi),%rcx
0x0000000000154a7d <+429>: mov %rcx,%rsi
0x0000000000154a80 <+432>: sar $0x3f,%rsi
0x0000000000154a84 <+436>: xor %rsi,%rcx
0x0000000000154a87 <+439>: sub %rsi,%rcx
0x0000000000154a8a <+442>: add %rcx,%rax
0x0000000000154a8d <+445>: mov %eax,0x234(%rdx)
0x0000000000154a93 <+451>: retq
0x0000000000154a94 <+452>: nopl 0x0(%rax)
0x0000000000154a98 <+456>: mov %ecx,%eax
0x0000000000154a9a <+458>: mov %r8d,%r8d
0x0000000000154a9d <+461>: mov %edx,%edx
0x0000000000154a9f <+463>: lea 0x22(%rax),%rcx
0x0000000000154aa3 <+467>: lea 0x22(%rdx),%r9
0x0000000000154aa7 <+471>: shl $0x4,%rax
0x0000000000154aab <+475>: lea (%rdi,%rax,1),%rax
0x0000000000154aaf <+479>: shl $0x4,%rdx
0x0000000000154ab3 <+483>: shl $0x4,%rcx
0x0000000000154ab7 <+487>: shl $0x4,%r9
0x0000000000154abb <+491>: add %rdi,%rdx
0x0000000000154abe <+494>: movsbq 0x8(%rdi,%rcx,1),%rsi
0x0000000000154ac4 <+500>: mov %rsi,%rcx
0x0000000000154ac7 <+503>: sar $0x3f,%rcx
0x0000000000154acb <+507>: xor %rcx,%rsi
0x0000000000154ace <+510>: sub %rcx,%rsi
0x0000000000154ad1 <+513>: lea 0x22(%r8),%rcx
0x0000000000154ad5 <+517>: shl $0x4,%r8
0x0000000000154ad9 <+521>: shl $0x4,%rcx
0x0000000000154add <+525>: movsbq 0x8(%rdi,%rcx,1),%rcx
0x0000000000154ae3 <+531>: mov %rcx,%r10
0x0000000000154ae6 <+534>: sar $0x3f,%r10
0x0000000000154aea <+538>: xor %r10,%rcx
0x0000000000154aed <+541>: sub %r10,%rcx
0x0000000000154af0 <+544>: add %rcx,%rsi
0x0000000000154af3 <+547>: mov %sil,0x8(%rdi,%r9,1)
0x0000000000154af8 <+552>: movsbq 0x229(%rax),%rcx
0x0000000000154b00 <+560>: add %r8,%rdi
0x0000000000154b03 <+563>: mov %rcx,%rsi
0x0000000000154b06 <+566>: sar $0x3f,%rsi
0x0000000000154b0a <+570>: xor %rsi,%rcx
0x0000000000154b0d <+573>: sub %rsi,%rcx
0x0000000000154b10 <+576>: movsbq 0x229(%rdi),%rsi
0x0000000000154b18 <+584>: mov %rsi,%r8
0x0000000000154b1b <+587>: sar $0x3f,%r8
0x0000000000154b1f <+591>: xor %r8,%rsi
0x0000000000154b22 <+594>: sub %r8,%rsi
0x0000000000154b25 <+597>: add %rsi,%rcx
0x0000000000154b28 <+600>: mov %cl,0x229(%rdx)
0x0000000000154b2e <+606>: movsbq 0x22a(%rax),%rcx
0x0000000000154b36 <+614>: mov %rcx,%rsi
0x0000000000154b39 <+617>: sar $0x3f,%rsi
0x0000000000154b3d <+621>: xor %rsi,%rcx
0x0000000000154b40 <+624>: sub %rsi,%rcx
0x0000000000154b43 <+627>: movsbq 0x22a(%rdi),%rsi
0x0000000000154b4b <+635>: mov %rsi,%r8
0x0000000000154b4e <+638>: sar $0x3f,%r8
0x0000000000154b52 <+642>: xor %r8,%rsi
0x0000000000154b55 <+645>: sub %r8,%rsi
0x0000000000154b58 <+648>: add %rsi,%rcx
0x0000000000154b5b <+651>: mov %cl,0x22a(%rdx)
0x0000000000154b61 <+657>: movsbq 0x22b(%rax),%rcx
0x0000000000154b69 <+665>: mov %rcx,%rsi
0x0000000000154b6c <+668>: sar $0x3f,%rsi
0x0000000000154b70 <+672>: xor %rsi,%rcx
0x0000000000154b73 <+675>: sub %rsi,%rcx
0x0000000000154b76 <+678>: movsbq 0x22b(%rdi),%rsi
0x0000000000154b7e <+686>: mov %rsi,%r8
0x0000000000154b81 <+689>: sar $0x3f,%r8
0x0000000000154b85 <+693>: xor %r8,%rsi
0x0000000000154b88 <+696>: sub %r8,%rsi
0x0000000000154b8b <+699>: add %rsi,%rcx
0x0000000000154b8e <+702>: mov %cl,0x22b(%rdx)
0x0000000000154b94 <+708>: movsbq 0x22c(%rax),%rcx
0x0000000000154b9c <+716>: mov %rcx,%rsi
0x0000000000154b9f <+719>: sar $0x3f,%rsi
0x0000000000154ba3 <+723>: xor %rsi,%rcx
0x0000000000154ba6 <+726>: sub %rsi,%rcx
0x0000000000154ba9 <+729>: movsbq 0x22c(%rdi),%rsi
0x0000000000154bb1 <+737>: mov %rsi,%r8
0x0000000000154bb4 <+740>: sar $0x3f,%r8
0x0000000000154bb8 <+744>: xor %r8,%rsi
0x0000000000154bbb <+747>: sub %r8,%rsi
0x0000000000154bbe <+750>: add %rsi,%rcx
0x0000000000154bc1 <+753>: mov %cl,0x22c(%rdx)
0x0000000000154bc7 <+759>: movsbq 0x22d(%rax),%rcx
0x0000000000154bcf <+767>: mov %rcx,%rsi
0x0000000000154bd2 <+770>: sar $0x3f,%rsi
0x0000000000154bd6 <+774>: xor %rsi,%rcx
0x0000000000154bd9 <+777>: sub %rsi,%rcx
0x0000000000154bdc <+780>: movsbq 0x22d(%rdi),%rsi
0x0000000000154be4 <+788>: mov %rsi,%r8
0x0000000000154be7 <+791>: sar $0x3f,%r8
0x0000000000154beb <+795>: xor %r8,%rsi
0x0000000000154bee <+798>: sub %r8,%rsi
0x0000000000154bf1 <+801>: add %rsi,%rcx
0x0000000000154bf4 <+804>: mov %cl,0x22d(%rdx)
0x0000000000154bfa <+810>: movsbq 0x22e(%rax),%rcx
0x0000000000154c02 <+818>: mov %rcx,%rsi
0x0000000000154c05 <+821>: sar $0x3f,%rsi
0x0000000000154c09 <+825>: xor %rsi,%rcx
0x0000000000154c0c <+828>: sub %rsi,%rcx
0x0000000000154c0f <+831>: movsbq 0x22e(%rdi),%rsi
0x0000000000154c17 <+839>: mov %rsi,%r8
0x0000000000154c1a <+842>: sar $0x3f,%r8
0x0000000000154c1e <+846>: xor %r8,%rsi
0x0000000000154c21 <+849>: sub %r8,%rsi
0x0000000000154c24 <+852>: add %rsi,%rcx
0x0000000000154c27 <+855>: mov %cl,0x22e(%rdx)
0x0000000000154c2d <+861>: movsbq 0x22f(%rax),%rcx
0x0000000000154c35 <+869>: mov %rcx,%rsi
0x0000000000154c38 <+872>: sar $0x3f,%rsi
0x0000000000154c3c <+876>: xor %rsi,%rcx
0x0000000000154c3f <+879>: sub %rsi,%rcx
0x0000000000154c42 <+882>: movsbq 0x22f(%rdi),%rsi
0x0000000000154c4a <+890>: mov %rsi,%r8
0x0000000000154c4d <+893>: sar $0x3f,%r8
0x0000000000154c51 <+897>: xor %r8,%rsi
0x0000000000154c54 <+900>: sub %r8,%rsi
0x0000000000154c57 <+903>: add %rsi,%rcx
0x0000000000154c5a <+906>: mov %cl,0x22f(%rdx)
0x0000000000154c60 <+912>: movsbq 0x230(%rax),%rcx
0x0000000000154c68 <+920>: mov %rcx,%rsi
0x0000000000154c6b <+923>: sar $0x3f,%rsi
0x0000000000154c6f <+927>: xor %rsi,%rcx
0x0000000000154c72 <+930>: sub %rsi,%rcx
0x0000000000154c75 <+933>: movsbq 0x230(%rdi),%rsi
0x0000000000154c7d <+941>: mov %rsi,%r8
0x0000000000154c80 <+944>: sar $0x3f,%r8
0x0000000000154c84 <+948>: xor %r8,%rsi
0x0000000000154c87 <+951>: sub %r8,%rsi
0x0000000000154c8a <+954>: add %rsi,%rcx
0x0000000000154c8d <+957>: mov %cl,0x230(%rdx)
0x0000000000154c93 <+963>: movsbq 0x231(%rax),%rcx
0x0000000000154c9b <+971>: mov %rcx,%rsi
0x0000000000154c9e <+974>: sar $0x3f,%rsi
0x0000000000154ca2 <+978>: xor %rsi,%rcx
0x0000000000154ca5 <+981>: sub %rsi,%rcx
0x0000000000154ca8 <+984>: movsbq 0x231(%rdi),%rsi
0x0000000000154cb0 <+992>: mov %rsi,%r8
0x0000000000154cb3 <+995>: sar $0x3f,%r8
0x0000000000154cb7 <+999>: xor %r8,%rsi
0x0000000000154cba <+1002>: sub %r8,%rsi
0x0000000000154cbd <+1005>: add %rsi,%rcx
0x0000000000154cc0 <+1008>: mov %cl,0x231(%rdx)
0x0000000000154cc6 <+1014>: movsbq 0x232(%rax),%rcx
0x0000000000154cce <+1022>: mov %rcx,%rsi
0x0000000000154cd1 <+1025>: sar $0x3f,%rsi
0x0000000000154cd5 <+1029>: xor %rsi,%rcx
0x0000000000154cd8 <+1032>: sub %rsi,%rcx
0x0000000000154cdb <+1035>: movsbq 0x232(%rdi),%rsi
0x0000000000154ce3 <+1043>: mov %rsi,%r8
0x0000000000154ce6 <+1046>: sar $0x3f,%r8
0x0000000000154cea <+1050>: xor %r8,%rsi
0x0000000000154ced <+1053>: sub %r8,%rsi
0x0000000000154cf0 <+1056>: add %rsi,%rcx
0x0000000000154cf3 <+1059>: mov %cl,0x232(%rdx)
0x0000000000154cf9 <+1065>: movsbq 0x233(%rdi),%rcx
0x0000000000154d01 <+1073>: mov %rcx,%rsi
0x0000000000154d04 <+1076>: sar $0x3f,%rsi
0x0000000000154d08 <+1080>: xor %rsi,%rcx
0x0000000000154d0b <+1083>: sub %rsi,%rcx
0x0000000000154d0e <+1086>: movsbq 0x233(%rax),%rsi
0x0000000000154d16 <+1094>: mov %rsi,%r8
0x0000000000154d19 <+1097>: sar $0x3f,%r8
0x0000000000154d1d <+1101>: xor %r8,%rsi
0x0000000000154d20 <+1104>: sub %r8,%rsi
0x0000000000154d23 <+1107>: add %rsi,%rcx
0x0000000000154d26 <+1110>: mov %cl,0x233(%rdx)
0x0000000000154d2c <+1116>: movsbq 0x234(%rdi),%rcx
0x0000000000154d34 <+1124>: mov %rcx,%rsi
0x0000000000154d37 <+1127>: sar $0x3f,%rsi
0x0000000000154d3b <+1131>: xor %rsi,%rcx
0x0000000000154d3e <+1134>: sub %rsi,%rcx
0x0000000000154d41 <+1137>: movsbq 0x234(%rax),%rsi
0x0000000000154d49 <+1145>: mov %rsi,%r8
0x0000000000154d4c <+1148>: sar $0x3f,%r8
0x0000000000154d50 <+1152>: xor %r8,%rsi
0x0000000000154d53 <+1155>: sub %r8,%rsi
0x0000000000154d56 <+1158>: add %rsi,%rcx
0x0000000000154d59 <+1161>: mov %cl,0x234(%rdx)
0x0000000000154d5f <+1167>: movsbq 0x235(%rax),%rcx
0x0000000000154d67 <+1175>: mov %rcx,%rsi
0x0000000000154d6a <+1178>: sar $0x3f,%rsi
0x0000000000154d6e <+1182>: xor %rsi,%rcx
0x0000000000154d71 <+1185>: sub %rsi,%rcx
0x0000000000154d74 <+1188>: movsbq 0x235(%rdi),%rsi
0x0000000000154d7c <+1196>: mov %rsi,%r8
0x0000000000154d7f <+1199>: sar $0x3f,%r8
0x0000000000154d83 <+1203>: xor %r8,%rsi
0x0000000000154d86 <+1206>: sub %r8,%rsi
0x0000000000154d89 <+1209>: add %rsi,%rcx
0x0000000000154d8c <+1212>: mov %cl,0x235(%rdx)
0x0000000000154d92 <+1218>: movsbq 0x236(%rdi),%rcx
0x0000000000154d9a <+1226>: mov %rcx,%rsi
0x0000000000154d9d <+1229>: sar $0x3f,%rsi
0x0000000000154da1 <+1233>: xor %rsi,%rcx
0x0000000000154da4 <+1236>: sub %rsi,%rcx
0x0000000000154da7 <+1239>: movsbq 0x236(%rax),%rsi
0x0000000000154daf <+1247>: mov %rsi,%r8
0x0000000000154db2 <+1250>: sar $0x3f,%r8
0x0000000000154db6 <+1254>: xor %r8,%rsi
0x0000000000154db9 <+1257>: sub %r8,%rsi
0x0000000000154dbc <+1260>: add %rsi,%rcx
0x0000000000154dbf <+1263>: mov %cl,0x236(%rdx)
0x0000000000154dc5 <+1269>: movsbq 0x237(%rax),%rax
0x0000000000154dcd <+1277>: mov %rax,%rcx
0x0000000000154dd0 <+1280>: sar $0x3f,%rcx
0x0000000000154dd4 <+1284>: xor %rcx,%rax
0x0000000000154dd7 <+1287>: sub %rcx,%rax
0x0000000000154dda <+1290>: movsbq 0x237(%rdi),%rcx
0x0000000000154de2 <+1298>: mov %rcx,%rsi
0x0000000000154de5 <+1301>: sar $0x3f,%rsi
0x0000000000154de9 <+1305>: xor %rsi,%rcx
0x0000000000154dec <+1308>: sub %rsi,%rcx
0x0000000000154def <+1311>: add %rcx,%rax
0x0000000000154df2 <+1314>: mov %al,0x237(%rdx)
0x0000000000154df8 <+1320>: retq
0x0000000000154df9 <+1321>: nopl 0x0(%rax)
0x0000000000154e00 <+1328>: mov %ecx,%eax
0x0000000000154e02 <+1330>: mov %r8d,%r8d
0x0000000000154e05 <+1333>: mov %edx,%edx
0x0000000000154e07 <+1335>: lea 0x22(%rax),%rcx
0x0000000000154e0b <+1339>: lea 0x22(%rdx),%r9
0x0000000000154e0f <+1343>: shl $0x4,%rax
0x0000000000154e13 <+1347>: lea (%rdi,%rax,1),%rax
0x0000000000154e17 <+1351>: shl $0x4,%rdx
0x0000000000154e1b <+1355>: shl $0x4,%rcx
0x0000000000154e1f <+1359>: shl $0x4,%r9
0x0000000000154e23 <+1363>: add %rdi,%rdx
0x0000000000154e26 <+1366>: movswq 0x8(%rdi,%rcx,1),%rsi
0x0000000000154e2c <+1372>: mov %rsi,%rcx
0x0000000000154e2f <+1375>: sar $0x3f,%rcx
0x0000000000154e33 <+1379>: xor %rcx,%rsi
0x0000000000154e36 <+1382>: sub %rcx,%rsi
0x0000000000154e39 <+1385>: lea 0x22(%r8),%rcx
0x0000000000154e3d <+1389>: shl $0x4,%r8
0x0000000000154e41 <+1393>: shl $0x4,%rcx
0x0000000000154e45 <+1397>: movswq 0x8(%rdi,%rcx,1),%rcx
0x0000000000154e4b <+1403>: mov %rcx,%r10
0x0000000000154e4e <+1406>: sar $0x3f,%r10
0x0000000000154e52 <+1410>: xor %r10,%rcx
0x0000000000154e55 <+1413>: sub %r10,%rcx
0x0000000000154e58 <+1416>: add %rcx,%rsi
0x0000000000154e5b <+1419>: mov %si,0x8(%rdi,%r9,1)
0x0000000000154e61 <+1425>: movswq 0x22a(%rax),%rcx
0x0000000000154e69 <+1433>: add %r8,%rdi
0x0000000000154e6c <+1436>: mov %rcx,%rsi
0x0000000000154e6f <+1439>: sar $0x3f,%rsi
0x0000000000154e73 <+1443>: xor %rsi,%rcx
0x0000000000154e76 <+1446>: sub %rsi,%rcx
0x0000000000154e79 <+1449>: movswq 0x22a(%rdi),%rsi
0x0000000000154e81 <+1457>: mov %rsi,%r8
0x0000000000154e84 <+1460>: sar $0x3f,%r8
0x0000000000154e88 <+1464>: xor %r8,%rsi
0x0000000000154e8b <+1467>: sub %r8,%rsi
0x0000000000154e8e <+1470>: add %rsi,%rcx
0x0000000000154e91 <+1473>: mov %cx,0x22a(%rdx)
0x0000000000154e98 <+1480>: movswq 0x22c(%rax),%rcx
0x0000000000154ea0 <+1488>: mov %rcx,%rsi
0x0000000000154ea3 <+1491>: sar $0x3f,%rsi
0x0000000000154ea7 <+1495>: xor %rsi,%rcx
0x0000000000154eaa <+1498>: sub %rsi,%rcx
0x0000000000154ead <+1501>: movswq 0x22c(%rdi),%rsi
0x0000000000154eb5 <+1509>: mov %rsi,%r8
0x0000000000154eb8 <+1512>: sar $0x3f,%r8
0x0000000000154ebc <+1516>: xor %r8,%rsi
0x0000000000154ebf <+1519>: sub %r8,%rsi
0x0000000000154ec2 <+1522>: add %rsi,%rcx
0x0000000000154ec5 <+1525>: mov %cx,0x22c(%rdx)
0x0000000000154ecc <+1532>: movswq 0x22e(%rax),%rcx
0x0000000000154ed4 <+1540>: mov %rcx,%rsi
0x0000000000154ed7 <+1543>: sar $0x3f,%rsi
0x0000000000154edb <+1547>: xor %rsi,%rcx
0x0000000000154ede <+1550>: sub %rsi,%rcx
0x0000000000154ee1 <+1553>: movswq 0x22e(%rdi),%rsi
0x0000000000154ee9 <+1561>: mov %rsi,%r8
0x0000000000154eec <+1564>: sar $0x3f,%r8
0x0000000000154ef0 <+1568>: xor %r8,%rsi
0x0000000000154ef3 <+1571>: sub %r8,%rsi
0x0000000000154ef6 <+1574>: add %rsi,%rcx
0x0000000000154ef9 <+1577>: mov %cx,0x22e(%rdx)
0x0000000000154f00 <+1584>: movswq 0x230(%rax),%rcx
0x0000000000154f08 <+1592>: mov %rcx,%rsi
0x0000000000154f0b <+1595>: sar $0x3f,%rsi
0x0000000000154f0f <+1599>: xor %rsi,%rcx
0x0000000000154f12 <+1602>: sub %rsi,%rcx
0x0000000000154f15 <+1605>: movswq 0x230(%rdi),%rsi
0x0000000000154f1d <+1613>: mov %rsi,%r8
0x0000000000154f20 <+1616>: sar $0x3f,%r8
0x0000000000154f24 <+1620>: xor %r8,%rsi
0x0000000000154f27 <+1623>: sub %r8,%rsi
0x0000000000154f2a <+1626>: add %rsi,%rcx
0x0000000000154f2d <+1629>: mov %cx,0x230(%rdx)
0x0000000000154f34 <+1636>: movswq 0x232(%rax),%rcx
0x0000000000154f3c <+1644>: mov %rcx,%rsi
0x0000000000154f3f <+1647>: sar $0x3f,%rsi
0x0000000000154f43 <+1651>: xor %rsi,%rcx
0x0000000000154f46 <+1654>: sub %rsi,%rcx
0x0000000000154f49 <+1657>: movswq 0x232(%rdi),%rsi
0x0000000000154f51 <+1665>: mov %rsi,%r8
0x0000000000154f54 <+1668>: sar $0x3f,%r8
0x0000000000154f58 <+1672>: xor %r8,%rsi
0x0000000000154f5b <+1675>: sub %r8,%rsi
0x0000000000154f5e <+1678>: add %rsi,%rcx
0x0000000000154f61 <+1681>: mov %cx,0x232(%rdx)
0x0000000000154f68 <+1688>: movswq 0x234(%rax),%rcx
0x0000000000154f70 <+1696>: mov %rcx,%rsi
0x0000000000154f73 <+1699>: sar $0x3f,%rsi
0x0000000000154f77 <+1703>: xor %rsi,%rcx
0x0000000000154f7a <+1706>: sub %rsi,%rcx
0x0000000000154f7d <+1709>: movswq 0x234(%rdi),%rsi
0x0000000000154f85 <+1717>: mov %rsi,%r8
0x0000000000154f88 <+1720>: sar $0x3f,%r8
0x0000000000154f8c <+1724>: xor %r8,%rsi
0x0000000000154f8f <+1727>: sub %r8,%rsi
0x0000000000154f92 <+1730>: add %rsi,%rcx
0x0000000000154f95 <+1733>: mov %cx,0x234(%rdx)
0x0000000000154f9c <+1740>: movswq 0x236(%rax),%rax
0x0000000000154fa4 <+1748>: mov %rax,%rcx
0x0000000000154fa7 <+1751>: sar $0x3f,%rcx
0x0000000000154fab <+1755>: xor %rcx,%rax
0x0000000000154fae <+1758>: sub %rcx,%rax
0x0000000000154fb1 <+1761>: movswq 0x236(%rdi),%rcx
0x0000000000154fb9 <+1769>: mov %rcx,%rsi
0x0000000000154fbc <+1772>: sar $0x3f,%rsi
0x0000000000154fc0 <+1776>: xor %rsi,%rcx
0x0000000000154fc3 <+1779>: sub %rsi,%rcx
0x0000000000154fc6 <+1782>: add %rcx,%rax
0x0000000000154fc9 <+1785>: mov %ax,0x236(%rdx)
0x0000000000154fd0 <+1792>: retq
0x0000000000154fd1 <+1793>: lea 0x14faa8(%rip),%rcx # 0x2a4a80 <__PRETTY_FUNCTION__.25843>
0x0000000000154fd8 <+1800>: lea 0x14ef81(%rip),%rsi # 0x2a3f60
0x0000000000154fdf <+1807>: lea 0x1da975(%rip),%rdi # 0x32f95b
0x0000000000154fe6 <+1814>: sub $0x8,%rsp
0x0000000000154fea <+1818>: mov $0x368,%edx
0x0000000000154fef <+1823>: callq 0x8f170
> >
> > Signed-off-by: Mateja Marjanovic <mateja.marjanovic@rt-rk.com>
> > ---
> > target/mips/msa_helper.c | 43 ++++++++++++++++++++++++++++++-------------
> > 1 file changed, 30 insertions(+), 13 deletions(-)
> >
> > diff --git a/target/mips/msa_helper.c b/target/mips/msa_helper.c
> > index 4c7ec05..1152fda 100644
> > --- a/target/mips/msa_helper.c
> > +++ b/target/mips/msa_helper.c
> > @@ -804,28 +804,45 @@ void helper_msa_ ## func ## _df(CPUMIPSState *env, uint32_t df, \
> > wr_t *pwd = &(env->active_fpu.fpr[wd].wr); \
> > wr_t *pws = &(env->active_fpu.fpr[ws].wr); \
> > wr_t *pwt = &(env->active_fpu.fpr[wt].wr);
> > \
> If we can ensure alignment for the various vector registers then the
> compiler always has the option of using host vectors (certainly for int
> and logic operations).
> > - uint32_t i; \
> > \
> > switch (df) { \
> > case DF_BYTE: \
> > - for (i = 0; i < DF_ELEMENTS(DF_BYTE); i++) { \
> > - pwd->b[i] = msa_ ## func ## _df(df, pws->b[i], pwt->b[i]); \
> > - } \
> > + pwd->b[0] = msa_ ## func ## _df(df, pws->b[0], pwt->b[0]); \
> > + pwd->b[1] = msa_ ## func ## _df(df, pws->b[1], pwt->b[1]); \
> > + pwd->b[2] = msa_ ## func ## _df(df, pws->b[2], pwt->b[2]); \
> > + pwd->b[3] = msa_ ## func ## _df(df, pws->b[3], pwt->b[3]); \
> > + pwd->b[4] = msa_ ## func ## _df(df, pws->b[4], pwt->b[4]); \
> > + pwd->b[5] = msa_ ## func ## _df(df, pws->b[5], pwt->b[5]); \
> > + pwd->b[6] = msa_ ## func ## _df(df, pws->b[6], pwt->b[6]); \
> > + pwd->b[7] = msa_ ## func ## _df(df, pws->b[7], pwt->b[7]); \
> > + pwd->b[8] = msa_ ## func ## _df(df, pws->b[8], pwt->b[8]); \
> > + pwd->b[9] = msa_ ## func ## _df(df, pws->b[9], pwt->b[9]); \
> > + pwd->b[10] = msa_ ## func ## _df(df, pws->b[10], pwt->b[10]); \
> > + pwd->b[11] = msa_ ## func ## _df(df, pws->b[11], pwt->b[11]); \
> > + pwd->b[12] = msa_ ## func ## _df(df, pws->b[12], pwt->b[12]); \
> > + pwd->b[13] = msa_ ## func ## _df(df, pws->b[13], pwt->b[13]); \
> > + pwd->b[14] = msa_ ## func ## _df(df, pws->b[14], pwt->b[14]); \
> > + pwd->b[15] = msa_ ## func ## _df(df, pws->b[15], pwt->b[15]); \
> > break; \
> > case DF_HALF: \
> > - for (i = 0; i < DF_ELEMENTS(DF_HALF); i++) { \
> > - pwd->h[i] = msa_ ## func ## _df(df, pws->h[i], pwt->h[i]); \
> > - } \
> > + pwd->h[0] = msa_ ## func ## _df(df, pws->h[0], pwt->h[0]); \
> > + pwd->h[1] = msa_ ## func ## _df(df, pws->h[1], pwt->h[1]); \
> > + pwd->h[2] = msa_ ## func ## _df(df, pws->h[2], pwt->h[2]); \
> > + pwd->h[3] = msa_ ## func ## _df(df, pws->h[3], pwt->h[3]); \
> > + pwd->h[4] = msa_ ## func ## _df(df, pws->h[4], pwt->h[4]); \
> > + pwd->h[5] = msa_ ## func ## _df(df, pws->h[5], pwt->h[5]); \
> > + pwd->h[6] = msa_ ## func ## _df(df, pws->h[6], pwt->h[6]); \
> > + pwd->h[7] = msa_ ## func ## _df(df, pws->h[7], pwt->h[7]); \
> > break; \
> > case DF_WORD: \
> > - for (i = 0; i < DF_ELEMENTS(DF_WORD); i++) { \
> > - pwd->w[i] = msa_ ## func ## _df(df, pws->w[i], pwt->w[i]); \
> > - } \
> > + pwd->w[0] = msa_ ## func ## _df(df, pws->w[0], pwt->w[0]); \
> > + pwd->w[1] = msa_ ## func ## _df(df, pws->w[1], pwt->w[1]); \
> > + pwd->w[2] = msa_ ## func ## _df(df, pws->w[2], pwt->w[2]); \
> > + pwd->w[3] = msa_ ## func ## _df(df, pws->w[3], pwt->w[3]); \
> > break; \
> > case DF_DOUBLE: \
> > - for (i = 0; i < DF_ELEMENTS(DF_DOUBLE); i++) { \
> > - pwd->d[i] = msa_ ## func ## _df(df, pws->d[i], pwt->d[i]); \
> > - } \
> > + pwd->d[0] = msa_ ## func ## _df(df, pws->d[0], pwt->d[0]); \
> > + pwd->d[1] = msa_ ## func ## _df(df, pws->d[1], pwt->d[1]); \
> > break; \
> > default: \
> > assert(0); \
--
Alex Bennée
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Qemu-devel] [PATCH 1/2] target/mips: Improve performance for MSA binary operations
2019-06-03 13:10 ` Aleksandar Markovic
@ 2019-06-03 13:29 ` Mateja Marjanovic
0 siblings, 0 replies; 10+ messages in thread
From: Mateja Marjanovic @ 2019-06-03 13:29 UTC (permalink / raw)
To: Aleksandar Markovic, Alex Bennée, qemu-devel
Cc: Aleksandar Rikalo, aurelien
On 3.6.19. 15:10, Aleksandar Markovic wrote:
>> From: Alex Bennée <alex.bennee@linaro.org>
>> Sent: Sunday, June 2, 2019 3:22 PM
>> To: qemu-devel@nongnu.org
>> Cc: Aleksandar Rikalo; Aleksandar Markovic; aurelien@aurel32.net
>> Subject: Re: [Qemu-devel] [PATCH 1/2] target/mips: Improve performance for MSA binary operations
>
>> Mateja Marjanovic <mateja.marjanovic@rt-rk.com> writes:
>>> From: Mateja Marjanovic <Mateja.Marjanovic@rt-rk.com>
>>>
>>> Eliminate loops for better performance.
>> Have you done any measurements of the bellow loop unrolling? Because
>> this is something that maybe we can achieve and let the compiler make
>> the choice.
> I know that Mateja did extensive performance measurements, and I am
> asking him to give us some samples.
Yes, here are some of the binop instructions with a loop and without
it:
|| intruction || with-loop || without-loop ||
===============================
|| addv.b || 147.356 ms || 84.249 ms ||
|| addv.h || 83.612 ms || 44.808 ms ||
|| addv.w || 49.952 ms || 34.128 ms ||
|| addv.d || 29.834 ms || 34.103 ms ||
|| asub_s.b || 187.939 ms || 143.658 ms ||
|| asub_s.h || 105.266 ms || 82.424 ms ||
|| asub_s.w || 68.941 ms || 57.923 ms ||
|| asub_s.d || 41.536 ms || 42.092 ms ||
|| max_s.b || 156.036 ms || 100.628 ms ||
|| max_s.h || 87.100 ms || 64.905 ms ||
|| max_s.w || 52.339 ms || 40.632 ms ||
|| max_s.d || 34.873 ms || 35.562 ms ||
===============================
>
> As for code generation, here are disassemblies of function
> helper_msa_add_a_df() before and after this patch:
>
> (it is visible the compiler did not perform unrolling loops by itself)
>
> BEFORE:
>
> Dump of assembler code for function helper_msa_add_a_df:
> 0x00000000001500b0 <+0>: cmp $0x1,%esi
> 0x00000000001500b3 <+3>: je 0x150258 <helper_msa_add_a_df+424>
> 0x00000000001500b9 <+9>: jb 0x1501e8 <helper_msa_add_a_df+312>
> 0x00000000001500bf <+15>: cmp $0x2,%esi
> 0x00000000001500c2 <+18>: je 0x150180 <helper_msa_add_a_df+208>
> 0x00000000001500c8 <+24>: cmp $0x3,%esi
> 0x00000000001500cb <+27>: jne 0x1502c2 <helper_msa_add_a_df+530>
> 0x00000000001500d1 <+33>: mov %ecx,%ecx
> 0x00000000001500d3 <+35>: mov %edx,%edx
> 0x00000000001500d5 <+37>: lea 0x22(%rcx),%rax
> 0x00000000001500d9 <+41>: lea 0x22(%rdx),%r10
> 0x00000000001500dd <+45>: shl $0x4,%rcx
> 0x00000000001500e1 <+49>: add %rdi,%rcx
> 0x00000000001500e4 <+52>: shl $0x4,%rdx
> 0x00000000001500e8 <+56>: shl $0x4,%rax
> 0x00000000001500ec <+60>: shl $0x4,%r10
> 0x00000000001500f0 <+64>: add %rdi,%rax
> 0x00000000001500f3 <+67>: mov 0x8(%rax),%r9
> 0x00000000001500f7 <+71>: mov 0x8(%rax),%rsi
> 0x00000000001500fb <+75>: mov %r8d,%eax
> 0x00000000001500fe <+78>: sar $0x3f,%r9
> 0x0000000000150102 <+82>: xor %r9,%rsi
> 0x0000000000150105 <+85>: sub %r9,%rsi
> 0x0000000000150108 <+88>: mov %rsi,%r9
> 0x000000000015010b <+91>: lea 0x22(%rax),%rsi
> 0x000000000015010f <+95>: shl $0x4,%rax
> 0x0000000000150113 <+99>: lea (%rdi,%rax,1),%rax
> 0x0000000000150117 <+103>: shl $0x4,%rsi
> 0x000000000015011b <+107>: add %rdi,%rsi
> 0x000000000015011e <+110>: mov 0x8(%rsi),%r8
> 0x0000000000150122 <+114>: mov 0x8(%rsi),%r11
> 0x0000000000150126 <+118>: sar $0x3f,%r8
> 0x000000000015012a <+122>: xor %r8,%r11
> 0x000000000015012d <+125>: mov %r11,%rsi
> 0x0000000000150130 <+128>: sub %r8,%rsi
> 0x0000000000150133 <+131>: add %r9,%rsi
> 0x0000000000150136 <+134>: mov %rsi,0x8(%rdi,%r10,1)
> 0x000000000015013b <+139>: mov 0x230(%rcx),%rsi
> 0x0000000000150142 <+146>: mov 0x230(%rcx),%r8
> 0x0000000000150149 <+153>: sar $0x3f,%rsi
> 0x000000000015014d <+157>: xor %rsi,%r8
> 0x0000000000150150 <+160>: mov %r8,%rcx
> 0x0000000000150153 <+163>: mov 0x230(%rax),%r8
> 0x000000000015015a <+170>: sub %rsi,%rcx
> 0x000000000015015d <+173>: mov 0x230(%rax),%rsi
> 0x0000000000150164 <+180>: sar $0x3f,%rsi
> 0x0000000000150168 <+184>: xor %rsi,%r8
> 0x000000000015016b <+187>: mov %r8,%rax
> 0x000000000015016e <+190>: sub %rsi,%rax
> 0x0000000000150171 <+193>: add %rcx,%rax
> 0x0000000000150174 <+196>: mov %rax,0x230(%rdi,%rdx,1)
> 0x000000000015017c <+204>: retq
> 0x000000000015017d <+205>: nopl (%rax)
> 0x0000000000150180 <+208>: mov %r8d,%r8d
> 0x0000000000150183 <+211>: mov %ecx,%ecx
> 0x0000000000150185 <+213>: mov %edx,%edx
> 0x0000000000150187 <+215>: mov %r8,%rax
> 0x000000000015018a <+218>: neg %r8
> 0x000000000015018d <+221>: shl $0x4,%rcx
> 0x0000000000150191 <+225>: shl $0x4,%rax
> 0x0000000000150195 <+229>: shl $0x4,%r8
> 0x0000000000150199 <+233>: shl $0x4,%rdx
> 0x000000000015019d <+237>: lea 0x228(%rdi,%rax,1),%r9
> 0x00000000001501a5 <+245>: lea 0x238(%rdi,%rax,1),%rdi
> 0x00000000001501ad <+253>: lea (%r9,%r8,1),%r10
> 0x00000000001501b1 <+257>: add $0x4,%r9
> 0x00000000001501b5 <+261>: movslq (%r10,%rcx,1),%rax
> 0x00000000001501b9 <+265>: mov %rax,%rsi
> 0x00000000001501bc <+268>: sar $0x3f,%rsi
> 0x00000000001501c0 <+272>: xor %rsi,%rax
> 0x00000000001501c3 <+275>: sub %rsi,%rax
> 0x00000000001501c6 <+278>: movslq -0x4(%r9),%rsi
> 0x00000000001501ca <+282>: mov %rsi,%r11
> 0x00000000001501cd <+285>: sar $0x3f,%r11
> 0x00000000001501d1 <+289>: xor %r11,%rsi
> 0x00000000001501d4 <+292>: sub %r11,%rsi
> 0x00000000001501d7 <+295>: add %rsi,%rax
> 0x00000000001501da <+298>: cmp %rdi,%r9
> 0x00000000001501dd <+301>: mov %eax,(%r10,%rdx,1)
> 0x00000000001501e1 <+305>: jne 0x1501ad <helper_msa_add_a_df+253>
> 0x00000000001501e3 <+307>: repz retq
> 0x00000000001501e5 <+309>: nopl (%rax)
> 0x00000000001501e8 <+312>: mov %r8d,%r8d
> 0x00000000001501eb <+315>: mov %ecx,%ecx
> 0x00000000001501ed <+317>: mov %edx,%edx
> 0x00000000001501ef <+319>: mov %r8,%rax
> 0x00000000001501f2 <+322>: neg %r8
> 0x00000000001501f5 <+325>: shl $0x4,%rcx
> 0x00000000001501f9 <+329>: shl $0x4,%rax
> 0x00000000001501fd <+333>: shl $0x4,%r8
> 0x0000000000150201 <+337>: shl $0x4,%rdx
> 0x0000000000150205 <+341>: lea 0x228(%rdi,%rax,1),%r9
> 0x000000000015020d <+349>: lea 0x238(%rdi,%rax,1),%r11
> 0x0000000000150215 <+357>: nopl (%rax)
> 0x0000000000150218 <+360>: lea (%r8,%r9,1),%rdi
> 0x000000000015021c <+364>: add $0x1,%r9
> 0x0000000000150220 <+368>: movsbq (%rdi,%rcx,1),%rax
> 0x0000000000150225 <+373>: mov %rax,%rsi
> 0x0000000000150228 <+376>: sar $0x3f,%rsi
> 0x000000000015022c <+380>: xor %rsi,%rax
> 0x000000000015022f <+383>: sub %rsi,%rax
> 0x0000000000150232 <+386>: movsbq -0x1(%r9),%rsi
> 0x0000000000150237 <+391>: mov %rsi,%r10
> 0x000000000015023a <+394>: sar $0x3f,%r10
> 0x000000000015023e <+398>: xor %r10,%rsi
> 0x0000000000150241 <+401>: sub %r10,%rsi
> 0x0000000000150244 <+404>: add %rsi,%rax
> 0x0000000000150247 <+407>: cmp %r9,%r11
> 0x000000000015024a <+410>: mov %al,(%rdi,%rdx,1)
> 0x000000000015024d <+413>: jne 0x150218 <helper_msa_add_a_df+360>
> 0x000000000015024f <+415>: repz retq
> 0x0000000000150251 <+417>: nopl 0x0(%rax)
> 0x0000000000150258 <+424>: mov %r8d,%r8d
> 0x000000000015025b <+427>: mov %ecx,%ecx
> 0x000000000015025d <+429>: mov %edx,%edx
> 0x000000000015025f <+431>: mov %r8,%rax
> 0x0000000000150262 <+434>: neg %r8
> 0x0000000000150265 <+437>: shl $0x4,%rcx
> 0x0000000000150269 <+441>: shl $0x4,%rax
> 0x000000000015026d <+445>: shl $0x4,%r8
> 0x0000000000150271 <+449>: shl $0x4,%rdx
> 0x0000000000150275 <+453>: lea 0x228(%rdi,%rax,1),%r9
> 0x000000000015027d <+461>: lea 0x238(%rdi,%rax,1),%r10
> 0x0000000000150285 <+469>: nopl (%rax)
> 0x0000000000150288 <+472>: lea (%r8,%r9,1),%rdi
> 0x000000000015028c <+476>: add $0x2,%r9
> 0x0000000000150290 <+480>: movswq (%rdi,%rcx,1),%rax
> 0x0000000000150295 <+485>: mov %rax,%rsi
> 0x0000000000150298 <+488>: sar $0x3f,%rsi
> 0x000000000015029c <+492>: xor %rsi,%rax
> 0x000000000015029f <+495>: sub %rsi,%rax
> 0x00000000001502a2 <+498>: movswq -0x2(%r9),%rsi
> 0x00000000001502a7 <+503>: mov %rsi,%r11
> 0x00000000001502aa <+506>: sar $0x3f,%r11
> 0x00000000001502ae <+510>: xor %r11,%rsi
> 0x00000000001502b1 <+513>: sub %r11,%rsi
> 0x00000000001502b4 <+516>: add %rsi,%rax
> 0x00000000001502b7 <+519>: cmp %r10,%r9
> 0x00000000001502ba <+522>: mov %ax,(%rdi,%rdx,1)
> 0x00000000001502be <+526>: jne 0x150288 <helper_msa_add_a_df+472>
> 0x00000000001502c0 <+528>: repz retq
> 0x00000000001502c2 <+530>: lea 0x13c3b7(%rip),%rcx # 0x28c680 <__PRETTY_FUNCTION__.26062>
> 0x00000000001502c9 <+537>: lea 0x13b830(%rip),%rsi # 0x28bb00
> 0x00000000001502d0 <+544>: lea 0x1c7204(%rip),%rdi # 0x3174db
> 0x00000000001502d7 <+551>: sub $0x8,%rsp
> 0x00000000001502db <+555>: mov $0x357,%edx
> 0x00000000001502e0 <+560>: callq 0x8eeb8
> End of assembler dump.
>
>
> AFTER:
>
> 0x00000000001548d0 <+0>: cmp $0x1,%esi
> 0x00000000001548d3 <+3>: je 0x154e00 <helper_msa_add_a_df+1328>
> 0x00000000001548d9 <+9>: jb 0x154a98 <helper_msa_add_a_df+456>
> 0x00000000001548df <+15>: cmp $0x2,%esi
> 0x00000000001548e2 <+18>: je 0x1549a0 <helper_msa_add_a_df+208>
> 0x00000000001548e8 <+24>: cmp $0x3,%esi
> 0x00000000001548eb <+27>: jne 0x154fd1 <helper_msa_add_a_df+1793>
> 0x00000000001548f1 <+33>: mov %ecx,%eax
> 0x00000000001548f3 <+35>: mov %r8d,%r8d
> 0x00000000001548f6 <+38>: mov %edx,%edx
> 0x00000000001548f8 <+40>: lea 0x22(%rax),%rcx
> 0x00000000001548fc <+44>: lea 0x22(%rdx),%r9
> 0x0000000000154900 <+48>: shl $0x4,%rax
> 0x0000000000154904 <+52>: add %rdi,%rax
> 0x0000000000154907 <+55>: shl $0x4,%rdx
> 0x000000000015490b <+59>: shl $0x4,%rcx
> 0x000000000015490f <+63>: shl $0x4,%r9
> 0x0000000000154913 <+67>: add %rdi,%rcx
> 0x0000000000154916 <+70>: mov 0x8(%rcx),%rsi
> 0x000000000015491a <+74>: mov 0x8(%rcx),%r11
> 0x000000000015491e <+78>: sar $0x3f,%rsi
> 0x0000000000154922 <+82>: xor %rsi,%r11
> 0x0000000000154925 <+85>: mov %r11,%rcx
> 0x0000000000154928 <+88>: sub %rsi,%rcx
> 0x000000000015492b <+91>: mov %rcx,%rsi
> 0x000000000015492e <+94>: lea 0x22(%r8),%rcx
> 0x0000000000154932 <+98>: shl $0x4,%r8
> 0x0000000000154936 <+102>: add %rdi,%r8
> 0x0000000000154939 <+105>: shl $0x4,%rcx
> 0x000000000015493d <+109>: add %rdi,%rcx
> 0x0000000000154940 <+112>: mov 0x8(%rcx),%r10
> 0x0000000000154944 <+116>: mov 0x8(%rcx),%r11
> 0x0000000000154948 <+120>: sar $0x3f,%r10
> 0x000000000015494c <+124>: xor %r10,%r11
> 0x000000000015494f <+127>: mov %r11,%rcx
> 0x0000000000154952 <+130>: sub %r10,%rcx
> 0x0000000000154955 <+133>: add %rsi,%rcx
> 0x0000000000154958 <+136>: mov %rcx,0x8(%rdi,%r9,1)
> 0x000000000015495d <+141>: mov 0x230(%rax),%rcx
> 0x0000000000154964 <+148>: mov 0x230(%rax),%rsi
> 0x000000000015496b <+155>: sar $0x3f,%rcx
> 0x000000000015496f <+159>: xor %rcx,%rsi
> 0x0000000000154972 <+162>: mov %rsi,%rax
> 0x0000000000154975 <+165>: mov 0x230(%r8),%rsi
> 0x000000000015497c <+172>: sub %rcx,%rax
> 0x000000000015497f <+175>: mov %rax,%rcx
> 0x0000000000154982 <+178>: mov 0x230(%r8),%rax
> 0x0000000000154989 <+185>: sar $0x3f,%rsi
> 0x000000000015498d <+189>: xor %rsi,%rax
> 0x0000000000154990 <+192>: sub %rsi,%rax
> 0x0000000000154993 <+195>: add %rcx,%rax
> 0x0000000000154996 <+198>: mov %rax,0x230(%rdi,%rdx,1)
> 0x000000000015499e <+206>: retq
> 0x000000000015499f <+207>: nop
> 0x00000000001549a0 <+208>: mov %ecx,%ecx
> 0x00000000001549a2 <+210>: mov %r8d,%r8d
> 0x00000000001549a5 <+213>: mov %edx,%edx
> 0x00000000001549a7 <+215>: lea 0x22(%rcx),%rax
> 0x00000000001549ab <+219>: lea 0x22(%rdx),%r9
> 0x00000000001549af <+223>: shl $0x4,%rcx
> 0x00000000001549b3 <+227>: add %rdi,%rcx
> 0x00000000001549b6 <+230>: shl $0x4,%rdx
> 0x00000000001549ba <+234>: shl $0x4,%rax
> 0x00000000001549be <+238>: shl $0x4,%r9
> 0x00000000001549c2 <+242>: add %rdi,%rdx
> 0x00000000001549c5 <+245>: movslq 0x8(%rdi,%rax,1),%rax
> 0x00000000001549ca <+250>: mov %rax,%rsi
> 0x00000000001549cd <+253>: sar $0x3f,%rsi
> 0x00000000001549d1 <+257>: xor %rsi,%rax
> 0x00000000001549d4 <+260>: sub %rsi,%rax
> 0x00000000001549d7 <+263>: lea 0x22(%r8),%rsi
> 0x00000000001549db <+267>: shl $0x4,%r8
> 0x00000000001549df <+271>: shl $0x4,%rsi
> 0x00000000001549e3 <+275>: movslq 0x8(%rdi,%rsi,1),%rsi
> 0x00000000001549e8 <+280>: mov %rsi,%r10
> 0x00000000001549eb <+283>: sar $0x3f,%r10
> 0x00000000001549ef <+287>: xor %r10,%rsi
> 0x00000000001549f2 <+290>: sub %r10,%rsi
> 0x00000000001549f5 <+293>: add %rsi,%rax
> 0x00000000001549f8 <+296>: mov %eax,0x8(%rdi,%r9,1)
> 0x00000000001549fd <+301>: movslq 0x22c(%rcx),%rax
> 0x0000000000154a04 <+308>: add %r8,%rdi
> 0x0000000000154a07 <+311>: mov %rax,%rsi
> 0x0000000000154a0a <+314>: sar $0x3f,%rsi
> 0x0000000000154a0e <+318>: xor %rsi,%rax
> 0x0000000000154a11 <+321>: sub %rsi,%rax
> 0x0000000000154a14 <+324>: movslq 0x22c(%rdi),%rsi
> 0x0000000000154a1b <+331>: mov %rsi,%r8
> 0x0000000000154a1e <+334>: sar $0x3f,%r8
> 0x0000000000154a22 <+338>: xor %r8,%rsi
> 0x0000000000154a25 <+341>: sub %r8,%rsi
> 0x0000000000154a28 <+344>: add %rsi,%rax
> 0x0000000000154a2b <+347>: mov %eax,0x22c(%rdx)
> 0x0000000000154a31 <+353>: movslq 0x230(%rcx),%rax
> 0x0000000000154a38 <+360>: mov %rax,%rsi
> 0x0000000000154a3b <+363>: sar $0x3f,%rsi
> 0x0000000000154a3f <+367>: xor %rsi,%rax
> 0x0000000000154a42 <+370>: sub %rsi,%rax
> 0x0000000000154a45 <+373>: movslq 0x230(%rdi),%rsi
> 0x0000000000154a4c <+380>: mov %rsi,%r8
> 0x0000000000154a4f <+383>: sar $0x3f,%r8
> 0x0000000000154a53 <+387>: xor %r8,%rsi
> 0x0000000000154a56 <+390>: sub %r8,%rsi
> 0x0000000000154a59 <+393>: add %rsi,%rax
> 0x0000000000154a5c <+396>: mov %eax,0x230(%rdx)
> 0x0000000000154a62 <+402>: movslq 0x234(%rcx),%rax
> 0x0000000000154a69 <+409>: mov %rax,%rcx
> 0x0000000000154a6c <+412>: sar $0x3f,%rcx
> 0x0000000000154a70 <+416>: xor %rcx,%rax
> 0x0000000000154a73 <+419>: sub %rcx,%rax
> 0x0000000000154a76 <+422>: movslq 0x234(%rdi),%rcx
> 0x0000000000154a7d <+429>: mov %rcx,%rsi
> 0x0000000000154a80 <+432>: sar $0x3f,%rsi
> 0x0000000000154a84 <+436>: xor %rsi,%rcx
> 0x0000000000154a87 <+439>: sub %rsi,%rcx
> 0x0000000000154a8a <+442>: add %rcx,%rax
> 0x0000000000154a8d <+445>: mov %eax,0x234(%rdx)
> 0x0000000000154a93 <+451>: retq
> 0x0000000000154a94 <+452>: nopl 0x0(%rax)
> 0x0000000000154a98 <+456>: mov %ecx,%eax
> 0x0000000000154a9a <+458>: mov %r8d,%r8d
> 0x0000000000154a9d <+461>: mov %edx,%edx
> 0x0000000000154a9f <+463>: lea 0x22(%rax),%rcx
> 0x0000000000154aa3 <+467>: lea 0x22(%rdx),%r9
> 0x0000000000154aa7 <+471>: shl $0x4,%rax
> 0x0000000000154aab <+475>: lea (%rdi,%rax,1),%rax
> 0x0000000000154aaf <+479>: shl $0x4,%rdx
> 0x0000000000154ab3 <+483>: shl $0x4,%rcx
> 0x0000000000154ab7 <+487>: shl $0x4,%r9
> 0x0000000000154abb <+491>: add %rdi,%rdx
> 0x0000000000154abe <+494>: movsbq 0x8(%rdi,%rcx,1),%rsi
> 0x0000000000154ac4 <+500>: mov %rsi,%rcx
> 0x0000000000154ac7 <+503>: sar $0x3f,%rcx
> 0x0000000000154acb <+507>: xor %rcx,%rsi
> 0x0000000000154ace <+510>: sub %rcx,%rsi
> 0x0000000000154ad1 <+513>: lea 0x22(%r8),%rcx
> 0x0000000000154ad5 <+517>: shl $0x4,%r8
> 0x0000000000154ad9 <+521>: shl $0x4,%rcx
> 0x0000000000154add <+525>: movsbq 0x8(%rdi,%rcx,1),%rcx
> 0x0000000000154ae3 <+531>: mov %rcx,%r10
> 0x0000000000154ae6 <+534>: sar $0x3f,%r10
> 0x0000000000154aea <+538>: xor %r10,%rcx
> 0x0000000000154aed <+541>: sub %r10,%rcx
> 0x0000000000154af0 <+544>: add %rcx,%rsi
> 0x0000000000154af3 <+547>: mov %sil,0x8(%rdi,%r9,1)
> 0x0000000000154af8 <+552>: movsbq 0x229(%rax),%rcx
> 0x0000000000154b00 <+560>: add %r8,%rdi
> 0x0000000000154b03 <+563>: mov %rcx,%rsi
> 0x0000000000154b06 <+566>: sar $0x3f,%rsi
> 0x0000000000154b0a <+570>: xor %rsi,%rcx
> 0x0000000000154b0d <+573>: sub %rsi,%rcx
> 0x0000000000154b10 <+576>: movsbq 0x229(%rdi),%rsi
> 0x0000000000154b18 <+584>: mov %rsi,%r8
> 0x0000000000154b1b <+587>: sar $0x3f,%r8
> 0x0000000000154b1f <+591>: xor %r8,%rsi
> 0x0000000000154b22 <+594>: sub %r8,%rsi
> 0x0000000000154b25 <+597>: add %rsi,%rcx
> 0x0000000000154b28 <+600>: mov %cl,0x229(%rdx)
> 0x0000000000154b2e <+606>: movsbq 0x22a(%rax),%rcx
> 0x0000000000154b36 <+614>: mov %rcx,%rsi
> 0x0000000000154b39 <+617>: sar $0x3f,%rsi
> 0x0000000000154b3d <+621>: xor %rsi,%rcx
> 0x0000000000154b40 <+624>: sub %rsi,%rcx
> 0x0000000000154b43 <+627>: movsbq 0x22a(%rdi),%rsi
> 0x0000000000154b4b <+635>: mov %rsi,%r8
> 0x0000000000154b4e <+638>: sar $0x3f,%r8
> 0x0000000000154b52 <+642>: xor %r8,%rsi
> 0x0000000000154b55 <+645>: sub %r8,%rsi
> 0x0000000000154b58 <+648>: add %rsi,%rcx
> 0x0000000000154b5b <+651>: mov %cl,0x22a(%rdx)
> 0x0000000000154b61 <+657>: movsbq 0x22b(%rax),%rcx
> 0x0000000000154b69 <+665>: mov %rcx,%rsi
> 0x0000000000154b6c <+668>: sar $0x3f,%rsi
> 0x0000000000154b70 <+672>: xor %rsi,%rcx
> 0x0000000000154b73 <+675>: sub %rsi,%rcx
> 0x0000000000154b76 <+678>: movsbq 0x22b(%rdi),%rsi
> 0x0000000000154b7e <+686>: mov %rsi,%r8
> 0x0000000000154b81 <+689>: sar $0x3f,%r8
> 0x0000000000154b85 <+693>: xor %r8,%rsi
> 0x0000000000154b88 <+696>: sub %r8,%rsi
> 0x0000000000154b8b <+699>: add %rsi,%rcx
> 0x0000000000154b8e <+702>: mov %cl,0x22b(%rdx)
> 0x0000000000154b94 <+708>: movsbq 0x22c(%rax),%rcx
> 0x0000000000154b9c <+716>: mov %rcx,%rsi
> 0x0000000000154b9f <+719>: sar $0x3f,%rsi
> 0x0000000000154ba3 <+723>: xor %rsi,%rcx
> 0x0000000000154ba6 <+726>: sub %rsi,%rcx
> 0x0000000000154ba9 <+729>: movsbq 0x22c(%rdi),%rsi
> 0x0000000000154bb1 <+737>: mov %rsi,%r8
> 0x0000000000154bb4 <+740>: sar $0x3f,%r8
> 0x0000000000154bb8 <+744>: xor %r8,%rsi
> 0x0000000000154bbb <+747>: sub %r8,%rsi
> 0x0000000000154bbe <+750>: add %rsi,%rcx
> 0x0000000000154bc1 <+753>: mov %cl,0x22c(%rdx)
> 0x0000000000154bc7 <+759>: movsbq 0x22d(%rax),%rcx
> 0x0000000000154bcf <+767>: mov %rcx,%rsi
> 0x0000000000154bd2 <+770>: sar $0x3f,%rsi
> 0x0000000000154bd6 <+774>: xor %rsi,%rcx
> 0x0000000000154bd9 <+777>: sub %rsi,%rcx
> 0x0000000000154bdc <+780>: movsbq 0x22d(%rdi),%rsi
> 0x0000000000154be4 <+788>: mov %rsi,%r8
> 0x0000000000154be7 <+791>: sar $0x3f,%r8
> 0x0000000000154beb <+795>: xor %r8,%rsi
> 0x0000000000154bee <+798>: sub %r8,%rsi
> 0x0000000000154bf1 <+801>: add %rsi,%rcx
> 0x0000000000154bf4 <+804>: mov %cl,0x22d(%rdx)
> 0x0000000000154bfa <+810>: movsbq 0x22e(%rax),%rcx
> 0x0000000000154c02 <+818>: mov %rcx,%rsi
> 0x0000000000154c05 <+821>: sar $0x3f,%rsi
> 0x0000000000154c09 <+825>: xor %rsi,%rcx
> 0x0000000000154c0c <+828>: sub %rsi,%rcx
> 0x0000000000154c0f <+831>: movsbq 0x22e(%rdi),%rsi
> 0x0000000000154c17 <+839>: mov %rsi,%r8
> 0x0000000000154c1a <+842>: sar $0x3f,%r8
> 0x0000000000154c1e <+846>: xor %r8,%rsi
> 0x0000000000154c21 <+849>: sub %r8,%rsi
> 0x0000000000154c24 <+852>: add %rsi,%rcx
> 0x0000000000154c27 <+855>: mov %cl,0x22e(%rdx)
> 0x0000000000154c2d <+861>: movsbq 0x22f(%rax),%rcx
> 0x0000000000154c35 <+869>: mov %rcx,%rsi
> 0x0000000000154c38 <+872>: sar $0x3f,%rsi
> 0x0000000000154c3c <+876>: xor %rsi,%rcx
> 0x0000000000154c3f <+879>: sub %rsi,%rcx
> 0x0000000000154c42 <+882>: movsbq 0x22f(%rdi),%rsi
> 0x0000000000154c4a <+890>: mov %rsi,%r8
> 0x0000000000154c4d <+893>: sar $0x3f,%r8
> 0x0000000000154c51 <+897>: xor %r8,%rsi
> 0x0000000000154c54 <+900>: sub %r8,%rsi
> 0x0000000000154c57 <+903>: add %rsi,%rcx
> 0x0000000000154c5a <+906>: mov %cl,0x22f(%rdx)
> 0x0000000000154c60 <+912>: movsbq 0x230(%rax),%rcx
> 0x0000000000154c68 <+920>: mov %rcx,%rsi
> 0x0000000000154c6b <+923>: sar $0x3f,%rsi
> 0x0000000000154c6f <+927>: xor %rsi,%rcx
> 0x0000000000154c72 <+930>: sub %rsi,%rcx
> 0x0000000000154c75 <+933>: movsbq 0x230(%rdi),%rsi
> 0x0000000000154c7d <+941>: mov %rsi,%r8
> 0x0000000000154c80 <+944>: sar $0x3f,%r8
> 0x0000000000154c84 <+948>: xor %r8,%rsi
> 0x0000000000154c87 <+951>: sub %r8,%rsi
> 0x0000000000154c8a <+954>: add %rsi,%rcx
> 0x0000000000154c8d <+957>: mov %cl,0x230(%rdx)
> 0x0000000000154c93 <+963>: movsbq 0x231(%rax),%rcx
> 0x0000000000154c9b <+971>: mov %rcx,%rsi
> 0x0000000000154c9e <+974>: sar $0x3f,%rsi
> 0x0000000000154ca2 <+978>: xor %rsi,%rcx
> 0x0000000000154ca5 <+981>: sub %rsi,%rcx
> 0x0000000000154ca8 <+984>: movsbq 0x231(%rdi),%rsi
> 0x0000000000154cb0 <+992>: mov %rsi,%r8
> 0x0000000000154cb3 <+995>: sar $0x3f,%r8
> 0x0000000000154cb7 <+999>: xor %r8,%rsi
> 0x0000000000154cba <+1002>: sub %r8,%rsi
> 0x0000000000154cbd <+1005>: add %rsi,%rcx
> 0x0000000000154cc0 <+1008>: mov %cl,0x231(%rdx)
> 0x0000000000154cc6 <+1014>: movsbq 0x232(%rax),%rcx
> 0x0000000000154cce <+1022>: mov %rcx,%rsi
> 0x0000000000154cd1 <+1025>: sar $0x3f,%rsi
> 0x0000000000154cd5 <+1029>: xor %rsi,%rcx
> 0x0000000000154cd8 <+1032>: sub %rsi,%rcx
> 0x0000000000154cdb <+1035>: movsbq 0x232(%rdi),%rsi
> 0x0000000000154ce3 <+1043>: mov %rsi,%r8
> 0x0000000000154ce6 <+1046>: sar $0x3f,%r8
> 0x0000000000154cea <+1050>: xor %r8,%rsi
> 0x0000000000154ced <+1053>: sub %r8,%rsi
> 0x0000000000154cf0 <+1056>: add %rsi,%rcx
> 0x0000000000154cf3 <+1059>: mov %cl,0x232(%rdx)
> 0x0000000000154cf9 <+1065>: movsbq 0x233(%rdi),%rcx
> 0x0000000000154d01 <+1073>: mov %rcx,%rsi
> 0x0000000000154d04 <+1076>: sar $0x3f,%rsi
> 0x0000000000154d08 <+1080>: xor %rsi,%rcx
> 0x0000000000154d0b <+1083>: sub %rsi,%rcx
> 0x0000000000154d0e <+1086>: movsbq 0x233(%rax),%rsi
> 0x0000000000154d16 <+1094>: mov %rsi,%r8
> 0x0000000000154d19 <+1097>: sar $0x3f,%r8
> 0x0000000000154d1d <+1101>: xor %r8,%rsi
> 0x0000000000154d20 <+1104>: sub %r8,%rsi
> 0x0000000000154d23 <+1107>: add %rsi,%rcx
> 0x0000000000154d26 <+1110>: mov %cl,0x233(%rdx)
> 0x0000000000154d2c <+1116>: movsbq 0x234(%rdi),%rcx
> 0x0000000000154d34 <+1124>: mov %rcx,%rsi
> 0x0000000000154d37 <+1127>: sar $0x3f,%rsi
> 0x0000000000154d3b <+1131>: xor %rsi,%rcx
> 0x0000000000154d3e <+1134>: sub %rsi,%rcx
> 0x0000000000154d41 <+1137>: movsbq 0x234(%rax),%rsi
> 0x0000000000154d49 <+1145>: mov %rsi,%r8
> 0x0000000000154d4c <+1148>: sar $0x3f,%r8
> 0x0000000000154d50 <+1152>: xor %r8,%rsi
> 0x0000000000154d53 <+1155>: sub %r8,%rsi
> 0x0000000000154d56 <+1158>: add %rsi,%rcx
> 0x0000000000154d59 <+1161>: mov %cl,0x234(%rdx)
> 0x0000000000154d5f <+1167>: movsbq 0x235(%rax),%rcx
> 0x0000000000154d67 <+1175>: mov %rcx,%rsi
> 0x0000000000154d6a <+1178>: sar $0x3f,%rsi
> 0x0000000000154d6e <+1182>: xor %rsi,%rcx
> 0x0000000000154d71 <+1185>: sub %rsi,%rcx
> 0x0000000000154d74 <+1188>: movsbq 0x235(%rdi),%rsi
> 0x0000000000154d7c <+1196>: mov %rsi,%r8
> 0x0000000000154d7f <+1199>: sar $0x3f,%r8
> 0x0000000000154d83 <+1203>: xor %r8,%rsi
> 0x0000000000154d86 <+1206>: sub %r8,%rsi
> 0x0000000000154d89 <+1209>: add %rsi,%rcx
> 0x0000000000154d8c <+1212>: mov %cl,0x235(%rdx)
> 0x0000000000154d92 <+1218>: movsbq 0x236(%rdi),%rcx
> 0x0000000000154d9a <+1226>: mov %rcx,%rsi
> 0x0000000000154d9d <+1229>: sar $0x3f,%rsi
> 0x0000000000154da1 <+1233>: xor %rsi,%rcx
> 0x0000000000154da4 <+1236>: sub %rsi,%rcx
> 0x0000000000154da7 <+1239>: movsbq 0x236(%rax),%rsi
> 0x0000000000154daf <+1247>: mov %rsi,%r8
> 0x0000000000154db2 <+1250>: sar $0x3f,%r8
> 0x0000000000154db6 <+1254>: xor %r8,%rsi
> 0x0000000000154db9 <+1257>: sub %r8,%rsi
> 0x0000000000154dbc <+1260>: add %rsi,%rcx
> 0x0000000000154dbf <+1263>: mov %cl,0x236(%rdx)
> 0x0000000000154dc5 <+1269>: movsbq 0x237(%rax),%rax
> 0x0000000000154dcd <+1277>: mov %rax,%rcx
> 0x0000000000154dd0 <+1280>: sar $0x3f,%rcx
> 0x0000000000154dd4 <+1284>: xor %rcx,%rax
> 0x0000000000154dd7 <+1287>: sub %rcx,%rax
> 0x0000000000154dda <+1290>: movsbq 0x237(%rdi),%rcx
> 0x0000000000154de2 <+1298>: mov %rcx,%rsi
> 0x0000000000154de5 <+1301>: sar $0x3f,%rsi
> 0x0000000000154de9 <+1305>: xor %rsi,%rcx
> 0x0000000000154dec <+1308>: sub %rsi,%rcx
> 0x0000000000154def <+1311>: add %rcx,%rax
> 0x0000000000154df2 <+1314>: mov %al,0x237(%rdx)
> 0x0000000000154df8 <+1320>: retq
> 0x0000000000154df9 <+1321>: nopl 0x0(%rax)
> 0x0000000000154e00 <+1328>: mov %ecx,%eax
> 0x0000000000154e02 <+1330>: mov %r8d,%r8d
> 0x0000000000154e05 <+1333>: mov %edx,%edx
> 0x0000000000154e07 <+1335>: lea 0x22(%rax),%rcx
> 0x0000000000154e0b <+1339>: lea 0x22(%rdx),%r9
> 0x0000000000154e0f <+1343>: shl $0x4,%rax
> 0x0000000000154e13 <+1347>: lea (%rdi,%rax,1),%rax
> 0x0000000000154e17 <+1351>: shl $0x4,%rdx
> 0x0000000000154e1b <+1355>: shl $0x4,%rcx
> 0x0000000000154e1f <+1359>: shl $0x4,%r9
> 0x0000000000154e23 <+1363>: add %rdi,%rdx
> 0x0000000000154e26 <+1366>: movswq 0x8(%rdi,%rcx,1),%rsi
> 0x0000000000154e2c <+1372>: mov %rsi,%rcx
> 0x0000000000154e2f <+1375>: sar $0x3f,%rcx
> 0x0000000000154e33 <+1379>: xor %rcx,%rsi
> 0x0000000000154e36 <+1382>: sub %rcx,%rsi
> 0x0000000000154e39 <+1385>: lea 0x22(%r8),%rcx
> 0x0000000000154e3d <+1389>: shl $0x4,%r8
> 0x0000000000154e41 <+1393>: shl $0x4,%rcx
> 0x0000000000154e45 <+1397>: movswq 0x8(%rdi,%rcx,1),%rcx
> 0x0000000000154e4b <+1403>: mov %rcx,%r10
> 0x0000000000154e4e <+1406>: sar $0x3f,%r10
> 0x0000000000154e52 <+1410>: xor %r10,%rcx
> 0x0000000000154e55 <+1413>: sub %r10,%rcx
> 0x0000000000154e58 <+1416>: add %rcx,%rsi
> 0x0000000000154e5b <+1419>: mov %si,0x8(%rdi,%r9,1)
> 0x0000000000154e61 <+1425>: movswq 0x22a(%rax),%rcx
> 0x0000000000154e69 <+1433>: add %r8,%rdi
> 0x0000000000154e6c <+1436>: mov %rcx,%rsi
> 0x0000000000154e6f <+1439>: sar $0x3f,%rsi
> 0x0000000000154e73 <+1443>: xor %rsi,%rcx
> 0x0000000000154e76 <+1446>: sub %rsi,%rcx
> 0x0000000000154e79 <+1449>: movswq 0x22a(%rdi),%rsi
> 0x0000000000154e81 <+1457>: mov %rsi,%r8
> 0x0000000000154e84 <+1460>: sar $0x3f,%r8
> 0x0000000000154e88 <+1464>: xor %r8,%rsi
> 0x0000000000154e8b <+1467>: sub %r8,%rsi
> 0x0000000000154e8e <+1470>: add %rsi,%rcx
> 0x0000000000154e91 <+1473>: mov %cx,0x22a(%rdx)
> 0x0000000000154e98 <+1480>: movswq 0x22c(%rax),%rcx
> 0x0000000000154ea0 <+1488>: mov %rcx,%rsi
> 0x0000000000154ea3 <+1491>: sar $0x3f,%rsi
> 0x0000000000154ea7 <+1495>: xor %rsi,%rcx
> 0x0000000000154eaa <+1498>: sub %rsi,%rcx
> 0x0000000000154ead <+1501>: movswq 0x22c(%rdi),%rsi
> 0x0000000000154eb5 <+1509>: mov %rsi,%r8
> 0x0000000000154eb8 <+1512>: sar $0x3f,%r8
> 0x0000000000154ebc <+1516>: xor %r8,%rsi
> 0x0000000000154ebf <+1519>: sub %r8,%rsi
> 0x0000000000154ec2 <+1522>: add %rsi,%rcx
> 0x0000000000154ec5 <+1525>: mov %cx,0x22c(%rdx)
> 0x0000000000154ecc <+1532>: movswq 0x22e(%rax),%rcx
> 0x0000000000154ed4 <+1540>: mov %rcx,%rsi
> 0x0000000000154ed7 <+1543>: sar $0x3f,%rsi
> 0x0000000000154edb <+1547>: xor %rsi,%rcx
> 0x0000000000154ede <+1550>: sub %rsi,%rcx
> 0x0000000000154ee1 <+1553>: movswq 0x22e(%rdi),%rsi
> 0x0000000000154ee9 <+1561>: mov %rsi,%r8
> 0x0000000000154eec <+1564>: sar $0x3f,%r8
> 0x0000000000154ef0 <+1568>: xor %r8,%rsi
> 0x0000000000154ef3 <+1571>: sub %r8,%rsi
> 0x0000000000154ef6 <+1574>: add %rsi,%rcx
> 0x0000000000154ef9 <+1577>: mov %cx,0x22e(%rdx)
> 0x0000000000154f00 <+1584>: movswq 0x230(%rax),%rcx
> 0x0000000000154f08 <+1592>: mov %rcx,%rsi
> 0x0000000000154f0b <+1595>: sar $0x3f,%rsi
> 0x0000000000154f0f <+1599>: xor %rsi,%rcx
> 0x0000000000154f12 <+1602>: sub %rsi,%rcx
> 0x0000000000154f15 <+1605>: movswq 0x230(%rdi),%rsi
> 0x0000000000154f1d <+1613>: mov %rsi,%r8
> 0x0000000000154f20 <+1616>: sar $0x3f,%r8
> 0x0000000000154f24 <+1620>: xor %r8,%rsi
> 0x0000000000154f27 <+1623>: sub %r8,%rsi
> 0x0000000000154f2a <+1626>: add %rsi,%rcx
> 0x0000000000154f2d <+1629>: mov %cx,0x230(%rdx)
> 0x0000000000154f34 <+1636>: movswq 0x232(%rax),%rcx
> 0x0000000000154f3c <+1644>: mov %rcx,%rsi
> 0x0000000000154f3f <+1647>: sar $0x3f,%rsi
> 0x0000000000154f43 <+1651>: xor %rsi,%rcx
> 0x0000000000154f46 <+1654>: sub %rsi,%rcx
> 0x0000000000154f49 <+1657>: movswq 0x232(%rdi),%rsi
> 0x0000000000154f51 <+1665>: mov %rsi,%r8
> 0x0000000000154f54 <+1668>: sar $0x3f,%r8
> 0x0000000000154f58 <+1672>: xor %r8,%rsi
> 0x0000000000154f5b <+1675>: sub %r8,%rsi
> 0x0000000000154f5e <+1678>: add %rsi,%rcx
> 0x0000000000154f61 <+1681>: mov %cx,0x232(%rdx)
> 0x0000000000154f68 <+1688>: movswq 0x234(%rax),%rcx
> 0x0000000000154f70 <+1696>: mov %rcx,%rsi
> 0x0000000000154f73 <+1699>: sar $0x3f,%rsi
> 0x0000000000154f77 <+1703>: xor %rsi,%rcx
> 0x0000000000154f7a <+1706>: sub %rsi,%rcx
> 0x0000000000154f7d <+1709>: movswq 0x234(%rdi),%rsi
> 0x0000000000154f85 <+1717>: mov %rsi,%r8
> 0x0000000000154f88 <+1720>: sar $0x3f,%r8
> 0x0000000000154f8c <+1724>: xor %r8,%rsi
> 0x0000000000154f8f <+1727>: sub %r8,%rsi
> 0x0000000000154f92 <+1730>: add %rsi,%rcx
> 0x0000000000154f95 <+1733>: mov %cx,0x234(%rdx)
> 0x0000000000154f9c <+1740>: movswq 0x236(%rax),%rax
> 0x0000000000154fa4 <+1748>: mov %rax,%rcx
> 0x0000000000154fa7 <+1751>: sar $0x3f,%rcx
> 0x0000000000154fab <+1755>: xor %rcx,%rax
> 0x0000000000154fae <+1758>: sub %rcx,%rax
> 0x0000000000154fb1 <+1761>: movswq 0x236(%rdi),%rcx
> 0x0000000000154fb9 <+1769>: mov %rcx,%rsi
> 0x0000000000154fbc <+1772>: sar $0x3f,%rsi
> 0x0000000000154fc0 <+1776>: xor %rsi,%rcx
> 0x0000000000154fc3 <+1779>: sub %rsi,%rcx
> 0x0000000000154fc6 <+1782>: add %rcx,%rax
> 0x0000000000154fc9 <+1785>: mov %ax,0x236(%rdx)
> 0x0000000000154fd0 <+1792>: retq
> 0x0000000000154fd1 <+1793>: lea 0x14faa8(%rip),%rcx # 0x2a4a80 <__PRETTY_FUNCTION__.25843>
> 0x0000000000154fd8 <+1800>: lea 0x14ef81(%rip),%rsi # 0x2a3f60
> 0x0000000000154fdf <+1807>: lea 0x1da975(%rip),%rdi # 0x32f95b
> 0x0000000000154fe6 <+1814>: sub $0x8,%rsp
> 0x0000000000154fea <+1818>: mov $0x368,%edx
> 0x0000000000154fef <+1823>: callq 0x8f170
>
>
>>> Signed-off-by: Mateja Marjanovic <mateja.marjanovic@rt-rk.com>
>>> ---
>>> target/mips/msa_helper.c | 43 ++++++++++++++++++++++++++++++-------------
>>> 1 file changed, 30 insertions(+), 13 deletions(-)
>>>
>>> diff --git a/target/mips/msa_helper.c b/target/mips/msa_helper.c
>>> index 4c7ec05..1152fda 100644
>>> --- a/target/mips/msa_helper.c
>>> +++ b/target/mips/msa_helper.c
>>> @@ -804,28 +804,45 @@ void helper_msa_ ## func ## _df(CPUMIPSState *env, uint32_t df, \
>>> wr_t *pwd = &(env->active_fpu.fpr[wd].wr); \
>>> wr_t *pws = &(env->active_fpu.fpr[ws].wr); \
>>> wr_t *pwt = &(env->active_fpu.fpr[wt].wr);
>>> \
>> If we can ensure alignment for the various vector registers then the
>> compiler always has the option of using host vectors (certainly for int
>> and logic operations).
Very interesting, could you please tell me more about that, so I can
understand better.
Thanks,
Mateja
>>> - uint32_t i; \
>>> \
>>> switch (df) { \
>>> case DF_BYTE: \
>>> - for (i = 0; i < DF_ELEMENTS(DF_BYTE); i++) { \
>>> - pwd->b[i] = msa_ ## func ## _df(df, pws->b[i], pwt->b[i]); \
>>> - } \
>>> + pwd->b[0] = msa_ ## func ## _df(df, pws->b[0], pwt->b[0]); \
>>> + pwd->b[1] = msa_ ## func ## _df(df, pws->b[1], pwt->b[1]); \
>>> + pwd->b[2] = msa_ ## func ## _df(df, pws->b[2], pwt->b[2]); \
>>> + pwd->b[3] = msa_ ## func ## _df(df, pws->b[3], pwt->b[3]); \
>>> + pwd->b[4] = msa_ ## func ## _df(df, pws->b[4], pwt->b[4]); \
>>> + pwd->b[5] = msa_ ## func ## _df(df, pws->b[5], pwt->b[5]); \
>>> + pwd->b[6] = msa_ ## func ## _df(df, pws->b[6], pwt->b[6]); \
>>> + pwd->b[7] = msa_ ## func ## _df(df, pws->b[7], pwt->b[7]); \
>>> + pwd->b[8] = msa_ ## func ## _df(df, pws->b[8], pwt->b[8]); \
>>> + pwd->b[9] = msa_ ## func ## _df(df, pws->b[9], pwt->b[9]); \
>>> + pwd->b[10] = msa_ ## func ## _df(df, pws->b[10], pwt->b[10]); \
>>> + pwd->b[11] = msa_ ## func ## _df(df, pws->b[11], pwt->b[11]); \
>>> + pwd->b[12] = msa_ ## func ## _df(df, pws->b[12], pwt->b[12]); \
>>> + pwd->b[13] = msa_ ## func ## _df(df, pws->b[13], pwt->b[13]); \
>>> + pwd->b[14] = msa_ ## func ## _df(df, pws->b[14], pwt->b[14]); \
>>> + pwd->b[15] = msa_ ## func ## _df(df, pws->b[15], pwt->b[15]); \
>>> break; \
>>> case DF_HALF: \
>>> - for (i = 0; i < DF_ELEMENTS(DF_HALF); i++) { \
>>> - pwd->h[i] = msa_ ## func ## _df(df, pws->h[i], pwt->h[i]); \
>>> - } \
>>> + pwd->h[0] = msa_ ## func ## _df(df, pws->h[0], pwt->h[0]); \
>>> + pwd->h[1] = msa_ ## func ## _df(df, pws->h[1], pwt->h[1]); \
>>> + pwd->h[2] = msa_ ## func ## _df(df, pws->h[2], pwt->h[2]); \
>>> + pwd->h[3] = msa_ ## func ## _df(df, pws->h[3], pwt->h[3]); \
>>> + pwd->h[4] = msa_ ## func ## _df(df, pws->h[4], pwt->h[4]); \
>>> + pwd->h[5] = msa_ ## func ## _df(df, pws->h[5], pwt->h[5]); \
>>> + pwd->h[6] = msa_ ## func ## _df(df, pws->h[6], pwt->h[6]); \
>>> + pwd->h[7] = msa_ ## func ## _df(df, pws->h[7], pwt->h[7]); \
>>> break; \
>>> case DF_WORD: \
>>> - for (i = 0; i < DF_ELEMENTS(DF_WORD); i++) { \
>>> - pwd->w[i] = msa_ ## func ## _df(df, pws->w[i], pwt->w[i]); \
>>> - } \
>>> + pwd->w[0] = msa_ ## func ## _df(df, pws->w[0], pwt->w[0]); \
>>> + pwd->w[1] = msa_ ## func ## _df(df, pws->w[1], pwt->w[1]); \
>>> + pwd->w[2] = msa_ ## func ## _df(df, pws->w[2], pwt->w[2]); \
>>> + pwd->w[3] = msa_ ## func ## _df(df, pws->w[3], pwt->w[3]); \
>>> break; \
>>> case DF_DOUBLE: \
>>> - for (i = 0; i < DF_ELEMENTS(DF_DOUBLE); i++) { \
>>> - pwd->d[i] = msa_ ## func ## _df(df, pws->d[i], pwt->d[i]); \
>>> - } \
>>> + pwd->d[0] = msa_ ## func ## _df(df, pws->d[0], pwt->d[0]); \
>>> + pwd->d[1] = msa_ ## func ## _df(df, pws->d[1], pwt->d[1]); \
>>> break; \
>>> default: \
>>> assert(0); \
>
> --
> Alex Bennée
>
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2019-06-03 13:30 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-04 16:51 [Qemu-devel] [PATCH 0/2] target/mips: Improve performance for MSA binary operations Mateja Marjanovic
2019-03-04 16:51 ` [Qemu-devel] [PATCH 1/2] " Mateja Marjanovic
2019-06-01 14:16 ` Aleksandar Markovic
2019-06-02 7:06 ` Aleksandar Markovic
2019-06-03 9:46 ` Mateja Marjanovic
2019-06-02 13:22 ` Alex Bennée
2019-06-03 13:10 ` Aleksandar Markovic
2019-06-03 13:29 ` Mateja Marjanovic
2019-03-04 16:51 ` [Qemu-devel] [PATCH 2/2] target/mips: Tests for binary integer MSA instruction (add, adds, hadd...) Mateja Marjanovic
2019-03-04 18:43 ` Aleksandar Markovic
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.