aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2019-02-14 18:33:00 +0000
committerPeter Maydell <peter.maydell@linaro.org>2019-02-14 18:33:00 +0000
commit0266c739abbed804deabb4ccde2aa449466ac3b4 (patch)
tree3c789a8bfeac4fc6f0b5b8794528facdd9a9f3c2
parent0d3e41d5efd638a0c5682f6813b26448c3c51624 (diff)
parentba632924450faf6741d299f8feed8150a0c6f884 (diff)
Merge remote-tracking branch 'remotes/amarkovic/tags/mips-queue-feb-14-2019' into staging
MIPS queue for February 14th, 2019 # gpg: Signature made Thu 14 Feb 2019 16:48:39 GMT # gpg: using RSA key D4972A8967F75A65 # gpg: Good signature from "Aleksandar Markovic <amarkovic@wavecomp.com>" [unknown] # gpg: WARNING: This key is not certified with a trusted signature! # gpg: There is no indication that the signature belongs to the owner. # Primary key fingerprint: 8526 FBF1 5DA3 811F 4A01 DD75 D497 2A89 67F7 5A65 * remotes/amarkovic/tags/mips-queue-feb-14-2019: tests/tcg: target/mips: Add tests for MSA logic instructions tests/tcg: target/mips: Add wrappers for MSA logic instructions tests/tcg: target/mips: Add tests for MSA interleave instructions tests/tcg: target/mips: Add wrappers for MSA interleave instructions tests/tcg: target/mips: Add tests for MSA bit counting instructions tests/tcg: target/mips: Add wrappers for MSA bit counting instructions tests/tcg: target/mips: Add a header with test utilities tests/tcg: target/mips: Add a header with test inputs tests/tcg: target/mips: Remove an unnecessary file target/mips: introduce MTTCG-enabled builds hw/mips_cpc: kick a VP when putting it into Run statewq target/mips: hold BQL in mips_vpe_wake() hw/mips_int: hold BQL for all interrupt requests target/mips: reimplement SC instruction emulation and use cmpxchg target/mips: compare virtual addresses in LL/SC sequence Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-rwxr-xr-xconfigure3
-rw-r--r--hw/mips/mips_int.c12
-rw-r--r--hw/misc/mips_cpc.c17
-rw-r--r--linux-user/mips/cpu_loop.c73
-rw-r--r--target/mips/cpu.h9
-rw-r--r--target/mips/helper.c6
-rw-r--r--target/mips/helper.h2
-rw-r--r--target/mips/machine.c7
-rw-r--r--target/mips/op_helper.c76
-rw-r--r--target/mips/translate.c127
-rw-r--r--tests/tcg/mips/include/test_inputs.h122
-rw-r--r--tests/tcg/mips/include/test_utils.h78
-rw-r--r--tests/tcg/mips/include/wrappers_msa.h101
-rw-r--r--tests/tcg/mips/mips64-dspr2/.directory2
-rw-r--r--tests/tcg/mips/user/ase/msa/bit-counting/test_msa_nloc_b.c144
-rw-r--r--tests/tcg/mips/user/ase/msa/bit-counting/test_msa_nloc_d.c144
-rw-r--r--tests/tcg/mips/user/ase/msa/bit-counting/test_msa_nloc_h.c144
-rw-r--r--tests/tcg/mips/user/ase/msa/bit-counting/test_msa_nloc_w.c144
-rw-r--r--tests/tcg/mips/user/ase/msa/bit-counting/test_msa_nlzc_b.c144
-rw-r--r--tests/tcg/mips/user/ase/msa/bit-counting/test_msa_nlzc_d.c144
-rw-r--r--tests/tcg/mips/user/ase/msa/bit-counting/test_msa_nlzc_h.c144
-rw-r--r--tests/tcg/mips/user/ase/msa/bit-counting/test_msa_nlzc_w.c144
-rw-r--r--tests/tcg/mips/user/ase/msa/bit-counting/test_msa_pcnt_b.c144
-rw-r--r--tests/tcg/mips/user/ase/msa/bit-counting/test_msa_pcnt_d.c144
-rw-r--r--tests/tcg/mips/user/ase/msa/bit-counting/test_msa_pcnt_h.c144
-rw-r--r--tests/tcg/mips/user/ase/msa/bit-counting/test_msa_pcnt_w.c144
-rw-r--r--tests/tcg/mips/user/ase/msa/interleave/test_msa_ilvev_b.c153
-rw-r--r--tests/tcg/mips/user/ase/msa/interleave/test_msa_ilvev_d.c153
-rw-r--r--tests/tcg/mips/user/ase/msa/interleave/test_msa_ilvev_h.c153
-rw-r--r--tests/tcg/mips/user/ase/msa/interleave/test_msa_ilvev_w.c153
-rw-r--r--tests/tcg/mips/user/ase/msa/interleave/test_msa_ilvl_b.c153
-rw-r--r--tests/tcg/mips/user/ase/msa/interleave/test_msa_ilvl_d.c153
-rw-r--r--tests/tcg/mips/user/ase/msa/interleave/test_msa_ilvl_h.c153
-rw-r--r--tests/tcg/mips/user/ase/msa/interleave/test_msa_ilvl_w.c153
-rw-r--r--tests/tcg/mips/user/ase/msa/interleave/test_msa_ilvod_b.c153
-rw-r--r--tests/tcg/mips/user/ase/msa/interleave/test_msa_ilvod_d.c153
-rw-r--r--tests/tcg/mips/user/ase/msa/interleave/test_msa_ilvod_h.c153
-rw-r--r--tests/tcg/mips/user/ase/msa/interleave/test_msa_ilvod_w.c153
-rw-r--r--tests/tcg/mips/user/ase/msa/interleave/test_msa_ilvr_b.c153
-rw-r--r--tests/tcg/mips/user/ase/msa/interleave/test_msa_ilvr_d.c153
-rw-r--r--tests/tcg/mips/user/ase/msa/interleave/test_msa_ilvr_h.c153
-rw-r--r--tests/tcg/mips/user/ase/msa/interleave/test_msa_ilvr_w.c153
-rw-r--r--tests/tcg/mips/user/ase/msa/logic/test_msa_and_v.c153
-rw-r--r--tests/tcg/mips/user/ase/msa/logic/test_msa_nor_v.c153
-rw-r--r--tests/tcg/mips/user/ase/msa/logic/test_msa_or_v.c153
-rw-r--r--tests/tcg/mips/user/ase/msa/logic/test_msa_xor_v.c153
46 files changed, 5194 insertions, 229 deletions
diff --git a/configure b/configure
index 90b9e2fa3c..a61682c3c7 100755
--- a/configure
+++ b/configure
@@ -7203,11 +7203,13 @@ case "$target_name" in
target_compiler=$cross_cc_microblaze
;;
mips|mipsel)
+ mttcg="yes"
TARGET_ARCH=mips
target_compiler=$cross_cc_mips
echo "TARGET_ABI_MIPSO32=y" >> $config_target_mak
;;
mipsn32|mipsn32el)
+ mttcg="yes"
TARGET_ARCH=mips64
TARGET_BASE_ARCH=mips
target_compiler=$cross_cc_mipsn32
@@ -7215,6 +7217,7 @@ case "$target_name" in
echo "TARGET_ABI32=y" >> $config_target_mak
;;
mips64|mips64el)
+ mttcg="yes"
TARGET_ARCH=mips64
TARGET_BASE_ARCH=mips
target_compiler=$cross_cc_mips64
diff --git a/hw/mips/mips_int.c b/hw/mips/mips_int.c
index 48192d22f3..5ddeb15848 100644
--- a/hw/mips/mips_int.c
+++ b/hw/mips/mips_int.c
@@ -21,6 +21,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/main-loop.h"
#include "hw/hw.h"
#include "hw/mips/cpudevs.h"
#include "cpu.h"
@@ -32,10 +33,17 @@ static void cpu_mips_irq_request(void *opaque, int irq, int level)
MIPSCPU *cpu = opaque;
CPUMIPSState *env = &cpu->env;
CPUState *cs = CPU(cpu);
+ bool locked = false;
if (irq < 0 || irq > 7)
return;
+ /* Make sure locking works even if BQL is already held by the caller */
+ if (!qemu_mutex_iothread_locked()) {
+ locked = true;
+ qemu_mutex_lock_iothread();
+ }
+
if (level) {
env->CP0_Cause |= 1 << (irq + CP0Ca_IP);
@@ -56,6 +64,10 @@ static void cpu_mips_irq_request(void *opaque, int irq, int level)
} else {
cpu_reset_interrupt(cs, CPU_INTERRUPT_HARD);
}
+
+ if (locked) {
+ qemu_mutex_unlock_iothread();
+ }
}
void cpu_mips_irq_init_cpu(MIPSCPU *cpu)
diff --git a/hw/misc/mips_cpc.c b/hw/misc/mips_cpc.c
index 6d345745f6..712d8423a7 100644
--- a/hw/misc/mips_cpc.c
+++ b/hw/misc/mips_cpc.c
@@ -30,6 +30,14 @@ static inline uint64_t cpc_vp_run_mask(MIPSCPCState *cpc)
return (1ULL << cpc->num_vp) - 1;
}
+static void mips_cpu_reset_async_work(CPUState *cs, run_on_cpu_data data)
+{
+ MIPSCPCState *cpc = (MIPSCPCState *) data.host_ptr;
+
+ cpu_reset(cs);
+ cpc->vp_running |= 1ULL << cs->cpu_index;
+}
+
static void cpc_run_vp(MIPSCPCState *cpc, uint64_t vp_run)
{
CPUState *cs = first_cpu;
@@ -37,8 +45,13 @@ static void cpc_run_vp(MIPSCPCState *cpc, uint64_t vp_run)
CPU_FOREACH(cs) {
uint64_t i = 1ULL << cs->cpu_index;
if (i & vp_run & ~cpc->vp_running) {
- cpu_reset(cs);
- cpc->vp_running |= i;
+ /*
+ * To avoid racing with a CPU we are just kicking off.
+ * We do the final bit of preparation for the work in
+ * the target CPUs context.
+ */
+ async_safe_run_on_cpu(cs, mips_cpu_reset_async_work,
+ RUN_ON_CPU_HOST_PTR(cpc));
}
}
}
diff --git a/linux-user/mips/cpu_loop.c b/linux-user/mips/cpu_loop.c
index d0f62ec9b6..61dc90d51c 100644
--- a/linux-user/mips/cpu_loop.c
+++ b/linux-user/mips/cpu_loop.c
@@ -392,70 +392,6 @@ static const uint8_t mips_syscall_args[] = {
# undef MIPS_SYS
# endif /* O32 */
-static int do_store_exclusive(CPUMIPSState *env)
-{
- target_ulong addr;
- target_ulong page_addr;
- target_ulong val;
- uint32_t val_wp = 0;
- uint32_t llnewval_wp = 0;
- int flags;
- int segv = 0;
- int reg;
- int d;
- int wp;
-
- addr = env->lladdr;
- page_addr = addr & TARGET_PAGE_MASK;
- start_exclusive();
- mmap_lock();
- flags = page_get_flags(page_addr);
- if ((flags & PAGE_READ) == 0) {
- segv = 1;
- } else {
- reg = env->llreg & 0x1f;
- d = (env->llreg & 0x20) != 0;
- wp = (env->llreg & 0x40) != 0;
- if (!wp) {
- if (d) {
- segv = get_user_s64(val, addr);
- } else {
- segv = get_user_s32(val, addr);
- }
- } else {
- segv = get_user_s32(val, addr);
- segv |= get_user_s32(val_wp, addr);
- llnewval_wp = env->llnewval_wp;
- }
- if (!segv) {
- if (val != env->llval && val_wp == llnewval_wp) {
- env->active_tc.gpr[reg] = 0;
- } else {
- if (!wp) {
- if (d) {
- segv = put_user_u64(env->llnewval, addr);
- } else {
- segv = put_user_u32(env->llnewval, addr);
- }
- } else {
- segv = put_user_u32(env->llnewval, addr);
- segv |= put_user_u32(env->llnewval_wp, addr + 4);
- }
- if (!segv) {
- env->active_tc.gpr[reg] = 1;
- }
- }
- }
- }
- env->lladdr = -1;
- if (!segv) {
- env->active_tc.PC += 4;
- }
- mmap_unlock();
- end_exclusive();
- return segv;
-}
-
/* Break codes */
enum {
BRK_OVERFLOW = 6,
@@ -597,15 +533,6 @@ done_syscall:
info.si_code = TARGET_TRAP_BRKPT;
queue_signal(env, info.si_signo, QEMU_SI_FAULT, &info);
break;
- case EXCP_SC:
- if (do_store_exclusive(env)) {
- info.si_signo = TARGET_SIGSEGV;
- info.si_errno = 0;
- info.si_code = TARGET_SEGV_MAPERR;
- info._sifields._sigfault._addr = env->active_tc.PC;
- queue_signal(env, info.si_signo, QEMU_SI_FAULT, &info);
- }
- break;
case EXCP_DSPDIS:
info.si_signo = TARGET_SIGILL;
info.si_errno = 0;
diff --git a/target/mips/cpu.h b/target/mips/cpu.h
index 473d26d6ff..a10eeb0de3 100644
--- a/target/mips/cpu.h
+++ b/target/mips/cpu.h
@@ -11,6 +11,8 @@
#include "exec/cpu-defs.h"
#include "fpu/softfloat.h"
+#define TCG_GUEST_DEFAULT_MO (0)
+
struct CPUMIPSState;
typedef struct CPUMIPSTLBContext CPUMIPSTLBContext;
@@ -867,18 +869,17 @@ struct CPUMIPSState {
#define CP0C5_NFExists 0
int32_t CP0_Config6;
int32_t CP0_Config7;
+ uint64_t CP0_LLAddr;
uint64_t CP0_MAAR[MIPS_MAAR_MAX];
int32_t CP0_MAARI;
/* XXX: Maybe make LLAddr per-TC? */
/*
* CP0 Register 17
*/
- uint64_t lladdr;
+ target_ulong lladdr; /* LL virtual address compared against SC */
target_ulong llval;
- target_ulong llnewval;
uint64_t llval_wp;
uint32_t llnewval_wp;
- target_ulong llreg;
uint64_t CP0_LLAddr_rw_bitmask;
int CP0_LLAddr_shift;
/*
@@ -1155,8 +1156,6 @@ enum {
EXCP_LAST = EXCP_TLBRI,
};
-/* Dummy exception for conditional stores. */
-#define EXCP_SC 0x100
/*
* This is an internally generated WAKE request line.
diff --git a/target/mips/helper.c b/target/mips/helper.c
index 8988452dbd..944f094566 100644
--- a/target/mips/helper.c
+++ b/target/mips/helper.c
@@ -1463,10 +1463,8 @@ void QEMU_NORETURN do_raise_exception_err(CPUMIPSState *env,
{
CPUState *cs = CPU(mips_env_get_cpu(env));
- if (exception < EXCP_SC) {
- qemu_log_mask(CPU_LOG_INT, "%s: %d %d\n",
- __func__, exception, error_code);
- }
+ qemu_log_mask(CPU_LOG_INT, "%s: %d %d\n",
+ __func__, exception, error_code);
cs->exception_index = exception;
env->error_code = error_code;
diff --git a/target/mips/helper.h b/target/mips/helper.h
index 8872c4647b..a6d687e340 100644
--- a/target/mips/helper.h
+++ b/target/mips/helper.h
@@ -13,10 +13,8 @@ DEF_HELPER_4(swr, void, env, tl, tl, int)
#ifndef CONFIG_USER_ONLY
DEF_HELPER_3(ll, tl, env, tl, int)
-DEF_HELPER_4(sc, tl, env, tl, tl, int)
#ifdef TARGET_MIPS64
DEF_HELPER_3(lld, tl, env, tl, int)
-DEF_HELPER_4(scd, tl, env, tl, tl, int)
#endif
#endif
diff --git a/target/mips/machine.c b/target/mips/machine.c
index 1341ab1df9..70d277db51 100644
--- a/target/mips/machine.c
+++ b/target/mips/machine.c
@@ -214,8 +214,8 @@ const VMStateDescription vmstate_tlb = {
const VMStateDescription vmstate_mips_cpu = {
.name = "cpu",
- .version_id = 17,
- .minimum_version_id = 17,
+ .version_id = 18,
+ .minimum_version_id = 18,
.post_load = cpu_post_load,
.fields = (VMStateField[]) {
/* Active TC */
@@ -293,9 +293,10 @@ const VMStateDescription vmstate_mips_cpu = {
VMSTATE_INT32(env.CP0_Config3, MIPSCPU),
VMSTATE_INT32(env.CP0_Config6, MIPSCPU),
VMSTATE_INT32(env.CP0_Config7, MIPSCPU),
+ VMSTATE_UINT64(env.CP0_LLAddr, MIPSCPU),
VMSTATE_UINT64_ARRAY(env.CP0_MAAR, MIPSCPU, MIPS_MAAR_MAX),
VMSTATE_INT32(env.CP0_MAARI, MIPSCPU),
- VMSTATE_UINT64(env.lladdr, MIPSCPU),
+ VMSTATE_UINTTL(env.lladdr, MIPSCPU),
VMSTATE_UINTTL_ARRAY(env.CP0_WatchLo, MIPSCPU, 8),
VMSTATE_INT32_ARRAY(env.CP0_WatchHi, MIPSCPU, 8),
VMSTATE_UINTTL(env.CP0_XContext, MIPSCPU),
diff --git a/target/mips/op_helper.c b/target/mips/op_helper.c
index aebad24ed6..0f272a5b93 100644
--- a/target/mips/op_helper.c
+++ b/target/mips/op_helper.c
@@ -349,15 +349,15 @@ static inline hwaddr do_translate_address(CPUMIPSState *env,
target_ulong address,
int rw, uintptr_t retaddr)
{
- hwaddr lladdr;
+ hwaddr paddr;
CPUState *cs = CPU(mips_env_get_cpu(env));
- lladdr = cpu_mips_translate_address(env, address, rw);
+ paddr = cpu_mips_translate_address(env, address, rw);
- if (lladdr == -1LL) {
+ if (paddr == -1LL) {
cpu_loop_exit_restore(cs, retaddr);
} else {
- return lladdr;
+ return paddr;
}
}
@@ -370,7 +370,8 @@ target_ulong helper_##name(CPUMIPSState *env, target_ulong arg, int mem_idx) \
} \
do_raise_exception(env, EXCP_AdEL, GETPC()); \
} \
- env->lladdr = do_translate_address(env, arg, 0, GETPC()); \
+ env->CP0_LLAddr = do_translate_address(env, arg, 0, GETPC()); \
+ env->lladdr = arg; \
env->llval = do_##insn(env, arg, mem_idx, GETPC()); \
return env->llval; \
}
@@ -379,33 +380,6 @@ HELPER_LD_ATOMIC(ll, lw, 0x3)
HELPER_LD_ATOMIC(lld, ld, 0x7)
#endif
#undef HELPER_LD_ATOMIC
-
-#define HELPER_ST_ATOMIC(name, ld_insn, st_insn, almask) \
-target_ulong helper_##name(CPUMIPSState *env, target_ulong arg1, \
- target_ulong arg2, int mem_idx) \
-{ \
- target_long tmp; \
- \
- if (arg2 & almask) { \
- if (!(env->hflags & MIPS_HFLAG_DM)) { \
- env->CP0_BadVAddr = arg2; \
- } \
- do_raise_exception(env, EXCP_AdES, GETPC()); \
- } \
- if (do_translate_address(env, arg2, 1, GETPC()) == env->lladdr) { \
- tmp = do_##ld_insn(env, arg2, mem_idx, GETPC()); \
- if (tmp == env->llval) { \
- do_##st_insn(env, arg2, arg1, mem_idx, GETPC()); \
- return 1; \
- } \
- } \
- return 0; \
-}
-HELPER_ST_ATOMIC(sc, lw, sw, 0x3)
-#ifdef TARGET_MIPS64
-HELPER_ST_ATOMIC(scd, ld, sd, 0x7)
-#endif
-#undef HELPER_ST_ATOMIC
#endif
#ifdef TARGET_WORDS_BIGENDIAN
@@ -665,7 +639,9 @@ static inline void mips_vpe_wake(MIPSCPU *c)
/* Don't set ->halted = 0 directly, let it be done via cpu_has_work
because there might be other conditions that state that c should
be sleeping. */
+ qemu_mutex_lock_iothread();
cpu_interrupt(CPU(c), CPU_INTERRUPT_WAKE);
+ qemu_mutex_unlock_iothread();
}
static inline void mips_vpe_sleep(MIPSCPU *cpu)
@@ -931,11 +907,7 @@ target_ulong helper_mftc0_tcschefback(CPUMIPSState *env)
target_ulong helper_mfc0_count(CPUMIPSState *env)
{
- int32_t count;
- qemu_mutex_lock_iothread();
- count = (int32_t) cpu_mips_get_count(env);
- qemu_mutex_unlock_iothread();
- return count;
+ return (int32_t)cpu_mips_get_count(env);
}
target_ulong helper_mfc0_saar(CPUMIPSState *env)
@@ -987,7 +959,7 @@ target_ulong helper_mftc0_status(CPUMIPSState *env)
target_ulong helper_mfc0_lladdr(CPUMIPSState *env)
{
- return (int32_t)(env->lladdr >> env->CP0_LLAddr_shift);
+ return (int32_t)(env->CP0_LLAddr >> env->CP0_LLAddr_shift);
}
target_ulong helper_mfc0_maar(CPUMIPSState *env)
@@ -1063,7 +1035,7 @@ target_ulong helper_dmfc0_tcschefback(CPUMIPSState *env)
target_ulong helper_dmfc0_lladdr(CPUMIPSState *env)
{
- return env->lladdr >> env->CP0_LLAddr_shift;
+ return env->CP0_LLAddr >> env->CP0_LLAddr_shift;
}
target_ulong helper_dmfc0_maar(CPUMIPSState *env)
@@ -1299,7 +1271,8 @@ void helper_mtc0_tcrestart(CPUMIPSState *env, target_ulong arg1)
{
env->active_tc.PC = arg1;
env->active_tc.CP0_TCStatus &= ~(1 << CP0TCSt_TDS);
- env->lladdr = 0ULL;
+ env->CP0_LLAddr = 0;
+ env->lladdr = 0;
/* MIPS16 not implemented. */
}
@@ -1311,12 +1284,14 @@ void helper_mttc0_tcrestart(CPUMIPSState *env, target_ulong arg1)
if (other_tc == other->current_tc) {
other->active_tc.PC = arg1;
other->active_tc.CP0_TCStatus &= ~(1 << CP0TCSt_TDS);
- other->lladdr = 0ULL;
+ other->CP0_LLAddr = 0;
+ other->lladdr = 0;
/* MIPS16 not implemented. */
} else {
other->tcs[other_tc].PC = arg1;
other->tcs[other_tc].CP0_TCStatus &= ~(1 << CP0TCSt_TDS);
- other->lladdr = 0ULL;
+ other->CP0_LLAddr = 0;
+ other->lladdr = 0;
/* MIPS16 not implemented. */
}
}
@@ -1617,9 +1592,7 @@ void helper_mtc0_hwrena(CPUMIPSState *env, target_ulong arg1)
void helper_mtc0_count(CPUMIPSState *env, target_ulong arg1)
{
- qemu_mutex_lock_iothread();
cpu_mips_store_count(env, arg1);
- qemu_mutex_unlock_iothread();
}
void helper_mtc0_saari(CPUMIPSState *env, target_ulong arg1)
@@ -1708,9 +1681,7 @@ void helper_mttc0_entryhi(CPUMIPSState *env, target_ulong arg1)
void helper_mtc0_compare(CPUMIPSState *env, target_ulong arg1)
{
- qemu_mutex_lock_iothread();
cpu_mips_store_compare(env, arg1);
- qemu_mutex_unlock_iothread();
}
void helper_mtc0_status(CPUMIPSState *env, target_ulong arg1)
@@ -1764,9 +1735,7 @@ void helper_mtc0_srsctl(CPUMIPSState *env, target_ulong arg1)
void helper_mtc0_cause(CPUMIPSState *env, target_ulong arg1)
{
- qemu_mutex_lock_iothread();
cpu_mips_store_cause(env, arg1);
- qemu_mutex_unlock_iothread();
}
void helper_mttc0_cause(CPUMIPSState *env, target_ulong arg1)
@@ -1868,7 +1837,7 @@ void helper_mtc0_lladdr(CPUMIPSState *env, target_ulong arg1)
{
target_long mask = env->CP0_LLAddr_rw_bitmask;
arg1 = arg1 << env->CP0_LLAddr_shift;
- env->lladdr = (env->lladdr & ~mask) | (arg1 & mask);
+ env->CP0_LLAddr = (env->CP0_LLAddr & ~mask) | (arg1 & mask);
}
#define MTC0_MAAR_MASK(env) \
@@ -2566,6 +2535,7 @@ static inline void exception_return(CPUMIPSState *env)
void helper_eret(CPUMIPSState *env)
{
exception_return(env);
+ env->CP0_LLAddr = 1;
env->lladdr = 1;
}
@@ -2609,16 +2579,12 @@ target_ulong helper_rdhwr_synci_step(CPUMIPSState *env)
target_ulong helper_rdhwr_cc(CPUMIPSState *env)
{
- int32_t count;
check_hwrena(env, 2, GETPC());
#ifdef CONFIG_USER_ONLY
- count = env->CP0_Count;
+ return env->CP0_Count;
#else
- qemu_mutex_lock_iothread();
- count = (int32_t)cpu_mips_get_count(env);
- qemu_mutex_unlock_iothread();
+ return (int32_t)cpu_mips_get_count(env);
#endif
- return count;
}
target_ulong helper_rdhwr_ccres(CPUMIPSState *env)
diff --git a/target/mips/translate.c b/target/mips/translate.c
index e9b5d1d860..3b170208c3 100644
--- a/target/mips/translate.c
+++ b/target/mips/translate.c
@@ -2450,6 +2450,7 @@ enum {
static TCGv cpu_gpr[32], cpu_PC;
static TCGv cpu_HI[MIPS_DSP_ACC], cpu_LO[MIPS_DSP_ACC];
static TCGv cpu_dspctrl, btarget, bcond;
+static TCGv cpu_lladdr, cpu_llval;
static TCGv_i32 hflags;
static TCGv_i32 fpu_fcr0, fpu_fcr31;
static TCGv_i64 fpu_f64[32];
@@ -3326,48 +3327,6 @@ OP_LD_ATOMIC(lld,ld64);
#endif
#undef OP_LD_ATOMIC
-#ifdef CONFIG_USER_ONLY
-#define OP_ST_ATOMIC(insn,fname,ldname,almask) \
-static inline void op_st_##insn(TCGv arg1, TCGv arg2, int rt, int mem_idx, \
- DisasContext *ctx) \
-{ \
- TCGv t0 = tcg_temp_new(); \
- TCGLabel *l1 = gen_new_label(); \
- TCGLabel *l2 = gen_new_label(); \
- \
- tcg_gen_andi_tl(t0, arg2, almask); \
- tcg_gen_brcondi_tl(TCG_COND_EQ, t0, 0, l1); \
- tcg_gen_st_tl(arg2, cpu_env, offsetof(CPUMIPSState, CP0_BadVAddr)); \
- generate_exception(ctx, EXCP_AdES); \
- gen_set_label(l1); \
- tcg_gen_ld_tl(t0, cpu_env, offsetof(CPUMIPSState, lladdr)); \
- tcg_gen_brcond_tl(TCG_COND_NE, arg2, t0, l2); \
- tcg_gen_movi_tl(t0, rt | ((almask << 3) & 0x20)); \
- tcg_gen_st_tl(t0, cpu_env, offsetof(CPUMIPSState, llreg)); \
- tcg_gen_st_tl(arg1, cpu_env, offsetof(CPUMIPSState, llnewval)); \
- generate_exception_end(ctx, EXCP_SC); \
- gen_set_label(l2); \
- tcg_gen_movi_tl(t0, 0); \
- gen_store_gpr(t0, rt); \
- tcg_temp_free(t0); \
-}
-#else
-#define OP_ST_ATOMIC(insn,fname,ldname,almask) \
-static inline void op_st_##insn(TCGv arg1, TCGv arg2, int rt, int mem_idx, \
- DisasContext *ctx) \
-{ \
- TCGv t0 = tcg_temp_new(); \
- gen_helper_1e2i(insn, t0, arg1, arg2, mem_idx); \
- gen_store_gpr(t0, rt); \
- tcg_temp_free(t0); \
-}
-#endif
-OP_ST_ATOMIC(sc,st32,ld32s,0x3);
-#if defined(TARGET_MIPS64)
-OP_ST_ATOMIC(scd,st64,ld64,0x7);
-#endif
-#undef OP_ST_ATOMIC
-
static void gen_base_offset_addr (DisasContext *ctx, TCGv addr,
int base, int offset)
{
@@ -3679,40 +3638,38 @@ static void gen_st (DisasContext *ctx, uint32_t opc, int rt,
/* Store conditional */
-static void gen_st_cond (DisasContext *ctx, uint32_t opc, int rt,
- int base, int16_t offset)
+static void gen_st_cond(DisasContext *ctx, int rt, int base, int offset,
+ TCGMemOp tcg_mo, bool eva)
{
- TCGv t0, t1;
- int mem_idx = ctx->mem_idx;
+ TCGv addr, t0, val;
+ TCGLabel *l1 = gen_new_label();
+ TCGLabel *done = gen_new_label();
-#ifdef CONFIG_USER_ONLY
- t0 = tcg_temp_local_new();
- t1 = tcg_temp_local_new();
-#else
t0 = tcg_temp_new();
- t1 = tcg_temp_new();
-#endif
- gen_base_offset_addr(ctx, t0, base, offset);
- gen_load_gpr(t1, rt);
- switch (opc) {
-#if defined(TARGET_MIPS64)
- case OPC_SCD:
- case R6_OPC_SCD:
- op_st_scd(t1, t0, rt, mem_idx, ctx);
- break;
-#endif
- case OPC_SCE:
- mem_idx = MIPS_HFLAG_UM;
- /* fall through */
- case OPC_SC:
- case R6_OPC_SC:
- op_st_sc(t1, t0, rt, mem_idx, ctx);
- break;
- }
- tcg_temp_free(t1);
+ addr = tcg_temp_new();
+ /* compare the address against that of the preceeding LL */
+ gen_base_offset_addr(ctx, addr, base, offset);
+ tcg_gen_brcond_tl(TCG_COND_EQ, addr, cpu_lladdr, l1);
+ tcg_temp_free(addr);
+ tcg_gen_movi_tl(t0, 0);
+ gen_store_gpr(t0, rt);
+ tcg_gen_br(done);
+
+ gen_set_label(l1);
+ /* generate cmpxchg */
+ val = tcg_temp_new();
+ gen_load_gpr(val, rt);
+ tcg_gen_atomic_cmpxchg_tl(t0, cpu_lladdr, cpu_llval, val,
+ eva ? MIPS_HFLAG_UM : ctx->mem_idx, tcg_mo);
+ tcg_gen_setcond_tl(TCG_COND_EQ, t0, t0, cpu_llval);
+ gen_store_gpr(t0, rt);
+ tcg_temp_free(val);
+
+ gen_set_label(done);
tcg_temp_free(t0);
}
+
static void gen_scwp(DisasContext *ctx, uint32_t base, int16_t offset,
uint32_t reg1, uint32_t reg2, bool eva)
{
@@ -6612,7 +6569,7 @@ static void gen_mfhc0(DisasContext *ctx, TCGv arg, int reg, int sel)
case CP0_REGISTER_17:
switch (sel) {
case 0:
- gen_mfhc0_load64(arg, offsetof(CPUMIPSState, lladdr),
+ gen_mfhc0_load64(arg, offsetof(CPUMIPSState, CP0_LLAddr),
ctx->CP0_LLAddr_shift);
register_name = "LLAddr";
break;
@@ -16864,13 +16821,13 @@ static void decode_micromips32_opc(CPUMIPSState *env, DisasContext *ctx)
gen_st(ctx, mips32_op, rt, rs, offset);
break;
case SC:
- gen_st_cond(ctx, OPC_SC, rt, rs, offset);
+ gen_st_cond(ctx, rt, rs, offset, MO_TESL, false);
break;
#if defined(TARGET_MIPS64)
case SCD:
check_insn(ctx, ISA_MIPS3);
check_mips_64(ctx);
- gen_st_cond(ctx, OPC_SCD, rt, rs, offset);
+ gen_st_cond(ctx, rt, rs, offset, MO_TEQ, false);
break;
#endif
case LD_EVA:
@@ -16951,7 +16908,7 @@ static void decode_micromips32_opc(CPUMIPSState *env, DisasContext *ctx)
mips32_op = OPC_SHE;
goto do_st_lr;
case SCE:
- gen_st_cond(ctx, OPC_SCE, rt, rs, offset);
+ gen_st_cond(ctx, rt, rs, offset, MO_TESL, true);
break;
case SWE:
mips32_op = OPC_SWE;
@@ -21558,7 +21515,7 @@ static int decode_nanomips_32_48_opc(CPUMIPSState *env, DisasContext *ctx)
case NM_P_SC:
switch (ctx->opcode & 0x03) {
case NM_SC:
- gen_st_cond(ctx, OPC_SC, rt, rs, s);
+ gen_st_cond(ctx, rt, rs, s, MO_TESL, false);
break;
case NM_SCWP:
check_xnp(ctx);
@@ -21661,7 +21618,7 @@ static int decode_nanomips_32_48_opc(CPUMIPSState *env, DisasContext *ctx)
check_xnp(ctx);
check_eva(ctx);
check_cp0_enabled(ctx);
- gen_st_cond(ctx, OPC_SCE, rt, rs, s);
+ gen_st_cond(ctx, rt, rs, s, MO_TESL, true);
break;
case NM_SCWPE:
check_xnp(ctx);
@@ -26698,7 +26655,7 @@ static void decode_opc_special3_r6(CPUMIPSState *env, DisasContext *ctx)
}
break;
case R6_OPC_SC:
- gen_st_cond(ctx, op1, rt, rs, imm);
+ gen_st_cond(ctx, rt, rs, imm, MO_TESL, false);
break;
case R6_OPC_LL:
gen_ld(ctx, op1, rt, rs, imm);
@@ -26725,7 +26682,7 @@ static void decode_opc_special3_r6(CPUMIPSState *env, DisasContext *ctx)
break;
#if defined(TARGET_MIPS64)
case R6_OPC_SCD:
- gen_st_cond(ctx, op1, rt, rs, imm);
+ gen_st_cond(ctx, rt, rs, imm, MO_TEQ, false);
break;
case R6_OPC_LLD:
gen_ld(ctx, op1, rt, rs, imm);
@@ -27580,7 +27537,7 @@ static void decode_opc_special3(CPUMIPSState *env, DisasContext *ctx)
return;
case OPC_SCE:
check_cp0_enabled(ctx);
- gen_st_cond(ctx, op1, rt, rs, imm);
+ gen_st_cond(ctx, rt, rs, imm, MO_TESL, true);
return;
case OPC_CACHEE:
check_cp0_enabled(ctx);
@@ -29172,8 +29129,8 @@ static void decode_opc(CPUMIPSState *env, DisasContext *ctx)
if (ctx->insn_flags & INSN_R5900) {
check_insn_opc_user_only(ctx, INSN_R5900);
}
- gen_st_cond(ctx, op, rt, rs, imm);
- break;
+ gen_st_cond(ctx, rt, rs, imm, MO_TESL, false);
+ break;
case OPC_CACHE:
check_insn_opc_removed(ctx, ISA_MIPS32R6);
check_cp0_enabled(ctx);
@@ -29472,7 +29429,7 @@ static void decode_opc(CPUMIPSState *env, DisasContext *ctx)
check_insn_opc_user_only(ctx, INSN_R5900);
}
check_mips_64(ctx);
- gen_st_cond(ctx, op, rt, rs, imm);
+ gen_st_cond(ctx, rt, rs, imm, MO_TEQ, false);
break;
case OPC_BNVC: /* OPC_BNEZALC, OPC_BNEC, OPC_DADDI */
if (ctx->insn_flags & ISA_MIPS32R6) {
@@ -29795,7 +29752,7 @@ void mips_cpu_dump_state(CPUState *cs, FILE *f, fprintf_function cpu_fprintf,
env->CP0_Status, env->CP0_Cause, env->CP0_EPC);
cpu_fprintf(f, " Config0 0x%08x Config1 0x%08x LLAddr 0x%016"
PRIx64 "\n",
- env->CP0_Config0, env->CP0_Config1, env->lladdr);
+ env->CP0_Config0, env->CP0_Config1, env->CP0_LLAddr);
cpu_fprintf(f, " Config2 0x%08x Config3 0x%08x\n",
env->CP0_Config2, env->CP0_Config3);
cpu_fprintf(f, " Config4 0x%08x Config5 0x%08x\n",
@@ -29853,6 +29810,10 @@ void mips_tcg_init(void)
fpu_fcr31 = tcg_global_mem_new_i32(cpu_env,
offsetof(CPUMIPSState, active_fpu.fcr31),
"fcr31");
+ cpu_lladdr = tcg_global_mem_new(cpu_env, offsetof(CPUMIPSState, lladdr),
+ "lladdr");
+ cpu_llval = tcg_global_mem_new(cpu_env, offsetof(CPUMIPSState, llval),
+ "llval");
#if defined(TARGET_MIPS64)
cpu_mmr[0] = NULL;
diff --git a/tests/tcg/mips/include/test_inputs.h b/tests/tcg/mips/include/test_inputs.h
new file mode 100644
index 0000000000..c173d589ff
--- /dev/null
+++ b/tests/tcg/mips/include/test_inputs.h
@@ -0,0 +1,122 @@
+/*
+ * Header file for pattern and random test inputs
+ *
+ * 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/>.
+ *
+ */
+
+#ifndef TEST_INPUTS_H
+#define TEST_INPUTS_H
+
+#include <stdint.h>
+
+
+#define PATTERN_INPUTS_COUNT 64
+#define PATTERN_INPUTS_SHORT_COUNT 8
+
+uint64_t b128_pattern[PATTERN_INPUTS_COUNT][2] = {
+ { 0xFFFFFFFFFFFFFFFFULL, 0xFFFFFFFFFFFFFFFFULL, }, /* 0 */
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0xAAAAAAAAAAAAAAAAULL, 0xAAAAAAAAAAAAAAAAULL, },
+ { 0x5555555555555555ULL, 0x5555555555555555ULL, },
+ { 0xCCCCCCCCCCCCCCCCULL, 0xCCCCCCCCCCCCCCCCULL, },
+ { 0x3333333333333333ULL, 0x3333333333333333ULL, },
+ { 0xE38E38E38E38E38EULL, 0x38E38E38E38E38E3ULL, },
+ { 0x1C71C71C71C71C71ULL, 0xC71C71C71C71C71CULL, },
+ { 0xF0F0F0F0F0F0F0F0ULL, 0xF0F0F0F0F0F0F0F0ULL, }, /* 8 */
+ { 0x0F0F0F0F0F0F0F0FULL, 0x0F0F0F0F0F0F0F0FULL, },
+ { 0xF83E0F83E0F83E0FULL, 0x83E0F83E0F83E0F8ULL, },
+ { 0x07C1F07C1F07C1F0ULL, 0x7C1F07C1F07C1F07ULL, },
+ { 0xFC0FC0FC0FC0FC0FULL, 0xC0FC0FC0FC0FC0FCULL, },
+ { 0x03F03F03F03F03F0ULL, 0x3F03F03F03F03F03ULL, },
+ { 0xFE03F80FE03F80FEULL, 0x03F80FE03F80FE03ULL, },
+ { 0x01FC07F01FC07F01ULL, 0xFC07F01FC07F01FCULL, },
+ { 0xFF00FF00FF00FF00ULL, 0xFF00FF00FF00FF00ULL, }, /* 16 */
+ { 0x00FF00FF00FF00FFULL, 0x00FF00FF00FF00FFULL, },
+ { 0xFF803FE00FF803FEULL, 0x00FF803FE00FF803ULL, },
+ { 0x007FC01FF007FC01ULL, 0xFF007FC01FF007FCULL, },
+ { 0xFFC00FFC00FFC00FULL, 0xFC00FFC00FFC00FFULL, },
+ { 0x003FF003FF003FF0ULL, 0x03FF003FF003FF00ULL, },
+ { 0xFFE003FF800FFE00ULL, 0x3FF800FFE003FF80ULL, },
+ { 0x001FFC007FF001FFULL, 0xC007FF001FFC007FULL, },
+ { 0xFFF000FFF000FFF0ULL, 0x00FFF000FFF000FFULL, }, /* 24 */
+ { 0x000FFF000FFF000FULL, 0xFF000FFF000FFF00ULL, },
+ { 0xFFF8003FFE000FFFULL, 0x8003FFE000FFF800ULL, },
+ { 0x0007FFC001FFF000ULL, 0x7FFC001FFF0007FFULL, },
+ { 0xFFFC000FFFC000FFULL, 0xFC000FFFC000FFFCULL, },
+ { 0x0003FFF0003FFF00ULL, 0x03FFF0003FFF0003ULL, },
+ { 0xFFFE0003FFF8000FULL, 0xFFE0003FFF8000FFULL, },
+ { 0x0001FFFC0007FFF0ULL, 0x001FFFC0007FFF00ULL, },
+ { 0xFFFF0000FFFF0000ULL, 0xFFFF0000FFFF0000ULL, }, /* 32 */
+ { 0x0000FFFF0000FFFFULL, 0x0000FFFF0000FFFFULL, },
+ { 0xFFFF80003FFFE000ULL, 0x0FFFF80003FFFE00ULL, },
+ { 0x00007FFFC0001FFFULL, 0xF00007FFFC0001FFULL, },
+ { 0xFFFFC0000FFFFC00ULL, 0x00FFFFC0000FFFFCULL, },
+ { 0x00003FFFF00003FFULL, 0xFF00003FFFF00003ULL, },
+ { 0xFFFFE00003FFFF80ULL, 0x000FFFFE00003FFFULL, },
+ { 0x00001FFFFC00007FULL, 0xFFF00001FFFFC000ULL, },
+ { 0xFFFFF00000FFFFF0ULL, 0x0000FFFFF00000FFULL, }, /* 40 */
+ { 0x00000FFFFF00000FULL, 0xFFFF00000FFFFF00ULL, },
+ { 0xFFFFF800003FFFFEULL, 0x00000FFFFF800003ULL, },
+ { 0x000007FFFFC00001ULL, 0xFFFFF000007FFFFCULL, },
+ { 0xFFFFFC00000FFFFFULL, 0xC00000FFFFFC0000ULL, },
+ { 0x000003FFFFF00000ULL, 0x3FFFFF000003FFFFULL, },
+ { 0xFFFFFE000003FFFFULL, 0xF800000FFFFFE000ULL, },
+ { 0x000001FFFFFC0000ULL, 0x07FFFFF000001FFFULL, },
+ { 0xFFFFFF000000FFFFULL, 0xFF000000FFFFFF00ULL, }, /* 48 */
+ { 0x000000FFFFFF0000ULL, 0x00FFFFFF000000FFULL, },
+ { 0xFFFFFF8000003FFFULL, 0xFFE000000FFFFFF8ULL, },
+ { 0x0000007FFFFFC000ULL, 0x001FFFFFF0000007ULL, },
+ { 0xFFFFFFC000000FFFULL, 0xFFFC000000FFFFFFULL, },
+ { 0x0000003FFFFFF000ULL, 0x0003FFFFFF000000ULL, },
+ { 0xFFFFFFE0000003FFULL, 0xFFFF8000000FFFFFULL, },
+ { 0x0000001FFFFFFC00ULL, 0x00007FFFFFF00000ULL, },
+ { 0xFFFFFFF0000000FFULL, 0xFFFFF0000000FFFFULL, }, /* 56 */
+ { 0x0000000FFFFFFF00ULL, 0x00000FFFFFFF0000ULL, },
+ { 0xFFFFFFF80000003FULL, 0xFFFFFE0000000FFFULL, },
+ { 0x00000007FFFFFFC0ULL, 0x000001FFFFFFF000ULL, },
+ { 0xFFFFFFFC0000000FULL, 0xFFFFFFC0000000FFULL, },
+ { 0x00000003FFFFFFF0ULL, 0x0000003FFFFFFF00ULL, },
+ { 0xFFFFFFFE00000003ULL, 0xFFFFFFF80000000FULL, },
+ { 0x00000001FFFFFFFCULL, 0x00000007FFFFFFF0ULL, },
+};
+
+
+#define RANDOM_INPUTS_COUNT 16
+#define RANDOM_INPUTS_SHORT_COUNT 4
+
+uint64_t b128_random[RANDOM_INPUTS_COUNT][2] = {
+ { 0x886AE6CC28625540ULL, 0x4B670B5EFE7BB00CULL, }, /* 0 */
+ { 0xFBBE00634D93C708ULL, 0x12F7BB1A153F52FCULL, },
+ { 0xAC5AAEAAB9CF8B80ULL, 0x27D8C6FFAB2B2514ULL, },
+ { 0x704F164D5E31E24EULL, 0x8DF188D8A942E2A0ULL, },
+ { 0xB9926B7C7DAF4258ULL, 0xA1227CADDCCE65B6ULL, },
+ { 0xD027BE89FF0A2EF9ULL, 0x170B5050FEA53078ULL, },
+ { 0xB83B580665CABC4AULL, 0x91230822BFF0BA62ULL, },
+ { 0xFC8F23F09AA6B782ULL, 0x93FD6637124275AEULL, },
+ { 0x201E09CD56AEE649ULL, 0xEF5DE039A6A52758ULL, }, /* 8 */
+ { 0xA57CD91365D9E5D7ULL, 0x9321BC9881ECBA5CULL, },
+ { 0xA2E8F6F5C9CBC61BULL, 0xB2C471545E0D7A12ULL, },
+ { 0xA89CF2F131A864AEULL, 0xD2A3E87A5DB986E7ULL, },
+ { 0xE61438E9A652EA0AULL, 0xA85483D97879D41CULL, },
+ { 0x944A35FD192361A8ULL, 0xF3912DA36A0B2D6BULL, },
+ { 0x4630426322BEF79CULL, 0xEB5686F7CB19304EULL, },
+ { 0x8B5AA7A2F259DEADULL, 0xD278CBCD696417E3ULL, },
+};
+
+
+#endif
diff --git a/tests/tcg/mips/include/test_utils.h b/tests/tcg/mips/include/test_utils.h
new file mode 100644
index 0000000000..82f4b5b1ef
--- /dev/null
+++ b/tests/tcg/mips/include/test_utils.h
@@ -0,0 +1,78 @@
+/*
+ * Header file for test utilities
+ *
+ * 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/>.
+ *
+ */
+
+#ifndef TEST_UTILS_H
+#define TEST_UTILS_H
+
+#include <stdio.h>
+#include <stdint.h>
+#include <inttypes.h>
+#include <string.h>
+
+#define PRINT_RESULTS 1
+
+
+static inline int32_t check_results(char *instruction_name,
+ uint32_t test_count,
+ double elapsed_time,
+ uint64_t *b128_result,
+ uint64_t *b128_expect)
+{
+#if PRINT_RESULTS
+ uint32_t ii;
+ printf("\n");
+ for (ii = 0; ii < test_count; ii++) {
+ uint64_t a, b;
+ memcpy(&a, (b128_result + 2 * ii), 8);
+ memcpy(&b, (b128_result + 2 * ii + 1), 8);
+ if (ii % 8 != 0) {
+ printf(" { 0x%016llxULL, 0x%016llxULL, },\n", a, b);
+ } else {
+ printf(" { 0x%016llxULL, 0x%016llxULL, }, /* %3d */\n",
+ a, b, ii);
+ }
+ }
+ printf("\n");
+#endif
+ uint32_t i;
+ uint32_t pass_count = 0;
+ uint32_t fail_count = 0;
+
+ printf("%s: ", instruction_name);
+ for (i = 0; i < test_count; i++) {
+ if (b128_result[i] == b128_expect[i]) {
+ pass_count++;
+ } else {
+ fail_count++;
+ }
+ }
+
+ printf("PASS: %3d FAIL: %3d elapsed time: %5.2f ms\n",
+ pass_count, fail_count, elapsed_time);
+
+ if (fail_count > 0) {
+ return -1;
+ } else {
+ return 0;
+ }
+}
+
+#endif
diff --git a/tests/tcg/mips/include/wrappers_msa.h b/tests/tcg/mips/include/wrappers_msa.h
new file mode 100644
index 0000000000..7a77fb9686
--- /dev/null
+++ b/tests/tcg/mips/include/wrappers_msa.h
@@ -0,0 +1,101 @@
+/*
+ * Header file for wrappers around MSA instructions assembler invocations
+ *
+ * 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/>.
+ *
+ */
+
+#ifndef WRAPPERS_MSA_H
+#define WRAPPERS_MSA_H
+
+
+#define DO_MSA__WD__WS(suffix, mnemonic) \
+static inline void do_msa_##suffix(void *input, void *output) \
+{ \
+ __asm__ volatile ( \
+ "move $t0, %0\n\t" \
+ "ld.d $w11, 0($t0)\n\t" \
+ #mnemonic " $w10, $w11\n\t" \
+ "move $t0, %1\n\t" \
+ "st.d $w10, 0($t0)\n\t" \
+ : \
+ : "r" (input), "r" (output) \
+ : "t0", "memory" \
+ ); \
+}
+
+DO_MSA__WD__WS(NLOC_B, nloc.b)
+DO_MSA__WD__WS(NLOC_H, nloc.h)
+DO_MSA__WD__WS(NLOC_W, nloc.w)
+DO_MSA__WD__WS(NLOC_D, nloc.d)
+
+DO_MSA__WD__WS(NLZC_B, nlzc.b)
+DO_MSA__WD__WS(NLZC_H, nlzc.h)
+DO_MSA__WD__WS(NLZC_W, nlzc.w)
+DO_MSA__WD__WS(NLZC_D, nlzc.d)
+
+DO_MSA__WD__WS(PCNT_B, pcnt.b)
+DO_MSA__WD__WS(PCNT_H, pcnt.h)
+DO_MSA__WD__WS(PCNT_W, pcnt.w)
+DO_MSA__WD__WS(PCNT_D, pcnt.d)
+
+
+#define DO_MSA__WD__WS_WT(suffix, mnemonic) \
+static inline void do_msa_##suffix(void *input1, void *input2, \
+ void *output) \
+{ \
+ __asm__ volatile ( \
+ "move $t0, %0\n\t" \
+ "ld.d $w11, 0($t0)\n\t" \
+ "move $t0, %1\n\t" \
+ "ld.d $w12, 0($t0)\n\t" \
+ #mnemonic " $w10, $w11, $w12\n\t" \
+ "move $t0, %2\n\t" \
+ "st.d $w10, 0($t0)\n\t" \
+ : \
+ : "r" (input1), "r" (input2), "r" (output) \
+ : "t0", "memory" \
+ ); \
+}
+
+DO_MSA__WD__WS_WT(ILVEV_B, ilvev.b)
+DO_MSA__WD__WS_WT(ILVEV_H, ilvev.h)
+DO_MSA__WD__WS_WT(ILVEV_W, ilvev.w)
+DO_MSA__WD__WS_WT(ILVEV_D, ilvev.d)
+
+DO_MSA__WD__WS_WT(ILVOD_B, ilvod.b)
+DO_MSA__WD__WS_WT(ILVOD_H, ilvod.h)
+DO_MSA__WD__WS_WT(ILVOD_W, ilvod.w)
+DO_MSA__WD__WS_WT(ILVOD_D, ilvod.d)
+
+DO_MSA__WD__WS_WT(ILVL_B, ilvl.b)
+DO_MSA__WD__WS_WT(ILVL_H, ilvl.h)
+DO_MSA__WD__WS_WT(ILVL_W, ilvl.w)
+DO_MSA__WD__WS_WT(ILVL_D, ilvl.d)
+
+DO_MSA__WD__WS_WT(ILVR_B, ilvr.b)
+DO_MSA__WD__WS_WT(ILVR_H, ilvr.h)
+DO_MSA__WD__WS_WT(ILVR_W, ilvr.w)
+DO_MSA__WD__WS_WT(ILVR_D, ilvr.d)
+
+DO_MSA__WD__WS_WT(AND_V, and.v)
+DO_MSA__WD__WS_WT(NOR_V, nor.v)
+DO_MSA__WD__WS_WT(OR_V, or.v)
+DO_MSA__WD__WS_WT(XOR_V, xor.v)
+
+
+#endif
diff --git a/tests/tcg/mips/mips64-dspr2/.directory b/tests/tcg/mips/mips64-dspr2/.directory
deleted file mode 100644
index c75a91451c..0000000000
--- a/tests/tcg/mips/mips64-dspr2/.directory
+++ /dev/null
@@ -1,2 +0,0 @@
-[Dolphin]
-Timestamp=2012,8,3,16,41,52
diff --git a/tests/tcg/mips/user/ase/msa/bit-counting/test_msa_nloc_b.c b/tests/tcg/mips/user/ase/msa/bit-counting/test_msa_nloc_b.c
new file mode 100644
index 0000000000..eb46290bff
--- /dev/null
+++ b/tests/tcg/mips/user/ase/msa/bit-counting/test_msa_nloc_b.c
@@ -0,0 +1,144 @@
+/*
+ * Test program for MSA instruction NLOC.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_COUNT + RANDOM_INPUTS_COUNT)
+
+
+int32_t main(void)
+{
+ char *instruction_name = "NLOC.B";
+ int32_t ret;
+ uint32_t i;
+ struct timeval start, end;
+ double elapsed_time;
+
+ uint64_t b128_result[TEST_COUNT_TOTAL][2];
+ uint64_t b128_expect[TEST_COUNT_TOTAL][2] = {
+ { 0x0808080808080808ULL, 0x0808080808080808ULL, }, /* 0 */
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0x0101010101010101ULL, 0x0101010101010101ULL, },
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0x0202020202020202ULL, 0x0202020202020202ULL, },
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0x0301000301000301ULL, 0x0003010003010003ULL, },
+ { 0x0000020000020000ULL, 0x0200000200000200ULL, },
+ { 0x0404040404040404ULL, 0x0404040404040404ULL, }, /* 8 */
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0x0500000103050000ULL, 0x0103050000010305ULL, },
+ { 0x0002040000000204ULL, 0x0000000204000000ULL, },
+ { 0x0600020600020600ULL, 0x0206000206000206ULL, },
+ { 0x0004000004000004ULL, 0x0000040000040000ULL, },
+ { 0x0700050003000107ULL, 0x0005000300010700ULL, },
+ { 0x0006000400020000ULL, 0x0600040002000006ULL, },
+ { 0x0800080008000800ULL, 0x0800080008000800ULL, }, /* 16 */
+ { 0x0008000800080008ULL, 0x0008000800080008ULL, },
+ { 0x0801000300050007ULL, 0x0008010003000500ULL, },
+ { 0x0000020004000600ULL, 0x0800000200040006ULL, },
+ { 0x0802000600080200ULL, 0x0600080200060008ULL, },
+ { 0x0000040008000004ULL, 0x0008000004000800ULL, },
+ { 0x0803000801000700ULL, 0x0005000803000801ULL, },
+ { 0x0000060000040008ULL, 0x0200080000060000ULL, },
+ { 0x0804000804000804ULL, 0x0008040008040008ULL, }, /* 24 */
+ { 0x0000080000080000ULL, 0x0800000800000800ULL, },
+ { 0x0805000007000008ULL, 0x0100080300080500ULL, },
+ { 0x0000080200080400ULL, 0x0006000008000008ULL, },
+ { 0x0806000008020008ULL, 0x0600000802000806ULL, },
+ { 0x0000080400000800ULL, 0x0008040000080000ULL, },
+ { 0x0807000008050000ULL, 0x0803000008010008ULL, },
+ { 0x0000080600000804ULL, 0x0000080200000800ULL, },
+ { 0x0808000008080000ULL, 0x0808000008080000ULL, }, /* 32 */
+ { 0x0000080800000808ULL, 0x0000080800000808ULL, },
+ { 0x0808010000080300ULL, 0x0008050000080700ULL, },
+ { 0x0000000802000008ULL, 0x0400000806000008ULL, },
+ { 0x0808020000080600ULL, 0x0008080200000806ULL, },
+ { 0x0000000804000008ULL, 0x0800000008040000ULL, },
+ { 0x0808030000080801ULL, 0x0000080700000008ULL, },
+ { 0x0000000806000000ULL, 0x0804000008080200ULL, },
+ { 0x0808040000080804ULL, 0x0000080804000008ULL, }, /* 40 */
+ { 0x0000000808000000ULL, 0x0808000000080800ULL, },
+ { 0x0808050000000807ULL, 0x0000000808010000ULL, },
+ { 0x0000000808020000ULL, 0x0808040000000806ULL, },
+ { 0x0808060000000808ULL, 0x0200000808060000ULL, },
+ { 0x0000000808040000ULL, 0x0008080000000808ULL, },
+ { 0x0808070000000808ULL, 0x0500000008080300ULL, },
+ { 0x0000000808060000ULL, 0x0008080400000008ULL, },
+ { 0x0808080000000808ULL, 0x0800000008080800ULL, }, /* 48 */
+ { 0x0000000808080000ULL, 0x0008080800000008ULL, },
+ { 0x0808080100000008ULL, 0x0803000000080805ULL, },
+ { 0x0000000008080200ULL, 0x0000080804000000ULL, },
+ { 0x0808080200000008ULL, 0x0806000000080808ULL, },
+ { 0x0000000008080400ULL, 0x0000080808000000ULL, },
+ { 0x0808080300000008ULL, 0x0808010000000808ULL, },
+ { 0x0000000008080600ULL, 0x0000000808040000ULL, },
+ { 0x0808080400000008ULL, 0x0808040000000808ULL, }, /* 56 */
+ { 0x0000000008080800ULL, 0x0000000808080000ULL, },
+ { 0x0808080500000000ULL, 0x0808070000000008ULL, },
+ { 0x0000000008080802ULL, 0x0000000808080400ULL, },
+ { 0x0808080600000000ULL, 0x0808080200000008ULL, },
+ { 0x0000000008080804ULL, 0x0000000008080800ULL, },
+ { 0x0808080700000000ULL, 0x0808080500000000ULL, },
+ { 0x0000000008080806ULL, 0x0000000008080804ULL, },
+ { 0x0100030200000000ULL, 0x0000000007000100ULL, }, /* 64 */
+ { 0x0501000000010200ULL, 0x0004010000000006ULL, },
+ { 0x0100010101020101ULL, 0x0002020801000000ULL, },
+ { 0x0000000000000300ULL, 0x0104010201000301ULL, },
+ { 0x0101000000010000ULL, 0x0100000102020001ULL, },
+ { 0x0200010108000005ULL, 0x0000000007010000ULL, },
+ { 0x0100000000020100ULL, 0x0100000001040100ULL, },
+ { 0x0601000401010101ULL, 0x0106000000000001ULL, },
+ { 0x0000000200010300ULL, 0x0300030001010000ULL, }, /* 72 */
+ { 0x0100020000020302ULL, 0x0100010101030100ULL, },
+ { 0x0103040402020200ULL, 0x0102000000000000ULL, },
+ { 0x0101040400010001ULL, 0x0201030000010103ULL, },
+ { 0x0300000301000300ULL, 0x0100010200000200ULL, },
+ { 0x0100000600000001ULL, 0x0401000100000000ULL, },
+ { 0x0000000000010401ULL, 0x0300010402000000ULL, },
+ { 0x0100010104000201ULL, 0x0200020200000003ULL, },
+ };
+
+ gettimeofday(&start, NULL);
+
+ for (i = 0; i < TEST_COUNT_TOTAL; i++) {
+ if (i < PATTERN_INPUTS_COUNT) {
+ do_msa_NLOC_B(b128_pattern[i], b128_result[i]);
+ } else {
+ do_msa_NLOC_B(b128_random[i - PATTERN_INPUTS_COUNT],
+ b128_result[i]);
+ }
+ }
+
+ 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/bit-counting/test_msa_nloc_d.c b/tests/tcg/mips/user/ase/msa/bit-counting/test_msa_nloc_d.c
new file mode 100644
index 0000000000..bb1c0cfa3f
--- /dev/null
+++ b/tests/tcg/mips/user/ase/msa/bit-counting/test_msa_nloc_d.c
@@ -0,0 +1,144 @@
+/*
+ * Test program for MSA instruction NLOC.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_COUNT + RANDOM_INPUTS_COUNT)
+
+
+int32_t main(void)
+{
+ char *instruction_name = "NLOC.D";
+ int32_t ret;
+ uint32_t i;
+ struct timeval start, end;
+ double elapsed_time;
+
+ uint64_t b128_result[TEST_COUNT_TOTAL][2];
+ uint64_t b128_expect[TEST_COUNT_TOTAL][2] = {
+ { 0x0000000000000040ULL, 0x0000000000000040ULL, }, /* 0 */
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0x0000000000000001ULL, 0x0000000000000001ULL, },
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0x0000000000000002ULL, 0x0000000000000002ULL, },
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0x0000000000000003ULL, 0x0000000000000000ULL, },
+ { 0x0000000000000000ULL, 0x0000000000000002ULL, },
+ { 0x0000000000000004ULL, 0x0000000000000004ULL, }, /* 8 */
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0x0000000000000005ULL, 0x0000000000000001ULL, },
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0x0000000000000006ULL, 0x0000000000000002ULL, },
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0x0000000000000007ULL, 0x0000000000000000ULL, },
+ { 0x0000000000000000ULL, 0x0000000000000006ULL, },
+ { 0x0000000000000008ULL, 0x0000000000000008ULL, }, /* 16 */
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0x0000000000000009ULL, 0x0000000000000000ULL, },
+ { 0x0000000000000000ULL, 0x0000000000000008ULL, },
+ { 0x000000000000000aULL, 0x0000000000000006ULL, },
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0x000000000000000bULL, 0x0000000000000000ULL, },
+ { 0x0000000000000000ULL, 0x0000000000000002ULL, },
+ { 0x000000000000000cULL, 0x0000000000000000ULL, }, /* 24 */
+ { 0x0000000000000000ULL, 0x0000000000000008ULL, },
+ { 0x000000000000000dULL, 0x0000000000000001ULL, },
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0x000000000000000eULL, 0x0000000000000006ULL, },
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0x000000000000000fULL, 0x000000000000000bULL, },
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0x0000000000000010ULL, 0x0000000000000010ULL, }, /* 32 */
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0x0000000000000011ULL, 0x0000000000000000ULL, },
+ { 0x0000000000000000ULL, 0x0000000000000004ULL, },
+ { 0x0000000000000012ULL, 0x0000000000000000ULL, },
+ { 0x0000000000000000ULL, 0x0000000000000008ULL, },
+ { 0x0000000000000013ULL, 0x0000000000000000ULL, },
+ { 0x0000000000000000ULL, 0x000000000000000cULL, },
+ { 0x0000000000000014ULL, 0x0000000000000000ULL, }, /* 40 */
+ { 0x0000000000000000ULL, 0x0000000000000010ULL, },
+ { 0x0000000000000015ULL, 0x0000000000000000ULL, },
+ { 0x0000000000000000ULL, 0x0000000000000014ULL, },
+ { 0x0000000000000016ULL, 0x0000000000000002ULL, },
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0x0000000000000017ULL, 0x0000000000000005ULL, },
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0x0000000000000018ULL, 0x0000000000000008ULL, }, /* 48 */
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0x0000000000000019ULL, 0x000000000000000bULL, },
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0x000000000000001aULL, 0x000000000000000eULL, },
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0x000000000000001bULL, 0x0000000000000011ULL, },
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0x000000000000001cULL, 0x0000000000000014ULL, }, /* 56 */
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0x000000000000001dULL, 0x0000000000000017ULL, },
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0x000000000000001eULL, 0x000000000000001aULL, },
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0x000000000000001fULL, 0x000000000000001dULL, },
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0x0000000000000001ULL, 0x0000000000000000ULL, }, /* 64 */
+ { 0x0000000000000005ULL, 0x0000000000000000ULL, },
+ { 0x0000000000000001ULL, 0x0000000000000000ULL, },
+ { 0x0000000000000000ULL, 0x0000000000000001ULL, },
+ { 0x0000000000000001ULL, 0x0000000000000001ULL, },
+ { 0x0000000000000002ULL, 0x0000000000000000ULL, },
+ { 0x0000000000000001ULL, 0x0000000000000001ULL, },
+ { 0x0000000000000006ULL, 0x0000000000000001ULL, },
+ { 0x0000000000000000ULL, 0x0000000000000003ULL, }, /* 72 */
+ { 0x0000000000000001ULL, 0x0000000000000001ULL, },
+ { 0x0000000000000001ULL, 0x0000000000000001ULL, },
+ { 0x0000000000000001ULL, 0x0000000000000002ULL, },
+ { 0x0000000000000003ULL, 0x0000000000000001ULL, },
+ { 0x0000000000000001ULL, 0x0000000000000004ULL, },
+ { 0x0000000000000000ULL, 0x0000000000000003ULL, },
+ { 0x0000000000000001ULL, 0x0000000000000002ULL, },
+ };
+
+ gettimeofday(&start, NULL);
+
+ for (i = 0; i < TEST_COUNT_TOTAL; i++) {
+ if (i < PATTERN_INPUTS_COUNT) {
+ do_msa_NLOC_D(b128_pattern[i], b128_result[i]);
+ } else {
+ do_msa_NLOC_D(b128_random[i - PATTERN_INPUTS_COUNT],
+ b128_result[i]);
+ }
+ }
+
+ 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/bit-counting/test_msa_nloc_h.c b/tests/tcg/mips/user/ase/msa/bit-counting/test_msa_nloc_h.c
new file mode 100644
index 0000000000..da1cd83448
--- /dev/null
+++ b/tests/tcg/mips/user/ase/msa/bit-counting/test_msa_nloc_h.c
@@ -0,0 +1,144 @@
+/*
+ * Test program for MSA instruction NLOC.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_COUNT + RANDOM_INPUTS_COUNT)
+
+
+int32_t main(void)
+{
+ char *instruction_name = "NLOC.H";
+ int32_t ret;
+ uint32_t i;
+ struct timeval start, end;
+ double elapsed_time;
+
+ uint64_t b128_result[TEST_COUNT_TOTAL][2];
+ uint64_t b128_expect[TEST_COUNT_TOTAL][2] = {
+ { 0x0010001000100010ULL, 0x0010001000100010ULL, }, /* 0 */
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0x0001000100010001ULL, 0x0001000100010001ULL, },
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0x0002000200020002ULL, 0x0002000200020002ULL, },
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0x0003000000010003ULL, 0x0000000100030000ULL, },
+ { 0x0000000200000000ULL, 0x0002000000000002ULL, },
+ { 0x0004000400040004ULL, 0x0004000400040004ULL, }, /* 8 */
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0x0005000000030000ULL, 0x0001000500000003ULL, },
+ { 0x0000000400000002ULL, 0x0000000000040000ULL, },
+ { 0x0006000200000006ULL, 0x0002000000060002ULL, },
+ { 0x0000000000040000ULL, 0x0000000400000000ULL, },
+ { 0x0007000500030001ULL, 0x0000000000000007ULL, },
+ { 0x0000000000000000ULL, 0x0006000400020000ULL, },
+ { 0x0008000800080008ULL, 0x0008000800080008ULL, }, /* 16 */
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0x0009000000000000ULL, 0x0000000100030005ULL, },
+ { 0x0000000200040006ULL, 0x0008000000000000ULL, },
+ { 0x000a000000000002ULL, 0x0006000a00000000ULL, },
+ { 0x0000000400080000ULL, 0x0000000000040008ULL, },
+ { 0x000b000000010007ULL, 0x0000000000030009ULL, },
+ { 0x0000000600000000ULL, 0x0002000800000000ULL, },
+ { 0x000c00000004000cULL, 0x00000004000c0000ULL, }, /* 24 */
+ { 0x0000000800000000ULL, 0x0008000000000008ULL, },
+ { 0x000d000000070000ULL, 0x0001000b00000005ULL, },
+ { 0x0000000a00000004ULL, 0x0000000000080000ULL, },
+ { 0x000e0000000a0000ULL, 0x000600000002000eULL, },
+ { 0x0000000c00000008ULL, 0x0000000400000000ULL, },
+ { 0x000f0000000d0000ULL, 0x000b000000090000ULL, },
+ { 0x0000000e0000000cULL, 0x0000000a00000008ULL, },
+ { 0x0010000000100000ULL, 0x0010000000100000ULL, }, /* 32 */
+ { 0x0000001000000010ULL, 0x0000001000000010ULL, },
+ { 0x0010000100000003ULL, 0x0000000500000007ULL, },
+ { 0x0000000000020000ULL, 0x0004000000060000ULL, },
+ { 0x0010000200000006ULL, 0x0000000a0000000eULL, },
+ { 0x0000000000040000ULL, 0x00080000000c0000ULL, },
+ { 0x0010000300000009ULL, 0x0000000f00000000ULL, },
+ { 0x0000000000060000ULL, 0x000c000000100002ULL, },
+ { 0x001000040000000cULL, 0x0000001000040000ULL, }, /* 40 */
+ { 0x0000000000080000ULL, 0x0010000000000008ULL, },
+ { 0x001000050000000fULL, 0x0000000000090000ULL, },
+ { 0x00000000000a0000ULL, 0x001000040000000eULL, },
+ { 0x0010000600000010ULL, 0x00020000000e0000ULL, },
+ { 0x00000000000c0000ULL, 0x0000000800000010ULL, },
+ { 0x0010000700000010ULL, 0x0005000000100003ULL, },
+ { 0x00000000000e0000ULL, 0x0000000c00000000ULL, },
+ { 0x0010000800000010ULL, 0x0008000000100008ULL, }, /* 48 */
+ { 0x0000000000100000ULL, 0x0000001000000000ULL, },
+ { 0x0010000900000000ULL, 0x000b00000000000dULL, },
+ { 0x0000000000100002ULL, 0x0000001000040000ULL, },
+ { 0x0010000a00000000ULL, 0x000e000000000010ULL, },
+ { 0x0000000000100004ULL, 0x0000001000080000ULL, },
+ { 0x0010000b00000000ULL, 0x0010000100000010ULL, },
+ { 0x0000000000100006ULL, 0x00000000000c0000ULL, },
+ { 0x0010000c00000000ULL, 0x0010000400000010ULL, }, /* 56 */
+ { 0x0000000000100008ULL, 0x0000000000100000ULL, },
+ { 0x0010000d00000000ULL, 0x0010000700000000ULL, },
+ { 0x000000000010000aULL, 0x0000000000100004ULL, },
+ { 0x0010000e00000000ULL, 0x0010000a00000000ULL, },
+ { 0x000000000010000cULL, 0x0000000000100008ULL, },
+ { 0x0010000f00000000ULL, 0x0010000d00000000ULL, },
+ { 0x000000000010000eULL, 0x000000000010000cULL, },
+ { 0x0001000300000000ULL, 0x0000000000070001ULL, }, /* 64 */
+ { 0x0005000000000002ULL, 0x0000000100000000ULL, },
+ { 0x0001000100010001ULL, 0x0000000200010000ULL, },
+ { 0x0000000000000003ULL, 0x0001000100010003ULL, },
+ { 0x0001000000000000ULL, 0x0001000000020000ULL, },
+ { 0x0002000100080000ULL, 0x0000000000070000ULL, },
+ { 0x0001000000000001ULL, 0x0001000000010001ULL, },
+ { 0x0006000000010001ULL, 0x0001000000000000ULL, },
+ { 0x0000000000000003ULL, 0x0003000300010000ULL, }, /* 72 */
+ { 0x0001000200000003ULL, 0x0001000100010001ULL, },
+ { 0x0001000400020002ULL, 0x0001000000000000ULL, },
+ { 0x0001000400000000ULL, 0x0002000300000001ULL, },
+ { 0x0003000000010003ULL, 0x0001000100000002ULL, },
+ { 0x0001000000000000ULL, 0x0004000000000000ULL, },
+ { 0x0000000000000004ULL, 0x0003000100020000ULL, },
+ { 0x0001000100040002ULL, 0x0002000200000000ULL, },
+ };
+
+ gettimeofday(&start, NULL);
+
+ for (i = 0; i < TEST_COUNT_TOTAL; i++) {
+ if (i < PATTERN_INPUTS_COUNT) {
+ do_msa_NLOC_H(b128_pattern[i], b128_result[i]);
+ } else {
+ do_msa_NLOC_H(b128_random[i - PATTERN_INPUTS_COUNT],
+ b128_result[i]);
+ }
+ }
+
+ 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/bit-counting/test_msa_nloc_w.c b/tests/tcg/mips/user/ase/msa/bit-counting/test_msa_nloc_w.c
new file mode 100644
index 0000000000..a059763781
--- /dev/null
+++ b/tests/tcg/mips/user/ase/msa/bit-counting/test_msa_nloc_w.c
@@ -0,0 +1,144 @@
+/*
+ * Test program for MSA instruction NLOC.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_COUNT + RANDOM_INPUTS_COUNT)
+
+
+int32_t main(void)
+{
+ char *instruction_name = "NLOC.W";
+ int32_t ret;
+ uint32_t i;
+ struct timeval start, end;
+ double elapsed_time;
+
+ uint64_t b128_result[TEST_COUNT_TOTAL][2];
+ uint64_t b128_expect[TEST_COUNT_TOTAL][2] = {
+ { 0x0000002000000020ULL, 0x0000002000000020ULL, }, /* 0 */
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0x0000000100000001ULL, 0x0000000100000001ULL, },
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0x0000000200000002ULL, 0x0000000200000002ULL, },
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0x0000000300000001ULL, 0x0000000000000003ULL, },
+ { 0x0000000000000000ULL, 0x0000000200000000ULL, },
+ { 0x0000000400000004ULL, 0x0000000400000004ULL, }, /* 8 */
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0x0000000500000003ULL, 0x0000000100000000ULL, },
+ { 0x0000000000000000ULL, 0x0000000000000004ULL, },
+ { 0x0000000600000000ULL, 0x0000000200000006ULL, },
+ { 0x0000000000000004ULL, 0x0000000000000000ULL, },
+ { 0x0000000700000003ULL, 0x0000000000000000ULL, },
+ { 0x0000000000000000ULL, 0x0000000600000002ULL, },
+ { 0x0000000800000008ULL, 0x0000000800000008ULL, }, /* 16 */
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0x0000000900000000ULL, 0x0000000000000003ULL, },
+ { 0x0000000000000004ULL, 0x0000000800000000ULL, },
+ { 0x0000000a00000000ULL, 0x0000000600000000ULL, },
+ { 0x0000000000000008ULL, 0x0000000000000004ULL, },
+ { 0x0000000b00000001ULL, 0x0000000000000003ULL, },
+ { 0x0000000000000000ULL, 0x0000000200000000ULL, },
+ { 0x0000000c00000004ULL, 0x000000000000000cULL, }, /* 24 */
+ { 0x0000000000000000ULL, 0x0000000800000000ULL, },
+ { 0x0000000d00000007ULL, 0x0000000100000000ULL, },
+ { 0x0000000000000000ULL, 0x0000000000000008ULL, },
+ { 0x0000000e0000000aULL, 0x0000000600000002ULL, },
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0x0000000f0000000dULL, 0x0000000b00000009ULL, },
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0x0000001000000010ULL, 0x0000001000000010ULL, }, /* 32 */
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0x0000001100000000ULL, 0x0000000000000000ULL, },
+ { 0x0000000000000002ULL, 0x0000000400000006ULL, },
+ { 0x0000001200000000ULL, 0x0000000000000000ULL, },
+ { 0x0000000000000004ULL, 0x000000080000000cULL, },
+ { 0x0000001300000000ULL, 0x0000000000000000ULL, },
+ { 0x0000000000000006ULL, 0x0000000c00000012ULL, },
+ { 0x0000001400000000ULL, 0x0000000000000004ULL, }, /* 40 */
+ { 0x0000000000000008ULL, 0x0000001000000000ULL, },
+ { 0x0000001500000000ULL, 0x0000000000000009ULL, },
+ { 0x000000000000000aULL, 0x0000001400000000ULL, },
+ { 0x0000001600000000ULL, 0x000000020000000eULL, },
+ { 0x000000000000000cULL, 0x0000000000000000ULL, },
+ { 0x0000001700000000ULL, 0x0000000500000013ULL, },
+ { 0x000000000000000eULL, 0x0000000000000000ULL, },
+ { 0x0000001800000000ULL, 0x0000000800000018ULL, }, /* 48 */
+ { 0x0000000000000010ULL, 0x0000000000000000ULL, },
+ { 0x0000001900000000ULL, 0x0000000b00000000ULL, },
+ { 0x0000000000000012ULL, 0x0000000000000004ULL, },
+ { 0x0000001a00000000ULL, 0x0000000e00000000ULL, },
+ { 0x0000000000000014ULL, 0x0000000000000008ULL, },
+ { 0x0000001b00000000ULL, 0x0000001100000000ULL, },
+ { 0x0000000000000016ULL, 0x000000000000000cULL, },
+ { 0x0000001c00000000ULL, 0x0000001400000000ULL, }, /* 56 */
+ { 0x0000000000000018ULL, 0x0000000000000010ULL, },
+ { 0x0000001d00000000ULL, 0x0000001700000000ULL, },
+ { 0x000000000000001aULL, 0x0000000000000014ULL, },
+ { 0x0000001e00000000ULL, 0x0000001a00000000ULL, },
+ { 0x000000000000001cULL, 0x0000000000000018ULL, },
+ { 0x0000001f00000000ULL, 0x0000001d00000000ULL, },
+ { 0x000000000000001eULL, 0x000000000000001cULL, },
+ { 0x0000000100000000ULL, 0x0000000000000007ULL, }, /* 64 */
+ { 0x0000000500000000ULL, 0x0000000000000000ULL, },
+ { 0x0000000100000001ULL, 0x0000000000000001ULL, },
+ { 0x0000000000000000ULL, 0x0000000100000001ULL, },
+ { 0x0000000100000000ULL, 0x0000000100000002ULL, },
+ { 0x0000000200000008ULL, 0x0000000000000007ULL, },
+ { 0x0000000100000000ULL, 0x0000000100000001ULL, },
+ { 0x0000000600000001ULL, 0x0000000100000000ULL, },
+ { 0x0000000000000000ULL, 0x0000000300000001ULL, }, /* 72 */
+ { 0x0000000100000000ULL, 0x0000000100000001ULL, },
+ { 0x0000000100000002ULL, 0x0000000100000000ULL, },
+ { 0x0000000100000000ULL, 0x0000000200000000ULL, },
+ { 0x0000000300000001ULL, 0x0000000100000000ULL, },
+ { 0x0000000100000000ULL, 0x0000000400000000ULL, },
+ { 0x0000000000000000ULL, 0x0000000300000002ULL, },
+ { 0x0000000100000004ULL, 0x0000000200000000ULL, },
+ };
+
+ gettimeofday(&start, NULL);
+
+ for (i = 0; i < TEST_COUNT_TOTAL; i++) {
+ if (i < PATTERN_INPUTS_COUNT) {
+ do_msa_NLOC_W(b128_pattern[i], b128_result[i]);
+ } else {
+ do_msa_NLOC_W(b128_random[i - PATTERN_INPUTS_COUNT],
+ b128_result[i]);
+ }
+ }
+
+ 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/bit-counting/test_msa_nlzc_b.c b/tests/tcg/mips/user/ase/msa/bit-counting/test_msa_nlzc_b.c
new file mode 100644
index 0000000000..9616d6e1a3
--- /dev/null
+++ b/tests/tcg/mips/user/ase/msa/bit-counting/test_msa_nlzc_b.c
@@ -0,0 +1,144 @@
+/*
+ * Test program for MSA instruction NLZC.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_COUNT + RANDOM_INPUTS_COUNT)
+
+
+int32_t main(void)
+{
+ char *instruction_name = "NLZC.B";
+ int32_t ret;
+ uint32_t i;
+ struct timeval start, end;
+ double elapsed_time;
+
+ uint64_t b128_result[TEST_COUNT_TOTAL][2];
+ uint64_t b128_expect[TEST_COUNT_TOTAL][2] = {
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 0 */
+ { 0x0808080808080808ULL, 0x0808080808080808ULL, },
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0x0101010101010101ULL, 0x0101010101010101ULL, },
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0x0202020202020202ULL, 0x0202020202020202ULL, },
+ { 0x0000020000020000ULL, 0x0200000200000200ULL, },
+ { 0x0301000301000301ULL, 0x0003010003010003ULL, },
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 8 */
+ { 0x0404040404040404ULL, 0x0404040404040404ULL, },
+ { 0x0002040000000204ULL, 0x0000000204000000ULL, },
+ { 0x0500000103050000ULL, 0x0103050000010305ULL, },
+ { 0x0004000004000004ULL, 0x0000040000040000ULL, },
+ { 0x0600020600020600ULL, 0x0206000206000206ULL, },
+ { 0x0006000400020000ULL, 0x0600040002000006ULL, },
+ { 0x0700050003000107ULL, 0x0005000300010700ULL, },
+ { 0x0008000800080008ULL, 0x0008000800080008ULL, }, /* 16 */
+ { 0x0800080008000800ULL, 0x0800080008000800ULL, },
+ { 0x0000020004000600ULL, 0x0800000200040006ULL, },
+ { 0x0801000300050007ULL, 0x0008010003000500ULL, },
+ { 0x0000040008000004ULL, 0x0008000004000800ULL, },
+ { 0x0802000600080200ULL, 0x0600080200060008ULL, },
+ { 0x0000060000040008ULL, 0x0200080000060000ULL, },
+ { 0x0803000801000700ULL, 0x0005000803000801ULL, },
+ { 0x0000080000080000ULL, 0x0800000800000800ULL, }, /* 24 */
+ { 0x0804000804000804ULL, 0x0008040008040008ULL, },
+ { 0x0000080200080400ULL, 0x0006000008000008ULL, },
+ { 0x0805000007000008ULL, 0x0100080300080500ULL, },
+ { 0x0000080400000800ULL, 0x0008040000080000ULL, },
+ { 0x0806000008020008ULL, 0x0600000802000806ULL, },
+ { 0x0000080600000804ULL, 0x0000080200000800ULL, },
+ { 0x0807000008050000ULL, 0x0803000008010008ULL, },
+ { 0x0000080800000808ULL, 0x0000080800000808ULL, }, /* 32 */
+ { 0x0808000008080000ULL, 0x0808000008080000ULL, },
+ { 0x0000000802000008ULL, 0x0400000806000008ULL, },
+ { 0x0808010000080300ULL, 0x0008050000080700ULL, },
+ { 0x0000000804000008ULL, 0x0800000008040000ULL, },
+ { 0x0808020000080600ULL, 0x0008080200000806ULL, },
+ { 0x0000000806000000ULL, 0x0804000008080200ULL, },
+ { 0x0808030000080801ULL, 0x0000080700000008ULL, },
+ { 0x0000000808000000ULL, 0x0808000000080800ULL, }, /* 40 */
+ { 0x0808040000080804ULL, 0x0000080804000008ULL, },
+ { 0x0000000808020000ULL, 0x0808040000000806ULL, },
+ { 0x0808050000000807ULL, 0x0000000808010000ULL, },
+ { 0x0000000808040000ULL, 0x0008080000000808ULL, },
+ { 0x0808060000000808ULL, 0x0200000808060000ULL, },
+ { 0x0000000808060000ULL, 0x0008080400000008ULL, },
+ { 0x0808070000000808ULL, 0x0500000008080300ULL, },
+ { 0x0000000808080000ULL, 0x0008080800000008ULL, }, /* 48 */
+ { 0x0808080000000808ULL, 0x0800000008080800ULL, },
+ { 0x0000000008080200ULL, 0x0000080804000000ULL, },
+ { 0x0808080100000008ULL, 0x0803000000080805ULL, },
+ { 0x0000000008080400ULL, 0x0000080808000000ULL, },
+ { 0x0808080200000008ULL, 0x0806000000080808ULL, },
+ { 0x0000000008080600ULL, 0x0000000808040000ULL, },
+ { 0x0808080300000008ULL, 0x0808010000000808ULL, },
+ { 0x0000000008080800ULL, 0x0000000808080000ULL, }, /* 56 */
+ { 0x0808080400000008ULL, 0x0808040000000808ULL, },
+ { 0x0000000008080802ULL, 0x0000000808080400ULL, },
+ { 0x0808080500000000ULL, 0x0808070000000008ULL, },
+ { 0x0000000008080804ULL, 0x0000000008080800ULL, },
+ { 0x0808080600000000ULL, 0x0808080200000008ULL, },
+ { 0x0000000008080806ULL, 0x0000000008080804ULL, },
+ { 0x0808080700000000ULL, 0x0808080500000000ULL, },
+ { 0x0001000002010101ULL, 0x0101040100010004ULL, }, /* 64 */
+ { 0x0000080101000004ULL, 0x0300000303020100ULL, },
+ { 0x0001000000000000ULL, 0x0200000000020203ULL, },
+ { 0x0101030101020001ULL, 0x0000000000010000ULL, },
+ { 0x0000010101000101ULL, 0x0002010000000100ULL, },
+ { 0x0002000000040200ULL, 0x0304010100000201ULL, },
+ { 0x0002010501000001ULL, 0x0002040200000001ULL, },
+ { 0x0000020000000000ULL, 0x0000010203010100ULL, },
+ { 0x0203040001000001ULL, 0x0001000200000201ULL, }, /* 72 */
+ { 0x0001000301000000ULL, 0x0002000000000001ULL, },
+ { 0x0000000000000003ULL, 0x0000010101040103ULL, },
+ { 0x0000000002000100ULL, 0x0000000101000000ULL, },
+ { 0x0003020000010004ULL, 0x0001000001010003ULL, },
+ { 0x0001020003020100ULL, 0x0000020001040201ULL, },
+ { 0x0102010102000000ULL, 0x0001000000030201ULL, },
+ { 0x0001000000010000ULL, 0x0001000001010300ULL, },
+ };
+
+ gettimeofday(&start, NULL);
+
+ for (i = 0; i < TEST_COUNT_TOTAL; i++) {
+ if (i < PATTERN_INPUTS_COUNT) {
+ do_msa_NLZC_B(b128_pattern[i], b128_result[i]);
+ } else {
+ do_msa_NLZC_B(b128_random[i - PATTERN_INPUTS_COUNT],
+ b128_result[i]);
+ }
+ }
+
+ 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/bit-counting/test_msa_nlzc_d.c b/tests/tcg/mips/user/ase/msa/bit-counting/test_msa_nlzc_d.c
new file mode 100644
index 0000000000..801c4bc296
--- /dev/null
+++ b/tests/tcg/mips/user/ase/msa/bit-counting/test_msa_nlzc_d.c
@@ -0,0 +1,144 @@
+/*
+ * Test program for MSA instruction NLZC.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_COUNT + RANDOM_INPUTS_COUNT)
+
+
+int32_t main(void)
+{
+ char *instruction_name = "NLZC.D";
+ int32_t ret;
+ uint32_t i;
+ struct timeval start, end;
+ double elapsed_time;
+
+ uint64_t b128_result[TEST_COUNT_TOTAL][2];
+ uint64_t b128_expect[TEST_COUNT_TOTAL][2] = {
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 0 */
+ { 0x0000000000000040ULL, 0x0000000000000040ULL, },
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0x0000000000000001ULL, 0x0000000000000001ULL, },
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0x0000000000000002ULL, 0x0000000000000002ULL, },
+ { 0x0000000000000000ULL, 0x0000000000000002ULL, },
+ { 0x0000000000000003ULL, 0x0000000000000000ULL, },
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 8 */
+ { 0x0000000000000004ULL, 0x0000000000000004ULL, },
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0x0000000000000005ULL, 0x0000000000000001ULL, },
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0x0000000000000006ULL, 0x0000000000000002ULL, },
+ { 0x0000000000000000ULL, 0x0000000000000006ULL, },
+ { 0x0000000000000007ULL, 0x0000000000000000ULL, },
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 16 */
+ { 0x0000000000000008ULL, 0x0000000000000008ULL, },
+ { 0x0000000000000000ULL, 0x0000000000000008ULL, },
+ { 0x0000000000000009ULL, 0x0000000000000000ULL, },
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0x000000000000000aULL, 0x0000000000000006ULL, },
+ { 0x0000000000000000ULL, 0x0000000000000002ULL, },
+ { 0x000000000000000bULL, 0x0000000000000000ULL, },
+ { 0x0000000000000000ULL, 0x0000000000000008ULL, }, /* 24 */
+ { 0x000000000000000cULL, 0x0000000000000000ULL, },
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0x000000000000000dULL, 0x0000000000000001ULL, },
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0x000000000000000eULL, 0x0000000000000006ULL, },
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0x000000000000000fULL, 0x000000000000000bULL, },
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 32 */
+ { 0x0000000000000010ULL, 0x0000000000000010ULL, },
+ { 0x0000000000000000ULL, 0x0000000000000004ULL, },
+ { 0x0000000000000011ULL, 0x0000000000000000ULL, },
+ { 0x0000000000000000ULL, 0x0000000000000008ULL, },
+ { 0x0000000000000012ULL, 0x0000000000000000ULL, },
+ { 0x0000000000000000ULL, 0x000000000000000cULL, },
+ { 0x0000000000000013ULL, 0x0000000000000000ULL, },
+ { 0x0000000000000000ULL, 0x0000000000000010ULL, }, /* 40 */
+ { 0x0000000000000014ULL, 0x0000000000000000ULL, },
+ { 0x0000000000000000ULL, 0x0000000000000014ULL, },
+ { 0x0000000000000015ULL, 0x0000000000000000ULL, },
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0x0000000000000016ULL, 0x0000000000000002ULL, },
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0x0000000000000017ULL, 0x0000000000000005ULL, },
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 48 */
+ { 0x0000000000000018ULL, 0x0000000000000008ULL, },
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0x0000000000000019ULL, 0x000000000000000bULL, },
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0x000000000000001aULL, 0x000000000000000eULL, },
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0x000000000000001bULL, 0x0000000000000011ULL, },
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 56 */
+ { 0x000000000000001cULL, 0x0000000000000014ULL, },
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0x000000000000001dULL, 0x0000000000000017ULL, },
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0x000000000000001eULL, 0x000000000000001aULL, },
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0x000000000000001fULL, 0x000000000000001dULL, },
+ { 0x0000000000000000ULL, 0x0000000000000001ULL, }, /* 64 */
+ { 0x0000000000000000ULL, 0x0000000000000003ULL, },
+ { 0x0000000000000000ULL, 0x0000000000000002ULL, },
+ { 0x0000000000000001ULL, 0x0000000000000000ULL, },
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0x0000000000000000ULL, 0x0000000000000003ULL, },
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0x0000000000000002ULL, 0x0000000000000000ULL, }, /* 72 */
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0x0000000000000001ULL, 0x0000000000000000ULL, },
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ };
+
+ gettimeofday(&start, NULL);
+
+ for (i = 0; i < TEST_COUNT_TOTAL; i++) {
+ if (i < PATTERN_INPUTS_COUNT) {
+ do_msa_NLZC_D(b128_pattern[i], b128_result[i]);
+ } else {
+ do_msa_NLZC_D(b128_random[i - PATTERN_INPUTS_COUNT],
+ b128_result[i]);
+ }
+ }
+
+ 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/bit-counting/test_msa_nlzc_h.c b/tests/tcg/mips/user/ase/msa/bit-counting/test_msa_nlzc_h.c
new file mode 100644
index 0000000000..03cb4cd53d
--- /dev/null
+++ b/tests/tcg/mips/user/ase/msa/bit-counting/test_msa_nlzc_h.c
@@ -0,0 +1,144 @@
+/*
+ * Test program for MSA instruction NLZC.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_COUNT + RANDOM_INPUTS_COUNT)
+
+
+int32_t main(void)
+{
+ char *instruction_name = "NLZC.H";
+ int32_t ret;
+ uint32_t i;
+ struct timeval start, end;
+ double elapsed_time;
+
+ uint64_t b128_result[TEST_COUNT_TOTAL][2];
+ uint64_t b128_expect[TEST_COUNT_TOTAL][2] = {
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 0 */
+ { 0x0010001000100010ULL, 0x0010001000100010ULL, },
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0x0001000100010001ULL, 0x0001000100010001ULL, },
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0x0002000200020002ULL, 0x0002000200020002ULL, },
+ { 0x0000000200000000ULL, 0x0002000000000002ULL, },
+ { 0x0003000000010003ULL, 0x0000000100030000ULL, },
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 8 */
+ { 0x0004000400040004ULL, 0x0004000400040004ULL, },
+ { 0x0000000400000002ULL, 0x0000000000040000ULL, },
+ { 0x0005000000030000ULL, 0x0001000500000003ULL, },
+ { 0x0000000000040000ULL, 0x0000000400000000ULL, },
+ { 0x0006000200000006ULL, 0x0002000000060002ULL, },
+ { 0x0000000000000000ULL, 0x0006000400020000ULL, },
+ { 0x0007000500030001ULL, 0x0000000000000007ULL, },
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 16 */
+ { 0x0008000800080008ULL, 0x0008000800080008ULL, },
+ { 0x0000000200040006ULL, 0x0008000000000000ULL, },
+ { 0x0009000000000000ULL, 0x0000000100030005ULL, },
+ { 0x0000000400080000ULL, 0x0000000000040008ULL, },
+ { 0x000a000000000002ULL, 0x0006000a00000000ULL, },
+ { 0x0000000600000000ULL, 0x0002000800000000ULL, },
+ { 0x000b000000010007ULL, 0x0000000000030009ULL, },
+ { 0x0000000800000000ULL, 0x0008000000000008ULL, }, /* 24 */
+ { 0x000c00000004000cULL, 0x00000004000c0000ULL, },
+ { 0x0000000a00000004ULL, 0x0000000000080000ULL, },
+ { 0x000d000000070000ULL, 0x0001000b00000005ULL, },
+ { 0x0000000c00000008ULL, 0x0000000400000000ULL, },
+ { 0x000e0000000a0000ULL, 0x000600000002000eULL, },
+ { 0x0000000e0000000cULL, 0x0000000a00000008ULL, },
+ { 0x000f0000000d0000ULL, 0x000b000000090000ULL, },
+ { 0x0000001000000010ULL, 0x0000001000000010ULL, }, /* 32 */
+ { 0x0010000000100000ULL, 0x0010000000100000ULL, },
+ { 0x0000000000020000ULL, 0x0004000000060000ULL, },
+ { 0x0010000100000003ULL, 0x0000000500000007ULL, },
+ { 0x0000000000040000ULL, 0x00080000000c0000ULL, },
+ { 0x0010000200000006ULL, 0x0000000a0000000eULL, },
+ { 0x0000000000060000ULL, 0x000c000000100002ULL, },
+ { 0x0010000300000009ULL, 0x0000000f00000000ULL, },
+ { 0x0000000000080000ULL, 0x0010000000000008ULL, }, /* 40 */
+ { 0x001000040000000cULL, 0x0000001000040000ULL, },
+ { 0x00000000000a0000ULL, 0x001000040000000eULL, },
+ { 0x001000050000000fULL, 0x0000000000090000ULL, },
+ { 0x00000000000c0000ULL, 0x0000000800000010ULL, },
+ { 0x0010000600000010ULL, 0x00020000000e0000ULL, },
+ { 0x00000000000e0000ULL, 0x0000000c00000000ULL, },
+ { 0x0010000700000010ULL, 0x0005000000100003ULL, },
+ { 0x0000000000100000ULL, 0x0000001000000000ULL, }, /* 48 */
+ { 0x0010000800000010ULL, 0x0008000000100008ULL, },
+ { 0x0000000000100002ULL, 0x0000001000040000ULL, },
+ { 0x0010000900000000ULL, 0x000b00000000000dULL, },
+ { 0x0000000000100004ULL, 0x0000001000080000ULL, },
+ { 0x0010000a00000000ULL, 0x000e000000000010ULL, },
+ { 0x0000000000100006ULL, 0x00000000000c0000ULL, },
+ { 0x0010000b00000000ULL, 0x0010000100000010ULL, },
+ { 0x0000000000100008ULL, 0x0000000000100000ULL, }, /* 56 */
+ { 0x0010000c00000000ULL, 0x0010000400000010ULL, },
+ { 0x000000000010000aULL, 0x0000000000100004ULL, },
+ { 0x0010000d00000000ULL, 0x0010000700000000ULL, },
+ { 0x000000000010000cULL, 0x0000000000100008ULL, },
+ { 0x0010000e00000000ULL, 0x0010000a00000000ULL, },
+ { 0x000000000010000eULL, 0x000000000010000cULL, },
+ { 0x0010000f00000000ULL, 0x0010000d00000000ULL, },
+ { 0x0000000000020001ULL, 0x0001000400000000ULL, }, /* 64 */
+ { 0x0000000900010000ULL, 0x0003000000030001ULL, },
+ { 0x0000000000000000ULL, 0x0002000000000002ULL, },
+ { 0x0001000300010000ULL, 0x0000000000000000ULL, },
+ { 0x0000000100010001ULL, 0x0000000100000001ULL, },
+ { 0x0000000000000002ULL, 0x0003000100000002ULL, },
+ { 0x0000000100010000ULL, 0x0000000400000000ULL, },
+ { 0x0000000200000000ULL, 0x0000000100030001ULL, },
+ { 0x0002000400010000ULL, 0x0000000000000002ULL, }, /* 72 */
+ { 0x0000000000010000ULL, 0x0000000000000000ULL, },
+ { 0x0000000000000000ULL, 0x0000000100010001ULL, },
+ { 0x0000000000020001ULL, 0x0000000000010000ULL, },
+ { 0x0000000200000000ULL, 0x0000000000010000ULL, },
+ { 0x0000000200030001ULL, 0x0000000200010002ULL, },
+ { 0x0001000100020000ULL, 0x0000000000000002ULL, },
+ { 0x0000000000000000ULL, 0x0000000000010003ULL, },
+ };
+
+ gettimeofday(&start, NULL);
+
+ for (i = 0; i < TEST_COUNT_TOTAL; i++) {
+ if (i < PATTERN_INPUTS_COUNT) {
+ do_msa_NLZC_H(b128_pattern[i], b128_result[i]);
+ } else {
+ do_msa_NLZC_H(b128_random[i - PATTERN_INPUTS_COUNT],
+ b128_result[i]);
+ }
+ }
+
+ 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/bit-counting/test_msa_nlzc_w.c b/tests/tcg/mips/user/ase/msa/bit-counting/test_msa_nlzc_w.c
new file mode 100644
index 0000000000..2ca93de73d
--- /dev/null
+++ b/tests/tcg/mips/user/ase/msa/bit-counting/test_msa_nlzc_w.c
@@ -0,0 +1,144 @@
+/*
+ * Test program for MSA instruction NLZC.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_COUNT + RANDOM_INPUTS_COUNT)
+
+
+int32_t main(void)
+{
+ char *instruction_name = "NLZC.W";
+ int32_t ret;
+ uint32_t i;
+ struct timeval start, end;
+ double elapsed_time;
+
+ uint64_t b128_result[TEST_COUNT_TOTAL][2];
+ uint64_t b128_expect[TEST_COUNT_TOTAL][2] = {
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 0 */
+ { 0x0000002000000020ULL, 0x0000002000000020ULL, },
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0x0000000100000001ULL, 0x0000000100000001ULL, },
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0x0000000200000002ULL, 0x0000000200000002ULL, },
+ { 0x0000000000000000ULL, 0x0000000200000000ULL, },
+ { 0x0000000300000001ULL, 0x0000000000000003ULL, },
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 8 */
+ { 0x0000000400000004ULL, 0x0000000400000004ULL, },
+ { 0x0000000000000000ULL, 0x0000000000000004ULL, },
+ { 0x0000000500000003ULL, 0x0000000100000000ULL, },
+ { 0x0000000000000004ULL, 0x0000000000000000ULL, },
+ { 0x0000000600000000ULL, 0x0000000200000006ULL, },
+ { 0x0000000000000000ULL, 0x0000000600000002ULL, },
+ { 0x0000000700000003ULL, 0x0000000000000000ULL, },
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 16 */
+ { 0x0000000800000008ULL, 0x0000000800000008ULL, },
+ { 0x0000000000000004ULL, 0x0000000800000000ULL, },
+ { 0x0000000900000000ULL, 0x0000000000000003ULL, },
+ { 0x0000000000000008ULL, 0x0000000000000004ULL, },
+ { 0x0000000a00000000ULL, 0x0000000600000000ULL, },
+ { 0x0000000000000000ULL, 0x0000000200000000ULL, },
+ { 0x0000000b00000001ULL, 0x0000000000000003ULL, },
+ { 0x0000000000000000ULL, 0x0000000800000000ULL, }, /* 24 */
+ { 0x0000000c00000004ULL, 0x000000000000000cULL, },
+ { 0x0000000000000000ULL, 0x0000000000000008ULL, },
+ { 0x0000000d00000007ULL, 0x0000000100000000ULL, },
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0x0000000e0000000aULL, 0x0000000600000002ULL, },
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0x0000000f0000000dULL, 0x0000000b00000009ULL, },
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 32 */
+ { 0x0000001000000010ULL, 0x0000001000000010ULL, },
+ { 0x0000000000000002ULL, 0x0000000400000006ULL, },
+ { 0x0000001100000000ULL, 0x0000000000000000ULL, },
+ { 0x0000000000000004ULL, 0x000000080000000cULL, },
+ { 0x0000001200000000ULL, 0x0000000000000000ULL, },
+ { 0x0000000000000006ULL, 0x0000000c00000012ULL, },
+ { 0x0000001300000000ULL, 0x0000000000000000ULL, },
+ { 0x0000000000000008ULL, 0x0000001000000000ULL, }, /* 40 */
+ { 0x0000001400000000ULL, 0x0000000000000004ULL, },
+ { 0x000000000000000aULL, 0x0000001400000000ULL, },
+ { 0x0000001500000000ULL, 0x0000000000000009ULL, },
+ { 0x000000000000000cULL, 0x0000000000000000ULL, },
+ { 0x0000001600000000ULL, 0x000000020000000eULL, },
+ { 0x000000000000000eULL, 0x0000000000000000ULL, },
+ { 0x0000001700000000ULL, 0x0000000500000013ULL, },
+ { 0x0000000000000010ULL, 0x0000000000000000ULL, }, /* 48 */
+ { 0x0000001800000000ULL, 0x0000000800000018ULL, },
+ { 0x0000000000000012ULL, 0x0000000000000004ULL, },
+ { 0x0000001900000000ULL, 0x0000000b00000000ULL, },
+ { 0x0000000000000014ULL, 0x0000000000000008ULL, },
+ { 0x0000001a00000000ULL, 0x0000000e00000000ULL, },
+ { 0x0000000000000016ULL, 0x000000000000000cULL, },
+ { 0x0000001b00000000ULL, 0x0000001100000000ULL, },
+ { 0x0000000000000018ULL, 0x0000000000000010ULL, }, /* 56 */
+ { 0x0000001c00000000ULL, 0x0000001400000000ULL, },
+ { 0x000000000000001aULL, 0x0000000000000014ULL, },
+ { 0x0000001d00000000ULL, 0x0000001700000000ULL, },
+ { 0x000000000000001cULL, 0x0000000000000018ULL, },
+ { 0x0000001e00000000ULL, 0x0000001a00000000ULL, },
+ { 0x000000000000001eULL, 0x000000000000001cULL, },
+ { 0x0000001f00000000ULL, 0x0000001d00000000ULL, },
+ { 0x0000000000000002ULL, 0x0000000100000000ULL, }, /* 64 */
+ { 0x0000000000000001ULL, 0x0000000300000003ULL, },
+ { 0x0000000000000000ULL, 0x0000000200000000ULL, },
+ { 0x0000000100000001ULL, 0x0000000000000000ULL, },
+ { 0x0000000000000001ULL, 0x0000000000000000ULL, },
+ { 0x0000000000000000ULL, 0x0000000300000000ULL, },
+ { 0x0000000000000001ULL, 0x0000000000000000ULL, },
+ { 0x0000000000000000ULL, 0x0000000000000003ULL, },
+ { 0x0000000200000001ULL, 0x0000000000000000ULL, }, /* 72 */
+ { 0x0000000000000001ULL, 0x0000000000000000ULL, },
+ { 0x0000000000000000ULL, 0x0000000000000001ULL, },
+ { 0x0000000000000002ULL, 0x0000000000000001ULL, },
+ { 0x0000000000000000ULL, 0x0000000000000001ULL, },
+ { 0x0000000000000003ULL, 0x0000000000000001ULL, },
+ { 0x0000000100000002ULL, 0x0000000000000000ULL, },
+ { 0x0000000000000000ULL, 0x0000000000000001ULL, },
+ };
+
+ gettimeofday(&start, NULL);
+
+ for (i = 0; i < TEST_COUNT_TOTAL; i++) {
+ if (i < PATTERN_INPUTS_COUNT) {
+ do_msa_NLZC_W(b128_pattern[i], b128_result[i]);
+ } else {
+ do_msa_NLZC_W(b128_random[i - PATTERN_INPUTS_COUNT],
+ b128_result[i]);
+ }
+ }
+
+ 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/bit-counting/test_msa_pcnt_b.c b/tests/tcg/mips/user/ase/msa/bit-counting/test_msa_pcnt_b.c
new file mode 100644
index 0000000000..b4cad43ea9
--- /dev/null
+++ b/tests/tcg/mips/user/ase/msa/bit-counting/test_msa_pcnt_b.c
@@ -0,0 +1,144 @@
+/*
+ * Test program for MSA instruction PCNT.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_COUNT + RANDOM_INPUTS_COUNT)
+
+
+int32_t main(void)
+{
+ char *instruction_name = "PCNT.B";
+ int32_t ret;
+ uint32_t i;
+ struct timeval start, end;
+ double elapsed_time;
+
+ uint64_t b128_result[TEST_COUNT_TOTAL][2];
+ uint64_t b128_expect[TEST_COUNT_TOTAL][2] = {
+ { 0x0808080808080808ULL, 0x0808080808080808ULL, }, /* 0 */
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0x0404040404040404ULL, 0x0404040404040404ULL, },
+ { 0x0404040404040404ULL, 0x0404040404040404ULL, },
+ { 0x0404040404040404ULL, 0x0404040404040404ULL, },
+ { 0x0404040404040404ULL, 0x0404040404040404ULL, },
+ { 0x0504030504030504ULL, 0x0305040305040305ULL, },
+ { 0x0304050304050304ULL, 0x0503040503040503ULL, },
+ { 0x0404040404040404ULL, 0x0404040404040404ULL, }, /* 8 */
+ { 0x0404040404040404ULL, 0x0404040404040404ULL, },
+ { 0x0505040303050504ULL, 0x0303050504030305ULL, },
+ { 0x0303040505030304ULL, 0x0505030304050503ULL, },
+ { 0x0604020604020604ULL, 0x0206040206040206ULL, },
+ { 0x0204060204060204ULL, 0x0602040602040602ULL, },
+ { 0x0702050403060107ULL, 0x0205040306010702ULL, },
+ { 0x0106030405020701ULL, 0x0603040502070106ULL, },
+ { 0x0800080008000800ULL, 0x0800080008000800ULL, }, /* 16 */
+ { 0x0008000800080008ULL, 0x0008000800080008ULL, },
+ { 0x0801060304050207ULL, 0x0008010603040502ULL, },
+ { 0x0007020504030601ULL, 0x0800070205040306ULL, },
+ { 0x0802040600080204ULL, 0x0600080204060008ULL, },
+ { 0x0006040208000604ULL, 0x0208000604020800ULL, },
+ { 0x0803020801040700ULL, 0x0605000803020801ULL, },
+ { 0x0005060007040108ULL, 0x0203080005060007ULL, },
+ { 0x0804000804000804ULL, 0x0008040008040008ULL, }, /* 24 */
+ { 0x0004080004080004ULL, 0x0800040800040800ULL, },
+ { 0x0805000607000408ULL, 0x0102080300080500ULL, },
+ { 0x0003080201080400ULL, 0x0706000508000308ULL, },
+ { 0x0806000408020008ULL, 0x0600040802000806ULL, },
+ { 0x0002080400060800ULL, 0x0208040006080002ULL, },
+ { 0x0807000208050004ULL, 0x0803000608010008ULL, },
+ { 0x0001080600030804ULL, 0x0005080200070800ULL, },
+ { 0x0808000008080000ULL, 0x0808000008080000ULL, }, /* 32 */
+ { 0x0000080800000808ULL, 0x0000080800000808ULL, },
+ { 0x0808010006080300ULL, 0x0408050002080700ULL, },
+ { 0x0000070802000508ULL, 0x0400030806000108ULL, },
+ { 0x0808020004080600ULL, 0x0008080200040806ULL, },
+ { 0x0000060804000208ULL, 0x0800000608040002ULL, },
+ { 0x0808030002080801ULL, 0x0004080700000608ULL, },
+ { 0x0000050806000007ULL, 0x0804000108080200ULL, },
+ { 0x0808040000080804ULL, 0x0000080804000008ULL, }, /* 40 */
+ { 0x0000040808000004ULL, 0x0808000004080800ULL, },
+ { 0x0808050000060807ULL, 0x0000040808010002ULL, },
+ { 0x0000030808020001ULL, 0x0808040000070806ULL, },
+ { 0x0808060000040808ULL, 0x0200000808060000ULL, },
+ { 0x0000020808040000ULL, 0x0608080000020808ULL, },
+ { 0x0808070000020808ULL, 0x0500000408080300ULL, },
+ { 0x0000010808060000ULL, 0x0308080400000508ULL, },
+ { 0x0808080000000808ULL, 0x0800000008080800ULL, }, /* 48 */
+ { 0x0000000808080000ULL, 0x0008080800000008ULL, },
+ { 0x0808080100000608ULL, 0x0803000004080805ULL, },
+ { 0x0000000708080200ULL, 0x0005080804000003ULL, },
+ { 0x0808080200000408ULL, 0x0806000000080808ULL, },
+ { 0x0000000608080400ULL, 0x0002080808000000ULL, },
+ { 0x0808080300000208ULL, 0x0808010000040808ULL, },
+ { 0x0000000508080600ULL, 0x0000070808040000ULL, },
+ { 0x0808080400000008ULL, 0x0808040000000808ULL, }, /* 56 */
+ { 0x0000000408080800ULL, 0x0000040808080000ULL, },
+ { 0x0808080500000006ULL, 0x0808070000000408ULL, },
+ { 0x0000000308080802ULL, 0x0000010808080400ULL, },
+ { 0x0808080600000004ULL, 0x0808080200000008ULL, },
+ { 0x0000000208080804ULL, 0x0000000608080800ULL, },
+ { 0x0808080700000002ULL, 0x0808080500000004ULL, },
+ { 0x0000000108080806ULL, 0x0000000308080804ULL, },
+ { 0x0204050402030401ULL, 0x0405030507060302ULL, }, /* 64 */
+ { 0x0706000404040501ULL, 0x0207060303060306ULL, },
+ { 0x0404050405060401ULL, 0x0404040805040302ULL, },
+ { 0x0305030405030404ULL, 0x0405020404020402ULL, },
+ { 0x0503050506060203ULL, 0x0302050505050405ULL, },
+ { 0x0304060308020406ULL, 0x0403020207040204ULL, },
+ { 0x0405030204040503ULL, 0x0303010207040503ULL, },
+ { 0x0605030404040602ULL, 0x0407040502020505ULL, },
+ { 0x0104020504050503ULL, 0x0705030404040403ULL, }, /* 72 */
+ { 0x0405050304050506ULL, 0x0402050302050504ULL, },
+ { 0x0304060604050404ULL, 0x0403040305030502ULL, },
+ { 0x0304050503030305ULL, 0x0404040505050306ULL, },
+ { 0x0502030504030502ULL, 0x0303030504050403ULL, },
+ { 0x0303040703030303ULL, 0x0603040404030405ULL, },
+ { 0x0302020402060704ULL, 0x0604030705030204ULL, },
+ { 0x0404050305040605ULL, 0x0404050504030405ULL, },
+ };
+
+ gettimeofday(&start, NULL);
+
+ for (i = 0; i < TEST_COUNT_TOTAL; i++) {
+ if (i < PATTERN_INPUTS_COUNT) {
+ do_msa_PCNT_B(b128_pattern[i], b128_result[i]);
+ } else {
+ do_msa_PCNT_B(b128_random[i - PATTERN_INPUTS_COUNT],
+ b128_result[i]);
+ }
+ }
+
+ 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/bit-counting/test_msa_pcnt_d.c b/tests/tcg/mips/user/ase/msa/bit-counting/test_msa_pcnt_d.c
new file mode 100644
index 0000000000..d6a8b0d091
--- /dev/null
+++ b/tests/tcg/mips/user/ase/msa/bit-counting/test_msa_pcnt_d.c
@@ -0,0 +1,144 @@
+/*
+ * Test program for MSA instruction PCNT.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_COUNT + RANDOM_INPUTS_COUNT)
+
+
+int32_t main(void)
+{
+ char *instruction_name = "PCNT.D";
+ int32_t ret;
+ uint32_t i;
+ struct timeval start, end;
+ double elapsed_time;
+
+ uint64_t b128_result[TEST_COUNT_TOTAL][2];
+ uint64_t b128_expect[TEST_COUNT_TOTAL][2] = {
+ { 0x0000000000000040ULL, 0x0000000000000040ULL, }, /* 0 */
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0x0000000000000020ULL, 0x0000000000000020ULL, },
+ { 0x0000000000000020ULL, 0x0000000000000020ULL, },
+ { 0x0000000000000020ULL, 0x0000000000000020ULL, },
+ { 0x0000000000000020ULL, 0x0000000000000020ULL, },
+ { 0x0000000000000021ULL, 0x0000000000000020ULL, },
+ { 0x000000000000001fULL, 0x0000000000000020ULL, },
+ { 0x0000000000000020ULL, 0x0000000000000020ULL, }, /* 8 */
+ { 0x0000000000000020ULL, 0x0000000000000020ULL, },
+ { 0x0000000000000022ULL, 0x000000000000001fULL, },
+ { 0x000000000000001eULL, 0x0000000000000021ULL, },
+ { 0x0000000000000022ULL, 0x0000000000000020ULL, },
+ { 0x000000000000001eULL, 0x0000000000000020ULL, },
+ { 0x0000000000000023ULL, 0x000000000000001eULL, },
+ { 0x000000000000001dULL, 0x0000000000000022ULL, },
+ { 0x0000000000000020ULL, 0x0000000000000020ULL, }, /* 16 */
+ { 0x0000000000000020ULL, 0x0000000000000020ULL, },
+ { 0x0000000000000024ULL, 0x000000000000001dULL, },
+ { 0x000000000000001cULL, 0x0000000000000023ULL, },
+ { 0x0000000000000022ULL, 0x0000000000000022ULL, },
+ { 0x000000000000001eULL, 0x000000000000001eULL, },
+ { 0x0000000000000021ULL, 0x0000000000000021ULL, },
+ { 0x000000000000001fULL, 0x000000000000001fULL, },
+ { 0x0000000000000024ULL, 0x0000000000000020ULL, }, /* 24 */
+ { 0x000000000000001cULL, 0x0000000000000020ULL, },
+ { 0x0000000000000026ULL, 0x000000000000001bULL, },
+ { 0x000000000000001aULL, 0x0000000000000025ULL, },
+ { 0x0000000000000024ULL, 0x0000000000000022ULL, },
+ { 0x000000000000001cULL, 0x000000000000001eULL, },
+ { 0x0000000000000022ULL, 0x0000000000000022ULL, },
+ { 0x000000000000001eULL, 0x000000000000001eULL, },
+ { 0x0000000000000020ULL, 0x0000000000000020ULL, }, /* 32 */
+ { 0x0000000000000020ULL, 0x0000000000000020ULL, },
+ { 0x0000000000000022ULL, 0x0000000000000022ULL, },
+ { 0x000000000000001eULL, 0x000000000000001eULL, },
+ { 0x0000000000000024ULL, 0x0000000000000024ULL, },
+ { 0x000000000000001cULL, 0x000000000000001cULL, },
+ { 0x0000000000000026ULL, 0x0000000000000021ULL, },
+ { 0x000000000000001aULL, 0x000000000000001fULL, },
+ { 0x0000000000000028ULL, 0x000000000000001cULL, }, /* 40 */
+ { 0x0000000000000018ULL, 0x0000000000000024ULL, },
+ { 0x000000000000002aULL, 0x0000000000000017ULL, },
+ { 0x0000000000000016ULL, 0x0000000000000029ULL, },
+ { 0x000000000000002aULL, 0x0000000000000018ULL, },
+ { 0x0000000000000016ULL, 0x0000000000000028ULL, },
+ { 0x0000000000000029ULL, 0x000000000000001cULL, },
+ { 0x0000000000000017ULL, 0x0000000000000024ULL, },
+ { 0x0000000000000028ULL, 0x0000000000000020ULL, }, /* 48 */
+ { 0x0000000000000018ULL, 0x0000000000000020ULL, },
+ { 0x0000000000000027ULL, 0x0000000000000024ULL, },
+ { 0x0000000000000019ULL, 0x000000000000001cULL, },
+ { 0x0000000000000026ULL, 0x0000000000000026ULL, },
+ { 0x000000000000001aULL, 0x000000000000001aULL, },
+ { 0x0000000000000025ULL, 0x0000000000000025ULL, },
+ { 0x000000000000001bULL, 0x000000000000001bULL, },
+ { 0x0000000000000024ULL, 0x0000000000000024ULL, }, /* 56 */
+ { 0x000000000000001cULL, 0x000000000000001cULL, },
+ { 0x0000000000000023ULL, 0x0000000000000023ULL, },
+ { 0x000000000000001dULL, 0x000000000000001dULL, },
+ { 0x0000000000000022ULL, 0x0000000000000022ULL, },
+ { 0x000000000000001eULL, 0x000000000000001eULL, },
+ { 0x0000000000000021ULL, 0x0000000000000021ULL, },
+ { 0x000000000000001fULL, 0x000000000000001fULL, },
+ { 0x0000000000000019ULL, 0x0000000000000023ULL, }, /* 64 */
+ { 0x000000000000001fULL, 0x0000000000000024ULL, },
+ { 0x0000000000000021ULL, 0x0000000000000022ULL, },
+ { 0x000000000000001fULL, 0x000000000000001bULL, },
+ { 0x0000000000000023ULL, 0x0000000000000022ULL, },
+ { 0x0000000000000024ULL, 0x000000000000001cULL, },
+ { 0x000000000000001eULL, 0x000000000000001cULL, },
+ { 0x0000000000000022ULL, 0x0000000000000022ULL, },
+ { 0x000000000000001dULL, 0x0000000000000022ULL, }, /* 72 */
+ { 0x0000000000000025ULL, 0x000000000000001eULL, },
+ { 0x0000000000000024ULL, 0x000000000000001dULL, },
+ { 0x000000000000001fULL, 0x0000000000000024ULL, },
+ { 0x000000000000001dULL, 0x000000000000001eULL, },
+ { 0x000000000000001dULL, 0x0000000000000021ULL, },
+ { 0x000000000000001eULL, 0x0000000000000022ULL, },
+ { 0x0000000000000024ULL, 0x0000000000000022ULL, },
+ };
+
+ gettimeofday(&start, NULL);
+
+ for (i = 0; i < TEST_COUNT_TOTAL; i++) {
+ if (i < PATTERN_INPUTS_COUNT) {
+ do_msa_PCNT_D(b128_pattern[i], b128_result[i]);
+ } else {
+ do_msa_PCNT_D(b128_random[i - PATTERN_INPUTS_COUNT],
+ b128_result[i]);
+ }
+ }
+
+ 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/bit-counting/test_msa_pcnt_h.c b/tests/tcg/mips/user/ase/msa/bit-counting/test_msa_pcnt_h.c
new file mode 100644
index 0000000000..1cdcabd00c
--- /dev/null
+++ b/tests/tcg/mips/user/ase/msa/bit-counting/test_msa_pcnt_h.c
@@ -0,0 +1,144 @@
+/*
+ * Test program for MSA instruction PCNT.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_COUNT + RANDOM_INPUTS_COUNT)
+
+
+int32_t main(void)
+{
+ char *instruction_name = "PCNT.H";
+ int32_t ret;
+ uint32_t i;
+ struct timeval start, end;
+ double elapsed_time;
+
+ uint64_t b128_result[TEST_COUNT_TOTAL][2];
+ uint64_t b128_expect[TEST_COUNT_TOTAL][2] = {
+ { 0x0010001000100010ULL, 0x0010001000100010ULL, }, /* 0 */
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0x0008000800080008ULL, 0x0008000800080008ULL, },
+ { 0x0008000800080008ULL, 0x0008000800080008ULL, },
+ { 0x0008000800080008ULL, 0x0008000800080008ULL, },
+ { 0x0008000800080008ULL, 0x0008000800080008ULL, },
+ { 0x0009000800070009ULL, 0x0008000700090008ULL, },
+ { 0x0007000800090007ULL, 0x0008000900070008ULL, },
+ { 0x0008000800080008ULL, 0x0008000800080008ULL, }, /* 8 */
+ { 0x0008000800080008ULL, 0x0008000800080008ULL, },
+ { 0x000a000700080009ULL, 0x0006000a00070008ULL, },
+ { 0x0006000900080007ULL, 0x000a000600090008ULL, },
+ { 0x000a00080006000aULL, 0x00080006000a0008ULL, },
+ { 0x00060008000a0006ULL, 0x0008000a00060008ULL, },
+ { 0x0009000900090008ULL, 0x0007000700070009ULL, },
+ { 0x0007000700070008ULL, 0x0009000900090007ULL, },
+ { 0x0008000800080008ULL, 0x0008000800080008ULL, }, /* 16 */
+ { 0x0008000800080008ULL, 0x0008000800080008ULL, },
+ { 0x0009000900090009ULL, 0x0008000700070007ULL, },
+ { 0x0007000700070007ULL, 0x0008000900090009ULL, },
+ { 0x000a000a00080006ULL, 0x0006000a000a0008ULL, },
+ { 0x000600060008000aULL, 0x000a000600060008ULL, },
+ { 0x000b000a00050007ULL, 0x000b000800050009ULL, },
+ { 0x00050006000b0009ULL, 0x00050008000b0007ULL, },
+ { 0x000c00080004000cULL, 0x00080004000c0008ULL, }, /* 24 */
+ { 0x00040008000c0004ULL, 0x0008000c00040008ULL, },
+ { 0x000d00060007000cULL, 0x0003000b00080005ULL, },
+ { 0x0003000a00090004ULL, 0x000d00050008000bULL, },
+ { 0x000e0004000a0008ULL, 0x0006000c0002000eULL, },
+ { 0x0002000c00060008ULL, 0x000a0004000e0002ULL, },
+ { 0x000f0002000d0004ULL, 0x000b000600090008ULL, },
+ { 0x0001000e0003000cULL, 0x0005000a00070008ULL, },
+ { 0x0010000000100000ULL, 0x0010000000100000ULL, }, /* 32 */
+ { 0x0000001000000010ULL, 0x0000001000000010ULL, },
+ { 0x00100001000e0003ULL, 0x000c0005000a0007ULL, },
+ { 0x0000000f0002000dULL, 0x0004000b00060009ULL, },
+ { 0x00100002000c0006ULL, 0x0008000a0004000eULL, },
+ { 0x0000000e0004000aULL, 0x00080006000c0002ULL, },
+ { 0x00100003000a0009ULL, 0x0004000f0000000eULL, },
+ { 0x0000000d00060007ULL, 0x000c000100100002ULL, },
+ { 0x001000040008000cULL, 0x0000001000040008ULL, }, /* 40 */
+ { 0x0000000c00080004ULL, 0x00100000000c0008ULL, },
+ { 0x001000050006000fULL, 0x0000000c00090002ULL, },
+ { 0x0000000b000a0001ULL, 0x001000040007000eULL, },
+ { 0x0010000600040010ULL, 0x00020008000e0000ULL, },
+ { 0x0000000a000c0000ULL, 0x000e000800020010ULL, },
+ { 0x0010000700020010ULL, 0x0005000400100003ULL, },
+ { 0x00000009000e0000ULL, 0x000b000c0000000dULL, },
+ { 0x0010000800000010ULL, 0x0008000000100008ULL, }, /* 48 */
+ { 0x0000000800100000ULL, 0x0008001000000008ULL, },
+ { 0x001000090000000eULL, 0x000b0000000c000dULL, },
+ { 0x0000000700100002ULL, 0x0005001000040003ULL, },
+ { 0x0010000a0000000cULL, 0x000e000000080010ULL, },
+ { 0x0000000600100004ULL, 0x0002001000080000ULL, },
+ { 0x0010000b0000000aULL, 0x0010000100040010ULL, },
+ { 0x0000000500100006ULL, 0x0000000f000c0000ULL, },
+ { 0x0010000c00000008ULL, 0x0010000400000010ULL, }, /* 56 */
+ { 0x0000000400100008ULL, 0x0000000c00100000ULL, },
+ { 0x0010000d00000006ULL, 0x001000070000000cULL, },
+ { 0x000000030010000aULL, 0x0000000900100004ULL, },
+ { 0x0010000e00000004ULL, 0x0010000a00000008ULL, },
+ { 0x000000020010000cULL, 0x0000000600100008ULL, },
+ { 0x0010000f00000002ULL, 0x0010000d00000004ULL, },
+ { 0x000000010010000eULL, 0x000000030010000cULL, },
+ { 0x0006000900050005ULL, 0x00090008000d0005ULL, }, /* 64 */
+ { 0x000d000400080006ULL, 0x0009000900090009ULL, },
+ { 0x00080009000b0005ULL, 0x0008000c00090005ULL, },
+ { 0x0008000700080008ULL, 0x0009000600060006ULL, },
+ { 0x0008000a000c0005ULL, 0x0005000a000a0009ULL, },
+ { 0x00070009000a000aULL, 0x00070004000b0006ULL, },
+ { 0x0009000500080008ULL, 0x00060003000b0008ULL, },
+ { 0x000b000700080008ULL, 0x000b00090004000aULL, },
+ { 0x0005000700090008ULL, 0x000c000700080007ULL, }, /* 72 */
+ { 0x000900080009000bULL, 0x0006000800070009ULL, },
+ { 0x0007000c00090008ULL, 0x0007000700080007ULL, },
+ { 0x0007000a00060008ULL, 0x00080009000a0009ULL, },
+ { 0x0007000800070007ULL, 0x0006000800090007ULL, },
+ { 0x0006000b00060006ULL, 0x0009000800070009ULL, },
+ { 0x000500060008000bULL, 0x000a000a00080006ULL, },
+ { 0x000800080009000bULL, 0x0008000a00070009ULL, },
+ };
+
+ gettimeofday(&start, NULL);
+
+ for (i = 0; i < TEST_COUNT_TOTAL; i++) {
+ if (i < PATTERN_INPUTS_COUNT) {
+ do_msa_PCNT_H(b128_pattern[i], b128_result[i]);
+ } else {
+ do_msa_PCNT_H(b128_random[i - PATTERN_INPUTS_COUNT],
+ b128_result[i]);
+ }
+ }
+
+ 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/bit-counting/test_msa_pcnt_w.c b/tests/tcg/mips/user/ase/msa/bit-counting/test_msa_pcnt_w.c
new file mode 100644
index 0000000000..38ddc146d0
--- /dev/null
+++ b/tests/tcg/mips/user/ase/msa/bit-counting/test_msa_pcnt_w.c
@@ -0,0 +1,144 @@
+/*
+ * Test program for MSA instruction PCNT.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_COUNT + RANDOM_INPUTS_COUNT)
+
+
+int32_t main(void)
+{
+ char *instruction_name = "PCNT.W";
+ int32_t ret;
+ uint32_t i;
+ struct timeval start, end;
+ double elapsed_time;
+
+ uint64_t b128_result[TEST_COUNT_TOTAL][2];
+ uint64_t b128_expect[TEST_COUNT_TOTAL][2] = {
+ { 0x0000002000000020ULL, 0x0000002000000020ULL, }, /* 0 */
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0x0000001000000010ULL, 0x0000001000000010ULL, },
+ { 0x0000001000000010ULL, 0x0000001000000010ULL, },
+ { 0x0000001000000010ULL, 0x0000001000000010ULL, },
+ { 0x0000001000000010ULL, 0x0000001000000010ULL, },
+ { 0x0000001100000010ULL, 0x0000000f00000011ULL, },
+ { 0x0000000f00000010ULL, 0x000000110000000fULL, },
+ { 0x0000001000000010ULL, 0x0000001000000010ULL, }, /* 8 */
+ { 0x0000001000000010ULL, 0x0000001000000010ULL, },
+ { 0x0000001100000011ULL, 0x000000100000000fULL, },
+ { 0x0000000f0000000fULL, 0x0000001000000011ULL, },
+ { 0x0000001200000010ULL, 0x0000000e00000012ULL, },
+ { 0x0000000e00000010ULL, 0x000000120000000eULL, },
+ { 0x0000001200000011ULL, 0x0000000e00000010ULL, },
+ { 0x0000000e0000000fULL, 0x0000001200000010ULL, },
+ { 0x0000001000000010ULL, 0x0000001000000010ULL, }, /* 16 */
+ { 0x0000001000000010ULL, 0x0000001000000010ULL, },
+ { 0x0000001200000012ULL, 0x0000000f0000000eULL, },
+ { 0x0000000e0000000eULL, 0x0000001100000012ULL, },
+ { 0x000000140000000eULL, 0x0000001000000012ULL, },
+ { 0x0000000c00000012ULL, 0x000000100000000eULL, },
+ { 0x000000150000000cULL, 0x000000130000000eULL, },
+ { 0x0000000b00000014ULL, 0x0000000d00000012ULL, },
+ { 0x0000001400000010ULL, 0x0000000c00000014ULL, }, /* 24 */
+ { 0x0000000c00000010ULL, 0x000000140000000cULL, },
+ { 0x0000001300000013ULL, 0x0000000e0000000dULL, },
+ { 0x0000000d0000000dULL, 0x0000001200000013ULL, },
+ { 0x0000001200000012ULL, 0x0000001200000010ULL, },
+ { 0x0000000e0000000eULL, 0x0000000e00000010ULL, },
+ { 0x0000001100000011ULL, 0x0000001100000011ULL, },
+ { 0x0000000f0000000fULL, 0x0000000f0000000fULL, },
+ { 0x0000001000000010ULL, 0x0000001000000010ULL, }, /* 32 */
+ { 0x0000001000000010ULL, 0x0000001000000010ULL, },
+ { 0x0000001100000011ULL, 0x0000001100000011ULL, },
+ { 0x0000000f0000000fULL, 0x0000000f0000000fULL, },
+ { 0x0000001200000012ULL, 0x0000001200000012ULL, },
+ { 0x0000000e0000000eULL, 0x0000000e0000000eULL, },
+ { 0x0000001300000013ULL, 0x000000130000000eULL, },
+ { 0x0000000d0000000dULL, 0x0000000d00000012ULL, },
+ { 0x0000001400000014ULL, 0x000000100000000cULL, }, /* 40 */
+ { 0x0000000c0000000cULL, 0x0000001000000014ULL, },
+ { 0x0000001500000015ULL, 0x0000000c0000000bULL, },
+ { 0x0000000b0000000bULL, 0x0000001400000015ULL, },
+ { 0x0000001600000014ULL, 0x0000000a0000000eULL, },
+ { 0x0000000a0000000cULL, 0x0000001600000012ULL, },
+ { 0x0000001700000012ULL, 0x0000000900000013ULL, },
+ { 0x000000090000000eULL, 0x000000170000000dULL, },
+ { 0x0000001800000010ULL, 0x0000000800000018ULL, }, /* 48 */
+ { 0x0000000800000010ULL, 0x0000001800000008ULL, },
+ { 0x000000190000000eULL, 0x0000000b00000019ULL, },
+ { 0x0000000700000012ULL, 0x0000001500000007ULL, },
+ { 0x0000001a0000000cULL, 0x0000000e00000018ULL, },
+ { 0x0000000600000014ULL, 0x0000001200000008ULL, },
+ { 0x0000001b0000000aULL, 0x0000001100000014ULL, },
+ { 0x0000000500000016ULL, 0x0000000f0000000cULL, },
+ { 0x0000001c00000008ULL, 0x0000001400000010ULL, }, /* 56 */
+ { 0x0000000400000018ULL, 0x0000000c00000010ULL, },
+ { 0x0000001d00000006ULL, 0x000000170000000cULL, },
+ { 0x000000030000001aULL, 0x0000000900000014ULL, },
+ { 0x0000001e00000004ULL, 0x0000001a00000008ULL, },
+ { 0x000000020000001cULL, 0x0000000600000018ULL, },
+ { 0x0000001f00000002ULL, 0x0000001d00000004ULL, },
+ { 0x000000010000001eULL, 0x000000030000001cULL, },
+ { 0x0000000f0000000aULL, 0x0000001100000012ULL, }, /* 64 */
+ { 0x000000110000000eULL, 0x0000001200000012ULL, },
+ { 0x0000001100000010ULL, 0x000000140000000eULL, },
+ { 0x0000000f00000010ULL, 0x0000000f0000000cULL, },
+ { 0x0000001200000011ULL, 0x0000000f00000013ULL, },
+ { 0x0000001000000014ULL, 0x0000000b00000011ULL, },
+ { 0x0000000e00000010ULL, 0x0000000900000013ULL, },
+ { 0x0000001200000010ULL, 0x000000140000000eULL, },
+ { 0x0000000c00000011ULL, 0x000000130000000fULL, }, /* 72 */
+ { 0x0000001100000014ULL, 0x0000000e00000010ULL, },
+ { 0x0000001300000011ULL, 0x0000000e0000000fULL, },
+ { 0x000000110000000eULL, 0x0000001100000013ULL, },
+ { 0x0000000f0000000eULL, 0x0000000e00000010ULL, },
+ { 0x000000110000000cULL, 0x0000001100000010ULL, },
+ { 0x0000000b00000013ULL, 0x000000140000000eULL, },
+ { 0x0000001000000014ULL, 0x0000001200000010ULL, },
+ };
+
+ gettimeofday(&start, NULL);
+
+ for (i = 0; i < TEST_COUNT_TOTAL; i++) {
+ if (i < PATTERN_INPUTS_COUNT) {
+ do_msa_PCNT_W(b128_pattern[i], b128_result[i]);
+ } else {
+ do_msa_PCNT_W(b128_random[i - PATTERN_INPUTS_COUNT],
+ b128_result[i]);
+ }
+ }
+
+ 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/interleave/test_msa_ilvev_b.c b/tests/tcg/mips/user/ase/msa/interleave/test_msa_ilvev_b.c
new file mode 100644
index 0000000000..5cf862756a
--- /dev/null
+++ b/tests/tcg/mips/user/ase/msa/interleave/test_msa_ilvev_b.c
@@ -0,0 +1,153 @@
+/*
+ * Test program for MSA instruction ILVEV.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 = "*ILVEV.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 */
+ { 0xff00ff00ff00ff00ULL, 0xff00ff00ff00ff00ULL, },
+ { 0xffaaffaaffaaffaaULL, 0xffaaffaaffaaffaaULL, },
+ { 0xff55ff55ff55ff55ULL, 0xff55ff55ff55ff55ULL, },
+ { 0xffccffccffccffccULL, 0xffccffccffccffccULL, },
+ { 0xff33ff33ff33ff33ULL, 0xff33ff33ff33ff33ULL, },
+ { 0xff8effe3ff38ff8eULL, 0xffe3ff38ff8effe3ULL, },
+ { 0xff71ff1cffc7ff71ULL, 0xff1cffc7ff71ff1cULL, },
+ { 0x00ff00ff00ff00ffULL, 0x00ff00ff00ff00ffULL, }, /* 8 */
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0x00aa00aa00aa00aaULL, 0x00aa00aa00aa00aaULL, },
+ { 0x0055005500550055ULL, 0x0055005500550055ULL, },
+ { 0x00cc00cc00cc00ccULL, 0x00cc00cc00cc00ccULL, },
+ { 0x0033003300330033ULL, 0x0033003300330033ULL, },
+ { 0x008e00e30038008eULL, 0x00e30038008e00e3ULL, },
+ { 0x0071001c00c70071ULL, 0x001c00c70071001cULL, },
+ { 0xaaffaaffaaffaaffULL, 0xaaffaaffaaffaaffULL, }, /* 16 */
+ { 0xaa00aa00aa00aa00ULL, 0xaa00aa00aa00aa00ULL, },
+ { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, },
+ { 0xaa55aa55aa55aa55ULL, 0xaa55aa55aa55aa55ULL, },
+ { 0xaaccaaccaaccaaccULL, 0xaaccaaccaaccaaccULL, },
+ { 0xaa33aa33aa33aa33ULL, 0xaa33aa33aa33aa33ULL, },
+ { 0xaa8eaae3aa38aa8eULL, 0xaae3aa38aa8eaae3ULL, },
+ { 0xaa71aa1caac7aa71ULL, 0xaa1caac7aa71aa1cULL, },
+ { 0x55ff55ff55ff55ffULL, 0x55ff55ff55ff55ffULL, }, /* 24 */
+ { 0x5500550055005500ULL, 0x5500550055005500ULL, },
+ { 0x55aa55aa55aa55aaULL, 0x55aa55aa55aa55aaULL, },
+ { 0x5555555555555555ULL, 0x5555555555555555ULL, },
+ { 0x55cc55cc55cc55ccULL, 0x55cc55cc55cc55ccULL, },
+ { 0x5533553355335533ULL, 0x5533553355335533ULL, },
+ { 0x558e55e35538558eULL, 0x55e35538558e55e3ULL, },
+ { 0x5571551c55c75571ULL, 0x551c55c75571551cULL, },
+ { 0xccffccffccffccffULL, 0xccffccffccffccffULL, }, /* 32 */
+ { 0xcc00cc00cc00cc00ULL, 0xcc00cc00cc00cc00ULL, },
+ { 0xccaaccaaccaaccaaULL, 0xccaaccaaccaaccaaULL, },
+ { 0xcc55cc55cc55cc55ULL, 0xcc55cc55cc55cc55ULL, },
+ { 0xccccccccccccccccULL, 0xccccccccccccccccULL, },
+ { 0xcc33cc33cc33cc33ULL, 0xcc33cc33cc33cc33ULL, },
+ { 0xcc8ecce3cc38cc8eULL, 0xcce3cc38cc8ecce3ULL, },
+ { 0xcc71cc1cccc7cc71ULL, 0xcc1cccc7cc71cc1cULL, },
+ { 0x33ff33ff33ff33ffULL, 0x33ff33ff33ff33ffULL, }, /* 40 */
+ { 0x3300330033003300ULL, 0x3300330033003300ULL, },
+ { 0x33aa33aa33aa33aaULL, 0x33aa33aa33aa33aaULL, },
+ { 0x3355335533553355ULL, 0x3355335533553355ULL, },
+ { 0x33cc33cc33cc33ccULL, 0x33cc33cc33cc33ccULL, },
+ { 0x3333333333333333ULL, 0x3333333333333333ULL, },
+ { 0x338e33e33338338eULL, 0x33e33338338e33e3ULL, },
+ { 0x3371331c33c73371ULL, 0x331c33c73371331cULL, },
+ { 0x8effe3ff38ff8effULL, 0xe3ff38ff8effe3ffULL, }, /* 48 */
+ { 0x8e00e30038008e00ULL, 0xe30038008e00e300ULL, },
+ { 0x8eaae3aa38aa8eaaULL, 0xe3aa38aa8eaae3aaULL, },
+ { 0x8e55e35538558e55ULL, 0xe35538558e55e355ULL, },
+ { 0x8ecce3cc38cc8eccULL, 0xe3cc38cc8ecce3ccULL, },
+ { 0x8e33e33338338e33ULL, 0xe33338338e33e333ULL, },
+ { 0x8e8ee3e338388e8eULL, 0xe3e338388e8ee3e3ULL, },
+ { 0x8e71e31c38c78e71ULL, 0xe31c38c78e71e31cULL, },
+ { 0x71ff1cffc7ff71ffULL, 0x1cffc7ff71ff1cffULL, }, /* 56 */
+ { 0x71001c00c7007100ULL, 0x1c00c70071001c00ULL, },
+ { 0x71aa1caac7aa71aaULL, 0x1caac7aa71aa1caaULL, },
+ { 0x71551c55c7557155ULL, 0x1c55c75571551c55ULL, },
+ { 0x71cc1cccc7cc71ccULL, 0x1cccc7cc71cc1cccULL, },
+ { 0x71331c33c7337133ULL, 0x1c33c73371331c33ULL, },
+ { 0x718e1ce3c738718eULL, 0x1ce3c738718e1ce3ULL, },
+ { 0x71711c1cc7c77171ULL, 0x1c1cc7c771711c1cULL, },
+ { 0x6a6acccc62624040ULL, 0x67675e5e7b7b0c0cULL, }, /* 64 */
+ { 0x6abecc6362934008ULL, 0x67f75e1a7b3f0cfcULL, },
+ { 0x6a5accaa62cf4080ULL, 0x67d85eff7b2b0c14ULL, },
+ { 0x6a4fcc4d6231404eULL, 0x67f15ed87b420ca0ULL, },
+ { 0xbe6a63cc93620840ULL, 0xf7671a5e3f7bfc0cULL, },
+ { 0xbebe636393930808ULL, 0xf7f71a1a3f3ffcfcULL, },
+ { 0xbe5a63aa93cf0880ULL, 0xf7d81aff3f2bfc14ULL, },
+ { 0xbe4f634d9331084eULL, 0xf7f11ad83f42fca0ULL, },
+ { 0x5a6aaacccf628040ULL, 0xd867ff5e2b7b140cULL, }, /* 72 */
+ { 0x5abeaa63cf938008ULL, 0xd8f7ff1a2b3f14fcULL, },
+ { 0x5a5aaaaacfcf8080ULL, 0xd8d8ffff2b2b1414ULL, },
+ { 0x5a4faa4dcf31804eULL, 0xd8f1ffd82b4214a0ULL, },
+ { 0x4f6a4dcc31624e40ULL, 0xf167d85e427ba00cULL, },
+ { 0x4fbe4d6331934e08ULL, 0xf1f7d81a423fa0fcULL, },
+ { 0x4f5a4daa31cf4e80ULL, 0xf1d8d8ff422ba014ULL, },
+ { 0x4f4f4d4d31314e4eULL, 0xf1f1d8d84242a0a0ULL, },
+ };
+
+ gettimeofday(&start, NULL);
+
+ for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) {
+ do_msa_ILVEV_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_ILVEV_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/interleave/test_msa_ilvev_d.c b/tests/tcg/mips/user/ase/msa/interleave/test_msa_ilvev_d.c
new file mode 100644
index 0000000000..d3600e96b4
--- /dev/null
+++ b/tests/tcg/mips/user/ase/msa/interleave/test_msa_ilvev_d.c
@@ -0,0 +1,153 @@
+/*
+ * Test program for MSA instruction ILVEV.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 = "*ILVEV.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 */
+ { 0x0000000000000000ULL, 0xffffffffffffffffULL, },
+ { 0xaaaaaaaaaaaaaaaaULL, 0xffffffffffffffffULL, },
+ { 0x5555555555555555ULL, 0xffffffffffffffffULL, },
+ { 0xccccccccccccccccULL, 0xffffffffffffffffULL, },
+ { 0x3333333333333333ULL, 0xffffffffffffffffULL, },
+ { 0xe38e38e38e38e38eULL, 0xffffffffffffffffULL, },
+ { 0x1c71c71c71c71c71ULL, 0xffffffffffffffffULL, },
+ { 0xffffffffffffffffULL, 0x0000000000000000ULL, }, /* 8 */
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0xaaaaaaaaaaaaaaaaULL, 0x0000000000000000ULL, },
+ { 0x5555555555555555ULL, 0x0000000000000000ULL, },
+ { 0xccccccccccccccccULL, 0x0000000000000000ULL, },
+ { 0x3333333333333333ULL, 0x0000000000000000ULL, },
+ { 0xe38e38e38e38e38eULL, 0x0000000000000000ULL, },
+ { 0x1c71c71c71c71c71ULL, 0x0000000000000000ULL, },
+ { 0xffffffffffffffffULL, 0xaaaaaaaaaaaaaaaaULL, }, /* 16 */
+ { 0x0000000000000000ULL, 0xaaaaaaaaaaaaaaaaULL, },
+ { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, },
+ { 0x5555555555555555ULL, 0xaaaaaaaaaaaaaaaaULL, },
+ { 0xccccccccccccccccULL, 0xaaaaaaaaaaaaaaaaULL, },
+ { 0x3333333333333333ULL, 0xaaaaaaaaaaaaaaaaULL, },
+ { 0xe38e38e38e38e38eULL, 0xaaaaaaaaaaaaaaaaULL, },
+ { 0x1c71c71c71c71c71ULL, 0xaaaaaaaaaaaaaaaaULL, },
+ { 0xffffffffffffffffULL, 0x5555555555555555ULL, }, /* 24 */
+ { 0x0000000000000000ULL, 0x5555555555555555ULL, },
+ { 0xaaaaaaaaaaaaaaaaULL, 0x5555555555555555ULL, },
+ { 0x5555555555555555ULL, 0x5555555555555555ULL, },
+ { 0xccccccccccccccccULL, 0x5555555555555555ULL, },
+ { 0x3333333333333333ULL, 0x5555555555555555ULL, },
+ { 0xe38e38e38e38e38eULL, 0x5555555555555555ULL, },
+ { 0x1c71c71c71c71c71ULL, 0x5555555555555555ULL, },
+ { 0xffffffffffffffffULL, 0xccccccccccccccccULL, }, /* 32 */
+ { 0x0000000000000000ULL, 0xccccccccccccccccULL, },
+ { 0xaaaaaaaaaaaaaaaaULL, 0xccccccccccccccccULL, },
+ { 0x5555555555555555ULL, 0xccccccccccccccccULL, },
+ { 0xccccccccccccccccULL, 0xccccccccccccccccULL, },
+ { 0x3333333333333333ULL, 0xccccccccccccccccULL, },
+ { 0xe38e38e38e38e38eULL, 0xccccccccccccccccULL, },
+ { 0x1c71c71c71c71c71ULL, 0xccccccccccccccccULL, },
+ { 0xffffffffffffffffULL, 0x3333333333333333ULL, }, /* 40 */
+ { 0x0000000000000000ULL, 0x3333333333333333ULL, },
+ { 0xaaaaaaaaaaaaaaaaULL, 0x3333333333333333ULL, },
+ { 0x5555555555555555ULL, 0x3333333333333333ULL, },
+ { 0xccccccccccccccccULL, 0x3333333333333333ULL, },
+ { 0x3333333333333333ULL, 0x3333333333333333ULL, },
+ { 0xe38e38e38e38e38eULL, 0x3333333333333333ULL, },
+ { 0x1c71c71c71c71c71ULL, 0x3333333333333333ULL, },
+ { 0xffffffffffffffffULL, 0xe38e38e38e38e38eULL, }, /* 48 */
+ { 0x0000000000000000ULL, 0xe38e38e38e38e38eULL, },
+ { 0xaaaaaaaaaaaaaaaaULL, 0xe38e38e38e38e38eULL, },
+ { 0x5555555555555555ULL, 0xe38e38e38e38e38eULL, },
+ { 0xccccccccccccccccULL, 0xe38e38e38e38e38eULL, },
+ { 0x3333333333333333ULL, 0xe38e38e38e38e38eULL, },
+ { 0xe38e38e38e38e38eULL, 0xe38e38e38e38e38eULL, },
+ { 0x1c71c71c71c71c71ULL, 0xe38e38e38e38e38eULL, },
+ { 0xffffffffffffffffULL, 0x1c71c71c71c71c71ULL, }, /* 56 */
+ { 0x0000000000000000ULL, 0x1c71c71c71c71c71ULL, },
+ { 0xaaaaaaaaaaaaaaaaULL, 0x1c71c71c71c71c71ULL, },
+ { 0x5555555555555555ULL, 0x1c71c71c71c71c71ULL, },
+ { 0xccccccccccccccccULL, 0x1c71c71c71c71c71ULL, },
+ { 0x3333333333333333ULL, 0x1c71c71c71c71c71ULL, },
+ { 0xe38e38e38e38e38eULL, 0x1c71c71c71c71c71ULL, },
+ { 0x1c71c71c71c71c71ULL, 0x1c71c71c71c71c71ULL, },
+ { 0x886ae6cc28625540ULL, 0x886ae6cc28625540ULL, }, /* 64 */
+ { 0xfbbe00634d93c708ULL, 0x886ae6cc28625540ULL, },
+ { 0xac5aaeaab9cf8b80ULL, 0x886ae6cc28625540ULL, },
+ { 0x704f164d5e31e24eULL, 0x886ae6cc28625540ULL, },
+ { 0x886ae6cc28625540ULL, 0xfbbe00634d93c708ULL, },
+ { 0xfbbe00634d93c708ULL, 0xfbbe00634d93c708ULL, },
+ { 0xac5aaeaab9cf8b80ULL, 0xfbbe00634d93c708ULL, },
+ { 0x704f164d5e31e24eULL, 0xfbbe00634d93c708ULL, },
+ { 0x886ae6cc28625540ULL, 0xac5aaeaab9cf8b80ULL, }, /* 72 */
+ { 0xfbbe00634d93c708ULL, 0xac5aaeaab9cf8b80ULL, },
+ { 0xac5aaeaab9cf8b80ULL, 0xac5aaeaab9cf8b80ULL, },
+ { 0x704f164d5e31e24eULL, 0xac5aaeaab9cf8b80ULL, },
+ { 0x886ae6cc28625540ULL, 0x704f164d5e31e24eULL, },
+ { 0xfbbe00634d93c708ULL, 0x704f164d5e31e24eULL, },
+ { 0xac5aaeaab9cf8b80ULL, 0x704f164d5e31e24eULL, },
+ { 0x704f164d5e31e24eULL, 0x704f164d5e31e24eULL, },
+ };
+
+ gettimeofday(&start, NULL);
+
+ for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) {
+ do_msa_ILVEV_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_ILVEV_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/interleave/test_msa_ilvev_h.c b/tests/tcg/mips/user/ase/msa/interleave/test_msa_ilvev_h.c
new file mode 100644
index 0000000000..9a80fac8eb
--- /dev/null
+++ b/tests/tcg/mips/user/ase/msa/interleave/test_msa_ilvev_h.c
@@ -0,0 +1,153 @@
+/*
+ * Test program for MSA instruction ILVEV.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 = "*ILVEV.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 */
+ { 0xffff0000ffff0000ULL, 0xffff0000ffff0000ULL, },
+ { 0xffffaaaaffffaaaaULL, 0xffffaaaaffffaaaaULL, },
+ { 0xffff5555ffff5555ULL, 0xffff5555ffff5555ULL, },
+ { 0xffffccccffffccccULL, 0xffffccccffffccccULL, },
+ { 0xffff3333ffff3333ULL, 0xffff3333ffff3333ULL, },
+ { 0xffff38e3ffffe38eULL, 0xffff8e38ffff38e3ULL, },
+ { 0xffffc71cffff1c71ULL, 0xffff71c7ffffc71cULL, },
+ { 0x0000ffff0000ffffULL, 0x0000ffff0000ffffULL, }, /* 8 */
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0x0000aaaa0000aaaaULL, 0x0000aaaa0000aaaaULL, },
+ { 0x0000555500005555ULL, 0x0000555500005555ULL, },
+ { 0x0000cccc0000ccccULL, 0x0000cccc0000ccccULL, },
+ { 0x0000333300003333ULL, 0x0000333300003333ULL, },
+ { 0x000038e30000e38eULL, 0x00008e38000038e3ULL, },
+ { 0x0000c71c00001c71ULL, 0x000071c70000c71cULL, },
+ { 0xaaaaffffaaaaffffULL, 0xaaaaffffaaaaffffULL, }, /* 16 */
+ { 0xaaaa0000aaaa0000ULL, 0xaaaa0000aaaa0000ULL, },
+ { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, },
+ { 0xaaaa5555aaaa5555ULL, 0xaaaa5555aaaa5555ULL, },
+ { 0xaaaaccccaaaaccccULL, 0xaaaaccccaaaaccccULL, },
+ { 0xaaaa3333aaaa3333ULL, 0xaaaa3333aaaa3333ULL, },
+ { 0xaaaa38e3aaaae38eULL, 0xaaaa8e38aaaa38e3ULL, },
+ { 0xaaaac71caaaa1c71ULL, 0xaaaa71c7aaaac71cULL, },
+ { 0x5555ffff5555ffffULL, 0x5555ffff5555ffffULL, }, /* 24 */
+ { 0x5555000055550000ULL, 0x5555000055550000ULL, },
+ { 0x5555aaaa5555aaaaULL, 0x5555aaaa5555aaaaULL, },
+ { 0x5555555555555555ULL, 0x5555555555555555ULL, },
+ { 0x5555cccc5555ccccULL, 0x5555cccc5555ccccULL, },
+ { 0x5555333355553333ULL, 0x5555333355553333ULL, },
+ { 0x555538e35555e38eULL, 0x55558e38555538e3ULL, },
+ { 0x5555c71c55551c71ULL, 0x555571c75555c71cULL, },
+ { 0xccccffffccccffffULL, 0xccccffffccccffffULL, }, /* 32 */
+ { 0xcccc0000cccc0000ULL, 0xcccc0000cccc0000ULL, },
+ { 0xccccaaaaccccaaaaULL, 0xccccaaaaccccaaaaULL, },
+ { 0xcccc5555cccc5555ULL, 0xcccc5555cccc5555ULL, },
+ { 0xccccccccccccccccULL, 0xccccccccccccccccULL, },
+ { 0xcccc3333cccc3333ULL, 0xcccc3333cccc3333ULL, },
+ { 0xcccc38e3cccce38eULL, 0xcccc8e38cccc38e3ULL, },
+ { 0xccccc71ccccc1c71ULL, 0xcccc71c7ccccc71cULL, },
+ { 0x3333ffff3333ffffULL, 0x3333ffff3333ffffULL, }, /* 40 */
+ { 0x3333000033330000ULL, 0x3333000033330000ULL, },
+ { 0x3333aaaa3333aaaaULL, 0x3333aaaa3333aaaaULL, },
+ { 0x3333555533335555ULL, 0x3333555533335555ULL, },
+ { 0x3333cccc3333ccccULL, 0x3333cccc3333ccccULL, },
+ { 0x3333333333333333ULL, 0x3333333333333333ULL, },
+ { 0x333338e33333e38eULL, 0x33338e38333338e3ULL, },
+ { 0x3333c71c33331c71ULL, 0x333371c73333c71cULL, },
+ { 0x38e3ffffe38effffULL, 0x8e38ffff38e3ffffULL, }, /* 48 */
+ { 0x38e30000e38e0000ULL, 0x8e38000038e30000ULL, },
+ { 0x38e3aaaae38eaaaaULL, 0x8e38aaaa38e3aaaaULL, },
+ { 0x38e35555e38e5555ULL, 0x8e38555538e35555ULL, },
+ { 0x38e3cccce38eccccULL, 0x8e38cccc38e3ccccULL, },
+ { 0x38e33333e38e3333ULL, 0x8e38333338e33333ULL, },
+ { 0x38e338e3e38ee38eULL, 0x8e388e3838e338e3ULL, },
+ { 0x38e3c71ce38e1c71ULL, 0x8e3871c738e3c71cULL, },
+ { 0xc71cffff1c71ffffULL, 0x71c7ffffc71cffffULL, }, /* 56 */
+ { 0xc71c00001c710000ULL, 0x71c70000c71c0000ULL, },
+ { 0xc71caaaa1c71aaaaULL, 0x71c7aaaac71caaaaULL, },
+ { 0xc71c55551c715555ULL, 0x71c75555c71c5555ULL, },
+ { 0xc71ccccc1c71ccccULL, 0x71c7ccccc71cccccULL, },
+ { 0xc71c33331c713333ULL, 0x71c73333c71c3333ULL, },
+ { 0xc71c38e31c71e38eULL, 0x71c78e38c71c38e3ULL, },
+ { 0xc71cc71c1c711c71ULL, 0x71c771c7c71cc71cULL, },
+ { 0xe6cce6cc55405540ULL, 0x0b5e0b5eb00cb00cULL, }, /* 64 */
+ { 0xe6cc00635540c708ULL, 0x0b5ebb1ab00c52fcULL, },
+ { 0xe6ccaeaa55408b80ULL, 0x0b5ec6ffb00c2514ULL, },
+ { 0xe6cc164d5540e24eULL, 0x0b5e88d8b00ce2a0ULL, },
+ { 0x0063e6ccc7085540ULL, 0xbb1a0b5e52fcb00cULL, },
+ { 0x00630063c708c708ULL, 0xbb1abb1a52fc52fcULL, },
+ { 0x0063aeaac7088b80ULL, 0xbb1ac6ff52fc2514ULL, },
+ { 0x0063164dc708e24eULL, 0xbb1a88d852fce2a0ULL, },
+ { 0xaeaae6cc8b805540ULL, 0xc6ff0b5e2514b00cULL, }, /* 72 */
+ { 0xaeaa00638b80c708ULL, 0xc6ffbb1a251452fcULL, },
+ { 0xaeaaaeaa8b808b80ULL, 0xc6ffc6ff25142514ULL, },
+ { 0xaeaa164d8b80e24eULL, 0xc6ff88d82514e2a0ULL, },
+ { 0x164de6cce24e5540ULL, 0x88d80b5ee2a0b00cULL, },
+ { 0x164d0063e24ec708ULL, 0x88d8bb1ae2a052fcULL, },
+ { 0x164daeaae24e8b80ULL, 0x88d8c6ffe2a02514ULL, },
+ { 0x164d164de24ee24eULL, 0x88d888d8e2a0e2a0ULL, },
+ };
+
+ gettimeofday(&start, NULL);
+
+ for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) {
+ do_msa_ILVEV_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_ILVEV_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/interleave/test_msa_ilvev_w.c b/tests/tcg/mips/user/ase/msa/interleave/test_msa_ilvev_w.c
new file mode 100644
index 0000000000..8f62d4700a
--- /dev/null
+++ b/tests/tcg/mips/user/ase/msa/interleave/test_msa_ilvev_w.c
@@ -0,0 +1,153 @@
+/*
+ * Test program for MSA instruction ILVEV.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 = "ILVEV.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 */
+ { 0xffffffff00000000ULL, 0xffffffff00000000ULL, },
+ { 0xffffffffaaaaaaaaULL, 0xffffffffaaaaaaaaULL, },
+ { 0xffffffff55555555ULL, 0xffffffff55555555ULL, },
+ { 0xffffffffccccccccULL, 0xffffffffccccccccULL, },
+ { 0xffffffff33333333ULL, 0xffffffff33333333ULL, },
+ { 0xffffffff8e38e38eULL, 0xffffffffe38e38e3ULL, },
+ { 0xffffffff71c71c71ULL, 0xffffffff1c71c71cULL, },
+ { 0x00000000ffffffffULL, 0x00000000ffffffffULL, }, /* 8 */
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0x00000000aaaaaaaaULL, 0x00000000aaaaaaaaULL, },
+ { 0x0000000055555555ULL, 0x0000000055555555ULL, },
+ { 0x00000000ccccccccULL, 0x00000000ccccccccULL, },
+ { 0x0000000033333333ULL, 0x0000000033333333ULL, },
+ { 0x000000008e38e38eULL, 0x00000000e38e38e3ULL, },
+ { 0x0000000071c71c71ULL, 0x000000001c71c71cULL, },
+ { 0xaaaaaaaaffffffffULL, 0xaaaaaaaaffffffffULL, }, /* 16 */
+ { 0xaaaaaaaa00000000ULL, 0xaaaaaaaa00000000ULL, },
+ { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, },
+ { 0xaaaaaaaa55555555ULL, 0xaaaaaaaa55555555ULL, },
+ { 0xaaaaaaaaccccccccULL, 0xaaaaaaaaccccccccULL, },
+ { 0xaaaaaaaa33333333ULL, 0xaaaaaaaa33333333ULL, },
+ { 0xaaaaaaaa8e38e38eULL, 0xaaaaaaaae38e38e3ULL, },
+ { 0xaaaaaaaa71c71c71ULL, 0xaaaaaaaa1c71c71cULL, },
+ { 0x55555555ffffffffULL, 0x55555555ffffffffULL, }, /* 24 */
+ { 0x5555555500000000ULL, 0x5555555500000000ULL, },
+ { 0x55555555aaaaaaaaULL, 0x55555555aaaaaaaaULL, },
+ { 0x5555555555555555ULL, 0x5555555555555555ULL, },
+ { 0x55555555ccccccccULL, 0x55555555ccccccccULL, },
+ { 0x5555555533333333ULL, 0x5555555533333333ULL, },
+ { 0x555555558e38e38eULL, 0x55555555e38e38e3ULL, },
+ { 0x5555555571c71c71ULL, 0x555555551c71c71cULL, },
+ { 0xccccccccffffffffULL, 0xccccccccffffffffULL, }, /* 32 */
+ { 0xcccccccc00000000ULL, 0xcccccccc00000000ULL, },
+ { 0xccccccccaaaaaaaaULL, 0xccccccccaaaaaaaaULL, },
+ { 0xcccccccc55555555ULL, 0xcccccccc55555555ULL, },
+ { 0xccccccccccccccccULL, 0xccccccccccccccccULL, },
+ { 0xcccccccc33333333ULL, 0xcccccccc33333333ULL, },
+ { 0xcccccccc8e38e38eULL, 0xcccccccce38e38e3ULL, },
+ { 0xcccccccc71c71c71ULL, 0xcccccccc1c71c71cULL, },
+ { 0x33333333ffffffffULL, 0x33333333ffffffffULL, }, /* 40 */
+ { 0x3333333300000000ULL, 0x3333333300000000ULL, },
+ { 0x33333333aaaaaaaaULL, 0x33333333aaaaaaaaULL, },
+ { 0x3333333355555555ULL, 0x3333333355555555ULL, },
+ { 0x33333333ccccccccULL, 0x33333333ccccccccULL, },
+ { 0x3333333333333333ULL, 0x3333333333333333ULL, },
+ { 0x333333338e38e38eULL, 0x33333333e38e38e3ULL, },
+ { 0x3333333371c71c71ULL, 0x333333331c71c71cULL, },
+ { 0x8e38e38effffffffULL, 0xe38e38e3ffffffffULL, }, /* 48 */
+ { 0x8e38e38e00000000ULL, 0xe38e38e300000000ULL, },
+ { 0x8e38e38eaaaaaaaaULL, 0xe38e38e3aaaaaaaaULL, },
+ { 0x8e38e38e55555555ULL, 0xe38e38e355555555ULL, },
+ { 0x8e38e38eccccccccULL, 0xe38e38e3ccccccccULL, },
+ { 0x8e38e38e33333333ULL, 0xe38e38e333333333ULL, },
+ { 0x8e38e38e8e38e38eULL, 0xe38e38e3e38e38e3ULL, },
+ { 0x8e38e38e71c71c71ULL, 0xe38e38e31c71c71cULL, },
+ { 0x71c71c71ffffffffULL, 0x1c71c71cffffffffULL, }, /* 56 */
+ { 0x71c71c7100000000ULL, 0x1c71c71c00000000ULL, },
+ { 0x71c71c71aaaaaaaaULL, 0x1c71c71caaaaaaaaULL, },
+ { 0x71c71c7155555555ULL, 0x1c71c71c55555555ULL, },
+ { 0x71c71c71ccccccccULL, 0x1c71c71cccccccccULL, },
+ { 0x71c71c7133333333ULL, 0x1c71c71c33333333ULL, },
+ { 0x71c71c718e38e38eULL, 0x1c71c71ce38e38e3ULL, },
+ { 0x71c71c7171c71c71ULL, 0x1c71c71c1c71c71cULL, },
+ { 0x2862554028625540ULL, 0xfe7bb00cfe7bb00cULL, }, /* 64 */
+ { 0x286255404d93c708ULL, 0xfe7bb00c153f52fcULL, },
+ { 0x28625540b9cf8b80ULL, 0xfe7bb00cab2b2514ULL, },
+ { 0x286255405e31e24eULL, 0xfe7bb00ca942e2a0ULL, },
+ { 0x4d93c70828625540ULL, 0x153f52fcfe7bb00cULL, },
+ { 0x4d93c7084d93c708ULL, 0x153f52fc153f52fcULL, },
+ { 0x4d93c708b9cf8b80ULL, 0x153f52fcab2b2514ULL, },
+ { 0x4d93c7085e31e24eULL, 0x153f52fca942e2a0ULL, },
+ { 0xb9cf8b8028625540ULL, 0xab2b2514fe7bb00cULL, }, /* 72 */
+ { 0xb9cf8b804d93c708ULL, 0xab2b2514153f52fcULL, },
+ { 0xb9cf8b80b9cf8b80ULL, 0xab2b2514ab2b2514ULL, },
+ { 0xb9cf8b805e31e24eULL, 0xab2b2514a942e2a0ULL, },
+ { 0x5e31e24e28625540ULL, 0xa942e2a0fe7bb00cULL, },
+ { 0x5e31e24e4d93c708ULL, 0xa942e2a0153f52fcULL, },
+ { 0x5e31e24eb9cf8b80ULL, 0xa942e2a0ab2b2514ULL, },
+ { 0x5e31e24e5e31e24eULL, 0xa942e2a0a942e2a0ULL, },
+ };
+
+ gettimeofday(&start, NULL);
+
+ for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) {
+ do_msa_ILVEV_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_ILVEV_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/interleave/test_msa_ilvl_b.c b/tests/tcg/mips/user/ase/msa/interleave/test_msa_ilvl_b.c
new file mode 100644
index 0000000000..f7e6dc0503
--- /dev/null
+++ b/tests/tcg/mips/user/ase/msa/interleave/test_msa_ilvl_b.c
@@ -0,0 +1,153 @@
+/*
+ * Test program for MSA instruction ILVL.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 = "ILVL.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 */
+ { 0xff00ff00ff00ff00ULL, 0xff00ff00ff00ff00ULL, },
+ { 0xffaaffaaffaaffaaULL, 0xffaaffaaffaaffaaULL, },
+ { 0xff55ff55ff55ff55ULL, 0xff55ff55ff55ff55ULL, },
+ { 0xffccffccffccffccULL, 0xffccffccffccffccULL, },
+ { 0xff33ff33ff33ff33ULL, 0xff33ff33ff33ff33ULL, },
+ { 0xffe3ff8eff38ffe3ULL, 0xff38ffe3ff8eff38ULL, },
+ { 0xff1cff71ffc7ff1cULL, 0xffc7ff1cff71ffc7ULL, },
+ { 0x00ff00ff00ff00ffULL, 0x00ff00ff00ff00ffULL, }, /* 8 */
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0x00aa00aa00aa00aaULL, 0x00aa00aa00aa00aaULL, },
+ { 0x0055005500550055ULL, 0x0055005500550055ULL, },
+ { 0x00cc00cc00cc00ccULL, 0x00cc00cc00cc00ccULL, },
+ { 0x0033003300330033ULL, 0x0033003300330033ULL, },
+ { 0x00e3008e003800e3ULL, 0x003800e3008e0038ULL, },
+ { 0x001c007100c7001cULL, 0x00c7001c007100c7ULL, },
+ { 0xaaffaaffaaffaaffULL, 0xaaffaaffaaffaaffULL, }, /* 16 */
+ { 0xaa00aa00aa00aa00ULL, 0xaa00aa00aa00aa00ULL, },
+ { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, },
+ { 0xaa55aa55aa55aa55ULL, 0xaa55aa55aa55aa55ULL, },
+ { 0xaaccaaccaaccaaccULL, 0xaaccaaccaaccaaccULL, },
+ { 0xaa33aa33aa33aa33ULL, 0xaa33aa33aa33aa33ULL, },
+ { 0xaae3aa8eaa38aae3ULL, 0xaa38aae3aa8eaa38ULL, },
+ { 0xaa1caa71aac7aa1cULL, 0xaac7aa1caa71aac7ULL, },
+ { 0x55ff55ff55ff55ffULL, 0x55ff55ff55ff55ffULL, }, /* 24 */
+ { 0x5500550055005500ULL, 0x5500550055005500ULL, },
+ { 0x55aa55aa55aa55aaULL, 0x55aa55aa55aa55aaULL, },
+ { 0x5555555555555555ULL, 0x5555555555555555ULL, },
+ { 0x55cc55cc55cc55ccULL, 0x55cc55cc55cc55ccULL, },
+ { 0x5533553355335533ULL, 0x5533553355335533ULL, },
+ { 0x55e3558e553855e3ULL, 0x553855e3558e5538ULL, },
+ { 0x551c557155c7551cULL, 0x55c7551c557155c7ULL, },
+ { 0xccffccffccffccffULL, 0xccffccffccffccffULL, }, /* 32 */
+ { 0xcc00cc00cc00cc00ULL, 0xcc00cc00cc00cc00ULL, },
+ { 0xccaaccaaccaaccaaULL, 0xccaaccaaccaaccaaULL, },
+ { 0xcc55cc55cc55cc55ULL, 0xcc55cc55cc55cc55ULL, },
+ { 0xccccccccccccccccULL, 0xccccccccccccccccULL, },
+ { 0xcc33cc33cc33cc33ULL, 0xcc33cc33cc33cc33ULL, },
+ { 0xcce3cc8ecc38cce3ULL, 0xcc38cce3cc8ecc38ULL, },
+ { 0xcc1ccc71ccc7cc1cULL, 0xccc7cc1ccc71ccc7ULL, },
+ { 0x33ff33ff33ff33ffULL, 0x33ff33ff33ff33ffULL, }, /* 40 */
+ { 0x3300330033003300ULL, 0x3300330033003300ULL, },
+ { 0x33aa33aa33aa33aaULL, 0x33aa33aa33aa33aaULL, },
+ { 0x3355335533553355ULL, 0x3355335533553355ULL, },
+ { 0x33cc33cc33cc33ccULL, 0x33cc33cc33cc33ccULL, },
+ { 0x3333333333333333ULL, 0x3333333333333333ULL, },
+ { 0x33e3338e333833e3ULL, 0x333833e3338e3338ULL, },
+ { 0x331c337133c7331cULL, 0x33c7331c337133c7ULL, },
+ { 0xe3ff8eff38ffe3ffULL, 0x38ffe3ff8eff38ffULL, }, /* 48 */
+ { 0xe3008e003800e300ULL, 0x3800e3008e003800ULL, },
+ { 0xe3aa8eaa38aae3aaULL, 0x38aae3aa8eaa38aaULL, },
+ { 0xe3558e553855e355ULL, 0x3855e3558e553855ULL, },
+ { 0xe3cc8ecc38cce3ccULL, 0x38cce3cc8ecc38ccULL, },
+ { 0xe3338e333833e333ULL, 0x3833e3338e333833ULL, },
+ { 0xe3e38e8e3838e3e3ULL, 0x3838e3e38e8e3838ULL, },
+ { 0xe31c8e7138c7e31cULL, 0x38c7e31c8e7138c7ULL, },
+ { 0x1cff71ffc7ff1cffULL, 0xc7ff1cff71ffc7ffULL, }, /* 56 */
+ { 0x1c007100c7001c00ULL, 0xc7001c007100c700ULL, },
+ { 0x1caa71aac7aa1caaULL, 0xc7aa1caa71aac7aaULL, },
+ { 0x1c557155c7551c55ULL, 0xc7551c557155c755ULL, },
+ { 0x1ccc71ccc7cc1cccULL, 0xc7cc1ccc71ccc7ccULL, },
+ { 0x1c337133c7331c33ULL, 0xc7331c337133c733ULL, },
+ { 0x1ce3718ec7381ce3ULL, 0xc7381ce3718ec738ULL, },
+ { 0x1c1c7171c7c71c1cULL, 0xc7c71c1c7171c7c7ULL, },
+ { 0xfefe7b7bb0b00c0cULL, 0x4b4b67670b0b5e5eULL, }, /* 64 */
+ { 0xfe157b3fb0520cfcULL, 0x4b1267f70bbb5e1aULL, },
+ { 0xfeab7b2bb0250c14ULL, 0x4b2767d80bc65effULL, },
+ { 0xfea97b42b0e20ca0ULL, 0x4b8d67f10b885ed8ULL, },
+ { 0x15fe3f7b52b0fc0cULL, 0x124bf767bb0b1a5eULL, },
+ { 0x15153f3f5252fcfcULL, 0x1212f7f7bbbb1a1aULL, },
+ { 0x15ab3f2b5225fc14ULL, 0x1227f7d8bbc61affULL, },
+ { 0x15a93f4252e2fca0ULL, 0x128df7f1bb881ad8ULL, },
+ { 0xabfe2b7b25b0140cULL, 0x274bd867c60bff5eULL, }, /* 72 */
+ { 0xab152b3f255214fcULL, 0x2712d8f7c6bbff1aULL, },
+ { 0xabab2b2b25251414ULL, 0x2727d8d8c6c6ffffULL, },
+ { 0xaba92b4225e214a0ULL, 0x278dd8f1c688ffd8ULL, },
+ { 0xa9fe427be2b0a00cULL, 0x8d4bf167880bd85eULL, },
+ { 0xa915423fe252a0fcULL, 0x8d12f1f788bbd81aULL, },
+ { 0xa9ab422be225a014ULL, 0x8d27f1d888c6d8ffULL, },
+ { 0xa9a94242e2e2a0a0ULL, 0x8d8df1f18888d8d8ULL, },
+ };
+
+ gettimeofday(&start, NULL);
+
+ for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) {
+ do_msa_ILVL_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_ILVL_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/interleave/test_msa_ilvl_d.c b/tests/tcg/mips/user/ase/msa/interleave/test_msa_ilvl_d.c
new file mode 100644
index 0000000000..0f4c048ff6
--- /dev/null
+++ b/tests/tcg/mips/user/ase/msa/interleave/test_msa_ilvl_d.c
@@ -0,0 +1,153 @@
+/*
+ * Test program for MSA instruction ILVL.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 = "ILVL.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 */
+ { 0x0000000000000000ULL, 0xffffffffffffffffULL, },
+ { 0xaaaaaaaaaaaaaaaaULL, 0xffffffffffffffffULL, },
+ { 0x5555555555555555ULL, 0xffffffffffffffffULL, },
+ { 0xccccccccccccccccULL, 0xffffffffffffffffULL, },
+ { 0x3333333333333333ULL, 0xffffffffffffffffULL, },
+ { 0x38e38e38e38e38e3ULL, 0xffffffffffffffffULL, },
+ { 0xc71c71c71c71c71cULL, 0xffffffffffffffffULL, },
+ { 0xffffffffffffffffULL, 0x0000000000000000ULL, }, /* 8 */
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0xaaaaaaaaaaaaaaaaULL, 0x0000000000000000ULL, },
+ { 0x5555555555555555ULL, 0x0000000000000000ULL, },
+ { 0xccccccccccccccccULL, 0x0000000000000000ULL, },
+ { 0x3333333333333333ULL, 0x0000000000000000ULL, },
+ { 0x38e38e38e38e38e3ULL, 0x0000000000000000ULL, },
+ { 0xc71c71c71c71c71cULL, 0x0000000000000000ULL, },
+ { 0xffffffffffffffffULL, 0xaaaaaaaaaaaaaaaaULL, }, /* 16 */
+ { 0x0000000000000000ULL, 0xaaaaaaaaaaaaaaaaULL, },
+ { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, },
+ { 0x5555555555555555ULL, 0xaaaaaaaaaaaaaaaaULL, },
+ { 0xccccccccccccccccULL, 0xaaaaaaaaaaaaaaaaULL, },
+ { 0x3333333333333333ULL, 0xaaaaaaaaaaaaaaaaULL, },
+ { 0x38e38e38e38e38e3ULL, 0xaaaaaaaaaaaaaaaaULL, },
+ { 0xc71c71c71c71c71cULL, 0xaaaaaaaaaaaaaaaaULL, },
+ { 0xffffffffffffffffULL, 0x5555555555555555ULL, }, /* 24 */
+ { 0x0000000000000000ULL, 0x5555555555555555ULL, },
+ { 0xaaaaaaaaaaaaaaaaULL, 0x5555555555555555ULL, },
+ { 0x5555555555555555ULL, 0x5555555555555555ULL, },
+ { 0xccccccccccccccccULL, 0x5555555555555555ULL, },
+ { 0x3333333333333333ULL, 0x5555555555555555ULL, },
+ { 0x38e38e38e38e38e3ULL, 0x5555555555555555ULL, },
+ { 0xc71c71c71c71c71cULL, 0x5555555555555555ULL, },
+ { 0xffffffffffffffffULL, 0xccccccccccccccccULL, }, /* 32 */
+ { 0x0000000000000000ULL, 0xccccccccccccccccULL, },
+ { 0xaaaaaaaaaaaaaaaaULL, 0xccccccccccccccccULL, },
+ { 0x5555555555555555ULL, 0xccccccccccccccccULL, },
+ { 0xccccccccccccccccULL, 0xccccccccccccccccULL, },
+ { 0x3333333333333333ULL, 0xccccccccccccccccULL, },
+ { 0x38e38e38e38e38e3ULL, 0xccccccccccccccccULL, },
+ { 0xc71c71c71c71c71cULL, 0xccccccccccccccccULL, },
+ { 0xffffffffffffffffULL, 0x3333333333333333ULL, }, /* 40 */
+ { 0x0000000000000000ULL, 0x3333333333333333ULL, },
+ { 0xaaaaaaaaaaaaaaaaULL, 0x3333333333333333ULL, },
+ { 0x5555555555555555ULL, 0x3333333333333333ULL, },
+ { 0xccccccccccccccccULL, 0x3333333333333333ULL, },
+ { 0x3333333333333333ULL, 0x3333333333333333ULL, },
+ { 0x38e38e38e38e38e3ULL, 0x3333333333333333ULL, },
+ { 0xc71c71c71c71c71cULL, 0x3333333333333333ULL, },
+ { 0xffffffffffffffffULL, 0x38e38e38e38e38e3ULL, }, /* 48 */
+ { 0x0000000000000000ULL, 0x38e38e38e38e38e3ULL, },
+ { 0xaaaaaaaaaaaaaaaaULL, 0x38e38e38e38e38e3ULL, },
+ { 0x5555555555555555ULL, 0x38e38e38e38e38e3ULL, },
+ { 0xccccccccccccccccULL, 0x38e38e38e38e38e3ULL, },
+ { 0x3333333333333333ULL, 0x38e38e38e38e38e3ULL, },
+ { 0x38e38e38e38e38e3ULL, 0x38e38e38e38e38e3ULL, },
+ { 0xc71c71c71c71c71cULL, 0x38e38e38e38e38e3ULL, },
+ { 0xffffffffffffffffULL, 0xc71c71c71c71c71cULL, }, /* 56 */
+ { 0x0000000000000000ULL, 0xc71c71c71c71c71cULL, },
+ { 0xaaaaaaaaaaaaaaaaULL, 0xc71c71c71c71c71cULL, },
+ { 0x5555555555555555ULL, 0xc71c71c71c71c71cULL, },
+ { 0xccccccccccccccccULL, 0xc71c71c71c71c71cULL, },
+ { 0x3333333333333333ULL, 0xc71c71c71c71c71cULL, },
+ { 0x38e38e38e38e38e3ULL, 0xc71c71c71c71c71cULL, },
+ { 0xc71c71c71c71c71cULL, 0xc71c71c71c71c71cULL, },
+ { 0x4b670b5efe7bb00cULL, 0x4b670b5efe7bb00cULL, }, /* 64 */
+ { 0x12f7bb1a153f52fcULL, 0x4b670b5efe7bb00cULL, },
+ { 0x27d8c6ffab2b2514ULL, 0x4b670b5efe7bb00cULL, },
+ { 0x8df188d8a942e2a0ULL, 0x4b670b5efe7bb00cULL, },
+ { 0x4b670b5efe7bb00cULL, 0x12f7bb1a153f52fcULL, },
+ { 0x12f7bb1a153f52fcULL, 0x12f7bb1a153f52fcULL, },
+ { 0x27d8c6ffab2b2514ULL, 0x12f7bb1a153f52fcULL, },
+ { 0x8df188d8a942e2a0ULL, 0x12f7bb1a153f52fcULL, },
+ { 0x4b670b5efe7bb00cULL, 0x27d8c6ffab2b2514ULL, }, /* 72 */
+ { 0x12f7bb1a153f52fcULL, 0x27d8c6ffab2b2514ULL, },
+ { 0x27d8c6ffab2b2514ULL, 0x27d8c6ffab2b2514ULL, },
+ { 0x8df188d8a942e2a0ULL, 0x27d8c6ffab2b2514ULL, },
+ { 0x4b670b5efe7bb00cULL, 0x8df188d8a942e2a0ULL, },
+ { 0x12f7bb1a153f52fcULL, 0x8df188d8a942e2a0ULL, },
+ { 0x27d8c6ffab2b2514ULL, 0x8df188d8a942e2a0ULL, },
+ { 0x8df188d8a942e2a0ULL, 0x8df188d8a942e2a0ULL, },
+ };
+
+ gettimeofday(&start, NULL);
+
+ for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) {
+ do_msa_ILVL_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_ILVL_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/interleave/test_msa_ilvl_h.c b/tests/tcg/mips/user/ase/msa/interleave/test_msa_ilvl_h.c
new file mode 100644
index 0000000000..6c1c6d9f36
--- /dev/null
+++ b/tests/tcg/mips/user/ase/msa/interleave/test_msa_ilvl_h.c
@@ -0,0 +1,153 @@
+/*
+ * Test program for MSA instruction ILVL.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 = "ILVL.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 */
+ { 0xffff0000ffff0000ULL, 0xffff0000ffff0000ULL, },
+ { 0xffffaaaaffffaaaaULL, 0xffffaaaaffffaaaaULL, },
+ { 0xffff5555ffff5555ULL, 0xffff5555ffff5555ULL, },
+ { 0xffffccccffffccccULL, 0xffffccccffffccccULL, },
+ { 0xffff3333ffff3333ULL, 0xffff3333ffff3333ULL, },
+ { 0xffffe38effff38e3ULL, 0xffff38e3ffff8e38ULL, },
+ { 0xffff1c71ffffc71cULL, 0xffffc71cffff71c7ULL, },
+ { 0x0000ffff0000ffffULL, 0x0000ffff0000ffffULL, }, /* 8 */
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0x0000aaaa0000aaaaULL, 0x0000aaaa0000aaaaULL, },
+ { 0x0000555500005555ULL, 0x0000555500005555ULL, },
+ { 0x0000cccc0000ccccULL, 0x0000cccc0000ccccULL, },
+ { 0x0000333300003333ULL, 0x0000333300003333ULL, },
+ { 0x0000e38e000038e3ULL, 0x000038e300008e38ULL, },
+ { 0x00001c710000c71cULL, 0x0000c71c000071c7ULL, },
+ { 0xaaaaffffaaaaffffULL, 0xaaaaffffaaaaffffULL, }, /* 16 */
+ { 0xaaaa0000aaaa0000ULL, 0xaaaa0000aaaa0000ULL, },
+ { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, },
+ { 0xaaaa5555aaaa5555ULL, 0xaaaa5555aaaa5555ULL, },
+ { 0xaaaaccccaaaaccccULL, 0xaaaaccccaaaaccccULL, },
+ { 0xaaaa3333aaaa3333ULL, 0xaaaa3333aaaa3333ULL, },
+ { 0xaaaae38eaaaa38e3ULL, 0xaaaa38e3aaaa8e38ULL, },
+ { 0xaaaa1c71aaaac71cULL, 0xaaaac71caaaa71c7ULL, },
+ { 0x5555ffff5555ffffULL, 0x5555ffff5555ffffULL, }, /* 24 */
+ { 0x5555000055550000ULL, 0x5555000055550000ULL, },
+ { 0x5555aaaa5555aaaaULL, 0x5555aaaa5555aaaaULL, },
+ { 0x5555555555555555ULL, 0x5555555555555555ULL, },
+ { 0x5555cccc5555ccccULL, 0x5555cccc5555ccccULL, },
+ { 0x5555333355553333ULL, 0x5555333355553333ULL, },
+ { 0x5555e38e555538e3ULL, 0x555538e355558e38ULL, },
+ { 0x55551c715555c71cULL, 0x5555c71c555571c7ULL, },
+ { 0xccccffffccccffffULL, 0xccccffffccccffffULL, }, /* 32 */
+ { 0xcccc0000cccc0000ULL, 0xcccc0000cccc0000ULL, },
+ { 0xccccaaaaccccaaaaULL, 0xccccaaaaccccaaaaULL, },
+ { 0xcccc5555cccc5555ULL, 0xcccc5555cccc5555ULL, },
+ { 0xccccccccccccccccULL, 0xccccccccccccccccULL, },
+ { 0xcccc3333cccc3333ULL, 0xcccc3333cccc3333ULL, },
+ { 0xcccce38ecccc38e3ULL, 0xcccc38e3cccc8e38ULL, },
+ { 0xcccc1c71ccccc71cULL, 0xccccc71ccccc71c7ULL, },
+ { 0x3333ffff3333ffffULL, 0x3333ffff3333ffffULL, }, /* 40 */
+ { 0x3333000033330000ULL, 0x3333000033330000ULL, },
+ { 0x3333aaaa3333aaaaULL, 0x3333aaaa3333aaaaULL, },
+ { 0x3333555533335555ULL, 0x3333555533335555ULL, },
+ { 0x3333cccc3333ccccULL, 0x3333cccc3333ccccULL, },
+ { 0x3333333333333333ULL, 0x3333333333333333ULL, },
+ { 0x3333e38e333338e3ULL, 0x333338e333338e38ULL, },
+ { 0x33331c713333c71cULL, 0x3333c71c333371c7ULL, },
+ { 0xe38effff38e3ffffULL, 0x38e3ffff8e38ffffULL, }, /* 48 */
+ { 0xe38e000038e30000ULL, 0x38e300008e380000ULL, },
+ { 0xe38eaaaa38e3aaaaULL, 0x38e3aaaa8e38aaaaULL, },
+ { 0xe38e555538e35555ULL, 0x38e355558e385555ULL, },
+ { 0xe38ecccc38e3ccccULL, 0x38e3cccc8e38ccccULL, },
+ { 0xe38e333338e33333ULL, 0x38e333338e383333ULL, },
+ { 0xe38ee38e38e338e3ULL, 0x38e338e38e388e38ULL, },
+ { 0xe38e1c7138e3c71cULL, 0x38e3c71c8e3871c7ULL, },
+ { 0x1c71ffffc71cffffULL, 0xc71cffff71c7ffffULL, }, /* 56 */
+ { 0x1c710000c71c0000ULL, 0xc71c000071c70000ULL, },
+ { 0x1c71aaaac71caaaaULL, 0xc71caaaa71c7aaaaULL, },
+ { 0x1c715555c71c5555ULL, 0xc71c555571c75555ULL, },
+ { 0x1c71ccccc71cccccULL, 0xc71ccccc71c7ccccULL, },
+ { 0x1c713333c71c3333ULL, 0xc71c333371c73333ULL, },
+ { 0x1c71e38ec71c38e3ULL, 0xc71c38e371c78e38ULL, },
+ { 0x1c711c71c71cc71cULL, 0xc71cc71c71c771c7ULL, },
+ { 0xfe7bfe7bb00cb00cULL, 0x4b674b670b5e0b5eULL, }, /* 64 */
+ { 0xfe7b153fb00c52fcULL, 0x4b6712f70b5ebb1aULL, },
+ { 0xfe7bab2bb00c2514ULL, 0x4b6727d80b5ec6ffULL, },
+ { 0xfe7ba942b00ce2a0ULL, 0x4b678df10b5e88d8ULL, },
+ { 0x153ffe7b52fcb00cULL, 0x12f74b67bb1a0b5eULL, },
+ { 0x153f153f52fc52fcULL, 0x12f712f7bb1abb1aULL, },
+ { 0x153fab2b52fc2514ULL, 0x12f727d8bb1ac6ffULL, },
+ { 0x153fa94252fce2a0ULL, 0x12f78df1bb1a88d8ULL, },
+ { 0xab2bfe7b2514b00cULL, 0x27d84b67c6ff0b5eULL, }, /* 72 */
+ { 0xab2b153f251452fcULL, 0x27d812f7c6ffbb1aULL, },
+ { 0xab2bab2b25142514ULL, 0x27d827d8c6ffc6ffULL, },
+ { 0xab2ba9422514e2a0ULL, 0x27d88df1c6ff88d8ULL, },
+ { 0xa942fe7be2a0b00cULL, 0x8df14b6788d80b5eULL, },
+ { 0xa942153fe2a052fcULL, 0x8df112f788d8bb1aULL, },
+ { 0xa942ab2be2a02514ULL, 0x8df127d888d8c6ffULL, },
+ { 0xa942a942e2a0e2a0ULL, 0x8df18df188d888d8ULL, },
+ };
+
+ gettimeofday(&start, NULL);
+
+ for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) {
+ do_msa_ILVL_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_ILVL_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/interleave/test_msa_ilvl_w.c b/tests/tcg/mips/user/ase/msa/interleave/test_msa_ilvl_w.c
new file mode 100644
index 0000000000..d22d96558d
--- /dev/null
+++ b/tests/tcg/mips/user/ase/msa/interleave/test_msa_ilvl_w.c
@@ -0,0 +1,153 @@
+/*
+ * Test program for MSA instruction ILVL.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 = "ILVL.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 */
+ { 0xffffffff00000000ULL, 0xffffffff00000000ULL, },
+ { 0xffffffffaaaaaaaaULL, 0xffffffffaaaaaaaaULL, },
+ { 0xffffffff55555555ULL, 0xffffffff55555555ULL, },
+ { 0xffffffffccccccccULL, 0xffffffffccccccccULL, },
+ { 0xffffffff33333333ULL, 0xffffffff33333333ULL, },
+ { 0xffffffffe38e38e3ULL, 0xffffffff38e38e38ULL, },
+ { 0xffffffff1c71c71cULL, 0xffffffffc71c71c7ULL, },
+ { 0x00000000ffffffffULL, 0x00000000ffffffffULL, }, /* 8 */
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0x00000000aaaaaaaaULL, 0x00000000aaaaaaaaULL, },
+ { 0x0000000055555555ULL, 0x0000000055555555ULL, },
+ { 0x00000000ccccccccULL, 0x00000000ccccccccULL, },
+ { 0x0000000033333333ULL, 0x0000000033333333ULL, },
+ { 0x00000000e38e38e3ULL, 0x0000000038e38e38ULL, },
+ { 0x000000001c71c71cULL, 0x00000000c71c71c7ULL, },
+ { 0xaaaaaaaaffffffffULL, 0xaaaaaaaaffffffffULL, }, /* 16 */
+ { 0xaaaaaaaa00000000ULL, 0xaaaaaaaa00000000ULL, },
+ { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, },
+ { 0xaaaaaaaa55555555ULL, 0xaaaaaaaa55555555ULL, },
+ { 0xaaaaaaaaccccccccULL, 0xaaaaaaaaccccccccULL, },
+ { 0xaaaaaaaa33333333ULL, 0xaaaaaaaa33333333ULL, },
+ { 0xaaaaaaaae38e38e3ULL, 0xaaaaaaaa38e38e38ULL, },
+ { 0xaaaaaaaa1c71c71cULL, 0xaaaaaaaac71c71c7ULL, },
+ { 0x55555555ffffffffULL, 0x55555555ffffffffULL, }, /* 24 */
+ { 0x5555555500000000ULL, 0x5555555500000000ULL, },
+ { 0x55555555aaaaaaaaULL, 0x55555555aaaaaaaaULL, },
+ { 0x5555555555555555ULL, 0x5555555555555555ULL, },
+ { 0x55555555ccccccccULL, 0x55555555ccccccccULL, },
+ { 0x5555555533333333ULL, 0x5555555533333333ULL, },
+ { 0x55555555e38e38e3ULL, 0x5555555538e38e38ULL, },
+ { 0x555555551c71c71cULL, 0x55555555c71c71c7ULL, },
+ { 0xccccccccffffffffULL, 0xccccccccffffffffULL, }, /* 32 */
+ { 0xcccccccc00000000ULL, 0xcccccccc00000000ULL, },
+ { 0xccccccccaaaaaaaaULL, 0xccccccccaaaaaaaaULL, },
+ { 0xcccccccc55555555ULL, 0xcccccccc55555555ULL, },
+ { 0xccccccccccccccccULL, 0xccccccccccccccccULL, },
+ { 0xcccccccc33333333ULL, 0xcccccccc33333333ULL, },
+ { 0xcccccccce38e38e3ULL, 0xcccccccc38e38e38ULL, },
+ { 0xcccccccc1c71c71cULL, 0xccccccccc71c71c7ULL, },
+ { 0x33333333ffffffffULL, 0x33333333ffffffffULL, }, /* 40 */
+ { 0x3333333300000000ULL, 0x3333333300000000ULL, },
+ { 0x33333333aaaaaaaaULL, 0x33333333aaaaaaaaULL, },
+ { 0x3333333355555555ULL, 0x3333333355555555ULL, },
+ { 0x33333333ccccccccULL, 0x33333333ccccccccULL, },
+ { 0x3333333333333333ULL, 0x3333333333333333ULL, },
+ { 0x33333333e38e38e3ULL, 0x3333333338e38e38ULL, },
+ { 0x333333331c71c71cULL, 0x33333333c71c71c7ULL, },
+ { 0xe38e38e3ffffffffULL, 0x38e38e38ffffffffULL, }, /* 48 */
+ { 0xe38e38e300000000ULL, 0x38e38e3800000000ULL, },
+ { 0xe38e38e3aaaaaaaaULL, 0x38e38e38aaaaaaaaULL, },
+ { 0xe38e38e355555555ULL, 0x38e38e3855555555ULL, },
+ { 0xe38e38e3ccccccccULL, 0x38e38e38ccccccccULL, },
+ { 0xe38e38e333333333ULL, 0x38e38e3833333333ULL, },
+ { 0xe38e38e3e38e38e3ULL, 0x38e38e3838e38e38ULL, },
+ { 0xe38e38e31c71c71cULL, 0x38e38e38c71c71c7ULL, },
+ { 0x1c71c71cffffffffULL, 0xc71c71c7ffffffffULL, }, /* 56 */
+ { 0x1c71c71c00000000ULL, 0xc71c71c700000000ULL, },
+ { 0x1c71c71caaaaaaaaULL, 0xc71c71c7aaaaaaaaULL, },
+ { 0x1c71c71c55555555ULL, 0xc71c71c755555555ULL, },
+ { 0x1c71c71cccccccccULL, 0xc71c71c7ccccccccULL, },
+ { 0x1c71c71c33333333ULL, 0xc71c71c733333333ULL, },
+ { 0x1c71c71ce38e38e3ULL, 0xc71c71c738e38e38ULL, },
+ { 0x1c71c71c1c71c71cULL, 0xc71c71c7c71c71c7ULL, },
+ { 0xfe7bb00cfe7bb00cULL, 0x4b670b5e4b670b5eULL, }, /* 64 */
+ { 0xfe7bb00c153f52fcULL, 0x4b670b5e12f7bb1aULL, },
+ { 0xfe7bb00cab2b2514ULL, 0x4b670b5e27d8c6ffULL, },
+ { 0xfe7bb00ca942e2a0ULL, 0x4b670b5e8df188d8ULL, },
+ { 0x153f52fcfe7bb00cULL, 0x12f7bb1a4b670b5eULL, },
+ { 0x153f52fc153f52fcULL, 0x12f7bb1a12f7bb1aULL, },
+ { 0x153f52fcab2b2514ULL, 0x12f7bb1a27d8c6ffULL, },
+ { 0x153f52fca942e2a0ULL, 0x12f7bb1a8df188d8ULL, },
+ { 0xab2b2514fe7bb00cULL, 0x27d8c6ff4b670b5eULL, }, /* 72 */
+ { 0xab2b2514153f52fcULL, 0x27d8c6ff12f7bb1aULL, },
+ { 0xab2b2514ab2b2514ULL, 0x27d8c6ff27d8c6ffULL, },
+ { 0xab2b2514a942e2a0ULL, 0x27d8c6ff8df188d8ULL, },
+ { 0xa942e2a0fe7bb00cULL, 0x8df188d84b670b5eULL, },
+ { 0xa942e2a0153f52fcULL, 0x8df188d812f7bb1aULL, },
+ { 0xa942e2a0ab2b2514ULL, 0x8df188d827d8c6ffULL, },
+ { 0xa942e2a0a942e2a0ULL, 0x8df188d88df188d8ULL, },
+ };
+
+ gettimeofday(&start, NULL);
+
+ for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) {
+ do_msa_ILVL_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_ILVL_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/interleave/test_msa_ilvod_b.c b/tests/tcg/mips/user/ase/msa/interleave/test_msa_ilvod_b.c
new file mode 100644
index 0000000000..c55f3a4d7d
--- /dev/null
+++ b/tests/tcg/mips/user/ase/msa/interleave/test_msa_ilvod_b.c
@@ -0,0 +1,153 @@
+/*
+ * Test program for MSA instruction ILVOD.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 = "ILVOD.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 */
+ { 0xff00ff00ff00ff00ULL, 0xff00ff00ff00ff00ULL, },
+ { 0xffaaffaaffaaffaaULL, 0xffaaffaaffaaffaaULL, },
+ { 0xff55ff55ff55ff55ULL, 0xff55ff55ff55ff55ULL, },
+ { 0xffccffccffccffccULL, 0xffccffccffccffccULL, },
+ { 0xff33ff33ff33ff33ULL, 0xff33ff33ff33ff33ULL, },
+ { 0xffe3ff38ff8effe3ULL, 0xff38ff8effe3ff38ULL, },
+ { 0xff1cffc7ff71ff1cULL, 0xffc7ff71ff1cffc7ULL, },
+ { 0x00ff00ff00ff00ffULL, 0x00ff00ff00ff00ffULL, }, /* 8 */
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0x00aa00aa00aa00aaULL, 0x00aa00aa00aa00aaULL, },
+ { 0x0055005500550055ULL, 0x0055005500550055ULL, },
+ { 0x00cc00cc00cc00ccULL, 0x00cc00cc00cc00ccULL, },
+ { 0x0033003300330033ULL, 0x0033003300330033ULL, },
+ { 0x00e30038008e00e3ULL, 0x0038008e00e30038ULL, },
+ { 0x001c00c70071001cULL, 0x00c70071001c00c7ULL, },
+ { 0xaaffaaffaaffaaffULL, 0xaaffaaffaaffaaffULL, }, /* 16 */
+ { 0xaa00aa00aa00aa00ULL, 0xaa00aa00aa00aa00ULL, },
+ { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, },
+ { 0xaa55aa55aa55aa55ULL, 0xaa55aa55aa55aa55ULL, },
+ { 0xaaccaaccaaccaaccULL, 0xaaccaaccaaccaaccULL, },
+ { 0xaa33aa33aa33aa33ULL, 0xaa33aa33aa33aa33ULL, },
+ { 0xaae3aa38aa8eaae3ULL, 0xaa38aa8eaae3aa38ULL, },
+ { 0xaa1caac7aa71aa1cULL, 0xaac7aa71aa1caac7ULL, },
+ { 0x55ff55ff55ff55ffULL, 0x55ff55ff55ff55ffULL, }, /* 24 */
+ { 0x5500550055005500ULL, 0x5500550055005500ULL, },
+ { 0x55aa55aa55aa55aaULL, 0x55aa55aa55aa55aaULL, },
+ { 0x5555555555555555ULL, 0x5555555555555555ULL, },
+ { 0x55cc55cc55cc55ccULL, 0x55cc55cc55cc55ccULL, },
+ { 0x5533553355335533ULL, 0x5533553355335533ULL, },
+ { 0x55e35538558e55e3ULL, 0x5538558e55e35538ULL, },
+ { 0x551c55c75571551cULL, 0x55c75571551c55c7ULL, },
+ { 0xccffccffccffccffULL, 0xccffccffccffccffULL, }, /* 32 */
+ { 0xcc00cc00cc00cc00ULL, 0xcc00cc00cc00cc00ULL, },
+ { 0xccaaccaaccaaccaaULL, 0xccaaccaaccaaccaaULL, },
+ { 0xcc55cc55cc55cc55ULL, 0xcc55cc55cc55cc55ULL, },
+ { 0xccccccccccccccccULL, 0xccccccccccccccccULL, },
+ { 0xcc33cc33cc33cc33ULL, 0xcc33cc33cc33cc33ULL, },
+ { 0xcce3cc38cc8ecce3ULL, 0xcc38cc8ecce3cc38ULL, },
+ { 0xcc1cccc7cc71cc1cULL, 0xccc7cc71cc1cccc7ULL, },
+ { 0x33ff33ff33ff33ffULL, 0x33ff33ff33ff33ffULL, }, /* 40 */
+ { 0x3300330033003300ULL, 0x3300330033003300ULL, },
+ { 0x33aa33aa33aa33aaULL, 0x33aa33aa33aa33aaULL, },
+ { 0x3355335533553355ULL, 0x3355335533553355ULL, },
+ { 0x33cc33cc33cc33ccULL, 0x33cc33cc33cc33ccULL, },
+ { 0x3333333333333333ULL, 0x3333333333333333ULL, },
+ { 0x33e33338338e33e3ULL, 0x3338338e33e33338ULL, },
+ { 0x331c33c73371331cULL, 0x33c73371331c33c7ULL, },
+ { 0xe3ff38ff8effe3ffULL, 0x38ff8effe3ff38ffULL, }, /* 48 */
+ { 0xe30038008e00e300ULL, 0x38008e00e3003800ULL, },
+ { 0xe3aa38aa8eaae3aaULL, 0x38aa8eaae3aa38aaULL, },
+ { 0xe35538558e55e355ULL, 0x38558e55e3553855ULL, },
+ { 0xe3cc38cc8ecce3ccULL, 0x38cc8ecce3cc38ccULL, },
+ { 0xe33338338e33e333ULL, 0x38338e33e3333833ULL, },
+ { 0xe3e338388e8ee3e3ULL, 0x38388e8ee3e33838ULL, },
+ { 0xe31c38c78e71e31cULL, 0x38c78e71e31c38c7ULL, },
+ { 0x1cffc7ff71ff1cffULL, 0xc7ff71ff1cffc7ffULL, }, /* 56 */
+ { 0x1c00c70071001c00ULL, 0xc70071001c00c700ULL, },
+ { 0x1caac7aa71aa1caaULL, 0xc7aa71aa1caac7aaULL, },
+ { 0x1c55c75571551c55ULL, 0xc75571551c55c755ULL, },
+ { 0x1cccc7cc71cc1cccULL, 0xc7cc71cc1cccc7ccULL, },
+ { 0x1c33c73371331c33ULL, 0xc73371331c33c733ULL, },
+ { 0x1ce3c738718e1ce3ULL, 0xc738718e1ce3c738ULL, },
+ { 0x1c1cc7c771711c1cULL, 0xc7c771711c1cc7c7ULL, },
+ { 0x8888e6e628285555ULL, 0x4b4b0b0bfefeb0b0ULL, }, /* 64 */
+ { 0x88fbe600284d55c7ULL, 0x4b120bbbfe15b052ULL, },
+ { 0x88ace6ae28b9558bULL, 0x4b270bc6feabb025ULL, },
+ { 0x8870e616285e55e2ULL, 0x4b8d0b88fea9b0e2ULL, },
+ { 0xfb8800e64d28c755ULL, 0x124bbb0b15fe52b0ULL, },
+ { 0xfbfb00004d4dc7c7ULL, 0x1212bbbb15155252ULL, },
+ { 0xfbac00ae4db9c78bULL, 0x1227bbc615ab5225ULL, },
+ { 0xfb7000164d5ec7e2ULL, 0x128dbb8815a952e2ULL, },
+ { 0xac88aee6b9288b55ULL, 0x274bc60babfe25b0ULL, }, /* 72 */
+ { 0xacfbae00b94d8bc7ULL, 0x2712c6bbab152552ULL, },
+ { 0xacacaeaeb9b98b8bULL, 0x2727c6c6abab2525ULL, },
+ { 0xac70ae16b95e8be2ULL, 0x278dc688aba925e2ULL, },
+ { 0x708816e65e28e255ULL, 0x8d4b880ba9fee2b0ULL, },
+ { 0x70fb16005e4de2c7ULL, 0x8d1288bba915e252ULL, },
+ { 0x70ac16ae5eb9e28bULL, 0x8d2788c6a9abe225ULL, },
+ { 0x707016165e5ee2e2ULL, 0x8d8d8888a9a9e2e2ULL, },
+ };
+
+ gettimeofday(&start, NULL);
+
+ for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) {
+ do_msa_ILVOD_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_ILVOD_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/interleave/test_msa_ilvod_d.c b/tests/tcg/mips/user/ase/msa/interleave/test_msa_ilvod_d.c
new file mode 100644
index 0000000000..d03e7b4eca
--- /dev/null
+++ b/tests/tcg/mips/user/ase/msa/interleave/test_msa_ilvod_d.c
@@ -0,0 +1,153 @@
+/*
+ * Test program for MSA instruction ILVOD.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 = "ILVOD.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 */
+ { 0x0000000000000000ULL, 0xffffffffffffffffULL, },
+ { 0xaaaaaaaaaaaaaaaaULL, 0xffffffffffffffffULL, },
+ { 0x5555555555555555ULL, 0xffffffffffffffffULL, },
+ { 0xccccccccccccccccULL, 0xffffffffffffffffULL, },
+ { 0x3333333333333333ULL, 0xffffffffffffffffULL, },
+ { 0x38e38e38e38e38e3ULL, 0xffffffffffffffffULL, },
+ { 0xc71c71c71c71c71cULL, 0xffffffffffffffffULL, },
+ { 0xffffffffffffffffULL, 0x0000000000000000ULL, }, /* 8 */
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0xaaaaaaaaaaaaaaaaULL, 0x0000000000000000ULL, },
+ { 0x5555555555555555ULL, 0x0000000000000000ULL, },
+ { 0xccccccccccccccccULL, 0x0000000000000000ULL, },
+ { 0x3333333333333333ULL, 0x0000000000000000ULL, },
+ { 0x38e38e38e38e38e3ULL, 0x0000000000000000ULL, },
+ { 0xc71c71c71c71c71cULL, 0x0000000000000000ULL, },
+ { 0xffffffffffffffffULL, 0xaaaaaaaaaaaaaaaaULL, }, /* 16 */
+ { 0x0000000000000000ULL, 0xaaaaaaaaaaaaaaaaULL, },
+ { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, },
+ { 0x5555555555555555ULL, 0xaaaaaaaaaaaaaaaaULL, },
+ { 0xccccccccccccccccULL, 0xaaaaaaaaaaaaaaaaULL, },
+ { 0x3333333333333333ULL, 0xaaaaaaaaaaaaaaaaULL, },
+ { 0x38e38e38e38e38e3ULL, 0xaaaaaaaaaaaaaaaaULL, },
+ { 0xc71c71c71c71c71cULL, 0xaaaaaaaaaaaaaaaaULL, },
+ { 0xffffffffffffffffULL, 0x5555555555555555ULL, }, /* 24 */
+ { 0x0000000000000000ULL, 0x5555555555555555ULL, },
+ { 0xaaaaaaaaaaaaaaaaULL, 0x5555555555555555ULL, },
+ { 0x5555555555555555ULL, 0x5555555555555555ULL, },
+ { 0xccccccccccccccccULL, 0x5555555555555555ULL, },
+ { 0x3333333333333333ULL, 0x5555555555555555ULL, },
+ { 0x38e38e38e38e38e3ULL, 0x5555555555555555ULL, },
+ { 0xc71c71c71c71c71cULL, 0x5555555555555555ULL, },
+ { 0xffffffffffffffffULL, 0xccccccccccccccccULL, }, /* 32 */
+ { 0x0000000000000000ULL, 0xccccccccccccccccULL, },
+ { 0xaaaaaaaaaaaaaaaaULL, 0xccccccccccccccccULL, },
+ { 0x5555555555555555ULL, 0xccccccccccccccccULL, },
+ { 0xccccccccccccccccULL, 0xccccccccccccccccULL, },
+ { 0x3333333333333333ULL, 0xccccccccccccccccULL, },
+ { 0x38e38e38e38e38e3ULL, 0xccccccccccccccccULL, },
+ { 0xc71c71c71c71c71cULL, 0xccccccccccccccccULL, },
+ { 0xffffffffffffffffULL, 0x3333333333333333ULL, }, /* 40 */
+ { 0x0000000000000000ULL, 0x3333333333333333ULL, },
+ { 0xaaaaaaaaaaaaaaaaULL, 0x3333333333333333ULL, },
+ { 0x5555555555555555ULL, 0x3333333333333333ULL, },
+ { 0xccccccccccccccccULL, 0x3333333333333333ULL, },
+ { 0x3333333333333333ULL, 0x3333333333333333ULL, },
+ { 0x38e38e38e38e38e3ULL, 0x3333333333333333ULL, },
+ { 0xc71c71c71c71c71cULL, 0x3333333333333333ULL, },
+ { 0xffffffffffffffffULL, 0x38e38e38e38e38e3ULL, }, /* 48 */
+ { 0x0000000000000000ULL, 0x38e38e38e38e38e3ULL, },
+ { 0xaaaaaaaaaaaaaaaaULL, 0x38e38e38e38e38e3ULL, },
+ { 0x5555555555555555ULL, 0x38e38e38e38e38e3ULL, },
+ { 0xccccccccccccccccULL, 0x38e38e38e38e38e3ULL, },
+ { 0x3333333333333333ULL, 0x38e38e38e38e38e3ULL, },
+ { 0x38e38e38e38e38e3ULL, 0x38e38e38e38e38e3ULL, },
+ { 0xc71c71c71c71c71cULL, 0x38e38e38e38e38e3ULL, },
+ { 0xffffffffffffffffULL, 0xc71c71c71c71c71cULL, }, /* 56 */
+ { 0x0000000000000000ULL, 0xc71c71c71c71c71cULL, },
+ { 0xaaaaaaaaaaaaaaaaULL, 0xc71c71c71c71c71cULL, },
+ { 0x5555555555555555ULL, 0xc71c71c71c71c71cULL, },
+ { 0xccccccccccccccccULL, 0xc71c71c71c71c71cULL, },
+ { 0x3333333333333333ULL, 0xc71c71c71c71c71cULL, },
+ { 0x38e38e38e38e38e3ULL, 0xc71c71c71c71c71cULL, },
+ { 0xc71c71c71c71c71cULL, 0xc71c71c71c71c71cULL, },
+ { 0x4b670b5efe7bb00cULL, 0x4b670b5efe7bb00cULL, }, /* 64 */
+ { 0x12f7bb1a153f52fcULL, 0x4b670b5efe7bb00cULL, },
+ { 0x27d8c6ffab2b2514ULL, 0x4b670b5efe7bb00cULL, },
+ { 0x8df188d8a942e2a0ULL, 0x4b670b5efe7bb00cULL, },
+ { 0x4b670b5efe7bb00cULL, 0x12f7bb1a153f52fcULL, },
+ { 0x12f7bb1a153f52fcULL, 0x12f7bb1a153f52fcULL, },
+ { 0x27d8c6ffab2b2514ULL, 0x12f7bb1a153f52fcULL, },
+ { 0x8df188d8a942e2a0ULL, 0x12f7bb1a153f52fcULL, },
+ { 0x4b670b5efe7bb00cULL, 0x27d8c6ffab2b2514ULL, }, /* 72 */
+ { 0x12f7bb1a153f52fcULL, 0x27d8c6ffab2b2514ULL, },
+ { 0x27d8c6ffab2b2514ULL, 0x27d8c6ffab2b2514ULL, },
+ { 0x8df188d8a942e2a0ULL, 0x27d8c6ffab2b2514ULL, },
+ { 0x4b670b5efe7bb00cULL, 0x8df188d8a942e2a0ULL, },
+ { 0x12f7bb1a153f52fcULL, 0x8df188d8a942e2a0ULL, },
+ { 0x27d8c6ffab2b2514ULL, 0x8df188d8a942e2a0ULL, },
+ { 0x8df188d8a942e2a0ULL, 0x8df188d8a942e2a0ULL, },
+ };
+
+ gettimeofday(&start, NULL);
+
+ for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) {
+ do_msa_ILVOD_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_ILVOD_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/interleave/test_msa_ilvod_h.c b/tests/tcg/mips/user/ase/msa/interleave/test_msa_ilvod_h.c
new file mode 100644
index 0000000000..f64d8b5fc9
--- /dev/null
+++ b/tests/tcg/mips/user/ase/msa/interleave/test_msa_ilvod_h.c
@@ -0,0 +1,153 @@
+/*
+ * Test program for MSA instruction ILVOD.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 = "ILVOD.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 */
+ { 0xffff0000ffff0000ULL, 0xffff0000ffff0000ULL, },
+ { 0xffffaaaaffffaaaaULL, 0xffffaaaaffffaaaaULL, },
+ { 0xffff5555ffff5555ULL, 0xffff5555ffff5555ULL, },
+ { 0xffffccccffffccccULL, 0xffffccccffffccccULL, },
+ { 0xffff3333ffff3333ULL, 0xffff3333ffff3333ULL, },
+ { 0xffffe38effff8e38ULL, 0xffff38e3ffffe38eULL, },
+ { 0xffff1c71ffff71c7ULL, 0xffffc71cffff1c71ULL, },
+ { 0x0000ffff0000ffffULL, 0x0000ffff0000ffffULL, }, /* 8 */
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0x0000aaaa0000aaaaULL, 0x0000aaaa0000aaaaULL, },
+ { 0x0000555500005555ULL, 0x0000555500005555ULL, },
+ { 0x0000cccc0000ccccULL, 0x0000cccc0000ccccULL, },
+ { 0x0000333300003333ULL, 0x0000333300003333ULL, },
+ { 0x0000e38e00008e38ULL, 0x000038e30000e38eULL, },
+ { 0x00001c71000071c7ULL, 0x0000c71c00001c71ULL, },
+ { 0xaaaaffffaaaaffffULL, 0xaaaaffffaaaaffffULL, }, /* 16 */
+ { 0xaaaa0000aaaa0000ULL, 0xaaaa0000aaaa0000ULL, },
+ { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, },
+ { 0xaaaa5555aaaa5555ULL, 0xaaaa5555aaaa5555ULL, },
+ { 0xaaaaccccaaaaccccULL, 0xaaaaccccaaaaccccULL, },
+ { 0xaaaa3333aaaa3333ULL, 0xaaaa3333aaaa3333ULL, },
+ { 0xaaaae38eaaaa8e38ULL, 0xaaaa38e3aaaae38eULL, },
+ { 0xaaaa1c71aaaa71c7ULL, 0xaaaac71caaaa1c71ULL, },
+ { 0x5555ffff5555ffffULL, 0x5555ffff5555ffffULL, }, /* 24 */
+ { 0x5555000055550000ULL, 0x5555000055550000ULL, },
+ { 0x5555aaaa5555aaaaULL, 0x5555aaaa5555aaaaULL, },
+ { 0x5555555555555555ULL, 0x5555555555555555ULL, },
+ { 0x5555cccc5555ccccULL, 0x5555cccc5555ccccULL, },
+ { 0x5555333355553333ULL, 0x5555333355553333ULL, },
+ { 0x5555e38e55558e38ULL, 0x555538e35555e38eULL, },
+ { 0x55551c71555571c7ULL, 0x5555c71c55551c71ULL, },
+ { 0xccccffffccccffffULL, 0xccccffffccccffffULL, }, /* 32 */
+ { 0xcccc0000cccc0000ULL, 0xcccc0000cccc0000ULL, },
+ { 0xccccaaaaccccaaaaULL, 0xccccaaaaccccaaaaULL, },
+ { 0xcccc5555cccc5555ULL, 0xcccc5555cccc5555ULL, },
+ { 0xccccccccccccccccULL, 0xccccccccccccccccULL, },
+ { 0xcccc3333cccc3333ULL, 0xcccc3333cccc3333ULL, },
+ { 0xcccce38ecccc8e38ULL, 0xcccc38e3cccce38eULL, },
+ { 0xcccc1c71cccc71c7ULL, 0xccccc71ccccc1c71ULL, },
+ { 0x3333ffff3333ffffULL, 0x3333ffff3333ffffULL, }, /* 40 */
+ { 0x3333000033330000ULL, 0x3333000033330000ULL, },
+ { 0x3333aaaa3333aaaaULL, 0x3333aaaa3333aaaaULL, },
+ { 0x3333555533335555ULL, 0x3333555533335555ULL, },
+ { 0x3333cccc3333ccccULL, 0x3333cccc3333ccccULL, },
+ { 0x3333333333333333ULL, 0x3333333333333333ULL, },
+ { 0x3333e38e33338e38ULL, 0x333338e33333e38eULL, },
+ { 0x33331c71333371c7ULL, 0x3333c71c33331c71ULL, },
+ { 0xe38effff8e38ffffULL, 0x38e3ffffe38effffULL, }, /* 48 */
+ { 0xe38e00008e380000ULL, 0x38e30000e38e0000ULL, },
+ { 0xe38eaaaa8e38aaaaULL, 0x38e3aaaae38eaaaaULL, },
+ { 0xe38e55558e385555ULL, 0x38e35555e38e5555ULL, },
+ { 0xe38ecccc8e38ccccULL, 0x38e3cccce38eccccULL, },
+ { 0xe38e33338e383333ULL, 0x38e33333e38e3333ULL, },
+ { 0xe38ee38e8e388e38ULL, 0x38e338e3e38ee38eULL, },
+ { 0xe38e1c718e3871c7ULL, 0x38e3c71ce38e1c71ULL, },
+ { 0x1c71ffff71c7ffffULL, 0xc71cffff1c71ffffULL, }, /* 56 */
+ { 0x1c71000071c70000ULL, 0xc71c00001c710000ULL, },
+ { 0x1c71aaaa71c7aaaaULL, 0xc71caaaa1c71aaaaULL, },
+ { 0x1c71555571c75555ULL, 0xc71c55551c715555ULL, },
+ { 0x1c71cccc71c7ccccULL, 0xc71ccccc1c71ccccULL, },
+ { 0x1c71333371c73333ULL, 0xc71c33331c713333ULL, },
+ { 0x1c71e38e71c78e38ULL, 0xc71c38e31c71e38eULL, },
+ { 0x1c711c7171c771c7ULL, 0xc71cc71c1c711c71ULL, },
+ { 0x886a886a28622862ULL, 0x4b674b67fe7bfe7bULL, }, /* 64 */
+ { 0x886afbbe28624d93ULL, 0x4b6712f7fe7b153fULL, },
+ { 0x886aac5a2862b9cfULL, 0x4b6727d8fe7bab2bULL, },
+ { 0x886a704f28625e31ULL, 0x4b678df1fe7ba942ULL, },
+ { 0xfbbe886a4d932862ULL, 0x12f74b67153ffe7bULL, },
+ { 0xfbbefbbe4d934d93ULL, 0x12f712f7153f153fULL, },
+ { 0xfbbeac5a4d93b9cfULL, 0x12f727d8153fab2bULL, },
+ { 0xfbbe704f4d935e31ULL, 0x12f78df1153fa942ULL, },
+ { 0xac5a886ab9cf2862ULL, 0x27d84b67ab2bfe7bULL, }, /* 72 */
+ { 0xac5afbbeb9cf4d93ULL, 0x27d812f7ab2b153fULL, },
+ { 0xac5aac5ab9cfb9cfULL, 0x27d827d8ab2bab2bULL, },
+ { 0xac5a704fb9cf5e31ULL, 0x27d88df1ab2ba942ULL, },
+ { 0x704f886a5e312862ULL, 0x8df14b67a942fe7bULL, },
+ { 0x704ffbbe5e314d93ULL, 0x8df112f7a942153fULL, },
+ { 0x704fac5a5e31b9cfULL, 0x8df127d8a942ab2bULL, },
+ { 0x704f704f5e315e31ULL, 0x8df18df1a942a942ULL, },
+ };
+
+ gettimeofday(&start, NULL);
+
+ for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) {
+ do_msa_ILVOD_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_ILVOD_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/interleave/test_msa_ilvod_w.c b/tests/tcg/mips/user/ase/msa/interleave/test_msa_ilvod_w.c
new file mode 100644
index 0000000000..4ae75f85f8
--- /dev/null
+++ b/tests/tcg/mips/user/ase/msa/interleave/test_msa_ilvod_w.c
@@ -0,0 +1,153 @@
+/*
+ * Test program for MSA instruction ILVOD.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 = "ILVOD.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 */
+ { 0xffffffff00000000ULL, 0xffffffff00000000ULL, },
+ { 0xffffffffaaaaaaaaULL, 0xffffffffaaaaaaaaULL, },
+ { 0xffffffff55555555ULL, 0xffffffff55555555ULL, },
+ { 0xffffffffccccccccULL, 0xffffffffccccccccULL, },
+ { 0xffffffff33333333ULL, 0xffffffff33333333ULL, },
+ { 0xffffffffe38e38e3ULL, 0xffffffff38e38e38ULL, },
+ { 0xffffffff1c71c71cULL, 0xffffffffc71c71c7ULL, },
+ { 0x00000000ffffffffULL, 0x00000000ffffffffULL, }, /* 8 */
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0x00000000aaaaaaaaULL, 0x00000000aaaaaaaaULL, },
+ { 0x0000000055555555ULL, 0x0000000055555555ULL, },
+ { 0x00000000ccccccccULL, 0x00000000ccccccccULL, },
+ { 0x0000000033333333ULL, 0x0000000033333333ULL, },
+ { 0x00000000e38e38e3ULL, 0x0000000038e38e38ULL, },
+ { 0x000000001c71c71cULL, 0x00000000c71c71c7ULL, },
+ { 0xaaaaaaaaffffffffULL, 0xaaaaaaaaffffffffULL, }, /* 16 */
+ { 0xaaaaaaaa00000000ULL, 0xaaaaaaaa00000000ULL, },
+ { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, },
+ { 0xaaaaaaaa55555555ULL, 0xaaaaaaaa55555555ULL, },
+ { 0xaaaaaaaaccccccccULL, 0xaaaaaaaaccccccccULL, },
+ { 0xaaaaaaaa33333333ULL, 0xaaaaaaaa33333333ULL, },
+ { 0xaaaaaaaae38e38e3ULL, 0xaaaaaaaa38e38e38ULL, },
+ { 0xaaaaaaaa1c71c71cULL, 0xaaaaaaaac71c71c7ULL, },
+ { 0x55555555ffffffffULL, 0x55555555ffffffffULL, }, /* 24 */
+ { 0x5555555500000000ULL, 0x5555555500000000ULL, },
+ { 0x55555555aaaaaaaaULL, 0x55555555aaaaaaaaULL, },
+ { 0x5555555555555555ULL, 0x5555555555555555ULL, },
+ { 0x55555555ccccccccULL, 0x55555555ccccccccULL, },
+ { 0x5555555533333333ULL, 0x5555555533333333ULL, },
+ { 0x55555555e38e38e3ULL, 0x5555555538e38e38ULL, },
+ { 0x555555551c71c71cULL, 0x55555555c71c71c7ULL, },
+ { 0xccccccccffffffffULL, 0xccccccccffffffffULL, }, /* 32 */
+ { 0xcccccccc00000000ULL, 0xcccccccc00000000ULL, },
+ { 0xccccccccaaaaaaaaULL, 0xccccccccaaaaaaaaULL, },
+ { 0xcccccccc55555555ULL, 0xcccccccc55555555ULL, },
+ { 0xccccccccccccccccULL, 0xccccccccccccccccULL, },
+ { 0xcccccccc33333333ULL, 0xcccccccc33333333ULL, },
+ { 0xcccccccce38e38e3ULL, 0xcccccccc38e38e38ULL, },
+ { 0xcccccccc1c71c71cULL, 0xccccccccc71c71c7ULL, },
+ { 0x33333333ffffffffULL, 0x33333333ffffffffULL, }, /* 40 */
+ { 0x3333333300000000ULL, 0x3333333300000000ULL, },
+ { 0x33333333aaaaaaaaULL, 0x33333333aaaaaaaaULL, },
+ { 0x3333333355555555ULL, 0x3333333355555555ULL, },
+ { 0x33333333ccccccccULL, 0x33333333ccccccccULL, },
+ { 0x3333333333333333ULL, 0x3333333333333333ULL, },
+ { 0x33333333e38e38e3ULL, 0x3333333338e38e38ULL, },
+ { 0x333333331c71c71cULL, 0x33333333c71c71c7ULL, },
+ { 0xe38e38e3ffffffffULL, 0x38e38e38ffffffffULL, }, /* 48 */
+ { 0xe38e38e300000000ULL, 0x38e38e3800000000ULL, },
+ { 0xe38e38e3aaaaaaaaULL, 0x38e38e38aaaaaaaaULL, },
+ { 0xe38e38e355555555ULL, 0x38e38e3855555555ULL, },
+ { 0xe38e38e3ccccccccULL, 0x38e38e38ccccccccULL, },
+ { 0xe38e38e333333333ULL, 0x38e38e3833333333ULL, },
+ { 0xe38e38e3e38e38e3ULL, 0x38e38e3838e38e38ULL, },
+ { 0xe38e38e31c71c71cULL, 0x38e38e38c71c71c7ULL, },
+ { 0x1c71c71cffffffffULL, 0xc71c71c7ffffffffULL, }, /* 56 */
+ { 0x1c71c71c00000000ULL, 0xc71c71c700000000ULL, },
+ { 0x1c71c71caaaaaaaaULL, 0xc71c71c7aaaaaaaaULL, },
+ { 0x1c71c71c55555555ULL, 0xc71c71c755555555ULL, },
+ { 0x1c71c71cccccccccULL, 0xc71c71c7ccccccccULL, },
+ { 0x1c71c71c33333333ULL, 0xc71c71c733333333ULL, },
+ { 0x1c71c71ce38e38e3ULL, 0xc71c71c738e38e38ULL, },
+ { 0x1c71c71c1c71c71cULL, 0xc71c71c7c71c71c7ULL, },
+ { 0x886ae6cc886ae6ccULL, 0x4b670b5e4b670b5eULL, }, /* 64 */
+ { 0x886ae6ccfbbe0063ULL, 0x4b670b5e12f7bb1aULL, },
+ { 0x886ae6ccac5aaeaaULL, 0x4b670b5e27d8c6ffULL, },
+ { 0x886ae6cc704f164dULL, 0x4b670b5e8df188d8ULL, },
+ { 0xfbbe0063886ae6ccULL, 0x12f7bb1a4b670b5eULL, },
+ { 0xfbbe0063fbbe0063ULL, 0x12f7bb1a12f7bb1aULL, },
+ { 0xfbbe0063ac5aaeaaULL, 0x12f7bb1a27d8c6ffULL, },
+ { 0xfbbe0063704f164dULL, 0x12f7bb1a8df188d8ULL, },
+ { 0xac5aaeaa886ae6ccULL, 0x27d8c6ff4b670b5eULL, }, /* 72 */
+ { 0xac5aaeaafbbe0063ULL, 0x27d8c6ff12f7bb1aULL, },
+ { 0xac5aaeaaac5aaeaaULL, 0x27d8c6ff27d8c6ffULL, },
+ { 0xac5aaeaa704f164dULL, 0x27d8c6ff8df188d8ULL, },
+ { 0x704f164d886ae6ccULL, 0x8df188d84b670b5eULL, },
+ { 0x704f164dfbbe0063ULL, 0x8df188d812f7bb1aULL, },
+ { 0x704f164dac5aaeaaULL, 0x8df188d827d8c6ffULL, },
+ { 0x704f164d704f164dULL, 0x8df188d88df188d8ULL, },
+ };
+
+ gettimeofday(&start, NULL);
+
+ for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) {
+ do_msa_ILVOD_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_ILVOD_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/interleave/test_msa_ilvr_b.c b/tests/tcg/mips/user/ase/msa/interleave/test_msa_ilvr_b.c
new file mode 100644
index 0000000000..f2cc7bf414
--- /dev/null
+++ b/tests/tcg/mips/user/ase/msa/interleave/test_msa_ilvr_b.c
@@ -0,0 +1,153 @@
+/*
+ * Test program for MSA instruction ILVR.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 = "ILVR.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 */
+ { 0xff00ff00ff00ff00ULL, 0xff00ff00ff00ff00ULL, },
+ { 0xffaaffaaffaaffaaULL, 0xffaaffaaffaaffaaULL, },
+ { 0xff55ff55ff55ff55ULL, 0xff55ff55ff55ff55ULL, },
+ { 0xffccffccffccffccULL, 0xffccffccffccffccULL, },
+ { 0xff33ff33ff33ff33ULL, 0xff33ff33ff33ff33ULL, },
+ { 0xff8eff38ffe3ff8eULL, 0xffe3ff8eff38ffe3ULL, },
+ { 0xff71ffc7ff1cff71ULL, 0xff1cff71ffc7ff1cULL, },
+ { 0x00ff00ff00ff00ffULL, 0x00ff00ff00ff00ffULL, }, /* 8 */
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0x00aa00aa00aa00aaULL, 0x00aa00aa00aa00aaULL, },
+ { 0x0055005500550055ULL, 0x0055005500550055ULL, },
+ { 0x00cc00cc00cc00ccULL, 0x00cc00cc00cc00ccULL, },
+ { 0x0033003300330033ULL, 0x0033003300330033ULL, },
+ { 0x008e003800e3008eULL, 0x00e3008e003800e3ULL, },
+ { 0x007100c7001c0071ULL, 0x001c007100c7001cULL, },
+ { 0xaaffaaffaaffaaffULL, 0xaaffaaffaaffaaffULL, }, /* 16 */
+ { 0xaa00aa00aa00aa00ULL, 0xaa00aa00aa00aa00ULL, },
+ { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, },
+ { 0xaa55aa55aa55aa55ULL, 0xaa55aa55aa55aa55ULL, },
+ { 0xaaccaaccaaccaaccULL, 0xaaccaaccaaccaaccULL, },
+ { 0xaa33aa33aa33aa33ULL, 0xaa33aa33aa33aa33ULL, },
+ { 0xaa8eaa38aae3aa8eULL, 0xaae3aa8eaa38aae3ULL, },
+ { 0xaa71aac7aa1caa71ULL, 0xaa1caa71aac7aa1cULL, },
+ { 0x55ff55ff55ff55ffULL, 0x55ff55ff55ff55ffULL, }, /* 24 */
+ { 0x5500550055005500ULL, 0x5500550055005500ULL, },
+ { 0x55aa55aa55aa55aaULL, 0x55aa55aa55aa55aaULL, },
+ { 0x5555555555555555ULL, 0x5555555555555555ULL, },
+ { 0x55cc55cc55cc55ccULL, 0x55cc55cc55cc55ccULL, },
+ { 0x5533553355335533ULL, 0x5533553355335533ULL, },
+ { 0x558e553855e3558eULL, 0x55e3558e553855e3ULL, },
+ { 0x557155c7551c5571ULL, 0x551c557155c7551cULL, },
+ { 0xccffccffccffccffULL, 0xccffccffccffccffULL, }, /* 32 */
+ { 0xcc00cc00cc00cc00ULL, 0xcc00cc00cc00cc00ULL, },
+ { 0xccaaccaaccaaccaaULL, 0xccaaccaaccaaccaaULL, },
+ { 0xcc55cc55cc55cc55ULL, 0xcc55cc55cc55cc55ULL, },
+ { 0xccccccccccccccccULL, 0xccccccccccccccccULL, },
+ { 0xcc33cc33cc33cc33ULL, 0xcc33cc33cc33cc33ULL, },
+ { 0xcc8ecc38cce3cc8eULL, 0xcce3cc8ecc38cce3ULL, },
+ { 0xcc71ccc7cc1ccc71ULL, 0xcc1ccc71ccc7cc1cULL, },
+ { 0x33ff33ff33ff33ffULL, 0x33ff33ff33ff33ffULL, }, /* 40 */
+ { 0x3300330033003300ULL, 0x3300330033003300ULL, },
+ { 0x33aa33aa33aa33aaULL, 0x33aa33aa33aa33aaULL, },
+ { 0x3355335533553355ULL, 0x3355335533553355ULL, },
+ { 0x33cc33cc33cc33ccULL, 0x33cc33cc33cc33ccULL, },
+ { 0x3333333333333333ULL, 0x3333333333333333ULL, },
+ { 0x338e333833e3338eULL, 0x33e3338e333833e3ULL, },
+ { 0x337133c7331c3371ULL, 0x331c337133c7331cULL, },
+ { 0x8eff38ffe3ff8effULL, 0xe3ff8eff38ffe3ffULL, }, /* 48 */
+ { 0x8e003800e3008e00ULL, 0xe3008e003800e300ULL, },
+ { 0x8eaa38aae3aa8eaaULL, 0xe3aa8eaa38aae3aaULL, },
+ { 0x8e553855e3558e55ULL, 0xe3558e553855e355ULL, },
+ { 0x8ecc38cce3cc8eccULL, 0xe3cc8ecc38cce3ccULL, },
+ { 0x8e333833e3338e33ULL, 0xe3338e333833e333ULL, },
+ { 0x8e8e3838e3e38e8eULL, 0xe3e38e8e3838e3e3ULL, },
+ { 0x8e7138c7e31c8e71ULL, 0xe31c8e7138c7e31cULL, },
+ { 0x71ffc7ff1cff71ffULL, 0x1cff71ffc7ff1cffULL, }, /* 56 */
+ { 0x7100c7001c007100ULL, 0x1c007100c7001c00ULL, },
+ { 0x71aac7aa1caa71aaULL, 0x1caa71aac7aa1caaULL, },
+ { 0x7155c7551c557155ULL, 0x1c557155c7551c55ULL, },
+ { 0x71ccc7cc1ccc71ccULL, 0x1ccc71ccc7cc1cccULL, },
+ { 0x7133c7331c337133ULL, 0x1c337133c7331c33ULL, },
+ { 0x718ec7381ce3718eULL, 0x1ce3718ec7381ce3ULL, },
+ { 0x7171c7c71c1c7171ULL, 0x1c1c7171c7c71c1cULL, },
+ { 0x2828626255554040ULL, 0x88886a6ae6e6ccccULL, }, /* 64 */
+ { 0x284d629355c74008ULL, 0x88fb6abee600cc63ULL, },
+ { 0x28b962cf558b4080ULL, 0x88ac6a5ae6aeccaaULL, },
+ { 0x285e623155e2404eULL, 0x88706a4fe616cc4dULL, },
+ { 0x4d289362c7550840ULL, 0xfb88be6a00e663ccULL, },
+ { 0x4d4d9393c7c70808ULL, 0xfbfbbebe00006363ULL, },
+ { 0x4db993cfc78b0880ULL, 0xfbacbe5a00ae63aaULL, },
+ { 0x4d5e9331c7e2084eULL, 0xfb70be4f0016634dULL, },
+ { 0xb928cf628b558040ULL, 0xac885a6aaee6aaccULL, }, /* 72 */
+ { 0xb94dcf938bc78008ULL, 0xacfb5abeae00aa63ULL, },
+ { 0xb9b9cfcf8b8b8080ULL, 0xacac5a5aaeaeaaaaULL, },
+ { 0xb95ecf318be2804eULL, 0xac705a4fae16aa4dULL, },
+ { 0x5e283162e2554e40ULL, 0x70884f6a16e64dccULL, },
+ { 0x5e4d3193e2c74e08ULL, 0x70fb4fbe16004d63ULL, },
+ { 0x5eb931cfe28b4e80ULL, 0x70ac4f5a16ae4daaULL, },
+ { 0x5e5e3131e2e24e4eULL, 0x70704f4f16164d4dULL, },
+ };
+
+ gettimeofday(&start, NULL);
+
+ for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) {
+ do_msa_ILVR_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_ILVR_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/interleave/test_msa_ilvr_d.c b/tests/tcg/mips/user/ase/msa/interleave/test_msa_ilvr_d.c
new file mode 100644
index 0000000000..f5ff947c0b
--- /dev/null
+++ b/tests/tcg/mips/user/ase/msa/interleave/test_msa_ilvr_d.c
@@ -0,0 +1,153 @@
+/*
+ * Test program for MSA instruction ILVR.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 = "ILVR.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 */
+ { 0x0000000000000000ULL, 0xffffffffffffffffULL, },
+ { 0xaaaaaaaaaaaaaaaaULL, 0xffffffffffffffffULL, },
+ { 0x5555555555555555ULL, 0xffffffffffffffffULL, },
+ { 0xccccccccccccccccULL, 0xffffffffffffffffULL, },
+ { 0x3333333333333333ULL, 0xffffffffffffffffULL, },
+ { 0xe38e38e38e38e38eULL, 0xffffffffffffffffULL, },
+ { 0x1c71c71c71c71c71ULL, 0xffffffffffffffffULL, },
+ { 0xffffffffffffffffULL, 0x0000000000000000ULL, }, /* 8 */
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0xaaaaaaaaaaaaaaaaULL, 0x0000000000000000ULL, },
+ { 0x5555555555555555ULL, 0x0000000000000000ULL, },
+ { 0xccccccccccccccccULL, 0x0000000000000000ULL, },
+ { 0x3333333333333333ULL, 0x0000000000000000ULL, },
+ { 0xe38e38e38e38e38eULL, 0x0000000000000000ULL, },
+ { 0x1c71c71c71c71c71ULL, 0x0000000000000000ULL, },
+ { 0xffffffffffffffffULL, 0xaaaaaaaaaaaaaaaaULL, }, /* 16 */
+ { 0x0000000000000000ULL, 0xaaaaaaaaaaaaaaaaULL, },
+ { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, },
+ { 0x5555555555555555ULL, 0xaaaaaaaaaaaaaaaaULL, },
+ { 0xccccccccccccccccULL, 0xaaaaaaaaaaaaaaaaULL, },
+ { 0x3333333333333333ULL, 0xaaaaaaaaaaaaaaaaULL, },
+ { 0xe38e38e38e38e38eULL, 0xaaaaaaaaaaaaaaaaULL, },
+ { 0x1c71c71c71c71c71ULL, 0xaaaaaaaaaaaaaaaaULL, },
+ { 0xffffffffffffffffULL, 0x5555555555555555ULL, }, /* 24 */
+ { 0x0000000000000000ULL, 0x5555555555555555ULL, },
+ { 0xaaaaaaaaaaaaaaaaULL, 0x5555555555555555ULL, },
+ { 0x5555555555555555ULL, 0x5555555555555555ULL, },
+ { 0xccccccccccccccccULL, 0x5555555555555555ULL, },
+ { 0x3333333333333333ULL, 0x5555555555555555ULL, },
+ { 0xe38e38e38e38e38eULL, 0x5555555555555555ULL, },
+ { 0x1c71c71c71c71c71ULL, 0x5555555555555555ULL, },
+ { 0xffffffffffffffffULL, 0xccccccccccccccccULL, }, /* 32 */
+ { 0x0000000000000000ULL, 0xccccccccccccccccULL, },
+ { 0xaaaaaaaaaaaaaaaaULL, 0xccccccccccccccccULL, },
+ { 0x5555555555555555ULL, 0xccccccccccccccccULL, },
+ { 0xccccccccccccccccULL, 0xccccccccccccccccULL, },
+ { 0x3333333333333333ULL, 0xccccccccccccccccULL, },
+ { 0xe38e38e38e38e38eULL, 0xccccccccccccccccULL, },
+ { 0x1c71c71c71c71c71ULL, 0xccccccccccccccccULL, },
+ { 0xffffffffffffffffULL, 0x3333333333333333ULL, }, /* 40 */
+ { 0x0000000000000000ULL, 0x3333333333333333ULL, },
+ { 0xaaaaaaaaaaaaaaaaULL, 0x3333333333333333ULL, },
+ { 0x5555555555555555ULL, 0x3333333333333333ULL, },
+ { 0xccccccccccccccccULL, 0x3333333333333333ULL, },
+ { 0x3333333333333333ULL, 0x3333333333333333ULL, },
+ { 0xe38e38e38e38e38eULL, 0x3333333333333333ULL, },
+ { 0x1c71c71c71c71c71ULL, 0x3333333333333333ULL, },
+ { 0xffffffffffffffffULL, 0xe38e38e38e38e38eULL, }, /* 48 */
+ { 0x0000000000000000ULL, 0xe38e38e38e38e38eULL, },
+ { 0xaaaaaaaaaaaaaaaaULL, 0xe38e38e38e38e38eULL, },
+ { 0x5555555555555555ULL, 0xe38e38e38e38e38eULL, },
+ { 0xccccccccccccccccULL, 0xe38e38e38e38e38eULL, },
+ { 0x3333333333333333ULL, 0xe38e38e38e38e38eULL, },
+ { 0xe38e38e38e38e38eULL, 0xe38e38e38e38e38eULL, },
+ { 0x1c71c71c71c71c71ULL, 0xe38e38e38e38e38eULL, },
+ { 0xffffffffffffffffULL, 0x1c71c71c71c71c71ULL, }, /* 56 */
+ { 0x0000000000000000ULL, 0x1c71c71c71c71c71ULL, },
+ { 0xaaaaaaaaaaaaaaaaULL, 0x1c71c71c71c71c71ULL, },
+ { 0x5555555555555555ULL, 0x1c71c71c71c71c71ULL, },
+ { 0xccccccccccccccccULL, 0x1c71c71c71c71c71ULL, },
+ { 0x3333333333333333ULL, 0x1c71c71c71c71c71ULL, },
+ { 0xe38e38e38e38e38eULL, 0x1c71c71c71c71c71ULL, },
+ { 0x1c71c71c71c71c71ULL, 0x1c71c71c71c71c71ULL, },
+ { 0x886ae6cc28625540ULL, 0x886ae6cc28625540ULL, }, /* 64 */
+ { 0xfbbe00634d93c708ULL, 0x886ae6cc28625540ULL, },
+ { 0xac5aaeaab9cf8b80ULL, 0x886ae6cc28625540ULL, },
+ { 0x704f164d5e31e24eULL, 0x886ae6cc28625540ULL, },
+ { 0x886ae6cc28625540ULL, 0xfbbe00634d93c708ULL, },
+ { 0xfbbe00634d93c708ULL, 0xfbbe00634d93c708ULL, },
+ { 0xac5aaeaab9cf8b80ULL, 0xfbbe00634d93c708ULL, },
+ { 0x704f164d5e31e24eULL, 0xfbbe00634d93c708ULL, },
+ { 0x886ae6cc28625540ULL, 0xac5aaeaab9cf8b80ULL, }, /* 72 */
+ { 0xfbbe00634d93c708ULL, 0xac5aaeaab9cf8b80ULL, },
+ { 0xac5aaeaab9cf8b80ULL, 0xac5aaeaab9cf8b80ULL, },
+ { 0x704f164d5e31e24eULL, 0xac5aaeaab9cf8b80ULL, },
+ { 0x886ae6cc28625540ULL, 0x704f164d5e31e24eULL, },
+ { 0xfbbe00634d93c708ULL, 0x704f164d5e31e24eULL, },
+ { 0xac5aaeaab9cf8b80ULL, 0x704f164d5e31e24eULL, },
+ { 0x704f164d5e31e24eULL, 0x704f164d5e31e24eULL, },
+ };
+
+ gettimeofday(&start, NULL);
+
+ for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) {
+ do_msa_ILVR_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_ILVR_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/interleave/test_msa_ilvr_h.c b/tests/tcg/mips/user/ase/msa/interleave/test_msa_ilvr_h.c
new file mode 100644
index 0000000000..5a2986dca6
--- /dev/null
+++ b/tests/tcg/mips/user/ase/msa/interleave/test_msa_ilvr_h.c
@@ -0,0 +1,153 @@
+/*
+ * Test program for MSA instruction ILVR.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 = "ILVR.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 */
+ { 0xffff0000ffff0000ULL, 0xffff0000ffff0000ULL, },
+ { 0xffffaaaaffffaaaaULL, 0xffffaaaaffffaaaaULL, },
+ { 0xffff5555ffff5555ULL, 0xffff5555ffff5555ULL, },
+ { 0xffffccccffffccccULL, 0xffffccccffffccccULL, },
+ { 0xffff3333ffff3333ULL, 0xffff3333ffff3333ULL, },
+ { 0xffff8e38ffffe38eULL, 0xffffe38effff38e3ULL, },
+ { 0xffff71c7ffff1c71ULL, 0xffff1c71ffffc71cULL, },
+ { 0x0000ffff0000ffffULL, 0x0000ffff0000ffffULL, }, /* 8 */
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0x0000aaaa0000aaaaULL, 0x0000aaaa0000aaaaULL, },
+ { 0x0000555500005555ULL, 0x0000555500005555ULL, },
+ { 0x0000cccc0000ccccULL, 0x0000cccc0000ccccULL, },
+ { 0x0000333300003333ULL, 0x0000333300003333ULL, },
+ { 0x00008e380000e38eULL, 0x0000e38e000038e3ULL, },
+ { 0x000071c700001c71ULL, 0x00001c710000c71cULL, },
+ { 0xaaaaffffaaaaffffULL, 0xaaaaffffaaaaffffULL, }, /* 16 */
+ { 0xaaaa0000aaaa0000ULL, 0xaaaa0000aaaa0000ULL, },
+ { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, },
+ { 0xaaaa5555aaaa5555ULL, 0xaaaa5555aaaa5555ULL, },
+ { 0xaaaaccccaaaaccccULL, 0xaaaaccccaaaaccccULL, },
+ { 0xaaaa3333aaaa3333ULL, 0xaaaa3333aaaa3333ULL, },
+ { 0xaaaa8e38aaaae38eULL, 0xaaaae38eaaaa38e3ULL, },
+ { 0xaaaa71c7aaaa1c71ULL, 0xaaaa1c71aaaac71cULL, },
+ { 0x5555ffff5555ffffULL, 0x5555ffff5555ffffULL, }, /* 24 */
+ { 0x5555000055550000ULL, 0x5555000055550000ULL, },
+ { 0x5555aaaa5555aaaaULL, 0x5555aaaa5555aaaaULL, },
+ { 0x5555555555555555ULL, 0x5555555555555555ULL, },
+ { 0x5555cccc5555ccccULL, 0x5555cccc5555ccccULL, },
+ { 0x5555333355553333ULL, 0x5555333355553333ULL, },
+ { 0x55558e385555e38eULL, 0x5555e38e555538e3ULL, },
+ { 0x555571c755551c71ULL, 0x55551c715555c71cULL, },
+ { 0xccccffffccccffffULL, 0xccccffffccccffffULL, }, /* 32 */
+ { 0xcccc0000cccc0000ULL, 0xcccc0000cccc0000ULL, },
+ { 0xccccaaaaccccaaaaULL, 0xccccaaaaccccaaaaULL, },
+ { 0xcccc5555cccc5555ULL, 0xcccc5555cccc5555ULL, },
+ { 0xccccccccccccccccULL, 0xccccccccccccccccULL, },
+ { 0xcccc3333cccc3333ULL, 0xcccc3333cccc3333ULL, },
+ { 0xcccc8e38cccce38eULL, 0xcccce38ecccc38e3ULL, },
+ { 0xcccc71c7cccc1c71ULL, 0xcccc1c71ccccc71cULL, },
+ { 0x3333ffff3333ffffULL, 0x3333ffff3333ffffULL, }, /* 40 */
+ { 0x3333000033330000ULL, 0x3333000033330000ULL, },
+ { 0x3333aaaa3333aaaaULL, 0x3333aaaa3333aaaaULL, },
+ { 0x3333555533335555ULL, 0x3333555533335555ULL, },
+ { 0x3333cccc3333ccccULL, 0x3333cccc3333ccccULL, },
+ { 0x3333333333333333ULL, 0x3333333333333333ULL, },
+ { 0x33338e383333e38eULL, 0x3333e38e333338e3ULL, },
+ { 0x333371c733331c71ULL, 0x33331c713333c71cULL, },
+ { 0x8e38ffffe38effffULL, 0xe38effff38e3ffffULL, }, /* 48 */
+ { 0x8e380000e38e0000ULL, 0xe38e000038e30000ULL, },
+ { 0x8e38aaaae38eaaaaULL, 0xe38eaaaa38e3aaaaULL, },
+ { 0x8e385555e38e5555ULL, 0xe38e555538e35555ULL, },
+ { 0x8e38cccce38eccccULL, 0xe38ecccc38e3ccccULL, },
+ { 0x8e383333e38e3333ULL, 0xe38e333338e33333ULL, },
+ { 0x8e388e38e38ee38eULL, 0xe38ee38e38e338e3ULL, },
+ { 0x8e3871c7e38e1c71ULL, 0xe38e1c7138e3c71cULL, },
+ { 0x71c7ffff1c71ffffULL, 0x1c71ffffc71cffffULL, }, /* 56 */
+ { 0x71c700001c710000ULL, 0x1c710000c71c0000ULL, },
+ { 0x71c7aaaa1c71aaaaULL, 0x1c71aaaac71caaaaULL, },
+ { 0x71c755551c715555ULL, 0x1c715555c71c5555ULL, },
+ { 0x71c7cccc1c71ccccULL, 0x1c71ccccc71cccccULL, },
+ { 0x71c733331c713333ULL, 0x1c713333c71c3333ULL, },
+ { 0x71c78e381c71e38eULL, 0x1c71e38ec71c38e3ULL, },
+ { 0x71c771c71c711c71ULL, 0x1c711c71c71cc71cULL, },
+ { 0x2862286255405540ULL, 0x886a886ae6cce6ccULL, }, /* 64 */
+ { 0x28624d935540c708ULL, 0x886afbbee6cc0063ULL, },
+ { 0x2862b9cf55408b80ULL, 0x886aac5ae6ccaeaaULL, },
+ { 0x28625e315540e24eULL, 0x886a704fe6cc164dULL, },
+ { 0x4d932862c7085540ULL, 0xfbbe886a0063e6ccULL, },
+ { 0x4d934d93c708c708ULL, 0xfbbefbbe00630063ULL, },
+ { 0x4d93b9cfc7088b80ULL, 0xfbbeac5a0063aeaaULL, },
+ { 0x4d935e31c708e24eULL, 0xfbbe704f0063164dULL, },
+ { 0xb9cf28628b805540ULL, 0xac5a886aaeaae6ccULL, }, /* 72 */
+ { 0xb9cf4d938b80c708ULL, 0xac5afbbeaeaa0063ULL, },
+ { 0xb9cfb9cf8b808b80ULL, 0xac5aac5aaeaaaeaaULL, },
+ { 0xb9cf5e318b80e24eULL, 0xac5a704faeaa164dULL, },
+ { 0x5e312862e24e5540ULL, 0x704f886a164de6ccULL, },
+ { 0x5e314d93e24ec708ULL, 0x704ffbbe164d0063ULL, },
+ { 0x5e31b9cfe24e8b80ULL, 0x704fac5a164daeaaULL, },
+ { 0x5e315e31e24ee24eULL, 0x704f704f164d164dULL, },
+ };
+
+ gettimeofday(&start, NULL);
+
+ for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) {
+ do_msa_ILVR_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_ILVR_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/interleave/test_msa_ilvr_w.c b/tests/tcg/mips/user/ase/msa/interleave/test_msa_ilvr_w.c
new file mode 100644
index 0000000000..fa0d6ea900
--- /dev/null
+++ b/tests/tcg/mips/user/ase/msa/interleave/test_msa_ilvr_w.c
@@ -0,0 +1,153 @@
+/*
+ * Test program for MSA instruction ILVR.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 = "ILVR.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 */
+ { 0xffffffff00000000ULL, 0xffffffff00000000ULL, },
+ { 0xffffffffaaaaaaaaULL, 0xffffffffaaaaaaaaULL, },
+ { 0xffffffff55555555ULL, 0xffffffff55555555ULL, },
+ { 0xffffffffccccccccULL, 0xffffffffccccccccULL, },
+ { 0xffffffff33333333ULL, 0xffffffff33333333ULL, },
+ { 0xffffffff8e38e38eULL, 0xffffffffe38e38e3ULL, },
+ { 0xffffffff71c71c71ULL, 0xffffffff1c71c71cULL, },
+ { 0x00000000ffffffffULL, 0x00000000ffffffffULL, }, /* 8 */
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0x00000000aaaaaaaaULL, 0x00000000aaaaaaaaULL, },
+ { 0x0000000055555555ULL, 0x0000000055555555ULL, },
+ { 0x00000000ccccccccULL, 0x00000000ccccccccULL, },
+ { 0x0000000033333333ULL, 0x0000000033333333ULL, },
+ { 0x000000008e38e38eULL, 0x00000000e38e38e3ULL, },
+ { 0x0000000071c71c71ULL, 0x000000001c71c71cULL, },
+ { 0xaaaaaaaaffffffffULL, 0xaaaaaaaaffffffffULL, }, /* 16 */
+ { 0xaaaaaaaa00000000ULL, 0xaaaaaaaa00000000ULL, },
+ { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, },
+ { 0xaaaaaaaa55555555ULL, 0xaaaaaaaa55555555ULL, },
+ { 0xaaaaaaaaccccccccULL, 0xaaaaaaaaccccccccULL, },
+ { 0xaaaaaaaa33333333ULL, 0xaaaaaaaa33333333ULL, },
+ { 0xaaaaaaaa8e38e38eULL, 0xaaaaaaaae38e38e3ULL, },
+ { 0xaaaaaaaa71c71c71ULL, 0xaaaaaaaa1c71c71cULL, },
+ { 0x55555555ffffffffULL, 0x55555555ffffffffULL, }, /* 24 */
+ { 0x5555555500000000ULL, 0x5555555500000000ULL, },
+ { 0x55555555aaaaaaaaULL, 0x55555555aaaaaaaaULL, },
+ { 0x5555555555555555ULL, 0x5555555555555555ULL, },
+ { 0x55555555ccccccccULL, 0x55555555ccccccccULL, },
+ { 0x5555555533333333ULL, 0x5555555533333333ULL, },
+ { 0x555555558e38e38eULL, 0x55555555e38e38e3ULL, },
+ { 0x5555555571c71c71ULL, 0x555555551c71c71cULL, },
+ { 0xccccccccffffffffULL, 0xccccccccffffffffULL, }, /* 32 */
+ { 0xcccccccc00000000ULL, 0xcccccccc00000000ULL, },
+ { 0xccccccccaaaaaaaaULL, 0xccccccccaaaaaaaaULL, },
+ { 0xcccccccc55555555ULL, 0xcccccccc55555555ULL, },
+ { 0xccccccccccccccccULL, 0xccccccccccccccccULL, },
+ { 0xcccccccc33333333ULL, 0xcccccccc33333333ULL, },
+ { 0xcccccccc8e38e38eULL, 0xcccccccce38e38e3ULL, },
+ { 0xcccccccc71c71c71ULL, 0xcccccccc1c71c71cULL, },
+ { 0x33333333ffffffffULL, 0x33333333ffffffffULL, }, /* 40 */
+ { 0x3333333300000000ULL, 0x3333333300000000ULL, },
+ { 0x33333333aaaaaaaaULL, 0x33333333aaaaaaaaULL, },
+ { 0x3333333355555555ULL, 0x3333333355555555ULL, },
+ { 0x33333333ccccccccULL, 0x33333333ccccccccULL, },
+ { 0x3333333333333333ULL, 0x3333333333333333ULL, },
+ { 0x333333338e38e38eULL, 0x33333333e38e38e3ULL, },
+ { 0x3333333371c71c71ULL, 0x333333331c71c71cULL, },
+ { 0x8e38e38effffffffULL, 0xe38e38e3ffffffffULL, }, /* 48 */
+ { 0x8e38e38e00000000ULL, 0xe38e38e300000000ULL, },
+ { 0x8e38e38eaaaaaaaaULL, 0xe38e38e3aaaaaaaaULL, },
+ { 0x8e38e38e55555555ULL, 0xe38e38e355555555ULL, },
+ { 0x8e38e38eccccccccULL, 0xe38e38e3ccccccccULL, },
+ { 0x8e38e38e33333333ULL, 0xe38e38e333333333ULL, },
+ { 0x8e38e38e8e38e38eULL, 0xe38e38e3e38e38e3ULL, },
+ { 0x8e38e38e71c71c71ULL, 0xe38e38e31c71c71cULL, },
+ { 0x71c71c71ffffffffULL, 0x1c71c71cffffffffULL, }, /* 56 */
+ { 0x71c71c7100000000ULL, 0x1c71c71c00000000ULL, },
+ { 0x71c71c71aaaaaaaaULL, 0x1c71c71caaaaaaaaULL, },
+ { 0x71c71c7155555555ULL, 0x1c71c71c55555555ULL, },
+ { 0x71c71c71ccccccccULL, 0x1c71c71cccccccccULL, },
+ { 0x71c71c7133333333ULL, 0x1c71c71c33333333ULL, },
+ { 0x71c71c718e38e38eULL, 0x1c71c71ce38e38e3ULL, },
+ { 0x71c71c7171c71c71ULL, 0x1c71c71c1c71c71cULL, },
+ { 0x2862554028625540ULL, 0x886ae6cc886ae6ccULL, }, /* 64 */
+ { 0x286255404d93c708ULL, 0x886ae6ccfbbe0063ULL, },
+ { 0x28625540b9cf8b80ULL, 0x886ae6ccac5aaeaaULL, },
+ { 0x286255405e31e24eULL, 0x886ae6cc704f164dULL, },
+ { 0x4d93c70828625540ULL, 0xfbbe0063886ae6ccULL, },
+ { 0x4d93c7084d93c708ULL, 0xfbbe0063fbbe0063ULL, },
+ { 0x4d93c708b9cf8b80ULL, 0xfbbe0063ac5aaeaaULL, },
+ { 0x4d93c7085e31e24eULL, 0xfbbe0063704f164dULL, },
+ { 0xb9cf8b8028625540ULL, 0xac5aaeaa886ae6ccULL, }, /* 72 */
+ { 0xb9cf8b804d93c708ULL, 0xac5aaeaafbbe0063ULL, },
+ { 0xb9cf8b80b9cf8b80ULL, 0xac5aaeaaac5aaeaaULL, },
+ { 0xb9cf8b805e31e24eULL, 0xac5aaeaa704f164dULL, },
+ { 0x5e31e24e28625540ULL, 0x704f164d886ae6ccULL, },
+ { 0x5e31e24e4d93c708ULL, 0x704f164dfbbe0063ULL, },
+ { 0x5e31e24eb9cf8b80ULL, 0x704f164dac5aaeaaULL, },
+ { 0x5e31e24e5e31e24eULL, 0x704f164d704f164dULL, },
+ };
+
+ gettimeofday(&start, NULL);
+
+ for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) {
+ do_msa_ILVR_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_ILVR_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/logic/test_msa_and_v.c b/tests/tcg/mips/user/ase/msa/logic/test_msa_and_v.c
new file mode 100644
index 0000000000..51b256fa50
--- /dev/null
+++ b/tests/tcg/mips/user/ase/msa/logic/test_msa_and_v.c
@@ -0,0 +1,153 @@
+/*
+ * Test program for MSA instruction AND.V
+ *
+ * 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 = "AND.V";
+ 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 */
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, },
+ { 0x5555555555555555ULL, 0x5555555555555555ULL, },
+ { 0xccccccccccccccccULL, 0xccccccccccccccccULL, },
+ { 0x3333333333333333ULL, 0x3333333333333333ULL, },
+ { 0xe38e38e38e38e38eULL, 0x38e38e38e38e38e3ULL, },
+ { 0x1c71c71c71c71c71ULL, 0xc71c71c71c71c71cULL, },
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 8 */
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, }, /* 16 */
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, },
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0x8888888888888888ULL, 0x8888888888888888ULL, },
+ { 0x2222222222222222ULL, 0x2222222222222222ULL, },
+ { 0xa28a28a28a28a28aULL, 0x28a28a28a28a28a2ULL, },
+ { 0x0820820820820820ULL, 0x8208208208208208ULL, },
+ { 0x5555555555555555ULL, 0x5555555555555555ULL, }, /* 24 */
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0x5555555555555555ULL, 0x5555555555555555ULL, },
+ { 0x4444444444444444ULL, 0x4444444444444444ULL, },
+ { 0x1111111111111111ULL, 0x1111111111111111ULL, },
+ { 0x4104104104104104ULL, 0x1041041041041041ULL, },
+ { 0x1451451451451451ULL, 0x4514514514514514ULL, },
+ { 0xccccccccccccccccULL, 0xccccccccccccccccULL, }, /* 32 */
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0x8888888888888888ULL, 0x8888888888888888ULL, },
+ { 0x4444444444444444ULL, 0x4444444444444444ULL, },
+ { 0xccccccccccccccccULL, 0xccccccccccccccccULL, },
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0xc08c08c08c08c08cULL, 0x08c08c08c08c08c0ULL, },
+ { 0x0c40c40c40c40c40ULL, 0xc40c40c40c40c40cULL, },
+ { 0x3333333333333333ULL, 0x3333333333333333ULL, }, /* 40 */
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0x2222222222222222ULL, 0x2222222222222222ULL, },
+ { 0x1111111111111111ULL, 0x1111111111111111ULL, },
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0x3333333333333333ULL, 0x3333333333333333ULL, },
+ { 0x2302302302302302ULL, 0x3023023023023023ULL, },
+ { 0x1031031031031031ULL, 0x0310310310310310ULL, },
+ { 0xe38e38e38e38e38eULL, 0x38e38e38e38e38e3ULL, }, /* 48 */
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0xa28a28a28a28a28aULL, 0x28a28a28a28a28a2ULL, },
+ { 0x4104104104104104ULL, 0x1041041041041041ULL, },
+ { 0xc08c08c08c08c08cULL, 0x08c08c08c08c08c0ULL, },
+ { 0x2302302302302302ULL, 0x3023023023023023ULL, },
+ { 0xe38e38e38e38e38eULL, 0x38e38e38e38e38e3ULL, },
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0x1c71c71c71c71c71ULL, 0xc71c71c71c71c71cULL, }, /* 56 */
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0x0820820820820820ULL, 0x8208208208208208ULL, },
+ { 0x1451451451451451ULL, 0x4514514514514514ULL, },
+ { 0x0c40c40c40c40c40ULL, 0xc40c40c40c40c40cULL, },
+ { 0x1031031031031031ULL, 0x0310310310310310ULL, },
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0x1c71c71c71c71c71ULL, 0xc71c71c71c71c71cULL, },
+ { 0x886ae6cc28625540ULL, 0x4b670b5efe7bb00cULL, }, /* 64 */
+ { 0x882a004008024500ULL, 0x02670b1a143b100cULL, },
+ { 0x884aa68828420100ULL, 0x0340025eaa2b2004ULL, },
+ { 0x004a064c08204040ULL, 0x09610858a842a000ULL, },
+ { 0x882a004008024500ULL, 0x02670b1a143b100cULL, },
+ { 0xfbbe00634d93c708ULL, 0x12f7bb1a153f52fcULL, },
+ { 0xa81a002209838300ULL, 0x02d0821a012b0014ULL, },
+ { 0x700e00414c11c208ULL, 0x00f18818010242a0ULL, },
+ { 0x884aa68828420100ULL, 0x0340025eaa2b2004ULL, }, /* 72 */
+ { 0xa81a002209838300ULL, 0x02d0821a012b0014ULL, },
+ { 0xac5aaeaab9cf8b80ULL, 0x27d8c6ffab2b2514ULL, },
+ { 0x204a060818018200ULL, 0x05d080d8a9022000ULL, },
+ { 0x004a064c08204040ULL, 0x09610858a842a000ULL, },
+ { 0x700e00414c11c208ULL, 0x00f18818010242a0ULL, },
+ { 0x204a060818018200ULL, 0x05d080d8a9022000ULL, },
+ { 0x704f164d5e31e24eULL, 0x8df188d8a942e2a0ULL, },
+ };
+
+ gettimeofday(&start, NULL);
+
+ for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) {
+ do_msa_AND_V(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_AND_V(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/logic/test_msa_nor_v.c b/tests/tcg/mips/user/ase/msa/logic/test_msa_nor_v.c
new file mode 100644
index 0000000000..90ca19843c
--- /dev/null
+++ b/tests/tcg/mips/user/ase/msa/logic/test_msa_nor_v.c
@@ -0,0 +1,153 @@
+/*
+ * Test program for MSA instruction NOR.V
+ *
+ * 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 = "NOR.V";
+ 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] = {
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 0 */
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 8 */
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0x5555555555555555ULL, 0x5555555555555555ULL, },
+ { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, },
+ { 0x3333333333333333ULL, 0x3333333333333333ULL, },
+ { 0xccccccccccccccccULL, 0xccccccccccccccccULL, },
+ { 0x1c71c71c71c71c71ULL, 0xc71c71c71c71c71cULL, },
+ { 0xe38e38e38e38e38eULL, 0x38e38e38e38e38e3ULL, },
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 16 */
+ { 0x5555555555555555ULL, 0x5555555555555555ULL, },
+ { 0x5555555555555555ULL, 0x5555555555555555ULL, },
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0x1111111111111111ULL, 0x1111111111111111ULL, },
+ { 0x4444444444444444ULL, 0x4444444444444444ULL, },
+ { 0x1451451451451451ULL, 0x4514514514514514ULL, },
+ { 0x4104104104104104ULL, 0x1041041041041041ULL, },
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 24 */
+ { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, },
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, },
+ { 0x2222222222222222ULL, 0x2222222222222222ULL, },
+ { 0x8888888888888888ULL, 0x8888888888888888ULL, },
+ { 0x0820820820820820ULL, 0x8208208208208208ULL, },
+ { 0xa28a28a28a28a28aULL, 0x28a28a28a28a28a2ULL, },
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 32 */
+ { 0x3333333333333333ULL, 0x3333333333333333ULL, },
+ { 0x1111111111111111ULL, 0x1111111111111111ULL, },
+ { 0x2222222222222222ULL, 0x2222222222222222ULL, },
+ { 0x3333333333333333ULL, 0x3333333333333333ULL, },
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0x1031031031031031ULL, 0x0310310310310310ULL, },
+ { 0x2302302302302302ULL, 0x3023023023023023ULL, },
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 40 */
+ { 0xccccccccccccccccULL, 0xccccccccccccccccULL, },
+ { 0x4444444444444444ULL, 0x4444444444444444ULL, },
+ { 0x8888888888888888ULL, 0x8888888888888888ULL, },
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0xccccccccccccccccULL, 0xccccccccccccccccULL, },
+ { 0x0c40c40c40c40c40ULL, 0xc40c40c40c40c40cULL, },
+ { 0xc08c08c08c08c08cULL, 0x08c08c08c08c08c0ULL, },
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 48 */
+ { 0x1c71c71c71c71c71ULL, 0xc71c71c71c71c71cULL, },
+ { 0x1451451451451451ULL, 0x4514514514514514ULL, },
+ { 0x0820820820820820ULL, 0x8208208208208208ULL, },
+ { 0x1031031031031031ULL, 0x0310310310310310ULL, },
+ { 0x0c40c40c40c40c40ULL, 0xc40c40c40c40c40cULL, },
+ { 0x1c71c71c71c71c71ULL, 0xc71c71c71c71c71cULL, },
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 56 */
+ { 0xe38e38e38e38e38eULL, 0x38e38e38e38e38e3ULL, },
+ { 0x4104104104104104ULL, 0x1041041041041041ULL, },
+ { 0xa28a28a28a28a28aULL, 0x28a28a28a28a28a2ULL, },
+ { 0x2302302302302302ULL, 0x3023023023023023ULL, },
+ { 0xc08c08c08c08c08cULL, 0x08c08c08c08c08c0ULL, },
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0xe38e38e38e38e38eULL, 0x38e38e38e38e38e3ULL, },
+ { 0x77951933d79daabfULL, 0xb498f4a101844ff3ULL, }, /* 64 */
+ { 0x04011910920c28b7ULL, 0xa40844a100800d03ULL, },
+ { 0x538511114610203fULL, 0x9000300000844ae3ULL, },
+ { 0x07900932818c08b1ULL, 0x3008742100840d53ULL, },
+ { 0x04011910920c28b7ULL, 0xa40844a100800d03ULL, },
+ { 0x0441ff9cb26c38f7ULL, 0xed0844e5eac0ad03ULL, },
+ { 0x0001511402203077ULL, 0xc800000040c08803ULL, },
+ { 0x0400e990a04c18b1ULL, 0x6008442542800d03ULL, },
+ { 0x538511114610203fULL, 0x9000300000844ae3ULL, }, /* 72 */
+ { 0x0001511402203077ULL, 0xc800000040c08803ULL, },
+ { 0x53a551554630747fULL, 0xd827390054d4daebULL, },
+ { 0x03a0411000001431ULL, 0x500631005494184bULL, },
+ { 0x07900932818c08b1ULL, 0x3008742100840d53ULL, },
+ { 0x0400e990a04c18b1ULL, 0x6008442542800d03ULL, },
+ { 0x03a0411000001431ULL, 0x500631005494184bULL, },
+ { 0x8fb0e9b2a1ce1db1ULL, 0x720e772756bd1d5fULL, },
+ };
+
+ gettimeofday(&start, NULL);
+
+ for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) {
+ do_msa_NOR_V(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_NOR_V(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/logic/test_msa_or_v.c b/tests/tcg/mips/user/ase/msa/logic/test_msa_or_v.c
new file mode 100644
index 0000000000..4ad5366dfb
--- /dev/null
+++ b/tests/tcg/mips/user/ase/msa/logic/test_msa_or_v.c
@@ -0,0 +1,153 @@
+/*
+ * Test program for MSA instruction OR.V
+ *
+ * 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 = "OR.V";
+ 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, },
+ { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xeeeeeeeeeeeeeeeeULL, 0xeeeeeeeeeeeeeeeeULL, },
+ { 0xbbbbbbbbbbbbbbbbULL, 0xbbbbbbbbbbbbbbbbULL, },
+ { 0xebaebaebaebaebaeULL, 0xbaebaebaebaebaebULL, },
+ { 0xbefbefbefbefbefbULL, 0xefbefbefbefbefbeULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 24 */
+ { 0x5555555555555555ULL, 0x5555555555555555ULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0x5555555555555555ULL, 0x5555555555555555ULL, },
+ { 0xddddddddddddddddULL, 0xddddddddddddddddULL, },
+ { 0x7777777777777777ULL, 0x7777777777777777ULL, },
+ { 0xf7df7df7df7df7dfULL, 0x7df7df7df7df7df7ULL, },
+ { 0x5d75d75d75d75d75ULL, 0xd75d75d75d75d75dULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 32 */
+ { 0xccccccccccccccccULL, 0xccccccccccccccccULL, },
+ { 0xeeeeeeeeeeeeeeeeULL, 0xeeeeeeeeeeeeeeeeULL, },
+ { 0xddddddddddddddddULL, 0xddddddddddddddddULL, },
+ { 0xccccccccccccccccULL, 0xccccccccccccccccULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xefcefcefcefcefceULL, 0xfcefcefcefcefcefULL, },
+ { 0xdcfdcfdcfdcfdcfdULL, 0xcfdcfdcfdcfdcfdcULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 40 */
+ { 0x3333333333333333ULL, 0x3333333333333333ULL, },
+ { 0xbbbbbbbbbbbbbbbbULL, 0xbbbbbbbbbbbbbbbbULL, },
+ { 0x7777777777777777ULL, 0x7777777777777777ULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0x3333333333333333ULL, 0x3333333333333333ULL, },
+ { 0xf3bf3bf3bf3bf3bfULL, 0x3bf3bf3bf3bf3bf3ULL, },
+ { 0x3f73f73f73f73f73ULL, 0xf73f73f73f73f73fULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 48 */
+ { 0xe38e38e38e38e38eULL, 0x38e38e38e38e38e3ULL, },
+ { 0xebaebaebaebaebaeULL, 0xbaebaebaebaebaebULL, },
+ { 0xf7df7df7df7df7dfULL, 0x7df7df7df7df7df7ULL, },
+ { 0xefcefcefcefcefceULL, 0xfcefcefcefcefcefULL, },
+ { 0xf3bf3bf3bf3bf3bfULL, 0x3bf3bf3bf3bf3bf3ULL, },
+ { 0xe38e38e38e38e38eULL, 0x38e38e38e38e38e3ULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 56 */
+ { 0x1c71c71c71c71c71ULL, 0xc71c71c71c71c71cULL, },
+ { 0xbefbefbefbefbefbULL, 0xefbefbefbefbefbeULL, },
+ { 0x5d75d75d75d75d75ULL, 0xd75d75d75d75d75dULL, },
+ { 0xdcfdcfdcfdcfdcfdULL, 0xcfdcfdcfdcfdcfdcULL, },
+ { 0x3f73f73f73f73f73ULL, 0xf73f73f73f73f73fULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0x1c71c71c71c71c71ULL, 0xc71c71c71c71c71cULL, },
+ { 0x886ae6cc28625540ULL, 0x4b670b5efe7bb00cULL, }, /* 64 */
+ { 0xfbfee6ef6df3d748ULL, 0x5bf7bb5eff7ff2fcULL, },
+ { 0xac7aeeeeb9efdfc0ULL, 0x6fffcfffff7bb51cULL, },
+ { 0xf86ff6cd7e73f74eULL, 0xcff78bdeff7bf2acULL, },
+ { 0xfbfee6ef6df3d748ULL, 0x5bf7bb5eff7ff2fcULL, },
+ { 0xfbbe00634d93c708ULL, 0x12f7bb1a153f52fcULL, },
+ { 0xfffeaeebfddfcf88ULL, 0x37ffffffbf3f77fcULL, },
+ { 0xfbff166f5fb3e74eULL, 0x9ff7bbdabd7ff2fcULL, },
+ { 0xac7aeeeeb9efdfc0ULL, 0x6fffcfffff7bb51cULL, }, /* 72 */
+ { 0xfffeaeebfddfcf88ULL, 0x37ffffffbf3f77fcULL, },
+ { 0xac5aaeaab9cf8b80ULL, 0x27d8c6ffab2b2514ULL, },
+ { 0xfc5fbeefffffebceULL, 0xaff9ceffab6be7b4ULL, },
+ { 0xf86ff6cd7e73f74eULL, 0xcff78bdeff7bf2acULL, },
+ { 0xfbff166f5fb3e74eULL, 0x9ff7bbdabd7ff2fcULL, },
+ { 0xfc5fbeefffffebceULL, 0xaff9ceffab6be7b4ULL, },
+ { 0x704f164d5e31e24eULL, 0x8df188d8a942e2a0ULL, },
+ };
+
+ gettimeofday(&start, NULL);
+
+ for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) {
+ do_msa_OR_V(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_OR_V(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/logic/test_msa_xor_v.c b/tests/tcg/mips/user/ase/msa/logic/test_msa_xor_v.c
new file mode 100644
index 0000000000..54effeda63
--- /dev/null
+++ b/tests/tcg/mips/user/ase/msa/logic/test_msa_xor_v.c
@@ -0,0 +1,153 @@
+/*
+ * Test program for MSA instruction XOR.V
+ *
+ * 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 = "XOR.V";
+ 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] = {
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 0 */
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0x5555555555555555ULL, 0x5555555555555555ULL, },
+ { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, },
+ { 0x3333333333333333ULL, 0x3333333333333333ULL, },
+ { 0xccccccccccccccccULL, 0xccccccccccccccccULL, },
+ { 0x1c71c71c71c71c71ULL, 0xc71c71c71c71c71cULL, },
+ { 0xe38e38e38e38e38eULL, 0x38e38e38e38e38e3ULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 8 */
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, },
+ { 0x5555555555555555ULL, 0x5555555555555555ULL, },
+ { 0xccccccccccccccccULL, 0xccccccccccccccccULL, },
+ { 0x3333333333333333ULL, 0x3333333333333333ULL, },
+ { 0xe38e38e38e38e38eULL, 0x38e38e38e38e38e3ULL, },
+ { 0x1c71c71c71c71c71ULL, 0xc71c71c71c71c71cULL, },
+ { 0x5555555555555555ULL, 0x5555555555555555ULL, }, /* 16 */
+ { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, },
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0x6666666666666666ULL, 0x6666666666666666ULL, },
+ { 0x9999999999999999ULL, 0x9999999999999999ULL, },
+ { 0x4924924924924924ULL, 0x9249249249249249ULL, },
+ { 0xb6db6db6db6db6dbULL, 0x6db6db6db6db6db6ULL, },
+ { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, }, /* 24 */
+ { 0x5555555555555555ULL, 0x5555555555555555ULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0x9999999999999999ULL, 0x9999999999999999ULL, },
+ { 0x6666666666666666ULL, 0x6666666666666666ULL, },
+ { 0xb6db6db6db6db6dbULL, 0x6db6db6db6db6db6ULL, },
+ { 0x4924924924924924ULL, 0x9249249249249249ULL, },
+ { 0x3333333333333333ULL, 0x3333333333333333ULL, }, /* 32 */
+ { 0xccccccccccccccccULL, 0xccccccccccccccccULL, },
+ { 0x6666666666666666ULL, 0x6666666666666666ULL, },
+ { 0x9999999999999999ULL, 0x9999999999999999ULL, },
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0x2f42f42f42f42f42ULL, 0xf42f42f42f42f42fULL, },
+ { 0xd0bd0bd0bd0bd0bdULL, 0x0bd0bd0bd0bd0bd0ULL, },
+ { 0xccccccccccccccccULL, 0xccccccccccccccccULL, }, /* 40 */
+ { 0x3333333333333333ULL, 0x3333333333333333ULL, },
+ { 0x9999999999999999ULL, 0x9999999999999999ULL, },
+ { 0x6666666666666666ULL, 0x6666666666666666ULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0xd0bd0bd0bd0bd0bdULL, 0x0bd0bd0bd0bd0bd0ULL, },
+ { 0x2f42f42f42f42f42ULL, 0xf42f42f42f42f42fULL, },
+ { 0x1c71c71c71c71c71ULL, 0xc71c71c71c71c71cULL, }, /* 48 */
+ { 0xe38e38e38e38e38eULL, 0x38e38e38e38e38e3ULL, },
+ { 0x4924924924924924ULL, 0x9249249249249249ULL, },
+ { 0xb6db6db6db6db6dbULL, 0x6db6db6db6db6db6ULL, },
+ { 0x2f42f42f42f42f42ULL, 0xf42f42f42f42f42fULL, },
+ { 0xd0bd0bd0bd0bd0bdULL, 0x0bd0bd0bd0bd0bd0ULL, },
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0xe38e38e38e38e38eULL, 0x38e38e38e38e38e3ULL, }, /* 56 */
+ { 0x1c71c71c71c71c71ULL, 0xc71c71c71c71c71cULL, },
+ { 0xb6db6db6db6db6dbULL, 0x6db6db6db6db6db6ULL, },
+ { 0x4924924924924924ULL, 0x9249249249249249ULL, },
+ { 0xd0bd0bd0bd0bd0bdULL, 0x0bd0bd0bd0bd0bd0ULL, },
+ { 0x2f42f42f42f42f42ULL, 0xf42f42f42f42f42fULL, },
+ { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 64 */
+ { 0x73d4e6af65f19248ULL, 0x5990b044eb44e2f0ULL, },
+ { 0x2430486691addec0ULL, 0x6cbfcda155509518ULL, },
+ { 0xf825f0817653b70eULL, 0xc6968386573952acULL, },
+ { 0x73d4e6af65f19248ULL, 0x5990b044eb44e2f0ULL, },
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0x57e4aec9f45c4c88ULL, 0x352f7de5be1477e8ULL, },
+ { 0x8bf1162e13a22546ULL, 0x9f0633c2bc7db05cULL, },
+ { 0x2430486691addec0ULL, 0x6cbfcda155509518ULL, }, /* 72 */
+ { 0x57e4aec9f45c4c88ULL, 0x352f7de5be1477e8ULL, },
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ { 0xdc15b8e7e7fe69ceULL, 0xaa294e270269c7b4ULL, },
+ { 0xf825f0817653b70eULL, 0xc6968386573952acULL, },
+ { 0x8bf1162e13a22546ULL, 0x9f0633c2bc7db05cULL, },
+ { 0xdc15b8e7e7fe69ceULL, 0xaa294e270269c7b4ULL, },
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+ };
+
+ gettimeofday(&start, NULL);
+
+ for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) {
+ for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) {
+ do_msa_XOR_V(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_XOR_V(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;
+}