summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--MAINTAINERS36
-rw-r--r--Makefile2
-rw-r--r--Makefile.objs2
-rw-r--r--Makefile.target5
-rw-r--r--cpus.c187
-rw-r--r--default-configs/mips-softmmu-common.mak7
-rw-r--r--default-configs/mips64-softmmu.mak5
-rw-r--r--default-configs/mips64el-softmmu.mak5
-rw-r--r--dump/Makefile.objs3
-rw-r--r--dump/dump-hmp-cmds.c88
-rw-r--r--dump/dump.c (renamed from dump.c)4
-rw-r--r--dump/win_dump.c (renamed from win_dump.c)0
-rw-r--r--dump/win_dump.h (renamed from win_dump.h)0
-rw-r--r--hw/block/xen-block.c2
-rw-r--r--hw/core/Makefile.objs4
-rw-r--r--hw/core/machine-hmp-cmds.c164
-rw-r--r--hw/core/machine-qmp-cmds.c328
-rw-r--r--hw/core/numa.c (renamed from numa.c)64
-rw-r--r--hw/core/qdev.c2
-rw-r--r--hw/display/ati.c7
-rw-r--r--hw/display/ati_int.h2
-rw-r--r--hw/display/virtio-gpu.c9
-rw-r--r--hw/i2c/bitbang_i2c.c47
-rw-r--r--hw/i2c/ppc4xx_i2c.c6
-rw-r--r--hw/i2c/versatile_i2c.c8
-rw-r--r--hw/mips/Kconfig30
-rw-r--r--hw/ppc/spapr_rtc.c2
-rw-r--r--hw/s390x/s390-skeys.c2
-rw-r--r--hw/timer/mc146818rtc.c4
-rw-r--r--include/hw/boards.h1
-rw-r--r--include/hw/i2c/bitbang_i2c.h38
-rw-r--r--include/hw/i2c/ppc4xx_i2c.h2
-rw-r--r--include/monitor/hmp.h (renamed from hmp.h)4
-rw-r--r--include/monitor/qdev.h1
-rw-r--r--include/sysemu/dump.h2
-rw-r--r--include/sysemu/hostmem.h2
-rw-r--r--include/sysemu/numa.h2
-rw-r--r--linux-user/fd-trans.c12
-rw-r--r--linux-user/generic/fcntl.h8
-rw-r--r--linux-user/mips/cpu_loop.c17
-rw-r--r--linux-user/mips/target_fcntl.h17
-rw-r--r--linux-user/strace.c86
-rw-r--r--linux-user/strace.list3
-rw-r--r--linux-user/syscall.c115
-rw-r--r--linux-user/syscall_defs.h37
-rw-r--r--monitor/hmp-cmds.c238
-rw-r--r--monitor/misc.c47
-rw-r--r--monitor/qmp-cmds.c315
-rw-r--r--qapi/Makefile.objs7
-rw-r--r--qapi/dump.json200
-rw-r--r--qapi/machine-target.json (renamed from qapi/target.json)300
-rw-r--r--qapi/machine.json697
-rw-r--r--qapi/misc-target.json268
-rw-r--r--qapi/misc.json1304
-rw-r--r--qapi/qapi-schema.json7
-rw-r--r--qapi/qdev.json125
-rw-r--r--qapi/qom.json244
-rw-r--r--qdev-monitor.c59
-rw-r--r--qom/Makefile.objs1
-rw-r--r--qom/qom-hmp-cmds.c120
-rw-r--r--qom/qom-qmp-cmds.c323
-rw-r--r--target/arm/helper.c2
-rw-r--r--target/arm/monitor.c2
-rw-r--r--target/i386/cpu.c4
-rw-r--r--target/i386/monitor.c2
-rw-r--r--target/i386/sev_i386.h2
-rw-r--r--target/mips/helper.c2
-rw-r--r--target/mips/msa_helper.c260
-rw-r--r--target/mips/translate.c497
-rw-r--r--target/nios2/monitor.c2
-rw-r--r--target/ppc/monitor.c2
-rw-r--r--target/ppc/translate_init.inc.c2
-rw-r--r--target/s390x/cpu.c2
-rw-r--r--target/s390x/cpu_models.c2
-rw-r--r--target/s390x/sigp.c2
-rw-r--r--target/sh4/monitor.c2
-rw-r--r--target/sparc/monitor.c2
-rw-r--r--target/xtensa/monitor.c2
-rw-r--r--tests/machine-none-test.c4
-rw-r--r--tests/tcg/mips/include/wrappers_msa.h16
-rw-r--r--tests/tcg/mips/user/ase/msa/fixed-multiply/test_msa_madd_q_h.c216
-rw-r--r--tests/tcg/mips/user/ase/msa/fixed-multiply/test_msa_madd_q_w.c216
-rw-r--r--tests/tcg/mips/user/ase/msa/fixed-multiply/test_msa_maddr_q_h.c216
-rw-r--r--tests/tcg/mips/user/ase/msa/fixed-multiply/test_msa_maddr_q_w.c216
-rw-r--r--tests/tcg/mips/user/ase/msa/fixed-multiply/test_msa_msub_q_h.c216
-rw-r--r--tests/tcg/mips/user/ase/msa/fixed-multiply/test_msa_msub_q_w.c216
-rw-r--r--tests/tcg/mips/user/ase/msa/fixed-multiply/test_msa_msubr_q_h.c216
-rw-r--r--tests/tcg/mips/user/ase/msa/fixed-multiply/test_msa_msubr_q_w.c216
-rw-r--r--tests/tcg/mips/user/ase/msa/int-multiply/test_msa_maddv_b.c224
-rw-r--r--tests/tcg/mips/user/ase/msa/int-multiply/test_msa_maddv_d.c214
-rw-r--r--tests/tcg/mips/user/ase/msa/int-multiply/test_msa_maddv_h.c224
-rw-r--r--tests/tcg/mips/user/ase/msa/int-multiply/test_msa_maddv_w.c224
-rw-r--r--tests/tcg/mips/user/ase/msa/int-multiply/test_msa_msubv_b.c224
-rw-r--r--tests/tcg/mips/user/ase/msa/int-multiply/test_msa_msubv_d.c224
-rw-r--r--tests/tcg/mips/user/ase/msa/int-multiply/test_msa_msubv_h.c224
-rw-r--r--tests/tcg/mips/user/ase/msa/int-multiply/test_msa_msubv_w.c224
-rwxr-xr-xtests/tcg/mips/user/ase/msa/test_msa_compile_32r6eb.sh32
-rwxr-xr-xtests/tcg/mips/user/ase/msa/test_msa_compile_32r6el.sh32
-rwxr-xr-xtests/tcg/mips/user/ase/msa/test_msa_compile_64r6eb.sh32
-rwxr-xr-xtests/tcg/mips/user/ase/msa/test_msa_compile_64r6el.sh32
-rw-r--r--tests/tcg/mips/user/ase/msa/test_msa_run_32r6eb.sh16
-rwxr-xr-xtests/tcg/mips/user/ase/msa/test_msa_run_32r6el.sh16
-rwxr-xr-xtests/tcg/mips/user/ase/msa/test_msa_run_64r6eb.sh16
-rwxr-xr-xtests/tcg/mips/user/ase/msa/test_msa_run_64r6el.sh16
-rw-r--r--vl.c45
105 files changed, 6334 insertions, 3849 deletions
diff --git a/MAINTAINERS b/MAINTAINERS
index 4165ac56f8..2cce50287a 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1274,11 +1274,18 @@ Machine core
 M: Eduardo Habkost <ehabkost@redhat.com>
 M: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
 S: Supported
+F: hw/core/machine-qmp-cmds.c
 F: hw/core/machine.c
 F: hw/core/null-machine.c
+F: hw/core/numa.c
 F: hw/cpu/cluster.c
+F: qapi/machine.json
+F: qapi/machine-target.json
+F: qom/cpu.c
 F: include/hw/boards.h
 F: include/hw/cpu/cluster.h
+F: include/qom/cpu.h
+F: include/sysemu/numa.h
 T: git https://github.com/ehabkost/qemu.git machine-next
 
 Xtensa Machines
@@ -1843,11 +1850,6 @@ M: Markus Armbruster <armbru@redhat.com>
 S: Supported
 F: scripts/coverity-model.c
 
-CPU
-S: Supported
-F: qom/cpu.c
-F: include/qom/cpu.h
-
 Device Tree
 M: Alistair Francis <alistair.francis@wdc.com>
 R: David Gibson <david@gibson.dropbear.id.au>
@@ -1858,11 +1860,13 @@ F: include/sysemu/device_tree.h
 Dump
 S: Supported
 M: Marc-André Lureau <marcandre.lureau@redhat.com>
-F: dump.c
+F: dump/
 F: hw/misc/vmcoreinfo.c
 F: include/hw/misc/vmcoreinfo.h
+F: include/qemu/win_dump_defs
 F: include/sysemu/dump-arch.h
 F: include/sysemu/dump.h
+F: qapi/dump.json
 F: scripts/dump-guest-memory.py
 F: stubs/dump.c
 
@@ -1956,13 +1960,6 @@ W: http://info.iet.unipi.it/~luigi/netmap/
 S: Maintained
 F: net/netmap.c
 
-NUMA
-M: Eduardo Habkost <ehabkost@redhat.com>
-S: Maintained
-F: numa.c
-F: include/sysemu/numa.h
-T: git https://github.com/ehabkost/qemu.git machine-next
-
 Host Memory Backends
 M: Eduardo Habkost <ehabkost@redhat.com>
 M: Igor Mammedov <imammedo@redhat.com>
@@ -2040,15 +2037,24 @@ F: docs/interop/qemu-ga-ref.texi
 T: git https://github.com/mdroth/qemu.git qga
 
 QOM
-M: Andreas Färber <afaerber@suse.de>
+M: Paolo Bonzini <pbonzini@redhat.com>
+R: Daniel P. Berrange <berrange@redhat.com>
+R: Eduardo Habkost <ehabkost@redhat.com>
 S: Supported
-T: git https://github.com/afaerber/qemu-cpu.git qom-next
+F: docs/qdev-device-use.txt
+F: hw/core/qdev*
+F: include/hw/qdev*
+F: include/monitor/qdev.h
 F: include/qom/
 X: include/qom/cpu.h
+F: qapi/qom.json
+F: qapi/qdev.json
+F: qdev-monitor.c
 F: qom/
 X: qom/cpu.c
 F: tests/check-qom-interface.c
 F: tests/check-qom-proplist.c
+F: tests/test-qdev-global-props.c
 
 QMP
 M: Markus Armbruster <armbru@redhat.com>
diff --git a/Makefile b/Makefile
index b1c93ac027..d657df9041 100644
--- a/Makefile
+++ b/Makefile
@@ -750,7 +750,7 @@ bepo    cz
 ifdef INSTALL_BLOBS
 BLOBS=bios.bin bios-256k.bin sgabios.bin vgabios.bin vgabios-cirrus.bin \
 vgabios-stdvga.bin vgabios-vmware.bin vgabios-qxl.bin vgabios-virtio.bin \
-vgabios-ramfb.bin vgabios-bochs-display.bin \
+vgabios-ramfb.bin vgabios-bochs-display.bin vgabios-ati.bin \
 ppc_rom.bin openbios-sparc32 openbios-sparc64 openbios-ppc QEMU,tcx.bin QEMU,cgthree.bin \
 pxe-e1000.rom pxe-eepro100.rom pxe-ne2k_pci.rom \
 pxe-pcnet.rom pxe-rtl8139.rom pxe-virtio.rom \
diff --git a/Makefile.objs b/Makefile.objs
index 3b83621f32..6a143dcd57 100644
--- a/Makefile.objs
+++ b/Makefile.objs
@@ -45,6 +45,7 @@ io-obj-y = io/
 ifeq ($(CONFIG_SOFTMMU),y)
 common-obj-y = blockdev.o blockdev-nbd.o block/
 common-obj-y += bootdevice.o iothread.o
+common-obj-y += dump/
 common-obj-y += job-qmp.o
 common-obj-y += monitor/
 common-obj-y += net/
@@ -85,7 +86,6 @@ common-obj-$(CONFIG_FDT) += device_tree.o
 # qapi
 
 common-obj-y += qapi/
-common-obj-y += monitor/
 endif
 
 #######################################################################
diff --git a/Makefile.target b/Makefile.target
index 72c267f7dc..a6919e0caf 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -148,15 +148,14 @@ endif #CONFIG_BSD_USER
 #########################################################
 # System emulator target
 ifdef CONFIG_SOFTMMU
-obj-y += arch_init.o cpus.o gdbstub.o balloon.o ioport.o numa.o
+obj-y += arch_init.o cpus.o gdbstub.o balloon.o ioport.o
 obj-y += qtest.o
+obj-y += dump/
 obj-y += hw/
 obj-y += monitor/
 obj-y += qapi/
 obj-y += memory.o
 obj-y += memory_mapping.o
-obj-y += dump.o
-obj-$(TARGET_X86_64) += win_dump.o
 obj-y += migration/ram.o
 LIBS := $(libs_softmmu) $(LIBS)
 
diff --git a/cpus.c b/cpus.c
index 1af51b73dd..eef7b007ae 100644
--- a/cpus.c
+++ b/cpus.c
@@ -25,7 +25,6 @@
 #include "qemu/osdep.h"
 #include "qemu-common.h"
 #include "qemu/config-file.h"
-#include "cpu.h"
 #include "monitor/monitor.h"
 #include "qapi/error.h"
 #include "qapi/qapi-commands-misc.h"
@@ -33,7 +32,6 @@
 #include "qapi/qmp/qerror.h"
 #include "qemu/error-report.h"
 #include "qemu/qemu-print.h"
-#include "sysemu/sysemu.h"
 #include "sysemu/tcg.h"
 #include "sysemu/block-backend.h"
 #include "exec/gdbstub.h"
@@ -56,7 +54,6 @@
 #include "tcg.h"
 #include "hw/nmi.h"
 #include "sysemu/replay.h"
-#include "hw/boards.h"
 
 #ifdef CONFIG_LINUX
 
@@ -2200,190 +2197,6 @@ void list_cpus(const char *optarg)
 #endif
 }
 
-CpuInfoList *qmp_query_cpus(Error **errp)
-{
-    MachineState *ms = MACHINE(qdev_get_machine());
-    MachineClass *mc = MACHINE_GET_CLASS(ms);
-    CpuInfoList *head = NULL, *cur_item = NULL;
-    CPUState *cpu;
-
-    CPU_FOREACH(cpu) {
-        CpuInfoList *info;
-#if defined(TARGET_I386)
-        X86CPU *x86_cpu = X86_CPU(cpu);
-        CPUX86State *env = &x86_cpu->env;
-#elif defined(TARGET_PPC)
-        PowerPCCPU *ppc_cpu = POWERPC_CPU(cpu);
-        CPUPPCState *env = &ppc_cpu->env;
-#elif defined(TARGET_SPARC)
-        SPARCCPU *sparc_cpu = SPARC_CPU(cpu);
-        CPUSPARCState *env = &sparc_cpu->env;
-#elif defined(TARGET_RISCV)
-        RISCVCPU *riscv_cpu = RISCV_CPU(cpu);
-        CPURISCVState *env = &riscv_cpu->env;
-#elif defined(TARGET_MIPS)
-        MIPSCPU *mips_cpu = MIPS_CPU(cpu);
-        CPUMIPSState *env = &mips_cpu->env;
-#elif defined(TARGET_TRICORE)
-        TriCoreCPU *tricore_cpu = TRICORE_CPU(cpu);
-        CPUTriCoreState *env = &tricore_cpu->env;
-#elif defined(TARGET_S390X)
-        S390CPU *s390_cpu = S390_CPU(cpu);
-        CPUS390XState *env = &s390_cpu->env;
-#endif
-
-        cpu_synchronize_state(cpu);
-
-        info = g_malloc0(sizeof(*info));
-        info->value = g_malloc0(sizeof(*info->value));
-        info->value->CPU = cpu->cpu_index;
-        info->value->current = (cpu == first_cpu);
-        info->value->halted = cpu->halted;
-        info->value->qom_path = object_get_canonical_path(OBJECT(cpu));
-        info->value->thread_id = cpu->thread_id;
-#if defined(TARGET_I386)
-        info->value->arch = CPU_INFO_ARCH_X86;
-        info->value->u.x86.pc = env->eip + env->segs[R_CS].base;
-#elif defined(TARGET_PPC)
-        info->value->arch = CPU_INFO_ARCH_PPC;
-        info->value->u.ppc.nip = env->nip;
-#elif defined(TARGET_SPARC)
-        info->value->arch = CPU_INFO_ARCH_SPARC;
-        info->value->u.q_sparc.pc = env->pc;
-        info->value->u.q_sparc.npc = env->npc;
-#elif defined(TARGET_MIPS)
-        info->value->arch = CPU_INFO_ARCH_MIPS;
-        info->value->u.q_mips.PC = env->active_tc.PC;
-#elif defined(TARGET_TRICORE)
-        info->value->arch = CPU_INFO_ARCH_TRICORE;
-        info->value->u.tricore.PC = env->PC;
-#elif defined(TARGET_S390X)
-        info->value->arch = CPU_INFO_ARCH_S390;
-        info->value->u.s390.cpu_state = env->cpu_state;
-#elif defined(TARGET_RISCV)
-        info->value->arch = CPU_INFO_ARCH_RISCV;
-        info->value->u.riscv.pc = env->pc;
-#else
-        info->value->arch = CPU_INFO_ARCH_OTHER;
-#endif
-        info->value->has_props = !!mc->cpu_index_to_instance_props;
-        if (info->value->has_props) {
-            CpuInstanceProperties *props;
-            props = g_malloc0(sizeof(*props));
-            *props = mc->cpu_index_to_instance_props(ms, cpu->cpu_index);
-            info->value->props = props;
-        }
-
-        /* XXX: waiting for the qapi to support GSList */
-        if (!cur_item) {
-            head = cur_item = info;
-        } else {
-            cur_item->next = info;
-            cur_item = info;
-        }
-    }
-
-    return head;
-}
-
-static CpuInfoArch sysemu_target_to_cpuinfo_arch(SysEmuTarget target)
-{
-    /*
-     * The @SysEmuTarget -> @CpuInfoArch mapping below is based on the
-     * TARGET_ARCH -> TARGET_BASE_ARCH mapping in the "configure" script.
-     */
-    switch (target) {
-    case SYS_EMU_TARGET_I386:
-    case SYS_EMU_TARGET_X86_64:
-        return CPU_INFO_ARCH_X86;
-
-    case SYS_EMU_TARGET_PPC:
-    case SYS_EMU_TARGET_PPC64:
-        return CPU_INFO_ARCH_PPC;
-
-    case SYS_EMU_TARGET_SPARC:
-    case SYS_EMU_TARGET_SPARC64:
-        return CPU_INFO_ARCH_SPARC;
-
-    case SYS_EMU_TARGET_MIPS:
-    case SYS_EMU_TARGET_MIPSEL:
-    case SYS_EMU_TARGET_MIPS64:
-    case SYS_EMU_TARGET_MIPS64EL:
-        return CPU_INFO_ARCH_MIPS;
-
-    case SYS_EMU_TARGET_TRICORE:
-        return CPU_INFO_ARCH_TRICORE;
-
-    case SYS_EMU_TARGET_S390X:
-        return CPU_INFO_ARCH_S390;
-
-    case SYS_EMU_TARGET_RISCV32:
-    case SYS_EMU_TARGET_RISCV64:
-        return CPU_INFO_ARCH_RISCV;
-
-    default:
-        return CPU_INFO_ARCH_OTHER;
-    }
-}
-
-static void cpustate_to_cpuinfo_s390(CpuInfoS390 *info, const CPUState *cpu)
-{
-#ifdef TARGET_S390X
-    S390CPU *s390_cpu = S390_CPU(cpu);
-    CPUS390XState *env = &s390_cpu->env;
-
-    info->cpu_state = env->cpu_state;
-#else
-    abort();
-#endif
-}
-
-/*
- * fast means: we NEVER interrupt vCPU threads to retrieve
- * information from KVM.
- */
-CpuInfoFastList *qmp_query_cpus_fast(Error **errp)
-{
-    MachineState *ms = MACHINE(qdev_get_machine());
-    MachineClass *mc = MACHINE_GET_CLASS(ms);
-    CpuInfoFastList *head = NULL, *cur_item = NULL;
-    SysEmuTarget target = qapi_enum_parse(&SysEmuTarget_lookup, TARGET_NAME,
-                                          -1, &error_abort);
-    CPUState *cpu;
-
-    CPU_FOREACH(cpu) {
-        CpuInfoFastList *info = g_malloc0(sizeof(*info));
-        info->value = g_malloc0(sizeof(*info->value));
-
-        info->value->cpu_index = cpu->cpu_index;
-        info->value->qom_path = object_get_canonical_path(OBJECT(cpu));
-        info->value->thread_id = cpu->thread_id;
-
-        info->value->has_props = !!mc->cpu_index_to_instance_props;
-        if (info->value->has_props) {
-            CpuInstanceProperties *props;
-            props = g_malloc0(sizeof(*props));
-            *props = mc->cpu_index_to_instance_props(ms, cpu->cpu_index);
-            info->value->props = props;
-        }
-
-        info->value->arch = sysemu_target_to_cpuinfo_arch(target);
-        info->value->target = target;
-        if (target == SYS_EMU_TARGET_S390X) {
-            cpustate_to_cpuinfo_s390(&info->value->u.s390x, cpu);
-        }
-
-        if (!cur_item) {
-            head = cur_item = info;
-        } else {
-            cur_item->next = info;
-            cur_item = info;
-        }
-    }
-
-    return head;
-}
-
 void qmp_memsave(int64_t addr, int64_t size, const char *filename,
                  bool has_cpu, int64_t cpu_index, Error **errp)
 {
diff --git a/default-configs/mips-softmmu-common.mak b/default-configs/mips-softmmu-common.mak
index e10ac4b20c..da29c6c0b2 100644
--- a/default-configs/mips-softmmu-common.mak
+++ b/default-configs/mips-softmmu-common.mak
@@ -1,9 +1,11 @@
 # Common mips*-softmmu CONFIG defines
 
+# CONFIG_SEMIHOSTING is always required on this architecture
+CONFIG_SEMIHOSTING=y
+
 CONFIG_ISA_BUS=y
 CONFIG_PCI=y
 CONFIG_PCI_DEVICES=y
-CONFIG_ESP=y
 CONFIG_VGA_ISA=y
 CONFIG_VGA_ISA_MM=y
 CONFIG_VGA_CIRRUS=y
@@ -25,8 +27,6 @@ CONFIG_I8257=y
 CONFIG_PIIX4=y
 CONFIG_IDE_ISA=y
 CONFIG_IDE_PIIX=y
-CONFIG_NE2000_ISA=y
-CONFIG_MIPSNET=y
 CONFIG_PFLASH_CFI01=y
 CONFIG_I8259=y
 CONFIG_MC146818RTC=y
@@ -35,7 +35,6 @@ CONFIG_MIPS_CPS=y
 CONFIG_MIPS_ITU=y
 CONFIG_R4K=y
 CONFIG_MALTA=y
-CONFIG_SEMIHOSTING=y
 CONFIG_PCNET_PCI=y
 CONFIG_MIPSSIM=y
 CONFIG_ACPI_SMBUS=y
diff --git a/default-configs/mips64-softmmu.mak b/default-configs/mips64-softmmu.mak
index bad7496672..a169738635 100644
--- a/default-configs/mips64-softmmu.mak
+++ b/default-configs/mips64-softmmu.mak
@@ -1,9 +1,4 @@
 # Default configuration for mips64-softmmu
 
 include mips-softmmu-common.mak
-CONFIG_RC4030=y
-CONFIG_DP8393X=y
-CONFIG_DS1225Y=y
 CONFIG_JAZZ=y
-CONFIG_G364FB=y
-CONFIG_JAZZ_LED=y
diff --git a/default-configs/mips64el-softmmu.mak b/default-configs/mips64el-softmmu.mak
index a67c9517a2..8b0c9b1e15 100644
--- a/default-configs/mips64el-softmmu.mak
+++ b/default-configs/mips64el-softmmu.mak
@@ -2,15 +2,10 @@
 
 include mips-softmmu-common.mak
 CONFIG_IDE_VIA=y
-CONFIG_RC4030=y
-CONFIG_DP8393X=y
-CONFIG_DS1225Y=y
 CONFIG_FULONG=y
 CONFIG_ATI_VGA=y
 CONFIG_RTL8139_PCI=y
 CONFIG_JAZZ=y
-CONFIG_G364FB=y
-CONFIG_JAZZ_LED=y
 CONFIG_VT82C686=y
 CONFIG_AHCI=y
 CONFIG_MIPS_BOSTON=y
diff --git a/dump/Makefile.objs b/dump/Makefile.objs
new file mode 100644
index 0000000000..d2a5db3b81
--- /dev/null
+++ b/dump/Makefile.objs
@@ -0,0 +1,3 @@
+obj-y += dump.o
+common-obj-y += dump-hmp-cmds.o
+obj-$(TARGET_X86_64) += win_dump.o
diff --git a/dump/dump-hmp-cmds.c b/dump/dump-hmp-cmds.c
new file mode 100644
index 0000000000..3dbf44372c
--- /dev/null
+++ b/dump/dump-hmp-cmds.c
@@ -0,0 +1,88 @@
+/*
+ * Human Monitor Interface commands
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+
+#include "qemu/osdep.h"
+#include "monitor/hmp.h"
+#include "monitor/monitor.h"
+#include "qapi/error.h"
+#include "qapi/qapi-commands-dump.h"
+#include "qapi/qmp/qdict.h"
+
+void hmp_dump_guest_memory(Monitor *mon, const QDict *qdict)
+{
+    Error *err = NULL;
+    bool win_dmp = qdict_get_try_bool(qdict, "windmp", false);
+    bool paging = qdict_get_try_bool(qdict, "paging", false);
+    bool zlib = qdict_get_try_bool(qdict, "zlib", false);
+    bool lzo = qdict_get_try_bool(qdict, "lzo", false);
+    bool snappy = qdict_get_try_bool(qdict, "snappy", false);
+    const char *file = qdict_get_str(qdict, "filename");
+    bool has_begin = qdict_haskey(qdict, "begin");
+    bool has_length = qdict_haskey(qdict, "length");
+    bool has_detach = qdict_haskey(qdict, "detach");
+    int64_t begin = 0;
+    int64_t length = 0;
+    bool detach = false;
+    enum DumpGuestMemoryFormat dump_format = DUMP_GUEST_MEMORY_FORMAT_ELF;
+    char *prot;
+
+    if (zlib + lzo + snappy + win_dmp > 1) {
+        error_setg(&err, "only one of '-z|-l|-s|-w' can be set");
+        hmp_handle_error(mon, &err);
+        return;
+    }
+
+    if (win_dmp) {
+        dump_format = DUMP_GUEST_MEMORY_FORMAT_WIN_DMP;
+    }
+
+    if (zlib) {
+        dump_format = DUMP_GUEST_MEMORY_FORMAT_KDUMP_ZLIB;
+    }
+
+    if (lzo) {
+        dump_format = DUMP_GUEST_MEMORY_FORMAT_KDUMP_LZO;
+    }
+
+    if (snappy) {
+        dump_format = DUMP_GUEST_MEMORY_FORMAT_KDUMP_SNAPPY;
+    }
+
+    if (has_begin) {
+        begin = qdict_get_int(qdict, "begin");
+    }
+    if (has_length) {
+        length = qdict_get_int(qdict, "length");
+    }
+    if (has_detach) {
+        detach = qdict_get_bool(qdict, "detach");
+    }
+
+    prot = g_strconcat("file:", file, NULL);
+
+    qmp_dump_guest_memory(paging, prot, true, detach, has_begin, begin,
+                          has_length, length, true, dump_format, &err);
+    hmp_handle_error(mon, &err);
+    g_free(prot);
+}
+
+void hmp_info_dump(Monitor *mon, const QDict *qdict)
+{
+    DumpQueryResult *result = qmp_query_dump(NULL);
+
+    assert(result && result->status < DUMP_STATUS__MAX);
+    monitor_printf(mon, "Status: %s\n", DumpStatus_str(result->status));
+
+    if (result->status == DUMP_STATUS_ACTIVE) {
+        float percent = 0;
+        assert(result->total != 0);
+        percent = 100.0 * result->completed / result->total;
+        monitor_printf(mon, "Finished: %.2f %%\n", percent);
+    }
+
+    qapi_free_DumpQueryResult(result);
+}
diff --git a/dump.c b/dump/dump.c
index e99554628c..c7b2301652 100644
--- a/dump.c
+++ b/dump/dump.c
@@ -24,8 +24,8 @@
 #include "sysemu/memory_mapping.h"
 #include "sysemu/cpus.h"
 #include "qapi/error.h"
-#include "qapi/qapi-commands-misc.h"
-#include "qapi/qapi-events-misc.h"
+#include "qapi/qapi-commands-dump.h"
+#include "qapi/qapi-events-dump.h"
 #include "qapi/qmp/qerror.h"
 #include "qemu/error-report.h"
 #include "hw/misc/vmcoreinfo.h"
diff --git a/win_dump.c b/dump/win_dump.c
index 0142655d3d..0142655d3d 100644
--- a/win_dump.c
+++ b/dump/win_dump.c
diff --git a/win_dump.h b/dump/win_dump.h
index b8c25348f4..b8c25348f4 100644
--- a/win_dump.h
+++ b/dump/win_dump.h
diff --git a/hw/block/xen-block.c b/hw/block/xen-block.c
index 8f224ef81d..69d73196e2 100644
--- a/hw/block/xen-block.c
+++ b/hw/block/xen-block.c
@@ -11,7 +11,7 @@
 #include "qemu/option.h"
 #include "qapi/error.h"
 #include "qapi/qapi-commands-block-core.h"
-#include "qapi/qapi-commands-misc.h"
+#include "qapi/qapi-commands-qom.h"
 #include "qapi/qapi-visit-block-core.h"
 #include "qapi/qobject-input-visitor.h"
 #include "qapi/visitor.h"
diff --git a/hw/core/Makefile.objs b/hw/core/Makefile.objs
index a799c83815..585b734358 100644
--- a/hw/core/Makefile.objs
+++ b/hw/core/Makefile.objs
@@ -22,3 +22,7 @@ common-obj-$(CONFIG_SOFTMMU) += split-irq.o
 common-obj-$(CONFIG_PLATFORM_BUS) += platform-bus.o
 common-obj-$(CONFIG_SOFTMMU) += generic-loader.o
 common-obj-$(CONFIG_SOFTMMU) += null-machine.o
+
+obj-$(CONFIG_SOFTMMU) += machine-qmp-cmds.o
+obj-$(CONFIG_SOFTMMU) += numa.o
+common-obj-$(CONFIG_SOFTMMU) += machine-hmp-cmds.o
diff --git a/hw/core/machine-hmp-cmds.c b/hw/core/machine-hmp-cmds.c
new file mode 100644
index 0000000000..7fa6075f1e
--- /dev/null
+++ b/hw/core/machine-hmp-cmds.c
@@ -0,0 +1,164 @@
+/*
+ * HMP commands related to machines and CPUs
+ *
+ * Copyright IBM, Corp. 2011
+ *
+ * Authors:
+ *  Anthony Liguori   <aliguori@us.ibm.com>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2.  See
+ * the COPYING file in the top-level directory.
+ *
+ * Contributions after 2012-01-13 are licensed under the terms of the
+ * GNU GPL, version 2 or (at your option) any later version.
+ */
+
+#include "qemu/osdep.h"
+#include "monitor/hmp.h"
+#include "monitor/monitor.h"
+#include "qapi/error.h"
+#include "qapi/qapi-builtin-visit.h"
+#include "qapi/qapi-commands-machine.h"
+#include "qapi/qmp/qdict.h"
+#include "qapi/string-output-visitor.h"
+#include "qemu/error-report.h"
+#include "sysemu/numa.h"
+
+void hmp_info_cpus(Monitor *mon, const QDict *qdict)
+{
+    CpuInfoFastList *cpu_list, *cpu;
+
+    cpu_list = qmp_query_cpus_fast(NULL);
+
+    for (cpu = cpu_list; cpu; cpu = cpu->next) {
+        int active = ' ';
+
+        if (cpu->value->cpu_index == monitor_get_cpu_index()) {
+            active = '*';
+        }
+
+        monitor_printf(mon, "%c CPU #%" PRId64 ":", active,
+                       cpu->value->cpu_index);
+        monitor_printf(mon, " thread_id=%" PRId64 "\n", cpu->value->thread_id);
+    }
+
+    qapi_free_CpuInfoFastList(cpu_list);
+}
+
+void hmp_cpu_add(Monitor *mon, const QDict *qdict)
+{
+    int cpuid;
+    Error *err = NULL;
+
+    error_report("cpu_add is deprecated, please use device_add instead");
+
+    cpuid = qdict_get_int(qdict, "id");
+    qmp_cpu_add(cpuid, &err);
+    hmp_handle_error(mon, &err);
+}
+
+void hmp_hotpluggable_cpus(Monitor *mon, const QDict *qdict)
+{
+    Error *err = NULL;
+    HotpluggableCPUList *l = qmp_query_hotpluggable_cpus(&err);
+    HotpluggableCPUList *saved = l;
+    CpuInstanceProperties *c;
+
+    if (err != NULL) {
+        hmp_handle_error(mon, &err);
+        return;
+    }
+
+    monitor_printf(mon, "Hotpluggable CPUs:\n");
+    while (l) {
+        monitor_printf(mon, "  type: \"%s\"\n", l->value->type);
+        monitor_printf(mon, "  vcpus_count: \"%" PRIu64 "\"\n",
+                       l->value->vcpus_count);
+        if (l->value->has_qom_path) {
+            monitor_printf(mon, "  qom_path: \"%s\"\n", l->value->qom_path);
+        }
+
+        c = l->value->props;
+        monitor_printf(mon, "  CPUInstance Properties:\n");
+        if (c->has_node_id) {
+            monitor_printf(mon, "    node-id: \"%" PRIu64 "\"\n", c->node_id);
+        }
+        if (c->has_socket_id) {
+            monitor_printf(mon, "    socket-id: \"%" PRIu64 "\"\n", c->socket_id);
+        }
+        if (c->has_core_id) {
+            monitor_printf(mon, "    core-id: \"%" PRIu64 "\"\n", c->core_id);
+        }
+        if (c->has_thread_id) {
+            monitor_printf(mon, "    thread-id: \"%" PRIu64 "\"\n", c->thread_id);
+        }
+
+        l = l->next;
+    }
+
+    qapi_free_HotpluggableCPUList(saved);
+}
+
+void hmp_info_memdev(Monitor *mon, const QDict *qdict)
+{
+    Error *err = NULL;
+    MemdevList *memdev_list = qmp_query_memdev(&err);
+    MemdevList *m = memdev_list;
+    Visitor *v;
+    char *str;
+
+    while (m) {
+        v = string_output_visitor_new(false, &str);
+        visit_type_uint16List(v, NULL, &m->value->host_nodes, NULL);
+        monitor_printf(mon, "memory backend: %s\n", m->value->id);
+        monitor_printf(mon, "  size:  %" PRId64 "\n", m->value->size);
+        monitor_printf(mon, "  merge: %s\n",
+                       m->value->merge ? "true" : "false");
+        monitor_printf(mon, "  dump: %s\n",
+                       m->value->dump ? "true" : "false");
+        monitor_printf(mon, "  prealloc: %s\n",
+                       m->value->prealloc ? "true" : "false");
+        monitor_printf(mon, "  policy: %s\n",
+                       HostMemPolicy_str(m->value->policy));
+        visit_complete(v, &str);
+        monitor_printf(mon, "  host nodes: %s\n", str);
+
+        g_free(str);
+        visit_free(v);
+        m = m->next;
+    }
+
+    monitor_printf(mon, "\n");
+
+    qapi_free_MemdevList(memdev_list);
+    hmp_handle_error(mon, &err);
+}
+
+void hmp_info_numa(Monitor *mon, const QDict *qdict)
+{
+    int i;
+    NumaNodeMem *node_mem;
+    CpuInfoList *cpu_list, *cpu;
+
+    cpu_list = qmp_query_cpus(&error_abort);
+    node_mem = g_new0(NumaNodeMem, nb_numa_nodes);
+
+    query_numa_node_mem(node_mem);
+    monitor_printf(mon, "%d nodes\n", nb_numa_nodes);
+    for (i = 0; i < nb_numa_nodes; i++) {
+        monitor_printf(mon, "node %d cpus:", i);
+        for (cpu = cpu_list; cpu; cpu = cpu->next) {
+            if (cpu->value->has_props && cpu->value->props->has_node_id &&
+                cpu->value->props->node_id == i) {
+                monitor_printf(mon, " %" PRIi64, cpu->value->CPU);
+            }
+        }
+        monitor_printf(mon, "\n");
+        monitor_printf(mon, "node %d size: %" PRId64 " MB\n", i,
+                       node_mem[i].node_mem >> 20);
+        monitor_printf(mon, "node %d plugged: %" PRId64 " MB\n", i,
+                       node_mem[i].node_plugged_mem >> 20);
+    }
+    qapi_free_CpuInfoList(cpu_list);
+    g_free(node_mem);
+}
diff --git a/hw/core/machine-qmp-cmds.c b/hw/core/machine-qmp-cmds.c
new file mode 100644
index 0000000000..1e08252af7
--- /dev/null
+++ b/hw/core/machine-qmp-cmds.c
@@ -0,0 +1,328 @@
+/*
+ * QMP commands related to machines and CPUs
+ *
+ * Copyright (C) 2014 Red Hat Inc
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+
+#include "qemu/osdep.h"
+#include "cpu.h"
+#include "hw/boards.h"
+#include "qapi/error.h"
+#include "qapi/qapi-commands-machine.h"
+#include "qapi/qmp/qerror.h"
+#include "sysemu/hostmem.h"
+#include "sysemu/hw_accel.h"
+#include "sysemu/numa.h"
+#include "sysemu/sysemu.h"
+
+CpuInfoList *qmp_query_cpus(Error **errp)
+{
+    MachineState *ms = MACHINE(qdev_get_machine());
+    MachineClass *mc = MACHINE_GET_CLASS(ms);
+    CpuInfoList *head = NULL, *cur_item = NULL;
+    CPUState *cpu;
+
+    CPU_FOREACH(cpu) {
+        CpuInfoList *info;
+#if defined(TARGET_I386)
+        X86CPU *x86_cpu = X86_CPU(cpu);
+        CPUX86State *env = &x86_cpu->env;
+#elif defined(TARGET_PPC)
+        PowerPCCPU *ppc_cpu = POWERPC_CPU(cpu);
+        CPUPPCState *env = &ppc_cpu->env;
+#elif defined(TARGET_SPARC)
+        SPARCCPU *sparc_cpu = SPARC_CPU(cpu);
+        CPUSPARCState *env = &sparc_cpu->env;
+#elif defined(TARGET_RISCV)
+        RISCVCPU *riscv_cpu = RISCV_CPU(cpu);
+        CPURISCVState *env = &riscv_cpu->env;
+#elif defined(TARGET_MIPS)
+        MIPSCPU *mips_cpu = MIPS_CPU(cpu);
+        CPUMIPSState *env = &mips_cpu->env;
+#elif defined(TARGET_TRICORE)
+        TriCoreCPU *tricore_cpu = TRICORE_CPU(cpu);
+        CPUTriCoreState *env = &tricore_cpu->env;
+#elif defined(TARGET_S390X)
+        S390CPU *s390_cpu = S390_CPU(cpu);
+        CPUS390XState *env = &s390_cpu->env;
+#endif
+
+        cpu_synchronize_state(cpu);
+
+        info = g_malloc0(sizeof(*info));
+        info->value = g_malloc0(sizeof(*info->value));
+        info->value->CPU = cpu->cpu_index;
+        info->value->current = (cpu == first_cpu);
+        info->value->halted = cpu->halted;
+        info->value->qom_path = object_get_canonical_path(OBJECT(cpu));
+        info->value->thread_id = cpu->thread_id;
+#if defined(TARGET_I386)
+        info->value->arch = CPU_INFO_ARCH_X86;
+        info->value->u.x86.pc = env->eip + env->segs[R_CS].base;
+#elif defined(TARGET_PPC)
+        info->value->arch = CPU_INFO_ARCH_PPC;
+        info->value->u.ppc.nip = env->nip;
+#elif defined(TARGET_SPARC)
+        info->value->arch = CPU_INFO_ARCH_SPARC;
+        info->value->u.q_sparc.pc = env->pc;
+        info->value->u.q_sparc.npc = env->npc;
+#elif defined(TARGET_MIPS)
+        info->value->arch = CPU_INFO_ARCH_MIPS;
+        info->value->u.q_mips.PC = env->active_tc.PC;
+#elif defined(TARGET_TRICORE)
+        info->value->arch = CPU_INFO_ARCH_TRICORE;
+        info->value->u.tricore.PC = env->PC;
+#elif defined(TARGET_S390X)
+        info->value->arch = CPU_INFO_ARCH_S390;
+        info->value->u.s390.cpu_state = env->cpu_state;
+#elif defined(TARGET_RISCV)
+        info->value->arch = CPU_INFO_ARCH_RISCV;
+        info->value->u.riscv.pc = env->pc;
+#else
+        info->value->arch = CPU_INFO_ARCH_OTHER;
+#endif
+        info->value->has_props = !!mc->cpu_index_to_instance_props;
+        if (info->value->has_props) {
+            CpuInstanceProperties *props;
+            props = g_malloc0(sizeof(*props));
+            *props = mc->cpu_index_to_instance_props(ms, cpu->cpu_index);
+            info->value->props = props;
+        }
+
+        /* XXX: waiting for the qapi to support GSList */
+        if (!cur_item) {
+            head = cur_item = info;
+        } else {
+            cur_item->next = info;
+            cur_item = info;
+        }
+    }
+
+    return head;
+}
+
+static CpuInfoArch sysemu_target_to_cpuinfo_arch(SysEmuTarget target)
+{
+    /*
+     * The @SysEmuTarget -> @CpuInfoArch mapping below is based on the
+     * TARGET_ARCH -> TARGET_BASE_ARCH mapping in the "configure" script.
+     */
+    switch (target) {
+    case SYS_EMU_TARGET_I386:
+    case SYS_EMU_TARGET_X86_64:
+        return CPU_INFO_ARCH_X86;
+
+    case SYS_EMU_TARGET_PPC:
+    case SYS_EMU_TARGET_PPC64:
+        return CPU_INFO_ARCH_PPC;
+
+    case SYS_EMU_TARGET_SPARC:
+    case SYS_EMU_TARGET_SPARC64:
+        return CPU_INFO_ARCH_SPARC;
+
+    case SYS_EMU_TARGET_MIPS:
+    case SYS_EMU_TARGET_MIPSEL:
+    case SYS_EMU_TARGET_MIPS64:
+    case SYS_EMU_TARGET_MIPS64EL:
+        return CPU_INFO_ARCH_MIPS;
+
+    case SYS_EMU_TARGET_TRICORE:
+        return CPU_INFO_ARCH_TRICORE;
+
+    case SYS_EMU_TARGET_S390X:
+        return CPU_INFO_ARCH_S390;
+
+    case SYS_EMU_TARGET_RISCV32:
+    case SYS_EMU_TARGET_RISCV64:
+        return CPU_INFO_ARCH_RISCV;
+
+    default:
+        return CPU_INFO_ARCH_OTHER;
+    }
+}
+
+static void cpustate_to_cpuinfo_s390(CpuInfoS390 *info, const CPUState *cpu)
+{
+#ifdef TARGET_S390X
+    S390CPU *s390_cpu = S390_CPU(cpu);
+    CPUS390XState *env = &s390_cpu->env;
+
+    info->cpu_state = env->cpu_state;
+#else
+    abort();
+#endif
+}
+
+/*
+ * fast means: we NEVER interrupt vCPU threads to retrieve
+ * information from KVM.
+ */
+CpuInfoFastList *qmp_query_cpus_fast(Error **errp)
+{
+    MachineState *ms = MACHINE(qdev_get_machine());
+    MachineClass *mc = MACHINE_GET_CLASS(ms);
+    CpuInfoFastList *head = NULL, *cur_item = NULL;
+    SysEmuTarget target = qapi_enum_parse(&SysEmuTarget_lookup, TARGET_NAME,
+                                          -1, &error_abort);
+    CPUState *cpu;
+
+    CPU_FOREACH(cpu) {
+        CpuInfoFastList *info = g_malloc0(sizeof(*info));
+        info->value = g_malloc0(sizeof(*info->value));
+
+        info->value->cpu_index = cpu->cpu_index;
+        info->value->qom_path = object_get_canonical_path(OBJECT(cpu));
+        info->value->thread_id = cpu->thread_id;
+
+        info->value->has_props = !!mc->cpu_index_to_instance_props;
+        if (info->value->has_props) {
+            CpuInstanceProperties *props;
+            props = g_malloc0(sizeof(*props));
+            *props = mc->cpu_index_to_instance_props(ms, cpu->cpu_index);
+            info->value->props = props;
+        }
+
+        info->value->arch = sysemu_target_to_cpuinfo_arch(target);
+        info->value->target = target;
+        if (target == SYS_EMU_TARGET_S390X) {
+            cpustate_to_cpuinfo_s390(&info->value->u.s390x, cpu);
+        }
+
+        if (!cur_item) {
+            head = cur_item = info;
+        } else {
+            cur_item->next = info;
+            cur_item = info;
+        }
+    }
+
+    return head;
+}
+
+MachineInfoList *qmp_query_machines(Error **errp)
+{
+    GSList *el, *machines = object_class_get_list(TYPE_MACHINE, false);
+    MachineInfoList *mach_list = NULL;
+
+    for (el = machines; el; el = el->next) {
+        MachineClass *mc = el->data;
+        MachineInfoList *entry;
+        MachineInfo *info;
+
+        info = g_malloc0(sizeof(*info));
+        if (mc->is_default) {
+            info->has_is_default = true;
+            info->is_default = true;
+        }
+
+        if (mc->alias) {
+            info->has_alias = true;
+            info->alias = g_strdup(mc->alias);
+        }
+
+        info->name = g_strdup(mc->name);
+        info->cpu_max = !mc->max_cpus ? 1 : mc->max_cpus;
+        info->hotpluggable_cpus = mc->has_hotpluggable_cpus;
+
+        entry = g_malloc0(sizeof(*entry));
+        entry->value = info;
+        entry->next = mach_list;
+        mach_list = entry;
+    }
+
+    g_slist_free(machines);
+    return mach_list;
+}
+
+CurrentMachineParams *qmp_query_current_machine(Error **errp)
+{
+    CurrentMachineParams *params = g_malloc0(sizeof(*params));
+    params->wakeup_suspend_support = qemu_wakeup_suspend_enabled();
+
+    return params;
+}
+
+HotpluggableCPUList *qmp_query_hotpluggable_cpus(Error **errp)
+{
+    MachineState *ms = MACHINE(qdev_get_machine());
+    MachineClass *mc = MACHINE_GET_CLASS(ms);
+
+    if (!mc->has_hotpluggable_cpus) {
+        error_setg(errp, QERR_FEATURE_DISABLED, "query-hotpluggable-cpus");
+        return NULL;
+    }
+
+    return machine_query_hotpluggable_cpus(ms);
+}
+
+void qmp_cpu_add(int64_t id, Error **errp)
+{
+    MachineClass *mc;
+
+    mc = MACHINE_GET_CLASS(current_machine);
+    if (mc->hot_add_cpu) {
+        mc->hot_add_cpu(id, errp);
+    } else {
+        error_setg(errp, "Not supported");
+    }
+}
+
+void qmp_set_numa_node(NumaOptions *cmd, Error **errp)
+{
+    if (!runstate_check(RUN_STATE_PRECONFIG)) {
+        error_setg(errp, "The command is permitted only in '%s' state",
+                   RunState_str(RUN_STATE_PRECONFIG));
+         return;
+    }
+
+    set_numa_options(MACHINE(qdev_get_machine()), cmd, errp);
+}
+
+static int query_memdev(Object *obj, void *opaque)
+{
+    MemdevList **list = opaque;
+    MemdevList *m = NULL;
+
+    if (object_dynamic_cast(obj, TYPE_MEMORY_BACKEND)) {
+        m = g_malloc0(sizeof(*m));
+
+        m->value = g_malloc0(sizeof(*m->value));
+
+        m->value->id = object_get_canonical_path_component(obj);
+        m->value->has_id = !!m->value->id;
+
+        m->value->size = object_property_get_uint(obj, "size",
+                                                  &error_abort);
+        m->value->merge = object_property_get_bool(obj, "merge",
+                                                   &error_abort);
+        m->value->dump = object_property_get_bool(obj, "dump",
+                                                  &error_abort);
+        m->value->prealloc = object_property_get_bool(obj,
+                                                      "prealloc",
+                                                      &error_abort);
+        m->value->policy = object_property_get_enum(obj,
+                                                    "policy",
+                                                    "HostMemPolicy",
+                                                    &error_abort);
+        object_property_get_uint16List(obj, "host-nodes",
+                                       &m->value->host_nodes,
+                                       &error_abort);
+
+        m->next = *list;
+        *list = m;
+    }
+
+    return 0;
+}
+
+MemdevList *qmp_query_memdev(Error **errp)
+{
+    Object *obj = object_get_objects_root();
+    MemdevList *list = NULL;
+
+    object_child_foreach(obj, query_memdev, &list);
+    return list;
+}
diff --git a/numa.c b/hw/core/numa.c
index 955ec0c830..76c447f90a 100644
--- a/numa.c
+++ b/hw/core/numa.c
@@ -27,14 +27,10 @@
 #include "exec/cpu-common.h"
 #include "exec/ramlist.h"
 #include "qemu/bitmap.h"
-#include "qom/cpu.h"
 #include "qemu/error-report.h"
 #include "qapi/error.h"
 #include "qapi/opts-visitor.h"
-#include "qapi/qapi-commands-misc.h"
-#include "qapi/qapi-visit-misc.h"
-#include "hw/boards.h"
-#include "sysemu/hostmem.h"
+#include "qapi/qapi-visit-machine.h"
 #include "hw/mem/pc-dimm.h"
 #include "hw/mem/memory-device.h"
 #include "qemu/option.h"
@@ -174,7 +170,6 @@ static void parse_numa_distance(NumaDistOptions *dist, Error **errp)
     have_numa_distance = true;
 }
 
-static
 void set_numa_options(MachineState *ms, NumaOptions *object, Error **errp)
 {
     Error *err = NULL;
@@ -447,17 +442,6 @@ void parse_numa_opts(MachineState *ms)
     qemu_opts_foreach(qemu_find_opts("numa"), parse_numa, ms, &error_fatal);
 }
 
-void qmp_set_numa_node(NumaOptions *cmd, Error **errp)
-{
-    if (!runstate_check(RUN_STATE_PRECONFIG)) {
-        error_setg(errp, "The command is permitted only in '%s' state",
-                   RunState_str(RUN_STATE_PRECONFIG));
-         return;
-    }
-
-    set_numa_options(MACHINE(qdev_get_machine()), cmd, errp);
-}
-
 void numa_cpu_pre_plug(const CPUArchId *slot, DeviceState *dev, Error **errp)
 {
     int node_id = object_property_get_int(OBJECT(dev), "node-id", &error_abort);
@@ -592,52 +576,6 @@ void query_numa_node_mem(NumaNodeMem node_mem[])
     }
 }
 
-static int query_memdev(Object *obj, void *opaque)
-{
-    MemdevList **list = opaque;
-    MemdevList *m = NULL;
-
-    if (object_dynamic_cast(obj, TYPE_MEMORY_BACKEND)) {
-        m = g_malloc0(sizeof(*m));
-
-        m->value = g_malloc0(sizeof(*m->value));
-
-        m->value->id = object_get_canonical_path_component(obj);
-        m->value->has_id = !!m->value->id;
-
-        m->value->size = object_property_get_uint(obj, "size",
-                                                  &error_abort);
-        m->value->merge = object_property_get_bool(obj, "merge",
-                                                   &error_abort);
-        m->value->dump = object_property_get_bool(obj, "dump",
-                                                  &error_abort);
-        m->value->prealloc = object_property_get_bool(obj,
-                                                      "prealloc",
-                                                      &error_abort);
-        m->value->policy = object_property_get_enum(obj,
-                                                    "policy",
-                                                    "HostMemPolicy",
-                                                    &error_abort);
-        object_property_get_uint16List(obj, "host-nodes",
-                                       &m->value->host_nodes,
-                                       &error_abort);
-
-        m->next = *list;
-        *list = m;
-    }
-
-    return 0;
-}
-
-MemdevList *qmp_query_memdev(Error **errp)
-{
-    Object *obj = object_get_objects_root();
-    MemdevList *list = NULL;
-
-    object_child_foreach(obj, query_memdev, &list);
-    return list;
-}
-
 void ram_block_notifier_add(RAMBlockNotifier *n)
 {
     QLIST_INSERT_HEAD(&ram_list.ramblock_notifiers, n, next);
diff --git a/hw/core/qdev.c b/hw/core/qdev.c
index f9b6efe509..94ebc0a4a1 100644
--- a/hw/core/qdev.c
+++ b/hw/core/qdev.c
@@ -29,7 +29,7 @@
 #include "hw/qdev.h"
 #include "sysemu/sysemu.h"
 #include "qapi/error.h"
-#include "qapi/qapi-events-misc.h"
+#include "qapi/qapi-events-qdev.h"
 #include "qapi/qmp/qerror.h"
 #include "qapi/visitor.h"
 #include "qemu/error-report.h"
diff --git a/hw/display/ati.c b/hw/display/ati.c
index 0cb1173848..c1d9d1518f 100644
--- a/hw/display/ati.c
+++ b/hw/display/ati.c
@@ -538,7 +538,7 @@ static void ati_mm_write(void *opaque, hwaddr addr,
         break;
     case GPIO_DVI_DDC:
         if (s->dev_id != PCI_DEVICE_ID_ATI_RAGE128_PF) {
-            s->regs.gpio_dvi_ddc = ati_i2c(s->bbi2c, data, 0);
+            s->regs.gpio_dvi_ddc = ati_i2c(&s->bbi2c, data, 0);
         }
         break;
     case GPIO_MONID ... GPIO_MONID + 3:
@@ -554,7 +554,7 @@ static void ati_mm_write(void *opaque, hwaddr addr,
              */
             if ((s->regs.gpio_monid & BIT(25)) &&
                 addr <= GPIO_MONID + 2 && addr + size > GPIO_MONID + 2) {
-                s->regs.gpio_monid = ati_i2c(s->bbi2c, s->regs.gpio_monid, 1);
+                s->regs.gpio_monid = ati_i2c(&s->bbi2c, s->regs.gpio_monid, 1);
             }
         }
         break;
@@ -856,7 +856,7 @@ static void ati_vga_realize(PCIDevice *dev, Error **errp)
 
     /* ddc, edid */
     I2CBus *i2cbus = i2c_init_bus(DEVICE(s), "ati-vga.ddc");
-    s->bbi2c = bitbang_i2c_init(i2cbus);
+    bitbang_i2c_init(&s->bbi2c, i2cbus);
     I2CSlave *i2cddc = I2C_SLAVE(qdev_create(BUS(i2cbus), TYPE_I2CDDC));
     i2c_set_slave_address(i2cddc, 0x50);
 
@@ -885,7 +885,6 @@ static void ati_vga_exit(PCIDevice *dev)
     ATIVGAState *s = ATI_VGA(dev);
 
     graphic_console_close(s->vga.con);
-    g_free(s->bbi2c);
 }
 
 static Property ati_vga_properties[] = {
diff --git a/hw/display/ati_int.h b/hw/display/ati_int.h
index 9b67d0022a..31a1927b3e 100644
--- a/hw/display/ati_int.h
+++ b/hw/display/ati_int.h
@@ -88,7 +88,7 @@ typedef struct ATIVGAState {
     uint16_t cursor_size;
     uint32_t cursor_offset;
     QEMUCursor *cursor;
-    bitbang_i2c_interface *bbi2c;
+    bitbang_i2c_interface bbi2c;
     MemoryRegion io;
     MemoryRegion mm;
     ATIVGARegs regs;
diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c
index 2b0f66b1d6..25d9e327fc 100644
--- a/hw/display/virtio-gpu.c
+++ b/hw/display/virtio-gpu.c
@@ -1002,6 +1002,11 @@ static int virtio_gpu_load(QEMUFile *f, void *opaque, size_t size,
 
     resource_id = qemu_get_be32(f);
     while (resource_id != 0) {
+        res = virtio_gpu_find_resource(g, resource_id);
+        if (res) {
+            return -EINVAL;
+        }
+
         res = g_new0(struct virtio_gpu_simple_resource, 1);
         res->resource_id = resource_id;
         res->width = qemu_get_be32(f);
@@ -1048,9 +1053,9 @@ static int virtio_gpu_load(QEMUFile *f, void *opaque, size_t size,
                 if (res->iov[i].iov_base) {
                     dma_memory_unmap(VIRTIO_DEVICE(g)->dma_as,
                                      res->iov[i].iov_base,
-                                     res->iov[i].iov_len,
+                                     len,
                                      DMA_DIRECTION_TO_DEVICE,
-                                     res->iov[i].iov_len);
+                                     0);
                 }
                 /* ...and the mappings for previous loop iterations */
                 res->iov_cnt = i;
diff --git a/hw/i2c/bitbang_i2c.c b/hw/i2c/bitbang_i2c.c
index 3cb0509b02..60c7a9be0b 100644
--- a/hw/i2c/bitbang_i2c.c
+++ b/hw/i2c/bitbang_i2c.c
@@ -25,39 +25,6 @@ do { printf("bitbang_i2c: " fmt , ## __VA_ARGS__); } while (0)
 #define DPRINTF(fmt, ...) do {} while(0)
 #endif
 
-typedef enum bitbang_i2c_state {
-    STOPPED = 0,
-    SENDING_BIT7,
-    SENDING_BIT6,
-    SENDING_BIT5,
-    SENDING_BIT4,
-    SENDING_BIT3,
-    SENDING_BIT2,
-    SENDING_BIT1,
-    SENDING_BIT0,
-    WAITING_FOR_ACK,
-    RECEIVING_BIT7,
-    RECEIVING_BIT6,
-    RECEIVING_BIT5,
-    RECEIVING_BIT4,
-    RECEIVING_BIT3,
-    RECEIVING_BIT2,
-    RECEIVING_BIT1,
-    RECEIVING_BIT0,
-    SENDING_ACK,
-    SENT_NACK
-} bitbang_i2c_state;
-
-struct bitbang_i2c_interface {
-    I2CBus *bus;
-    bitbang_i2c_state state;
-    int last_data;
-    int last_clock;
-    int device_out;
-    uint8_t buffer;
-    int current_addr;
-};
-
 static void bitbang_i2c_enter_stop(bitbang_i2c_interface *i2c)
 {
     DPRINTF("STOP\n");
@@ -184,18 +151,12 @@ int bitbang_i2c_set(bitbang_i2c_interface *i2c, int line, int level)
     abort();
 }
 
-bitbang_i2c_interface *bitbang_i2c_init(I2CBus *bus)
+void bitbang_i2c_init(bitbang_i2c_interface *s, I2CBus *bus)
 {
-    bitbang_i2c_interface *s;
-
-    s = g_malloc0(sizeof(bitbang_i2c_interface));
-
     s->bus = bus;
     s->last_data = 1;
     s->last_clock = 1;
     s->device_out = 1;
-
-    return s;
 }
 
 /* GPIO interface.  */
@@ -207,7 +168,7 @@ typedef struct GPIOI2CState {
     SysBusDevice parent_obj;
 
     MemoryRegion dummy_iomem;
-    bitbang_i2c_interface *bitbang;
+    bitbang_i2c_interface bitbang;
     int last_level;
     qemu_irq out;
 } GPIOI2CState;
@@ -216,7 +177,7 @@ static void bitbang_i2c_gpio_set(void *opaque, int irq, int level)
 {
     GPIOI2CState *s = opaque;
 
-    level = bitbang_i2c_set(s->bitbang, irq, level);
+    level = bitbang_i2c_set(&s->bitbang, irq, level);
     if (level != s->last_level) {
         s->last_level = level;
         qemu_set_irq(s->out, level);
@@ -234,7 +195,7 @@ static void gpio_i2c_init(Object *obj)
     sysbus_init_mmio(sbd, &s->dummy_iomem);
 
     bus = i2c_init_bus(dev, "i2c");
-    s->bitbang = bitbang_i2c_init(bus);
+    bitbang_i2c_init(&s->bitbang, bus);
 
     qdev_init_gpio_in(dev, bitbang_i2c_gpio_set, 2);
     qdev_init_gpio_out(dev, &s->out, 1);
diff --git a/hw/i2c/ppc4xx_i2c.c b/hw/i2c/ppc4xx_i2c.c
index 5fb4f86c38..462729db4e 100644
--- a/hw/i2c/ppc4xx_i2c.c
+++ b/hw/i2c/ppc4xx_i2c.c
@@ -311,9 +311,9 @@ static void ppc4xx_i2c_writeb(void *opaque, hwaddr addr, uint64_t value,
     case IIC_DIRECTCNTL:
         i2c->directcntl = value & (IIC_DIRECTCNTL_SDAC & IIC_DIRECTCNTL_SCLC);
         i2c->directcntl |= (value & IIC_DIRECTCNTL_SCLC ? 1 : 0);
-        bitbang_i2c_set(i2c->bitbang, BITBANG_I2C_SCL,
+        bitbang_i2c_set(&i2c->bitbang, BITBANG_I2C_SCL,
                         i2c->directcntl & IIC_DIRECTCNTL_MSCL);
-        i2c->directcntl |= bitbang_i2c_set(i2c->bitbang, BITBANG_I2C_SDA,
+        i2c->directcntl |= bitbang_i2c_set(&i2c->bitbang, BITBANG_I2C_SDA,
                                (value & IIC_DIRECTCNTL_SDAC) != 0) << 1;
         break;
     default:
@@ -347,7 +347,7 @@ static void ppc4xx_i2c_init(Object *o)
     sysbus_init_mmio(SYS_BUS_DEVICE(s), &s->iomem);
     sysbus_init_irq(SYS_BUS_DEVICE(s), &s->irq);
     s->bus = i2c_init_bus(DEVICE(s), "i2c");
-    s->bitbang = bitbang_i2c_init(s->bus);
+    bitbang_i2c_init(&s->bitbang, s->bus);
 }
 
 static void ppc4xx_i2c_class_init(ObjectClass *klass, void *data)
diff --git a/hw/i2c/versatile_i2c.c b/hw/i2c/versatile_i2c.c
index 24b6e36b6d..1ac2a6f59a 100644
--- a/hw/i2c/versatile_i2c.c
+++ b/hw/i2c/versatile_i2c.c
@@ -35,7 +35,7 @@ typedef struct VersatileI2CState {
     SysBusDevice parent_obj;
 
     MemoryRegion iomem;
-    bitbang_i2c_interface *bitbang;
+    bitbang_i2c_interface bitbang;
     int out;
     int in;
 } VersatileI2CState;
@@ -70,8 +70,8 @@ static void versatile_i2c_write(void *opaque, hwaddr offset,
         qemu_log_mask(LOG_GUEST_ERROR,
                       "%s: Bad offset 0x%x\n", __func__, (int)offset);
     }
-    bitbang_i2c_set(s->bitbang, BITBANG_I2C_SCL, (s->out & 1) != 0);
-    s->in = bitbang_i2c_set(s->bitbang, BITBANG_I2C_SDA, (s->out & 2) != 0);
+    bitbang_i2c_set(&s->bitbang, BITBANG_I2C_SCL, (s->out & 1) != 0);
+    s->in = bitbang_i2c_set(&s->bitbang, BITBANG_I2C_SDA, (s->out & 2) != 0);
 }
 
 static const MemoryRegionOps versatile_i2c_ops = {
@@ -88,7 +88,7 @@ static void versatile_i2c_init(Object *obj)
     I2CBus *bus;
 
     bus = i2c_init_bus(dev, "i2c");
-    s->bitbang = bitbang_i2c_init(bus);
+    bitbang_i2c_init(&s->bitbang, bus);
     memory_region_init_io(&s->iomem, obj, &versatile_i2c_ops, s,
                           "versatile_i2c", 0x1000);
     sysbus_init_mmio(sbd, &s->iomem);
diff --git a/hw/mips/Kconfig b/hw/mips/Kconfig
index cdc07e59b6..62aa01b29e 100644
--- a/hw/mips/Kconfig
+++ b/hw/mips/Kconfig
@@ -1,14 +1,44 @@
 config R4K
     bool
+    select ISA_BUS
+    select SERIAL_ISA
+    select I8259
+    select I8254
+    select MC146818RTC
+    imply VGA_ISA
+    imply NE2000_ISA
+    select IDE_ISA
+    select PCKBD
+    select PFLASH_CFI01
 
 config MALTA
     bool
 
 config MIPSSIM
     bool
+    select ISA_BUS
+    select SERIAL_ISA
+    select MIPSNET
 
 config JAZZ
     bool
+    select ISA_BUS
+    select RC4030
+    select I8259
+    select I8254
+    select I8257
+    select PCSPK
+    select VGA_ISA_MM
+    select G364FB
+    select DP8393X
+    select ESP
+    select FDC
+    select MC146818RTC
+    select PCKBD
+    select SERIAL
+    select PARALLEL
+    select DS1225Y
+    select JAZZ_LED
 
 config FULONG
     bool
diff --git a/hw/ppc/spapr_rtc.c b/hw/ppc/spapr_rtc.c
index af1ef30a53..6cf0113b34 100644
--- a/hw/ppc/spapr_rtc.c
+++ b/hw/ppc/spapr_rtc.c
@@ -32,7 +32,7 @@
 #include "sysemu/sysemu.h"
 #include "hw/ppc/spapr.h"
 #include "qapi/error.h"
-#include "qapi/qapi-events-target.h"
+#include "qapi/qapi-events-misc-target.h"
 #include "qemu/cutils.h"
 #include "qemu/module.h"
 
diff --git a/hw/s390x/s390-skeys.c b/hw/s390x/s390-skeys.c
index daac936698..e5bd92c0c7 100644
--- a/hw/s390x/s390-skeys.c
+++ b/hw/s390x/s390-skeys.c
@@ -14,7 +14,7 @@
 #include "hw/boards.h"
 #include "hw/s390x/storage-keys.h"
 #include "qapi/error.h"
-#include "qapi/qapi-commands-target.h"
+#include "qapi/qapi-commands-misc-target.h"
 #include "qapi/qmp/qdict.h"
 #include "qemu/error-report.h"
 #include "sysemu/kvm.h"
diff --git a/hw/timer/mc146818rtc.c b/hw/timer/mc146818rtc.c
index 0d79e000d2..ce4550b6f2 100644
--- a/hw/timer/mc146818rtc.c
+++ b/hw/timer/mc146818rtc.c
@@ -33,8 +33,8 @@
 #include "sysemu/replay.h"
 #include "hw/timer/mc146818rtc.h"
 #include "qapi/error.h"
-#include "qapi/qapi-commands-target.h"
-#include "qapi/qapi-events-target.h"
+#include "qapi/qapi-commands-misc-target.h"
+#include "qapi/qapi-events-misc-target.h"
 #include "qapi/visitor.h"
 #include "exec/address-spaces.h"
 
diff --git a/include/hw/boards.h b/include/hw/boards.h
index eaa050a7ab..c6ad196b14 100644
--- a/include/hw/boards.h
+++ b/include/hw/boards.h
@@ -6,6 +6,7 @@
 #include "sysemu/blockdev.h"
 #include "sysemu/accel.h"
 #include "hw/qdev.h"
+#include "qapi/qapi-types-machine.h"
 #include "qemu/module.h"
 #include "qom/object.h"
 #include "qom/cpu.h"
diff --git a/include/hw/i2c/bitbang_i2c.h b/include/hw/i2c/bitbang_i2c.h
index 3a7126d5de..92334e9016 100644
--- a/include/hw/i2c/bitbang_i2c.h
+++ b/include/hw/i2c/bitbang_i2c.h
@@ -8,7 +8,43 @@ typedef struct bitbang_i2c_interface bitbang_i2c_interface;
 #define BITBANG_I2C_SDA 0
 #define BITBANG_I2C_SCL 1
 
-bitbang_i2c_interface *bitbang_i2c_init(I2CBus *bus);
+typedef enum bitbang_i2c_state {
+    STOPPED = 0,
+    SENDING_BIT7,
+    SENDING_BIT6,
+    SENDING_BIT5,
+    SENDING_BIT4,
+    SENDING_BIT3,
+    SENDING_BIT2,
+    SENDING_BIT1,
+    SENDING_BIT0,
+    WAITING_FOR_ACK,
+    RECEIVING_BIT7,
+    RECEIVING_BIT6,
+    RECEIVING_BIT5,
+    RECEIVING_BIT4,
+    RECEIVING_BIT3,
+    RECEIVING_BIT2,
+    RECEIVING_BIT1,
+    RECEIVING_BIT0,
+    SENDING_ACK,
+    SENT_NACK
+} bitbang_i2c_state;
+
+struct bitbang_i2c_interface {
+    I2CBus *bus;
+    bitbang_i2c_state state;
+    int last_data;
+    int last_clock;
+    int device_out;
+    uint8_t buffer;
+    int current_addr;
+};
+
+/**
+ * bitbang_i2c_init: in-place initialize the bitbang_i2c_interface struct
+ */
+void bitbang_i2c_init(bitbang_i2c_interface *s, I2CBus *bus);
 int bitbang_i2c_set(bitbang_i2c_interface *i2c, int line, int level);
 
 #endif
diff --git a/include/hw/i2c/ppc4xx_i2c.h b/include/hw/i2c/ppc4xx_i2c.h
index 8437bf070b..f6f837fbec 100644
--- a/include/hw/i2c/ppc4xx_i2c.h
+++ b/include/hw/i2c/ppc4xx_i2c.h
@@ -41,7 +41,7 @@ typedef struct PPC4xxI2CState {
     I2CBus *bus;
     qemu_irq irq;
     MemoryRegion iomem;
-    bitbang_i2c_interface *bitbang;
+    bitbang_i2c_interface bitbang;
     int mdidx;
     uint8_t mdata[4];
     uint8_t lmadr;
diff --git a/hmp.h b/include/monitor/hmp.h
index 1d095d5837..a0e9511440 100644
--- a/hmp.h
+++ b/include/monitor/hmp.h
@@ -16,6 +16,8 @@
 
 #include "qemu/readline.h"
 
+void hmp_handle_error(Monitor *mon, Error **errp);
+
 void hmp_info_name(Monitor *mon, const QDict *qdict);
 void hmp_info_version(Monitor *mon, const QDict *qdict);
 void hmp_info_kvm(Monitor *mon, const QDict *qdict);
@@ -115,9 +117,11 @@ void hmp_cpu_add(Monitor *mon, const QDict *qdict);
 void hmp_object_add(Monitor *mon, const QDict *qdict);
 void hmp_object_del(Monitor *mon, const QDict *qdict);
 void hmp_info_memdev(Monitor *mon, const QDict *qdict);
+void hmp_info_numa(Monitor *mon, const QDict *qdict);
 void hmp_info_memory_devices(Monitor *mon, const QDict *qdict);
 void hmp_qom_list(Monitor *mon, const QDict *qdict);
 void hmp_qom_set(Monitor *mon, const QDict *qdict);
+void hmp_info_qom_tree(Monitor *mon, const QDict *dict);
 void object_add_completion(ReadLineState *rs, int nb_args, const char *str);
 void object_del_completion(ReadLineState *rs, int nb_args, const char *str);
 void device_add_completion(ReadLineState *rs, int nb_args, const char *str);
diff --git a/include/monitor/qdev.h b/include/monitor/qdev.h
index 0ff3331284..084799e4d9 100644
--- a/include/monitor/qdev.h
+++ b/include/monitor/qdev.h
@@ -7,7 +7,6 @@
 
 void hmp_info_qtree(Monitor *mon, const QDict *qdict);
 void hmp_info_qdm(Monitor *mon, const QDict *qdict);
-void hmp_info_qom_tree(Monitor *mon, const QDict *dict);
 void qmp_device_add(QDict *qdict, QObject **ret_data, Error **errp);
 
 int qdev_device_help(QemuOpts *opts);
diff --git a/include/sysemu/dump.h b/include/sysemu/dump.h
index d824bc0941..250143cb5a 100644
--- a/include/sysemu/dump.h
+++ b/include/sysemu/dump.h
@@ -14,7 +14,7 @@
 #ifndef DUMP_H
 #define DUMP_H
 
-#include "qapi/qapi-types-misc.h"
+#include "qapi/qapi-types-dump.h"
 
 #define MAKEDUMPFILE_SIGNATURE      "makedumpfile"
 #define MAX_SIZE_MDF_HEADER         (4096) /* max size of makedumpfile_header */
diff --git a/include/sysemu/hostmem.h b/include/sysemu/hostmem.h
index a023b372a4..92fa0e458c 100644
--- a/include/sysemu/hostmem.h
+++ b/include/sysemu/hostmem.h
@@ -14,7 +14,7 @@
 #define SYSEMU_HOSTMEM_H
 
 #include "sysemu/sysemu.h" /* for MAX_NODES */
-#include "qapi/qapi-types-misc.h"
+#include "qapi/qapi-types-machine.h"
 #include "qom/object.h"
 #include "exec/memory.h"
 #include "qemu/bitmap.h"
diff --git a/include/sysemu/numa.h b/include/sysemu/numa.h
index b6ac7de43e..01a263eba2 100644
--- a/include/sysemu/numa.h
+++ b/include/sysemu/numa.h
@@ -22,6 +22,8 @@ struct NumaNodeMem {
 };
 
 extern NodeInfo numa_info[MAX_NODES];
+
+void set_numa_options(MachineState *ms, NumaOptions *object, Error **errp);
 void parse_numa_opts(MachineState *ms);
 void numa_complete_configuration(MachineState *ms);
 void query_numa_node_mem(NumaNodeMem node_mem[]);
diff --git a/linux-user/fd-trans.c b/linux-user/fd-trans.c
index 612819c1b1..60077ce531 100644
--- a/linux-user/fd-trans.c
+++ b/linux-user/fd-trans.c
@@ -483,6 +483,12 @@ static abi_long host_to_target_data_bridge_nlattr(struct nlattr *nlattr,
     case QEMU_IFLA_BR_ROOT_ID:
     case QEMU_IFLA_BR_BRIDGE_ID:
         break;
+    /* br_boolopt_multi { uint32_t, uint32_t } */
+    case QEMU_IFLA_BR_MULTI_BOOLOPT:
+        u32 = NLA_DATA(nlattr);
+        u32[0] = tswap32(u32[0]); /* optval */
+        u32[1] = tswap32(u32[1]); /* optmask */
+        break;
     default:
         gemu_log("Unknown QEMU_IFLA_BR type %d\n", nlattr->nla_type);
         break;
@@ -546,12 +552,6 @@ static abi_long host_to_target_slave_data_bridge_nlattr(struct nlattr *nlattr,
     case QEMU_IFLA_BRPORT_ROOT_ID:
     case QEMU_IFLA_BRPORT_BRIDGE_ID:
         break;
-    /* br_boolopt_multi { uint32_t, uint32_t } */
-    case QEMU_IFLA_BR_MULTI_BOOLOPT:
-        u32 = NLA_DATA(nlattr);
-        u32[0] = tswap32(u32[0]); /* optval */
-        u32[1] = tswap32(u32[1]); /* optmask */
-        break;
     default:
         gemu_log("Unknown QEMU_IFLA_BRPORT type %d\n", nlattr->nla_type);
         break;
diff --git a/linux-user/generic/fcntl.h b/linux-user/generic/fcntl.h
index a775a491e9..9f727d4df2 100644
--- a/linux-user/generic/fcntl.h
+++ b/linux-user/generic/fcntl.h
@@ -120,6 +120,7 @@ struct target_f_owner_ex {
 #define TARGET_F_SHLCK         8
 #endif
 
+#ifndef TARGET_HAVE_ARCH_STRUCT_FLOCK
 #ifndef TARGET_ARCH_FLOCK_PAD
 #define TARGET_ARCH_FLOCK_PAD
 #endif
@@ -129,13 +130,12 @@ struct target_flock {
     short l_whence;
     abi_long l_start;
     abi_long l_len;
-#if defined(TARGET_MIPS)
-    abi_long l_sysid;
-#endif
     int l_pid;
     TARGET_ARCH_FLOCK_PAD
 };
+#endif
 
+#ifndef TARGET_HAVE_ARCH_STRUCT_FLOCK64
 #ifndef TARGET_ARCH_FLOCK64_PAD
 #define TARGET_ARCH_FLOCK64_PAD
 #endif
@@ -149,3 +149,5 @@ struct target_flock64 {
     TARGET_ARCH_FLOCK64_PAD
 };
 #endif
+
+#endif
diff --git a/linux-user/mips/cpu_loop.c b/linux-user/mips/cpu_loop.c
index 43ba267547..0ba894fa7a 100644
--- a/linux-user/mips/cpu_loop.c
+++ b/linux-user/mips/cpu_loop.c
@@ -540,6 +540,23 @@ done_syscall:
             info.si_code = TARGET_ILL_ILLOPC;
             queue_signal(env, info.si_signo, QEMU_SI_FAULT, &info);
             break;
+        case EXCP_FPE:
+            info.si_signo = TARGET_SIGFPE;
+            info.si_errno = 0;
+            info.si_code = TARGET_FPE_FLTUNK;
+            if (GET_FP_CAUSE(env->active_fpu.fcr31) & FP_INVALID) {
+                info.si_code = TARGET_FPE_FLTINV;
+            } else if (GET_FP_CAUSE(env->active_fpu.fcr31) & FP_DIV0) {
+                info.si_code = TARGET_FPE_FLTDIV;
+            } else if (GET_FP_CAUSE(env->active_fpu.fcr31) & FP_OVERFLOW) {
+                info.si_code = TARGET_FPE_FLTOVF;
+            } else if (GET_FP_CAUSE(env->active_fpu.fcr31) & FP_UNDERFLOW) {
+                info.si_code = TARGET_FPE_FLTUND;
+            } else if (GET_FP_CAUSE(env->active_fpu.fcr31) & FP_INEXACT) {
+                info.si_code = TARGET_FPE_FLTRES;
+            }
+            queue_signal(env, info.si_signo, QEMU_SI_FAULT, &info);
+            break;
         /* The code below was inspired by the MIPS Linux kernel trap
          * handling code in arch/mips/kernel/traps.c.
          */
diff --git a/linux-user/mips/target_fcntl.h b/linux-user/mips/target_fcntl.h
index 000527cc95..6fc7b8a12b 100644
--- a/linux-user/mips/target_fcntl.h
+++ b/linux-user/mips/target_fcntl.h
@@ -27,8 +27,21 @@
 #define TARGET_F_SETOWN        24       /*  for sockets. */
 #define TARGET_F_GETOWN        23       /*  for sockets. */
 
-#define TARGET_ARCH_FLOCK_PAD abi_long pad[4];
-#define TARGET_ARCH_FLOCK64_PAD
+#if (TARGET_ABI_BITS == 32)
+
+struct target_flock {
+    short l_type;
+    short l_whence;
+    abi_long l_start;
+    abi_long l_len;
+    abi_long l_sysid;
+    int l_pid;
+    abi_long pad[4];
+};
+
+#define TARGET_HAVE_ARCH_STRUCT_FLOCK
+
+#endif
 
 #define TARGET_F_GETLK64       33      /*  using 'struct flock64' */
 #define TARGET_F_SETLK64       34
diff --git a/linux-user/strace.c b/linux-user/strace.c
index 6f72a74c09..c80e93b5db 100644
--- a/linux-user/strace.c
+++ b/linux-user/strace.c
@@ -976,6 +976,76 @@ UNUSED static struct flags msg_flags[] = {
     FLAG_END,
 };
 
+UNUSED static struct flags statx_flags[] = {
+#ifdef AT_EMPTY_PATH
+    FLAG_GENERIC(AT_EMPTY_PATH),
+#endif
+#ifdef AT_NO_AUTOMOUNT
+    FLAG_GENERIC(AT_NO_AUTOMOUNT),
+#endif
+#ifdef AT_SYMLINK_NOFOLLOW
+    FLAG_GENERIC(AT_SYMLINK_NOFOLLOW),
+#endif
+#ifdef AT_STATX_SYNC_AS_STAT
+    FLAG_GENERIC(AT_STATX_SYNC_AS_STAT),
+#endif
+#ifdef AT_STATX_FORCE_SYNC
+    FLAG_GENERIC(AT_STATX_FORCE_SYNC),
+#endif
+#ifdef AT_STATX_DONT_SYNC
+    FLAG_GENERIC(AT_STATX_DONT_SYNC),
+#endif
+    FLAG_END,
+};
+
+UNUSED static struct flags statx_mask[] = {
+/* This must come first, because it includes everything.  */
+#ifdef STATX_ALL
+    FLAG_GENERIC(STATX_ALL),
+#endif
+/* This must come second; it includes everything except STATX_BTIME.  */
+#ifdef STATX_BASIC_STATS
+    FLAG_GENERIC(STATX_BASIC_STATS),
+#endif
+#ifdef STATX_TYPE
+    FLAG_GENERIC(STATX_TYPE),
+#endif
+#ifdef STATX_MODE
+    FLAG_GENERIC(STATX_MODE),
+#endif
+#ifdef STATX_NLINK
+    FLAG_GENERIC(STATX_NLINK),
+#endif
+#ifdef STATX_UID
+    FLAG_GENERIC(STATX_UID),
+#endif
+#ifdef STATX_GID
+    FLAG_GENERIC(STATX_GID),
+#endif
+#ifdef STATX_ATIME
+    FLAG_GENERIC(STATX_ATIME),
+#endif
+#ifdef STATX_MTIME
+    FLAG_GENERIC(STATX_MTIME),
+#endif
+#ifdef STATX_CTIME
+    FLAG_GENERIC(STATX_CTIME),
+#endif
+#ifdef STATX_INO
+    FLAG_GENERIC(STATX_INO),
+#endif
+#ifdef STATX_SIZE
+    FLAG_GENERIC(STATX_SIZE),
+#endif
+#ifdef STATX_BLOCKS
+    FLAG_GENERIC(STATX_BLOCKS),
+#endif
+#ifdef STATX_BTIME
+    FLAG_GENERIC(STATX_BTIME),
+#endif
+    FLAG_END,
+};
+
 /*
  * print_xxx utility functions.  These are used to print syscall
  * parameters in certain format.  All of these have parameter
@@ -2611,6 +2681,22 @@ print_tgkill(const struct syscallname *name,
 }
 #endif
 
+#ifdef TARGET_NR_statx
+static void
+print_statx(const struct syscallname *name,
+            abi_long arg0, abi_long arg1, abi_long arg2,
+            abi_long arg3, abi_long arg4, abi_long arg5)
+{
+    print_syscall_prologue(name);
+    print_at_dirfd(arg0, 0);
+    print_string(arg1, 0);
+    print_flags(statx_flags, arg2, 0);
+    print_flags(statx_mask, arg3, 0);
+    print_pointer(arg4, 1);
+    print_syscall_epilogue(name);
+}
+#endif
+
 /*
  * An array of all of the syscalls we know about
  */
diff --git a/linux-user/strace.list b/linux-user/strace.list
index db21ce4177..63a946642d 100644
--- a/linux-user/strace.list
+++ b/linux-user/strace.list
@@ -1650,3 +1650,6 @@
 #ifdef TARGET_NR_atomic_barrier
 { TARGET_NR_atomic_barrier, "atomic_barrier", NULL, NULL, NULL },
 #endif
+#ifdef TARGET_NR_statx
+{ TARGET_NR_statx, "statx", NULL, print_statx, NULL },
+#endif
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index d2c9817938..39a37496fe 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -238,6 +238,7 @@ static type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5,	\
 #define __NR_sys_inotify_init __NR_inotify_init
 #define __NR_sys_inotify_add_watch __NR_inotify_add_watch
 #define __NR_sys_inotify_rm_watch __NR_inotify_rm_watch
+#define __NR_sys_statx __NR_statx
 
 #if defined(__alpha__) || defined(__x86_64__) || defined(__s390x__)
 #define __NR__llseek __NR_lseek
@@ -316,6 +317,14 @@ _syscall5(int, kcmp, pid_t, pid1, pid_t, pid2, int, type,
           unsigned long, idx1, unsigned long, idx2)
 #endif
 
+/*
+ * It is assumed that struct statx is architecture independent.
+ */
+#if defined(TARGET_NR_statx) && defined(__NR_statx)
+_syscall5(int, sys_statx, int, dirfd, const char *, pathname, int, flags,
+          unsigned int, mask, struct target_statx *, statxbuf)
+#endif
+
 static bitmask_transtbl fcntl_flags_tbl[] = {
   { TARGET_O_ACCMODE,   TARGET_O_WRONLY,    O_ACCMODE,   O_WRONLY,    },
   { TARGET_O_ACCMODE,   TARGET_O_RDWR,      O_ACCMODE,   O_RDWR,      },
@@ -6516,6 +6525,48 @@ static inline abi_long host_to_target_stat64(void *cpu_env,
 }
 #endif
 
+#if defined(TARGET_NR_statx) && defined(__NR_statx)
+static inline abi_long host_to_target_statx(struct target_statx *host_stx,
+                                            abi_ulong target_addr)
+{
+    struct target_statx *target_stx;
+
+    if (!lock_user_struct(VERIFY_WRITE, target_stx, target_addr,  0)) {
+        return -TARGET_EFAULT;
+    }
+    memset(target_stx, 0, sizeof(*target_stx));
+
+    __put_user(host_stx->stx_mask, &target_stx->stx_mask);
+    __put_user(host_stx->stx_blksize, &target_stx->stx_blksize);
+    __put_user(host_stx->stx_attributes, &target_stx->stx_attributes);
+    __put_user(host_stx->stx_nlink, &target_stx->stx_nlink);
+    __put_user(host_stx->stx_uid, &target_stx->stx_uid);
+    __put_user(host_stx->stx_gid, &target_stx->stx_gid);
+    __put_user(host_stx->stx_mode, &target_stx->stx_mode);
+    __put_user(host_stx->stx_ino, &target_stx->stx_ino);
+    __put_user(host_stx->stx_size, &target_stx->stx_size);
+    __put_user(host_stx->stx_blocks, &target_stx->stx_blocks);
+    __put_user(host_stx->stx_attributes_mask, &target_stx->stx_attributes_mask);
+    __put_user(host_stx->stx_atime.tv_sec, &target_stx->stx_atime.tv_sec);
+    __put_user(host_stx->stx_atime.tv_nsec, &target_stx->stx_atime.tv_nsec);
+    __put_user(host_stx->stx_btime.tv_sec, &target_stx->stx_atime.tv_sec);
+    __put_user(host_stx->stx_btime.tv_nsec, &target_stx->stx_atime.tv_nsec);
+    __put_user(host_stx->stx_ctime.tv_sec, &target_stx->stx_atime.tv_sec);
+    __put_user(host_stx->stx_ctime.tv_nsec, &target_stx->stx_atime.tv_nsec);
+    __put_user(host_stx->stx_mtime.tv_sec, &target_stx->stx_atime.tv_sec);
+    __put_user(host_stx->stx_mtime.tv_nsec, &target_stx->stx_atime.tv_nsec);
+    __put_user(host_stx->stx_rdev_major, &target_stx->stx_rdev_major);
+    __put_user(host_stx->stx_rdev_minor, &target_stx->stx_rdev_minor);
+    __put_user(host_stx->stx_dev_major, &target_stx->stx_dev_major);
+    __put_user(host_stx->stx_dev_minor, &target_stx->stx_dev_minor);
+
+    unlock_user_struct(target_stx, target_addr, 1);
+
+    return 0;
+}
+#endif
+
+
 /* ??? Using host futex calls even when target atomic operations
    are not really atomic probably breaks things.  However implementing
    futexes locally would make futexes shared between multiple processes
@@ -7094,7 +7145,8 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1,
     abi_long ret;
 #if defined(TARGET_NR_stat) || defined(TARGET_NR_stat64) \
     || defined(TARGET_NR_lstat) || defined(TARGET_NR_lstat64) \
-    || defined(TARGET_NR_fstat) || defined(TARGET_NR_fstat64)
+    || defined(TARGET_NR_fstat) || defined(TARGET_NR_fstat64) \
+    || defined(TARGET_NR_statx)
     struct stat st;
 #endif
 #if defined(TARGET_NR_statfs) || defined(TARGET_NR_statfs64) \
@@ -10172,6 +10224,67 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1,
             ret = host_to_target_stat64(cpu_env, arg3, &st);
         return ret;
 #endif
+#if defined(TARGET_NR_statx)
+    case TARGET_NR_statx:
+        {
+            struct target_statx *target_stx;
+            int dirfd = arg1;
+            int flags = arg3;
+
+            p = lock_user_string(arg2);
+            if (p == NULL) {
+                return -TARGET_EFAULT;
+            }
+#if defined(__NR_statx)
+            {
+                /*
+                 * It is assumed that struct statx is architecture independent.
+                 */
+                struct target_statx host_stx;
+                int mask = arg4;
+
+                ret = get_errno(sys_statx(dirfd, p, flags, mask, &host_stx));
+                if (!is_error(ret)) {
+                    if (host_to_target_statx(&host_stx, arg5) != 0) {
+                        unlock_user(p, arg2, 0);
+                        return -TARGET_EFAULT;
+                    }
+                }
+
+                if (ret != -TARGET_ENOSYS) {
+                    unlock_user(p, arg2, 0);
+                    return ret;
+                }
+            }
+#endif
+            ret = get_errno(fstatat(dirfd, path(p), &st, flags));
+            unlock_user(p, arg2, 0);
+
+            if (!is_error(ret)) {
+                if (!lock_user_struct(VERIFY_WRITE, target_stx, arg5, 0)) {
+                    return -TARGET_EFAULT;
+                }
+                memset(target_stx, 0, sizeof(*target_stx));
+                __put_user(major(st.st_dev), &target_stx->stx_dev_major);
+                __put_user(minor(st.st_dev), &target_stx->stx_dev_minor);
+                __put_user(st.st_ino, &target_stx->stx_ino);
+                __put_user(st.st_mode, &target_stx->stx_mode);
+                __put_user(st.st_uid, &target_stx->stx_uid);
+                __put_user(st.st_gid, &target_stx->stx_gid);
+                __put_user(st.st_nlink, &target_stx->stx_nlink);
+                __put_user(major(st.st_rdev), &target_stx->stx_rdev_major);
+                __put_user(minor(st.st_rdev), &target_stx->stx_rdev_minor);
+                __put_user(st.st_size, &target_stx->stx_size);
+                __put_user(st.st_blksize, &target_stx->stx_blksize);
+                __put_user(st.st_blocks, &target_stx->stx_blocks);
+                __put_user(st.st_atime, &target_stx->stx_atime.tv_sec);
+                __put_user(st.st_mtime, &target_stx->stx_mtime.tv_sec);
+                __put_user(st.st_ctime, &target_stx->stx_ctime.tv_sec);
+                unlock_user_struct(target_stx, arg5, 1);
+            }
+        }
+        return ret;
+#endif
 #ifdef TARGET_NR_lchown
     case TARGET_NR_lchown:
         if (!(p = lock_user_string(arg1)))
diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h
index 3175440e9d..fffa89f256 100644
--- a/linux-user/syscall_defs.h
+++ b/linux-user/syscall_defs.h
@@ -2537,4 +2537,41 @@ struct target_user_cap_data {
 /* Return size of the log buffer */
 #define TARGET_SYSLOG_ACTION_SIZE_BUFFER   10
 
+struct target_statx_timestamp {
+   int64_t tv_sec;
+   uint32_t tv_nsec;
+   int32_t __reserved;
+};
+
+struct target_statx {
+   /* 0x00 */
+   uint32_t stx_mask;       /* What results were written [uncond] */
+   uint32_t stx_blksize;    /* Preferred general I/O size [uncond] */
+   uint64_t stx_attributes; /* Flags conveying information about the file */
+   /* 0x10 */
+   uint32_t stx_nlink;      /* Number of hard links */
+   uint32_t stx_uid;        /* User ID of owner */
+   uint32_t stx_gid;        /* Group ID of owner */
+   uint16_t stx_mode;       /* File mode */
+   uint16_t __spare0[1];
+   /* 0x20 */
+   uint64_t stx_ino;        /* Inode number */
+   uint64_t stx_size;       /* File size */
+   uint64_t stx_blocks;     /* Number of 512-byte blocks allocated */
+   uint64_t stx_attributes_mask; /* Mask to show what is supported */
+   /* 0x40 */
+   struct target_statx_timestamp  stx_atime;  /* Last access time */
+   struct target_statx_timestamp  stx_btime;  /* File creation time */
+   struct target_statx_timestamp  stx_ctime;  /* Last attribute change time */
+   struct target_statx_timestamp  stx_mtime;  /* Last data modification time */
+   /* 0x80 */
+   uint32_t stx_rdev_major;   /* Device ID of special file [if bdev/cdev] */
+   uint32_t stx_rdev_minor;
+   uint32_t stx_dev_major; /* ID of device containing file [uncond] */
+   uint32_t stx_dev_minor;
+   /* 0x90 */
+   uint64_t __spare2[14];  /* Spare space for future expansion */
+   /* 0x100 */
+};
+
 #endif
diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c
index 9de35387c3..7cccedbd5b 100644
--- a/monitor/hmp-cmds.c
+++ b/monitor/hmp-cmds.c
@@ -14,7 +14,7 @@
  */
 
 #include "qemu/osdep.h"
-#include "hmp.h"
+#include "monitor/hmp.h"
 #include "net/net.h"
 #include "net/eth.h"
 #include "chardev/char.h"
@@ -35,6 +35,7 @@
 #include "qapi/qapi-commands-migration.h"
 #include "qapi/qapi-commands-misc.h"
 #include "qapi/qapi-commands-net.h"
+#include "qapi/qapi-commands-qdev.h"
 #include "qapi/qapi-commands-rocker.h"
 #include "qapi/qapi-commands-run-state.h"
 #include "qapi/qapi-commands-tpm.h"
@@ -61,7 +62,7 @@
 #include <spice/enums.h>
 #endif
 
-static void hmp_handle_error(Monitor *mon, Error **errp)
+void hmp_handle_error(Monitor *mon, Error **errp)
 {
     assert(errp);
     if (*errp) {
@@ -483,27 +484,6 @@ void hmp_info_migrate_cache_size(Monitor *mon, const QDict *qdict)
                    qmp_query_migrate_cache_size(NULL) >> 10);
 }
 
-void hmp_info_cpus(Monitor *mon, const QDict *qdict)
-{
-    CpuInfoFastList *cpu_list, *cpu;
-
-    cpu_list = qmp_query_cpus_fast(NULL);
-
-    for (cpu = cpu_list; cpu; cpu = cpu->next) {
-        int active = ' ';
-
-        if (cpu->value->cpu_index == monitor_get_cpu_index()) {
-            active = '*';
-        }
-
-        monitor_printf(mon, "%c CPU #%" PRId64 ":", active,
-                       cpu->value->cpu_index);
-        monitor_printf(mon, " thread_id=%" PRId64 "\n", cpu->value->thread_id);
-    }
-
-    qapi_free_CpuInfoFastList(cpu_list);
-}
-
 static void print_block_info(Monitor *mon, BlockInfo *info,
                              BlockDeviceInfo *inserted, bool verbose)
 {
@@ -2218,64 +2198,6 @@ void hmp_device_del(Monitor *mon, const QDict *qdict)
     hmp_handle_error(mon, &err);
 }
 
-void hmp_dump_guest_memory(Monitor *mon, const QDict *qdict)
-{
-    Error *err = NULL;
-    bool win_dmp = qdict_get_try_bool(qdict, "windmp", false);
-    bool paging = qdict_get_try_bool(qdict, "paging", false);
-    bool zlib = qdict_get_try_bool(qdict, "zlib", false);
-    bool lzo = qdict_get_try_bool(qdict, "lzo", false);
-    bool snappy = qdict_get_try_bool(qdict, "snappy", false);
-    const char *file = qdict_get_str(qdict, "filename");
-    bool has_begin = qdict_haskey(qdict, "begin");
-    bool has_length = qdict_haskey(qdict, "length");
-    bool has_detach = qdict_haskey(qdict, "detach");
-    int64_t begin = 0;
-    int64_t length = 0;
-    bool detach = false;
-    enum DumpGuestMemoryFormat dump_format = DUMP_GUEST_MEMORY_FORMAT_ELF;
-    char *prot;
-
-    if (zlib + lzo + snappy + win_dmp > 1) {
-        error_setg(&err, "only one of '-z|-l|-s|-w' can be set");
-        hmp_handle_error(mon, &err);
-        return;
-    }
-
-    if (win_dmp) {
-        dump_format = DUMP_GUEST_MEMORY_FORMAT_WIN_DMP;
-    }
-
-    if (zlib) {
-        dump_format = DUMP_GUEST_MEMORY_FORMAT_KDUMP_ZLIB;
-    }
-
-    if (lzo) {
-        dump_format = DUMP_GUEST_MEMORY_FORMAT_KDUMP_LZO;
-    }
-
-    if (snappy) {
-        dump_format = DUMP_GUEST_MEMORY_FORMAT_KDUMP_SNAPPY;
-    }
-
-    if (has_begin) {
-        begin = qdict_get_int(qdict, "begin");
-    }
-    if (has_length) {
-        length = qdict_get_int(qdict, "length");
-    }
-    if (has_detach) {
-        detach = qdict_get_bool(qdict, "detach");
-    }
-
-    prot = g_strconcat("file:", file, NULL);
-
-    qmp_dump_guest_memory(paging, prot, true, detach, has_begin, begin,
-                          has_length, length, true, dump_format, &err);
-    hmp_handle_error(mon, &err);
-    g_free(prot);
-}
-
 void hmp_netdev_add(Monitor *mon, const QDict *qdict)
 {
     Error *err = NULL;
@@ -2509,18 +2431,6 @@ void hmp_nbd_server_stop(Monitor *mon, const QDict *qdict)
     hmp_handle_error(mon, &err);
 }
 
-void hmp_cpu_add(Monitor *mon, const QDict *qdict)
-{
-    int cpuid;
-    Error *err = NULL;
-
-    error_report("cpu_add is deprecated, please use device_add instead");
-
-    cpuid = qdict_get_int(qdict, "id");
-    qmp_cpu_add(cpuid, &err);
-    hmp_handle_error(mon, &err);
-}
-
 void hmp_chardev_add(Monitor *mon, const QDict *qdict)
 {
     const char *args = qdict_get_str(qdict, "args");
@@ -2652,41 +2562,6 @@ void hmp_object_del(Monitor *mon, const QDict *qdict)
     hmp_handle_error(mon, &err);
 }
 
-void hmp_info_memdev(Monitor *mon, const QDict *qdict)
-{
-    Error *err = NULL;
-    MemdevList *memdev_list = qmp_query_memdev(&err);
-    MemdevList *m = memdev_list;
-    Visitor *v;
-    char *str;
-
-    while (m) {
-        v = string_output_visitor_new(false, &str);
-        visit_type_uint16List(v, NULL, &m->value->host_nodes, NULL);
-        monitor_printf(mon, "memory backend: %s\n", m->value->id);
-        monitor_printf(mon, "  size:  %" PRId64 "\n", m->value->size);
-        monitor_printf(mon, "  merge: %s\n",
-                       m->value->merge ? "true" : "false");
-        monitor_printf(mon, "  dump: %s\n",
-                       m->value->dump ? "true" : "false");
-        monitor_printf(mon, "  prealloc: %s\n",
-                       m->value->prealloc ? "true" : "false");
-        monitor_printf(mon, "  policy: %s\n",
-                       HostMemPolicy_str(m->value->policy));
-        visit_complete(v, &str);
-        monitor_printf(mon, "  host nodes: %s\n", str);
-
-        g_free(str);
-        visit_free(v);
-        m = m->next;
-    }
-
-    monitor_printf(mon, "\n");
-
-    qapi_free_MemdevList(memdev_list);
-    hmp_handle_error(mon, &err);
-}
-
 void hmp_info_memory_devices(Monitor *mon, const QDict *qdict)
 {
     Error *err = NULL;
@@ -2752,54 +2627,6 @@ void hmp_info_iothreads(Monitor *mon, const QDict *qdict)
     qapi_free_IOThreadInfoList(info_list);
 }
 
-void hmp_qom_list(Monitor *mon, const QDict *qdict)
-{
-    const char *path = qdict_get_try_str(qdict, "path");
-    ObjectPropertyInfoList *list;
-    Error *err = NULL;
-
-    if (path == NULL) {
-        monitor_printf(mon, "/\n");
-        return;
-    }
-
-    list = qmp_qom_list(path, &err);
-    if (err == NULL) {
-        ObjectPropertyInfoList *start = list;
-        while (list != NULL) {
-            ObjectPropertyInfo *value = list->value;
-
-            monitor_printf(mon, "%s (%s)\n",
-                           value->name, value->type);
-            list = list->next;
-        }
-        qapi_free_ObjectPropertyInfoList(start);
-    }
-    hmp_handle_error(mon, &err);
-}
-
-void hmp_qom_set(Monitor *mon, const QDict *qdict)
-{
-    const char *path = qdict_get_str(qdict, "path");
-    const char *property = qdict_get_str(qdict, "property");
-    const char *value = qdict_get_str(qdict, "value");
-    Error *err = NULL;
-    bool ambiguous = false;
-    Object *obj;
-
-    obj = object_resolve_path(path, &ambiguous);
-    if (obj == NULL) {
-        error_set(&err, ERROR_CLASS_DEVICE_NOT_FOUND,
-                  "Device '%s' not found", path);
-    } else {
-        if (ambiguous) {
-            monitor_printf(mon, "Warning: Path '%s' is ambiguous\n", path);
-        }
-        object_property_parse(obj, value, property, &err);
-    }
-    hmp_handle_error(mon, &err);
-}
-
 void hmp_rocker(Monitor *mon, const QDict *qdict)
 {
     const char *name = qdict_get_str(qdict, "name");
@@ -3102,70 +2929,11 @@ void hmp_rocker_of_dpa_groups(Monitor *mon, const QDict *qdict)
     qapi_free_RockerOfDpaGroupList(list);
 }
 
-void hmp_info_dump(Monitor *mon, const QDict *qdict)
-{
-    DumpQueryResult *result = qmp_query_dump(NULL);
-
-    assert(result && result->status < DUMP_STATUS__MAX);
-    monitor_printf(mon, "Status: %s\n", DumpStatus_str(result->status));
-
-    if (result->status == DUMP_STATUS_ACTIVE) {
-        float percent = 0;
-        assert(result->total != 0);
-        percent = 100.0 * result->completed / result->total;
-        monitor_printf(mon, "Finished: %.2f %%\n", percent);
-    }
-
-    qapi_free_DumpQueryResult(result);
-}
-
 void hmp_info_ramblock(Monitor *mon, const QDict *qdict)
 {
     ram_block_dump(mon);
 }
 
-void hmp_hotpluggable_cpus(Monitor *mon, const QDict *qdict)
-{
-    Error *err = NULL;
-    HotpluggableCPUList *l = qmp_query_hotpluggable_cpus(&err);
-    HotpluggableCPUList *saved = l;
-    CpuInstanceProperties *c;
-
-    if (err != NULL) {
-        hmp_handle_error(mon, &err);
-        return;
-    }
-
-    monitor_printf(mon, "Hotpluggable CPUs:\n");
-    while (l) {
-        monitor_printf(mon, "  type: \"%s\"\n", l->value->type);
-        monitor_printf(mon, "  vcpus_count: \"%" PRIu64 "\"\n",
-                       l->value->vcpus_count);
-        if (l->value->has_qom_path) {
-            monitor_printf(mon, "  qom_path: \"%s\"\n", l->value->qom_path);
-        }
-
-        c = l->value->props;
-        monitor_printf(mon, "  CPUInstance Properties:\n");
-        if (c->has_node_id) {
-            monitor_printf(mon, "    node-id: \"%" PRIu64 "\"\n", c->node_id);
-        }
-        if (c->has_socket_id) {
-            monitor_printf(mon, "    socket-id: \"%" PRIu64 "\"\n", c->socket_id);
-        }
-        if (c->has_core_id) {
-            monitor_printf(mon, "    core-id: \"%" PRIu64 "\"\n", c->core_id);
-        }
-        if (c->has_thread_id) {
-            monitor_printf(mon, "    thread-id: \"%" PRIu64 "\"\n", c->thread_id);
-        }
-
-        l = l->next;
-    }
-
-    qapi_free_HotpluggableCPUList(saved);
-}
-
 void hmp_info_vm_generation_id(Monitor *mon, const QDict *qdict)
 {
     Error *err = NULL;
diff --git a/monitor/misc.c b/monitor/misc.c
index bf9faceb86..00338c002a 100644
--- a/monitor/misc.c
+++ b/monitor/misc.c
@@ -36,7 +36,6 @@
 #include "net/slirp.h"
 #include "chardev/char-mux.h"
 #include "ui/qemu-spice.h"
-#include "sysemu/numa.h"
 #include "qemu/config-file.h"
 #include "qemu/ctype.h"
 #include "ui/console.h"
@@ -48,6 +47,8 @@
 #include "sysemu/hw_accel.h"
 #include "authz/list.h"
 #include "qapi/util.h"
+#include "sysemu/blockdev.h"
+#include "sysemu/sysemu.h"
 #include "sysemu/tcg.h"
 #include "sysemu/tpm.h"
 #include "qapi/qmp/qdict.h"
@@ -56,13 +57,13 @@
 #include "qom/object_interfaces.h"
 #include "trace/control.h"
 #include "monitor/hmp-target.h"
+#include "monitor/hmp.h"
 #ifdef CONFIG_TRACE_SIMPLE
 #include "trace/simple.h"
 #endif
 #include "exec/memory.h"
 #include "exec/exec-all.h"
 #include "qemu/option.h"
-#include "hmp.h"
 #include "qemu/thread.h"
 #include "block/qapi.h"
 #include "qapi/qapi-commands.h"
@@ -1081,35 +1082,6 @@ static void hmp_info_mtree(Monitor *mon, const QDict *qdict)
     mtree_info(flatview, dispatch_tree, owner);
 }
 
-static void hmp_info_numa(Monitor *mon, const QDict *qdict)
-{
-    int i;
-    NumaNodeMem *node_mem;
-    CpuInfoList *cpu_list, *cpu;
-
-    cpu_list = qmp_query_cpus(&error_abort);
-    node_mem = g_new0(NumaNodeMem, nb_numa_nodes);
-
-    query_numa_node_mem(node_mem);
-    monitor_printf(mon, "%d nodes\n", nb_numa_nodes);
-    for (i = 0; i < nb_numa_nodes; i++) {
-        monitor_printf(mon, "node %d cpus:", i);
-        for (cpu = cpu_list; cpu; cpu = cpu->next) {
-            if (cpu->value->has_props && cpu->value->props->has_node_id &&
-                cpu->value->props->node_id == i) {
-                monitor_printf(mon, " %" PRIi64, cpu->value->CPU);
-            }
-        }
-        monitor_printf(mon, "\n");
-        monitor_printf(mon, "node %d size: %" PRId64 " MB\n", i,
-                       node_mem[i].node_mem >> 20);
-        monitor_printf(mon, "node %d plugged: %" PRId64 " MB\n", i,
-                       node_mem[i].node_plugged_mem >> 20);
-    }
-    qapi_free_CpuInfoList(cpu_list);
-    g_free(node_mem);
-}
-
 #ifdef CONFIG_PROFILER
 
 int64_t dev_time;
@@ -2338,16 +2310,3 @@ void monitor_init_globals(void)
     sortcmdlist();
     qemu_mutex_init(&mon_fdsets_lock);
 }
-
-HotpluggableCPUList *qmp_query_hotpluggable_cpus(Error **errp)
-{
-    MachineState *ms = MACHINE(qdev_get_machine());
-    MachineClass *mc = MACHINE_GET_CLASS(ms);
-
-    if (!mc->has_hotpluggable_cpus) {
-        error_setg(errp, QERR_FEATURE_DISABLED, "query-hotpluggable-cpus");
-        return NULL;
-    }
-
-    return machine_query_hotpluggable_cpus(ms);
-}
diff --git a/monitor/qmp-cmds.c b/monitor/qmp-cmds.c
index 01ce77e129..b9ae40eec7 100644
--- a/monitor/qmp-cmds.c
+++ b/monitor/qmp-cmds.c
@@ -27,19 +27,15 @@
 #include "ui/vnc.h"
 #include "sysemu/kvm.h"
 #include "sysemu/arch_init.h"
-#include "hw/qdev.h"
 #include "sysemu/blockdev.h"
 #include "sysemu/block-backend.h"
-#include "qom/qom-qobject.h"
 #include "qapi/error.h"
 #include "qapi/qapi-commands-block-core.h"
+#include "qapi/qapi-commands-machine.h"
 #include "qapi/qapi-commands-misc.h"
 #include "qapi/qapi-commands-ui.h"
-#include "qapi/qmp/qdict.h"
 #include "qapi/qmp/qerror.h"
-#include "qapi/qobject-input-visitor.h"
 #include "hw/boards.h"
-#include "qom/object_interfaces.h"
 #include "hw/mem/memory-device.h"
 #include "hw/acpi/acpi_dev_interface.h"
 
@@ -118,18 +114,6 @@ void qmp_system_powerdown(Error **erp)
     qemu_system_powerdown_request();
 }
 
-void qmp_cpu_add(int64_t id, Error **errp)
-{
-    MachineClass *mc;
-
-    mc = MACHINE_GET_CLASS(current_machine);
-    if (mc->hot_add_cpu) {
-        mc->hot_add_cpu(id, errp);
-    } else {
-        error_setg(errp, "Not supported");
-    }
-}
-
 void qmp_x_exit_preconfig(Error **errp)
 {
     if (!runstate_check(RUN_STATE_PRECONFIG)) {
@@ -201,69 +185,6 @@ void qmp_system_wakeup(Error **errp)
     qemu_system_wakeup_request(QEMU_WAKEUP_REASON_OTHER, errp);
 }
 
-ObjectPropertyInfoList *qmp_qom_list(const char *path, Error **errp)
-{
-    Object *obj;
-    bool ambiguous = false;
-    ObjectPropertyInfoList *props = NULL;
-    ObjectProperty *prop;
-    ObjectPropertyIterator iter;
-
-    obj = object_resolve_path(path, &ambiguous);
-    if (obj == NULL) {
-        if (ambiguous) {
-            error_setg(errp, "Path '%s' is ambiguous", path);
-        } else {
-            error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND,
-                      "Device '%s' not found", path);
-        }
-        return NULL;
-    }
-
-    object_property_iter_init(&iter, obj);
-    while ((prop = object_property_iter_next(&iter))) {
-        ObjectPropertyInfoList *entry = g_malloc0(sizeof(*entry));
-
-        entry->value = g_malloc0(sizeof(ObjectPropertyInfo));
-        entry->next = props;
-        props = entry;
-
-        entry->value->name = g_strdup(prop->name);
-        entry->value->type = g_strdup(prop->type);
-    }
-
-    return props;
-}
-
-void qmp_qom_set(const char *path, const char *property, QObject *value,
-                 Error **errp)
-{
-    Object *obj;
-
-    obj = object_resolve_path(path, NULL);
-    if (!obj) {
-        error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND,
-                  "Device '%s' not found", path);
-        return;
-    }
-
-    object_property_set_qobject(obj, value, property, errp);
-}
-
-QObject *qmp_qom_get(const char *path, const char *property, Error **errp)
-{
-    Object *obj;
-
-    obj = object_resolve_path(path, NULL);
-    if (!obj) {
-        error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND,
-                  "Device '%s' not found", path);
-        return NULL;
-    }
-
-    return object_property_get_qobject(obj, property, errp);
-}
-
 void qmp_set_password(const char *protocol, const char *password,
                       bool has_connected, const char *connected, Error **errp)
 {
@@ -412,208 +333,6 @@ void qmp_change(const char *device, const char *target,
     }
 }
 
-static void qom_list_types_tramp(ObjectClass *klass, void *data)
-{
-    ObjectTypeInfoList *e, **pret = data;
-    ObjectTypeInfo *info;
-    ObjectClass *parent = object_class_get_parent(klass);
-
-    info = g_malloc0(sizeof(*info));
-    info->name = g_strdup(object_class_get_name(klass));
-    info->has_abstract = info->abstract = object_class_is_abstract(klass);
-    if (parent) {
-        info->has_parent = true;
-        info->parent = g_strdup(object_class_get_name(parent));
-    }
-
-    e = g_malloc0(sizeof(*e));
-    e->value = info;
-    e->next = *pret;
-    *pret = e;
-}
-
-ObjectTypeInfoList *qmp_qom_list_types(bool has_implements,
-                                       const char *implements,
-                                       bool has_abstract,
-                                       bool abstract,
-                                       Error **errp)
-{
-    ObjectTypeInfoList *ret = NULL;
-
-    object_class_foreach(qom_list_types_tramp, implements, abstract, &ret);
-
-    return ret;
-}
-
-/* Return a DevicePropertyInfo for a qdev property.
- *
- * If a qdev property with the given name does not exist, use the given default
- * type.  If the qdev property info should not be shown, return NULL.
- *
- * The caller must free the return value.
- */
-static ObjectPropertyInfo *make_device_property_info(ObjectClass *klass,
-                                                  const char *name,
-                                                  const char *default_type,
-                                                  const char *description)
-{
-    ObjectPropertyInfo *info;
-    Property *prop;
-
-    do {
-        for (prop = DEVICE_CLASS(klass)->props; prop && prop->name; prop++) {
-            if (strcmp(name, prop->name) != 0) {
-                continue;
-            }
-
-            /*
-             * TODO Properties without a parser are just for dirty hacks.
-             * qdev_prop_ptr is the only such PropertyInfo.  It's marked
-             * for removal.  This conditional should be removed along with
-             * it.
-             */
-            if (!prop->info->set && !prop->info->create) {
-                return NULL;           /* no way to set it, don't show */
-            }
-
-            info = g_malloc0(sizeof(*info));
-            info->name = g_strdup(prop->name);
-            info->type = default_type ? g_strdup(default_type)
-                                      : g_strdup(prop->info->name);
-            info->has_description = !!prop->info->description;
-            info->description = g_strdup(prop->info->description);
-            return info;
-        }
-        klass = object_class_get_parent(klass);
-    } while (klass != object_class_by_name(TYPE_DEVICE));
-
-    /* Not a qdev property, use the default type */
-    info = g_malloc0(sizeof(*info));
-    info->name = g_strdup(name);
-    info->type = g_strdup(default_type);
-    info->has_description = !!description;
-    info->description = g_strdup(description);
-
-    return info;
-}
-
-ObjectPropertyInfoList *qmp_device_list_properties(const char *typename,
-                                                Error **errp)
-{
-    ObjectClass *klass;
-    Object *obj;
-    ObjectProperty *prop;
-    ObjectPropertyIterator iter;
-    ObjectPropertyInfoList *prop_list = NULL;
-
-    klass = object_class_by_name(typename);
-    if (klass == NULL) {
-        error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND,
-                  "Device '%s' not found", typename);
-        return NULL;
-    }
-
-    klass = object_class_dynamic_cast(klass, TYPE_DEVICE);
-    if (klass == NULL) {
-        error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "typename", TYPE_DEVICE);
-        return NULL;
-    }
-
-    if (object_class_is_abstract(klass)) {
-        error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "typename",
-                   "non-abstract device type");
-        return NULL;
-    }
-
-    obj = object_new(typename);
-
-    object_property_iter_init(&iter, obj);
-    while ((prop = object_property_iter_next(&iter))) {
-        ObjectPropertyInfo *info;
-        ObjectPropertyInfoList *entry;
-
-        /* Skip Object and DeviceState properties */
-        if (strcmp(prop->name, "type") == 0 ||
-            strcmp(prop->name, "realized") == 0 ||
-            strcmp(prop->name, "hotpluggable") == 0 ||
-            strcmp(prop->name, "hotplugged") == 0 ||
-            strcmp(prop->name, "parent_bus") == 0) {
-            continue;
-        }
-
-        /* Skip legacy properties since they are just string versions of
-         * properties that we already list.
-         */
-        if (strstart(prop->name, "legacy-", NULL)) {
-            continue;
-        }
-
-        info = make_device_property_info(klass, prop->name, prop->type,
-                                         prop->description);
-        if (!info) {
-            continue;
-        }
-
-        entry = g_malloc0(sizeof(*entry));
-        entry->value = info;
-        entry->next = prop_list;
-        prop_list = entry;
-    }
-
-    object_unref(obj);
-
-    return prop_list;
-}
-
-ObjectPropertyInfoList *qmp_qom_list_properties(const char *typename,
-                                             Error **errp)
-{
-    ObjectClass *klass;
-    Object *obj = NULL;
-    ObjectProperty *prop;
-    ObjectPropertyIterator iter;
-    ObjectPropertyInfoList *prop_list = NULL;
-
-    klass = object_class_by_name(typename);
-    if (klass == NULL) {
-        error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND,
-                  "Class '%s' not found", typename);
-        return NULL;
-    }
-
-    klass = object_class_dynamic_cast(klass, TYPE_OBJECT);
-    if (klass == NULL) {
-        error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "typename", TYPE_OBJECT);
-        return NULL;
-    }
-
-    if (object_class_is_abstract(klass)) {
-        object_class_property_iter_init(&iter, klass);
-    } else {
-        obj = object_new(typename);
-        object_property_iter_init(&iter, obj);
-    }
-    while ((prop = object_property_iter_next(&iter))) {
-        ObjectPropertyInfo *info;
-        ObjectPropertyInfoList *entry;
-
-        info = g_malloc0(sizeof(*info));
-        info->name = g_strdup(prop->name);
-        info->type = g_strdup(prop->type);
-        info->has_description = !!prop->description;
-        info->description = g_strdup(prop->description);
-
-        entry = g_malloc0(sizeof(*entry));
-        entry->value = info;
-        entry->next = prop_list;
-        prop_list = entry;
-    }
-
-    object_unref(obj);
-
-    return prop_list;
-}
-
 void qmp_add_client(const char *protocol, const char *fdname,
                     bool has_skipauth, bool skipauth, bool has_tls, bool tls,
                     Error **errp)
@@ -658,38 +377,6 @@ void qmp_add_client(const char *protocol, const char *fdname,
 }
 
 
-void qmp_object_add(const char *type, const char *id,
-                    bool has_props, QObject *props, Error **errp)
-{
-    QDict *pdict;
-    Visitor *v;
-    Object *obj;
-
-    if (props) {
-        pdict = qobject_to(QDict, props);
-        if (!pdict) {
-            error_setg(errp, QERR_INVALID_PARAMETER_TYPE, "props", "dict");
-            return;
-        }
-        qobject_ref(pdict);
-    } else {
-        pdict = qdict_new();
-    }
-
-    v = qobject_input_visitor_new(QOBJECT(pdict));
-    obj = user_creatable_add_type(type, id, pdict, v, errp);
-    visit_free(v);
-    if (obj) {
-        object_unref(obj);
-    }
-    qobject_unref(pdict);
-}
-
-void qmp_object_del(const char *id, Error **errp)
-{
-    user_creatable_del(id, errp);
-}
-
 MemoryDeviceInfoList *qmp_query_memory_devices(Error **errp)
 {
     return qmp_memory_device_list();
diff --git a/qapi/Makefile.objs b/qapi/Makefile.objs
index 729e5185c5..c5a29e86e2 100644
--- a/qapi/Makefile.objs
+++ b/qapi/Makefile.objs
@@ -6,9 +6,10 @@ util-obj-y += qmp-event.o
 util-obj-y += qapi-util.o
 
 QAPI_COMMON_MODULES = audio authz block-core block char common crypto
-QAPI_COMMON_MODULES += introspect job migration misc net rdma rocker
-QAPI_COMMON_MODULES += run-state sockets tpm trace transaction ui
-QAPI_TARGET_MODULES = target
+QAPI_COMMON_MODULES += dump introspect job machine migration misc net
+QAPI_COMMON_MODULES += qdev qom rdma rocker run-state sockets tpm
+QAPI_COMMON_MODULES += trace transaction ui
+QAPI_TARGET_MODULES = machine-target misc-target
 QAPI_MODULES = $(QAPI_COMMON_MODULES) $(QAPI_TARGET_MODULES)
 
 util-obj-y += qapi-builtin-types.o
diff --git a/qapi/dump.json b/qapi/dump.json
new file mode 100644
index 0000000000..2b35409a7b
--- /dev/null
+++ b/qapi/dump.json
@@ -0,0 +1,200 @@
+# -*- Mode: Python -*-
+#
+# This work is licensed under the terms of the GNU GPL, version 2 or later.
+# See the COPYING file in the top-level directory.
+
+##
+# = Dump guest memory
+##
+
+##
+# @DumpGuestMemoryFormat:
+#
+# An enumeration of guest-memory-dump's format.
+#
+# @elf: elf format
+#
+# @kdump-zlib: kdump-compressed format with zlib-compressed
+#
+# @kdump-lzo: kdump-compressed format with lzo-compressed
+#
+# @kdump-snappy: kdump-compressed format with snappy-compressed
+#
+# @win-dmp: Windows full crashdump format,
+#           can be used instead of ELF converting (since 2.13)
+#
+# Since: 2.0
+##
+{ 'enum': 'DumpGuestMemoryFormat',
+  'data': [ 'elf', 'kdump-zlib', 'kdump-lzo', 'kdump-snappy', 'win-dmp' ] }
+
+##
+# @dump-guest-memory:
+#
+# Dump guest's memory to vmcore. It is a synchronous operation that can take
+# very long depending on the amount of guest memory.
+#
+# @paging: if true, do paging to get guest's memory mapping. This allows
+#          using gdb to process the core file.
+#
+#          IMPORTANT: this option can make QEMU allocate several gigabytes
+#                     of RAM. This can happen for a large guest, or a
+#                     malicious guest pretending to be large.
+#
+#          Also, paging=true has the following limitations:
+#
+#             1. The guest may be in a catastrophic state or can have corrupted
+#                memory, which cannot be trusted
+#             2. The guest can be in real-mode even if paging is enabled. For
+#                example, the guest uses ACPI to sleep, and ACPI sleep state
+#                goes in real-mode
+#             3. Currently only supported on i386 and x86_64.
+#
+# @protocol: the filename or file descriptor of the vmcore. The supported
+#            protocols are:
+#
+#            1. file: the protocol starts with "file:", and the following
+#               string is the file's path.
+#            2. fd: the protocol starts with "fd:", and the following string
+#               is the fd's name.
+#
+# @detach: if true, QMP will return immediately rather than
+#          waiting for the dump to finish. The user can track progress
+#          using "query-dump". (since 2.6).
+#
+# @begin: if specified, the starting physical address.
+#
+# @length: if specified, the memory size, in bytes. If you don't
+#          want to dump all guest's memory, please specify the start @begin
+#          and @length
+#
+# @format: if specified, the format of guest memory dump. But non-elf
+#          format is conflict with paging and filter, ie. @paging, @begin and
+#          @length is not allowed to be specified with non-elf @format at the
+#          same time (since 2.0)
+#
+# Note: All boolean arguments default to false
+#
+# Returns: nothing on success
+#
+# Since: 1.2
+#
+# Example:
+#
+# -> { "execute": "dump-guest-memory",
+#      "arguments": { "protocol": "fd:dump" } }
+# <- { "return": {} }
+#
+##
+{ 'command': 'dump-guest-memory',
+  'data': { 'paging': 'bool', 'protocol': 'str', '*detach': 'bool',
+            '*begin': 'int', '*length': 'int',
+            '*format': 'DumpGuestMemoryFormat'} }
+
+##
+# @DumpStatus:
+#
+# Describe the status of a long-running background guest memory dump.
+#
+# @none: no dump-guest-memory has started yet.
+#
+# @active: there is one dump running in background.
+#
+# @completed: the last dump has finished successfully.
+#
+# @failed: the last dump has failed.
+#
+# Since: 2.6
+##
+{ 'enum': 'DumpStatus',
+  'data': [ 'none', 'active', 'completed', 'failed' ] }
+
+##
+# @DumpQueryResult:
+#
+# The result format for 'query-dump'.
+#
+# @status: enum of @DumpStatus, which shows current dump status
+#
+# @completed: bytes written in latest dump (uncompressed)
+#
+# @total: total bytes to be written in latest dump (uncompressed)
+#
+# Since: 2.6
+##
+{ 'struct': 'DumpQueryResult',
+  'data': { 'status': 'DumpStatus',
+            'completed': 'int',
+            'total': 'int' } }
+
+##
+# @query-dump:
+#
+# Query latest dump status.
+#
+# Returns: A @DumpStatus object showing the dump status.
+#
+# Since: 2.6
+#
+# Example:
+#
+# -> { "execute": "query-dump" }
+# <- { "return": { "status": "active", "completed": 1024000,
+#                  "total": 2048000 } }
+#
+##
+{ 'command': 'query-dump', 'returns': 'DumpQueryResult' }
+
+##
+# @DUMP_COMPLETED:
+#
+# Emitted when background dump has completed
+#
+# @result: final dump status
+#
+# @error: human-readable error string that provides
+#         hint on why dump failed. Only presents on failure. The
+#         user should not try to interpret the error string.
+#
+# Since: 2.6
+#
+# Example:
+#
+# { "event": "DUMP_COMPLETED",
+#   "data": {"result": {"total": 1090650112, "status": "completed",
+#                       "completed": 1090650112} } }
+#
+##
+{ 'event': 'DUMP_COMPLETED' ,
+  'data': { 'result': 'DumpQueryResult', '*error': 'str' } }
+
+##
+# @DumpGuestMemoryCapability:
+#
+# A list of the available formats for dump-guest-memory
+#
+# Since: 2.0
+##
+{ 'struct': 'DumpGuestMemoryCapability',
+  'data': {
+      'formats': ['DumpGuestMemoryFormat'] } }
+
+##
+# @query-dump-guest-memory-capability:
+#
+# Returns the available formats for dump-guest-memory
+#
+# Returns:  A @DumpGuestMemoryCapability object listing available formats for
+#           dump-guest-memory
+#
+# Since: 2.0
+#
+# Example:
+#
+# -> { "execute": "query-dump-guest-memory-capability" }
+# <- { "return": { "formats":
+#                  ["elf", "kdump-zlib", "kdump-lzo", "kdump-snappy"] }
+#
+##
+{ 'command': 'query-dump-guest-memory-capability',
+  'returns': 'DumpGuestMemoryCapability' }
diff --git a/qapi/target.json b/qapi/machine-target.json
index 1d4d54b600..5d7480f6ab 100644
--- a/qapi/target.json
+++ b/qapi/machine-target.json
@@ -1,232 +1,81 @@
 # -*- Mode: Python -*-
 #
+# This work is licensed under the terms of the GNU GPL, version 2 or later.
+# See the COPYING file in the top-level directory.
 
 ##
-# = Target-specific commands & events
-##
-
-{ 'include': 'misc.json' }
-
-##
-# @RTC_CHANGE:
-#
-# Emitted when the guest changes the RTC time.
-#
-# @offset: offset between base RTC clock (as specified by -rtc base), and
-#          new RTC clock value
-#
-# Note: This event is rate-limited.
-#
-# Since: 0.13.0
-#
-# Example:
-#
-# <-   { "event": "RTC_CHANGE",
-#        "data": { "offset": 78 },
-#        "timestamp": { "seconds": 1267020223, "microseconds": 435656 } }
-#
-##
-{ 'event': 'RTC_CHANGE',
-  'data': { 'offset': 'int' },
-  'if': 'defined(TARGET_ALPHA) || defined(TARGET_ARM) || defined(TARGET_HPPA) || defined(TARGET_I386) || defined(TARGET_MIPS) || defined(TARGET_MIPS64) || defined(TARGET_MOXIE) || defined(TARGET_PPC) || defined(TARGET_PPC64) || defined(TARGET_S390X) || defined(TARGET_SH4) || defined(TARGET_SPARC)' }
-
-##
-# @rtc-reset-reinjection:
-#
-# This command will reset the RTC interrupt reinjection backlog.
-# Can be used if another mechanism to synchronize guest time
-# is in effect, for example QEMU guest agent's guest-set-time
-# command.
-#
-# Since: 2.1
-#
-# Example:
-#
-# -> { "execute": "rtc-reset-reinjection" }
-# <- { "return": {} }
-#
-##
-{ 'command': 'rtc-reset-reinjection',
-  'if': 'defined(TARGET_I386)' }
-
-
-##
-# @SevState:
-#
-# An enumeration of SEV state information used during @query-sev.
-#
-# @uninit: The guest is uninitialized.
+# @CpuModelInfo:
 #
-# @launch-update: The guest is currently being launched; plaintext data and
-#                 register state is being imported.
+# Virtual CPU model.
 #
-# @launch-secret: The guest is currently being launched; ciphertext data
-#                 is being imported.
+# A CPU model consists of the name of a CPU definition, to which
+# delta changes are applied (e.g. features added/removed). Most magic values
+# that an architecture might require should be hidden behind the name.
+# However, if required, architectures can expose relevant properties.
 #
-# @running: The guest is fully launched or migrated in.
-#
-# @send-update: The guest is currently being migrated out to another machine.
-#
-# @receive-update: The guest is currently being migrated from another machine.
-#
-# Since: 2.12
-##
-{ 'enum': 'SevState',
-  'data': ['uninit', 'launch-update', 'launch-secret', 'running',
-           'send-update', 'receive-update' ],
-  'if': 'defined(TARGET_I386)' }
-
-##
-# @SevInfo:
-#
-# Information about Secure Encrypted Virtualization (SEV) support
-#
-# @enabled: true if SEV is active
-#
-# @api-major: SEV API major version
-#
-# @api-minor: SEV API minor version
-#
-# @build-id: SEV FW build id
-#
-# @policy: SEV policy value
-#
-# @state: SEV guest state
-#
-# @handle: SEV firmware handle
-#
-# Since: 2.12
-##
-{ 'struct': 'SevInfo',
-    'data': { 'enabled': 'bool',
-              'api-major': 'uint8',
-              'api-minor' : 'uint8',
-              'build-id' : 'uint8',
-              'policy' : 'uint32',
-              'state' : 'SevState',
-              'handle' : 'uint32'
-            },
-  'if': 'defined(TARGET_I386)'
-}
-
-##
-# @query-sev:
-#
-# Returns information about SEV
-#
-# Returns: @SevInfo
-#
-# Since: 2.12
-#
-# Example:
-#
-# -> { "execute": "query-sev" }
-# <- { "return": { "enabled": true, "api-major" : 0, "api-minor" : 0,
-#                  "build-id" : 0, "policy" : 0, "state" : "running",
-#                  "handle" : 1 } }
-#
-##
-{ 'command': 'query-sev', 'returns': 'SevInfo',
-  'if': 'defined(TARGET_I386)' }
-
-
-##
-# @SevLaunchMeasureInfo:
-#
-# SEV Guest Launch measurement information
-#
-# @data: the measurement value encoded in base64
-#
-# Since: 2.12
+# @name: the name of the CPU definition the model is based on
+# @props: a dictionary of QOM properties to be applied
 #
+# Since: 2.8.0
 ##
-{ 'struct': 'SevLaunchMeasureInfo', 'data': {'data': 'str'},
-  'if': 'defined(TARGET_I386)' }
+{ 'struct': 'CpuModelInfo',
+  'data': { 'name': 'str',
+            '*props': 'any' } }
 
 ##
-# @query-sev-launch-measure:
-#
-# Query the SEV guest launch information.
-#
-# Returns: The @SevLaunchMeasureInfo for the guest
+# @CpuModelExpansionType:
 #
-# Since: 2.12
+# An enumeration of CPU model expansion types.
 #
-# Example:
-#
-# -> { "execute": "query-sev-launch-measure" }
-# <- { "return": { "data": "4l8LXeNlSPUDlXPJG5966/8%YZ" } }
-#
-##
-{ 'command': 'query-sev-launch-measure', 'returns': 'SevLaunchMeasureInfo',
-  'if': 'defined(TARGET_I386)' }
+# @static: Expand to a static CPU model, a combination of a static base
+#          model name and property delta changes. As the static base model will
+#          never change, the expanded CPU model will be the same, independent of
+#          QEMU version, machine type, machine options, and accelerator options.
+#          Therefore, the resulting model can be used by tooling without having
+#          to specify a compatibility machine - e.g. when displaying the "host"
+#          model. The @static CPU models are migration-safe.
 
-
-##
-# @SevCapability:
-#
-# The struct describes capability for a Secure Encrypted Virtualization
-# feature.
-#
-# @pdh:  Platform Diffie-Hellman key (base64 encoded)
-#
-# @cert-chain:  PDH certificate chain (base64 encoded)
-#
-# @cbitpos: C-bit location in page table entry
+# @full: Expand all properties. The produced model is not guaranteed to be
+#        migration-safe, but allows tooling to get an insight and work with
+#        model details.
+#
+# Note: When a non-migration-safe CPU model is expanded in static mode, some
+# features enabled by the CPU model may be omitted, because they can't be
+# implemented by a static CPU model definition (e.g. cache info passthrough and
+# PMU passthrough in x86). If you need an accurate representation of the
+# features enabled by a non-migration-safe CPU model, use @full. If you need a
+# static representation that will keep ABI compatibility even when changing QEMU
+# version or machine-type, use @static (but keep in mind that some features may
+# be omitted).
 #
-# @reduced-phys-bits: Number of physical Address bit reduction when SEV is
-#                     enabled
-#
-# Since: 2.12
+# Since: 2.8.0
 ##
-{ 'struct': 'SevCapability',
-  'data': { 'pdh': 'str',
-            'cert-chain': 'str',
-            'cbitpos': 'int',
-            'reduced-phys-bits': 'int'},
-  'if': 'defined(TARGET_I386)' }
+{ 'enum': 'CpuModelExpansionType',
+  'data': [ 'static', 'full' ] }
 
-##
-# @query-sev-capabilities:
-#
-# This command is used to get the SEV capabilities, and is supported on AMD
-# X86 platforms only.
-#
-# Returns: SevCapability objects.
-#
-# Since: 2.12
-#
-# Example:
-#
-# -> { "execute": "query-sev-capabilities" }
-# <- { "return": { "pdh": "8CCDD8DDD", "cert-chain": "888CCCDDDEE",
-#                  "cbitpos": 47, "reduced-phys-bits": 5}}
-#
-##
-{ 'command': 'query-sev-capabilities', 'returns': 'SevCapability',
-  'if': 'defined(TARGET_I386)' }
 
 ##
-# @dump-skeys:
-#
-# Dump guest's storage keys
+# @CpuModelCompareResult:
 #
-# @filename: the path to the file to dump to
+# An enumeration of CPU model comparison results. The result is usually
+# calculated using e.g. CPU features or CPU generations.
 #
-# This command is only supported on s390 architecture.
+# @incompatible: If model A is incompatible to model B, model A is not
+#                guaranteed to run where model B runs and the other way around.
 #
-# Since: 2.5
+# @identical: If model A is identical to model B, model A is guaranteed to run
+#             where model B runs and the other way around.
 #
-# Example:
+# @superset: If model A is a superset of model B, model B is guaranteed to run
+#            where model A runs. There are no guarantees about the other way.
 #
-# -> { "execute": "dump-skeys",
-#      "arguments": { "filename": "/tmp/skeys" } }
-# <- { "return": {} }
+# @subset: If model A is a subset of model B, model A is guaranteed to run
+#          where model B runs. There are no guarantees about the other way.
 #
+# Since: 2.8.0
 ##
-{ 'command': 'dump-skeys',
-  'data': { 'filename': 'str' },
-  'if': 'defined(TARGET_S390X)' }
+{ 'enum': 'CpuModelCompareResult',
+  'data': [ 'incompatible', 'identical', 'superset', 'subset' ] }
 
 ##
 # @CpuModelBaselineInfo:
@@ -353,51 +202,6 @@
   'if': 'defined(TARGET_S390X)' }
 
 ##
-# @GICCapability:
-#
-# The struct describes capability for a specific GIC (Generic
-# Interrupt Controller) version. These bits are not only decided by
-# QEMU/KVM software version, but also decided by the hardware that
-# the program is running upon.
-#
-# @version:  version of GIC to be described. Currently, only 2 and 3
-#            are supported.
-#
-# @emulated: whether current QEMU/hardware supports emulated GIC
-#            device in user space.
-#
-# @kernel:   whether current QEMU/hardware supports hardware
-#            accelerated GIC device in kernel.
-#
-# Since: 2.6
-##
-{ 'struct': 'GICCapability',
-  'data': { 'version': 'int',
-            'emulated': 'bool',
-            'kernel': 'bool' },
-  'if': 'defined(TARGET_ARM)' }
-
-##
-# @query-gic-capabilities:
-#
-# This command is ARM-only. It will return a list of GICCapability
-# objects that describe its capability bits.
-#
-# Returns: a list of GICCapability objects.
-#
-# Since: 2.6
-#
-# Example:
-#
-# -> { "execute": "query-gic-capabilities" }
-# <- { "return": [{ "version": 2, "emulated": true, "kernel": false },
-#                 { "version": 3, "emulated": false, "kernel": true } ] }
-#
-##
-{ 'command': 'query-gic-capabilities', 'returns': ['GICCapability'],
-  'if': 'defined(TARGET_ARM)' }
-
-##
 # @CpuModelExpansionInfo:
 #
 # The result of a cpu model expansion.
diff --git a/qapi/machine.json b/qapi/machine.json
new file mode 100644
index 0000000000..81849acb3a
--- /dev/null
+++ b/qapi/machine.json
@@ -0,0 +1,697 @@
+# -*- Mode: Python -*-
+#
+# This work is licensed under the terms of the GNU GPL, version 2 or later.
+# See the COPYING file in the top-level directory.
+
+##
+# = Machines
+##
+
+{ 'include': 'common.json' }
+
+##
+# @CpuInfoArch:
+#
+# An enumeration of cpu types that enable additional information during
+# @query-cpus and @query-cpus-fast.
+#
+# @s390: since 2.12
+#
+# @riscv: since 2.12
+#
+# Since: 2.6
+##
+{ 'enum': 'CpuInfoArch',
+  'data': ['x86', 'sparc', 'ppc', 'mips', 'tricore', 's390', 'riscv', 'other' ] }
+
+##
+# @CpuInfo:
+#
+# Information about a virtual CPU
+#
+# @CPU: the index of the virtual CPU
+#
+# @current: this only exists for backwards compatibility and should be ignored
+#
+# @halted: true if the virtual CPU is in the halt state.  Halt usually refers
+#          to a processor specific low power mode.
+#
+# @qom_path: path to the CPU object in the QOM tree (since 2.4)
+#
+# @thread_id: ID of the underlying host thread
+#
+# @props: properties describing to which node/socket/core/thread
+#         virtual CPU belongs to, provided if supported by board (since 2.10)
+#
+# @arch: architecture of the cpu, which determines which additional fields
+#        will be listed (since 2.6)
+#
+# Since: 0.14.0
+#
+# Notes: @halted is a transient state that changes frequently.  By the time the
+#        data is sent to the client, the guest may no longer be halted.
+##
+{ 'union': 'CpuInfo',
+  'base': {'CPU': 'int', 'current': 'bool', 'halted': 'bool',
+           'qom_path': 'str', 'thread_id': 'int',
+           '*props': 'CpuInstanceProperties', 'arch': 'CpuInfoArch' },
+  'discriminator': 'arch',
+  'data': { 'x86': 'CpuInfoX86',
+            'sparc': 'CpuInfoSPARC',
+            'ppc': 'CpuInfoPPC',
+            'mips': 'CpuInfoMIPS',
+            'tricore': 'CpuInfoTricore',
+            's390': 'CpuInfoS390',
+            'riscv': 'CpuInfoRISCV' } }
+
+##
+# @CpuInfoX86:
+#
+# Additional information about a virtual i386 or x86_64 CPU
+#
+# @pc: the 64-bit instruction pointer
+#
+# Since: 2.6
+##
+{ 'struct': 'CpuInfoX86', 'data': { 'pc': 'int' } }
+
+##
+# @CpuInfoSPARC:
+#
+# Additional information about a virtual SPARC CPU
+#
+# @pc: the PC component of the instruction pointer
+#
+# @npc: the NPC component of the instruction pointer
+#
+# Since: 2.6
+##
+{ 'struct': 'CpuInfoSPARC', 'data': { 'pc': 'int', 'npc': 'int' } }
+
+##
+# @CpuInfoPPC:
+#
+# Additional information about a virtual PPC CPU
+#
+# @nip: the instruction pointer
+#
+# Since: 2.6
+##
+{ 'struct': 'CpuInfoPPC', 'data': { 'nip': 'int' } }
+
+##
+# @CpuInfoMIPS:
+#
+# Additional information about a virtual MIPS CPU
+#
+# @PC: the instruction pointer
+#
+# Since: 2.6
+##
+{ 'struct': 'CpuInfoMIPS', 'data': { 'PC': 'int' } }
+
+##
+# @CpuInfoTricore:
+#
+# Additional information about a virtual Tricore CPU
+#
+# @PC: the instruction pointer
+#
+# Since: 2.6
+##
+{ 'struct': 'CpuInfoTricore', 'data': { 'PC': 'int' } }
+
+##
+# @CpuInfoRISCV:
+#
+# Additional information about a virtual RISCV CPU
+#
+# @pc: the instruction pointer
+#
+# Since 2.12
+##
+{ 'struct': 'CpuInfoRISCV', 'data': { 'pc': 'int' } }
+
+##
+# @CpuS390State:
+#
+# An enumeration of cpu states that can be assumed by a virtual
+# S390 CPU
+#
+# Since: 2.12
+##
+{ 'enum': 'CpuS390State',
+  'prefix': 'S390_CPU_STATE',
+  'data': [ 'uninitialized', 'stopped', 'check-stop', 'operating', 'load' ] }
+
+##
+# @CpuInfoS390:
+#
+# Additional information about a virtual S390 CPU
+#
+# @cpu-state: the virtual CPU's state
+#
+# Since: 2.12
+##
+{ 'struct': 'CpuInfoS390', 'data': { 'cpu-state': 'CpuS390State' } }
+
+##
+# @query-cpus:
+#
+# Returns a list of information about each virtual CPU.
+#
+# This command causes vCPU threads to exit to userspace, which causes
+# a small interruption to guest CPU execution. This will have a negative
+# impact on realtime guests and other latency sensitive guest workloads.
+# It is recommended to use @query-cpus-fast instead of this command to
+# avoid the vCPU interruption.
+#
+# Returns: a list of @CpuInfo for each virtual CPU
+#
+# Since: 0.14.0
+#
+# Example:
+#
+# -> { "execute": "query-cpus" }
+# <- { "return": [
+#          {
+#             "CPU":0,
+#             "current":true,
+#             "halted":false,
+#             "qom_path":"/machine/unattached/device[0]",
+#             "arch":"x86",
+#             "pc":3227107138,
+#             "thread_id":3134
+#          },
+#          {
+#             "CPU":1,
+#             "current":false,
+#             "halted":true,
+#             "qom_path":"/machine/unattached/device[2]",
+#             "arch":"x86",
+#             "pc":7108165,
+#             "thread_id":3135
+#          }
+#       ]
+#    }
+#
+# Notes: This interface is deprecated (since 2.12.0), and it is strongly
+#        recommended that you avoid using it. Use @query-cpus-fast to
+#        obtain information about virtual CPUs.
+#
+##
+{ 'command': 'query-cpus', 'returns': ['CpuInfo'] }
+
+##
+# @CpuInfoFast:
+#
+# Information about a virtual CPU
+#
+# @cpu-index: index of the virtual CPU
+#
+# @qom-path: path to the CPU object in the QOM tree
+#
+# @thread-id: ID of the underlying host thread
+#
+# @props: properties describing to which node/socket/core/thread
+#         virtual CPU belongs to, provided if supported by board
+#
+# @arch: base architecture of the cpu; deprecated since 3.0.0 in favor
+#        of @target
+#
+# @target: the QEMU system emulation target, which determines which
+#          additional fields will be listed (since 3.0)
+#
+# Since: 2.12
+#
+##
+{ 'union'         : 'CpuInfoFast',
+  'base'          : { 'cpu-index'    : 'int',
+                      'qom-path'     : 'str',
+                      'thread-id'    : 'int',
+                      '*props'       : 'CpuInstanceProperties',
+                      'arch'         : 'CpuInfoArch',
+                      'target'       : 'SysEmuTarget' },
+  'discriminator' : 'target',
+  'data'          : { 's390x'        : 'CpuInfoS390' } }
+
+##
+# @query-cpus-fast:
+#
+# Returns information about all virtual CPUs. This command does not
+# incur a performance penalty and should be used in production
+# instead of query-cpus.
+#
+# Returns: list of @CpuInfoFast
+#
+# Since: 2.12
+#
+# Example:
+#
+# -> { "execute": "query-cpus-fast" }
+# <- { "return": [
+#         {
+#             "thread-id": 25627,
+#             "props": {
+#                 "core-id": 0,
+#                 "thread-id": 0,
+#                 "socket-id": 0
+#             },
+#             "qom-path": "/machine/unattached/device[0]",
+#             "arch":"x86",
+#             "target":"x86_64",
+#             "cpu-index": 0
+#         },
+#         {
+#             "thread-id": 25628,
+#             "props": {
+#                 "core-id": 0,
+#                 "thread-id": 0,
+#                 "socket-id": 1
+#             },
+#             "qom-path": "/machine/unattached/device[2]",
+#             "arch":"x86",
+#             "target":"x86_64",
+#             "cpu-index": 1
+#         }
+#     ]
+# }
+##
+{ 'command': 'query-cpus-fast', 'returns': [ 'CpuInfoFast' ] }
+
+##
+# @cpu-add:
+#
+# Adds CPU with specified ID.
+#
+# @id: ID of CPU to be created, valid values [0..max_cpus)
+#
+# Returns: Nothing on success
+#
+# Since: 1.5
+#
+# Note: This command is deprecated.  The `device_add` command should be
+#       used instead.  See the `query-hotpluggable-cpus` command for
+#       details.
+#
+# Example:
+#
+# -> { "execute": "cpu-add", "arguments": { "id": 2 } }
+# <- { "return": {} }
+#
+##
+{ 'command': 'cpu-add', 'data': {'id': 'int'} }
+
+##
+# @MachineInfo:
+#
+# Information describing a machine.
+#
+# @name: the name of the machine
+#
+# @alias: an alias for the machine name
+#
+# @is-default: whether the machine is default
+#
+# @cpu-max: maximum number of CPUs supported by the machine type
+#           (since 1.5.0)
+#
+# @hotpluggable-cpus: cpu hotplug via -device is supported (since 2.7.0)
+#
+# Since: 1.2.0
+##
+{ 'struct': 'MachineInfo',
+  'data': { 'name': 'str', '*alias': 'str',
+            '*is-default': 'bool', 'cpu-max': 'int',
+            'hotpluggable-cpus': 'bool'} }
+
+##
+# @query-machines:
+#
+# Return a list of supported machines
+#
+# Returns: a list of MachineInfo
+#
+# Since: 1.2.0
+##
+{ 'command': 'query-machines', 'returns': ['MachineInfo'] }
+
+##
+# @CurrentMachineParams:
+#
+# Information describing the running machine parameters.
+#
+# @wakeup-suspend-support: true if the machine supports wake up from
+#                          suspend
+#
+# Since: 4.0
+##
+{ 'struct': 'CurrentMachineParams',
+  'data': { 'wakeup-suspend-support': 'bool'} }
+
+##
+# @query-current-machine:
+#
+# Return information on the current virtual machine.
+#
+# Returns: CurrentMachineParams
+#
+# Since: 4.0
+##
+{ 'command': 'query-current-machine', 'returns': 'CurrentMachineParams' }
+
+##
+# @NumaOptionsType:
+#
+# @node: NUMA nodes configuration
+#
+# @dist: NUMA distance configuration (since 2.10)
+#
+# @cpu: property based CPU(s) to node mapping (Since: 2.10)
+#
+# Since: 2.1
+##
+{ 'enum': 'NumaOptionsType',
+  'data': [ 'node', 'dist', 'cpu' ] }
+
+##
+# @NumaOptions:
+#
+# A discriminated record of NUMA options. (for OptsVisitor)
+#
+# Since: 2.1
+##
+{ 'union': 'NumaOptions',
+  'base': { 'type': 'NumaOptionsType' },
+  'discriminator': 'type',
+  'data': {
+    'node': 'NumaNodeOptions',
+    'dist': 'NumaDistOptions',
+    'cpu': 'NumaCpuOptions' }}
+
+##
+# @NumaNodeOptions:
+#
+# Create a guest NUMA node. (for OptsVisitor)
+#
+# @nodeid: NUMA node ID (increase by 1 from 0 if omitted)
+#
+# @cpus: VCPUs belonging to this node (assign VCPUS round-robin
+#         if omitted)
+#
+# @mem: memory size of this node; mutually exclusive with @memdev.
+#       Equally divide total memory among nodes if both @mem and @memdev are
+#       omitted.
+#
+# @memdev: memory backend object.  If specified for one node,
+#          it must be specified for all nodes.
+#
+# Since: 2.1
+##
+{ 'struct': 'NumaNodeOptions',
+  'data': {
+   '*nodeid': 'uint16',
+   '*cpus':   ['uint16'],
+   '*mem':    'size',
+   '*memdev': 'str' }}
+
+##
+# @NumaDistOptions:
+#
+# Set the distance between 2 NUMA nodes.
+#
+# @src: source NUMA node.
+#
+# @dst: destination NUMA node.
+#
+# @val: NUMA distance from source node to destination node.
+#       When a node is unreachable from another node, set the distance
+#       between them to 255.
+#
+# Since: 2.10
+##
+{ 'struct': 'NumaDistOptions',
+  'data': {
+   'src': 'uint16',
+   'dst': 'uint16',
+   'val': 'uint8' }}
+
+##
+# @X86CPURegister32:
+#
+# A X86 32-bit register
+#
+# Since: 1.5
+##
+{ 'enum': 'X86CPURegister32',
+  'data': [ 'EAX', 'EBX', 'ECX', 'EDX', 'ESP', 'EBP', 'ESI', 'EDI' ] }
+
+##
+# @X86CPUFeatureWordInfo:
+#
+# Information about a X86 CPU feature word
+#
+# @cpuid-input-eax: Input EAX value for CPUID instruction for that feature word
+#
+# @cpuid-input-ecx: Input ECX value for CPUID instruction for that
+#                   feature word
+#
+# @cpuid-register: Output register containing the feature bits
+#
+# @features: value of output register, containing the feature bits
+#
+# Since: 1.5
+##
+{ 'struct': 'X86CPUFeatureWordInfo',
+  'data': { 'cpuid-input-eax': 'int',
+            '*cpuid-input-ecx': 'int',
+            'cpuid-register': 'X86CPURegister32',
+            'features': 'int' } }
+
+##
+# @DummyForceArrays:
+#
+# Not used by QMP; hack to let us use X86CPUFeatureWordInfoList internally
+#
+# Since: 2.5
+##
+{ 'struct': 'DummyForceArrays',
+  'data': { 'unused': ['X86CPUFeatureWordInfo'] } }
+
+##
+# @NumaCpuOptions:
+#
+# Option "-numa cpu" overrides default cpu to node mapping.
+# It accepts the same set of cpu properties as returned by
+# query-hotpluggable-cpus[].props, where node-id could be used to
+# override default node mapping.
+#
+# Since: 2.10
+##
+{ 'struct': 'NumaCpuOptions',
+   'base': 'CpuInstanceProperties',
+   'data' : {} }
+
+##
+# @HostMemPolicy:
+#
+# Host memory policy types
+#
+# @default: restore default policy, remove any nondefault policy
+#
+# @preferred: set the preferred host nodes for allocation
+#
+# @bind: a strict policy that restricts memory allocation to the
+#        host nodes specified
+#
+# @interleave: memory allocations are interleaved across the set
+#              of host nodes specified
+#
+# Since: 2.1
+##
+{ 'enum': 'HostMemPolicy',
+  'data': [ 'default', 'preferred', 'bind', 'interleave' ] }
+
+##
+# @Memdev:
+#
+# Information about memory backend
+#
+# @id: backend's ID if backend has 'id' property (since 2.9)
+#
+# @size: memory backend size
+#
+# @merge: enables or disables memory merge support
+#
+# @dump: includes memory backend's memory in a core dump or not
+#
+# @prealloc: enables or disables memory preallocation
+#
+# @host-nodes: host nodes for its memory policy
+#
+# @policy: memory policy of memory backend
+#
+# Since: 2.1
+##
+{ 'struct': 'Memdev',
+  'data': {
+    '*id':        'str',
+    'size':       'size',
+    'merge':      'bool',
+    'dump':       'bool',
+    'prealloc':   'bool',
+    'host-nodes': ['uint16'],
+    'policy':     'HostMemPolicy' }}
+
+##
+# @query-memdev:
+#
+# Returns information for all memory backends.
+#
+# Returns: a list of @Memdev.
+#
+# Since: 2.1
+#
+# Example:
+#
+# -> { "execute": "query-memdev" }
+# <- { "return": [
+#        {
+#          "id": "mem1",
+#          "size": 536870912,
+#          "merge": false,
+#          "dump": true,
+#          "prealloc": false,
+#          "host-nodes": [0, 1],
+#          "policy": "bind"
+#        },
+#        {
+#          "size": 536870912,
+#          "merge": false,
+#          "dump": true,
+#          "prealloc": true,
+#          "host-nodes": [2, 3],
+#          "policy": "preferred"
+#        }
+#      ]
+#    }
+#
+##
+{ 'command': 'query-memdev', 'returns': ['Memdev'], 'allow-preconfig': true }
+
+##
+# @CpuInstanceProperties:
+#
+# List of properties to be used for hotplugging a CPU instance,
+# it should be passed by management with device_add command when
+# a CPU is being hotplugged.
+#
+# @node-id: NUMA node ID the CPU belongs to
+# @socket-id: socket number within node/board the CPU belongs to
+# @core-id: core number within socket the CPU belongs to
+# @thread-id: thread number within core the CPU belongs to
+#
+# Note: currently there are 4 properties that could be present
+# but management should be prepared to pass through other
+# properties with device_add command to allow for future
+# interface extension. This also requires the filed names to be kept in
+# sync with the properties passed to -device/device_add.
+#
+# Since: 2.7
+##
+{ 'struct': 'CpuInstanceProperties',
+  'data': { '*node-id': 'int',
+            '*socket-id': 'int',
+            '*core-id': 'int',
+            '*thread-id': 'int'
+  }
+}
+
+##
+# @HotpluggableCPU:
+#
+# @type: CPU object type for usage with device_add command
+# @props: list of properties to be used for hotplugging CPU
+# @vcpus-count: number of logical VCPU threads @HotpluggableCPU provides
+# @qom-path: link to existing CPU object if CPU is present or
+#            omitted if CPU is not present.
+#
+# Since: 2.7
+##
+{ 'struct': 'HotpluggableCPU',
+  'data': { 'type': 'str',
+            'vcpus-count': 'int',
+            'props': 'CpuInstanceProperties',
+            '*qom-path': 'str'
+          }
+}
+
+##
+# @query-hotpluggable-cpus:
+#
+# TODO: Better documentation; currently there is none.
+#
+# Returns: a list of HotpluggableCPU objects.
+#
+# Since: 2.7
+#
+# Example:
+#
+# For pseries machine type started with -smp 2,cores=2,maxcpus=4 -cpu POWER8:
+#
+# -> { "execute": "query-hotpluggable-cpus" }
+# <- {"return": [
+#      { "props": { "core": 8 }, "type": "POWER8-spapr-cpu-core",
+#        "vcpus-count": 1 },
+#      { "props": { "core": 0 }, "type": "POWER8-spapr-cpu-core",
+#        "vcpus-count": 1, "qom-path": "/machine/unattached/device[0]"}
+#    ]}'
+#
+# For pc machine type started with -smp 1,maxcpus=2:
+#
+# -> { "execute": "query-hotpluggable-cpus" }
+# <- {"return": [
+#      {
+#         "type": "qemu64-x86_64-cpu", "vcpus-count": 1,
+#         "props": {"core-id": 0, "socket-id": 1, "thread-id": 0}
+#      },
+#      {
+#         "qom-path": "/machine/unattached/device[0]",
+#         "type": "qemu64-x86_64-cpu", "vcpus-count": 1,
+#         "props": {"core-id": 0, "socket-id": 0, "thread-id": 0}
+#      }
+#    ]}
+#
+# For s390x-virtio-ccw machine type started with -smp 1,maxcpus=2 -cpu qemu
+# (Since: 2.11):
+#
+# -> { "execute": "query-hotpluggable-cpus" }
+# <- {"return": [
+#      {
+#         "type": "qemu-s390x-cpu", "vcpus-count": 1,
+#         "props": { "core-id": 1 }
+#      },
+#      {
+#         "qom-path": "/machine/unattached/device[0]",
+#         "type": "qemu-s390x-cpu", "vcpus-count": 1,
+#         "props": { "core-id": 0 }
+#      }
+#    ]}
+#
+##
+{ 'command': 'query-hotpluggable-cpus', 'returns': ['HotpluggableCPU'],
+             'allow-preconfig': true }
+
+##
+# @set-numa-node:
+#
+# Runtime equivalent of '-numa' CLI option, available at
+# preconfigure stage to configure numa mapping before initializing
+# machine.
+#
+# Since 3.0
+##
+{ 'command': 'set-numa-node', 'boxed': true,
+  'data': 'NumaOptions',
+  'allow-preconfig': true
+}
diff --git a/qapi/misc-target.json b/qapi/misc-target.json
new file mode 100644
index 0000000000..a00fd821eb
--- /dev/null
+++ b/qapi/misc-target.json
@@ -0,0 +1,268 @@
+# -*- Mode: Python -*-
+#
+
+##
+# @RTC_CHANGE:
+#
+# Emitted when the guest changes the RTC time.
+#
+# @offset: offset between base RTC clock (as specified by -rtc base), and
+#          new RTC clock value
+#
+# Note: This event is rate-limited.
+#
+# Since: 0.13.0
+#
+# Example:
+#
+# <-   { "event": "RTC_CHANGE",
+#        "data": { "offset": 78 },
+#        "timestamp": { "seconds": 1267020223, "microseconds": 435656 } }
+#
+##
+{ 'event': 'RTC_CHANGE',
+  'data': { 'offset': 'int' },
+  'if': 'defined(TARGET_ALPHA) || defined(TARGET_ARM) || defined(TARGET_HPPA) || defined(TARGET_I386) || defined(TARGET_MIPS) || defined(TARGET_MIPS64) || defined(TARGET_MOXIE) || defined(TARGET_PPC) || defined(TARGET_PPC64) || defined(TARGET_S390X) || defined(TARGET_SH4) || defined(TARGET_SPARC)' }
+
+##
+# @rtc-reset-reinjection:
+#
+# This command will reset the RTC interrupt reinjection backlog.
+# Can be used if another mechanism to synchronize guest time
+# is in effect, for example QEMU guest agent's guest-set-time
+# command.
+#
+# Since: 2.1
+#
+# Example:
+#
+# -> { "execute": "rtc-reset-reinjection" }
+# <- { "return": {} }
+#
+##
+{ 'command': 'rtc-reset-reinjection',
+  'if': 'defined(TARGET_I386)' }
+
+
+##
+# @SevState:
+#
+# An enumeration of SEV state information used during @query-sev.
+#
+# @uninit: The guest is uninitialized.
+#
+# @launch-update: The guest is currently being launched; plaintext data and
+#                 register state is being imported.
+#
+# @launch-secret: The guest is currently being launched; ciphertext data
+#                 is being imported.
+#
+# @running: The guest is fully launched or migrated in.
+#
+# @send-update: The guest is currently being migrated out to another machine.
+#
+# @receive-update: The guest is currently being migrated from another machine.
+#
+# Since: 2.12
+##
+{ 'enum': 'SevState',
+  'data': ['uninit', 'launch-update', 'launch-secret', 'running',
+           'send-update', 'receive-update' ],
+  'if': 'defined(TARGET_I386)' }
+
+##
+# @SevInfo:
+#
+# Information about Secure Encrypted Virtualization (SEV) support
+#
+# @enabled: true if SEV is active
+#
+# @api-major: SEV API major version
+#
+# @api-minor: SEV API minor version
+#
+# @build-id: SEV FW build id
+#
+# @policy: SEV policy value
+#
+# @state: SEV guest state
+#
+# @handle: SEV firmware handle
+#
+# Since: 2.12
+##
+{ 'struct': 'SevInfo',
+    'data': { 'enabled': 'bool',
+              'api-major': 'uint8',
+              'api-minor' : 'uint8',
+              'build-id' : 'uint8',
+              'policy' : 'uint32',
+              'state' : 'SevState',
+              'handle' : 'uint32'
+            },
+  'if': 'defined(TARGET_I386)'
+}
+
+##
+# @query-sev:
+#
+# Returns information about SEV
+#
+# Returns: @SevInfo
+#
+# Since: 2.12
+#
+# Example:
+#
+# -> { "execute": "query-sev" }
+# <- { "return": { "enabled": true, "api-major" : 0, "api-minor" : 0,
+#                  "build-id" : 0, "policy" : 0, "state" : "running",
+#                  "handle" : 1 } }
+#
+##
+{ 'command': 'query-sev', 'returns': 'SevInfo',
+  'if': 'defined(TARGET_I386)' }
+
+
+##
+# @SevLaunchMeasureInfo:
+#
+# SEV Guest Launch measurement information
+#
+# @data: the measurement value encoded in base64
+#
+# Since: 2.12
+#
+##
+{ 'struct': 'SevLaunchMeasureInfo', 'data': {'data': 'str'},
+  'if': 'defined(TARGET_I386)' }
+
+##
+# @query-sev-launch-measure:
+#
+# Query the SEV guest launch information.
+#
+# Returns: The @SevLaunchMeasureInfo for the guest
+#
+# Since: 2.12
+#
+# Example:
+#
+# -> { "execute": "query-sev-launch-measure" }
+# <- { "return": { "data": "4l8LXeNlSPUDlXPJG5966/8%YZ" } }
+#
+##
+{ 'command': 'query-sev-launch-measure', 'returns': 'SevLaunchMeasureInfo',
+  'if': 'defined(TARGET_I386)' }
+
+
+##
+# @SevCapability:
+#
+# The struct describes capability for a Secure Encrypted Virtualization
+# feature.
+#
+# @pdh:  Platform Diffie-Hellman key (base64 encoded)
+#
+# @cert-chain:  PDH certificate chain (base64 encoded)
+#
+# @cbitpos: C-bit location in page table entry
+#
+# @reduced-phys-bits: Number of physical Address bit reduction when SEV is
+#                     enabled
+#
+# Since: 2.12
+##
+{ 'struct': 'SevCapability',
+  'data': { 'pdh': 'str',
+            'cert-chain': 'str',
+            'cbitpos': 'int',
+            'reduced-phys-bits': 'int'},
+  'if': 'defined(TARGET_I386)' }
+
+##
+# @query-sev-capabilities:
+#
+# This command is used to get the SEV capabilities, and is supported on AMD
+# X86 platforms only.
+#
+# Returns: SevCapability objects.
+#
+# Since: 2.12
+#
+# Example:
+#
+# -> { "execute": "query-sev-capabilities" }
+# <- { "return": { "pdh": "8CCDD8DDD", "cert-chain": "888CCCDDDEE",
+#                  "cbitpos": 47, "reduced-phys-bits": 5}}
+#
+##
+{ 'command': 'query-sev-capabilities', 'returns': 'SevCapability',
+  'if': 'defined(TARGET_I386)' }
+
+##
+# @dump-skeys:
+#
+# Dump guest's storage keys
+#
+# @filename: the path to the file to dump to
+#
+# This command is only supported on s390 architecture.
+#
+# Since: 2.5
+#
+# Example:
+#
+# -> { "execute": "dump-skeys",
+#      "arguments": { "filename": "/tmp/skeys" } }
+# <- { "return": {} }
+#
+##
+{ 'command': 'dump-skeys',
+  'data': { 'filename': 'str' },
+  'if': 'defined(TARGET_S390X)' }
+
+##
+# @GICCapability:
+#
+# The struct describes capability for a specific GIC (Generic
+# Interrupt Controller) version. These bits are not only decided by
+# QEMU/KVM software version, but also decided by the hardware that
+# the program is running upon.
+#
+# @version:  version of GIC to be described. Currently, only 2 and 3
+#            are supported.
+#
+# @emulated: whether current QEMU/hardware supports emulated GIC
+#            device in user space.
+#
+# @kernel:   whether current QEMU/hardware supports hardware
+#            accelerated GIC device in kernel.
+#
+# Since: 2.6
+##
+{ 'struct': 'GICCapability',
+  'data': { 'version': 'int',
+            'emulated': 'bool',
+            'kernel': 'bool' },
+  'if': 'defined(TARGET_ARM)' }
+
+##
+# @query-gic-capabilities:
+#
+# This command is ARM-only. It will return a list of GICCapability
+# objects that describe its capability bits.
+#
+# Returns: a list of GICCapability objects.
+#
+# Since: 2.6
+#
+# Example:
+#
+# -> { "execute": "query-gic-capabilities" }
+# <- { "return": [{ "version": 2, "emulated": true, "kernel": false },
+#                 { "version": 3, "emulated": false, "kernel": true } ] }
+#
+##
+{ 'command': 'query-gic-capabilities', 'returns': ['GICCapability'],
+  'if': 'defined(TARGET_ARM)' }
diff --git a/qapi/misc.json b/qapi/misc.json
index dc4cf9da20..31427d45a6 100644
--- a/qapi/misc.json
+++ b/qapi/misc.json
@@ -343,276 +343,6 @@
 { 'command': 'query-events', 'returns': ['EventInfo'] }
 
 ##
-# @CpuInfoArch:
-#
-# An enumeration of cpu types that enable additional information during
-# @query-cpus and @query-cpus-fast.
-#
-# @s390: since 2.12
-#
-# @riscv: since 2.12
-#
-# Since: 2.6
-##
-{ 'enum': 'CpuInfoArch',
-  'data': ['x86', 'sparc', 'ppc', 'mips', 'tricore', 's390', 'riscv', 'other' ] }
-
-##
-# @CpuInfo:
-#
-# Information about a virtual CPU
-#
-# @CPU: the index of the virtual CPU
-#
-# @current: this only exists for backwards compatibility and should be ignored
-#
-# @halted: true if the virtual CPU is in the halt state.  Halt usually refers
-#          to a processor specific low power mode.
-#
-# @qom_path: path to the CPU object in the QOM tree (since 2.4)
-#
-# @thread_id: ID of the underlying host thread
-#
-# @props: properties describing to which node/socket/core/thread
-#         virtual CPU belongs to, provided if supported by board (since 2.10)
-#
-# @arch: architecture of the cpu, which determines which additional fields
-#        will be listed (since 2.6)
-#
-# Since: 0.14.0
-#
-# Notes: @halted is a transient state that changes frequently.  By the time the
-#        data is sent to the client, the guest may no longer be halted.
-##
-{ 'union': 'CpuInfo',
-  'base': {'CPU': 'int', 'current': 'bool', 'halted': 'bool',
-           'qom_path': 'str', 'thread_id': 'int',
-           '*props': 'CpuInstanceProperties', 'arch': 'CpuInfoArch' },
-  'discriminator': 'arch',
-  'data': { 'x86': 'CpuInfoX86',
-            'sparc': 'CpuInfoSPARC',
-            'ppc': 'CpuInfoPPC',
-            'mips': 'CpuInfoMIPS',
-            'tricore': 'CpuInfoTricore',
-            's390': 'CpuInfoS390',
-            'riscv': 'CpuInfoRISCV' } }
-
-##
-# @CpuInfoX86:
-#
-# Additional information about a virtual i386 or x86_64 CPU
-#
-# @pc: the 64-bit instruction pointer
-#
-# Since: 2.6
-##
-{ 'struct': 'CpuInfoX86', 'data': { 'pc': 'int' } }
-
-##
-# @CpuInfoSPARC:
-#
-# Additional information about a virtual SPARC CPU
-#
-# @pc: the PC component of the instruction pointer
-#
-# @npc: the NPC component of the instruction pointer
-#
-# Since: 2.6
-##
-{ 'struct': 'CpuInfoSPARC', 'data': { 'pc': 'int', 'npc': 'int' } }
-
-##
-# @CpuInfoPPC:
-#
-# Additional information about a virtual PPC CPU
-#
-# @nip: the instruction pointer
-#
-# Since: 2.6
-##
-{ 'struct': 'CpuInfoPPC', 'data': { 'nip': 'int' } }
-
-##
-# @CpuInfoMIPS:
-#
-# Additional information about a virtual MIPS CPU
-#
-# @PC: the instruction pointer
-#
-# Since: 2.6
-##
-{ 'struct': 'CpuInfoMIPS', 'data': { 'PC': 'int' } }
-
-##
-# @CpuInfoTricore:
-#
-# Additional information about a virtual Tricore CPU
-#
-# @PC: the instruction pointer
-#
-# Since: 2.6
-##
-{ 'struct': 'CpuInfoTricore', 'data': { 'PC': 'int' } }
-
-##
-# @CpuInfoRISCV:
-#
-# Additional information about a virtual RISCV CPU
-#
-# @pc: the instruction pointer
-#
-# Since 2.12
-##
-{ 'struct': 'CpuInfoRISCV', 'data': { 'pc': 'int' } }
-
-##
-# @CpuS390State:
-#
-# An enumeration of cpu states that can be assumed by a virtual
-# S390 CPU
-#
-# Since: 2.12
-##
-{ 'enum': 'CpuS390State',
-  'prefix': 'S390_CPU_STATE',
-  'data': [ 'uninitialized', 'stopped', 'check-stop', 'operating', 'load' ] }
-
-##
-# @CpuInfoS390:
-#
-# Additional information about a virtual S390 CPU
-#
-# @cpu-state: the virtual CPU's state
-#
-# Since: 2.12
-##
-{ 'struct': 'CpuInfoS390', 'data': { 'cpu-state': 'CpuS390State' } }
-
-##
-# @query-cpus:
-#
-# Returns a list of information about each virtual CPU.
-#
-# This command causes vCPU threads to exit to userspace, which causes
-# a small interruption to guest CPU execution. This will have a negative
-# impact on realtime guests and other latency sensitive guest workloads.
-# It is recommended to use @query-cpus-fast instead of this command to
-# avoid the vCPU interruption.
-#
-# Returns: a list of @CpuInfo for each virtual CPU
-#
-# Since: 0.14.0
-#
-# Example:
-#
-# -> { "execute": "query-cpus" }
-# <- { "return": [
-#          {
-#             "CPU":0,
-#             "current":true,
-#             "halted":false,
-#             "qom_path":"/machine/unattached/device[0]",
-#             "arch":"x86",
-#             "pc":3227107138,
-#             "thread_id":3134
-#          },
-#          {
-#             "CPU":1,
-#             "current":false,
-#             "halted":true,
-#             "qom_path":"/machine/unattached/device[2]",
-#             "arch":"x86",
-#             "pc":7108165,
-#             "thread_id":3135
-#          }
-#       ]
-#    }
-#
-# Notes: This interface is deprecated (since 2.12.0), and it is strongly
-#        recommended that you avoid using it. Use @query-cpus-fast to
-#        obtain information about virtual CPUs.
-#
-##
-{ 'command': 'query-cpus', 'returns': ['CpuInfo'] }
-
-##
-# @CpuInfoFast:
-#
-# Information about a virtual CPU
-#
-# @cpu-index: index of the virtual CPU
-#
-# @qom-path: path to the CPU object in the QOM tree
-#
-# @thread-id: ID of the underlying host thread
-#
-# @props: properties describing to which node/socket/core/thread
-#         virtual CPU belongs to, provided if supported by board
-#
-# @arch: base architecture of the cpu; deprecated since 3.0.0 in favor
-#        of @target
-#
-# @target: the QEMU system emulation target, which determines which
-#          additional fields will be listed (since 3.0)
-#
-# Since: 2.12
-#
-##
-{ 'union'         : 'CpuInfoFast',
-  'base'          : { 'cpu-index'    : 'int',
-                      'qom-path'     : 'str',
-                      'thread-id'    : 'int',
-                      '*props'       : 'CpuInstanceProperties',
-                      'arch'         : 'CpuInfoArch',
-                      'target'       : 'SysEmuTarget' },
-  'discriminator' : 'target',
-  'data'          : { 's390x'        : 'CpuInfoS390' } }
-
-##
-# @query-cpus-fast:
-#
-# Returns information about all virtual CPUs. This command does not
-# incur a performance penalty and should be used in production
-# instead of query-cpus.
-#
-# Returns: list of @CpuInfoFast
-#
-# Since: 2.12
-#
-# Example:
-#
-# -> { "execute": "query-cpus-fast" }
-# <- { "return": [
-#         {
-#             "thread-id": 25627,
-#             "props": {
-#                 "core-id": 0,
-#                 "thread-id": 0,
-#                 "socket-id": 0
-#             },
-#             "qom-path": "/machine/unattached/device[0]",
-#             "arch":"x86",
-#             "target":"x86_64",
-#             "cpu-index": 0
-#         },
-#         {
-#             "thread-id": 25628,
-#             "props": {
-#                 "core-id": 0,
-#                 "thread-id": 0,
-#                 "socket-id": 1
-#             },
-#             "qom-path": "/machine/unattached/device[2]",
-#             "arch":"x86",
-#             "target":"x86_64",
-#             "cpu-index": 1
-#         }
-#     ]
-# }
-##
-{ 'command': 'query-cpus-fast', 'returns': [ 'CpuInfoFast' ] }
-
-##
 # @IOThreadInfo:
 #
 # Information about an iothread
@@ -1106,29 +836,6 @@
 { 'command': 'system_powerdown' }
 
 ##
-# @cpu-add:
-#
-# Adds CPU with specified ID.
-#
-# @id: ID of CPU to be created, valid values [0..max_cpus)
-#
-# Returns: Nothing on success
-#
-# Since: 1.5
-#
-# Note: This command is deprecated.  The `device_add` command should be
-#       used instead.  See the `query-hotpluggable-cpus` command for
-#       details.
-#
-# Example:
-#
-# -> { "execute": "cpu-add", "arguments": { "id": 2 } }
-# <- { "return": {} }
-#
-##
-{ 'command': 'cpu-add', 'data': {'id': 'int'} }
-
-##
 # @memsave:
 #
 # Save a portion of guest memory to a file.
@@ -1343,140 +1050,6 @@
   'returns': 'str' }
 
 ##
-# @ObjectPropertyInfo:
-#
-# @name: the name of the property
-#
-# @type: the type of the property.  This will typically come in one of four
-#        forms:
-#
-#        1) A primitive type such as 'u8', 'u16', 'bool', 'str', or 'double'.
-#           These types are mapped to the appropriate JSON type.
-#
-#        2) A child type in the form 'child<subtype>' where subtype is a qdev
-#           device type name.  Child properties create the composition tree.
-#
-#        3) A link type in the form 'link<subtype>' where subtype is a qdev
-#           device type name.  Link properties form the device model graph.
-#
-# @description: if specified, the description of the property.
-#
-# Since: 1.2
-##
-{ 'struct': 'ObjectPropertyInfo',
-  'data': { 'name': 'str', 'type': 'str', '*description': 'str' } }
-
-##
-# @qom-list:
-#
-# This command will list any properties of a object given a path in the object
-# model.
-#
-# @path: the path within the object model.  See @qom-get for a description of
-#        this parameter.
-#
-# Returns: a list of @ObjectPropertyInfo that describe the properties of the
-#          object.
-#
-# Since: 1.2
-#
-# Example:
-#
-# -> { "execute": "qom-list",
-#      "arguments": { "path": "/chardevs" } }
-# <- { "return": [ { "name": "type", "type": "string" },
-#                  { "name": "parallel0", "type": "child<chardev-vc>" },
-#                  { "name": "serial0", "type": "child<chardev-vc>" },
-#                  { "name": "mon0", "type": "child<chardev-stdio>" } ] }
-#
-##
-{ 'command': 'qom-list',
-  'data': { 'path': 'str' },
-  'returns': [ 'ObjectPropertyInfo' ],
-  'allow-preconfig': true }
-
-##
-# @qom-get:
-#
-# This command will get a property from a object model path and return the
-# value.
-#
-# @path: The path within the object model.  There are two forms of supported
-#        paths--absolute and partial paths.
-#
-#        Absolute paths are derived from the root object and can follow child<>
-#        or link<> properties.  Since they can follow link<> properties, they
-#        can be arbitrarily long.  Absolute paths look like absolute filenames
-#        and are prefixed  with a leading slash.
-#
-#        Partial paths look like relative filenames.  They do not begin
-#        with a prefix.  The matching rules for partial paths are subtle but
-#        designed to make specifying objects easy.  At each level of the
-#        composition tree, the partial path is matched as an absolute path.
-#        The first match is not returned.  At least two matches are searched
-#        for.  A successful result is only returned if only one match is
-#        found.  If more than one match is found, a flag is return to
-#        indicate that the match was ambiguous.
-#
-# @property: The property name to read
-#
-# Returns: The property value.  The type depends on the property
-#          type. child<> and link<> properties are returned as #str
-#          pathnames.  All integer property types (u8, u16, etc) are
-#          returned as #int.
-#
-# Since: 1.2
-#
-# Example:
-#
-# 1. Use absolute path
-#
-# -> { "execute": "qom-get",
-#      "arguments": { "path": "/machine/unattached/device[0]",
-#                     "property": "hotplugged" } }
-# <- { "return": false }
-#
-# 2. Use partial path
-#
-# -> { "execute": "qom-get",
-#      "arguments": { "path": "unattached/sysbus",
-#                     "property": "type" } }
-# <- { "return": "System" }
-#
-##
-{ 'command': 'qom-get',
-  'data': { 'path': 'str', 'property': 'str' },
-  'returns': 'any',
-  'allow-preconfig': true }
-
-##
-# @qom-set:
-#
-# This command will set a property from a object model path.
-#
-# @path: see @qom-get for a description of this parameter
-#
-# @property: the property name to set
-#
-# @value: a value who's type is appropriate for the property type.  See @qom-get
-#         for a description of type mapping.
-#
-# Since: 1.2
-#
-# Example:
-#
-# -> { "execute": "qom-set",
-#      "arguments": { "path": "/machine",
-#                     "property": "graphics",
-#                     "value": false } }
-# <- { "return": {} }
-#
-##
-{ 'command': 'qom-set',
-  'data': { 'path': 'str', 'property': 'str', 'value': 'any' },
-  'allow-preconfig': true }
-
-##
 # @change:
 #
 # This command is multiple commands multiplexed together.
@@ -1525,80 +1098,6 @@
   'data': {'device': 'str', 'target': 'str', '*arg': 'str'} }
 
 ##
-# @ObjectTypeInfo:
-#
-# This structure describes a search result from @qom-list-types
-#
-# @name: the type name found in the search
-#
-# @abstract: the type is abstract and can't be directly instantiated.
-#            Omitted if false. (since 2.10)
-#
-# @parent: Name of parent type, if any (since 2.10)
-#
-# Since: 1.1
-##
-{ 'struct': 'ObjectTypeInfo',
-  'data': { 'name': 'str', '*abstract': 'bool', '*parent': 'str' } }
-
-##
-# @qom-list-types:
-#
-# This command will return a list of types given search parameters
-#
-# @implements: if specified, only return types that implement this type name
-#
-# @abstract: if true, include abstract types in the results
-#
-# Returns: a list of @ObjectTypeInfo or an empty list if no results are found
-#
-# Since: 1.1
-##
-{ 'command': 'qom-list-types',
-  'data': { '*implements': 'str', '*abstract': 'bool' },
-  'returns': [ 'ObjectTypeInfo' ],
-  'allow-preconfig': true }
-
-##
-# @device-list-properties:
-#
-# List properties associated with a device.
-#
-# @typename: the type name of a device
-#
-# Returns: a list of ObjectPropertyInfo describing a devices properties
-#
-# Note: objects can create properties at runtime, for example to describe
-# links between different devices and/or objects. These properties
-# are not included in the output of this command.
-#
-# Since: 1.2
-##
-{ 'command': 'device-list-properties',
-  'data': { 'typename': 'str'},
-  'returns': [ 'ObjectPropertyInfo' ] }
-
-##
-# @qom-list-properties:
-#
-# List properties associated with a QOM object.
-#
-# @typename: the type name of an object
-#
-# Note: objects can create properties at runtime, for example to describe
-# links between different devices and/or objects. These properties
-# are not included in the output of this command.
-#
-# Returns: a list of ObjectPropertyInfo describing object properties
-#
-# Since: 2.12
-##
-{ 'command': 'qom-list-properties',
-  'data': { 'typename': 'str'},
-  'returns': [ 'ObjectPropertyInfo' ],
-  'allow-preconfig': true }
-
-##
 # @xen-set-global-dirty-log:
 #
 # Enable or disable the global dirty log mode.
@@ -1619,341 +1118,6 @@
 { 'command': 'xen-set-global-dirty-log', 'data': { 'enable': 'bool' } }
 
 ##
-# @device_add:
-#
-# @driver: the name of the new device's driver
-#
-# @bus: the device's parent bus (device tree path)
-#
-# @id: the device's ID, must be unique
-#
-# Additional arguments depend on the type.
-#
-# Add a device.
-#
-# Notes:
-# 1. For detailed information about this command, please refer to the
-#    'docs/qdev-device-use.txt' file.
-#
-# 2. It's possible to list device properties by running QEMU with the
-#    "-device DEVICE,help" command-line argument, where DEVICE is the
-#    device's name
-#
-# Example:
-#
-# -> { "execute": "device_add",
-#      "arguments": { "driver": "e1000", "id": "net1",
-#                     "bus": "pci.0",
-#                     "mac": "52:54:00:12:34:56" } }
-# <- { "return": {} }
-#
-# TODO: This command effectively bypasses QAPI completely due to its
-# "additional arguments" business.  It shouldn't have been added to
-# the schema in this form.  It should be qapified properly, or
-# replaced by a properly qapified command.
-#
-# Since: 0.13
-##
-{ 'command': 'device_add',
-  'data': {'driver': 'str', '*bus': 'str', '*id': 'str'},
-  'gen': false } # so we can get the additional arguments
-
-##
-# @device_del:
-#
-# Remove a device from a guest
-#
-# @id: the device's ID or QOM path
-#
-# Returns: Nothing on success
-#          If @id is not a valid device, DeviceNotFound
-#
-# Notes: When this command completes, the device may not be removed from the
-#        guest.  Hot removal is an operation that requires guest cooperation.
-#        This command merely requests that the guest begin the hot removal
-#        process.  Completion of the device removal process is signaled with a
-#        DEVICE_DELETED event. Guest reset will automatically complete removal
-#        for all devices.
-#
-# Since: 0.14.0
-#
-# Example:
-#
-# -> { "execute": "device_del",
-#      "arguments": { "id": "net1" } }
-# <- { "return": {} }
-#
-# -> { "execute": "device_del",
-#      "arguments": { "id": "/machine/peripheral-anon/device[0]" } }
-# <- { "return": {} }
-#
-##
-{ 'command': 'device_del', 'data': {'id': 'str'} }
-
-##
-# @DEVICE_DELETED:
-#
-# Emitted whenever the device removal completion is acknowledged by the guest.
-# At this point, it's safe to reuse the specified device ID. Device removal can
-# be initiated by the guest or by HMP/QMP commands.
-#
-# @device: device name
-#
-# @path: device path
-#
-# Since: 1.5
-#
-# Example:
-#
-# <- { "event": "DEVICE_DELETED",
-#      "data": { "device": "virtio-net-pci-0",
-#                "path": "/machine/peripheral/virtio-net-pci-0" },
-#      "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
-#
-##
-{ 'event': 'DEVICE_DELETED',
-  'data': { '*device': 'str', 'path': 'str' } }
-
-##
-# @DumpGuestMemoryFormat:
-#
-# An enumeration of guest-memory-dump's format.
-#
-# @elf: elf format
-#
-# @kdump-zlib: kdump-compressed format with zlib-compressed
-#
-# @kdump-lzo: kdump-compressed format with lzo-compressed
-#
-# @kdump-snappy: kdump-compressed format with snappy-compressed
-#
-# @win-dmp: Windows full crashdump format,
-#           can be used instead of ELF converting (since 2.13)
-#
-# Since: 2.0
-##
-{ 'enum': 'DumpGuestMemoryFormat',
-  'data': [ 'elf', 'kdump-zlib', 'kdump-lzo', 'kdump-snappy', 'win-dmp' ] }
-
-##
-# @dump-guest-memory:
-#
-# Dump guest's memory to vmcore. It is a synchronous operation that can take
-# very long depending on the amount of guest memory.
-#
-# @paging: if true, do paging to get guest's memory mapping. This allows
-#          using gdb to process the core file.
-#
-#          IMPORTANT: this option can make QEMU allocate several gigabytes
-#                     of RAM. This can happen for a large guest, or a
-#                     malicious guest pretending to be large.
-#
-#          Also, paging=true has the following limitations:
-#
-#             1. The guest may be in a catastrophic state or can have corrupted
-#                memory, which cannot be trusted
-#             2. The guest can be in real-mode even if paging is enabled. For
-#                example, the guest uses ACPI to sleep, and ACPI sleep state
-#                goes in real-mode
-#             3. Currently only supported on i386 and x86_64.
-#
-# @protocol: the filename or file descriptor of the vmcore. The supported
-#            protocols are:
-#
-#            1. file: the protocol starts with "file:", and the following
-#               string is the file's path.
-#            2. fd: the protocol starts with "fd:", and the following string
-#               is the fd's name.
-#
-# @detach: if true, QMP will return immediately rather than
-#          waiting for the dump to finish. The user can track progress
-#          using "query-dump". (since 2.6).
-#
-# @begin: if specified, the starting physical address.
-#
-# @length: if specified, the memory size, in bytes. If you don't
-#          want to dump all guest's memory, please specify the start @begin
-#          and @length
-#
-# @format: if specified, the format of guest memory dump. But non-elf
-#          format is conflict with paging and filter, ie. @paging, @begin and
-#          @length is not allowed to be specified with non-elf @format at the
-#          same time (since 2.0)
-#
-# Note: All boolean arguments default to false
-#
-# Returns: nothing on success
-#
-# Since: 1.2
-#
-# Example:
-#
-# -> { "execute": "dump-guest-memory",
-#      "arguments": { "protocol": "fd:dump" } }
-# <- { "return": {} }
-#
-##
-{ 'command': 'dump-guest-memory',
-  'data': { 'paging': 'bool', 'protocol': 'str', '*detach': 'bool',
-            '*begin': 'int', '*length': 'int',
-            '*format': 'DumpGuestMemoryFormat'} }
-
-##
-# @DumpStatus:
-#
-# Describe the status of a long-running background guest memory dump.
-#
-# @none: no dump-guest-memory has started yet.
-#
-# @active: there is one dump running in background.
-#
-# @completed: the last dump has finished successfully.
-#
-# @failed: the last dump has failed.
-#
-# Since: 2.6
-##
-{ 'enum': 'DumpStatus',
-  'data': [ 'none', 'active', 'completed', 'failed' ] }
-
-##
-# @DumpQueryResult:
-#
-# The result format for 'query-dump'.
-#
-# @status: enum of @DumpStatus, which shows current dump status
-#
-# @completed: bytes written in latest dump (uncompressed)
-#
-# @total: total bytes to be written in latest dump (uncompressed)
-#
-# Since: 2.6
-##
-{ 'struct': 'DumpQueryResult',
-  'data': { 'status': 'DumpStatus',
-            'completed': 'int',
-            'total': 'int' } }
-
-##
-# @query-dump:
-#
-# Query latest dump status.
-#
-# Returns: A @DumpStatus object showing the dump status.
-#
-# Since: 2.6
-#
-# Example:
-#
-# -> { "execute": "query-dump" }
-# <- { "return": { "status": "active", "completed": 1024000,
-#                  "total": 2048000 } }
-#
-##
-{ 'command': 'query-dump', 'returns': 'DumpQueryResult' }
-
-##
-# @DUMP_COMPLETED:
-#
-# Emitted when background dump has completed
-#
-# @result: final dump status
-#
-# @error: human-readable error string that provides
-#         hint on why dump failed. Only presents on failure. The
-#         user should not try to interpret the error string.
-#
-# Since: 2.6
-#
-# Example:
-#
-# { "event": "DUMP_COMPLETED",
-#   "data": {"result": {"total": 1090650112, "status": "completed",
-#                       "completed": 1090650112} } }
-#
-##
-{ 'event': 'DUMP_COMPLETED' ,
-  'data': { 'result': 'DumpQueryResult', '*error': 'str' } }
-
-##
-# @DumpGuestMemoryCapability:
-#
-# A list of the available formats for dump-guest-memory
-#
-# Since: 2.0
-##
-{ 'struct': 'DumpGuestMemoryCapability',
-  'data': {
-      'formats': ['DumpGuestMemoryFormat'] } }
-
-##
-# @query-dump-guest-memory-capability:
-#
-# Returns the available formats for dump-guest-memory
-#
-# Returns:  A @DumpGuestMemoryCapability object listing available formats for
-#           dump-guest-memory
-#
-# Since: 2.0
-#
-# Example:
-#
-# -> { "execute": "query-dump-guest-memory-capability" }
-# <- { "return": { "formats":
-#                  ["elf", "kdump-zlib", "kdump-lzo", "kdump-snappy"] }
-#
-##
-{ 'command': 'query-dump-guest-memory-capability',
-  'returns': 'DumpGuestMemoryCapability' }
-
-##
-# @object-add:
-#
-# Create a QOM object.
-#
-# @qom-type: the class name for the object to be created
-#
-# @id: the name of the new object
-#
-# @props: a dictionary of properties to be passed to the backend
-#
-# Returns: Nothing on success
-#          Error if @qom-type is not a valid class name
-#
-# Since: 2.0
-#
-# Example:
-#
-# -> { "execute": "object-add",
-#      "arguments": { "qom-type": "rng-random", "id": "rng1",
-#                     "props": { "filename": "/dev/hwrng" } } }
-# <- { "return": {} }
-#
-##
-{ 'command': 'object-add',
-  'data': {'qom-type': 'str', 'id': 'str', '*props': 'any'} }
-
-##
-# @object-del:
-#
-# Remove a QOM object.
-#
-# @id: the name of the QOM object to remove
-#
-# Returns: Nothing on success
-#          Error if @id is not a valid id for a QOM object
-#
-# Since: 2.0
-#
-# Example:
-#
-# -> { "execute": "object-del", "arguments": { "id": "rng1" } }
-# <- { "return": {} }
-#
-##
-{ 'command': 'object-del', 'data': {'id': 'str'} }
-
-##
 # @getfd:
 #
 # Receive a file descriptor via SCM rights and assign it a name
@@ -1999,64 +1163,6 @@
 { 'command': 'closefd', 'data': {'fdname': 'str'} }
 
 ##
-# @MachineInfo:
-#
-# Information describing a machine.
-#
-# @name: the name of the machine
-#
-# @alias: an alias for the machine name
-#
-# @is-default: whether the machine is default
-#
-# @cpu-max: maximum number of CPUs supported by the machine type
-#           (since 1.5.0)
-#
-# @hotpluggable-cpus: cpu hotplug via -device is supported (since 2.7.0)
-#
-# Since: 1.2.0
-##
-{ 'struct': 'MachineInfo',
-  'data': { 'name': 'str', '*alias': 'str',
-            '*is-default': 'bool', 'cpu-max': 'int',
-            'hotpluggable-cpus': 'bool'} }
-
-##
-# @query-machines:
-#
-# Return a list of supported machines
-#
-# Returns: a list of MachineInfo
-#
-# Since: 1.2.0
-##
-{ 'command': 'query-machines', 'returns': ['MachineInfo'] }
-
-##
-# @CurrentMachineParams:
-#
-# Information describing the running machine parameters.
-#
-# @wakeup-suspend-support: true if the machine supports wake up from
-#                          suspend
-#
-# Since: 4.0
-##
-{ 'struct': 'CurrentMachineParams',
-  'data': { 'wakeup-suspend-support': 'bool'} }
-
-##
-# @query-current-machine:
-#
-# Return information on the current virtual machine.
-#
-# Returns: CurrentMachineParams
-#
-# Since: 4.0
-##
-{ 'command': 'query-current-machine', 'returns': 'CurrentMachineParams' }
-
-##
 # @MemoryInfo:
 #
 # Actual memory information in bytes.
@@ -2090,80 +1196,6 @@
 
 
 ##
-# @CpuModelInfo:
-#
-# Virtual CPU model.
-#
-# A CPU model consists of the name of a CPU definition, to which
-# delta changes are applied (e.g. features added/removed). Most magic values
-# that an architecture might require should be hidden behind the name.
-# However, if required, architectures can expose relevant properties.
-#
-# @name: the name of the CPU definition the model is based on
-# @props: a dictionary of QOM properties to be applied
-#
-# Since: 2.8.0
-##
-{ 'struct': 'CpuModelInfo',
-  'data': { 'name': 'str',
-            '*props': 'any' } }
-
-##
-# @CpuModelExpansionType:
-#
-# An enumeration of CPU model expansion types.
-#
-# @static: Expand to a static CPU model, a combination of a static base
-#          model name and property delta changes. As the static base model will
-#          never change, the expanded CPU model will be the same, independent of
-#          QEMU version, machine type, machine options, and accelerator options.
-#          Therefore, the resulting model can be used by tooling without having
-#          to specify a compatibility machine - e.g. when displaying the "host"
-#          model. The @static CPU models are migration-safe.
-
-# @full: Expand all properties. The produced model is not guaranteed to be
-#        migration-safe, but allows tooling to get an insight and work with
-#        model details.
-#
-# Note: When a non-migration-safe CPU model is expanded in static mode, some
-# features enabled by the CPU model may be omitted, because they can't be
-# implemented by a static CPU model definition (e.g. cache info passthrough and
-# PMU passthrough in x86). If you need an accurate representation of the
-# features enabled by a non-migration-safe CPU model, use @full. If you need a
-# static representation that will keep ABI compatibility even when changing QEMU
-# version or machine-type, use @static (but keep in mind that some features may
-# be omitted).
-#
-# Since: 2.8.0
-##
-{ 'enum': 'CpuModelExpansionType',
-  'data': [ 'static', 'full' ] }
-
-
-##
-# @CpuModelCompareResult:
-#
-# An enumeration of CPU model comparison results. The result is usually
-# calculated using e.g. CPU features or CPU generations.
-#
-# @incompatible: If model A is incompatible to model B, model A is not
-#                guaranteed to run where model B runs and the other way around.
-#
-# @identical: If model A is identical to model B, model A is guaranteed to run
-#             where model B runs and the other way around.
-#
-# @superset: If model A is a superset of model B, model B is guaranteed to run
-#            where model A runs. There are no guarantees about the other way.
-#
-# @subset: If model A is a subset of model B, model A is guaranteed to run
-#          where model B runs. There are no guarantees about the other way.
-#
-# Since: 2.8.0
-##
-{ 'enum': 'CpuModelCompareResult',
-  'data': [ 'incompatible', 'identical', 'superset', 'subset' ] }
-
-##
 # @AddfdInfo:
 #
 # Information about a file descriptor that was added to an fd set.
@@ -2484,226 +1516,6 @@
  'allow-preconfig': true }
 
 ##
-# @X86CPURegister32:
-#
-# A X86 32-bit register
-#
-# Since: 1.5
-##
-{ 'enum': 'X86CPURegister32',
-  'data': [ 'EAX', 'EBX', 'ECX', 'EDX', 'ESP', 'EBP', 'ESI', 'EDI' ] }
-
-##
-# @X86CPUFeatureWordInfo:
-#
-# Information about a X86 CPU feature word
-#
-# @cpuid-input-eax: Input EAX value for CPUID instruction for that feature word
-#
-# @cpuid-input-ecx: Input ECX value for CPUID instruction for that
-#                   feature word
-#
-# @cpuid-register: Output register containing the feature bits
-#
-# @features: value of output register, containing the feature bits
-#
-# Since: 1.5
-##
-{ 'struct': 'X86CPUFeatureWordInfo',
-  'data': { 'cpuid-input-eax': 'int',
-            '*cpuid-input-ecx': 'int',
-            'cpuid-register': 'X86CPURegister32',
-            'features': 'int' } }
-
-##
-# @DummyForceArrays:
-#
-# Not used by QMP; hack to let us use X86CPUFeatureWordInfoList internally
-#
-# Since: 2.5
-##
-{ 'struct': 'DummyForceArrays',
-  'data': { 'unused': ['X86CPUFeatureWordInfo'] } }
-
-
-##
-# @NumaOptionsType:
-#
-# @node: NUMA nodes configuration
-#
-# @dist: NUMA distance configuration (since 2.10)
-#
-# @cpu: property based CPU(s) to node mapping (Since: 2.10)
-#
-# Since: 2.1
-##
-{ 'enum': 'NumaOptionsType',
-  'data': [ 'node', 'dist', 'cpu' ] }
-
-##
-# @NumaOptions:
-#
-# A discriminated record of NUMA options. (for OptsVisitor)
-#
-# Since: 2.1
-##
-{ 'union': 'NumaOptions',
-  'base': { 'type': 'NumaOptionsType' },
-  'discriminator': 'type',
-  'data': {
-    'node': 'NumaNodeOptions',
-    'dist': 'NumaDistOptions',
-    'cpu': 'NumaCpuOptions' }}
-
-##
-# @NumaNodeOptions:
-#
-# Create a guest NUMA node. (for OptsVisitor)
-#
-# @nodeid: NUMA node ID (increase by 1 from 0 if omitted)
-#
-# @cpus: VCPUs belonging to this node (assign VCPUS round-robin
-#         if omitted)
-#
-# @mem: memory size of this node; mutually exclusive with @memdev.
-#       Equally divide total memory among nodes if both @mem and @memdev are
-#       omitted.
-#
-# @memdev: memory backend object.  If specified for one node,
-#          it must be specified for all nodes.
-#
-# Since: 2.1
-##
-{ 'struct': 'NumaNodeOptions',
-  'data': {
-   '*nodeid': 'uint16',
-   '*cpus':   ['uint16'],
-   '*mem':    'size',
-   '*memdev': 'str' }}
-
-##
-# @NumaDistOptions:
-#
-# Set the distance between 2 NUMA nodes.
-#
-# @src: source NUMA node.
-#
-# @dst: destination NUMA node.
-#
-# @val: NUMA distance from source node to destination node.
-#       When a node is unreachable from another node, set the distance
-#       between them to 255.
-#
-# Since: 2.10
-##
-{ 'struct': 'NumaDistOptions',
-  'data': {
-   'src': 'uint16',
-   'dst': 'uint16',
-   'val': 'uint8' }}
-
-##
-# @NumaCpuOptions:
-#
-# Option "-numa cpu" overrides default cpu to node mapping.
-# It accepts the same set of cpu properties as returned by
-# query-hotpluggable-cpus[].props, where node-id could be used to
-# override default node mapping.
-#
-# Since: 2.10
-##
-{ 'struct': 'NumaCpuOptions',
-   'base': 'CpuInstanceProperties',
-   'data' : {} }
-
-##
-# @HostMemPolicy:
-#
-# Host memory policy types
-#
-# @default: restore default policy, remove any nondefault policy
-#
-# @preferred: set the preferred host nodes for allocation
-#
-# @bind: a strict policy that restricts memory allocation to the
-#        host nodes specified
-#
-# @interleave: memory allocations are interleaved across the set
-#              of host nodes specified
-#
-# Since: 2.1
-##
-{ 'enum': 'HostMemPolicy',
-  'data': [ 'default', 'preferred', 'bind', 'interleave' ] }
-
-##
-# @Memdev:
-#
-# Information about memory backend
-#
-# @id: backend's ID if backend has 'id' property (since 2.9)
-#
-# @size: memory backend size
-#
-# @merge: enables or disables memory merge support
-#
-# @dump: includes memory backend's memory in a core dump or not
-#
-# @prealloc: enables or disables memory preallocation
-#
-# @host-nodes: host nodes for its memory policy
-#
-# @policy: memory policy of memory backend
-#
-# Since: 2.1
-##
-{ 'struct': 'Memdev',
-  'data': {
-    '*id':        'str',
-    'size':       'size',
-    'merge':      'bool',
-    'dump':       'bool',
-    'prealloc':   'bool',
-    'host-nodes': ['uint16'],
-    'policy':     'HostMemPolicy' }}
-
-##
-# @query-memdev:
-#
-# Returns information for all memory backends.
-#
-# Returns: a list of @Memdev.
-#
-# Since: 2.1
-#
-# Example:
-#
-# -> { "execute": "query-memdev" }
-# <- { "return": [
-#        {
-#          "id": "mem1",
-#          "size": 536870912,
-#          "merge": false,
-#          "dump": true,
-#          "prealloc": false,
-#          "host-nodes": [0, 1],
-#          "policy": "bind"
-#        },
-#        {
-#          "size": 536870912,
-#          "merge": false,
-#          "dump": true,
-#          "prealloc": true,
-#          "host-nodes": [2, 3],
-#          "policy": "preferred"
-#        }
-#      ]
-#    }
-#
-##
-{ 'command': 'query-memdev', 'returns': ['Memdev'], 'allow-preconfig': true }
-
-##
 # @PCDIMMDeviceInfo:
 #
 # PCDIMMDevice state information
@@ -2912,109 +1724,6 @@
 { 'command': 'xen-load-devices-state', 'data': {'filename': 'str'} }
 
 ##
-# @CpuInstanceProperties:
-#
-# List of properties to be used for hotplugging a CPU instance,
-# it should be passed by management with device_add command when
-# a CPU is being hotplugged.
-#
-# @node-id: NUMA node ID the CPU belongs to
-# @socket-id: socket number within node/board the CPU belongs to
-# @core-id: core number within socket the CPU belongs to
-# @thread-id: thread number within core the CPU belongs to
-#
-# Note: currently there are 4 properties that could be present
-# but management should be prepared to pass through other
-# properties with device_add command to allow for future
-# interface extension. This also requires the filed names to be kept in
-# sync with the properties passed to -device/device_add.
-#
-# Since: 2.7
-##
-{ 'struct': 'CpuInstanceProperties',
-  'data': { '*node-id': 'int',
-            '*socket-id': 'int',
-            '*core-id': 'int',
-            '*thread-id': 'int'
-  }
-}
-
-##
-# @HotpluggableCPU:
-#
-# @type: CPU object type for usage with device_add command
-# @props: list of properties to be used for hotplugging CPU
-# @vcpus-count: number of logical VCPU threads @HotpluggableCPU provides
-# @qom-path: link to existing CPU object if CPU is present or
-#            omitted if CPU is not present.
-#
-# Since: 2.7
-##
-{ 'struct': 'HotpluggableCPU',
-  'data': { 'type': 'str',
-            'vcpus-count': 'int',
-            'props': 'CpuInstanceProperties',
-            '*qom-path': 'str'
-          }
-}
-
-##
-# @query-hotpluggable-cpus:
-#
-# TODO: Better documentation; currently there is none.
-#
-# Returns: a list of HotpluggableCPU objects.
-#
-# Since: 2.7
-#
-# Example:
-#
-# For pseries machine type started with -smp 2,cores=2,maxcpus=4 -cpu POWER8:
-#
-# -> { "execute": "query-hotpluggable-cpus" }
-# <- {"return": [
-#      { "props": { "core": 8 }, "type": "POWER8-spapr-cpu-core",
-#        "vcpus-count": 1 },
-#      { "props": { "core": 0 }, "type": "POWER8-spapr-cpu-core",
-#        "vcpus-count": 1, "qom-path": "/machine/unattached/device[0]"}
-#    ]}'
-#
-# For pc machine type started with -smp 1,maxcpus=2:
-#
-# -> { "execute": "query-hotpluggable-cpus" }
-# <- {"return": [
-#      {
-#         "type": "qemu64-x86_64-cpu", "vcpus-count": 1,
-#         "props": {"core-id": 0, "socket-id": 1, "thread-id": 0}
-#      },
-#      {
-#         "qom-path": "/machine/unattached/device[0]",
-#         "type": "qemu64-x86_64-cpu", "vcpus-count": 1,
-#         "props": {"core-id": 0, "socket-id": 0, "thread-id": 0}
-#      }
-#    ]}
-#
-# For s390x-virtio-ccw machine type started with -smp 1,maxcpus=2 -cpu qemu
-# (Since: 2.11):
-#
-# -> { "execute": "query-hotpluggable-cpus" }
-# <- {"return": [
-#      {
-#         "type": "qemu-s390x-cpu", "vcpus-count": 1,
-#         "props": { "core-id": 1 }
-#      },
-#      {
-#         "qom-path": "/machine/unattached/device[0]",
-#         "type": "qemu-s390x-cpu", "vcpus-count": 1,
-#         "props": { "core-id": 0 }
-#      }
-#    ]}
-#
-##
-{ 'command': 'query-hotpluggable-cpus', 'returns': ['HotpluggableCPU'],
-             'allow-preconfig': true }
-
-##
 # @GuidInfo:
 #
 # GUID information.
@@ -3034,16 +1743,3 @@
 ##
 { 'command': 'query-vm-generation-id', 'returns': 'GuidInfo' }
 
-##
-# @set-numa-node:
-#
-# Runtime equivalent of '-numa' CLI option, available at
-# preconfigure stage to configure numa mapping before initializing
-# machine.
-#
-# Since 3.0
-##
-{ 'command': 'set-numa-node', 'boxed': true,
-  'data': 'NumaOptions',
-  'allow-preconfig': true
-}
diff --git a/qapi/qapi-schema.json b/qapi/qapi-schema.json
index 4bd1223637..38af54d6b3 100644
--- a/qapi/qapi-schema.json
+++ b/qapi/qapi-schema.json
@@ -86,6 +86,7 @@
 { 'include': 'crypto.json' }
 { 'include': 'block.json' }
 { 'include': 'char.json' }
+{ 'include': 'dump.json' }
 { 'include': 'job.json' }
 { 'include': 'net.json' }
 { 'include': 'rdma.json' }
@@ -97,6 +98,10 @@
 { 'include': 'transaction.json' }
 { 'include': 'trace.json' }
 { 'include': 'introspect.json' }
+{ 'include': 'qom.json' }
+{ 'include': 'qdev.json' }
+{ 'include': 'machine.json' }
+{ 'include': 'machine-target.json' }
 { 'include': 'misc.json' }
-{ 'include': 'target.json' }
+{ 'include': 'misc-target.json' }
 { 'include': 'audio.json' }
diff --git a/qapi/qdev.json b/qapi/qdev.json
new file mode 100644
index 0000000000..c6d05032f4
--- /dev/null
+++ b/qapi/qdev.json
@@ -0,0 +1,125 @@
+# -*- Mode: Python -*-
+#
+# This work is licensed under the terms of the GNU GPL, version 2 or later.
+# See the COPYING file in the top-level directory.
+
+##
+# = Device infrastructure (qdev)
+##
+
+{ 'include': 'qom.json' }
+
+##
+# @device-list-properties:
+#
+# List properties associated with a device.
+#
+# @typename: the type name of a device
+#
+# Returns: a list of ObjectPropertyInfo describing a devices properties
+#
+# Note: objects can create properties at runtime, for example to describe
+# links between different devices and/or objects. These properties
+# are not included in the output of this command.
+#
+# Since: 1.2
+##
+{ 'command': 'device-list-properties',
+  'data': { 'typename': 'str'},
+  'returns': [ 'ObjectPropertyInfo' ] }
+
+##
+# @device_add:
+#
+# @driver: the name of the new device's driver
+#
+# @bus: the device's parent bus (device tree path)
+#
+# @id: the device's ID, must be unique
+#
+# Additional arguments depend on the type.
+#
+# Add a device.
+#
+# Notes:
+# 1. For detailed information about this command, please refer to the
+#    'docs/qdev-device-use.txt' file.
+#
+# 2. It's possible to list device properties by running QEMU with the
+#    "-device DEVICE,help" command-line argument, where DEVICE is the
+#    device's name
+#
+# Example:
+#
+# -> { "execute": "device_add",
+#      "arguments": { "driver": "e1000", "id": "net1",
+#                     "bus": "pci.0",
+#                     "mac": "52:54:00:12:34:56" } }
+# <- { "return": {} }
+#
+# TODO: This command effectively bypasses QAPI completely due to its
+# "additional arguments" business.  It shouldn't have been added to
+# the schema in this form.  It should be qapified properly, or
+# replaced by a properly qapified command.
+#
+# Since: 0.13
+##
+{ 'command': 'device_add',
+  'data': {'driver': 'str', '*bus': 'str', '*id': 'str'},
+  'gen': false } # so we can get the additional arguments
+
+##
+# @device_del:
+#
+# Remove a device from a guest
+#
+# @id: the device's ID or QOM path
+#
+# Returns: Nothing on success
+#          If @id is not a valid device, DeviceNotFound
+#
+# Notes: When this command completes, the device may not be removed from the
+#        guest.  Hot removal is an operation that requires guest cooperation.
+#        This command merely requests that the guest begin the hot removal
+#        process.  Completion of the device removal process is signaled with a
+#        DEVICE_DELETED event. Guest reset will automatically complete removal
+#        for all devices.
+#
+# Since: 0.14.0
+#
+# Example:
+#
+# -> { "execute": "device_del",
+#      "arguments": { "id": "net1" } }
+# <- { "return": {} }
+#
+# -> { "execute": "device_del",
+#      "arguments": { "id": "/machine/peripheral-anon/device[0]" } }
+# <- { "return": {} }
+#
+##
+{ 'command': 'device_del', 'data': {'id': 'str'} }
+
+##
+# @DEVICE_DELETED:
+#
+# Emitted whenever the device removal completion is acknowledged by the guest.
+# At this point, it's safe to reuse the specified device ID. Device removal can
+# be initiated by the guest or by HMP/QMP commands.
+#
+# @device: device name
+#
+# @path: device path
+#
+# Since: 1.5
+#
+# Example:
+#
+# <- { "event": "DEVICE_DELETED",
+#      "data": { "device": "virtio-net-pci-0",
+#                "path": "/machine/peripheral/virtio-net-pci-0" },
+#      "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
+#
+##
+{ 'event': 'DEVICE_DELETED',
+  'data': { '*device': 'str', 'path': 'str' } }
diff --git a/qapi/qom.json b/qapi/qom.json
new file mode 100644
index 0000000000..32db96ffc4
--- /dev/null
+++ b/qapi/qom.json
@@ -0,0 +1,244 @@
+# -*- Mode: Python -*-
+#
+# This work is licensed under the terms of the GNU GPL, version 2 or later.
+# See the COPYING file in the top-level directory.
+
+##
+# = QEMU Object Model (QOM)
+##
+
+##
+# @ObjectPropertyInfo:
+#
+# @name: the name of the property
+#
+# @type: the type of the property.  This will typically come in one of four
+#        forms:
+#
+#        1) A primitive type such as 'u8', 'u16', 'bool', 'str', or 'double'.
+#           These types are mapped to the appropriate JSON type.
+#
+#        2) A child type in the form 'child<subtype>' where subtype is a qdev
+#           device type name.  Child properties create the composition tree.
+#
+#        3) A link type in the form 'link<subtype>' where subtype is a qdev
+#           device type name.  Link properties form the device model graph.
+#
+# @description: if specified, the description of the property.
+#
+# Since: 1.2
+##
+{ 'struct': 'ObjectPropertyInfo',
+  'data': { 'name': 'str', 'type': 'str', '*description': 'str' } }
+
+##
+# @qom-list:
+#
+# This command will list any properties of a object given a path in the object
+# model.
+#
+# @path: the path within the object model.  See @qom-get for a description of
+#        this parameter.
+#
+# Returns: a list of @ObjectPropertyInfo that describe the properties of the
+#          object.
+#
+# Since: 1.2
+#
+# Example:
+#
+# -> { "execute": "qom-list",
+#      "arguments": { "path": "/chardevs" } }
+# <- { "return": [ { "name": "type", "type": "string" },
+#                  { "name": "parallel0", "type": "child<chardev-vc>" },
+#                  { "name": "serial0", "type": "child<chardev-vc>" },
+#                  { "name": "mon0", "type": "child<chardev-stdio>" } ] }
+#
+##
+{ 'command': 'qom-list',
+  'data': { 'path': 'str' },
+  'returns': [ 'ObjectPropertyInfo' ],
+  'allow-preconfig': true }
+
+##
+# @qom-get:
+#
+# This command will get a property from a object model path and return the
+# value.
+#
+# @path: The path within the object model.  There are two forms of supported
+#        paths--absolute and partial paths.
+#
+#        Absolute paths are derived from the root object and can follow child<>
+#        or link<> properties.  Since they can follow link<> properties, they
+#        can be arbitrarily long.  Absolute paths look like absolute filenames
+#        and are prefixed  with a leading slash.
+#
+#        Partial paths look like relative filenames.  They do not begin
+#        with a prefix.  The matching rules for partial paths are subtle but
+#        designed to make specifying objects easy.  At each level of the
+#        composition tree, the partial path is matched as an absolute path.
+#        The first match is not returned.  At least two matches are searched
+#        for.  A successful result is only returned if only one match is
+#        found.  If more than one match is found, a flag is return to
+#        indicate that the match was ambiguous.
+#
+# @property: The property name to read
+#
+# Returns: The property value.  The type depends on the property
+#          type. child<> and link<> properties are returned as #str
+#          pathnames.  All integer property types (u8, u16, etc) are
+#          returned as #int.
+#
+# Since: 1.2
+#
+# Example:
+#
+# 1. Use absolute path
+#
+# -> { "execute": "qom-get",
+#      "arguments": { "path": "/machine/unattached/device[0]",
+#                     "property": "hotplugged" } }
+# <- { "return": false }
+#
+# 2. Use partial path
+#
+# -> { "execute": "qom-get",
+#      "arguments": { "path": "unattached/sysbus",
+#                     "property": "type" } }
+# <- { "return": "System" }
+#
+##
+{ 'command': 'qom-get',
+  'data': { 'path': 'str', 'property': 'str' },
+  'returns': 'any',
+  'allow-preconfig': true }
+
+##
+# @qom-set:
+#
+# This command will set a property from a object model path.
+#
+# @path: see @qom-get for a description of this parameter
+#
+# @property: the property name to set
+#
+# @value: a value who's type is appropriate for the property type.  See @qom-get
+#         for a description of type mapping.
+#
+# Since: 1.2
+#
+# Example:
+#
+# -> { "execute": "qom-set",
+#      "arguments": { "path": "/machine",
+#                     "property": "graphics",
+#                     "value": false } }
+# <- { "return": {} }
+#
+##
+{ 'command': 'qom-set',
+  'data': { 'path': 'str', 'property': 'str', 'value': 'any' },
+  'allow-preconfig': true }
+
+##
+# @ObjectTypeInfo:
+#
+# This structure describes a search result from @qom-list-types
+#
+# @name: the type name found in the search
+#
+# @abstract: the type is abstract and can't be directly instantiated.
+#            Omitted if false. (since 2.10)
+#
+# @parent: Name of parent type, if any (since 2.10)
+#
+# Since: 1.1
+##
+{ 'struct': 'ObjectTypeInfo',
+  'data': { 'name': 'str', '*abstract': 'bool', '*parent': 'str' } }
+
+##
+# @qom-list-types:
+#
+# This command will return a list of types given search parameters
+#
+# @implements: if specified, only return types that implement this type name
+#
+# @abstract: if true, include abstract types in the results
+#
+# Returns: a list of @ObjectTypeInfo or an empty list if no results are found
+#
+# Since: 1.1
+##
+{ 'command': 'qom-list-types',
+  'data': { '*implements': 'str', '*abstract': 'bool' },
+  'returns': [ 'ObjectTypeInfo' ],
+  'allow-preconfig': true }
+
+##
+# @qom-list-properties:
+#
+# List properties associated with a QOM object.
+#
+# @typename: the type name of an object
+#
+# Note: objects can create properties at runtime, for example to describe
+# links between different devices and/or objects. These properties
+# are not included in the output of this command.
+#
+# Returns: a list of ObjectPropertyInfo describing object properties
+#
+# Since: 2.12
+##
+{ 'command': 'qom-list-properties',
+  'data': { 'typename': 'str'},
+  'returns': [ 'ObjectPropertyInfo' ],
+  'allow-preconfig': true }
+
+##
+# @object-add:
+#
+# Create a QOM object.
+#
+# @qom-type: the class name for the object to be created
+#
+# @id: the name of the new object
+#
+# @props: a dictionary of properties to be passed to the backend
+#
+# Returns: Nothing on success
+#          Error if @qom-type is not a valid class name
+#
+# Since: 2.0
+#
+# Example:
+#
+# -> { "execute": "object-add",
+#      "arguments": { "qom-type": "rng-random", "id": "rng1",
+#                     "props": { "filename": "/dev/hwrng" } } }
+# <- { "return": {} }
+#
+##
+{ 'command': 'object-add',
+  'data': {'qom-type': 'str', 'id': 'str', '*props': 'any'} }
+
+##
+# @object-del:
+#
+# Remove a QOM object.
+#
+# @id: the name of the QOM object to remove
+#
+# Returns: Nothing on success
+#          Error if @id is not a valid id for a QOM object
+#
+# Since: 2.0
+#
+# Example:
+#
+# -> { "execute": "object-del", "arguments": { "id": "rng1" } }
+# <- { "return": {} }
+#
+##
+{ 'command': 'object-del', 'data': {'id': 'str'} }
diff --git a/qdev-monitor.c b/qdev-monitor.c
index 373b9ad445..58222c2211 100644
--- a/qdev-monitor.c
+++ b/qdev-monitor.c
@@ -24,7 +24,7 @@
 #include "monitor/qdev.h"
 #include "sysemu/arch_init.h"
 #include "qapi/error.h"
-#include "qapi/qapi-commands-misc.h"
+#include "qapi/qapi-commands-qdev.h"
 #include "qapi/qmp/qdict.h"
 #include "qapi/qmp/qerror.h"
 #include "qemu/config-file.h"
@@ -739,63 +739,6 @@ void hmp_info_qdm(Monitor *mon, const QDict *qdict)
     qdev_print_devinfos(true);
 }
 
-typedef struct QOMCompositionState {
-    Monitor *mon;
-    int indent;
-} QOMCompositionState;
-
-static void print_qom_composition(Monitor *mon, Object *obj, int indent);
-
-static int print_qom_composition_child(Object *obj, void *opaque)
-{
-    QOMCompositionState *s = opaque;
-
-    print_qom_composition(s->mon, obj, s->indent);
-
-    return 0;
-}
-
-static void print_qom_composition(Monitor *mon, Object *obj, int indent)
-{
-    QOMCompositionState s = {
-        .mon = mon,
-        .indent = indent + 2,
-    };
-    char *name;
-
-    if (obj == object_get_root()) {
-        name = g_strdup("");
-    } else {
-        name = object_get_canonical_path_component(obj);
-    }
-    monitor_printf(mon, "%*s/%s (%s)\n", indent, "", name,
-                   object_get_typename(obj));
-    g_free(name);
-    object_child_foreach(obj, print_qom_composition_child, &s);
-}
-
-void hmp_info_qom_tree(Monitor *mon, const QDict *dict)
-{
-    const char *path = qdict_get_try_str(dict, "path");
-    Object *obj;
-    bool ambiguous = false;
-
-    if (path) {
-        obj = object_resolve_path(path, &ambiguous);
-        if (!obj) {
-            monitor_printf(mon, "Path '%s' could not be resolved.\n", path);
-            return;
-        }
-        if (ambiguous) {
-            monitor_printf(mon, "Warning: Path '%s' is ambiguous.\n", path);
-            return;
-        }
-    } else {
-        obj = qdev_get_machine();
-    }
-    print_qom_composition(mon, obj, 0);
-}
-
 void qmp_device_add(QDict *qdict, QObject **ret_data, Error **errp)
 {
     Error *local_err = NULL;
diff --git a/qom/Makefile.objs b/qom/Makefile.objs
index 516349eec3..aae478fc21 100644
--- a/qom/Makefile.objs
+++ b/qom/Makefile.objs
@@ -2,3 +2,4 @@ qom-obj-y = object.o container.o qom-qobject.o
 qom-obj-y += object_interfaces.o
 
 common-obj-y = cpu.o
+common-obj-$(CONFIG_SOFTMMU) += qom-hmp-cmds.o qom-qmp-cmds.o
diff --git a/qom/qom-hmp-cmds.c b/qom/qom-hmp-cmds.c
new file mode 100644
index 0000000000..a268e01eb4
--- /dev/null
+++ b/qom/qom-hmp-cmds.c
@@ -0,0 +1,120 @@
+/*
+ * HMP commands related to QOM
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or
+ * later.  See the COPYING file in the top-level directory.
+ */
+
+#include "qemu/osdep.h"
+#include "hw/qdev-core.h"
+#include "monitor/hmp.h"
+#include "monitor/monitor.h"
+#include "qapi/error.h"
+#include "qapi/qapi-commands-qom.h"
+#include "qapi/qmp/qdict.h"
+#include "qom/object.h"
+
+void hmp_qom_list(Monitor *mon, const QDict *qdict)
+{
+    const char *path = qdict_get_try_str(qdict, "path");
+    ObjectPropertyInfoList *list;
+    Error *err = NULL;
+
+    if (path == NULL) {
+        monitor_printf(mon, "/\n");
+        return;
+    }
+
+    list = qmp_qom_list(path, &err);
+    if (err == NULL) {
+        ObjectPropertyInfoList *start = list;
+        while (list != NULL) {
+            ObjectPropertyInfo *value = list->value;
+
+            monitor_printf(mon, "%s (%s)\n",
+                           value->name, value->type);
+            list = list->next;
+        }
+        qapi_free_ObjectPropertyInfoList(start);
+    }
+    hmp_handle_error(mon, &err);
+}
+
+void hmp_qom_set(Monitor *mon, const QDict *qdict)
+{
+    const char *path = qdict_get_str(qdict, "path");
+    const char *property = qdict_get_str(qdict, "property");
+    const char *value = qdict_get_str(qdict, "value");
+    Error *err = NULL;
+    bool ambiguous = false;
+    Object *obj;
+
+    obj = object_resolve_path(path, &ambiguous);
+    if (obj == NULL) {
+        error_set(&err, ERROR_CLASS_DEVICE_NOT_FOUND,
+                  "Device '%s' not found", path);
+    } else {
+        if (ambiguous) {
+            monitor_printf(mon, "Warning: Path '%s' is ambiguous\n", path);
+        }
+        object_property_parse(obj, value, property, &err);
+    }
+    hmp_handle_error(mon, &err);
+}
+
+typedef struct QOMCompositionState {
+    Monitor *mon;
+    int indent;
+} QOMCompositionState;
+
+static void print_qom_composition(Monitor *mon, Object *obj, int indent);
+
+static int print_qom_composition_child(Object *obj, void *opaque)
+{
+    QOMCompositionState *s = opaque;
+
+    print_qom_composition(s->mon, obj, s->indent);
+
+    return 0;
+}
+
+static void print_qom_composition(Monitor *mon, Object *obj, int indent)
+{
+    QOMCompositionState s = {
+        .mon = mon,
+        .indent = indent + 2,
+    };
+    char *name;
+
+    if (obj == object_get_root()) {
+        name = g_strdup("");
+    } else {
+        name = object_get_canonical_path_component(obj);
+    }
+    monitor_printf(mon, "%*s/%s (%s)\n", indent, "", name,
+                   object_get_typename(obj));
+    g_free(name);
+    object_child_foreach(obj, print_qom_composition_child, &s);
+}
+
+void hmp_info_qom_tree(Monitor *mon, const QDict *dict)
+{
+    const char *path = qdict_get_try_str(dict, "path");
+    Object *obj;
+    bool ambiguous = false;
+
+    if (path) {
+        obj = object_resolve_path(path, &ambiguous);
+        if (!obj) {
+            monitor_printf(mon, "Path '%s' could not be resolved.\n", path);
+            return;
+        }
+        if (ambiguous) {
+            monitor_printf(mon, "Warning: Path '%s' is ambiguous.\n", path);
+            return;
+        }
+    } else {
+        obj = qdev_get_machine();
+    }
+    print_qom_composition(mon, obj, 0);
+}
diff --git a/qom/qom-qmp-cmds.c b/qom/qom-qmp-cmds.c
new file mode 100644
index 0000000000..e046a0f190
--- /dev/null
+++ b/qom/qom-qmp-cmds.c
@@ -0,0 +1,323 @@
+/*
+ * QMP commands related to QOM
+ *
+ * Copyright IBM, Corp. 2011
+ *
+ * Authors:
+ *  Anthony Liguori   <aliguori@us.ibm.com>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2.  See
+ * the COPYING file in the top-level directory.
+ *
+ * Contributions after 2012-01-13 are licensed under the terms of the
+ * GNU GPL, version 2 or (at your option) any later version.
+ */
+
+#include "qemu/osdep.h"
+#include "hw/qdev.h"
+#include "qapi/error.h"
+#include "qapi/qapi-commands-qdev.h"
+#include "qapi/qapi-commands-qom.h"
+#include "qapi/qmp/qdict.h"
+#include "qapi/qmp/qerror.h"
+#include "qapi/qobject-input-visitor.h"
+#include "qemu/cutils.h"
+#include "qom/object_interfaces.h"
+#include "qom/qom-qobject.h"
+
+ObjectPropertyInfoList *qmp_qom_list(const char *path, Error **errp)
+{
+    Object *obj;
+    bool ambiguous = false;
+    ObjectPropertyInfoList *props = NULL;
+    ObjectProperty *prop;
+    ObjectPropertyIterator iter;
+
+    obj = object_resolve_path(path, &ambiguous);
+    if (obj == NULL) {
+        if (ambiguous) {
+            error_setg(errp, "Path '%s' is ambiguous", path);
+        } else {
+            error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND,
+                      "Device '%s' not found", path);
+        }
+        return NULL;
+    }
+
+    object_property_iter_init(&iter, obj);
+    while ((prop = object_property_iter_next(&iter))) {
+        ObjectPropertyInfoList *entry = g_malloc0(sizeof(*entry));
+
+        entry->value = g_malloc0(sizeof(ObjectPropertyInfo));
+        entry->next = props;
+        props = entry;
+
+        entry->value->name = g_strdup(prop->name);
+        entry->value->type = g_strdup(prop->type);
+    }
+
+    return props;
+}
+
+void qmp_qom_set(const char *path, const char *property, QObject *value,
+                 Error **errp)
+{
+    Object *obj;
+
+    obj = object_resolve_path(path, NULL);
+    if (!obj) {
+        error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND,
+                  "Device '%s' not found", path);
+        return;
+    }
+
+    object_property_set_qobject(obj, value, property, errp);
+}
+
+QObject *qmp_qom_get(const char *path, const char *property, Error **errp)
+{
+    Object *obj;
+
+    obj = object_resolve_path(path, NULL);
+    if (!obj) {
+        error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND,
+                  "Device '%s' not found", path);
+        return NULL;
+    }
+
+    return object_property_get_qobject(obj, property, errp);
+}
+
+static void qom_list_types_tramp(ObjectClass *klass, void *data)
+{
+    ObjectTypeInfoList *e, **pret = data;
+    ObjectTypeInfo *info;
+    ObjectClass *parent = object_class_get_parent(klass);
+
+    info = g_malloc0(sizeof(*info));
+    info->name = g_strdup(object_class_get_name(klass));
+    info->has_abstract = info->abstract = object_class_is_abstract(klass);
+    if (parent) {
+        info->has_parent = true;
+        info->parent = g_strdup(object_class_get_name(parent));
+    }
+
+    e = g_malloc0(sizeof(*e));
+    e->value = info;
+    e->next = *pret;
+    *pret = e;
+}
+
+ObjectTypeInfoList *qmp_qom_list_types(bool has_implements,
+                                       const char *implements,
+                                       bool has_abstract,
+                                       bool abstract,
+                                       Error **errp)
+{
+    ObjectTypeInfoList *ret = NULL;
+
+    object_class_foreach(qom_list_types_tramp, implements, abstract, &ret);
+
+    return ret;
+}
+
+/* Return a DevicePropertyInfo for a qdev property.
+ *
+ * If a qdev property with the given name does not exist, use the given default
+ * type.  If the qdev property info should not be shown, return NULL.
+ *
+ * The caller must free the return value.
+ */
+static ObjectPropertyInfo *make_device_property_info(ObjectClass *klass,
+                                                  const char *name,
+                                                  const char *default_type,
+                                                  const char *description)
+{
+    ObjectPropertyInfo *info;
+    Property *prop;
+
+    do {
+        for (prop = DEVICE_CLASS(klass)->props; prop && prop->name; prop++) {
+            if (strcmp(name, prop->name) != 0) {
+                continue;
+            }
+
+            /*
+             * TODO Properties without a parser are just for dirty hacks.
+             * qdev_prop_ptr is the only such PropertyInfo.  It's marked
+             * for removal.  This conditional should be removed along with
+             * it.
+             */
+            if (!prop->info->set && !prop->info->create) {
+                return NULL;           /* no way to set it, don't show */
+            }
+
+            info = g_malloc0(sizeof(*info));
+            info->name = g_strdup(prop->name);
+            info->type = default_type ? g_strdup(default_type)
+                                      : g_strdup(prop->info->name);
+            info->has_description = !!prop->info->description;
+            info->description = g_strdup(prop->info->description);
+            return info;
+        }
+        klass = object_class_get_parent(klass);
+    } while (klass != object_class_by_name(TYPE_DEVICE));
+
+    /* Not a qdev property, use the default type */
+    info = g_malloc0(sizeof(*info));
+    info->name = g_strdup(name);
+    info->type = g_strdup(default_type);
+    info->has_description = !!description;
+    info->description = g_strdup(description);
+
+    return info;
+}
+
+ObjectPropertyInfoList *qmp_device_list_properties(const char *typename,
+                                                Error **errp)
+{
+    ObjectClass *klass;
+    Object *obj;
+    ObjectProperty *prop;
+    ObjectPropertyIterator iter;
+    ObjectPropertyInfoList *prop_list = NULL;
+
+    klass = object_class_by_name(typename);
+    if (klass == NULL) {
+        error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND,
+                  "Device '%s' not found", typename);
+        return NULL;
+    }
+
+    klass = object_class_dynamic_cast(klass, TYPE_DEVICE);
+    if (klass == NULL) {
+        error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "typename", TYPE_DEVICE);
+        return NULL;
+    }
+
+    if (object_class_is_abstract(klass)) {
+        error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "typename",
+                   "non-abstract device type");
+        return NULL;
+    }
+
+    obj = object_new(typename);
+
+    object_property_iter_init(&iter, obj);
+    while ((prop = object_property_iter_next(&iter))) {
+        ObjectPropertyInfo *info;
+        ObjectPropertyInfoList *entry;
+
+        /* Skip Object and DeviceState properties */
+        if (strcmp(prop->name, "type") == 0 ||
+            strcmp(prop->name, "realized") == 0 ||
+            strcmp(prop->name, "hotpluggable") == 0 ||
+            strcmp(prop->name, "hotplugged") == 0 ||
+            strcmp(prop->name, "parent_bus") == 0) {
+            continue;
+        }
+
+        /* Skip legacy properties since they are just string versions of
+         * properties that we already list.
+         */
+        if (strstart(prop->name, "legacy-", NULL)) {
+            continue;
+        }
+
+        info = make_device_property_info(klass, prop->name, prop->type,
+                                         prop->description);
+        if (!info) {
+            continue;
+        }
+
+        entry = g_malloc0(sizeof(*entry));
+        entry->value = info;
+        entry->next = prop_list;
+        prop_list = entry;
+    }
+
+    object_unref(obj);
+
+    return prop_list;
+}
+
+ObjectPropertyInfoList *qmp_qom_list_properties(const char *typename,
+                                             Error **errp)
+{
+    ObjectClass *klass;
+    Object *obj = NULL;
+    ObjectProperty *prop;
+    ObjectPropertyIterator iter;
+    ObjectPropertyInfoList *prop_list = NULL;
+
+    klass = object_class_by_name(typename);
+    if (klass == NULL) {
+        error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND,
+                  "Class '%s' not found", typename);
+        return NULL;
+    }
+
+    klass = object_class_dynamic_cast(klass, TYPE_OBJECT);
+    if (klass == NULL) {
+        error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "typename", TYPE_OBJECT);
+        return NULL;
+    }
+
+    if (object_class_is_abstract(klass)) {
+        object_class_property_iter_init(&iter, klass);
+    } else {
+        obj = object_new(typename);
+        object_property_iter_init(&iter, obj);
+    }
+    while ((prop = object_property_iter_next(&iter))) {
+        ObjectPropertyInfo *info;
+        ObjectPropertyInfoList *entry;
+
+        info = g_malloc0(sizeof(*info));
+        info->name = g_strdup(prop->name);
+        info->type = g_strdup(prop->type);
+        info->has_description = !!prop->description;
+        info->description = g_strdup(prop->description);
+
+        entry = g_malloc0(sizeof(*entry));
+        entry->value = info;
+        entry->next = prop_list;
+        prop_list = entry;
+    }
+
+    object_unref(obj);
+
+    return prop_list;
+}
+
+void qmp_object_add(const char *type, const char *id,
+                    bool has_props, QObject *props, Error **errp)
+{
+    QDict *pdict;
+    Visitor *v;
+    Object *obj;
+
+    if (props) {
+        pdict = qobject_to(QDict, props);
+        if (!pdict) {
+            error_setg(errp, QERR_INVALID_PARAMETER_TYPE, "props", "dict");
+            return;
+        }
+        qobject_ref(pdict);
+    } else {
+        pdict = qdict_new();
+    }
+
+    v = qobject_input_visitor_new(QOBJECT(pdict));
+    obj = user_creatable_add_type(type, id, pdict, v, errp);
+    visit_free(v);
+    if (obj) {
+        object_unref(obj);
+    }
+    qobject_unref(pdict);
+}
+
+void qmp_object_del(const char *id, Error **errp)
+{
+    user_creatable_del(id, errp);
+}
diff --git a/target/arm/helper.c b/target/arm/helper.c
index 38b73430cb..9a1fe3b72e 100644
--- a/target/arm/helper.c
+++ b/target/arm/helper.c
@@ -26,7 +26,7 @@
 #include "sysemu/cpus.h"
 #include "sysemu/kvm.h"
 #include "qemu/range.h"
-#include "qapi/qapi-commands-target.h"
+#include "qapi/qapi-commands-machine-target.h"
 #include "qapi/error.h"
 #include "qemu/guest-random.h"
 
diff --git a/target/arm/monitor.c b/target/arm/monitor.c
index 41b32b94b2..6ec6dd04ac 100644
--- a/target/arm/monitor.c
+++ b/target/arm/monitor.c
@@ -23,7 +23,7 @@
 #include "qemu/osdep.h"
 #include "hw/boards.h"
 #include "kvm_arm.h"
-#include "qapi/qapi-commands-target.h"
+#include "qapi/qapi-commands-misc-target.h"
 
 static GICCapability *gic_cap_new(int version)
 {
diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index da6eb67cfb..2a9f4e2d12 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -36,14 +36,14 @@
 #include "qemu/option.h"
 #include "qemu/config-file.h"
 #include "qapi/error.h"
-#include "qapi/qapi-visit-misc.h"
+#include "qapi/qapi-visit-machine.h"
 #include "qapi/qapi-visit-run-state.h"
 #include "qapi/qmp/qdict.h"
 #include "qapi/qmp/qerror.h"
 #include "qapi/visitor.h"
 #include "qom/qom-qobject.h"
 #include "sysemu/arch_init.h"
-#include "qapi/qapi-commands-target.h"
+#include "qapi/qapi-commands-machine-target.h"
 
 #include "standard-headers/asm-x86/kvm_para.h"
 
diff --git a/target/i386/monitor.c b/target/i386/monitor.c
index 56e2dbece7..1f3b532fc2 100644
--- a/target/i386/monitor.c
+++ b/target/i386/monitor.c
@@ -26,11 +26,11 @@
 #include "cpu.h"
 #include "monitor/monitor.h"
 #include "monitor/hmp-target.h"
+#include "monitor/hmp.h"
 #include "qapi/qmp/qdict.h"
 #include "hw/i386/pc.h"
 #include "sysemu/kvm.h"
 #include "sysemu/sev.h"
-#include "hmp.h"
 #include "qapi/error.h"
 #include "sev_i386.h"
 #include "qapi/qapi-commands-misc.h"
diff --git a/target/i386/sev_i386.h b/target/i386/sev_i386.h
index c0f9373beb..55313441ae 100644
--- a/target/i386/sev_i386.h
+++ b/target/i386/sev_i386.h
@@ -19,7 +19,7 @@
 #include "sysemu/kvm.h"
 #include "sysemu/sev.h"
 #include "qemu/error-report.h"
-#include "qapi/qapi-commands-target.h"
+#include "qapi/qapi-commands-misc-target.h"
 
 #define SEV_POLICY_NODBG        0x1
 #define SEV_POLICY_NOKS         0x2
diff --git a/target/mips/helper.c b/target/mips/helper.c
index 6e6a44292f..a2b6459b05 100644
--- a/target/mips/helper.c
+++ b/target/mips/helper.c
@@ -24,7 +24,7 @@
 #include "exec/cpu_ldst.h"
 #include "exec/log.h"
 #include "hw/mips/cpudevs.h"
-#include "qapi/qapi-commands-target.h"
+#include "qapi/qapi-commands-machine-target.h"
 
 enum {
     TLBRET_XI = -6,
diff --git a/target/mips/msa_helper.c b/target/mips/msa_helper.c
index 8bad636501..a383c40ece 100644
--- a/target/mips/msa_helper.c
+++ b/target/mips/msa_helper.c
@@ -72,9 +72,6 @@
  * --------
  *
  * +---------------+----------------------------------------------------------+
- * | BMNZ.V        | Vector Bit Move If Not Zero                              |
- * | BMZ.V         | Vector Bit Move If Zero                                  |
- * | BSEL.V        | Vector Bit Select                                        |
  * | BINSL.B       | Vector Bit Insert Left (byte)                            |
  * | BINSL.H       | Vector Bit Insert Left (halfword)                        |
  * | BINSL.W       | Vector Bit Insert Left (word)                            |
@@ -83,6 +80,9 @@
  * | BINSR.H       | Vector Bit Insert Right (halfword)                       |
  * | BINSR.W       | Vector Bit Insert Right (word)                           |
  * | BINSR.D       | Vector Bit Insert Right (doubleword)                     |
+ * | BMNZ.V        | Vector Bit Move If Not Zero                              |
+ * | BMZ.V         | Vector Bit Move If Zero                                  |
+ * | BSEL.V        | Vector Bit Select                                        |
  * +---------------+----------------------------------------------------------+
  */
 
@@ -179,12 +179,12 @@
  * | ADDV.H        | Vector Add (halfword)                                    |
  * | ADDV.W        | Vector Add (word)                                        |
  * | ADDV.D        | Vector Add (doubleword)                                  |
- * | HSUB_S.H      | Vector Signed Horizontal Add (halfword)                  |
- * | HSUB_S.W      | Vector Signed Horizontal Add (word)                      |
- * | HSUB_S.D      | Vector Signed Horizontal Add (doubleword)                |
- * | HSUB_U.H      | Vector Unigned Horizontal Add (halfword)                 |
- * | HSUB_U.W      | Vector Unigned Horizontal Add (word)                     |
- * | HSUB_U.D      | Vector Unigned Horizontal Add (doubleword)               |
+ * | HADD_S.H      | Vector Signed Horizontal Add (halfword)                  |
+ * | HADD_S.W      | Vector Signed Horizontal Add (word)                      |
+ * | HADD_S.D      | Vector Signed Horizontal Add (doubleword)                |
+ * | HADD_U.H      | Vector Unigned Horizontal Add (halfword)                 |
+ * | HADD_U.W      | Vector Unigned Horizontal Add (word)                     |
+ * | HADD_U.D      | Vector Unigned Horizontal Add (doubleword)               |
  * +---------------+----------------------------------------------------------+
  */
 
@@ -279,6 +279,18 @@
  * | DOTP_U.H      | Vector Unsigned Dot Product (halfword)                   |
  * | DOTP_U.W      | Vector Unsigned Dot Product (word)                       |
  * | DOTP_U.D      | Vector Unsigned Dot Product (doubleword)                 |
+ * | DPADD_S.H     | Vector Signed Dot Product (halfword)                     |
+ * | DPADD_S.W     | Vector Signed Dot Product (word)                         |
+ * | DPADD_S.D     | Vector Signed Dot Product (doubleword)                   |
+ * | DPADD_U.H     | Vector Unsigned Dot Product (halfword)                   |
+ * | DPADD_U.W     | Vector Unsigned Dot Product (word)                       |
+ * | DPADD_U.D     | Vector Unsigned Dot Product (doubleword)                 |
+ * | DPSUB_S.H     | Vector Signed Dot Product (halfword)                     |
+ * | DPSUB_S.W     | Vector Signed Dot Product (word)                         |
+ * | DPSUB_S.D     | Vector Signed Dot Product (doubleword)                   |
+ * | DPSUB_U.H     | Vector Unsigned Dot Product (halfword)                   |
+ * | DPSUB_U.W     | Vector Unsigned Dot Product (word)                       |
+ * | DPSUB_U.D     | Vector Unsigned Dot Product (doubleword)                 |
  * +---------------+----------------------------------------------------------+
  */
 
@@ -389,14 +401,14 @@
  * | SUBS_U.H      | Vector Unsigned Saturated Subtract (of Uns.) (halfword)  |
  * | SUBS_U.W      | Vector Unsigned Saturated Subtract (of Uns.) (word)      |
  * | SUBS_U.D      | Vector Unsigned Saturated Subtract (of Uns.) (doubleword)|
- * | SUBSUS_S.B    | Vector Uns. Sat. Subtract (of S. from Uns.) (byte)       |
- * | SUBSUS_S.H    | Vector Uns. Sat. Subtract (of S. from Uns.) (halfword)   |
- * | SUBSUS_S.W    | Vector Uns. Sat. Subtract (of S. from Uns.) (word)       |
- * | SUBSUS_S.D    | Vector Uns. Sat. Subtract (of S. from Uns.) (doubleword) |
- * | SUBSUU_U.B    | Vector Signed Saturated Subtract (of Uns.) (byte)        |
- * | SUBSUU_U.H    | Vector Signed Saturated Subtract (of Uns.) (halfword)    |
- * | SUBSUU_U.W    | Vector Signed Saturated Subtract (of Uns.) (word)        |
- * | SUBSUU_U.D    | Vector Signed Saturated Subtract (of Uns.) (doubleword)  |
+ * | SUBSUS_U.B    | Vector Uns. Sat. Subtract (of S. from Uns.) (byte)       |
+ * | SUBSUS_U.H    | Vector Uns. Sat. Subtract (of S. from Uns.) (halfword)   |
+ * | SUBSUS_U.W    | Vector Uns. Sat. Subtract (of S. from Uns.) (word)       |
+ * | SUBSUS_U.D    | Vector Uns. Sat. Subtract (of S. from Uns.) (doubleword) |
+ * | SUBSUU_S.B    | Vector Signed Saturated Subtract (of Uns.) (byte)        |
+ * | SUBSUU_S.H    | Vector Signed Saturated Subtract (of Uns.) (halfword)    |
+ * | SUBSUU_S.W    | Vector Signed Saturated Subtract (of Uns.) (word)        |
+ * | SUBSUU_S.D    | Vector Signed Saturated Subtract (of Uns.) (doubleword)  |
  * | SUBV.B        | Vector Subtract (byte)                                   |
  * | SUBV.H        | Vector Subtract (halfword)                               |
  * | SUBV.W        | Vector Subtract (word)                                   |
@@ -450,6 +462,18 @@
 
 
 /*
+ * Move
+ * ----
+ *
+ * +---------------+----------------------------------------------------------+
+ * | MOVE.V        | Vector Move                                              |
+ * +---------------+----------------------------------------------------------+
+ */
+
+/* TODO: insert Move group helpers here */
+
+
+/*
  * Pack
  * ----
  *
@@ -3826,35 +3850,65 @@ void helper_msa_fmin_df(CPUMIPSState *env, uint32_t df, uint32_t wd,
     wr_t *pwd = &(env->active_fpu.fpr[wd].wr);
     wr_t *pws = &(env->active_fpu.fpr[ws].wr);
     wr_t *pwt = &(env->active_fpu.fpr[wt].wr);
-    uint32_t i;
 
     clear_msacsr_cause(env);
 
-    switch (df) {
-    case DF_WORD:
-        for (i = 0; i < DF_ELEMENTS(DF_WORD); i++) {
-            if (NUMBER_QNAN_PAIR(pws->w[i], pwt->w[i], 32, status)) {
-                MSA_FLOAT_MAXOP(pwx->w[i], min, pws->w[i], pws->w[i], 32);
-            } else if (NUMBER_QNAN_PAIR(pwt->w[i], pws->w[i], 32, status)) {
-                MSA_FLOAT_MAXOP(pwx->w[i], min, pwt->w[i], pwt->w[i], 32);
-            } else {
-                MSA_FLOAT_MAXOP(pwx->w[i], min, pws->w[i], pwt->w[i], 32);
-            }
+    if (df == DF_WORD) {
+
+        if (NUMBER_QNAN_PAIR(pws->w[0], pwt->w[0], 32, status)) {
+            MSA_FLOAT_MAXOP(pwx->w[0], min, pws->w[0], pws->w[0], 32);
+        } else if (NUMBER_QNAN_PAIR(pwt->w[0], pws->w[0], 32, status)) {
+            MSA_FLOAT_MAXOP(pwx->w[0], min, pwt->w[0], pwt->w[0], 32);
+        } else {
+            MSA_FLOAT_MAXOP(pwx->w[0], min, pws->w[0], pwt->w[0], 32);
         }
-        break;
-    case DF_DOUBLE:
-        for (i = 0; i < DF_ELEMENTS(DF_DOUBLE); i++) {
-            if (NUMBER_QNAN_PAIR(pws->d[i], pwt->d[i], 64, status)) {
-                MSA_FLOAT_MAXOP(pwx->d[i], min, pws->d[i], pws->d[i], 64);
-            } else if (NUMBER_QNAN_PAIR(pwt->d[i], pws->d[i], 64, status)) {
-                MSA_FLOAT_MAXOP(pwx->d[i], min, pwt->d[i], pwt->d[i], 64);
-            } else {
-                MSA_FLOAT_MAXOP(pwx->d[i], min, pws->d[i], pwt->d[i], 64);
-            }
+
+        if (NUMBER_QNAN_PAIR(pws->w[1], pwt->w[1], 32, status)) {
+            MSA_FLOAT_MAXOP(pwx->w[1], min, pws->w[1], pws->w[1], 32);
+        } else if (NUMBER_QNAN_PAIR(pwt->w[1], pws->w[1], 32, status)) {
+            MSA_FLOAT_MAXOP(pwx->w[1], min, pwt->w[1], pwt->w[1], 32);
+        } else {
+            MSA_FLOAT_MAXOP(pwx->w[1], min, pws->w[1], pwt->w[1], 32);
         }
-        break;
-    default:
+
+        if (NUMBER_QNAN_PAIR(pws->w[2], pwt->w[2], 32, status)) {
+            MSA_FLOAT_MAXOP(pwx->w[2], min, pws->w[2], pws->w[2], 32);
+        } else if (NUMBER_QNAN_PAIR(pwt->w[2], pws->w[2], 32, status)) {
+            MSA_FLOAT_MAXOP(pwx->w[2], min, pwt->w[2], pwt->w[2], 32);
+        } else {
+            MSA_FLOAT_MAXOP(pwx->w[2], min, pws->w[2], pwt->w[2], 32);
+        }
+
+        if (NUMBER_QNAN_PAIR(pws->w[3], pwt->w[3], 32, status)) {
+            MSA_FLOAT_MAXOP(pwx->w[3], min, pws->w[3], pws->w[3], 32);
+        } else if (NUMBER_QNAN_PAIR(pwt->w[3], pws->w[3], 32, status)) {
+            MSA_FLOAT_MAXOP(pwx->w[3], min, pwt->w[3], pwt->w[3], 32);
+        } else {
+            MSA_FLOAT_MAXOP(pwx->w[3], min, pws->w[3], pwt->w[3], 32);
+        }
+
+    } else if (df == DF_DOUBLE) {
+
+        if (NUMBER_QNAN_PAIR(pws->d[0], pwt->d[0], 64, status)) {
+            MSA_FLOAT_MAXOP(pwx->d[0], min, pws->d[0], pws->d[0], 64);
+        } else if (NUMBER_QNAN_PAIR(pwt->d[0], pws->d[0], 64, status)) {
+            MSA_FLOAT_MAXOP(pwx->d[0], min, pwt->d[0], pwt->d[0], 64);
+        } else {
+            MSA_FLOAT_MAXOP(pwx->d[0], min, pws->d[0], pwt->d[0], 64);
+        }
+
+        if (NUMBER_QNAN_PAIR(pws->d[1], pwt->d[1], 64, status)) {
+            MSA_FLOAT_MAXOP(pwx->d[1], min, pws->d[1], pws->d[1], 64);
+        } else if (NUMBER_QNAN_PAIR(pwt->d[1], pws->d[1], 64, status)) {
+            MSA_FLOAT_MAXOP(pwx->d[1], min, pwt->d[1], pwt->d[1], 64);
+        } else {
+            MSA_FLOAT_MAXOP(pwx->d[1], min, pws->d[1], pwt->d[1], 64);
+        }
+
+    } else {
+
         assert(0);
+
     }
 
     check_msacsr_cause(env, GETPC());
@@ -3870,22 +3924,18 @@ void helper_msa_fmin_a_df(CPUMIPSState *env, uint32_t df, uint32_t wd,
     wr_t *pwd = &(env->active_fpu.fpr[wd].wr);
     wr_t *pws = &(env->active_fpu.fpr[ws].wr);
     wr_t *pwt = &(env->active_fpu.fpr[wt].wr);
-    uint32_t i;
 
     clear_msacsr_cause(env);
 
-    switch (df) {
-    case DF_WORD:
-        for (i = 0; i < DF_ELEMENTS(DF_WORD); i++) {
-            FMAXMIN_A(min, max, pwx->w[i], pws->w[i], pwt->w[i], 32, status);
-        }
-        break;
-    case DF_DOUBLE:
-        for (i = 0; i < DF_ELEMENTS(DF_DOUBLE); i++) {
-            FMAXMIN_A(min, max, pwx->d[i], pws->d[i], pwt->d[i], 64, status);
-        }
-        break;
-    default:
+    if (df == DF_WORD) {
+        FMAXMIN_A(min, max, pwx->w[0], pws->w[0], pwt->w[0], 32, status);
+        FMAXMIN_A(min, max, pwx->w[1], pws->w[1], pwt->w[1], 32, status);
+        FMAXMIN_A(min, max, pwx->w[2], pws->w[2], pwt->w[2], 32, status);
+        FMAXMIN_A(min, max, pwx->w[3], pws->w[3], pwt->w[3], 32, status);
+    } else if (df == DF_DOUBLE) {
+        FMAXMIN_A(min, max, pwx->d[0], pws->d[0], pwt->d[0], 64, status);
+        FMAXMIN_A(min, max, pwx->d[1], pws->d[1], pwt->d[1], 64, status);
+    } else {
         assert(0);
     }
 
@@ -3897,40 +3947,70 @@ void helper_msa_fmin_a_df(CPUMIPSState *env, uint32_t df, uint32_t wd,
 void helper_msa_fmax_df(CPUMIPSState *env, uint32_t df, uint32_t wd,
         uint32_t ws, uint32_t wt)
 {
-    float_status *status = &env->active_tc.msa_fp_status;
+     float_status *status = &env->active_tc.msa_fp_status;
     wr_t wx, *pwx = &wx;
     wr_t *pwd = &(env->active_fpu.fpr[wd].wr);
     wr_t *pws = &(env->active_fpu.fpr[ws].wr);
     wr_t *pwt = &(env->active_fpu.fpr[wt].wr);
-    uint32_t i;
 
     clear_msacsr_cause(env);
 
-    switch (df) {
-    case DF_WORD:
-        for (i = 0; i < DF_ELEMENTS(DF_WORD); i++) {
-            if (NUMBER_QNAN_PAIR(pws->w[i], pwt->w[i], 32, status)) {
-                MSA_FLOAT_MAXOP(pwx->w[i], max, pws->w[i], pws->w[i], 32);
-            } else if (NUMBER_QNAN_PAIR(pwt->w[i], pws->w[i], 32, status)) {
-                MSA_FLOAT_MAXOP(pwx->w[i], max, pwt->w[i], pwt->w[i], 32);
-            } else {
-                MSA_FLOAT_MAXOP(pwx->w[i], max, pws->w[i], pwt->w[i], 32);
-            }
+    if (df == DF_WORD) {
+
+        if (NUMBER_QNAN_PAIR(pws->w[0], pwt->w[0], 32, status)) {
+            MSA_FLOAT_MAXOP(pwx->w[0], max, pws->w[0], pws->w[0], 32);
+        } else if (NUMBER_QNAN_PAIR(pwt->w[0], pws->w[0], 32, status)) {
+            MSA_FLOAT_MAXOP(pwx->w[0], max, pwt->w[0], pwt->w[0], 32);
+        } else {
+            MSA_FLOAT_MAXOP(pwx->w[0], max, pws->w[0], pwt->w[0], 32);
         }
-        break;
-    case DF_DOUBLE:
-        for (i = 0; i < DF_ELEMENTS(DF_DOUBLE); i++) {
-            if (NUMBER_QNAN_PAIR(pws->d[i], pwt->d[i], 64, status)) {
-                MSA_FLOAT_MAXOP(pwx->d[i], max, pws->d[i], pws->d[i], 64);
-            } else if (NUMBER_QNAN_PAIR(pwt->d[i], pws->d[i], 64, status)) {
-                MSA_FLOAT_MAXOP(pwx->d[i], max, pwt->d[i], pwt->d[i], 64);
-            } else {
-                MSA_FLOAT_MAXOP(pwx->d[i], max, pws->d[i], pwt->d[i], 64);
-            }
+
+        if (NUMBER_QNAN_PAIR(pws->w[1], pwt->w[1], 32, status)) {
+            MSA_FLOAT_MAXOP(pwx->w[1], max, pws->w[1], pws->w[1], 32);
+        } else if (NUMBER_QNAN_PAIR(pwt->w[1], pws->w[1], 32, status)) {
+            MSA_FLOAT_MAXOP(pwx->w[1], max, pwt->w[1], pwt->w[1], 32);
+        } else {
+            MSA_FLOAT_MAXOP(pwx->w[1], max, pws->w[1], pwt->w[1], 32);
         }
-        break;
-    default:
+
+        if (NUMBER_QNAN_PAIR(pws->w[2], pwt->w[2], 32, status)) {
+            MSA_FLOAT_MAXOP(pwx->w[2], max, pws->w[2], pws->w[2], 32);
+        } else if (NUMBER_QNAN_PAIR(pwt->w[2], pws->w[2], 32, status)) {
+            MSA_FLOAT_MAXOP(pwx->w[2], max, pwt->w[2], pwt->w[2], 32);
+        } else {
+            MSA_FLOAT_MAXOP(pwx->w[2], max, pws->w[2], pwt->w[2], 32);
+        }
+
+        if (NUMBER_QNAN_PAIR(pws->w[3], pwt->w[3], 32, status)) {
+            MSA_FLOAT_MAXOP(pwx->w[3], max, pws->w[3], pws->w[3], 32);
+        } else if (NUMBER_QNAN_PAIR(pwt->w[3], pws->w[3], 32, status)) {
+            MSA_FLOAT_MAXOP(pwx->w[3], max, pwt->w[3], pwt->w[3], 32);
+        } else {
+            MSA_FLOAT_MAXOP(pwx->w[3], max, pws->w[3], pwt->w[3], 32);
+        }
+
+    } else if (df == DF_DOUBLE) {
+
+        if (NUMBER_QNAN_PAIR(pws->d[0], pwt->d[0], 64, status)) {
+            MSA_FLOAT_MAXOP(pwx->d[0], max, pws->d[0], pws->d[0], 64);
+        } else if (NUMBER_QNAN_PAIR(pwt->d[0], pws->d[0], 64, status)) {
+            MSA_FLOAT_MAXOP(pwx->d[0], max, pwt->d[0], pwt->d[0], 64);
+        } else {
+            MSA_FLOAT_MAXOP(pwx->d[0], max, pws->d[0], pwt->d[0], 64);
+        }
+
+        if (NUMBER_QNAN_PAIR(pws->d[1], pwt->d[1], 64, status)) {
+            MSA_FLOAT_MAXOP(pwx->d[1], max, pws->d[1], pws->d[1], 64);
+        } else if (NUMBER_QNAN_PAIR(pwt->d[1], pws->d[1], 64, status)) {
+            MSA_FLOAT_MAXOP(pwx->d[1], max, pwt->d[1], pwt->d[1], 64);
+        } else {
+            MSA_FLOAT_MAXOP(pwx->d[1], max, pws->d[1], pwt->d[1], 64);
+        }
+
+    } else {
+
         assert(0);
+
     }
 
     check_msacsr_cause(env, GETPC());
@@ -3946,22 +4026,18 @@ void helper_msa_fmax_a_df(CPUMIPSState *env, uint32_t df, uint32_t wd,
     wr_t *pwd = &(env->active_fpu.fpr[wd].wr);
     wr_t *pws = &(env->active_fpu.fpr[ws].wr);
     wr_t *pwt = &(env->active_fpu.fpr[wt].wr);
-    uint32_t i;
 
     clear_msacsr_cause(env);
 
-    switch (df) {
-    case DF_WORD:
-        for (i = 0; i < DF_ELEMENTS(DF_WORD); i++) {
-            FMAXMIN_A(max, min, pwx->w[i], pws->w[i], pwt->w[i], 32, status);
-        }
-        break;
-    case DF_DOUBLE:
-        for (i = 0; i < DF_ELEMENTS(DF_DOUBLE); i++) {
-            FMAXMIN_A(max, min, pwx->d[i], pws->d[i], pwt->d[i], 64, status);
-        }
-        break;
-    default:
+    if (df == DF_WORD) {
+        FMAXMIN_A(max, min, pwx->w[0], pws->w[0], pwt->w[0], 32, status);
+        FMAXMIN_A(max, min, pwx->w[1], pws->w[1], pwt->w[1], 32, status);
+        FMAXMIN_A(max, min, pwx->w[2], pws->w[2], pwt->w[2], 32, status);
+        FMAXMIN_A(max, min, pwx->w[3], pws->w[3], pwt->w[3], 32, status);
+    } else if (df == DF_DOUBLE) {
+        FMAXMIN_A(max, min, pwx->d[0], pws->d[0], pwt->d[0], 64, status);
+        FMAXMIN_A(max, min, pwx->d[1], pws->d[1], pwt->d[1], 64, status);
+    } else {
         assert(0);
     }
 
@@ -3982,9 +4058,11 @@ void helper_msa_fclass_df(CPUMIPSState *env, uint32_t df,
         pwd->w[1] = float_class_s(pws->w[1], status);
         pwd->w[2] = float_class_s(pws->w[2], status);
         pwd->w[3] = float_class_s(pws->w[3], status);
-    } else {
+    } else if (df == DF_DOUBLE) {
         pwd->d[0] = float_class_d(pws->d[0], status);
         pwd->d[1] = float_class_d(pws->d[1], status);
+    } else {
+        assert(0);
     }
 }
 
diff --git a/target/mips/translate.c b/target/mips/translate.c
index e3a0f08dea..f96f141cdf 100644
--- a/target/mips/translate.c
+++ b/target/mips/translate.c
@@ -259,8 +259,10 @@ enum {
     OPC_SPECIAL3D_RESERVED = 0x3D | OPC_SPECIAL,
 };
 
-/* R6 Multiply and Divide instructions have the same Opcode
-   and function field as legacy OPC_MULT[U]/OPC_DIV[U] */
+/*
+ * R6 Multiply and Divide instructions have the same opcode
+ * and function field as legacy OPC_MULT[U]/OPC_DIV[U]
+ */
 #define MASK_R6_MULDIV(op)   (MASK_SPECIAL(op) | (op & (0x7ff)))
 
 enum {
@@ -2923,10 +2925,11 @@ static inline void check_cp1_enabled(DisasContext *ctx)
     }
 }
 
-/* Verify that the processor is running with COP1X instructions enabled.
-   This is associated with the nabla symbol in the MIPS32 and MIPS64
-   opcode tables.  */
-
+/*
+ * Verify that the processor is running with COP1X instructions enabled.
+ * This is associated with the nabla symbol in the MIPS32 and MIPS64
+ * opcode tables.
+ */
 static inline void check_cop1x(DisasContext *ctx)
 {
     if (unlikely(!(ctx->hflags & MIPS_HFLAG_COP1X))) {
@@ -2934,9 +2937,10 @@ static inline void check_cop1x(DisasContext *ctx)
     }
 }
 
-/* Verify that the processor is running with 64-bit floating-point
-   operations enabled.  */
-
+/*
+ * Verify that the processor is running with 64-bit floating-point
+ * operations enabled.
+ */
 static inline void check_cp1_64bitmode(DisasContext *ctx)
 {
     if (unlikely(~ctx->hflags & (MIPS_HFLAG_F64 | MIPS_HFLAG_COP1X))) {
@@ -2962,10 +2966,10 @@ static inline void check_cp1_registers(DisasContext *ctx, int regs)
     }
 }
 
-/* Verify that the processor is running with DSP instructions enabled.
-   This is enabled by CP0 Status register MX(24) bit.
+/*
+ * Verify that the processor is running with DSP instructions enabled.
+ * This is enabled by CP0 Status register MX(24) bit.
  */
-
 static inline void check_dsp(DisasContext *ctx)
 {
     if (unlikely(!(ctx->hflags & MIPS_HFLAG_DSP))) {
@@ -2999,8 +3003,10 @@ static inline void check_dsp_r3(DisasContext *ctx)
     }
 }
 
-/* This code generates a "reserved instruction" exception if the
-   CPU does not support the instruction set corresponding to flags. */
+/*
+ * This code generates a "reserved instruction" exception if the
+ * CPU does not support the instruction set corresponding to flags.
+ */
 static inline void check_insn(DisasContext *ctx, uint64_t flags)
 {
     if (unlikely(!(ctx->insn_flags & flags))) {
@@ -3008,9 +3014,11 @@ static inline void check_insn(DisasContext *ctx, uint64_t flags)
     }
 }
 
-/* This code generates a "reserved instruction" exception if the
-   CPU has corresponding flag set which indicates that the instruction
-   has been removed. */
+/*
+ * This code generates a "reserved instruction" exception if the
+ * CPU has corresponding flag set which indicates that the instruction
+ * has been removed.
+ */
 static inline void check_insn_opc_removed(DisasContext *ctx, uint64_t flags)
 {
     if (unlikely(ctx->insn_flags & flags)) {
@@ -3033,8 +3041,10 @@ static inline void check_insn_opc_user_only(DisasContext *ctx, uint64_t flags)
 #endif
 }
 
-/* This code generates a "reserved instruction" exception if the
-   CPU does not support 64-bit paired-single (PS) floating point data type */
+/*
+ * This code generates a "reserved instruction" exception if the
+ * CPU does not support 64-bit paired-single (PS) floating point data type.
+ */
 static inline void check_ps(DisasContext *ctx)
 {
     if (unlikely(!ctx->ps)) {
@@ -3044,8 +3054,10 @@ static inline void check_ps(DisasContext *ctx)
 }
 
 #ifdef TARGET_MIPS64
-/* This code generates a "reserved instruction" exception if 64-bit
-   instructions are not enabled. */
+/*
+ * This code generates a "reserved instruction" exception if 64-bit
+ * instructions are not enabled.
+ */
 static inline void check_mips_64(DisasContext *ctx)
 {
     if (unlikely(!(ctx->hflags & MIPS_HFLAG_64))) {
@@ -3157,10 +3169,12 @@ static inline void check_eva(DisasContext *ctx)
 }
 
 
-/* Define small wrappers for gen_load_fpr* so that we have a uniform
-   calling interface for 32 and 64-bit FPRs.  No sense in changing
-   all callers for gen_load_fpr32 when we need the CTX parameter for
-   this one use.  */
+/*
+ * Define small wrappers for gen_load_fpr* so that we have a uniform
+ * calling interface for 32 and 64-bit FPRs.  No sense in changing
+ * all callers for gen_load_fpr32 when we need the CTX parameter for
+ * this one use.
+ */
 #define gen_ldcmp_fpr32(ctx, x, y) gen_load_fpr32(ctx, x, y)
 #define gen_ldcmp_fpr64(ctx, x, y) gen_load_fpr64(ctx, x, y)
 #define FOP_CONDS(type, abs, fmt, ifmt, bits)                                 \
@@ -3405,9 +3419,11 @@ static void gen_ld(DisasContext *ctx, uint32_t opc,
     int mem_idx = ctx->mem_idx;
 
     if (rt == 0 && ctx->insn_flags & (INSN_LOONGSON2E | INSN_LOONGSON2F)) {
-        /* Loongson CPU uses a load to zero register for prefetch.
-           We emulate it as a NOP. On other CPU we must perform the
-           actual memory access. */
+        /*
+         * Loongson CPU uses a load to zero register for prefetch.
+         * We emulate it as a NOP. On other CPU we must perform the
+         * actual memory access.
+         */
         return;
     }
 
@@ -3433,8 +3449,10 @@ static void gen_ld(DisasContext *ctx, uint32_t opc,
         break;
     case OPC_LDL:
         t1 = tcg_temp_new();
-        /* Do a byte access to possibly trigger a page
-           fault with the unaligned address.  */
+        /*
+         * Do a byte access to possibly trigger a page
+         * fault with the unaligned address.
+         */
         tcg_gen_qemu_ld_tl(t1, t0, mem_idx, MO_UB);
         tcg_gen_andi_tl(t1, t0, 7);
 #ifndef TARGET_WORDS_BIGENDIAN
@@ -3455,8 +3473,10 @@ static void gen_ld(DisasContext *ctx, uint32_t opc,
         break;
     case OPC_LDR:
         t1 = tcg_temp_new();
-        /* Do a byte access to possibly trigger a page
-           fault with the unaligned address.  */
+        /*
+         * Do a byte access to possibly trigger a page
+         * fault with the unaligned address.
+         */
         tcg_gen_qemu_ld_tl(t1, t0, mem_idx, MO_UB);
         tcg_gen_andi_tl(t1, t0, 7);
 #ifdef TARGET_WORDS_BIGENDIAN
@@ -3534,8 +3554,10 @@ static void gen_ld(DisasContext *ctx, uint32_t opc,
         /* fall through */
     case OPC_LWL:
         t1 = tcg_temp_new();
-        /* Do a byte access to possibly trigger a page
-           fault with the unaligned address.  */
+        /*
+         * Do a byte access to possibly trigger a page
+         * fault with the unaligned address.
+         */
         tcg_gen_qemu_ld_tl(t1, t0, mem_idx, MO_UB);
         tcg_gen_andi_tl(t1, t0, 3);
 #ifndef TARGET_WORDS_BIGENDIAN
@@ -3560,8 +3582,10 @@ static void gen_ld(DisasContext *ctx, uint32_t opc,
         /* fall through */
     case OPC_LWR:
         t1 = tcg_temp_new();
-        /* Do a byte access to possibly trigger a page
-           fault with the unaligned address.  */
+        /*
+         * Do a byte access to possibly trigger a page
+         * fault with the unaligned address.
+         */
         tcg_gen_qemu_ld_tl(t1, t0, mem_idx, MO_UB);
         tcg_gen_andi_tl(t1, t0, 3);
 #ifdef TARGET_WORDS_BIGENDIAN
@@ -3762,8 +3786,10 @@ static void gen_scwp(DisasContext *ctx, uint32_t base, int16_t offset,
 static void gen_flt_ldst(DisasContext *ctx, uint32_t opc, int ft,
                          TCGv t0)
 {
-    /* Don't do NOP if destination is zero: we must perform the actual
-       memory access. */
+    /*
+     * Don't do NOP if destination is zero: we must perform the actual
+     * memory access.
+     */
     switch (opc) {
     case OPC_LWC1:
         {
@@ -3837,8 +3863,10 @@ static void gen_arith_imm(DisasContext *ctx, uint32_t opc,
     target_ulong uimm = (target_long)imm; /* Sign extend to 32/64 bits */
 
     if (rt == 0 && opc != OPC_ADDI && opc != OPC_DADDI) {
-        /* If no destination, treat it as a NOP.
-           For addi, we must generate the overflow exception when needed. */
+        /*
+         * If no destination, treat it as a NOP.
+         * For addi, we must generate the overflow exception when needed.
+         */
         return;
     }
     switch (opc) {
@@ -4064,8 +4092,10 @@ static void gen_arith(DisasContext *ctx, uint32_t opc,
 {
     if (rd == 0 && opc != OPC_ADD && opc != OPC_SUB
        && opc != OPC_DADD && opc != OPC_DSUB) {
-        /* If no destination, treat it as a NOP.
-           For add & sub, we must generate the overflow exception when needed. */
+        /*
+         * If no destination, treat it as a NOP.
+         * For add & sub, we must generate the overflow exception when needed.
+         */
         return;
     }
 
@@ -4123,7 +4153,10 @@ static void gen_arith(DisasContext *ctx, uint32_t opc,
             tcg_temp_free(t2);
             tcg_gen_brcondi_tl(TCG_COND_GE, t1, 0, l1);
             tcg_temp_free(t1);
-            /* operands of different sign, first operand and result different sign */
+            /*
+             * operands of different sign, first operand and the result
+             * of different sign
+             */
             generate_exception(ctx, EXCP_OVERFLOW);
             gen_set_label(l1);
             gen_store_gpr(t0, rd);
@@ -4346,8 +4379,10 @@ static void gen_shift(DisasContext *ctx, uint32_t opc,
     TCGv t0, t1;
 
     if (rd == 0) {
-        /* If no destination, treat it as a NOP.
-           For add & sub, we must generate the overflow exception when needed. */
+        /*
+         * If no destination, treat it as a NOP.
+         * For add & sub, we must generate the overflow exception when needed.
+         */
         return;
     }
 
@@ -5643,8 +5678,10 @@ static void gen_loongson_multimedia(DisasContext *ctx, int rd, int rs, int rt)
             break;
         case OPC_SRA_CP2:
         case OPC_DSRA_CP2:
-            /* Since SRA is UndefinedResult without sign-extended inputs,
-               we can treat SRA and DSRA the same.  */
+            /*
+             * Since SRA is UndefinedResult without sign-extended inputs,
+             * we can treat SRA and DSRA the same.
+             */
             tcg_gen_sar_i64(t0, t0, t1);
             break;
         case OPC_SRL_CP2:
@@ -5720,8 +5757,10 @@ static void gen_loongson_multimedia(DisasContext *ctx, int rd, int rs, int rt)
     case OPC_SLT_CP2:
     case OPC_SLEU_CP2:
     case OPC_SLE_CP2:
-        /* ??? Document is unclear: Set FCC[CC].  Does that mean the
-           FD field is the CC field?  */
+        /*
+         * ??? Document is unclear: Set FCC[CC].  Does that mean the
+         * FD field is the CC field?
+         */
     default:
         MIPS_INVAL("loongson_cp2");
         generate_exception_end(ctx, EXCP_RI);
@@ -5935,8 +5974,10 @@ static void gen_compute_branch (DisasContext *ctx, uint32_t opc,
     case OPC_JALR:
         /* Jump to register */
         if (offset != 0 && offset != 16) {
-            /* Hint = 0 is JR/JALR, hint 16 is JR.HB/JALR.HB, the
-               others are reserved. */
+            /*
+             * Hint = 0 is JR/JALR, hint 16 is JR.HB/JALR.HB, the
+             * others are reserved.
+             */
             MIPS_INVAL("jump hint");
             generate_exception_end(ctx, EXCP_RI);
             goto out;
@@ -5972,8 +6013,10 @@ static void gen_compute_branch (DisasContext *ctx, uint32_t opc,
             /* Treat as NOP. */
             goto out;
         case OPC_BLTZAL:  /* 0 < 0           */
-            /* Handle as an unconditional branch to get correct delay
-               slot checking.  */
+            /*
+             * Handle as an unconditional branch to get correct delay
+             * slot checking.
+             */
             blink = 31;
             btgt = ctx->base.pc_next + insn_bytes + delayslot_size;
             ctx->hflags |= MIPS_HFLAG_B;
@@ -6151,8 +6194,10 @@ static void gen_compute_branch_nm(DisasContext *ctx, uint32_t opc,
     case OPC_JALR:
         /* Jump to register */
         if (offset != 0 && offset != 16) {
-            /* Hint = 0 is JR/JALR, hint 16 is JR.HB/JALR.HB, the
-               others are reserved. */
+            /*
+             * Hint = 0 is JR/JALR, hint 16 is JR.HB/JALR.HB, the
+             * others are reserved.
+             */
             MIPS_INVAL("jump hint");
             generate_exception_end(ctx, EXCP_RI);
             goto out;
@@ -6249,8 +6294,10 @@ static void gen_bitops(DisasContext *ctx, uint32_t opc, int rt,
         if (msb != 31) {
             tcg_gen_extract_tl(t0, t1, lsb, msb + 1);
         } else {
-            /* The two checks together imply that lsb == 0,
-               so this is a simple sign-extension.  */
+            /*
+             * The two checks together imply that lsb == 0,
+             * so this is a simple sign-extension.
+             */
             tcg_gen_ext32s_tl(t0, t1);
         }
         break;
@@ -6701,10 +6748,12 @@ static void gen_mthc0(DisasContext *ctx, TCGv arg, int reg, int sel)
     case CP0_REGISTER_17:
         switch (sel) {
         case 0:
-            /* LLAddr is read-only (the only exception is bit 0 if LLB is
-               supported); the CP0_LLAddr_rw_bitmask does not seem to be
-               relevant for modern MIPS cores supporting MTHC0, therefore
-               treating MTHC0 to LLAddr as NOP. */
+            /*
+             * LLAddr is read-only (the only exception is bit 0 if LLB is
+             * supported); the CP0_LLAddr_rw_bitmask does not seem to be
+             * relevant for modern MIPS cores supporting MTHC0, therefore
+             * treating MTHC0 to LLAddr as NOP.
+             */
             register_name = "LLAddr";
             break;
         case 1:
@@ -6928,7 +6977,7 @@ static void gen_mfc0(DisasContext *ctx, TCGv arg, int reg, int sel)
             register_name = "Context";
             break;
         case 1:
-//            gen_helper_mfc0_contextconfig(arg); /* SmartMIPS ASE */
+            /* gen_helper_mfc0_contextconfig(arg); - SmartMIPS ASE */
             register_name = "ContextConfig";
             goto cp0_unimplemented;
         case 2:
@@ -7079,9 +7128,11 @@ static void gen_mfc0(DisasContext *ctx, TCGv arg, int reg, int sel)
             if (tb_cflags(ctx->base.tb) & CF_USE_ICOUNT) {
                 gen_io_end();
             }
-            /* Break the TB to be able to take timer interrupts immediately
-               after reading count. DISAS_STOP isn't sufficient, we need to
-               ensure we break completely out of translated code.  */
+            /*
+             * Break the TB to be able to take timer interrupts immediately
+             * after reading count. DISAS_STOP isn't sufficient, we need to
+             * ensure we break completely out of translated code.
+             */
             gen_save_pc(ctx->base.pc_next + 4);
             ctx->base.is_jmp = DISAS_EXIT;
             register_name = "Count";
@@ -7361,31 +7412,31 @@ static void gen_mfc0(DisasContext *ctx, TCGv arg, int reg, int sel)
             register_name = "Performance0";
             break;
         case 1:
-//            gen_helper_mfc0_performance1(arg);
+            /* gen_helper_mfc0_performance1(arg); */
             register_name = "Performance1";
             goto cp0_unimplemented;
         case 2:
-//            gen_helper_mfc0_performance2(arg);
+            /* gen_helper_mfc0_performance2(arg); */
             register_name = "Performance2";
             goto cp0_unimplemented;
         case 3:
-//            gen_helper_mfc0_performance3(arg);
+            /* gen_helper_mfc0_performance3(arg); */
             register_name = "Performance3";
             goto cp0_unimplemented;
         case 4:
-//            gen_helper_mfc0_performance4(arg);
+            /* gen_helper_mfc0_performance4(arg); */
             register_name = "Performance4";
             goto cp0_unimplemented;
         case 5:
-//            gen_helper_mfc0_performance5(arg);
+            /* gen_helper_mfc0_performance5(arg); */
             register_name = "Performance5";
             goto cp0_unimplemented;
         case 6:
-//            gen_helper_mfc0_performance6(arg);
+            /* gen_helper_mfc0_performance6(arg); */
             register_name = "Performance6";
             goto cp0_unimplemented;
         case 7:
-//            gen_helper_mfc0_performance7(arg);
+            /* gen_helper_mfc0_performance7(arg); */
             register_name = "Performance7";
             goto cp0_unimplemented;
         default:
@@ -7877,9 +7928,11 @@ static void gen_mtc0(DisasContext *ctx, TCGv arg, int reg, int sel)
         case 0:
             save_cpu_state(ctx, 1);
             gen_helper_mtc0_cause(cpu_env, arg);
-            /* Stop translation as we may have triggered an interrupt.
+            /*
+             * Stop translation as we may have triggered an interrupt.
              * DISAS_STOP isn't sufficient, we need to ensure we break out of
-             * translated code to check for pending interrupts.  */
+             * translated code to check for pending interrupts.
+             */
             gen_save_pc(ctx->base.pc_next + 4);
             ctx->base.is_jmp = DISAS_EXIT;
             register_name = "Cause";
@@ -8104,31 +8157,31 @@ static void gen_mtc0(DisasContext *ctx, TCGv arg, int reg, int sel)
             register_name = "Performance0";
             break;
         case 1:
-//            gen_helper_mtc0_performance1(arg);
+            /* gen_helper_mtc0_performance1(arg); */
             register_name = "Performance1";
             goto cp0_unimplemented;
         case 2:
-//            gen_helper_mtc0_performance2(arg);
+            /* gen_helper_mtc0_performance2(arg); */
             register_name = "Performance2";
             goto cp0_unimplemented;
         case 3:
-//            gen_helper_mtc0_performance3(arg);
+            /* gen_helper_mtc0_performance3(arg); */
             register_name = "Performance3";
             goto cp0_unimplemented;
         case 4:
-//            gen_helper_mtc0_performance4(arg);
+            /* gen_helper_mtc0_performance4(arg); */
             register_name = "Performance4";
             goto cp0_unimplemented;
         case 5:
-//            gen_helper_mtc0_performance5(arg);
+            /* gen_helper_mtc0_performance5(arg); */
             register_name = "Performance5";
             goto cp0_unimplemented;
         case 6:
-//            gen_helper_mtc0_performance6(arg);
+            /* gen_helper_mtc0_performance6(arg); */
             register_name = "Performance6";
             goto cp0_unimplemented;
         case 7:
-//            gen_helper_mtc0_performance7(arg);
+            /* gen_helper_mtc0_performance7(arg); */
             register_name = "Performance7";
             goto cp0_unimplemented;
         default:
@@ -8240,8 +8293,10 @@ static void gen_mtc0(DisasContext *ctx, TCGv arg, int reg, int sel)
     /* For simplicity assume that all writes can cause interrupts.  */
     if (tb_cflags(ctx->base.tb) & CF_USE_ICOUNT) {
         gen_io_end();
-        /* DISAS_STOP isn't sufficient, we need to ensure we break out of
-         * translated code to check for pending interrupts.  */
+        /*
+         * DISAS_STOP isn't sufficient, we need to ensure we break out of
+         * translated code to check for pending interrupts.
+         */
         gen_save_pc(ctx->base.pc_next + 4);
         ctx->base.is_jmp = DISAS_EXIT;
     }
@@ -8551,9 +8606,11 @@ static void gen_dmfc0(DisasContext *ctx, TCGv arg, int reg, int sel)
             if (tb_cflags(ctx->base.tb) & CF_USE_ICOUNT) {
                 gen_io_end();
             }
-            /* Break the TB to be able to take timer interrupts immediately
-               after reading count. DISAS_STOP isn't sufficient, we need to
-               ensure we break completely out of translated code.  */
+            /*
+             * Break the TB to be able to take timer interrupts immediately
+             * after reading count. DISAS_STOP isn't sufficient, we need to
+             * ensure we break completely out of translated code.
+             */
             gen_save_pc(ctx->base.pc_next + 4);
             ctx->base.is_jmp = DISAS_EXIT;
             register_name = "Count";
@@ -8825,31 +8882,31 @@ static void gen_dmfc0(DisasContext *ctx, TCGv arg, int reg, int sel)
             register_name = "Performance0";
             break;
         case 1:
-//            gen_helper_dmfc0_performance1(arg);
+            /* gen_helper_dmfc0_performance1(arg); */
             register_name = "Performance1";
             goto cp0_unimplemented;
         case 2:
-//            gen_helper_dmfc0_performance2(arg);
+            /* gen_helper_dmfc0_performance2(arg); */
             register_name = "Performance2";
             goto cp0_unimplemented;
         case 3:
-//            gen_helper_dmfc0_performance3(arg);
+            /* gen_helper_dmfc0_performance3(arg); */
             register_name = "Performance3";
             goto cp0_unimplemented;
         case 4:
-//            gen_helper_dmfc0_performance4(arg);
+            /* gen_helper_dmfc0_performance4(arg); */
             register_name = "Performance4";
             goto cp0_unimplemented;
         case 5:
-//            gen_helper_dmfc0_performance5(arg);
+            /* gen_helper_dmfc0_performance5(arg); */
             register_name = "Performance5";
             goto cp0_unimplemented;
         case 6:
-//            gen_helper_dmfc0_performance6(arg);
+            /* gen_helper_dmfc0_performance6(arg); */
             register_name = "Performance6";
             goto cp0_unimplemented;
         case 7:
-//            gen_helper_dmfc0_performance7(arg);
+            /* gen_helper_dmfc0_performance7(arg); */
             register_name = "Performance7";
             goto cp0_unimplemented;
         default:
@@ -9336,9 +9393,11 @@ static void gen_dmtc0(DisasContext *ctx, TCGv arg, int reg, int sel)
         case 0:
             save_cpu_state(ctx, 1);
             gen_helper_mtc0_cause(cpu_env, arg);
-            /* Stop translation as we may have triggered an interrupt.
+            /*
+             * Stop translation as we may have triggered an interrupt.
              * DISAS_STOP isn't sufficient, we need to ensure we break out of
-             * translated code to check for pending interrupts.  */
+             * translated code to check for pending interrupts.
+             */
             gen_save_pc(ctx->base.pc_next + 4);
             ctx->base.is_jmp = DISAS_EXIT;
             register_name = "Cause";
@@ -9550,31 +9609,31 @@ static void gen_dmtc0(DisasContext *ctx, TCGv arg, int reg, int sel)
             register_name = "Performance0";
             break;
         case 1:
-//            gen_helper_mtc0_performance1(cpu_env, arg);
+            /* gen_helper_mtc0_performance1(cpu_env, arg); */
             register_name = "Performance1";
             goto cp0_unimplemented;
         case 2:
-//            gen_helper_mtc0_performance2(cpu_env, arg);
+            /* gen_helper_mtc0_performance2(cpu_env, arg); */
             register_name = "Performance2";
             goto cp0_unimplemented;
         case 3:
-//            gen_helper_mtc0_performance3(cpu_env, arg);
+            /* gen_helper_mtc0_performance3(cpu_env, arg); */
             register_name = "Performance3";
             goto cp0_unimplemented;
         case 4:
-//            gen_helper_mtc0_performance4(cpu_env, arg);
+            /* gen_helper_mtc0_performance4(cpu_env, arg); */
             register_name = "Performance4";
             goto cp0_unimplemented;
         case 5:
-//            gen_helper_mtc0_performance5(cpu_env, arg);
+            /* gen_helper_mtc0_performance5(cpu_env, arg); */
             register_name = "Performance5";
             goto cp0_unimplemented;
         case 6:
-//            gen_helper_mtc0_performance6(cpu_env, arg);
+            /* gen_helper_mtc0_performance6(cpu_env, arg); */
             register_name = "Performance6";
             goto cp0_unimplemented;
         case 7:
-//            gen_helper_mtc0_performance7(cpu_env, arg);
+            /* gen_helper_mtc0_performance7(cpu_env, arg); */
             register_name = "Performance7";
             goto cp0_unimplemented;
         default:
@@ -9686,8 +9745,10 @@ static void gen_dmtc0(DisasContext *ctx, TCGv arg, int reg, int sel)
     /* For simplicity assume that all writes can cause interrupts.  */
     if (tb_cflags(ctx->base.tb) & CF_USE_ICOUNT) {
         gen_io_end();
-        /* DISAS_STOP isn't sufficient, we need to ensure we break out of
-         * translated code to check for pending interrupts.  */
+        /*
+         * DISAS_STOP isn't sufficient, we need to ensure we break out of
+         * translated code to check for pending interrupts.
+         */
         gen_save_pc(ctx->base.pc_next + 4);
         ctx->base.is_jmp = DISAS_EXIT;
     }
@@ -9933,10 +9994,12 @@ static void gen_mttr(CPUMIPSState *env, DisasContext *ctx, int rd, int rt,
     if ((env->CP0_VPEConf0 & (1 << CP0VPEC0_MVP)) == 0 &&
         ((env->tcs[other_tc].CP0_TCBind & (0xf << CP0TCBd_CurVPE)) !=
          (env->active_tc.CP0_TCBind & (0xf << CP0TCBd_CurVPE)))) {
-        /* NOP */ ;
+        /* NOP */
+        ;
     } else if ((env->CP0_VPEControl & (0xff << CP0VPECo_TargTC)) >
              (env->mvp->CP0_MVPConf0 & (0xff << CP0MVPC0_PTC))) {
-        /* NOP */ ;
+        /* NOP */
+        ;
     } else if (u == 0) {
         switch (rd) {
         case 1:
@@ -12389,8 +12452,10 @@ static void gen_flt3_ldst(DisasContext *ctx, uint32_t opc,
     } else {
         gen_op_addr_add(ctx, t0, cpu_gpr[base], cpu_gpr[index]);
     }
-    /* Don't do NOP if destination is zero: we must perform the actual
-       memory access. */
+    /*
+     * Don't do NOP if destination is zero: we must perform the actual
+     * memory access.
+     */
     switch (opc) {
     case OPC_LWXC1:
         check_cop1x(ctx);
@@ -12718,8 +12783,10 @@ static void gen_rdhwr(DisasContext *ctx, int rt, int rd, int sel)
     TCGv t0;
 
 #if !defined(CONFIG_USER_ONLY)
-    /* The Linux kernel will emulate rdhwr if it's not supported natively.
-       Therefore only check the ISA in system mode.  */
+    /*
+     * The Linux kernel will emulate rdhwr if it's not supported natively.
+     * Therefore only check the ISA in system mode.
+     */
     check_insn(ctx, ISA_MIPS32R2);
 #endif
     t0 = tcg_temp_new();
@@ -12742,9 +12809,11 @@ static void gen_rdhwr(DisasContext *ctx, int rt, int rd, int sel)
             gen_io_end();
         }
         gen_store_gpr(t0, rt);
-        /* Break the TB to be able to take timer interrupts immediately
-           after reading count. DISAS_STOP isn't sufficient, we need to ensure
-           we break completely out of translated code.  */
+        /*
+         * Break the TB to be able to take timer interrupts immediately
+         * after reading count. DISAS_STOP isn't sufficient, we need to ensure
+         * we break completely out of translated code.
+         */
         gen_save_pc(ctx->base.pc_next + 4);
         ctx->base.is_jmp = DISAS_EXIT;
         break;
@@ -12755,7 +12824,8 @@ static void gen_rdhwr(DisasContext *ctx, int rt, int rd, int sel)
     case 4:
         check_insn(ctx, ISA_MIPS32R6);
         if (sel != 0) {
-            /* Performance counter registers are not implemented other than
+            /*
+             * Performance counter registers are not implemented other than
              * control register 0.
              */
             generate_exception(ctx, EXCP_RI);
@@ -12799,8 +12869,10 @@ static inline void clear_branch_hflags(DisasContext *ctx)
     if (ctx->base.is_jmp == DISAS_NEXT) {
         save_cpu_state(ctx, 0);
     } else {
-        /* it is not safe to save ctx->hflags as hflags may be changed
-           in execution time by the instruction in delay / forbidden slot. */
+        /*
+         * It is not safe to save ctx->hflags as hflags may be changed
+         * in execution time by the instruction in delay / forbidden slot.
+         */
         tcg_gen_andi_i32(hflags, hflags, ~MIPS_HFLAG_BMASK);
     }
 }
@@ -13599,8 +13671,10 @@ static int decode_extended_mips16_opc(CPUMIPSState *env, DisasContext *ctx)
                               | ((ctx->opcode >> 21) & 0x3f) << 5
                               | (ctx->opcode & 0x1f));
 
-    /* The extended opcodes cleverly reuse the opcodes from their 16-bit
-       counterparts.  */
+    /*
+     * The extended opcodes cleverly reuse the opcodes from their 16-bit
+     * counterparts.
+     */
     switch (op) {
     case M16_OPC_ADDIUSP:
         gen_arith_imm(ctx, OPC_ADDIU, rx, 29, imm);
@@ -14099,7 +14173,8 @@ static int decode_mips16_opc(CPUMIPSState *env, DisasContext *ctx)
             if (is_uhi(extract32(ctx->opcode, 5, 6))) {
                 gen_helper_do_semihosting(cpu_env);
             } else {
-                /* XXX: not clear which exception should be raised
+                /*
+                 * XXX: not clear which exception should be raised
                  *      when in debug mode...
                  */
                 check_insn(ctx, ISA_MIPS32);
@@ -14407,8 +14482,10 @@ enum {
 /* POOL32A encoding of minor opcode field */
 
 enum {
-    /* These opcodes are distinguished only by bits 9..6; those bits are
-     * what are recorded below. */
+    /*
+     * These opcodes are distinguished only by bits 9..6; those bits are
+     * what are recorded below.
+     */
     SLL32 = 0x0,
     SRL32 = 0x1,
     SRA = 0x2,
@@ -15056,8 +15133,10 @@ static void gen_pool16c_insn(DisasContext *ctx)
         {
             int reg = ctx->opcode & 0x1f;
             gen_compute_branch(ctx, OPC_JR, 2, reg, 0, 0, 0);
-            /* Let normal delay slot handling in our caller take us
-               to the branch target.  */
+            /*
+             * Let normal delay slot handling in our caller take us
+             * to the branch target.
+             */
         }
         break;
     case JALR16 + 0:
@@ -15085,7 +15164,8 @@ static void gen_pool16c_insn(DisasContext *ctx)
         if (is_uhi(extract32(ctx->opcode, 0, 4))) {
             gen_helper_do_semihosting(cpu_env);
         } else {
-            /* XXX: not clear which exception should be raised
+            /*
+             * XXX: not clear which exception should be raised
              *      when in debug mode...
              */
             check_insn(ctx, ISA_MIPS32);
@@ -15098,8 +15178,10 @@ static void gen_pool16c_insn(DisasContext *ctx)
             int imm = ZIMM(ctx->opcode, 0, 5);
             gen_compute_branch(ctx, OPC_JR, 2, 31, 0, 0, 0);
             gen_arith_imm(ctx, OPC_ADDIU, 29, 29, imm << 2);
-            /* Let normal delay slot handling in our caller take us
-               to the branch target.  */
+            /*
+             * Let normal delay slot handling in our caller take us
+             * to the branch target.
+             */
         }
         break;
     default:
@@ -15595,8 +15677,10 @@ static void gen_pool32axf(CPUMIPSState *env, DisasContext *ctx, int rt, int rs)
                 save_cpu_state(ctx, 1);
                 gen_helper_ei(t0, cpu_env);
                 gen_store_gpr(t0, rs);
-                /* DISAS_STOP isn't sufficient, we need to ensure we break out
-                   of translated code to check for pending interrupts.  */
+                /*
+                 * DISAS_STOP isn't sufficient, we need to ensure we break out
+                 * of translated code to check for pending interrupts.
+                 */
                 gen_save_pc(ctx->base.pc_next + 4);
                 ctx->base.is_jmp = DISAS_EXIT;
                 tcg_temp_free(t0);
@@ -15676,9 +15760,10 @@ static void gen_pool32axf(CPUMIPSState *env, DisasContext *ctx, int rt, int rs)
     }
 }
 
-/* Values for microMIPS fmt field.  Variable-width, depending on which
-   formats the instruction supports.  */
-
+/*
+ * Values for microMIPS fmt field.  Variable-width, depending on which
+ * formats the instruction supports.
+ */
 enum {
     FMT_SD_S = 0,
     FMT_SD_D = 1,
@@ -16751,8 +16836,10 @@ static void decode_micromips32_opc(CPUMIPSState *env, DisasContext *ctx)
         case TNEI: /* SYNCI */
             if (ctx->insn_flags & ISA_MIPS32R6) {
                 /* SYNCI */
-                /* Break the TB to be able to sync copied instructions
-                   immediately */
+                /*
+                 * Break the TB to be able to sync copied instructions
+                 * immediately.
+                 */
                 ctx->base.is_jmp = DISAS_STOP;
             } else {
                 /* TNEI */
@@ -16772,9 +16859,11 @@ static void decode_micromips32_opc(CPUMIPSState *env, DisasContext *ctx)
             check_insn_opc_removed(ctx, ISA_MIPS32R6);
             gen_compute_branch(ctx, minor == BNEZC ? OPC_BNE : OPC_BEQ,
                                4, rs, 0, imm << 1, 0);
-            /* Compact branches don't have a delay slot, so just let
-               the normal delay slot handling take us to the branch
-               target. */
+            /*
+             * Compact branches don't have a delay slot, so just let
+             * the normal delay slot handling take us to the branch
+             * target.
+             */
             break;
         case LUI:
             check_insn_opc_removed(ctx, ISA_MIPS32R6);
@@ -16782,8 +16871,10 @@ static void decode_micromips32_opc(CPUMIPSState *env, DisasContext *ctx)
             break;
         case SYNCI:
             check_insn_opc_removed(ctx, ISA_MIPS32R6);
-            /* Break the TB to be able to sync copied instructions
-               immediately */
+            /*
+             * Break the TB to be able to sync copied instructions
+             * immediately.
+             */
             ctx->base.is_jmp = DISAS_STOP;
             break;
         case BC2F:
@@ -17358,7 +17449,8 @@ static int decode_micromips_opc(CPUMIPSState *env, DisasContext *ctx)
                 break;
             }
             if (ctx->insn_flags & ISA_MIPS32R6) {
-                /* In the Release 6 the register number location in
+                /*
+                 * In the Release 6, the register number location in
                  * the instruction encoding has changed.
                  */
                 gen_arith(ctx, opc, rs1, rd, rs2);
@@ -21083,9 +21175,11 @@ static int decode_nanomips_32_48_opc(CPUMIPSState *env, DisasContext *ctx)
                 gen_p_lsx(ctx, rd, rs, rt);
                 break;
             case NM_LSA:
-                /* In nanoMIPS, the shift field directly encodes the shift
+                /*
+                 * In nanoMIPS, the shift field directly encodes the shift
                  * amount, meaning that the supported shift values are in
-                 * the range 0 to 3 (instead of 1 to 4 in MIPSR6). */
+                 * the range 0 to 3 (instead of 1 to 4 in MIPSR6).
+                 */
                 gen_lsa(ctx, OPC_LSA, rd, rs, rt,
                         extract32(ctx->opcode, 9, 2) - 1);
                 break;
@@ -21440,8 +21534,10 @@ static int decode_nanomips_32_48_opc(CPUMIPSState *env, DisasContext *ctx)
             case NM_P_PREFU12:
                 if (rt == 31) {
                     /* SYNCI */
-                    /* Break the TB to be able to sync copied instructions
-                       immediately */
+                    /*
+                     * Break the TB to be able to sync copied instructions
+                     * immediately.
+                     */
                     ctx->base.is_jmp = DISAS_STOP;
                 } else {
                     /* PREF */
@@ -21537,8 +21633,10 @@ static int decode_nanomips_32_48_opc(CPUMIPSState *env, DisasContext *ctx)
                 case NM_P_PREFS9:
                     if (rt == 31) {
                         /* SYNCI */
-                        /* Break the TB to be able to sync copied instructions
-                           immediately */
+                        /*
+                         * Break the TB to be able to sync copied instructions
+                         * immediately.
+                         */
                         ctx->base.is_jmp = DISAS_STOP;
                     } else {
                         /* PREF */
@@ -21630,8 +21728,10 @@ static int decode_nanomips_32_48_opc(CPUMIPSState *env, DisasContext *ctx)
                         /* case NM_SYNCIE */
                         check_eva(ctx);
                         check_cp0_enabled(ctx);
-                        /* Break the TB to be able to sync copied instructions
-                           immediately */
+                        /*
+                         * Break the TB to be able to sync copied instructions
+                         * immediately.
+                         */
                         ctx->base.is_jmp = DISAS_STOP;
                     } else {
                         /* case NM_PREFE */
@@ -23026,8 +23126,10 @@ static void gen_mipsdsp_multiply(DisasContext *ctx, uint32_t op1, uint32_t op2,
     gen_load_gpr(v2_t, v2);
 
     switch (op1) {
-    /* OPC_MULT_G_2E, OPC_ADDUH_QB_DSP, OPC_MUL_PH_DSP have
-     * the same mask and op1. */
+    /*
+     * OPC_MULT_G_2E, OPC_ADDUH_QB_DSP, OPC_MUL_PH_DSP have
+     * the same mask and op1.
+     */
     case OPC_MULT_G_2E:
         check_dsp_r2(ctx);
         switch (op2) {
@@ -23996,8 +24098,10 @@ static void decode_opc_special_r6(CPUMIPSState *env, DisasContext *ctx)
     case R6_OPC_CLO:
     case R6_OPC_CLZ:
         if (rt == 0 && sa == 1) {
-            /* Major opcode and function field is shared with preR6 MFHI/MTHI.
-               We need additionally to check other fields */
+            /*
+             * Major opcode and function field is shared with preR6 MFHI/MTHI.
+             * We need additionally to check other fields.
+             */
             gen_cl(ctx, op1, rd, rs);
         } else {
             generate_exception_end(ctx, EXCP_RI);
@@ -24022,8 +24126,10 @@ static void decode_opc_special_r6(CPUMIPSState *env, DisasContext *ctx)
     case R6_OPC_DCLO:
     case R6_OPC_DCLZ:
         if (rt == 0 && sa == 1) {
-            /* Major opcode and function field is shared with preR6 MFHI/MTHI.
-               We need additionally to check other fields */
+            /*
+             * Major opcode and function field is shared with preR6 MFHI/MTHI.
+             * We need additionally to check other fields.
+             */
             check_mips_64(ctx);
             gen_cl(ctx, op1, rd, rs);
         } else {
@@ -25939,7 +26045,7 @@ static void decode_opc_mxu__pool07(CPUMIPSState *env, DisasContext *ctx)
  *  |  SPECIAL2 |    rb   |x|        s12        |  XRa  |MXU__POOL08|
  *  +-----------+---------+-+-------------------+-------+-----------+
  *
-*/
+ */
 static void decode_opc_mxu__pool08(CPUMIPSState *env, DisasContext *ctx)
 {
     uint32_t opcode = extract32(ctx->opcode, 20, 1);
@@ -26835,7 +26941,8 @@ static void decode_opc_special2_legacy(CPUMIPSState *env, DisasContext *ctx)
         if (is_uhi(extract32(ctx->opcode, 6, 20))) {
             gen_helper_do_semihosting(cpu_env);
         } else {
-            /* XXX: not clear which exception should be raised
+            /*
+             * XXX: not clear which exception should be raised
              *      when in debug mode...
              */
             check_insn(ctx, ISA_MIPS32);
@@ -26977,8 +27084,10 @@ static void decode_opc_special3_legacy(CPUMIPSState *env, DisasContext *ctx)
     case OPC_MODU_G_2E:
     case OPC_MULT_G_2E:
     case OPC_MULTU_G_2E:
-        /* OPC_MULT_G_2E, OPC_ADDUH_QB_DSP, OPC_MUL_PH_DSP have
-         * the same mask and op1. */
+        /*
+         * OPC_MULT_G_2E, OPC_ADDUH_QB_DSP, OPC_MUL_PH_DSP have
+         * the same mask and op1.
+         */
         if ((ctx->insn_flags & ASE_DSP_R2) && (op1 == OPC_MULT_G_2E)) {
             op2 = MASK_ADDUH_QB(ctx->opcode);
             switch (op2) {
@@ -29165,8 +29274,10 @@ static void decode_opc(CPUMIPSState *env, DisasContext *ctx)
             break;
         case OPC_SYNCI:
             check_insn(ctx, ISA_MIPS32R2);
-            /* Break the TB to be able to sync copied instructions
-               immediately */
+            /*
+             * Break the TB to be able to sync copied instructions
+             * immediately.
+             */
             ctx->base.is_jmp = DISAS_STOP;
             break;
         case OPC_BPOSGE32:    /* MIPS DSP branch */
@@ -29283,8 +29394,10 @@ static void decode_opc(CPUMIPSState *env, DisasContext *ctx)
                     save_cpu_state(ctx, 1);
                     gen_helper_di(t0, cpu_env);
                     gen_store_gpr(t0, rt);
-                    /* Stop translation as we may have switched
-                       the execution mode.  */
+                    /*
+                     * Stop translation as we may have switched
+                     * the execution mode.
+                     */
                     ctx->base.is_jmp = DISAS_STOP;
                     break;
                 case OPC_EI:
@@ -29292,8 +29405,10 @@ static void decode_opc(CPUMIPSState *env, DisasContext *ctx)
                     save_cpu_state(ctx, 1);
                     gen_helper_ei(t0, cpu_env);
                     gen_store_gpr(t0, rt);
-                    /* DISAS_STOP isn't sufficient, we need to ensure we break
-                       out of translated code to check for pending interrupts */
+                    /*
+                     * DISAS_STOP isn't sufficient, we need to ensure we break
+                     * out of translated code to check for pending interrupts.
+                     */
                     gen_save_pc(ctx->base.pc_next + 4);
                     ctx->base.is_jmp = DISAS_EXIT;
                     break;
@@ -29876,10 +29991,12 @@ static bool mips_tr_breakpoint_check(DisasContextBase *dcbase, CPUState *cs,
     save_cpu_state(ctx, 1);
     ctx->base.is_jmp = DISAS_NORETURN;
     gen_helper_raise_exception_debug(cpu_env);
-    /* The address covered by the breakpoint must be included in
-       [tb->pc, tb->pc + tb->size) in order to for it to be
-       properly cleared -- thus we increment the PC here so that
-       the logic setting tb->size below does the right thing.  */
+    /*
+     * The address covered by the breakpoint must be included in
+     * [tb->pc, tb->pc + tb->size) in order to for it to be
+     * properly cleared -- thus we increment the PC here so that
+     * the logic setting tb->size below does the right thing.
+     */
     ctx->base.pc_next += 4;
     return true;
 }
@@ -29914,14 +30031,18 @@ static void mips_tr_translate_insn(DisasContextBase *dcbase, CPUState *cs)
     if (ctx->hflags & MIPS_HFLAG_BMASK) {
         if (!(ctx->hflags & (MIPS_HFLAG_BDS16 | MIPS_HFLAG_BDS32 |
                              MIPS_HFLAG_FBNSLOT))) {
-            /* force to generate branch as there is neither delay nor
-               forbidden slot */
+            /*
+             * Force to generate branch as there is neither delay nor
+             * forbidden slot.
+             */
             is_slot = 1;
         }
         if ((ctx->hflags & MIPS_HFLAG_M16) &&
             (ctx->hflags & MIPS_HFLAG_FBNSLOT)) {
-            /* Force to generate branch as microMIPS R6 doesn't restrict
-               branches in the forbidden slot. */
+            /*
+             * Force to generate branch as microMIPS R6 doesn't restrict
+             * branches in the forbidden slot.
+             */
             is_slot = 1;
         }
     }
@@ -29933,10 +30054,12 @@ static void mips_tr_translate_insn(DisasContextBase *dcbase, CPUState *cs)
     if (ctx->base.is_jmp != DISAS_NEXT) {
         return;
     }
-    /* Execute a branch and its delay slot as a single instruction.
-       This is what GDB expects and is consistent with what the
-       hardware does (e.g. if a delay slot instruction faults, the
-       reported PC is the PC of the branch).  */
+    /*
+     * Execute a branch and its delay slot as a single instruction.
+     * This is what GDB expects and is consistent with what the
+     * hardware does (e.g. if a delay slot instruction faults, the
+     * reported PC is the PC of the branch).
+     */
     if (ctx->base.singlestep_enabled &&
         (ctx->hflags & MIPS_HFLAG_BMASK) == 0) {
         ctx->base.is_jmp = DISAS_TOO_MANY;
@@ -30088,8 +30211,10 @@ void mips_tcg_init(void)
         int off = offsetof(CPUMIPSState, active_fpu.fpr[i].wr.d[0]);
         msa_wr_d[i * 2] =
                 tcg_global_mem_new_i64(cpu_env, off, msaregnames[i * 2]);
-        /* The scalar floating-point unit (FPU) registers are mapped on
-         * the MSA vector registers. */
+        /*
+         * The scalar floating-point unit (FPU) registers are mapped on
+         * the MSA vector registers.
+         */
         fpu_f64[i] = msa_wr_d[i * 2];
         off = offsetof(CPUMIPSState, active_fpu.fpr[i].wr.d[1]);
         msa_wr_d[i * 2 + 1] =
@@ -30247,8 +30372,10 @@ void cpu_state_reset(CPUMIPSState *env)
     /* Enable 64-bit address mode.  */
     env->CP0_Status |= (1 << CP0St_UX);
 # endif
-    /* Enable access to the CPUNum, SYNCI_Step, CC, and CCRes RDHWR
-       hardware registers.  */
+    /*
+     * Enable access to the CPUNum, SYNCI_Step, CC, and CCRes RDHWR
+     * hardware registers.
+     */
     env->CP0_HWREna |= 0x0000000F;
     if (env->CP0_Config1 & (1 << CP0C1_FP)) {
         env->CP0_Status |= (1 << CP0St_CU1);
@@ -30265,8 +30392,10 @@ void cpu_state_reset(CPUMIPSState *env)
 # endif
 #else
     if (env->hflags & MIPS_HFLAG_BMASK) {
-        /* If the exception was raised from a delay slot,
-           come back to the jump.  */
+        /*
+         * If the exception was raised from a delay slot,
+         * come back to the jump.
+         */
         env->CP0_ErrorEPC = (env->active_tc.PC
                              - (env->hflags & MIPS_HFLAG_B16 ? 2 : 4));
     } else {
@@ -30289,8 +30418,10 @@ void cpu_state_reset(CPUMIPSState *env)
     env->CP0_EntryHi_ASID_mask = (env->CP0_Config4 & (1 << CP0C4_AE)) ?
                                  0x3ff : 0xff;
     env->CP0_Status = (1 << CP0St_BEV) | (1 << CP0St_ERL);
-    /* vectored interrupts not implemented, timer on int 7,
-       no performance counters. */
+    /*
+     * Vectored interrupts not implemented, timer on int 7,
+     * no performance counters.
+     */
     env->CP0_IntCtl = 0xe0000000;
     {
         int i;
diff --git a/target/nios2/monitor.c b/target/nios2/monitor.c
index d5e3393716..6646836df5 100644
--- a/target/nios2/monitor.c
+++ b/target/nios2/monitor.c
@@ -25,7 +25,7 @@
 #include "cpu.h"
 #include "monitor/monitor.h"
 #include "monitor/hmp-target.h"
-#include "hmp.h"
+#include "monitor/hmp.h"
 
 void hmp_info_tlb(Monitor *mon, const QDict *qdict)
 {
diff --git a/target/ppc/monitor.c b/target/ppc/monitor.c
index 7f8360d903..a5a177d717 100644
--- a/target/ppc/monitor.c
+++ b/target/ppc/monitor.c
@@ -27,7 +27,7 @@
 #include "monitor/monitor.h"
 #include "qemu/ctype.h"
 #include "monitor/hmp-target.h"
-#include "hmp.h"
+#include "monitor/hmp.h"
 
 static target_long monitor_get_ccr(const struct MonitorDef *md, int val)
 {
diff --git a/target/ppc/translate_init.inc.c b/target/ppc/translate_init.inc.c
index 03cb6d0521..86fc8f2e31 100644
--- a/target/ppc/translate_init.inc.c
+++ b/target/ppc/translate_init.inc.c
@@ -41,7 +41,7 @@
 #include "qemu/cutils.h"
 #include "disas/capstone.h"
 #include "fpu/softfloat.h"
-#include "qapi/qapi-commands-target.h"
+#include "qapi/qapi-commands-machine-target.h"
 
 /* #define PPC_DUMP_CPU */
 /* #define PPC_DEBUG_SPR */
diff --git a/target/s390x/cpu.c b/target/s390x/cpu.c
index f2d93644d5..8540e7a2cb 100644
--- a/target/s390x/cpu.c
+++ b/target/s390x/cpu.c
@@ -31,7 +31,7 @@
 #include "qemu/module.h"
 #include "trace.h"
 #include "qapi/visitor.h"
-#include "qapi/qapi-visit-misc.h"
+#include "qapi/qapi-types-machine.h"
 #include "qapi/qapi-visit-run-state.h"
 #include "sysemu/hw_accel.h"
 #include "hw/qdev-properties.h"
diff --git a/target/s390x/cpu_models.c b/target/s390x/cpu_models.c
index 19ebde14db..2cb09c0780 100644
--- a/target/s390x/cpu_models.c
+++ b/target/s390x/cpu_models.c
@@ -28,7 +28,7 @@
 #include "sysemu/arch_init.h"
 #include "hw/pci/pci.h"
 #endif
-#include "qapi/qapi-commands-target.h"
+#include "qapi/qapi-commands-machine-target.h"
 
 #define CPUDEF_INIT(_type, _gen, _ec_ga, _mha_pow, _hmfai, _name, _desc) \
     {                                                                    \
diff --git a/target/s390x/sigp.c b/target/s390x/sigp.c
index ce49a792fc..8348b7035e 100644
--- a/target/s390x/sigp.c
+++ b/target/s390x/sigp.c
@@ -17,7 +17,7 @@
 #include "sysemu/sysemu.h"
 #include "sysemu/tcg.h"
 #include "trace.h"
-#include "qapi/qapi-types-misc.h"
+#include "qapi/qapi-types-machine.h"
 
 QemuMutex qemu_sigp_mutex;
 
diff --git a/target/sh4/monitor.c b/target/sh4/monitor.c
index 4c7f36c9cc..918a5ccfc6 100644
--- a/target/sh4/monitor.c
+++ b/target/sh4/monitor.c
@@ -25,7 +25,7 @@
 #include "cpu.h"
 #include "monitor/monitor.h"
 #include "monitor/hmp-target.h"
-#include "hmp.h"
+#include "monitor/hmp.h"
 
 static void print_tlb(Monitor *mon, int idx, tlb_t *tlb)
 {
diff --git a/target/sparc/monitor.c b/target/sparc/monitor.c
index 3ec3b51a3d..a7ea287cbc 100644
--- a/target/sparc/monitor.c
+++ b/target/sparc/monitor.c
@@ -25,7 +25,7 @@
 #include "cpu.h"
 #include "monitor/monitor.h"
 #include "monitor/hmp-target.h"
-#include "hmp.h"
+#include "monitor/hmp.h"
 
 
 void hmp_info_tlb(Monitor *mon, const QDict *qdict)
diff --git a/target/xtensa/monitor.c b/target/xtensa/monitor.c
index cf7957bb63..608173c238 100644
--- a/target/xtensa/monitor.c
+++ b/target/xtensa/monitor.c
@@ -25,7 +25,7 @@
 #include "cpu.h"
 #include "monitor/monitor.h"
 #include "monitor/hmp-target.h"
-#include "hmp.h"
+#include "monitor/hmp.h"
 
 void hmp_info_tlb(Monitor *mon, const QDict *qdict)
 {
diff --git a/tests/machine-none-test.c b/tests/machine-none-test.c
index 4c6d470798..5953d31755 100644
--- a/tests/machine-none-test.c
+++ b/tests/machine-none-test.c
@@ -36,9 +36,9 @@ static struct arch2cpu cpus_map[] = {
     /* FIXME: { "microblaze", "any" }, doesn't work with -M none -cpu any */
     /* FIXME: { "microblazeel", "any" }, doesn't work with -M none -cpu any */
     { "mips", "4Kc" },
-    { "mipsel", "4Kc" },
+    { "mipsel", "I7200" },
     { "mips64", "20Kc" },
-    { "mips64el", "20Kc" },
+    { "mips64el", "I6500" },
     { "moxie", "MoxieLite" },
     { "nios2", "FIXME" },
     { "or1k", "or1200" },
diff --git a/tests/tcg/mips/include/wrappers_msa.h b/tests/tcg/mips/include/wrappers_msa.h
index b512b1db57..4be7821ece 100644
--- a/tests/tcg/mips/include/wrappers_msa.h
+++ b/tests/tcg/mips/include/wrappers_msa.h
@@ -252,16 +252,32 @@ DO_MSA__WD__WS_WT(BNEG_D, bneg.d)
  */
 
 DO_MSA__WD__WS_WT(MADD_Q_H, madd_q.h)
+DO_MSA__WD__WD_WT(MADD_Q_H__DDT, madd_q.h)
+DO_MSA__WD__WS_WD(MADD_Q_H__DSD, madd_q.h)
 DO_MSA__WD__WS_WT(MADD_Q_W, madd_q.w)
+DO_MSA__WD__WD_WT(MADD_Q_W__DDT, madd_q.w)
+DO_MSA__WD__WS_WD(MADD_Q_W__DSD, madd_q.w)
 
 DO_MSA__WD__WS_WT(MADDR_Q_H, maddr_q.h)
+DO_MSA__WD__WD_WT(MADDR_Q_H__DDT, maddr_q.h)
+DO_MSA__WD__WS_WD(MADDR_Q_H__DSD, maddr_q.h)
 DO_MSA__WD__WS_WT(MADDR_Q_W, maddr_q.w)
+DO_MSA__WD__WD_WT(MADDR_Q_W__DDT, maddr_q.w)
+DO_MSA__WD__WS_WD(MADDR_Q_W__DSD, maddr_q.w)
 
 DO_MSA__WD__WS_WT(MSUB_Q_H, msub_q.h)
+DO_MSA__WD__WD_WT(MSUB_Q_H__DDT, msub_q.h)
+DO_MSA__WD__WS_WD(MSUB_Q_H__DSD, msub_q.h)
 DO_MSA__WD__WS_WT(MSUB_Q_W, msub_q.w)
+DO_MSA__WD__WD_WT(MSUB_Q_W__DDT, msub_q.w)
+DO_MSA__WD__WS_WD(MSUB_Q_W__DSD, msub_q.w)
 
 DO_MSA__WD__WS_WT(MSUBR_Q_H, msubr_q.h)
+DO_MSA__WD__WD_WT(MSUBR_Q_H__DDT, msubr_q.h)
+DO_MSA__WD__WS_WD(MSUBR_Q_H__DSD, msubr_q.h)
 DO_MSA__WD__WS_WT(MSUBR_Q_W, msubr_q.w)
+DO_MSA__WD__WD_WT(MSUBR_Q_W__DDT, msubr_q.w)
+DO_MSA__WD__WS_WD(MSUBR_Q_W__DSD, msubr_q.w)
 
 DO_MSA__WD__WS_WT(MUL_Q_H, mul_q.h)
 DO_MSA__WD__WS_WT(MUL_Q_W, mul_q.w)
diff --git a/tests/tcg/mips/user/ase/msa/fixed-multiply/test_msa_madd_q_h.c b/tests/tcg/mips/user/ase/msa/fixed-multiply/test_msa_madd_q_h.c
new file mode 100644
index 0000000000..29a2990011
--- /dev/null
+++ b/tests/tcg/mips/user/ase/msa/fixed-multiply/test_msa_madd_q_h.c
@@ -0,0 +1,216 @@
+/*
+ *  Test program for MSA instruction MADD_Q.H
+ *
+ *  Copyright (C) 2019  Wave Computing, Inc.
+ *  Copyright (C) 2019  Aleksandar Markovic <amarkovic@wavecomp.com>
+ *  Copyright (C) 2019  RT-RK Computer Based Systems LLC
+ *  Copyright (C) 2019  Mateja Marjanovic <mateja.marjanovic@rt-rk.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_128.h"
+#include "../../../../include/test_utils_128.h"
+
+#define TEST_COUNT_TOTAL (                                                \
+            (PATTERN_INPUTS_SHORT_COUNT) * (PATTERN_INPUTS_SHORT_COUNT) + \
+            3 * (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT))
+
+
+int32_t main(void)
+{
+    char *isa_ase_name = "MSA";
+    char *group_name = "Fixed Multiply";
+    char *instruction_name =  "MADD_Q.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] = {
+        { 0x0000000000000000ULL, 0x0000000000000000ULL, },    /*   0  */
+        { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+        { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+        { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+        { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+        { 0xfffefffefffefffeULL, 0xfffefffefffefffeULL, },
+        { 0xfffefffdfffefffeULL, 0xfffdfffefffefffdULL, },
+        { 0xfffdfffdfffdfffdULL, 0xfffdfffdfffdfffdULL, },
+        { 0xfffdfffdfffdfffdULL, 0xfffdfffdfffdfffdULL, },    /*   8  */
+        { 0xfffdfffdfffdfffdULL, 0xfffdfffdfffdfffdULL, },
+        { 0xfffdfffdfffdfffdULL, 0xfffdfffdfffdfffdULL, },
+        { 0xfffdfffdfffdfffdULL, 0xfffdfffdfffdfffdULL, },
+        { 0xfffdfffdfffdfffdULL, 0xfffdfffdfffdfffdULL, },
+        { 0xfffdfffdfffdfffdULL, 0xfffdfffdfffdfffdULL, },
+        { 0xfffdfffdfffdfffdULL, 0xfffdfffdfffdfffdULL, },
+        { 0xfffdfffdfffdfffdULL, 0xfffdfffdfffdfffdULL, },
+        { 0xfffdfffdfffdfffdULL, 0xfffdfffdfffdfffdULL, },    /*  16  */
+        { 0xfffdfffdfffdfffdULL, 0xfffdfffdfffdfffdULL, },
+        { 0x38e138e138e138e1ULL, 0x38e138e138e138e1ULL, },
+        { 0xfffdfffdfffdfffdULL, 0xfffdfffdfffdfffdULL, },
+        { 0x221f221f221f221fULL, 0x221f221f221f221fULL, },
+        { 0xfffcfffcfffcfffcULL, 0xfffcfffcfffcfffcULL, },
+        { 0x12f2da0f4bd712f2ULL, 0xda0f4bd712f2da0fULL, },
+        { 0xfffbfffcfffcfffbULL, 0xfffcfffcfffbfffcULL, },
+        { 0xfffafffbfffbfffaULL, 0xfffbfffbfffafffbULL, },    /*  24  */
+        { 0xfffafffbfffbfffaULL, 0xfffbfffbfffafffbULL, },
+        { 0xc716c717c717c716ULL, 0xc717c717c716c717ULL, },
+        { 0xfff9fffafffafff9ULL, 0xfffafffafff9fffaULL, },
+        { 0xddd6ddd7ddd7ddd6ULL, 0xddd7ddd7ddd6ddd7ULL, },
+        { 0xfff7fff8fff8fff7ULL, 0xfff8fff8fff7fff8ULL, },
+        { 0xed0025e4b41ded00ULL, 0x25e4b41ded0025e4ULL, },
+        { 0xfff5fff6fff6fff5ULL, 0xfff6fff6fff5fff6ULL, },
+        { 0xfff5fff6fff6fff5ULL, 0xfff6fff6fff5fff6ULL, },    /*  32  */
+        { 0xfff5fff6fff6fff5ULL, 0xfff6fff6fff5fff6ULL, },
+        { 0x2217221822182217ULL, 0x2218221822172218ULL, },
+        { 0xfff4fff5fff5fff4ULL, 0xfff5fff5fff4fff5ULL, },
+        { 0x146f14701470146fULL, 0x14701470146f1470ULL, },
+        { 0xfff3fff4fff4fff3ULL, 0xfff4fff4fff3fff4ULL, },
+        { 0x0b53e9322d770b53ULL, 0xe9322d770b53e932ULL, },
+        { 0xfff2fff3fff3fff2ULL, 0xfff3fff3fff2fff3ULL, },
+        { 0xfff1fff2fff2fff1ULL, 0xfff2fff2fff1fff2ULL, },    /*  40  */
+        { 0xfff1fff2fff2fff1ULL, 0xfff2fff2fff1fff2ULL, },
+        { 0xddceddcfddcfddceULL, 0xddcfddcfddceddcfULL, },
+        { 0xffeffff0fff0ffefULL, 0xfff0fff0ffeffff0ULL, },
+        { 0xeb73eb74eb74eb73ULL, 0xeb74eb74eb73eb74ULL, },
+        { 0xffedffeeffeeffedULL, 0xffeeffeeffedffeeULL, },
+        { 0xf48c16afd26af48cULL, 0x16afd26af48c16afULL, },
+        { 0xffecffedffecffecULL, 0xffedffecffecffedULL, },
+        { 0xffecffecffecffecULL, 0xffecffecffecffecULL, },    /*  48  */
+        { 0xffecffecffecffecULL, 0xffecffecffecffecULL, },
+        { 0x12e2d9ff4bc712e2ULL, 0xd9ff4bc712e2d9ffULL, },
+        { 0xffebffebffecffebULL, 0xffebffecffebffebULL, },
+        { 0x0b4be9292d6f0b4bULL, 0xe9292d6f0b4be929ULL, },
+        { 0xffeaffeaffebffeaULL, 0xffeaffebffeaffeaULL, },
+        { 0x063c1932650f063cULL, 0x1932650f063c1932ULL, },
+        { 0xffe9ffe9ffebffe9ULL, 0xffe9ffebffe9ffe9ULL, },
+        { 0xffe8ffe9ffeaffe8ULL, 0xffe9ffeaffe8ffe9ULL, },    /*  56  */
+        { 0xffe8ffe9ffeaffe8ULL, 0xffe9ffeaffe8ffe9ULL, },
+        { 0xecf125d6b40fecf1ULL, 0x25d6b40fecf125d6ULL, },
+        { 0xffe6ffe8ffe8ffe6ULL, 0xffe8ffe8ffe6ffe8ULL, },
+        { 0xf48516a9d264f485ULL, 0x16a9d264f48516a9ULL, },
+        { 0xffe5ffe7ffe6ffe5ULL, 0xffe7ffe6ffe5ffe7ULL, },
+        { 0xf992e69e9ac2f992ULL, 0xe69e9ac2f992e69eULL, },
+        { 0xffe3ffe7ffe4ffe3ULL, 0xffe7ffe4ffe3ffe7ULL, },
+        { 0x6f9c04dd0ca138aaULL, 0x2c5200e6ffe731d8ULL, },    /*  64  */
+        { 0x739604c9251a12b8ULL, 0x377dfac7ffa6fe02ULL, },
+        { 0x7fff14cc0ef4c520ULL, 0x4ef5f5b700a7e6d8ULL, },
+        { 0x171110672cabb158ULL, 0x0bc4eb2201aef931ULL, },
+        { 0x1b0b105345248b66ULL, 0x16efe503016dc55bULL, },
+        { 0x1b2f10537427a4c0ULL, 0x19be0a1804f3fb27ULL, },
+        { 0x1df71014499cd899ULL, 0x1fa528c6f6de1330ULL, },
+        { 0x1a3a10257fffe5d0ULL, 0x0ebe68e9e8780024ULL, },
+        { 0x6860202869d99838ULL, 0x263663d9e979e8faULL, },    /*  72  */
+        { 0x6b281fe93f4ecc11ULL, 0x2c1d7fffdb640103ULL, },
+        { 0x7fff539865cb3619ULL, 0x38847fff139c0bc0ULL, },
+        { 0x369a456c32245120ULL, 0x15027fff4d19033dULL, },
+        { 0xcdac41074fdb3d58ULL, 0xd1d1756a4e201596ULL, },
+        { 0xc9ef41187fff4a8fULL, 0xc0ea7fff3fba028aULL, },
+        { 0x808a32ec4c586596ULL, 0x9d687fff7937fa07ULL, },
+        { 0xe31436ce7fff6c79ULL, 0x030a7fff7fff00c4ULL, },
+        { 0xfe192c037fff7fffULL, 0x04d47fff7e7a0049ULL, },    /*  80  */
+        { 0xfe292c257fff4707ULL, 0x058b3b197fff0078ULL, },
+        { 0xff5c101739ce0661ULL, 0x074420c72b2a009aULL, },
+        { 0xfecc12e4645704e6ULL, 0x00ca02430de90076ULL, },
+        { 0xffeb0f2b7fff0829ULL, 0x014002760dbe002cULL, },
+        { 0xffeb0f367fff0487ULL, 0x016f012210050048ULL, },
+        { 0xfff8058b39ce0068ULL, 0x01e100a00567005cULL, },
+        { 0xfff006826457004fULL, 0x0034000b01bd0046ULL, },
+        { 0xfffe05397fff0083ULL, 0x0052000b01b7001aULL, },    /*  88  */
+        { 0xfffe053d7fff0048ULL, 0x005e000501ff002aULL, },
+        { 0xffff01e839ce0006ULL, 0x007b000200ac0036ULL, },
+        { 0xfffe023d64570004ULL, 0x000d000000370029ULL, },
+        { 0xffff01cc7fff0006ULL, 0x001400000036000fULL, },
+        { 0xffff01cd7fff0003ULL, 0x00160000003e0018ULL, },
+        { 0xffff00a839ce0000ULL, 0x001c00000014001eULL, },
+        { 0xfffe00c564570000ULL, 0x0003000000060017ULL, },
+        { 0xffff009e7fff0000ULL, 0x0004000000050008ULL, },    /*  96  */
+        { 0xffff007e7fff0000ULL, 0x0006000000040003ULL, },
+        { 0xffff00657fff0000ULL, 0x0009000000030001ULL, },
+        { 0xffff00517fff0000ULL, 0x000e000000020000ULL, },
+        { 0xffff00517fff0000ULL, 0x0010000000020000ULL, },
+        { 0xffff00517fff0000ULL, 0x0012000000020000ULL, },
+        { 0xffff00517fff0000ULL, 0x0014000000020000ULL, },
+        { 0xffff00517fff0000ULL, 0x0016000000020000ULL, },
+        { 0xffff001d39ce0000ULL, 0x001c000000000000ULL, },    /* 104  */
+        { 0xffff000a1a1b0000ULL, 0x0024000000000000ULL, },
+        { 0xffff00030bca0000ULL, 0x002f000000000000ULL, },
+        { 0xffff000105530000ULL, 0x003d000000000000ULL, },
+        { 0xfffe0001093d0000ULL, 0x0006000000000000ULL, },
+        { 0xfffc000110090000ULL, 0x0000000000000000ULL, },
+        { 0xfff800011bd50000ULL, 0x0000000000000000ULL, },
+        { 0xfff0000130500000ULL, 0x0000000000000000ULL, },
+};
+
+    reset_msa_registers();
+
+    gettimeofday(&start, NULL);
+
+    for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) {
+        for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) {
+            do_msa_MADD_Q_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_MADD_Q_H(b128_random[i], b128_random[j],
+                            b128_result[((PATTERN_INPUTS_SHORT_COUNT) *
+                                         (PATTERN_INPUTS_SHORT_COUNT)) +
+                                        RANDOM_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_MADD_Q_H__DDT(b128_random[i], b128_random[j],
+                                 b128_result[
+                                     ((PATTERN_INPUTS_SHORT_COUNT) *
+                                      (PATTERN_INPUTS_SHORT_COUNT)) +
+                                     ((RANDOM_INPUTS_SHORT_COUNT) *
+                                      (RANDOM_INPUTS_SHORT_COUNT)) +
+                                     RANDOM_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_MADD_Q_H__DSD(b128_random[i], b128_random[j],
+                                 b128_result[
+                                     ((PATTERN_INPUTS_SHORT_COUNT) *
+                                      (PATTERN_INPUTS_SHORT_COUNT)) +
+                                     (2 * (RANDOM_INPUTS_SHORT_COUNT) *
+                                      (RANDOM_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_128(isa_ase_name, group_name, 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/fixed-multiply/test_msa_madd_q_w.c b/tests/tcg/mips/user/ase/msa/fixed-multiply/test_msa_madd_q_w.c
new file mode 100644
index 0000000000..529d60d1e9
--- /dev/null
+++ b/tests/tcg/mips/user/ase/msa/fixed-multiply/test_msa_madd_q_w.c
@@ -0,0 +1,216 @@
+/*
+ *  Test program for MSA instruction MADD_Q.W
+ *
+ *  Copyright (C) 2019  Wave Computing, Inc.
+ *  Copyright (C) 2019  Aleksandar Markovic <amarkovic@wavecomp.com>
+ *  Copyright (C) 2019  RT-RK Computer Based Systems LLC
+ *  Copyright (C) 2019  Mateja Marjanovic <mateja.marjanovic@rt-rk.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_128.h"
+#include "../../../../include/test_utils_128.h"
+
+#define TEST_COUNT_TOTAL (                                                \
+            (PATTERN_INPUTS_SHORT_COUNT) * (PATTERN_INPUTS_SHORT_COUNT) + \
+            3 * (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT))
+
+
+int32_t main(void)
+{
+    char *isa_ase_name = "MSA";
+    char *group_name = "Fixed Multiply";
+    char *instruction_name =  "MADD_Q.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] = {
+        { 0x0000000000000000ULL, 0x0000000000000000ULL, },    /*   0  */
+        { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+        { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+        { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+        { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+        { 0xfffffffefffffffeULL, 0xfffffffefffffffeULL, },
+        { 0xfffffffefffffffeULL, 0xfffffffdfffffffeULL, },
+        { 0xfffffffdfffffffdULL, 0xfffffffdfffffffdULL, },
+        { 0xfffffffdfffffffdULL, 0xfffffffdfffffffdULL, },    /*   8  */
+        { 0xfffffffdfffffffdULL, 0xfffffffdfffffffdULL, },
+        { 0xfffffffdfffffffdULL, 0xfffffffdfffffffdULL, },
+        { 0xfffffffdfffffffdULL, 0xfffffffdfffffffdULL, },
+        { 0xfffffffdfffffffdULL, 0xfffffffdfffffffdULL, },
+        { 0xfffffffdfffffffdULL, 0xfffffffdfffffffdULL, },
+        { 0xfffffffdfffffffdULL, 0xfffffffdfffffffdULL, },
+        { 0xfffffffdfffffffdULL, 0xfffffffdfffffffdULL, },
+        { 0xfffffffdfffffffdULL, 0xfffffffdfffffffdULL, },    /*  16  */
+        { 0xfffffffdfffffffdULL, 0xfffffffdfffffffdULL, },
+        { 0x38e38e3638e38e36ULL, 0x38e38e3638e38e36ULL, },
+        { 0xfffffffcfffffffcULL, 0xfffffffcfffffffcULL, },
+        { 0x2222221e2222221eULL, 0x2222221e2222221eULL, },
+        { 0xfffffffbfffffffbULL, 0xfffffffbfffffffbULL, },
+        { 0x12f684b94bda12f2ULL, 0xda12f68012f684b9ULL, },
+        { 0xfffffffbfffffffbULL, 0xfffffffbfffffffbULL, },
+        { 0xfffffffafffffffaULL, 0xfffffffafffffffaULL, },    /*  24  */
+        { 0xfffffffafffffffaULL, 0xfffffffafffffffaULL, },
+        { 0xc71c71c0c71c71c0ULL, 0xc71c71c0c71c71c0ULL, },
+        { 0xfffffff8fffffff8ULL, 0xfffffff8fffffff8ULL, },
+        { 0xddddddd5ddddddd5ULL, 0xddddddd5ddddddd5ULL, },
+        { 0xfffffff6fffffff6ULL, 0xfffffff6fffffff6ULL, },
+        { 0xed097b38b425ecffULL, 0x25ed0970ed097b38ULL, },
+        { 0xfffffff5fffffff4ULL, 0xfffffff4fffffff5ULL, },
+        { 0xfffffff5fffffff4ULL, 0xfffffff4fffffff5ULL, },    /*  32  */
+        { 0xfffffff5fffffff4ULL, 0xfffffff4fffffff5ULL, },
+        { 0x2222221722222216ULL, 0x2222221622222217ULL, },
+        { 0xfffffff4fffffff3ULL, 0xfffffff3fffffff4ULL, },
+        { 0x147ae13c147ae13bULL, 0x147ae13b147ae13cULL, },
+        { 0xfffffff4fffffff3ULL, 0xfffffff3fffffff4ULL, },
+        { 0x0b60b5ff2d82d821ULL, 0xe93e93dc0b60b5ffULL, },
+        { 0xfffffff3fffffff3ULL, 0xfffffff3fffffff3ULL, },
+        { 0xfffffff2fffffff2ULL, 0xfffffff2fffffff2ULL, },    /*  40  */
+        { 0xfffffff2fffffff2ULL, 0xfffffff2fffffff2ULL, },
+        { 0xddddddcfddddddcfULL, 0xddddddcfddddddcfULL, },
+        { 0xfffffff0fffffff0ULL, 0xfffffff0fffffff0ULL, },
+        { 0xeb851ea8eb851ea8ULL, 0xeb851ea8eb851ea8ULL, },
+        { 0xffffffefffffffefULL, 0xffffffefffffffefULL, },
+        { 0xf49f49e3d27d27c1ULL, 0x16c16c05f49f49e3ULL, },
+        { 0xffffffeeffffffeeULL, 0xffffffeeffffffeeULL, },
+        { 0xffffffeeffffffeeULL, 0xffffffedffffffeeULL, },    /*  48  */
+        { 0xffffffeeffffffeeULL, 0xffffffedffffffeeULL, },
+        { 0x12f684ac4bda12e5ULL, 0xda12f67212f684acULL, },
+        { 0xffffffeeffffffeeULL, 0xffffffecffffffeeULL, },
+        { 0x0b60b5f92d82d81cULL, 0xe93e93d50b60b5f9ULL, },
+        { 0xffffffedffffffeeULL, 0xffffffebffffffedULL, },
+        { 0x06522c2c6522c3e1ULL, 0x1948b0e706522c2cULL, },
+        { 0xffffffecffffffeeULL, 0xffffffeaffffffecULL, },
+        { 0xffffffebffffffedULL, 0xffffffeaffffffebULL, },    /*  56  */
+        { 0xffffffebffffffedULL, 0xffffffeaffffffebULL, },
+        { 0xed097b2db425ecf6ULL, 0x25ed0965ed097b2dULL, },
+        { 0xffffffeaffffffebULL, 0xffffffe9ffffffeaULL, },
+        { 0xf49f49ded27d27bdULL, 0x16c16c00f49f49deULL, },
+        { 0xffffffe9ffffffeaULL, 0xffffffe9ffffffe9ULL, },
+        { 0xf9add3a99add3bf7ULL, 0xe6b74eecf9add3a9ULL, },
+        { 0xffffffe8ffffffe8ULL, 0xffffffe8ffffffe8ULL, },
+        { 0x6fb7e8710cbdc0baULL, 0x2c6b142e000499ecULL, },    /*  64  */
+        { 0x73b239bf253787bbULL, 0x379780d7ffc424b2ULL, },
+        { 0x7fffffff0f12777aULL, 0x4f10996a00c57ee6ULL, },
+        { 0x1713a7162cca6b1fULL, 0x0be04dd301cca255ULL, },
+        { 0x1b0df86445443220ULL, 0x170cba7c018c2d1bULL, },
+        { 0x1b323a657448a831ULL, 0x19dc4690051313a9ULL, },
+        { 0x1dfa85ec49be7952ULL, 0x1fc3e11af6fe2ffbULL, },
+        { 0x1a3e24c87fffffffULL, 0x0edd19b6e8983fd8ULL, },
+        { 0x6863454e69daefbeULL, 0x26563249e9999a0cULL, },    /*  72  */
+        { 0x6b2b90d53f50c0dfULL, 0x2c3dccd3db84b65eULL, },
+        { 0x7fffffff65cdd2a2ULL, 0x38a5553713bd77aaULL, },
+        { 0x369baa383226e26fULL, 0x1523c32e4d39d083ULL, },
+        { 0xcdaf514f4fded614ULL, 0xd1f377974e40f3f2ULL, },
+        { 0xc9f2f02b7fffffffULL, 0xc10cb0333fdb03cfULL, },
+        { 0x808e9a644c590fccULL, 0x9d8b1e2a79575ca8ULL, },
+        { 0xe31932487fffffffULL, 0x032ce40b7fffffffULL, },
+        { 0xfe196fe57fffffffULL, 0x050bc0117e7bb00bULL, },    /*  80  */
+        { 0xfe299f467fffffffULL, 0x05cb2b207fffffffULL, },
+        { 0xff5d018239cf8b7fULL, 0x0798e21e2b2b2513ULL, },
+        { 0xfecdfe1e645a7d99ULL, 0x00d3dcf00dea608dULL, },
+        { 0xffebe0507fffffffULL, 0x0150aaf30dc02967ULL, },
+        { 0xffec8bad7fffffffULL, 0x01828e9310087db0ULL, },
+        { 0xfff9423b39cf8b7fULL, 0x01fae4ad056841b8ULL, },
+        { 0xfff35804645a7d99ULL, 0x003737ba01be3861ULL, },
+        { 0xffff2aee7fffffffULL, 0x0057bed401b8eeafULL, },    /*  88  */
+        { 0xffff32047fffffffULL, 0x0064bf7c02021ffbULL, },
+        { 0xffffb89f39cf8b7fULL, 0x00841c7300ad6409ULL, },
+        { 0xffff79fe645a7d99ULL, 0x000e642e0037e4a5ULL, },
+        { 0xfffff72f7fffffffULL, 0x0016de7600373b15ULL, },
+        { 0xfffff77a7fffffffULL, 0x001a420100406619ULL, },
+        { 0xfffffd0b39cf8b7fULL, 0x00226e950015b801ULL, },
+        { 0xfffffa72645a7d99ULL, 0x0003c03400070049ULL, },
+        { 0xffffffa27fffffffULL, 0x0005f5d70006eb0bULL, },    /*  96  */
+        { 0xfffffff97fffffffULL, 0x000978af0006d60eULL, },
+        { 0xffffffff7fffffffULL, 0x000f0d050006c150ULL, },
+        { 0xffffffff7fffffffULL, 0x0017eac30006acd1ULL, },
+        { 0xffffffff7fffffffULL, 0x001b76100007c878ULL, },
+        { 0xffffffff7fffffffULL, 0x001f87d000091335ULL, },
+        { 0xffffffff7fffffffULL, 0x002433ef000a94d9ULL, },
+        { 0xffffffff7fffffffULL, 0x0029914d000c5680ULL, },
+        { 0xffffffff39cf8b7fULL, 0x003681f800042937ULL, },    /* 104  */
+        { 0xffffffff1a1c28c3ULL, 0x004779e10001673fULL, },
+        { 0xffffffff0bcae025ULL, 0x005dba1000007928ULL, },
+        { 0xffffffff055376c1ULL, 0x007ae77c000028dcULL, },
+        { 0xfffffffe093ed554ULL, 0x000d636d00000d2bULL, },
+        { 0xfffffffc100c9463ULL, 0x0001755c0000043eULL, },
+        { 0xfffffff81bdc128cULL, 0x000028ab0000015eULL, },
+        { 0xfffffff0305c8babULL, 0x0000046e00000070ULL, },
+};
+
+    reset_msa_registers();
+
+    gettimeofday(&start, NULL);
+
+    for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) {
+        for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) {
+            do_msa_MADD_Q_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_MADD_Q_W(b128_random[i], b128_random[j],
+                            b128_result[((PATTERN_INPUTS_SHORT_COUNT) *
+                                         (PATTERN_INPUTS_SHORT_COUNT)) +
+                                        RANDOM_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_MADD_Q_W__DDT(b128_random[i], b128_random[j],
+                                 b128_result[
+                                     ((PATTERN_INPUTS_SHORT_COUNT) *
+                                      (PATTERN_INPUTS_SHORT_COUNT)) +
+                                     ((RANDOM_INPUTS_SHORT_COUNT) *
+                                      (RANDOM_INPUTS_SHORT_COUNT)) +
+                                     RANDOM_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_MADD_Q_W__DSD(b128_random[i], b128_random[j],
+                                 b128_result[
+                                     ((PATTERN_INPUTS_SHORT_COUNT) *
+                                      (PATTERN_INPUTS_SHORT_COUNT)) +
+                                     (2 * (RANDOM_INPUTS_SHORT_COUNT) *
+                                      (RANDOM_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_128(isa_ase_name, group_name, 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/fixed-multiply/test_msa_maddr_q_h.c b/tests/tcg/mips/user/ase/msa/fixed-multiply/test_msa_maddr_q_h.c
new file mode 100644
index 0000000000..a4713f2321
--- /dev/null
+++ b/tests/tcg/mips/user/ase/msa/fixed-multiply/test_msa_maddr_q_h.c
@@ -0,0 +1,216 @@
+/*
+ *  Test program for MSA instruction MADDR_Q.H
+ *
+ *  Copyright (C) 2019  Wave Computing, Inc.
+ *  Copyright (C) 2019  Aleksandar Markovic <amarkovic@wavecomp.com>
+ *  Copyright (C) 2019  RT-RK Computer Based Systems LLC
+ *  Copyright (C) 2019  Mateja Marjanovic <mateja.marjanovic@rt-rk.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_128.h"
+#include "../../../../include/test_utils_128.h"
+
+#define TEST_COUNT_TOTAL (                                                \
+            (PATTERN_INPUTS_SHORT_COUNT) * (PATTERN_INPUTS_SHORT_COUNT) + \
+            3 * (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT))
+
+
+int32_t main(void)
+{
+    char *isa_ase_name = "MSA";
+    char *group_name = "Fixed Multiply";
+    char *instruction_name =  "MADDR_Q.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] = {
+        { 0x0000000000000000ULL, 0x0000000000000000ULL, },    /*   0  */
+        { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+        { 0x0001000100010001ULL, 0x0001000100010001ULL, },
+        { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+        { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+        { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+        { 0x0000000000010000ULL, 0x0000000100000000ULL, },
+        { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+        { 0x0000000000000000ULL, 0x0000000000000000ULL, },    /*   8  */
+        { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+        { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+        { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+        { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+        { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+        { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+        { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+        { 0x0001000100010001ULL, 0x0001000100010001ULL, },    /*  16  */
+        { 0x0001000100010001ULL, 0x0001000100010001ULL, },
+        { 0x38e538e538e538e5ULL, 0x38e538e538e538e5ULL, },
+        { 0x0001000100010001ULL, 0x0001000100010001ULL, },
+        { 0x2224222422242224ULL, 0x2224222422242224ULL, },
+        { 0x0002000200020002ULL, 0x0002000200020002ULL, },
+        { 0x12f9da154bdd12f9ULL, 0xda154bdd12f9da15ULL, },
+        { 0x0003000300020003ULL, 0x0003000200030003ULL, },
+        { 0x0002000200010002ULL, 0x0002000100020002ULL, },    /*  24  */
+        { 0x0002000200010002ULL, 0x0002000100020002ULL, },
+        { 0xc71ec71ec71dc71eULL, 0xc71ec71dc71ec71eULL, },
+        { 0x0001000100000001ULL, 0x0001000000010001ULL, },
+        { 0xdddedddedddddddeULL, 0xdddedddddddedddeULL, },
+        { 0x00000000ffff0000ULL, 0x0000ffff00000000ULL, },
+        { 0xed0925edb425ed09ULL, 0x25edb425ed0925edULL, },
+        { 0xffff0000ffffffffULL, 0x0000ffffffff0000ULL, },
+        { 0xffff0000ffffffffULL, 0x0000ffffffff0000ULL, },    /*  32  */
+        { 0xffff0000ffffffffULL, 0x0000ffffffff0000ULL, },
+        { 0x2222222322222222ULL, 0x2223222222222223ULL, },
+        { 0xffff0000ffffffffULL, 0x0000ffffffff0000ULL, },
+        { 0x147b147c147b147bULL, 0x147c147b147b147cULL, },
+        { 0x0000000100000000ULL, 0x0001000000000001ULL, },
+        { 0x0b61e93f2d840b61ULL, 0xe93f2d840b61e93fULL, },
+        { 0x0000000100000000ULL, 0x0001000000000001ULL, },
+        { 0x0000000100000000ULL, 0x0001000000000001ULL, },    /*  40  */
+        { 0x0000000100000000ULL, 0x0001000000000001ULL, },
+        { 0xdddedddfdddedddeULL, 0xdddfdddedddedddfULL, },
+        { 0x0000000100000000ULL, 0x0001000000000001ULL, },
+        { 0xeb85eb86eb85eb85ULL, 0xeb86eb85eb85eb86ULL, },
+        { 0x0000000100000000ULL, 0x0001000000000001ULL, },
+        { 0xf49f16c2d27df49fULL, 0x16c2d27df49f16c2ULL, },
+        { 0xffff00000000ffffULL, 0x00000000ffff0000ULL, },
+        { 0xffff00000001ffffULL, 0x00000001ffff0000ULL, },    /*  48  */
+        { 0xffff00000001ffffULL, 0x00000001ffff0000ULL, },
+        { 0x12f6da134bdc12f6ULL, 0xda134bdc12f6da13ULL, },
+        { 0xffff00000002ffffULL, 0x00000002ffff0000ULL, },
+        { 0x0b60e93e2d860b60ULL, 0xe93e2d860b60e93eULL, },
+        { 0xffffffff0003ffffULL, 0xffff0003ffffffffULL, },
+        { 0x0651194765270651ULL, 0x1947652706511947ULL, },
+        { 0xfffffffe0004ffffULL, 0xfffe0004fffffffeULL, },
+        { 0xfffffffe0003ffffULL, 0xfffe0003fffffffeULL, },    /*  56  */
+        { 0xfffffffe0003ffffULL, 0xfffe0003fffffffeULL, },
+        { 0xed0925ecb428ed09ULL, 0x25ecb428ed0925ecULL, },
+        { 0xffffffff0002ffffULL, 0xffff0002ffffffffULL, },
+        { 0xf49e16c1d27ef49eULL, 0x16c1d27ef49e16c1ULL, },
+        { 0xfffeffff0001fffeULL, 0xffff0001fffeffffULL, },
+        { 0xf9ace6b69adef9acULL, 0xe6b69adef9ace6b6ULL, },
+        { 0xfffeffff0001fffeULL, 0xffff0001fffeffffULL, },
+        { 0x6fb804f50cbf38c5ULL, 0x2c6a0103000331f0ULL, },    /*  64  */
+        { 0x73b204e2253812d4ULL, 0x3796fae5ffc2fe1aULL, },
+        { 0x7fff14e60f13c53dULL, 0x4f0ff5d500c4e6f1ULL, },
+        { 0x171210822ccab176ULL, 0x0bdeeb4001ccf94aULL, },
+        { 0x1b0c106f45438b85ULL, 0x170ae522018bc574ULL, },
+        { 0x1b30106f7447a4e0ULL, 0x19d90a380512fb41ULL, },
+        { 0x1df8103049bdd8baULL, 0x1fc028e7f6fd134bULL, },
+        { 0x1a3c10417fffe5f1ULL, 0x0eda690ae8970040ULL, },
+        { 0x6862204569da985aULL, 0x265363fae999e917ULL, },    /*  72  */
+        { 0x6b2a20063f50cc34ULL, 0x2c3a7fffdb840121ULL, },
+        { 0x7fff53b565ce363dULL, 0x38a17fff13bd0bdfULL, },
+        { 0x369a458932275144ULL, 0x15207fff4d3a035dULL, },
+        { 0xcdad41254fde3d7dULL, 0xd1ef756a4e4215b6ULL, },
+        { 0xc9f141367fff4ab4ULL, 0xc1097fff3fdc02abULL, },
+        { 0x808c330a4c5865bbULL, 0x9d887fff7959fa29ULL, },
+        { 0xe31636ed7fff6c9fULL, 0x032b7fff7fff00e7ULL, },
+        { 0xfe192c1c7fff7fffULL, 0x05097fff7e7a0057ULL, },    /*  80  */
+        { 0xfe292c3e7fff4707ULL, 0x05c83b1a7fff008fULL, },
+        { 0xff5d102139cf0662ULL, 0x079520c82b2b00b8ULL, },
+        { 0xfece12f0645904e7ULL, 0x00d302440dea008eULL, },
+        { 0xffec0f357fff082bULL, 0x014f02780dc00035ULL, },
+        { 0xffed0f417fff0488ULL, 0x0181012410080057ULL, },
+        { 0xfff9059039cf0068ULL, 0x01f900a205680070ULL, },
+        { 0xfff3068864590050ULL, 0x0037000b01be0056ULL, },
+        { 0xffff053f7fff0085ULL, 0x0057000c01b90020ULL, },    /*  88  */
+        { 0xffff05437fff004aULL, 0x0064000602020035ULL, },
+        { 0x000001eb39cf0007ULL, 0x0083000300ad0044ULL, },
+        { 0x0000024164590005ULL, 0x000e000000380034ULL, },
+        { 0x000001cf7fff0008ULL, 0x0016000000370014ULL, },
+        { 0x000001d07fff0004ULL, 0x0019000000400021ULL, },
+        { 0x000000a939cf0000ULL, 0x002100000016002bULL, },
+        { 0x000000c664590000ULL, 0x0004000000070021ULL, },
+        { 0x0000009f7fff0000ULL, 0x000600000007000cULL, },    /*  96  */
+        { 0x000000807fff0000ULL, 0x000a000000070005ULL, },
+        { 0x000000677fff0000ULL, 0x0010000000070002ULL, },
+        { 0x000000537fff0000ULL, 0x0019000000070001ULL, },
+        { 0x000000537fff0000ULL, 0x001d000000080002ULL, },
+        { 0x000000537fff0000ULL, 0x0021000000090003ULL, },
+        { 0x000000537fff0000ULL, 0x00260000000a0005ULL, },
+        { 0x000000537fff0000ULL, 0x002c0000000c0008ULL, },
+        { 0x0000001e39cf0000ULL, 0x003a00000004000aULL, },    /* 104  */
+        { 0x0000000b1a1c0000ULL, 0x004c00000001000dULL, },
+        { 0x000000040bcb0000ULL, 0x0064000000000011ULL, },
+        { 0x0000000105530000ULL, 0x0083000000000016ULL, },
+        { 0x00000001093e0000ULL, 0x000e000000000011ULL, },
+        { 0x00000001100b0000ULL, 0x000200000000000dULL, },
+        { 0x000000011bd90000ULL, 0x000000000000000aULL, },
+        { 0x0000000130570000ULL, 0x0000000000000008ULL, },
+};
+
+    reset_msa_registers();
+
+    gettimeofday(&start, NULL);
+
+    for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) {
+        for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) {
+            do_msa_MADDR_Q_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_MADDR_Q_H(b128_random[i], b128_random[j],
+                             b128_result[((PATTERN_INPUTS_SHORT_COUNT) *
+                                          (PATTERN_INPUTS_SHORT_COUNT)) +
+                                         RANDOM_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_MADDR_Q_H__DDT(b128_random[i], b128_random[j],
+                                  b128_result[
+                                      ((PATTERN_INPUTS_SHORT_COUNT) *
+                                       (PATTERN_INPUTS_SHORT_COUNT)) +
+                                      ((RANDOM_INPUTS_SHORT_COUNT) *
+                                       (RANDOM_INPUTS_SHORT_COUNT)) +
+                                      RANDOM_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_MADDR_Q_H__DSD(b128_random[i], b128_random[j],
+                                  b128_result[
+                                      ((PATTERN_INPUTS_SHORT_COUNT) *
+                                       (PATTERN_INPUTS_SHORT_COUNT)) +
+                                      (2 * (RANDOM_INPUTS_SHORT_COUNT) *
+                                       (RANDOM_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_128(isa_ase_name, group_name, 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/fixed-multiply/test_msa_maddr_q_w.c b/tests/tcg/mips/user/ase/msa/fixed-multiply/test_msa_maddr_q_w.c
new file mode 100644
index 0000000000..19eccbf5ba
--- /dev/null
+++ b/tests/tcg/mips/user/ase/msa/fixed-multiply/test_msa_maddr_q_w.c
@@ -0,0 +1,216 @@
+/*
+ *  Test program for MSA instruction MADDR_Q.W
+ *
+ *  Copyright (C) 2019  Wave Computing, Inc.
+ *  Copyright (C) 2019  Aleksandar Markovic <amarkovic@wavecomp.com>
+ *  Copyright (C) 2019  RT-RK Computer Based Systems LLC
+ *  Copyright (C) 2019  Mateja Marjanovic <mateja.marjanovic@rt-rk.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_128.h"
+#include "../../../../include/test_utils_128.h"
+
+#define TEST_COUNT_TOTAL (                                                \
+            (PATTERN_INPUTS_SHORT_COUNT) * (PATTERN_INPUTS_SHORT_COUNT) + \
+            3 * (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT))
+
+
+int32_t main(void)
+{
+    char *isa_ase_name = "MSA";
+    char *group_name = "Fixed Multiply";
+    char *instruction_name =  "MADDR_Q.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] = {
+        { 0x0000000000000000ULL, 0x0000000000000000ULL, },    /*   0  */
+        { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+        { 0x0000000100000001ULL, 0x0000000100000001ULL, },
+        { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+        { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+        { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+        { 0x0000000000000001ULL, 0x0000000000000000ULL, },
+        { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+        { 0x0000000000000000ULL, 0x0000000000000000ULL, },    /*   8  */
+        { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+        { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+        { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+        { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+        { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+        { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+        { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+        { 0x0000000100000001ULL, 0x0000000100000001ULL, },    /*  16  */
+        { 0x0000000100000001ULL, 0x0000000100000001ULL, },
+        { 0x38e38e3b38e38e3bULL, 0x38e38e3b38e38e3bULL, },
+        { 0x0000000200000002ULL, 0x0000000200000002ULL, },
+        { 0x2222222522222225ULL, 0x2222222522222225ULL, },
+        { 0x0000000300000003ULL, 0x0000000300000003ULL, },
+        { 0x12f684c14bda12faULL, 0xda12f68812f684c1ULL, },
+        { 0x0000000400000003ULL, 0x0000000400000004ULL, },
+        { 0x0000000300000002ULL, 0x0000000300000003ULL, },    /*  24  */
+        { 0x0000000300000002ULL, 0x0000000300000003ULL, },
+        { 0xc71c71cac71c71c9ULL, 0xc71c71cac71c71caULL, },
+        { 0x0000000200000001ULL, 0x0000000200000002ULL, },
+        { 0xdddddddfdddddddeULL, 0xdddddddfdddddddfULL, },
+        { 0x0000000100000000ULL, 0x0000000100000001ULL, },
+        { 0xed097b43b425ed0aULL, 0x25ed097ced097b43ULL, },
+        { 0x0000000000000000ULL, 0x0000000100000000ULL, },
+        { 0x0000000000000000ULL, 0x0000000100000000ULL, },    /*  32  */
+        { 0x0000000000000000ULL, 0x0000000100000000ULL, },
+        { 0x2222222322222223ULL, 0x2222222422222223ULL, },
+        { 0x0000000000000000ULL, 0x0000000100000000ULL, },
+        { 0x147ae148147ae148ULL, 0x147ae149147ae148ULL, },
+        { 0x0000000000000000ULL, 0x0000000100000000ULL, },
+        { 0x0b60b60c2d82d82eULL, 0xe93e93ea0b60b60cULL, },
+        { 0x0000000100000000ULL, 0x0000000100000001ULL, },
+        { 0x0000000100000000ULL, 0x0000000100000001ULL, },    /*  40  */
+        { 0x0000000100000000ULL, 0x0000000100000001ULL, },
+        { 0xdddddddfdddddddeULL, 0xdddddddfdddddddfULL, },
+        { 0x0000000100000000ULL, 0x0000000100000001ULL, },
+        { 0xeb851eb9eb851eb8ULL, 0xeb851eb9eb851eb9ULL, },
+        { 0x0000000100000000ULL, 0x0000000100000001ULL, },
+        { 0xf49f49f5d27d27d3ULL, 0x16c16c17f49f49f5ULL, },
+        { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+        { 0x0000000000000001ULL, 0x0000000000000000ULL, },    /*  48  */
+        { 0x0000000000000001ULL, 0x0000000000000000ULL, },
+        { 0x12f684be4bda12f8ULL, 0xda12f68512f684beULL, },
+        { 0x0000000000000002ULL, 0x0000000000000000ULL, },
+        { 0x0b60b60c2d82d830ULL, 0xe93e93e90b60b60cULL, },
+        { 0x0000000000000003ULL, 0xffffffff00000000ULL, },
+        { 0x06522c3f6522c3f7ULL, 0x1948b0fb06522c3fULL, },
+        { 0x0000000000000004ULL, 0xffffffff00000000ULL, },
+        { 0x0000000000000003ULL, 0xffffffff00000000ULL, },    /*  56  */
+        { 0x0000000000000003ULL, 0xffffffff00000000ULL, },
+        { 0xed097b43b425ed0cULL, 0x25ed097bed097b43ULL, },
+        { 0x0000000000000002ULL, 0x0000000000000000ULL, },
+        { 0xf49f49f5d27d27d4ULL, 0x16c16c17f49f49f5ULL, },
+        { 0x0000000000000001ULL, 0x0000000000000000ULL, },
+        { 0xf9add3c19add3c0eULL, 0xe6b74f04f9add3c1ULL, },
+        { 0x0000000000000000ULL, 0x0000000100000000ULL, },
+        { 0x6fb7e8890cbdc0d3ULL, 0x2c6b144700049a05ULL, },    /*  64  */
+        { 0x73b239d7253787d5ULL, 0x379780f0ffc424ccULL, },
+        { 0x7fffffff0f127795ULL, 0x4f10998300c57f01ULL, },
+        { 0x1713a7162cca6b3bULL, 0x0be04ded01cca270ULL, },
+        { 0x1b0df8644544323dULL, 0x170cba96018c2d37ULL, },
+        { 0x1b323a657448a84fULL, 0x19dc46aa051313c6ULL, },
+        { 0x1dfa85ed49be7970ULL, 0x1fc3e135f6fe3018ULL, },
+        { 0x1a3e24ca7fffffffULL, 0x0edd19d1e8983ff6ULL, },
+        { 0x6863455169daefbfULL, 0x26563264e9999a2bULL, },    /*  72  */
+        { 0x6b2b90d93f50c0e0ULL, 0x2c3dccefdb84b67dULL, },
+        { 0x7fffffff65cdd2a4ULL, 0x38a5555313bd77c9ULL, },
+        { 0x369baa393226e271ULL, 0x1523c34a4d39d0a3ULL, },
+        { 0xcdaf51504fded617ULL, 0xd1f377b44e40f412ULL, },
+        { 0xc9f2f02d7fffffffULL, 0xc10cb0503fdb03f0ULL, },
+        { 0x808e9a674c590fccULL, 0x9d8b1e4779575ccaULL, },
+        { 0xe319324b7fffffffULL, 0x032ce4297fffffffULL, },
+        { 0xfe196fe67fffffffULL, 0x050bc0417e7bb00bULL, },    /*  80  */
+        { 0xfe299f487fffffffULL, 0x05cb2b577fffffffULL, },
+        { 0xff5d018339cf8b80ULL, 0x0798e2662b2b2514ULL, },
+        { 0xfecdfe20645a7d9bULL, 0x00d3dcf80dea608eULL, },
+        { 0xffebe0517fffffffULL, 0x0150ab000dc02968ULL, },
+        { 0xffec8baf7fffffffULL, 0x01828ea210087db2ULL, },
+        { 0xfff9423c39cf8b80ULL, 0x01fae4c1056841b9ULL, },
+        { 0xfff35806645a7d9bULL, 0x003737bc01be3862ULL, },
+        { 0xffff2aee7fffffffULL, 0x0057bed801b8eeb0ULL, },    /*  88  */
+        { 0xffff32047fffffffULL, 0x0064bf8102021ffcULL, },
+        { 0xffffb89f39cf8b80ULL, 0x00841c7a00ad640aULL, },
+        { 0xffff79fe645a7d9bULL, 0x000e642f0037e4a6ULL, },
+        { 0xfffff7307fffffffULL, 0x0016de7800373b16ULL, },
+        { 0xfffff77b7fffffffULL, 0x001a42040040661aULL, },
+        { 0xfffffd0c39cf8b80ULL, 0x00226e990015b802ULL, },
+        { 0xfffffa75645a7d9bULL, 0x0003c0350007004aULL, },
+        { 0xffffffa37fffffffULL, 0x0005f5d90006eb0dULL, },    /*  96  */
+        { 0xfffffffa7fffffffULL, 0x000978b30006d610ULL, },
+        { 0x000000007fffffffULL, 0x000f0d0c0006c153ULL, },
+        { 0x000000007fffffffULL, 0x0017eacf0006acd5ULL, },
+        { 0x000000007fffffffULL, 0x001b761e0007c87dULL, },
+        { 0x000000007fffffffULL, 0x001f87e00009133bULL, },
+        { 0x000000007fffffffULL, 0x00243402000a94e0ULL, },
+        { 0x000000007fffffffULL, 0x00299164000c5689ULL, },
+        { 0x0000000039cf8b80ULL, 0x003682160004293bULL, },    /* 104  */
+        { 0x000000001a1c28c4ULL, 0x00477a0900016741ULL, },
+        { 0x000000000bcae026ULL, 0x005dba4500007929ULL, },
+        { 0x00000000055376c2ULL, 0x007ae7c2000028ddULL, },
+        { 0x00000000093ed557ULL, 0x000d637500000d2cULL, },
+        { 0x00000000100c9469ULL, 0x0001755d0000043fULL, },
+        { 0x000000001bdc1297ULL, 0x000028ac0000015eULL, },
+        { 0x00000000305c8bbfULL, 0x0000046e00000071ULL, },
+};
+
+    reset_msa_registers();
+
+    gettimeofday(&start, NULL);
+
+    for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) {
+        for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) {
+            do_msa_MADDR_Q_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_MADDR_Q_W(b128_random[i], b128_random[j],
+                             b128_result[((PATTERN_INPUTS_SHORT_COUNT) *
+                                          (PATTERN_INPUTS_SHORT_COUNT)) +
+                                         RANDOM_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_MADDR_Q_W__DDT(b128_random[i], b128_random[j],
+                                  b128_result[
+                                      ((PATTERN_INPUTS_SHORT_COUNT) *
+                                       (PATTERN_INPUTS_SHORT_COUNT)) +
+                                      ((RANDOM_INPUTS_SHORT_COUNT) *
+                                       (RANDOM_INPUTS_SHORT_COUNT)) +
+                                      RANDOM_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_MADDR_Q_W__DSD(b128_random[i], b128_random[j],
+                                  b128_result[
+                                      ((PATTERN_INPUTS_SHORT_COUNT) *
+                                       (PATTERN_INPUTS_SHORT_COUNT)) +
+                                      (2 * (RANDOM_INPUTS_SHORT_COUNT) *
+                                       (RANDOM_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_128(isa_ase_name, group_name, 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/fixed-multiply/test_msa_msub_q_h.c b/tests/tcg/mips/user/ase/msa/fixed-multiply/test_msa_msub_q_h.c
new file mode 100644
index 0000000000..b584736ed1
--- /dev/null
+++ b/tests/tcg/mips/user/ase/msa/fixed-multiply/test_msa_msub_q_h.c
@@ -0,0 +1,216 @@
+/*
+ *  Test program for MSA instruction MSUB_Q.H
+ *
+ *  Copyright (C) 2019  Wave Computing, Inc.
+ *  Copyright (C) 2019  Aleksandar Markovic <amarkovic@wavecomp.com>
+ *  Copyright (C) 2019  RT-RK Computer Based Systems LLC
+ *  Copyright (C) 2019  Mateja Marjanovic <mateja.marjanovic@rt-rk.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_128.h"
+#include "../../../../include/test_utils_128.h"
+
+#define TEST_COUNT_TOTAL (                                                \
+            (PATTERN_INPUTS_SHORT_COUNT) * (PATTERN_INPUTS_SHORT_COUNT) + \
+            3 * (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT))
+
+
+int32_t main(void)
+{
+    char *isa_ase_name = "MSA";
+    char *group_name = "Fixed Multiply";
+    char *instruction_name =  "MSUB_Q.H";
+    int32_t ret;
+    uint32_t i, j;
+    struct timeval start, end;
+    double elapsed_time;
+
+    uint64_t b128_result[TEST_COUNT_TOTAL][2];
+    uint64_t b128_expect[TEST_COUNT_TOTAL][2] = {
+        { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },    /*   0  */
+        { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+        { 0xfffefffefffefffeULL, 0xfffefffefffefffeULL, },
+        { 0xfffefffefffefffeULL, 0xfffefffefffefffeULL, },
+        { 0xfffdfffdfffdfffdULL, 0xfffdfffdfffdfffdULL, },
+        { 0xfffdfffdfffdfffdULL, 0xfffdfffdfffdfffdULL, },
+        { 0xfffcfffdfffcfffcULL, 0xfffdfffcfffcfffdULL, },
+        { 0xfffcfffcfffcfffcULL, 0xfffcfffcfffcfffcULL, },
+        { 0xfffcfffcfffcfffcULL, 0xfffcfffcfffcfffcULL, },    /*   8  */
+        { 0xfffcfffcfffcfffcULL, 0xfffcfffcfffcfffcULL, },
+        { 0xfffcfffcfffcfffcULL, 0xfffcfffcfffcfffcULL, },
+        { 0xfffcfffcfffcfffcULL, 0xfffcfffcfffcfffcULL, },
+        { 0xfffcfffcfffcfffcULL, 0xfffcfffcfffcfffcULL, },
+        { 0xfffcfffcfffcfffcULL, 0xfffcfffcfffcfffcULL, },
+        { 0xfffcfffcfffcfffcULL, 0xfffcfffcfffcfffcULL, },
+        { 0xfffcfffcfffcfffcULL, 0xfffcfffcfffcfffcULL, },
+        { 0xfffbfffbfffbfffbULL, 0xfffbfffbfffbfffbULL, },    /*  16  */
+        { 0xfffbfffbfffbfffbULL, 0xfffbfffbfffbfffbULL, },
+        { 0xc716c716c716c716ULL, 0xc716c716c716c716ULL, },
+        { 0xfff9fff9fff9fff9ULL, 0xfff9fff9fff9fff9ULL, },
+        { 0xddd6ddd6ddd6ddd6ULL, 0xddd6ddd6ddd6ddd6ULL, },
+        { 0xfff8fff8fff8fff8ULL, 0xfff8fff8fff8fff8ULL, },
+        { 0xed0125e4b41ced01ULL, 0x25e4b41ced0125e4ULL, },
+        { 0xfff7fff6fff6fff7ULL, 0xfff6fff6fff7fff6ULL, },
+        { 0xfff7fff6fff6fff7ULL, 0xfff6fff6fff7fff6ULL, },    /*  24  */
+        { 0xfff7fff6fff6fff7ULL, 0xfff6fff6fff7fff6ULL, },
+        { 0x38da38d938d938daULL, 0x38d938d938da38d9ULL, },
+        { 0xfff6fff5fff5fff6ULL, 0xfff5fff5fff6fff5ULL, },
+        { 0x2218221722172218ULL, 0x2217221722182217ULL, },
+        { 0xfff6fff5fff5fff6ULL, 0xfff5fff5fff6fff5ULL, },
+        { 0x12ecda084bcf12ecULL, 0xda084bcf12ecda08ULL, },
+        { 0xfff6fff5fff5fff6ULL, 0xfff5fff5fff6fff5ULL, },
+        { 0xfff5fff4fff4fff5ULL, 0xfff4fff4fff5fff4ULL, },    /*  32  */
+        { 0xfff5fff4fff4fff5ULL, 0xfff4fff4fff5fff4ULL, },
+        { 0xddd2ddd1ddd1ddd2ULL, 0xddd1ddd1ddd2ddd1ULL, },
+        { 0xfff4fff3fff3fff4ULL, 0xfff3fff3fff4fff3ULL, },
+        { 0xeb78eb77eb77eb78ULL, 0xeb77eb77eb78eb77ULL, },
+        { 0xfff3fff2fff2fff3ULL, 0xfff2fff2fff3fff2ULL, },
+        { 0xf49216b3d26ef492ULL, 0x16b3d26ef49216b3ULL, },
+        { 0xfff2fff1fff1fff2ULL, 0xfff1fff1fff2fff1ULL, },
+        { 0xfff2fff1fff1fff2ULL, 0xfff1fff1fff2fff1ULL, },    /*  40  */
+        { 0xfff2fff1fff1fff2ULL, 0xfff1fff1fff2fff1ULL, },
+        { 0x2214221322132214ULL, 0x2213221322142213ULL, },
+        { 0xfff2fff1fff1fff2ULL, 0xfff1fff1fff2fff1ULL, },
+        { 0x146d146c146c146dULL, 0x146c146c146d146cULL, },
+        { 0xfff2fff1fff1fff2ULL, 0xfff1fff1fff2fff1ULL, },
+        { 0x0b52e92f2d740b52ULL, 0xe92f2d740b52e92fULL, },
+        { 0xfff1fff0fff1fff1ULL, 0xfff0fff1fff1fff0ULL, },
+        { 0xfff0fff0fff0fff0ULL, 0xfff0fff0fff0fff0ULL, },    /*  48  */
+        { 0xfff0fff0fff0fff0ULL, 0xfff0fff0fff0fff0ULL, },
+        { 0xecf925dcb414ecf9ULL, 0x25dcb414ecf925dcULL, },
+        { 0xffefffefffeeffefULL, 0xffefffeeffefffefULL, },
+        { 0xf48e16b0d26af48eULL, 0x16b0d26af48e16b0ULL, },
+        { 0xffeeffeeffedffeeULL, 0xffeeffedffeeffeeULL, },
+        { 0xf99be6a59ac8f99bULL, 0xe6a59ac8f99be6a5ULL, },
+        { 0xffedffedffebffedULL, 0xffedffebffedffedULL, },
+        { 0xffedffecffebffedULL, 0xffecffebffedffecULL, },    /*  56  */
+        { 0xffedffecffebffedULL, 0xffecffebffedffecULL, },
+        { 0x12e3d9fe4bc512e3ULL, 0xd9fe4bc512e3d9feULL, },
+        { 0xffedffebffebffedULL, 0xffebffebffedffebULL, },
+        { 0x0b4de9292d6e0b4dULL, 0xe9292d6e0b4de929ULL, },
+        { 0xffecffeaffebffecULL, 0xffeaffebffecffeaULL, },
+        { 0x063e1932650e063eULL, 0x1932650e063e1932ULL, },
+        { 0xffecffe8ffebffecULL, 0xffe8ffebffecffe8ULL, },
+        { 0x9032faf1f32dc724ULL, 0xd37cfee8ffe7cdf6ULL, },    /*  64  */
+        { 0x8c37fb04dab3ed15ULL, 0xc8500506002701cbULL, },
+        { 0x8000eb00f0d83aacULL, 0xb0d70a15ff2518f4ULL, },
+        { 0xe8edef64d3204e73ULL, 0xf40714a9fe1d069aULL, },
+        { 0xe4f2ef77baa67464ULL, 0xe8db1ac7fe5d3a6fULL, },
+        { 0xe4cdef768ba25b09ULL, 0xe60bf5b1fad604a2ULL, },
+        { 0xe204efb4b62c272fULL, 0xe023d70208eaec98ULL, },
+        { 0xe5c0efa2800019f7ULL, 0xf10996de174fffa3ULL, },
+        { 0x9799df9e9625678eULL, 0xd9909bed164d16ccULL, },    /*  72  */
+        { 0x94d0dfdcc0af33b4ULL, 0xd3a880002461fec2ULL, },
+        { 0x8000ac2c9a31c9abULL, 0xc7408000ec28f404ULL, },
+        { 0xc964ba57cdd7aea3ULL, 0xeac18000b2aafc86ULL, },
+        { 0x3251bebbb01fc26aULL, 0x2df18a94b1a2ea2cULL, },
+        { 0x360dbea98000b532ULL, 0x3ed78000c007fd37ULL, },
+        { 0x7f71ccd4b3a69a2aULL, 0x62588000868905b9ULL, },
+        { 0x1ce6c8f180009346ULL, 0xfcb580008000fefbULL, },
+        { 0x37e5be19a862dbafULL, 0xfea58b5e8000fe57ULL, },    /*  80  */
+        { 0x39c0be4bdd7bcb85ULL, 0xfed88000953fff6aULL, },
+        { 0x5f7d948aca8d9bc1ULL, 0xff3480008000ff95ULL, },
+        { 0x0bb4a742f1e1847fULL, 0xfe7e80008000ff7cULL, },
+        { 0x16a395c8f655d6c0ULL, 0xff618b5e8000ff29ULL, },
+        { 0x1763961afc30c464ULL, 0xff788000953fffb4ULL, },
+        { 0x26ab8000fa188e23ULL, 0xffa280008000ffcaULL, },
+        { 0x04bd964dfe708000ULL, 0xff4e80008000ffbdULL, },
+        { 0x092a817dfeeed540ULL, 0xffb68b5e8000ff93ULL, },    /*  88  */
+        { 0x097881deff94c239ULL, 0xffc08000953fffd9ULL, },
+        { 0x0fa88000ff5889feULL, 0xffd380008000ffe4ULL, },
+        { 0x01eb964dffd38000ULL, 0xffaa80008000ffddULL, },
+        { 0x03b5817dffe1d540ULL, 0xffdc8b5e8000ffc7ULL, },
+        { 0x03d481defff3c239ULL, 0xffe18000953fffebULL, },
+        { 0x06548000ffeb89feULL, 0xffea80008000fff1ULL, },
+        { 0x00c6964dfffa8000ULL, 0xffd680008000ffedULL, },
+        { 0x017e817dfffbd540ULL, 0xffee8b5e8000ffe1ULL, },    /*  96  */
+        { 0x02e28000fffcf1b8ULL, 0xfff895b98000ffcdULL, },
+        { 0x05938000fffdfb3aULL, 0xfffc9f298000ffadULL, },
+        { 0x0ac88000fffdfe67ULL, 0xfffea7c28000ff79ULL, },
+        { 0x0b238063fffefdb0ULL, 0xfffe8000953fffd0ULL, },
+        { 0x0b8180c5fffffca8ULL, 0xfffe8000a6f7ffefULL, },
+        { 0x0be28127fffffb2bULL, 0xfffe8000b5befffaULL, },
+        { 0x0c478189fffff904ULL, 0xfffe8000c211fffdULL, },
+        { 0x144c8000fffef2a8ULL, 0xfffe80009905fffdULL, },    /* 104  */
+        { 0x218f8000fffce682ULL, 0xfffe80008000fffdULL, },
+        { 0x377d8000fff9cf4eULL, 0xfffe80008000fffdULL, },
+        { 0x5bc08000fff5a2fbULL, 0xfffe80008000fffdULL, },
+        { 0x0b3f964dfffd8d66ULL, 0xfffc80008000fffcULL, },
+        { 0x0160a8b7ffff8000ULL, 0xfff880008000fffbULL, },
+        { 0x002bb7ecffff8000ULL, 0xfff080008000fff9ULL, },
+        { 0x0005c47affff8000ULL, 0xffe180008000fff7ULL, },
+};
+
+    reset_msa_registers();
+
+    gettimeofday(&start, NULL);
+
+    for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) {
+        for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) {
+            do_msa_MSUB_Q_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_MSUB_Q_H(b128_random[i], b128_random[j],
+                            b128_result[((PATTERN_INPUTS_SHORT_COUNT) *
+                                         (PATTERN_INPUTS_SHORT_COUNT)) +
+                                        RANDOM_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_MSUB_Q_H__DDT(b128_random[i], b128_random[j],
+                                 b128_result[
+                                     ((PATTERN_INPUTS_SHORT_COUNT) *
+                                      (PATTERN_INPUTS_SHORT_COUNT)) +
+                                     ((RANDOM_INPUTS_SHORT_COUNT) *
+                                      (RANDOM_INPUTS_SHORT_COUNT)) +
+                                     RANDOM_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_MSUB_Q_H__DSD(b128_random[i], b128_random[j],
+                                 b128_result[
+                                     ((PATTERN_INPUTS_SHORT_COUNT) *
+                                      (PATTERN_INPUTS_SHORT_COUNT)) +
+                                     (2 * (RANDOM_INPUTS_SHORT_COUNT) *
+                                      (RANDOM_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_128(isa_ase_name, group_name, 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/fixed-multiply/test_msa_msub_q_w.c b/tests/tcg/mips/user/ase/msa/fixed-multiply/test_msa_msub_q_w.c
new file mode 100644
index 0000000000..56191924a1
--- /dev/null
+++ b/tests/tcg/mips/user/ase/msa/fixed-multiply/test_msa_msub_q_w.c
@@ -0,0 +1,216 @@
+/*
+ *  Test program for MSA instruction MSUB_Q.W
+ *
+ *  Copyright (C) 2019  Wave Computing, Inc.
+ *  Copyright (C) 2019  Aleksandar Markovic <amarkovic@wavecomp.com>
+ *  Copyright (C) 2019  RT-RK Computer Based Systems LLC
+ *  Copyright (C) 2019  Mateja Marjanovic <mateja.marjanovic@rt-rk.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_128.h"
+#include "../../../../include/test_utils_128.h"
+
+#define TEST_COUNT_TOTAL (                                                \
+            (PATTERN_INPUTS_SHORT_COUNT) * (PATTERN_INPUTS_SHORT_COUNT) + \
+            3 * (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT))
+
+
+int32_t main(void)
+{
+    char *isa_ase_name = "MSA";
+    char *group_name = "Fixed Multiply";
+    char *instruction_name =  "MSUB_Q.W";
+    int32_t ret;
+    uint32_t i, j;
+    struct timeval start, end;
+    double elapsed_time;
+
+    uint64_t b128_result[TEST_COUNT_TOTAL][2];
+    uint64_t b128_expect[TEST_COUNT_TOTAL][2] = {
+        { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },    /*   0  */
+        { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+        { 0xfffffffefffffffeULL, 0xfffffffefffffffeULL, },
+        { 0xfffffffefffffffeULL, 0xfffffffefffffffeULL, },
+        { 0xfffffffdfffffffdULL, 0xfffffffdfffffffdULL, },
+        { 0xfffffffdfffffffdULL, 0xfffffffdfffffffdULL, },
+        { 0xfffffffcfffffffcULL, 0xfffffffdfffffffcULL, },
+        { 0xfffffffcfffffffcULL, 0xfffffffcfffffffcULL, },
+        { 0xfffffffcfffffffcULL, 0xfffffffcfffffffcULL, },    /*   8  */
+        { 0xfffffffcfffffffcULL, 0xfffffffcfffffffcULL, },
+        { 0xfffffffcfffffffcULL, 0xfffffffcfffffffcULL, },
+        { 0xfffffffcfffffffcULL, 0xfffffffcfffffffcULL, },
+        { 0xfffffffcfffffffcULL, 0xfffffffcfffffffcULL, },
+        { 0xfffffffcfffffffcULL, 0xfffffffcfffffffcULL, },
+        { 0xfffffffcfffffffcULL, 0xfffffffcfffffffcULL, },
+        { 0xfffffffcfffffffcULL, 0xfffffffcfffffffcULL, },
+        { 0xfffffffbfffffffbULL, 0xfffffffbfffffffbULL, },    /*  16  */
+        { 0xfffffffbfffffffbULL, 0xfffffffbfffffffbULL, },
+        { 0xc71c71c1c71c71c1ULL, 0xc71c71c1c71c71c1ULL, },
+        { 0xfffffffafffffffaULL, 0xfffffffafffffffaULL, },
+        { 0xddddddd7ddddddd7ULL, 0xddddddd7ddddddd7ULL, },
+        { 0xfffffff9fffffff9ULL, 0xfffffff9fffffff9ULL, },
+        { 0xed097b3ab425ed01ULL, 0x25ed0973ed097b3aULL, },
+        { 0xfffffff7fffffff7ULL, 0xfffffff7fffffff7ULL, },
+        { 0xfffffff7fffffff7ULL, 0xfffffff7fffffff7ULL, },    /*  24  */
+        { 0xfffffff7fffffff7ULL, 0xfffffff7fffffff7ULL, },
+        { 0x38e38e3038e38e30ULL, 0x38e38e3038e38e30ULL, },
+        { 0xfffffff7fffffff7ULL, 0xfffffff7fffffff7ULL, },
+        { 0x2222221922222219ULL, 0x2222221922222219ULL, },
+        { 0xfffffff7fffffff7ULL, 0xfffffff7fffffff7ULL, },
+        { 0x12f684b44bda12edULL, 0xda12f67c12f684b4ULL, },
+        { 0xfffffff6fffffff7ULL, 0xfffffff7fffffff6ULL, },
+        { 0xfffffff5fffffff6ULL, 0xfffffff6fffffff5ULL, },    /*  32  */
+        { 0xfffffff5fffffff6ULL, 0xfffffff6fffffff5ULL, },
+        { 0xddddddd2ddddddd3ULL, 0xddddddd3ddddddd2ULL, },
+        { 0xfffffff4fffffff5ULL, 0xfffffff5fffffff4ULL, },
+        { 0xeb851eabeb851eacULL, 0xeb851eaceb851eabULL, },
+        { 0xfffffff2fffffff3ULL, 0xfffffff3fffffff2ULL, },
+        { 0xf49f49e6d27d27c4ULL, 0x16c16c09f49f49e6ULL, },
+        { 0xfffffff1fffffff1ULL, 0xfffffff1fffffff1ULL, },
+        { 0xfffffff1fffffff1ULL, 0xfffffff1fffffff1ULL, },    /*  40  */
+        { 0xfffffff1fffffff1ULL, 0xfffffff1fffffff1ULL, },
+        { 0x2222221322222213ULL, 0x2222221322222213ULL, },
+        { 0xfffffff1fffffff1ULL, 0xfffffff1fffffff1ULL, },
+        { 0x147ae138147ae138ULL, 0x147ae138147ae138ULL, },
+        { 0xfffffff0fffffff0ULL, 0xfffffff0fffffff0ULL, },
+        { 0x0b60b5fb2d82d81dULL, 0xe93e93d90b60b5fbULL, },
+        { 0xffffffefffffffefULL, 0xffffffefffffffefULL, },
+        { 0xffffffeeffffffeeULL, 0xffffffefffffffeeULL, },    /*  48  */
+        { 0xffffffeeffffffeeULL, 0xffffffefffffffeeULL, },
+        { 0xed097b2fb425ecf6ULL, 0x25ed0969ed097b2fULL, },
+        { 0xffffffecffffffecULL, 0xffffffeeffffffecULL, },
+        { 0xf49f49e0d27d27bdULL, 0x16c16c04f49f49e0ULL, },
+        { 0xffffffebffffffeaULL, 0xffffffedffffffebULL, },
+        { 0xf9add3ab9add3bf6ULL, 0xe6b74ef0f9add3abULL, },
+        { 0xffffffeaffffffe8ULL, 0xffffffecffffffeaULL, },
+        { 0xffffffeaffffffe8ULL, 0xffffffebffffffeaULL, },    /*  56  */
+        { 0xffffffeaffffffe8ULL, 0xffffffebffffffeaULL, },
+        { 0x12f684a74bda12deULL, 0xda12f66f12f684a7ULL, },
+        { 0xffffffe9ffffffe8ULL, 0xffffffeaffffffe9ULL, },
+        { 0x0b60b5f42d82d815ULL, 0xe93e93d20b60b5f4ULL, },
+        { 0xffffffe8ffffffe7ULL, 0xffffffe8ffffffe8ULL, },
+        { 0x06522c276522c3d9ULL, 0x1948b0e406522c27ULL, },
+        { 0xffffffe7ffffffe7ULL, 0xffffffe7ffffffe7ULL, },
+        { 0x9048175df3423f14ULL, 0xd394eba0fffb65e2ULL, },    /*  64  */
+        { 0x8c4dc60edac87812ULL, 0xc8687ef6003bdb1bULL, },
+        { 0x80000000f0ed8852ULL, 0xb0ef6662ff3a80e6ULL, },
+        { 0xe8ec58e8d33594acULL, 0xf41fb1f8fe335d76ULL, },
+        { 0xe4f20799babbcdaaULL, 0xe8f3454efe73d2afULL, },
+        { 0xe4cdc5978bb75798ULL, 0xe623b939faecec20ULL, },
+        { 0xe2057a0fb6418676ULL, 0xe03c1eae0901cfcdULL, },
+        { 0xe5c1db3280000000ULL, 0xf122e6111767bfefULL, },
+        { 0x979cbaab96251040ULL, 0xd9a9cd7d166665baULL, },    /*  72  */
+        { 0x94d46f23c0af3f1eULL, 0xd3c232f2247b4967ULL, },
+        { 0x800000009a322d5aULL, 0xc75aaa8dec42881aULL, },
+        { 0xc96455c6cdd91d8cULL, 0xeadc3c95b2c62f40ULL, },
+        { 0x3250aeaeb02129e6ULL, 0x2e0c882bb1bf0bd0ULL, },
+        { 0x360d0fd180000000ULL, 0x3ef34f8ec024fbf2ULL, },
+        { 0x7f716597b3a6f032ULL, 0x6274e19686a8a318ULL, },
+        { 0x1ce6cdb280000000ULL, 0xfcd31bb480000000ULL, },
+        { 0x37e70b49a8625540ULL, 0xfeb1f7e080000000ULL, },    /*  80  */
+        { 0x39c31699dd7c5546ULL, 0xfee37780953f52fcULL, },
+        { 0x5f82316fca8f431eULL, 0xff3c0af780000000ULL, },
+        { 0x0bb5432ff1e2e177ULL, 0xfe8d6e9580000000ULL, },
+        { 0x16a56af3f656d2b3ULL, 0xff67ba1b80000000ULL, },
+        { 0x17664384fc31bf42ULL, 0xff7e4aa4953f52fcULL, },
+        { 0x26b0cbfdfa1b830bULL, 0xffa6ab9180000000ULL, },
+        { 0x04be31a4fe719ab1ULL, 0xff57124580000000ULL, },
+        { 0x092c8a1ffeef4c68ULL, 0xffba958e80000000ULL, },    /*  88  */
+        { 0x097aa960ff949347ULL, 0xffc4dede953f52fcULL, },
+        { 0x0fac7158ff59ab27ULL, 0xffd7471a80000000ULL, },
+        { 0x01ebdf01ffd41248ULL, 0xffb2fdd380000000ULL, },
+        { 0x03b76546ffe1ee50ULL, 0xffe05b1780000000ULL, },
+        { 0x03d70afdfff427aaULL, 0xffe50b86953f52fcULL, },
+        { 0x065971c1ffeda8dfULL, 0xffed6fa980000000ULL, },
+        { 0x00c741e8fffb2801ULL, 0xffdce50280000000ULL, },
+        { 0x01816947fffcaf39ULL, 0xfff1931580000000ULL, },    /*  96  */
+        { 0x02e97a17fffdbb03ULL, 0xfffa128380000000ULL, },
+        { 0x05a1edf3fffe7250ULL, 0xfffd906f80000000ULL, },
+        { 0x0ae508c5fffeefc8ULL, 0xfffeffc380000000ULL, },
+        { 0x0b41cf1bffff94c3ULL, 0xffff25bb953f52fcULL, },
+        { 0x0ba1ab79ffffd5c1ULL, 0xffff4613a6f7bf69ULL, },
+        { 0x0c04b828ffffef5bULL, 0xffff61a0b5bf25caULL, },
+        { 0x0c6b104efffff971ULL, 0xffff7918c21285a5ULL, },
+        { 0x148886c7fffff5d8ULL, 0xffffa3179907b21bULL, },    /* 104  */
+        { 0x21f39335fffff046ULL, 0xffffc00380000000ULL, },
+        { 0x38235e38ffffe7a6ULL, 0xffffd3ee80000000ULL, },
+        { 0x5cd2ce93ffffda4bULL, 0xffffe1a680000000ULL, },
+        { 0x0b60ff8afffff60aULL, 0xffffc69a80000000ULL, },
+        { 0x01651818fffffd5eULL, 0xffff937480000000ULL, },
+        { 0x002bc65fffffff4dULL, 0xffff32bb80000000ULL, },
+        { 0x00055dbfffffffd0ULL, 0xfffe7bd280000000ULL, },
+};
+
+    reset_msa_registers();
+
+    gettimeofday(&start, NULL);
+
+    for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) {
+        for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) {
+            do_msa_MSUB_Q_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_MSUB_Q_W(b128_random[i], b128_random[j],
+                            b128_result[((PATTERN_INPUTS_SHORT_COUNT) *
+                                         (PATTERN_INPUTS_SHORT_COUNT)) +
+                                        RANDOM_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_MSUB_Q_W__DDT(b128_random[i], b128_random[j],
+                                 b128_result[
+                                     ((PATTERN_INPUTS_SHORT_COUNT) *
+                                      (PATTERN_INPUTS_SHORT_COUNT)) +
+                                     ((RANDOM_INPUTS_SHORT_COUNT) *
+                                      (RANDOM_INPUTS_SHORT_COUNT)) +
+                                     RANDOM_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_MSUB_Q_W__DSD(b128_random[i], b128_random[j],
+                                 b128_result[
+                                     ((PATTERN_INPUTS_SHORT_COUNT) *
+                                      (PATTERN_INPUTS_SHORT_COUNT)) +
+                                     (2 * (RANDOM_INPUTS_SHORT_COUNT) *
+                                      (RANDOM_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_128(isa_ase_name, group_name, 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/fixed-multiply/test_msa_msubr_q_h.c b/tests/tcg/mips/user/ase/msa/fixed-multiply/test_msa_msubr_q_h.c
new file mode 100644
index 0000000000..0be6d51418
--- /dev/null
+++ b/tests/tcg/mips/user/ase/msa/fixed-multiply/test_msa_msubr_q_h.c
@@ -0,0 +1,216 @@
+/*
+ *  Test program for MSA instruction MSUBR_Q.H
+ *
+ *  Copyright (C) 2019  Wave Computing, Inc.
+ *  Copyright (C) 2019  Aleksandar Markovic <amarkovic@wavecomp.com>
+ *  Copyright (C) 2019  RT-RK Computer Based Systems LLC
+ *  Copyright (C) 2019  Mateja Marjanovic <mateja.marjanovic@rt-rk.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_128.h"
+#include "../../../../include/test_utils_128.h"
+
+#define TEST_COUNT_TOTAL (                                                \
+            (PATTERN_INPUTS_SHORT_COUNT) * (PATTERN_INPUTS_SHORT_COUNT) + \
+            3 * (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT))
+
+
+int32_t main(void)
+{
+    char *isa_ase_name = "MSA";
+    char *group_name = "Fixed Multiply";
+    char *instruction_name =  "MSUBR_Q.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] = {
+        { 0x0000000000000000ULL, 0x0000000000000000ULL, },    /*   0  */
+        { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+        { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+        { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+        { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+        { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+        { 0x00000000ffff0000ULL, 0x0000ffff00000000ULL, },
+        { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+        { 0x0000000000000000ULL, 0x0000000000000000ULL, },    /*   8  */
+        { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+        { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+        { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+        { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+        { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+        { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+        { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+        { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },    /*  16  */
+        { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+        { 0xc71bc71bc71bc71bULL, 0xc71bc71bc71bc71bULL, },
+        { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+        { 0xdddcdddcdddcdddcULL, 0xdddcdddcdddcdddcULL, },
+        { 0xfffefffefffefffeULL, 0xfffefffefffefffeULL, },
+        { 0xed0725ebb423ed07ULL, 0x25ebb423ed0725ebULL, },
+        { 0xfffdfffdfffefffdULL, 0xfffdfffefffdfffdULL, },
+        { 0xfffefffefffffffeULL, 0xfffefffffffefffeULL, },    /*  24  */
+        { 0xfffefffefffffffeULL, 0xfffefffffffefffeULL, },
+        { 0x38e238e238e338e2ULL, 0x38e238e338e238e2ULL, },
+        { 0xffffffff0000ffffULL, 0xffff0000ffffffffULL, },
+        { 0x2222222222232222ULL, 0x2222222322222222ULL, },
+        { 0x0000000000010000ULL, 0x0000000100000000ULL, },
+        { 0x12f7da134bdb12f7ULL, 0xda134bdb12f7da13ULL, },
+        { 0x0001000000010001ULL, 0x0000000100010000ULL, },
+        { 0x0001000000010001ULL, 0x0000000100010000ULL, },    /*  32  */
+        { 0x0001000000010001ULL, 0x0000000100010000ULL, },
+        { 0xdddedddddddedddeULL, 0xdddddddedddeddddULL, },
+        { 0x0001000000010001ULL, 0x0000000100010000ULL, },
+        { 0xeb85eb84eb85eb85ULL, 0xeb84eb85eb85eb84ULL, },
+        { 0x0000ffff00000000ULL, 0xffff00000000ffffULL, },
+        { 0xf49f16c1d27cf49fULL, 0x16c1d27cf49f16c1ULL, },
+        { 0x0000ffff00000000ULL, 0xffff00000000ffffULL, },
+        { 0x0000ffff00000000ULL, 0xffff00000000ffffULL, },    /*  40  */
+        { 0x0000ffff00000000ULL, 0xffff00000000ffffULL, },
+        { 0x2222222122222222ULL, 0x2221222222222221ULL, },
+        { 0x0000ffff00000000ULL, 0xffff00000000ffffULL, },
+        { 0x147b147a147b147bULL, 0x147a147b147b147aULL, },
+        { 0x0000ffff00000000ULL, 0xffff00000000ffffULL, },
+        { 0x0b61e93e2d830b61ULL, 0xe93e2d830b61e93eULL, },
+        { 0x0001000000000001ULL, 0x0000000000010000ULL, },
+        { 0x00010000ffff0001ULL, 0x0000ffff00010000ULL, },    /*  48  */
+        { 0x00010000ffff0001ULL, 0x0000ffff00010000ULL, },
+        { 0xed0a25edb424ed0aULL, 0x25edb424ed0a25edULL, },
+        { 0x00010000fffe0001ULL, 0x0000fffe00010000ULL, },
+        { 0xf4a016c2d27af4a0ULL, 0x16c2d27af4a016c2ULL, },
+        { 0x00010001fffd0001ULL, 0x0001fffd00010001ULL, },
+        { 0xf9afe6b99ad9f9afULL, 0xe6b99ad9f9afe6b9ULL, },
+        { 0x00010002fffc0001ULL, 0x0002fffc00010002ULL, },
+        { 0x00010002fffd0001ULL, 0x0002fffd00010002ULL, },    /*  56  */
+        { 0x00010002fffd0001ULL, 0x0002fffd00010002ULL, },
+        { 0x12f7da144bd812f7ULL, 0xda144bd812f7da14ULL, },
+        { 0x00010001fffe0001ULL, 0x0001fffe00010001ULL, },
+        { 0x0b62e93f2d820b62ULL, 0xe93f2d820b62e93fULL, },
+        { 0x00020001ffff0002ULL, 0x0001ffff00020001ULL, },
+        { 0x0654194a65220654ULL, 0x194a65220654194aULL, },
+        { 0x00020001ffff0002ULL, 0x0001ffff00020001ULL, },
+        { 0x9048fb0bf341c73bULL, 0xd396fefdfffdce10ULL, },    /*  64  */
+        { 0x8c4efb1edac8ed2cULL, 0xc86a051b003e01e6ULL, },
+        { 0x8000eb1af0ed3ac3ULL, 0xb0f10a2bff3c190fULL, },
+        { 0xe8edef7ed3364e8aULL, 0xf42214c0fe3406b6ULL, },
+        { 0xe4f3ef91babd747bULL, 0xe8f61adefe753a8cULL, },
+        { 0xe4cfef918bb95b20ULL, 0xe627f5c8faee04bfULL, },
+        { 0xe207efd0b6432746ULL, 0xe040d7190903ecb5ULL, },
+        { 0xe5c3efbf80001a0fULL, 0xf12696f61769ffc0ULL, },
+        { 0x979ddfbb962567a6ULL, 0xd9ad9c06166716e9ULL, },    /*  72  */
+        { 0x94d5dffac0af33ccULL, 0xd3c68000247cfedfULL, },
+        { 0x8000ac4b9a31c9c4ULL, 0xc75f8000ec43f421ULL, },
+        { 0xc965ba77cdd8aebdULL, 0xeae08000b2c6fca3ULL, },
+        { 0x3252bedbb021c284ULL, 0x2e118a95b1beea4aULL, },
+        { 0x360ebeca8000b54dULL, 0x3ef78000c024fd55ULL, },
+        { 0x7f73ccf6b3a79a46ULL, 0x6278800086a705d7ULL, },
+        { 0x1ce9c91380009362ULL, 0xfcd580008000ff19ULL, },
+        { 0x37ebbe42a862dbb9ULL, 0xfeb38b5e8000fe89ULL, },    /*  80  */
+        { 0x39c7be75dd7ccb94ULL, 0xfee48000953fff7cULL, },
+        { 0x5f8994cfca8f9bdeULL, 0xff3c80008000ffa2ULL, },
+        { 0x0bb6a77cf1e284a3ULL, 0xfe8d80008000ff8cULL, },
+        { 0x16a7960ef656d6ccULL, 0xff688b5e8000ff44ULL, },
+        { 0x17689660fc31c475ULL, 0xff7f8000953fffbeULL, },
+        { 0x26b48000fa1a8e43ULL, 0xffa780008000ffd1ULL, },
+        { 0x04bf964dfe718000ULL, 0xff5880008000ffc6ULL, },
+        { 0x092e817dfeefd540ULL, 0xffbb8b5e8000ffa2ULL, },    /*  88  */
+        { 0x097c81dfff94c239ULL, 0xffc58000953fffdfULL, },
+        { 0x0faf8000ff5989ffULL, 0xffd780008000ffe9ULL, },
+        { 0x01ec964dffd48000ULL, 0xffb280008000ffe4ULL, },
+        { 0x03b8817dffe2d540ULL, 0xffe08b5e8000ffd3ULL, },
+        { 0x03d881dffff4c239ULL, 0xffe58000953ffff0ULL, },
+        { 0x065b8000ffed89ffULL, 0xffed80008000fff5ULL, },
+        { 0x00c7964dfffb8000ULL, 0xffdc80008000fff2ULL, },
+        { 0x0181817dfffdd540ULL, 0xfff18b5e8000ffe9ULL, },    /*  96  */
+        { 0x02e98000fffef1b9ULL, 0xfffa95ba8000ffdbULL, },
+        { 0x05a18000fffffb3bULL, 0xfffe9f2a8000ffc4ULL, },
+        { 0x0ae38000fffffe68ULL, 0xffffa7c48000ff9fULL, },
+        { 0x0b4080630000fdb2ULL, 0xffff8000953fffdeULL, },
+        { 0x0ba080c60000fcabULL, 0xffff8000a6f7fff4ULL, },
+        { 0x0c0381280000fb2fULL, 0xffff8000b5befffcULL, },
+        { 0x0c69818a0000f90aULL, 0xffff8000c211ffffULL, },
+        { 0x148580000000f2b4ULL, 0xffff80009905ffffULL, },    /* 104  */
+        { 0x21ee80000000e69aULL, 0xffff80008000ffffULL, },
+        { 0x381a80000000cf7cULL, 0xffff80008000ffffULL, },
+        { 0x5cc480000000a354ULL, 0xffff80008000ffffULL, },
+        { 0x0b5f964d00008dd4ULL, 0xfffe80008000ffffULL, },
+        { 0x0165a8b700008000ULL, 0xfffc80008000ffffULL, },
+        { 0x002cb7ec00008000ULL, 0xfff880008000ffffULL, },
+        { 0x0005c47b00008000ULL, 0xfff180008000ffffULL, },
+};
+
+    reset_msa_registers();
+
+    gettimeofday(&start, NULL);
+
+    for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) {
+        for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) {
+            do_msa_MSUBR_Q_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_MSUBR_Q_H(b128_random[i], b128_random[j],
+                             b128_result[((PATTERN_INPUTS_SHORT_COUNT) *
+                                          (PATTERN_INPUTS_SHORT_COUNT)) +
+                                         RANDOM_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_MSUBR_Q_H__DDT(b128_random[i], b128_random[j],
+                                  b128_result[
+                                      ((PATTERN_INPUTS_SHORT_COUNT) *
+                                       (PATTERN_INPUTS_SHORT_COUNT)) +
+                                      ((RANDOM_INPUTS_SHORT_COUNT) *
+                                       (RANDOM_INPUTS_SHORT_COUNT)) +
+                                      RANDOM_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_MSUBR_Q_H__DSD(b128_random[i], b128_random[j],
+                                  b128_result[
+                                      ((PATTERN_INPUTS_SHORT_COUNT) *
+                                       (PATTERN_INPUTS_SHORT_COUNT)) +
+                                      (2 * (RANDOM_INPUTS_SHORT_COUNT) *
+                                       (RANDOM_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_128(isa_ase_name, group_name, 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/fixed-multiply/test_msa_msubr_q_w.c b/tests/tcg/mips/user/ase/msa/fixed-multiply/test_msa_msubr_q_w.c
new file mode 100644
index 0000000000..7d57cb500a
--- /dev/null
+++ b/tests/tcg/mips/user/ase/msa/fixed-multiply/test_msa_msubr_q_w.c
@@ -0,0 +1,216 @@
+/*
+ *  Test program for MSA instruction MSUBR_Q.W
+ *
+ *  Copyright (C) 2019  Wave Computing, Inc.
+ *  Copyright (C) 2019  Aleksandar Markovic <amarkovic@wavecomp.com>
+ *  Copyright (C) 2019  RT-RK Computer Based Systems LLC
+ *  Copyright (C) 2019  Mateja Marjanovic <mateja.marjanovic@rt-rk.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_128.h"
+#include "../../../../include/test_utils_128.h"
+
+#define TEST_COUNT_TOTAL (                                                \
+            (PATTERN_INPUTS_SHORT_COUNT) * (PATTERN_INPUTS_SHORT_COUNT) + \
+            3 * (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT))
+
+
+int32_t main(void)
+{
+    char *isa_ase_name = "MSA";
+    char *group_name = "Fixed Multiply";
+    char *instruction_name =  "MSUBR_Q.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] = {
+        { 0x0000000000000000ULL, 0x0000000000000000ULL, },    /*   0  */
+        { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+        { 0x0000000100000001ULL, 0x0000000100000001ULL, },
+        { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+        { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+        { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+        { 0x0000000000000001ULL, 0x0000000000000000ULL, },
+        { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+        { 0x0000000000000000ULL, 0x0000000000000000ULL, },    /*   8  */
+        { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+        { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+        { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+        { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+        { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+        { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+        { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+        { 0x0000000100000001ULL, 0x0000000100000001ULL, },    /*  16  */
+        { 0x0000000100000001ULL, 0x0000000100000001ULL, },
+        { 0x38e38e3b38e38e3bULL, 0x38e38e3b38e38e3bULL, },
+        { 0x0000000200000002ULL, 0x0000000200000002ULL, },
+        { 0x2222222522222225ULL, 0x2222222522222225ULL, },
+        { 0x0000000300000003ULL, 0x0000000300000003ULL, },
+        { 0x12f684c14bda12faULL, 0xda12f68812f684c1ULL, },
+        { 0x0000000400000003ULL, 0x0000000400000004ULL, },
+        { 0x0000000300000002ULL, 0x0000000300000003ULL, },    /*  24  */
+        { 0x0000000300000002ULL, 0x0000000300000003ULL, },
+        { 0xc71c71cac71c71c9ULL, 0xc71c71cac71c71caULL, },
+        { 0x0000000200000001ULL, 0x0000000200000002ULL, },
+        { 0xdddddddfdddddddeULL, 0xdddddddfdddddddfULL, },
+        { 0x0000000100000000ULL, 0x0000000100000001ULL, },
+        { 0xed097b43b425ed0aULL, 0x25ed097ced097b43ULL, },
+        { 0x0000000000000000ULL, 0x0000000100000000ULL, },
+        { 0x0000000000000000ULL, 0x0000000100000000ULL, },    /*  32  */
+        { 0x0000000000000000ULL, 0x0000000100000000ULL, },
+        { 0x2222222322222223ULL, 0x2222222422222223ULL, },
+        { 0x0000000000000000ULL, 0x0000000100000000ULL, },
+        { 0x147ae148147ae148ULL, 0x147ae149147ae148ULL, },
+        { 0x0000000000000000ULL, 0x0000000100000000ULL, },
+        { 0x0b60b60c2d82d82eULL, 0xe93e93ea0b60b60cULL, },
+        { 0x0000000100000000ULL, 0x0000000100000001ULL, },
+        { 0x0000000100000000ULL, 0x0000000100000001ULL, },    /*  40  */
+        { 0x0000000100000000ULL, 0x0000000100000001ULL, },
+        { 0xdddddddfdddddddeULL, 0xdddddddfdddddddfULL, },
+        { 0x0000000100000000ULL, 0x0000000100000001ULL, },
+        { 0xeb851eb9eb851eb8ULL, 0xeb851eb9eb851eb9ULL, },
+        { 0x0000000100000000ULL, 0x0000000100000001ULL, },
+        { 0xf49f49f5d27d27d3ULL, 0x16c16c17f49f49f5ULL, },
+        { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+        { 0x0000000000000001ULL, 0x0000000000000000ULL, },    /*  48  */
+        { 0x0000000000000001ULL, 0x0000000000000000ULL, },
+        { 0x12f684be4bda12f8ULL, 0xda12f68512f684beULL, },
+        { 0x0000000000000002ULL, 0x0000000000000000ULL, },
+        { 0x0b60b60c2d82d830ULL, 0xe93e93e90b60b60cULL, },
+        { 0x0000000000000003ULL, 0xffffffff00000000ULL, },
+        { 0x06522c3f6522c3f7ULL, 0x1948b0fb06522c3fULL, },
+        { 0x0000000000000004ULL, 0xffffffff00000000ULL, },
+        { 0x0000000000000003ULL, 0xffffffff00000000ULL, },    /*  56  */
+        { 0x0000000000000003ULL, 0xffffffff00000000ULL, },
+        { 0xed097b43b425ed0cULL, 0x25ed097bed097b43ULL, },
+        { 0x0000000000000002ULL, 0x0000000000000000ULL, },
+        { 0xf49f49f5d27d27d4ULL, 0x16c16c17f49f49f5ULL, },
+        { 0x0000000000000001ULL, 0x0000000000000000ULL, },
+        { 0xf9add3c19add3c0eULL, 0xe6b74f04f9add3c1ULL, },
+        { 0x0000000000000000ULL, 0x0000000100000000ULL, },
+        { 0x6fb7e8890cbdc0d3ULL, 0x2c6b144700049a05ULL, },    /*  64  */
+        { 0x73b239d7253787d5ULL, 0x379780f0ffc424ccULL, },
+        { 0x7fffffff0f127795ULL, 0x4f10998300c57f01ULL, },
+        { 0x1713a7162cca6b3bULL, 0x0be04ded01cca270ULL, },
+        { 0x1b0df8644544323dULL, 0x170cba96018c2d37ULL, },
+        { 0x1b323a657448a84fULL, 0x19dc46aa051313c6ULL, },
+        { 0x1dfa85ed49be7970ULL, 0x1fc3e135f6fe3018ULL, },
+        { 0x1a3e24ca7fffffffULL, 0x0edd19d1e8983ff6ULL, },
+        { 0x6863455169daefbfULL, 0x26563264e9999a2bULL, },    /*  72  */
+        { 0x6b2b90d93f50c0e0ULL, 0x2c3dccefdb84b67dULL, },
+        { 0x7fffffff65cdd2a4ULL, 0x38a5555313bd77c9ULL, },
+        { 0x369baa393226e271ULL, 0x1523c34a4d39d0a3ULL, },
+        { 0xcdaf51504fded617ULL, 0xd1f377b44e40f412ULL, },
+        { 0xc9f2f02d7fffffffULL, 0xc10cb0503fdb03f0ULL, },
+        { 0x808e9a674c590fccULL, 0x9d8b1e4779575ccaULL, },
+        { 0xe319324b7fffffffULL, 0x032ce4297fffffffULL, },
+        { 0xfe196fe67fffffffULL, 0x050bc0417e7bb00bULL, },    /*  80  */
+        { 0xfe299f487fffffffULL, 0x05cb2b577fffffffULL, },
+        { 0xff5d018339cf8b80ULL, 0x0798e2662b2b2514ULL, },
+        { 0xfecdfe20645a7d9bULL, 0x00d3dcf80dea608eULL, },
+        { 0xffebe0517fffffffULL, 0x0150ab000dc02968ULL, },
+        { 0xffec8baf7fffffffULL, 0x01828ea210087db2ULL, },
+        { 0xfff9423c39cf8b80ULL, 0x01fae4c1056841b9ULL, },
+        { 0xfff35806645a7d9bULL, 0x003737bc01be3862ULL, },
+        { 0xffff2aee7fffffffULL, 0x0057bed801b8eeb0ULL, },    /*  88  */
+        { 0xffff32047fffffffULL, 0x0064bf8102021ffcULL, },
+        { 0xffffb89f39cf8b80ULL, 0x00841c7a00ad640aULL, },
+        { 0xffff79fe645a7d9bULL, 0x000e642f0037e4a6ULL, },
+        { 0xfffff7307fffffffULL, 0x0016de7800373b16ULL, },
+        { 0xfffff77b7fffffffULL, 0x001a42040040661aULL, },
+        { 0xfffffd0c39cf8b80ULL, 0x00226e990015b802ULL, },
+        { 0xfffffa75645a7d9bULL, 0x0003c0350007004aULL, },
+        { 0xffffffa37fffffffULL, 0x0005f5d90006eb0dULL, },    /*  96  */
+        { 0xfffffffa7fffffffULL, 0x000978b30006d610ULL, },
+        { 0x000000007fffffffULL, 0x000f0d0c0006c153ULL, },
+        { 0x000000007fffffffULL, 0x0017eacf0006acd5ULL, },
+        { 0x000000007fffffffULL, 0x001b761e0007c87dULL, },
+        { 0x000000007fffffffULL, 0x001f87e00009133bULL, },
+        { 0x000000007fffffffULL, 0x00243402000a94e0ULL, },
+        { 0x000000007fffffffULL, 0x00299164000c5689ULL, },
+        { 0x0000000039cf8b80ULL, 0x003682160004293bULL, },    /* 104  */
+        { 0x000000001a1c28c4ULL, 0x00477a0900016741ULL, },
+        { 0x000000000bcae026ULL, 0x005dba4500007929ULL, },
+        { 0x00000000055376c2ULL, 0x007ae7c2000028ddULL, },
+        { 0x00000000093ed557ULL, 0x000d637500000d2cULL, },
+        { 0x00000000100c9469ULL, 0x0001755d0000043fULL, },
+        { 0x000000001bdc1297ULL, 0x000028ac0000015eULL, },
+        { 0x00000000305c8bbfULL, 0x0000046e00000071ULL, },
+};
+
+    reset_msa_registers();
+
+    gettimeofday(&start, NULL);
+
+    for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) {
+        for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) {
+            do_msa_MADDR_Q_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_MADDR_Q_W(b128_random[i], b128_random[j],
+                             b128_result[((PATTERN_INPUTS_SHORT_COUNT) *
+                                          (PATTERN_INPUTS_SHORT_COUNT)) +
+                                         RANDOM_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_MADDR_Q_W__DDT(b128_random[i], b128_random[j],
+                                  b128_result[
+                                      ((PATTERN_INPUTS_SHORT_COUNT) *
+                                       (PATTERN_INPUTS_SHORT_COUNT)) +
+                                      ((RANDOM_INPUTS_SHORT_COUNT) *
+                                       (RANDOM_INPUTS_SHORT_COUNT)) +
+                                      RANDOM_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_MADDR_Q_W__DSD(b128_random[i], b128_random[j],
+                                  b128_result[
+                                      ((PATTERN_INPUTS_SHORT_COUNT) *
+                                       (PATTERN_INPUTS_SHORT_COUNT)) +
+                                      (2 * (RANDOM_INPUTS_SHORT_COUNT) *
+                                       (RANDOM_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_128(isa_ase_name, group_name, instruction_name,
+                            TEST_COUNT_TOTAL, elapsed_time,
+                            &b128_result[0][0], &b128_expect[0][0]);
+
+    return ret;
+}
diff --git a/tests/tcg/mips/user/ase/msa/int-multiply/test_msa_maddv_b.c b/tests/tcg/mips/user/ase/msa/int-multiply/test_msa_maddv_b.c
index 5678677267..d543e1af28 100644
--- a/tests/tcg/mips/user/ase/msa/int-multiply/test_msa_maddv_b.c
+++ b/tests/tcg/mips/user/ase/msa/int-multiply/test_msa_maddv_b.c
@@ -43,118 +43,118 @@ int32_t main(void)
 
     uint64_t b128_result[TEST_COUNT_TOTAL][2];
     uint64_t b128_expect[TEST_COUNT_TOTAL][2] = {
-        { 0x0000000000000002ULL, 0x0000000000000002ULL, },    /*   0  */
-        { 0x0000000000000002ULL, 0x0000000000000002ULL, },
-        { 0x00000000aaaaaaaeULL, 0x00000000aaaaaaaeULL, },
-        { 0x0000000000000004ULL, 0x0000000000000004ULL, },
-        { 0x000000006666666cULL, 0x000000006666666cULL, },
-        { 0x0000000000000006ULL, 0x0000000000000006ULL, },
-        { 0x000000008e38e395ULL, 0xffffffffe38e38ebULL, },
-        { 0x0000000000000008ULL, 0x0000000000000008ULL, },
-        { 0x0000000000000008ULL, 0x0000000000000008ULL, },    /*   8  */
-        { 0x0000000000000008ULL, 0x0000000000000008ULL, },
-        { 0x0000000000000008ULL, 0x0000000000000008ULL, },
-        { 0x0000000000000008ULL, 0x0000000000000008ULL, },
-        { 0x0000000000000008ULL, 0x0000000000000008ULL, },
-        { 0x0000000000000008ULL, 0x0000000000000008ULL, },
-        { 0x0000000000000008ULL, 0x0000000000000008ULL, },
-        { 0x0000000000000008ULL, 0x0000000000000008ULL, },
-        { 0x00000000aaaaaab4ULL, 0x00000000aaaaaab4ULL, },    /*  16  */
-        { 0x00000000aaaaaab4ULL, 0x00000000aaaaaab4ULL, },
-        { 0x38e38e3a71c71c7cULL, 0x38e38e3a71c71c7cULL, },
-        { 0x0000000155555560ULL, 0x0000000155555560ULL, },
-        { 0x2222222444444450ULL, 0x2222222444444450ULL, },
-        { 0x000000020000000cULL, 0x000000020000000cULL, },
-        { 0x2f684bdcb425ed16ULL, 0xf684bda397b425faULL, },
-        { 0x00000002aaaaaab8ULL, 0x00000002aaaaaab8ULL, },
-        { 0x000000020000000eULL, 0x000000020000000eULL, },    /*  24  */
-        { 0x000000020000000eULL, 0x000000020000000eULL, },
-        { 0xc71c71c8e38e38f2ULL, 0xc71c71c8e38e38f2ULL, },
-        { 0x0000000155555564ULL, 0x0000000155555564ULL, },
-        { 0xdddddddeccccccdcULL, 0xdddddddeccccccdcULL, },
-        { 0x00000000aaaaaabaULL, 0x00000000aaaaaabaULL, },
-        { 0xd097b42684bda13fULL, 0x097b425ef684bdb1ULL, },
-        { 0x0000000000000010ULL, 0x0000000000000010ULL, },
-        { 0x0000000066666678ULL, 0x0000000066666678ULL, },    /*  32  */
-        { 0x0000000066666678ULL, 0x0000000066666678ULL, },
-        { 0x2222222355555568ULL, 0x2222222355555568ULL, },
-        { 0x00000000cccccce0ULL, 0x00000000cccccce0ULL, },
-        { 0x147ae1491eb85200ULL, 0x147ae1491eb85200ULL, },
-        { 0x0000000133333348ULL, 0x0000000133333348ULL, },
-        { 0x1c71c71e3e93e954ULL, 0xfa4fa4fbb60b60ccULL, },
-        { 0x00000001999999b0ULL, 0x00000001999999b0ULL, },
-        { 0x000000013333334aULL, 0x000000013333334aULL, },    /*  40  */
-        { 0x000000013333334aULL, 0x000000013333334aULL, },
-        { 0xdddddddeeeeeef06ULL, 0xdddddddeeeeeef06ULL, },
-        { 0x00000000cccccce4ULL, 0x00000000cccccce4ULL, },
-        { 0xeb851eb8e147ae2cULL, 0xeb851eb8e147ae2cULL, },
-        { 0x000000006666667eULL, 0x000000006666667eULL, },
-        { 0xe38e38e3e93e9401ULL, 0x05b05b05c71c71dfULL, },
-        { 0x0000000000000018ULL, 0x0000000000000018ULL, },
-        { 0x000000008e38e3a7ULL, 0xffffffffe38e38fdULL, },    /*  48  */
-        { 0x000000008e38e3a7ULL, 0xffffffffe38e38fdULL, },
-        { 0x2f684bdb425ed0b1ULL, 0xf684bda17b425eebULL, },
-        { 0x000000011c71c736ULL, 0xffffffffc71c71e2ULL, },
-        { 0x1c71c71e27d27d42ULL, 0xfa4fa4fa49f49f66ULL, },
-        { 0x00000001aaaaaac5ULL, 0xffffffffaaaaaac7ULL, },
-        { 0x35ba781b4587e6d2ULL, 0x0fcd6e9d6b74f050ULL, },
-        { 0x0000000238e38e54ULL, 0xffffffff8e38e3acULL, },
-        { 0x00000001aaaaaac7ULL, 0xffffffffaaaaaac9ULL, },    /*  56  */
-        { 0x00000001aaaaaac7ULL, 0xffffffffaaaaaac9ULL, },
-        { 0xd097b427a12f6869ULL, 0x097b425ebda12f87ULL, },
-        { 0x000000011c71c73aULL, 0xffffffffc71c71e6ULL, },
-        { 0xe38e38e477777796ULL, 0x05b05b05aaaaaacaULL, },
-        { 0x000000008e38e3adULL, 0xffffffffe38e3903ULL, },
-        { 0xca4587e781948b2fULL, 0xf032916206522c5fULL, },
-        { 0x0000000000000020ULL, 0x0000000000000020ULL, },
-        { 0x3e3ad4ae1266c2b0ULL, 0x1637d725aebdb734ULL, },    /*  64  */
-        { 0x4c74e0d60a3d6d94ULL, 0x1badd2dd9f4dac90ULL, },
-        { 0x6874e8f94205b90cULL, 0x27eb0c41af2c3022ULL, },
-        { 0x42dab657e16f25e8ULL, 0x06d6782e137656f2ULL, },
-        { 0x5114c27fd945d0ccULL, 0x0c4c73e604064c4eULL, },
-        { 0x68a91e898c276755ULL, 0x0f77ad378bdfb302ULL, },
-        { 0x54c82cde41d1cf13ULL, 0x0b6108a5f38e1598ULL, },
-        { 0x6f755d3eddd1234aULL, 0xfbbaace2f5421908ULL, },
-        { 0x8b75656215996ec2ULL, 0x07f7e64705209c9aULL, },    /*  72  */
-        { 0x779473b6cb43d680ULL, 0x03e141b56cceff30ULL, },
-        { 0xa6279a1866fb9f64ULL, 0x2631668db9e53ac1ULL, },
-        { 0x67a1f71bd99e4586ULL, 0x312ec9f6206e6e69ULL, },
-        { 0x4207c47a7907b262ULL, 0x101a35e284b89539ULL, },
-        { 0x5cb4f4db15070699ULL, 0x0073da1f866c98a9ULL, },
-        { 0x1e2f51de87a9acbbULL, 0x0b713d87ecf5cc51ULL, },
-        { 0x721d49ba5f0acfa8ULL, 0x5ba5bbe9afeae691ULL, },
-        { 0x4bcd68690d995de0ULL, 0x771da6b4b6c967ebULL, },    /*  80  */
-        { 0x4ea9a2cfbb5acd7bULL, 0x79dd6a73439e6387ULL, },
-        { 0x47c800b999dd2371ULL, 0x766d25914ef7a7a0ULL, },
-        { 0x41b0fa10eb77cf84ULL, 0x26e85189458965f8ULL, },
-        { 0x1fc448ce062c2944ULL, 0x31f490a9422a80e6ULL, },
-        { 0x211bdfadfd79770eULL, 0x3b25f4cac5763378ULL, },
-        { 0x16fbb87edd87b6f0ULL, 0x57c0b65fabdda20eULL, },
-        { 0x14621091eac4a5f6ULL, 0x4d29a25d32fa9ef6ULL, },
-        { 0x07832ded1c464b02ULL, 0x6396905709e3cfa4ULL, },    /*  88  */
-        { 0x0ff4a84eab8df3b9ULL, 0x6bc9a7d8c6adf2eaULL, },
-        { 0x21e53326bfbd0b05ULL, 0x8f8f3b9c679dff5aULL, },
-        { 0x191ed6a24e1576f9ULL, 0x9e8c2e402760373aULL, },
-        { 0x19b438400fc27751ULL, 0x819c4bbfd3ee6972ULL, },
-        { 0x1e0d5dc1094ae999ULL, 0x7496a289f5eff010ULL, },
-        { 0x11af620b7bc03943ULL, 0x8a11f229836addc7ULL, },
-        { 0x46fa45d0e84440fcULL, 0xe8d2c0211fb042bfULL, },
-        { 0x22142516b5a8adbcULL, 0xe1cf1923e186aad1ULL, },    /*  96  */
-        { 0x066ebbbb4ff6da44ULL, 0xd918d7e6a7e61877ULL, },
-        { 0x100acc9d22839a48ULL, 0xce291932929e367fULL, },
-        { 0x0dfe419d62a62f64ULL, 0xc020fe45a8cf7acfULL, },
-        { 0x2ba79b6ffbf3c63bULL, 0xb428f52c49fce695ULL, },
-        { 0x29b3b85200bdf100ULL, 0xb4ae7ea2f52aa5b9ULL, },
-        { 0x293bb84d6360c0b6ULL, 0xae33b26e4c493c49ULL, },
-        { 0x46a99fdf54f4862dULL, 0xae790dc5055f6f51ULL, },
-        { 0x18480e0fd728c7c3ULL, 0xa000ad7b15f8ebe0ULL, },    /* 104  */
-        { 0x1b8b97aa205e1239ULL, 0x89c78b8909c4a8e5ULL, },
-        { 0x09abb26b05ef649dULL, 0x74242fa1bd49e740ULL, },
-        { 0x04e233bc861d272bULL, 0x9c5343ab30f62f9fULL, },
-        { 0xda2da0d0884dc3d1ULL, 0xb824f201640b4147ULL, },
-        { 0x9d8b22ee1b9a2e0fULL, 0xb642ddf1edb0747fULL, },
-        { 0x7c81956533686a37ULL, 0xdd5181781dc3ad37ULL, },
-        { 0xc60b1905717ff25aULL, 0xe2af726e71ad7ad7ULL, },
+        { 0x0101010101010101ULL, 0x0101010101010101ULL, },    /*   0  */
+        { 0x0101010101010101ULL, 0x0101010101010101ULL, },
+        { 0x5757575757575757ULL, 0x5757575757575757ULL, },
+        { 0x0202020202020202ULL, 0x0202020202020202ULL, },
+        { 0x3636363636363636ULL, 0x3636363636363636ULL, },
+        { 0x0303030303030303ULL, 0x0303030303030303ULL, },
+        { 0x2075cb2075cb2075ULL, 0xcb2075cb2075cb20ULL, },
+        { 0x0404040404040404ULL, 0x0404040404040404ULL, },
+        { 0x0404040404040404ULL, 0x0404040404040404ULL, },    /*   8  */
+        { 0x0404040404040404ULL, 0x0404040404040404ULL, },
+        { 0x0404040404040404ULL, 0x0404040404040404ULL, },
+        { 0x0404040404040404ULL, 0x0404040404040404ULL, },
+        { 0x0404040404040404ULL, 0x0404040404040404ULL, },
+        { 0x0404040404040404ULL, 0x0404040404040404ULL, },
+        { 0x0404040404040404ULL, 0x0404040404040404ULL, },
+        { 0x0404040404040404ULL, 0x0404040404040404ULL, },
+        { 0x5a5a5a5a5a5a5a5aULL, 0x5a5a5a5a5a5a5a5aULL, },    /*  16  */
+        { 0x5a5a5a5a5a5a5a5aULL, 0x5a5a5a5a5a5a5a5aULL, },
+        { 0x3e3e3e3e3e3e3e3eULL, 0x3e3e3e3e3e3e3e3eULL, },
+        { 0xb0b0b0b0b0b0b0b0ULL, 0xb0b0b0b0b0b0b0b0ULL, },
+        { 0x2828282828282828ULL, 0x2828282828282828ULL, },
+        { 0x0606060606060606ULL, 0x0606060606060606ULL, },
+        { 0xc45236c45236c452ULL, 0x36c45236c45236c4ULL, },
+        { 0x5c5c5c5c5c5c5c5cULL, 0x5c5c5c5c5c5c5c5cULL, },
+        { 0x0707070707070707ULL, 0x0707070707070707ULL, },    /*  24  */
+        { 0x0707070707070707ULL, 0x0707070707070707ULL, },
+        { 0x7979797979797979ULL, 0x7979797979797979ULL, },
+        { 0xb2b2b2b2b2b2b2b2ULL, 0xb2b2b2b2b2b2b2b2ULL, },
+        { 0x6e6e6e6e6e6e6e6eULL, 0x6e6e6e6e6e6e6e6eULL, },
+        { 0x5d5d5d5d5d5d5d5dULL, 0x5d5d5d5d5d5d5d5dULL, },
+        { 0xbc83f5bc83f5bc83ULL, 0xf5bc83f5bc83f5bcULL, },
+        { 0x0808080808080808ULL, 0x0808080808080808ULL, },
+        { 0x3c3c3c3c3c3c3c3cULL, 0x3c3c3c3c3c3c3c3cULL, },    /*  32  */
+        { 0x3c3c3c3c3c3c3c3cULL, 0x3c3c3c3c3c3c3c3cULL, },
+        { 0xb4b4b4b4b4b4b4b4ULL, 0xb4b4b4b4b4b4b4b4ULL, },
+        { 0x7070707070707070ULL, 0x7070707070707070ULL, },
+        { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+        { 0xa4a4a4a4a4a4a4a4ULL, 0xa4a4a4a4a4a4a4a4ULL, },
+        { 0x88cc4488cc4488ccULL, 0x4488cc4488cc4488ULL, },
+        { 0xd8d8d8d8d8d8d8d8ULL, 0xd8d8d8d8d8d8d8d8ULL, },
+        { 0xa5a5a5a5a5a5a5a5ULL, 0xa5a5a5a5a5a5a5a5ULL, },    /*  40  */
+        { 0xa5a5a5a5a5a5a5a5ULL, 0xa5a5a5a5a5a5a5a5ULL, },
+        { 0x8383838383838383ULL, 0x8383838383838383ULL, },
+        { 0x7272727272727272ULL, 0x7272727272727272ULL, },
+        { 0x1616161616161616ULL, 0x1616161616161616ULL, },
+        { 0x3f3f3f3f3f3f3f3fULL, 0x3f3f3f3f3f3f3f3fULL, },
+        { 0x7889677889677889ULL, 0x6778896778896778ULL, },
+        { 0x0c0c0c0c0c0c0c0cULL, 0x0c0c0c0c0c0c0c0cULL, },
+        { 0x297ed4297ed4297eULL, 0xd4297ed4297ed429ULL, },    /*  48  */
+        { 0x297ed4297ed4297eULL, 0xd4297ed4297ed429ULL, },
+        { 0xe7ca04e7ca04e7caULL, 0x04e7ca04e7ca04e7ULL, },
+        { 0x46f09c46f09c46f0ULL, 0x9c46f09c46f09c46ULL, },
+        { 0x2a183c2a183c2a18ULL, 0x3c2a183c2a183c2aULL, },
+        { 0x6362646362646362ULL, 0x6463626463626463ULL, },
+        { 0xac26a4ac26a4ac26ULL, 0xa4ac26a4ac26a4acULL, },
+        { 0x80d42c80d42c80d4ULL, 0x2c80d42c80d42c80ULL, },
+        { 0x6463656463656463ULL, 0x6564636564636564ULL, },    /*  56  */
+        { 0x6463656463656463ULL, 0x6564636564636564ULL, },
+        { 0xfc6d8bfc6d8bfc6dULL, 0x8bfc6d8bfc6d8bfcULL, },
+        { 0x48f29e48f29e48f2ULL, 0x9e48f29e48f29e48ULL, },
+        { 0x98fe3298fe3298feULL, 0x3298fe3298fe3298ULL, },
+        { 0x2c81d72c81d72c81ULL, 0xd72c81d72c81d72cULL, },
+        { 0x002f5f002f5f002fULL, 0x5f002f5f002f5f00ULL, },
+        { 0x1010101010101010ULL, 0x1010101010101010ULL, },
+        { 0x50f4b4a050944910ULL, 0x09818994142910a0ULL, },    /*  64  */
+        { 0xa8a0b48458da5c10ULL, 0x4fe29220ea6e7070ULL, },
+        { 0x08e408fc40188310ULL, 0xbcca14c29417e060ULL, },
+        { 0x889acc58f0da8d90ULL, 0x0bc1ec1242cd40e0ULL, },
+        { 0xe046cc3cf820a090ULL, 0x5122f59e1812a0b0ULL, },
+        { 0xf94acc85218951d0ULL, 0x95738e42d193e4c0ULL, },
+        { 0x9d16cc43c6665ed0ULL, 0x53db3028d828be70ULL, },
+        { 0x6db8cc0a0c890c40ULL, 0x3d628818b56622f0ULL, },
+        { 0xcdfc2082f4c73340ULL, 0xaa4a0aba5f0f92e0ULL, },    /*  72  */
+        { 0x71c8204099a44040ULL, 0x68b2aca066a46c90ULL, },
+        { 0x016c64244a05b940ULL, 0x59f2d0a19fddc520ULL, },
+        { 0x4132584638a46f40ULL, 0xd44a00c982f36fa0ULL, },
+        { 0xc1e81ca2e86679c0ULL, 0x2341d81930a9cf20ULL, },
+        { 0x918a1c692e892730ULL, 0x0dc830090de733a0ULL, },
+        { 0xd150108b1c28dd30ULL, 0x88206031f0fddd20ULL, },
+        { 0xd1b1f4b4a08961f4ULL, 0x3101a07181016120ULL, },
+        { 0xd9fb2c24a0fb96f4ULL, 0x8c6880ef7f7c11a0ULL, },    /*  80  */
+        { 0x9c452c10c01c3094ULL, 0x64c00035ea008320ULL, },
+        { 0x6c8714b080c04094ULL, 0xa0c00000380072a0ULL, },
+        { 0xac30cca08080c0acULL, 0xc0800000300016a0ULL, },
+        { 0x0c101420808080acULL, 0x00000000d0003620ULL, },
+        { 0xd0f014800000000cULL, 0x00000000e00082a0ULL, },
+        { 0x9050ac800000000cULL, 0x0000000080004c20ULL, },
+        { 0x90007400000000b4ULL, 0x0000000000006420ULL, },
+        { 0x1000ac00000000b4ULL, 0x00000000000024a0ULL, },    /*  88  */
+        { 0xc000ac0000000054ULL, 0x000000000000ac20ULL, },
+        { 0xc000940000000054ULL, 0x00000000000088a0ULL, },
+        { 0xc0004c00000000ecULL, 0x00000000000098a0ULL, },
+        { 0xc0009400000000ecULL, 0x0000000000001820ULL, },
+        { 0x000094000000004cULL, 0x000000000000c8a0ULL, },
+        { 0x00002c000000004cULL, 0x000000000000b020ULL, },
+        { 0x0000f40000000074ULL, 0x0000000000001020ULL, },
+        { 0x00002c0000000074ULL, 0x00000000000010a0ULL, },    /*  96  */
+        { 0x0000b40000000074ULL, 0x0000000000001020ULL, },
+        { 0x00006c0000000074ULL, 0x00000000000010a0ULL, },
+        { 0x0000740000000074ULL, 0x0000000000001020ULL, },
+        { 0x0000740000000014ULL, 0x00000000000030a0ULL, },
+        { 0x00007400000000b4ULL, 0x0000000000009020ULL, },
+        { 0x0000740000000054ULL, 0x000000000000b0a0ULL, },
+        { 0x00007400000000f4ULL, 0x0000000000001020ULL, },
+        { 0x00004c00000000f4ULL, 0x00000000000060a0ULL, },    /* 104  */
+        { 0x0000f400000000f4ULL, 0x0000000000004020ULL, },
+        { 0x0000cc00000000f4ULL, 0x00000000000080a0ULL, },
+        { 0x00007400000000f4ULL, 0x0000000000000020ULL, },
+        { 0x00006c000000004cULL, 0x0000000000000020ULL, },
+        { 0x0000b40000000074ULL, 0x0000000000000020ULL, },
+        { 0x00002c00000000ccULL, 0x0000000000000020ULL, },
+        { 0x0000f400000000f4ULL, 0x0000000000000020ULL, },
     };
 
     reset_msa_registers();
diff --git a/tests/tcg/mips/user/ase/msa/int-multiply/test_msa_maddv_d.c b/tests/tcg/mips/user/ase/msa/int-multiply/test_msa_maddv_d.c
index 965703ca38..fda35f757b 100644
--- a/tests/tcg/mips/user/ase/msa/int-multiply/test_msa_maddv_d.c
+++ b/tests/tcg/mips/user/ase/msa/int-multiply/test_msa_maddv_d.c
@@ -43,118 +43,118 @@ int32_t main(void)
 
     uint64_t b128_result[TEST_COUNT_TOTAL][2];
     uint64_t b128_expect[TEST_COUNT_TOTAL][2] = {
-        { 0x0000000000000002ULL, 0x0000000000000002ULL, },    /*   0  */
+        { 0x0000000000000001ULL, 0x0000000000000001ULL, },    /*   0  */
+        { 0x0000000000000001ULL, 0x0000000000000001ULL, },
+        { 0x5555555555555557ULL, 0x5555555555555557ULL, },
         { 0x0000000000000002ULL, 0x0000000000000002ULL, },
-        { 0x00000000aaaaaaaeULL, 0x00000000aaaaaaaeULL, },
+        { 0x3333333333333336ULL, 0x3333333333333336ULL, },
+        { 0x0000000000000003ULL, 0x0000000000000003ULL, },
+        { 0x1c71c71c71c71c75ULL, 0xc71c71c71c71c720ULL, },
         { 0x0000000000000004ULL, 0x0000000000000004ULL, },
-        { 0x000000006666666cULL, 0x000000006666666cULL, },
+        { 0x0000000000000004ULL, 0x0000000000000004ULL, },    /*   8  */
+        { 0x0000000000000004ULL, 0x0000000000000004ULL, },
+        { 0x0000000000000004ULL, 0x0000000000000004ULL, },
+        { 0x0000000000000004ULL, 0x0000000000000004ULL, },
+        { 0x0000000000000004ULL, 0x0000000000000004ULL, },
+        { 0x0000000000000004ULL, 0x0000000000000004ULL, },
+        { 0x0000000000000004ULL, 0x0000000000000004ULL, },
+        { 0x0000000000000004ULL, 0x0000000000000004ULL, },
+        { 0x555555555555555aULL, 0x555555555555555aULL, },    /*  16  */
+        { 0x555555555555555aULL, 0x555555555555555aULL, },
+        { 0x8e38e38e38e38e3eULL, 0x8e38e38e38e38e3eULL, },
+        { 0xaaaaaaaaaaaaaab0ULL, 0xaaaaaaaaaaaaaab0ULL, },
+        { 0x2222222222222228ULL, 0x2222222222222228ULL, },
         { 0x0000000000000006ULL, 0x0000000000000006ULL, },
-        { 0x000000008e38e395ULL, 0xffffffffe38e38ebULL, },
-        { 0x0000000000000008ULL, 0x0000000000000008ULL, },
-        { 0x0000000000000008ULL, 0x0000000000000008ULL, },    /*   8  */
-        { 0x0000000000000008ULL, 0x0000000000000008ULL, },
-        { 0x0000000000000008ULL, 0x0000000000000008ULL, },
-        { 0x0000000000000008ULL, 0x0000000000000008ULL, },
-        { 0x0000000000000008ULL, 0x0000000000000008ULL, },
-        { 0x0000000000000008ULL, 0x0000000000000008ULL, },
-        { 0x0000000000000008ULL, 0x0000000000000008ULL, },
+        { 0x12f684bda12f6852ULL, 0x2f684bda12f684c4ULL, },
+        { 0x555555555555555cULL, 0x555555555555555cULL, },
+        { 0x0000000000000007ULL, 0x0000000000000007ULL, },    /*  24  */
+        { 0x0000000000000007ULL, 0x0000000000000007ULL, },
+        { 0x1c71c71c71c71c79ULL, 0x1c71c71c71c71c79ULL, },
+        { 0xaaaaaaaaaaaaaab2ULL, 0xaaaaaaaaaaaaaab2ULL, },
+        { 0x666666666666666eULL, 0x666666666666666eULL, },
+        { 0x555555555555555dULL, 0x555555555555555dULL, },
+        { 0x5ed097b425ed0983ULL, 0xed097b425ed097bcULL, },
         { 0x0000000000000008ULL, 0x0000000000000008ULL, },
-        { 0x00000000aaaaaab4ULL, 0x00000000aaaaaab4ULL, },    /*  16  */
-        { 0x00000000aaaaaab4ULL, 0x00000000aaaaaab4ULL, },
-        { 0x38e38e3a71c71c7cULL, 0x38e38e3a71c71c7cULL, },
-        { 0x0000000155555560ULL, 0x0000000155555560ULL, },
-        { 0x2222222444444450ULL, 0x2222222444444450ULL, },
-        { 0x000000020000000cULL, 0x000000020000000cULL, },
-        { 0x2f684bdcb425ed16ULL, 0xf684bda397b425faULL, },
-        { 0x00000002aaaaaab8ULL, 0x00000002aaaaaab8ULL, },
-        { 0x000000020000000eULL, 0x000000020000000eULL, },    /*  24  */
-        { 0x000000020000000eULL, 0x000000020000000eULL, },
-        { 0xc71c71c8e38e38f2ULL, 0xc71c71c8e38e38f2ULL, },
-        { 0x0000000155555564ULL, 0x0000000155555564ULL, },
-        { 0xdddddddeccccccdcULL, 0xdddddddeccccccdcULL, },
-        { 0x00000000aaaaaabaULL, 0x00000000aaaaaabaULL, },
-        { 0xd097b42684bda13fULL, 0x097b425ef684bdb1ULL, },
+        { 0x333333333333333cULL, 0x333333333333333cULL, },    /*  32  */
+        { 0x333333333333333cULL, 0x333333333333333cULL, },
+        { 0xaaaaaaaaaaaaaab4ULL, 0xaaaaaaaaaaaaaab4ULL, },
+        { 0x6666666666666670ULL, 0x6666666666666670ULL, },
+        { 0x5c28f5c28f5c2900ULL, 0x5c28f5c28f5c2900ULL, },
+        { 0x99999999999999a4ULL, 0x99999999999999a4ULL, },
+        { 0x16c16c16c16c16ccULL, 0xd27d27d27d27d288ULL, },
+        { 0xccccccccccccccd8ULL, 0xccccccccccccccd8ULL, },
+        { 0x99999999999999a5ULL, 0x99999999999999a5ULL, },    /*  40  */
+        { 0x99999999999999a5ULL, 0x99999999999999a5ULL, },
+        { 0x7777777777777783ULL, 0x7777777777777783ULL, },
+        { 0x6666666666666672ULL, 0x6666666666666672ULL, },
+        { 0xa3d70a3d70a3d716ULL, 0xa3d70a3d70a3d716ULL, },
+        { 0x333333333333333fULL, 0x333333333333333fULL, },
+        { 0xd27d27d27d27d289ULL, 0xc16c16c16c16c178ULL, },
+        { 0x000000000000000cULL, 0x000000000000000cULL, },
+        { 0x1c71c71c71c71c7eULL, 0xc71c71c71c71c729ULL, },    /*  48  */
+        { 0x1c71c71c71c71c7eULL, 0xc71c71c71c71c729ULL, },
+        { 0x2f684bda12f684caULL, 0xf684bda12f684be7ULL, },
+        { 0x38e38e38e38e38f0ULL, 0x8e38e38e38e38e46ULL, },
+        { 0xb60b60b60b60b618ULL, 0xc71c71c71c71c72aULL, },
+        { 0x5555555555555562ULL, 0x5555555555555563ULL, },
+        { 0x06522c3f35ba7826ULL, 0xa781948b0fcd6eacULL, },
+        { 0x71c71c71c71c71d4ULL, 0x1c71c71c71c71c80ULL, },
+        { 0x5555555555555563ULL, 0x5555555555555564ULL, },    /*  56  */
+        { 0x5555555555555563ULL, 0x5555555555555564ULL, },
+        { 0x97b425ed097b426dULL, 0x7b425ed097b425fcULL, },
+        { 0x38e38e38e38e38f2ULL, 0x8e38e38e38e38e48ULL, },
+        { 0xeeeeeeeeeeeeeefeULL, 0x8888888888888898ULL, },
+        { 0x1c71c71c71c71c81ULL, 0xc71c71c71c71c72cULL, },
+        { 0x87e6b74f0329162fULL, 0x3c0ca4587e6b7500ULL, },
         { 0x0000000000000010ULL, 0x0000000000000010ULL, },
-        { 0x0000000066666678ULL, 0x0000000066666678ULL, },    /*  32  */
-        { 0x0000000066666678ULL, 0x0000000066666678ULL, },
-        { 0x2222222355555568ULL, 0x2222222355555568ULL, },
-        { 0x00000000cccccce0ULL, 0x00000000cccccce0ULL, },
-        { 0x147ae1491eb85200ULL, 0x147ae1491eb85200ULL, },
-        { 0x0000000133333348ULL, 0x0000000133333348ULL, },
-        { 0x1c71c71e3e93e954ULL, 0xfa4fa4fbb60b60ccULL, },
-        { 0x00000001999999b0ULL, 0x00000001999999b0ULL, },
-        { 0x000000013333334aULL, 0x000000013333334aULL, },    /*  40  */
-        { 0x000000013333334aULL, 0x000000013333334aULL, },
-        { 0xdddddddeeeeeef06ULL, 0xdddddddeeeeeef06ULL, },
-        { 0x00000000cccccce4ULL, 0x00000000cccccce4ULL, },
-        { 0xeb851eb8e147ae2cULL, 0xeb851eb8e147ae2cULL, },
-        { 0x000000006666667eULL, 0x000000006666667eULL, },
-        { 0xe38e38e3e93e9401ULL, 0x05b05b05c71c71dfULL, },
-        { 0x0000000000000018ULL, 0x0000000000000018ULL, },
-        { 0x000000008e38e3a7ULL, 0xffffffffe38e38fdULL, },    /*  48  */
-        { 0x000000008e38e3a7ULL, 0xffffffffe38e38fdULL, },
-        { 0x2f684bdb425ed0b1ULL, 0xf684bda17b425eebULL, },
-        { 0x000000011c71c736ULL, 0xffffffffc71c71e2ULL, },
-        { 0x1c71c71e27d27d42ULL, 0xfa4fa4fa49f49f66ULL, },
-        { 0x00000001aaaaaac5ULL, 0xffffffffaaaaaac7ULL, },
-        { 0x35ba781b4587e6d2ULL, 0x0fcd6e9d6b74f050ULL, },
-        { 0x0000000238e38e54ULL, 0xffffffff8e38e3acULL, },
-        { 0x00000001aaaaaac7ULL, 0xffffffffaaaaaac9ULL, },    /*  56  */
-        { 0x00000001aaaaaac7ULL, 0xffffffffaaaaaac9ULL, },
-        { 0xd097b427a12f6869ULL, 0x097b425ebda12f87ULL, },
-        { 0x000000011c71c73aULL, 0xffffffffc71c71e6ULL, },
-        { 0xe38e38e477777796ULL, 0x05b05b05aaaaaacaULL, },
-        { 0x000000008e38e3adULL, 0xffffffffe38e3903ULL, },
-        { 0xca4587e781948b2fULL, 0xf032916206522c5fULL, },
-        { 0x0000000000000020ULL, 0x0000000000000020ULL, },
-        { 0x3e3ad4ae1266c2b0ULL, 0x1637d725aebdb734ULL, },    /*  64  */
-        { 0x4c74e0d60a3d6d94ULL, 0x1badd2dd9f4dac90ULL, },
-        { 0x6874e8f94205b90cULL, 0x27eb0c41af2c3022ULL, },
-        { 0x42dab657e16f25e8ULL, 0x06d6782e137656f2ULL, },
-        { 0x5114c27fd945d0ccULL, 0x0c4c73e604064c4eULL, },
-        { 0x68a91e898c276755ULL, 0x0f77ad378bdfb302ULL, },
-        { 0x54c82cde41d1cf13ULL, 0x0b6108a5f38e1598ULL, },
-        { 0x6f755d3eddd1234aULL, 0xfbbaace2f5421908ULL, },
-        { 0x8b75656215996ec2ULL, 0x07f7e64705209c9aULL, },    /*  72  */
-        { 0x779473b6cb43d680ULL, 0x03e141b56cceff30ULL, },
-        { 0xa6279a1866fb9f64ULL, 0x2631668db9e53ac1ULL, },
-        { 0x67a1f71bd99e4586ULL, 0x312ec9f6206e6e69ULL, },
-        { 0x4207c47a7907b262ULL, 0x101a35e284b89539ULL, },
-        { 0x5cb4f4db15070699ULL, 0x0073da1f866c98a9ULL, },
-        { 0x1e2f51de87a9acbbULL, 0x0b713d87ecf5cc51ULL, },
-        { 0x721d49ba5f0acfa8ULL, 0x5ba5bbe9afeae691ULL, },
-        { 0x4bcd68690d995de0ULL, 0x771da6b4b6c967ebULL, },    /*  80  */
-        { 0x4ea9a2cfbb5acd7bULL, 0x79dd6a73439e6387ULL, },
-        { 0x47c800b999dd2371ULL, 0x766d25914ef7a7a0ULL, },
-        { 0x41b0fa10eb77cf84ULL, 0x26e85189458965f8ULL, },
-        { 0x1fc448ce062c2944ULL, 0x31f490a9422a80e6ULL, },
-        { 0x211bdfadfd79770eULL, 0x3b25f4cac5763378ULL, },
-        { 0x16fbb87edd87b6f0ULL, 0x57c0b65fabdda20eULL, },
-        { 0x14621091eac4a5f6ULL, 0x4d29a25d32fa9ef6ULL, },
-        { 0x07832ded1c464b02ULL, 0x6396905709e3cfa4ULL, },    /*  88  */
-        { 0x0ff4a84eab8df3b9ULL, 0x6bc9a7d8c6adf2eaULL, },
-        { 0x21e53326bfbd0b05ULL, 0x8f8f3b9c679dff5aULL, },
-        { 0x191ed6a24e1576f9ULL, 0x9e8c2e402760373aULL, },
-        { 0x19b438400fc27751ULL, 0x819c4bbfd3ee6972ULL, },
-        { 0x1e0d5dc1094ae999ULL, 0x7496a289f5eff010ULL, },
-        { 0x11af620b7bc03943ULL, 0x8a11f229836addc7ULL, },
-        { 0x46fa45d0e84440fcULL, 0xe8d2c0211fb042bfULL, },
-        { 0x22142516b5a8adbcULL, 0xe1cf1923e186aad1ULL, },    /*  96  */
-        { 0x066ebbbb4ff6da44ULL, 0xd918d7e6a7e61877ULL, },
-        { 0x100acc9d22839a48ULL, 0xce291932929e367fULL, },
-        { 0x0dfe419d62a62f64ULL, 0xc020fe45a8cf7acfULL, },
-        { 0x2ba79b6ffbf3c63bULL, 0xb428f52c49fce695ULL, },
-        { 0x29b3b85200bdf100ULL, 0xb4ae7ea2f52aa5b9ULL, },
-        { 0x293bb84d6360c0b6ULL, 0xae33b26e4c493c49ULL, },
-        { 0x46a99fdf54f4862dULL, 0xae790dc5055f6f51ULL, },
-        { 0x18480e0fd728c7c3ULL, 0xa000ad7b15f8ebe0ULL, },    /* 104  */
-        { 0x1b8b97aa205e1239ULL, 0x89c78b8909c4a8e5ULL, },
-        { 0x09abb26b05ef649dULL, 0x74242fa1bd49e740ULL, },
-        { 0x04e233bc861d272bULL, 0x9c5343ab30f62f9fULL, },
-        { 0xda2da0d0884dc3d1ULL, 0xb824f201640b4147ULL, },
-        { 0x9d8b22ee1b9a2e0fULL, 0xb642ddf1edb0747fULL, },
-        { 0x7c81956533686a37ULL, 0xdd5181781dc3ad37ULL, },
-        { 0xc60b1905717ff25aULL, 0xe2af726e71ad7ad7ULL, },
+        { 0xad45be6961639010ULL, 0x3297fdea749880a0ULL, },    /*  64  */
+        { 0x9ced640a487afa10ULL, 0xeaa90809e3b1a470ULL, },
+        { 0xa5b377aa0caf5a10ULL, 0x95c9a7903bd12160ULL, },
+        { 0xa194ffe4fb27d390ULL, 0x17e6ccd3c9a1c0e0ULL, },
+        { 0x913ca585e23f3d90ULL, 0xcff7d6f338bae4b0ULL, },
+        { 0xc8ead0bee02cadd0ULL, 0x381c4d6a83a94cc0ULL, },
+        { 0x33b60e279e9989d0ULL, 0xe7f71f9b97ee3470ULL, },
+        { 0x217580abbfdd3e40ULL, 0x6779436687bc89f0ULL, },
+        { 0x2a3b944b84119e40ULL, 0x1299e2ecdfdc06e0ULL, },    /*  72  */
+        { 0x9506d1b4427e7a40ULL, 0xc274b51df420ee90ULL, },
+        { 0x1b2bb7962782ba40ULL, 0x9bf62dc42637b820ULL, },
+        { 0x91d16316b1663b40ULL, 0x3cf7c824fb128ca0ULL, },
+        { 0x8db2eb519fdeb4c0ULL, 0xbf14ed6888e32c20ULL, },
+        { 0x7b725dd5c1226930ULL, 0x3e97113378b181a0ULL, },
+        { 0xf21809564b05ea30ULL, 0xdf98ab944d8c5620ULL, },
+        { 0x3dcc402bfcefb9f4ULL, 0xf26a7a4530ab3a20ULL, },
+        { 0x81a8956a21043af4ULL, 0xe63ec4a9de07f3a0ULL, },    /*  80  */
+        { 0x14acc7eab115be94ULL, 0xa72fae300e450520ULL, },
+        { 0x4c5c3900181b6494ULL, 0xc26796e561c70ba0ULL, },
+        { 0x513451003792b1acULL, 0x5acad191d5b18fa0ULL, },
+        { 0x0daff27cb51538acULL, 0x31375ce2aea24b20ULL, },
+        { 0xbb9ebee52390b20cULL, 0xd8cfb350af547ea0ULL, },
+        { 0x4df25269204a3c0cULL, 0x07b9241bbd1b8320ULL, },
+        { 0x39b3c4d066371fb4ULL, 0x2a4dc00c264fb720ULL, },
+        { 0xf9aee458846dd0b4ULL, 0x79d838b37c524ca0ULL, },    /*  88  */
+        { 0x115f9e7f00744254ULL, 0x46ec87fe3540fa20ULL, },
+        { 0xb01458f6b0850854ULL, 0xde82246a25db24a0ULL, },
+        { 0xc18097bf5a7bb9ecULL, 0x4155f0da566748a0ULL, },
+        { 0x70c7391b1a7d90ecULL, 0x0400deec0a0cb020ULL, },
+        { 0xf7a41980bd958c4cULL, 0xedfeb14ff6d44fa0ULL, },
+        { 0x7906f19718fcf64cULL, 0x29e471752ecca820ULL, },
+        { 0xb6393967140b1974ULL, 0xbd0ed4c39361fc20ULL, },
+        { 0x74ecb57da4acfa74ULL, 0x36ea3f3dbcafcda0ULL, },    /*  96  */
+        { 0x5b14aa5e3f7c1b74ULL, 0xeb031f17fe2b7120ULL, },
+        { 0x0468573ef6087c74ULL, 0xe8ef35d2e05abea0ULL, },
+        { 0xd69cf5cf0de21d74ULL, 0x39f569701e89ae20ULL, },
+        { 0xf233f7a10f743514ULL, 0xf574fc00c1b755a0ULL, },
+        { 0x873c421a5ed469b4ULL, 0x96f393305dfcdf20ULL, },
+        { 0x17e80b0449fea354ULL, 0x2f05ddb06b40c2a0ULL, },
+        { 0x0741f67f982609f4ULL, 0x9c23f2dbc2b79820ULL, },
+        { 0x530275e3b2de7ff4ULL, 0xc6904e7f6f6c1aa0ULL, },    /* 104  */
+        { 0xf8214644bbe3f5f4ULL, 0xe44a0de01c974f20ULL, },
+        { 0xb59c90c0a8b66bf4ULL, 0x9abcf7a8e1391da0ULL, },
+        { 0xb67d543caed5e1f4ULL, 0x4ce8f72994d78e20ULL, },
+        { 0xcee67f5e9d2e224cULL, 0xba31bdf2ab48a220ULL, },
+        { 0x87acb43db40fad74ULL, 0x8a259794c40e3620ULL, },
+        { 0x45c27495332aeeccULL, 0xe81c4208ecf84a20ULL, },
+        { 0x50a99b794e1bc8f4ULL, 0x17cdf4c275d6de20ULL, },
     };
 
     reset_msa_registers();
diff --git a/tests/tcg/mips/user/ase/msa/int-multiply/test_msa_maddv_h.c b/tests/tcg/mips/user/ase/msa/int-multiply/test_msa_maddv_h.c
index ad20f01b17..a9ee9b328a 100644
--- a/tests/tcg/mips/user/ase/msa/int-multiply/test_msa_maddv_h.c
+++ b/tests/tcg/mips/user/ase/msa/int-multiply/test_msa_maddv_h.c
@@ -43,118 +43,118 @@ int32_t main(void)
 
     uint64_t b128_result[TEST_COUNT_TOTAL][2];
     uint64_t b128_expect[TEST_COUNT_TOTAL][2] = {
-        { 0x0000000000000002ULL, 0x0000000000000002ULL, },    /*   0  */
-        { 0x0000000000000002ULL, 0x0000000000000002ULL, },
-        { 0x00000000aaaaaaaeULL, 0x00000000aaaaaaaeULL, },
-        { 0x0000000000000004ULL, 0x0000000000000004ULL, },
-        { 0x000000006666666cULL, 0x000000006666666cULL, },
-        { 0x0000000000000006ULL, 0x0000000000000006ULL, },
-        { 0x000000008e38e395ULL, 0xffffffffe38e38ebULL, },
-        { 0x0000000000000008ULL, 0x0000000000000008ULL, },
-        { 0x0000000000000008ULL, 0x0000000000000008ULL, },    /*   8  */
-        { 0x0000000000000008ULL, 0x0000000000000008ULL, },
-        { 0x0000000000000008ULL, 0x0000000000000008ULL, },
-        { 0x0000000000000008ULL, 0x0000000000000008ULL, },
-        { 0x0000000000000008ULL, 0x0000000000000008ULL, },
-        { 0x0000000000000008ULL, 0x0000000000000008ULL, },
-        { 0x0000000000000008ULL, 0x0000000000000008ULL, },
-        { 0x0000000000000008ULL, 0x0000000000000008ULL, },
-        { 0x00000000aaaaaab4ULL, 0x00000000aaaaaab4ULL, },    /*  16  */
-        { 0x00000000aaaaaab4ULL, 0x00000000aaaaaab4ULL, },
-        { 0x38e38e3a71c71c7cULL, 0x38e38e3a71c71c7cULL, },
-        { 0x0000000155555560ULL, 0x0000000155555560ULL, },
-        { 0x2222222444444450ULL, 0x2222222444444450ULL, },
-        { 0x000000020000000cULL, 0x000000020000000cULL, },
-        { 0x2f684bdcb425ed16ULL, 0xf684bda397b425faULL, },
-        { 0x00000002aaaaaab8ULL, 0x00000002aaaaaab8ULL, },
-        { 0x000000020000000eULL, 0x000000020000000eULL, },    /*  24  */
-        { 0x000000020000000eULL, 0x000000020000000eULL, },
-        { 0xc71c71c8e38e38f2ULL, 0xc71c71c8e38e38f2ULL, },
-        { 0x0000000155555564ULL, 0x0000000155555564ULL, },
-        { 0xdddddddeccccccdcULL, 0xdddddddeccccccdcULL, },
-        { 0x00000000aaaaaabaULL, 0x00000000aaaaaabaULL, },
-        { 0xd097b42684bda13fULL, 0x097b425ef684bdb1ULL, },
-        { 0x0000000000000010ULL, 0x0000000000000010ULL, },
-        { 0x0000000066666678ULL, 0x0000000066666678ULL, },    /*  32  */
-        { 0x0000000066666678ULL, 0x0000000066666678ULL, },
-        { 0x2222222355555568ULL, 0x2222222355555568ULL, },
-        { 0x00000000cccccce0ULL, 0x00000000cccccce0ULL, },
-        { 0x147ae1491eb85200ULL, 0x147ae1491eb85200ULL, },
-        { 0x0000000133333348ULL, 0x0000000133333348ULL, },
-        { 0x1c71c71e3e93e954ULL, 0xfa4fa4fbb60b60ccULL, },
-        { 0x00000001999999b0ULL, 0x00000001999999b0ULL, },
-        { 0x000000013333334aULL, 0x000000013333334aULL, },    /*  40  */
-        { 0x000000013333334aULL, 0x000000013333334aULL, },
-        { 0xdddddddeeeeeef06ULL, 0xdddddddeeeeeef06ULL, },
-        { 0x00000000cccccce4ULL, 0x00000000cccccce4ULL, },
-        { 0xeb851eb8e147ae2cULL, 0xeb851eb8e147ae2cULL, },
-        { 0x000000006666667eULL, 0x000000006666667eULL, },
-        { 0xe38e38e3e93e9401ULL, 0x05b05b05c71c71dfULL, },
-        { 0x0000000000000018ULL, 0x0000000000000018ULL, },
-        { 0x000000008e38e3a7ULL, 0xffffffffe38e38fdULL, },    /*  48  */
-        { 0x000000008e38e3a7ULL, 0xffffffffe38e38fdULL, },
-        { 0x2f684bdb425ed0b1ULL, 0xf684bda17b425eebULL, },
-        { 0x000000011c71c736ULL, 0xffffffffc71c71e2ULL, },
-        { 0x1c71c71e27d27d42ULL, 0xfa4fa4fa49f49f66ULL, },
-        { 0x00000001aaaaaac5ULL, 0xffffffffaaaaaac7ULL, },
-        { 0x35ba781b4587e6d2ULL, 0x0fcd6e9d6b74f050ULL, },
-        { 0x0000000238e38e54ULL, 0xffffffff8e38e3acULL, },
-        { 0x00000001aaaaaac7ULL, 0xffffffffaaaaaac9ULL, },    /*  56  */
-        { 0x00000001aaaaaac7ULL, 0xffffffffaaaaaac9ULL, },
-        { 0xd097b427a12f6869ULL, 0x097b425ebda12f87ULL, },
-        { 0x000000011c71c73aULL, 0xffffffffc71c71e6ULL, },
-        { 0xe38e38e477777796ULL, 0x05b05b05aaaaaacaULL, },
-        { 0x000000008e38e3adULL, 0xffffffffe38e3903ULL, },
-        { 0xca4587e781948b2fULL, 0xf032916206522c5fULL, },
-        { 0x0000000000000020ULL, 0x0000000000000020ULL, },
-        { 0x3e3ad4ae1266c2b0ULL, 0x1637d725aebdb734ULL, },    /*  64  */
-        { 0x4c74e0d60a3d6d94ULL, 0x1badd2dd9f4dac90ULL, },
-        { 0x6874e8f94205b90cULL, 0x27eb0c41af2c3022ULL, },
-        { 0x42dab657e16f25e8ULL, 0x06d6782e137656f2ULL, },
-        { 0x5114c27fd945d0ccULL, 0x0c4c73e604064c4eULL, },
-        { 0x68a91e898c276755ULL, 0x0f77ad378bdfb302ULL, },
-        { 0x54c82cde41d1cf13ULL, 0x0b6108a5f38e1598ULL, },
-        { 0x6f755d3eddd1234aULL, 0xfbbaace2f5421908ULL, },
-        { 0x8b75656215996ec2ULL, 0x07f7e64705209c9aULL, },    /*  72  */
-        { 0x779473b6cb43d680ULL, 0x03e141b56cceff30ULL, },
-        { 0xa6279a1866fb9f64ULL, 0x2631668db9e53ac1ULL, },
-        { 0x67a1f71bd99e4586ULL, 0x312ec9f6206e6e69ULL, },
-        { 0x4207c47a7907b262ULL, 0x101a35e284b89539ULL, },
-        { 0x5cb4f4db15070699ULL, 0x0073da1f866c98a9ULL, },
-        { 0x1e2f51de87a9acbbULL, 0x0b713d87ecf5cc51ULL, },
-        { 0x721d49ba5f0acfa8ULL, 0x5ba5bbe9afeae691ULL, },
-        { 0x4bcd68690d995de0ULL, 0x771da6b4b6c967ebULL, },    /*  80  */
-        { 0x4ea9a2cfbb5acd7bULL, 0x79dd6a73439e6387ULL, },
-        { 0x47c800b999dd2371ULL, 0x766d25914ef7a7a0ULL, },
-        { 0x41b0fa10eb77cf84ULL, 0x26e85189458965f8ULL, },
-        { 0x1fc448ce062c2944ULL, 0x31f490a9422a80e6ULL, },
-        { 0x211bdfadfd79770eULL, 0x3b25f4cac5763378ULL, },
-        { 0x16fbb87edd87b6f0ULL, 0x57c0b65fabdda20eULL, },
-        { 0x14621091eac4a5f6ULL, 0x4d29a25d32fa9ef6ULL, },
-        { 0x07832ded1c464b02ULL, 0x6396905709e3cfa4ULL, },    /*  88  */
-        { 0x0ff4a84eab8df3b9ULL, 0x6bc9a7d8c6adf2eaULL, },
-        { 0x21e53326bfbd0b05ULL, 0x8f8f3b9c679dff5aULL, },
-        { 0x191ed6a24e1576f9ULL, 0x9e8c2e402760373aULL, },
-        { 0x19b438400fc27751ULL, 0x819c4bbfd3ee6972ULL, },
-        { 0x1e0d5dc1094ae999ULL, 0x7496a289f5eff010ULL, },
-        { 0x11af620b7bc03943ULL, 0x8a11f229836addc7ULL, },
-        { 0x46fa45d0e84440fcULL, 0xe8d2c0211fb042bfULL, },
-        { 0x22142516b5a8adbcULL, 0xe1cf1923e186aad1ULL, },    /*  96  */
-        { 0x066ebbbb4ff6da44ULL, 0xd918d7e6a7e61877ULL, },
-        { 0x100acc9d22839a48ULL, 0xce291932929e367fULL, },
-        { 0x0dfe419d62a62f64ULL, 0xc020fe45a8cf7acfULL, },
-        { 0x2ba79b6ffbf3c63bULL, 0xb428f52c49fce695ULL, },
-        { 0x29b3b85200bdf100ULL, 0xb4ae7ea2f52aa5b9ULL, },
-        { 0x293bb84d6360c0b6ULL, 0xae33b26e4c493c49ULL, },
-        { 0x46a99fdf54f4862dULL, 0xae790dc5055f6f51ULL, },
-        { 0x18480e0fd728c7c3ULL, 0xa000ad7b15f8ebe0ULL, },    /* 104  */
-        { 0x1b8b97aa205e1239ULL, 0x89c78b8909c4a8e5ULL, },
-        { 0x09abb26b05ef649dULL, 0x74242fa1bd49e740ULL, },
-        { 0x04e233bc861d272bULL, 0x9c5343ab30f62f9fULL, },
-        { 0xda2da0d0884dc3d1ULL, 0xb824f201640b4147ULL, },
-        { 0x9d8b22ee1b9a2e0fULL, 0xb642ddf1edb0747fULL, },
-        { 0x7c81956533686a37ULL, 0xdd5181781dc3ad37ULL, },
-        { 0xc60b1905717ff25aULL, 0xe2af726e71ad7ad7ULL, },
+        { 0x0001000100010001ULL, 0x0001000100010001ULL, },    /*   0  */
+        { 0x0001000100010001ULL, 0x0001000100010001ULL, },
+        { 0x5557555755575557ULL, 0x5557555755575557ULL, },
+        { 0x0002000200020002ULL, 0x0002000200020002ULL, },
+        { 0x3336333633363336ULL, 0x3336333633363336ULL, },
+        { 0x0003000300030003ULL, 0x0003000300030003ULL, },
+        { 0x1c75c72071cb1c75ULL, 0xc72071cb1c75c720ULL, },
+        { 0x0004000400040004ULL, 0x0004000400040004ULL, },
+        { 0x0004000400040004ULL, 0x0004000400040004ULL, },    /*   8  */
+        { 0x0004000400040004ULL, 0x0004000400040004ULL, },
+        { 0x0004000400040004ULL, 0x0004000400040004ULL, },
+        { 0x0004000400040004ULL, 0x0004000400040004ULL, },
+        { 0x0004000400040004ULL, 0x0004000400040004ULL, },
+        { 0x0004000400040004ULL, 0x0004000400040004ULL, },
+        { 0x0004000400040004ULL, 0x0004000400040004ULL, },
+        { 0x0004000400040004ULL, 0x0004000400040004ULL, },
+        { 0x555a555a555a555aULL, 0x555a555a555a555aULL, },    /*  16  */
+        { 0x555a555a555a555aULL, 0x555a555a555a555aULL, },
+        { 0x8e3e8e3e8e3e8e3eULL, 0x8e3e8e3e8e3e8e3eULL, },
+        { 0xaab0aab0aab0aab0ULL, 0xaab0aab0aab0aab0ULL, },
+        { 0x2228222822282228ULL, 0x2228222822282228ULL, },
+        { 0x0006000600060006ULL, 0x0006000600060006ULL, },
+        { 0x685284c4a1366852ULL, 0x84c4a136685284c4ULL, },
+        { 0x555c555c555c555cULL, 0x555c555c555c555cULL, },
+        { 0x0007000700070007ULL, 0x0007000700070007ULL, },    /*  24  */
+        { 0x0007000700070007ULL, 0x0007000700070007ULL, },
+        { 0x1c791c791c791c79ULL, 0x1c791c791c791c79ULL, },
+        { 0xaab2aab2aab2aab2ULL, 0xaab2aab2aab2aab2ULL, },
+        { 0x666e666e666e666eULL, 0x666e666e666e666eULL, },
+        { 0x555d555d555d555dULL, 0x555d555d555d555dULL, },
+        { 0x098397bc25f50983ULL, 0x97bc25f5098397bcULL, },
+        { 0x0008000800080008ULL, 0x0008000800080008ULL, },
+        { 0x333c333c333c333cULL, 0x333c333c333c333cULL, },    /*  32  */
+        { 0x333c333c333c333cULL, 0x333c333c333c333cULL, },
+        { 0xaab4aab4aab4aab4ULL, 0xaab4aab4aab4aab4ULL, },
+        { 0x6670667066706670ULL, 0x6670667066706670ULL, },
+        { 0x2900290029002900ULL, 0x2900290029002900ULL, },
+        { 0x99a499a499a499a4ULL, 0x99a499a499a499a4ULL, },
+        { 0x16ccd2888e4416ccULL, 0xd2888e4416ccd288ULL, },
+        { 0xccd8ccd8ccd8ccd8ULL, 0xccd8ccd8ccd8ccd8ULL, },
+        { 0x99a599a599a599a5ULL, 0x99a599a599a599a5ULL, },    /*  40  */
+        { 0x99a599a599a599a5ULL, 0x99a599a599a599a5ULL, },
+        { 0x7783778377837783ULL, 0x7783778377837783ULL, },
+        { 0x6672667266726672ULL, 0x6672667266726672ULL, },
+        { 0xd716d716d716d716ULL, 0xd716d716d716d716ULL, },
+        { 0x333f333f333f333fULL, 0x333f333f333f333fULL, },
+        { 0xd289c178b067d289ULL, 0xc178b067d289c178ULL, },
+        { 0x000c000c000c000cULL, 0x000c000c000c000cULL, },
+        { 0x1c7ec72971d41c7eULL, 0xc72971d41c7ec729ULL, },    /*  48  */
+        { 0x1c7ec72971d41c7eULL, 0xc72971d41c7ec729ULL, },
+        { 0x84ca4be7130484caULL, 0x4be7130484ca4be7ULL, },
+        { 0x38f08e46e39c38f0ULL, 0x8e46e39c38f08e46ULL, },
+        { 0xb618c72ad83cb618ULL, 0xc72ad83cb618c72aULL, },
+        { 0x5562556355645562ULL, 0x5563556455625563ULL, },
+        { 0x78266eac81a47826ULL, 0x6eac81a478266eacULL, },
+        { 0x71d41c80c72c71d4ULL, 0x1c80c72c71d41c80ULL, },
+        { 0x5563556455655563ULL, 0x5564556555635564ULL, },    /*  56  */
+        { 0x5563556455655563ULL, 0x5564556555635564ULL, },
+        { 0x426d25fc098b426dULL, 0x25fc098b426d25fcULL, },
+        { 0x38f28e48e39e38f2ULL, 0x8e48e39e38f28e48ULL, },
+        { 0xeefe88982232eefeULL, 0x88982232eefe8898ULL, },
+        { 0x1c81c72c71d71c81ULL, 0xc72c71d71c81c72cULL, },
+        { 0x162f7500b75f162fULL, 0x7500b75f162f7500ULL, },
+        { 0x0010001000100010ULL, 0x0010001000100010ULL, },
+        { 0xcbf432a0c5949010ULL, 0x838136944f2980a0ULL, },    /*  64  */
+        { 0xf8a073846fdafa10ULL, 0x81e20820066ea470ULL, },
+        { 0x25e45efce9185a10ULL, 0xd1ca0ec2ee172160ULL, },
+        { 0x9e9a52589fdad390ULL, 0x88c19612bccdc0e0ULL, },
+        { 0xcb46933c4a203d90ULL, 0x8722679e7412e4b0ULL, },
+        { 0xec4ab9850c89add0ULL, 0x31736642d9934cc0ULL, },
+        { 0x15164543016689d0ULL, 0xd2dbe12880283470ULL, },
+        { 0xe4b8e50ad4893e40ULL, 0xb8628f18916689f0ULL, },
+        { 0x11fcd0824dc79e40ULL, 0x084a95ba790f06e0ULL, },    /*  72  */
+        { 0x3ac85c4042a47a40ULL, 0xa9b210a01fa4ee90ULL, },
+        { 0x4a6ce5241805ba40ULL, 0x2ff282a198ddb820ULL, },
+        { 0xda320a46aaa43b40ULL, 0xaa4ae1c91cf38ca0ULL, },
+        { 0x52e8fda26166b4c0ULL, 0x61416919eba92c20ULL, },
+        { 0x228a9d6934896930ULL, 0x46c81709fce781a0ULL, },
+        { 0xb250c28bc728ea30ULL, 0xc120763180fd5620ULL, },
+        { 0xeab115b4cc89b9f4ULL, 0x1e01ac71b6013a20ULL, },
+        { 0x1ffb192480fb3af4ULL, 0x7b68d8ef267cf3a0ULL, },    /*  80  */
+        { 0xf545d210101cbe94ULL, 0xdcc07635cb000520ULL, },
+        { 0x8b8730b052c06494ULL, 0x5ec03300e4000ba0ULL, },
+        { 0xaa30f5a0a980b1acULL, 0x51803b00ac008fa0ULL, },
+        { 0xa21071208c8038acULL, 0x9c00e50050004b20ULL, },
+        { 0x99f03080ba00b20cULL, 0x2000270000007ea0ULL, },
+        { 0xf850658020003c0cULL, 0x2000000000008320ULL, },
+        { 0x9900ed0040001fb4ULL, 0x400000000000b720ULL, },
+        { 0xf300c900c000d0b4ULL, 0x0000000000004ca0ULL, },    /*  88  */
+        { 0x4d00840000004254ULL, 0x000000000000fa20ULL, },
+        { 0x5f002c0000000854ULL, 0x00000000000024a0ULL, },
+        { 0xb00068000000b9ecULL, 0x00000000000048a0ULL, },
+        { 0x90004800000090ecULL, 0x000000000000b020ULL, },
+        { 0x7000200000008c4cULL, 0x0000000000004fa0ULL, },
+        { 0xd00060000000f64cULL, 0x000000000000a820ULL, },
+        { 0x0000400000001974ULL, 0x000000000000fc20ULL, },
+        { 0x000040000000fa74ULL, 0x000000000000cda0ULL, },    /*  96  */
+        { 0x0000400000001b74ULL, 0x0000000000007120ULL, },
+        { 0x0000400000007c74ULL, 0x000000000000bea0ULL, },
+        { 0x0000400000001d74ULL, 0x000000000000ae20ULL, },
+        { 0x0000000000003514ULL, 0x00000000000055a0ULL, },
+        { 0x00000000000069b4ULL, 0x000000000000df20ULL, },
+        { 0x000000000000a354ULL, 0x000000000000c2a0ULL, },
+        { 0x00000000000009f4ULL, 0x0000000000009820ULL, },
+        { 0x0000000000007ff4ULL, 0x0000000000001aa0ULL, },    /* 104  */
+        { 0x000000000000f5f4ULL, 0x0000000000004f20ULL, },
+        { 0x0000000000006bf4ULL, 0x0000000000001da0ULL, },
+        { 0x000000000000e1f4ULL, 0x0000000000008e20ULL, },
+        { 0x000000000000224cULL, 0x000000000000a220ULL, },
+        { 0x000000000000ad74ULL, 0x0000000000003620ULL, },
+        { 0x000000000000eeccULL, 0x0000000000004a20ULL, },
+        { 0x000000000000c8f4ULL, 0x000000000000de20ULL, },
     };
 
     reset_msa_registers();
diff --git a/tests/tcg/mips/user/ase/msa/int-multiply/test_msa_maddv_w.c b/tests/tcg/mips/user/ase/msa/int-multiply/test_msa_maddv_w.c
index 09f01d36b7..bc3f5d246e 100644
--- a/tests/tcg/mips/user/ase/msa/int-multiply/test_msa_maddv_w.c
+++ b/tests/tcg/mips/user/ase/msa/int-multiply/test_msa_maddv_w.c
@@ -43,118 +43,118 @@ int32_t main(void)
 
     uint64_t b128_result[TEST_COUNT_TOTAL][2];
     uint64_t b128_expect[TEST_COUNT_TOTAL][2] = {
-        { 0x0000000000000002ULL, 0x0000000000000002ULL, },    /*   0  */
-        { 0x0000000000000002ULL, 0x0000000000000002ULL, },
-        { 0x00000000aaaaaaaeULL, 0x00000000aaaaaaaeULL, },
-        { 0x0000000000000004ULL, 0x0000000000000004ULL, },
-        { 0x000000006666666cULL, 0x000000006666666cULL, },
-        { 0x0000000000000006ULL, 0x0000000000000006ULL, },
-        { 0x000000008e38e395ULL, 0xffffffffe38e38ebULL, },
-        { 0x0000000000000008ULL, 0x0000000000000008ULL, },
-        { 0x0000000000000008ULL, 0x0000000000000008ULL, },    /*   8  */
-        { 0x0000000000000008ULL, 0x0000000000000008ULL, },
-        { 0x0000000000000008ULL, 0x0000000000000008ULL, },
-        { 0x0000000000000008ULL, 0x0000000000000008ULL, },
-        { 0x0000000000000008ULL, 0x0000000000000008ULL, },
-        { 0x0000000000000008ULL, 0x0000000000000008ULL, },
-        { 0x0000000000000008ULL, 0x0000000000000008ULL, },
-        { 0x0000000000000008ULL, 0x0000000000000008ULL, },
-        { 0x00000000aaaaaab4ULL, 0x00000000aaaaaab4ULL, },    /*  16  */
-        { 0x00000000aaaaaab4ULL, 0x00000000aaaaaab4ULL, },
-        { 0x38e38e3a71c71c7cULL, 0x38e38e3a71c71c7cULL, },
-        { 0x0000000155555560ULL, 0x0000000155555560ULL, },
-        { 0x2222222444444450ULL, 0x2222222444444450ULL, },
-        { 0x000000020000000cULL, 0x000000020000000cULL, },
-        { 0x2f684bdcb425ed16ULL, 0xf684bda397b425faULL, },
-        { 0x00000002aaaaaab8ULL, 0x00000002aaaaaab8ULL, },
-        { 0x000000020000000eULL, 0x000000020000000eULL, },    /*  24  */
-        { 0x000000020000000eULL, 0x000000020000000eULL, },
-        { 0xc71c71c8e38e38f2ULL, 0xc71c71c8e38e38f2ULL, },
-        { 0x0000000155555564ULL, 0x0000000155555564ULL, },
-        { 0xdddddddeccccccdcULL, 0xdddddddeccccccdcULL, },
-        { 0x00000000aaaaaabaULL, 0x00000000aaaaaabaULL, },
-        { 0xd097b42684bda13fULL, 0x097b425ef684bdb1ULL, },
-        { 0x0000000000000010ULL, 0x0000000000000010ULL, },
-        { 0x0000000066666678ULL, 0x0000000066666678ULL, },    /*  32  */
-        { 0x0000000066666678ULL, 0x0000000066666678ULL, },
-        { 0x2222222355555568ULL, 0x2222222355555568ULL, },
-        { 0x00000000cccccce0ULL, 0x00000000cccccce0ULL, },
-        { 0x147ae1491eb85200ULL, 0x147ae1491eb85200ULL, },
-        { 0x0000000133333348ULL, 0x0000000133333348ULL, },
-        { 0x1c71c71e3e93e954ULL, 0xfa4fa4fbb60b60ccULL, },
-        { 0x00000001999999b0ULL, 0x00000001999999b0ULL, },
-        { 0x000000013333334aULL, 0x000000013333334aULL, },    /*  40  */
-        { 0x000000013333334aULL, 0x000000013333334aULL, },
-        { 0xdddddddeeeeeef06ULL, 0xdddddddeeeeeef06ULL, },
-        { 0x00000000cccccce4ULL, 0x00000000cccccce4ULL, },
-        { 0xeb851eb8e147ae2cULL, 0xeb851eb8e147ae2cULL, },
-        { 0x000000006666667eULL, 0x000000006666667eULL, },
-        { 0xe38e38e3e93e9401ULL, 0x05b05b05c71c71dfULL, },
-        { 0x0000000000000018ULL, 0x0000000000000018ULL, },
-        { 0x000000008e38e3a7ULL, 0xffffffffe38e38fdULL, },    /*  48  */
-        { 0x000000008e38e3a7ULL, 0xffffffffe38e38fdULL, },
-        { 0x2f684bdb425ed0b1ULL, 0xf684bda17b425eebULL, },
-        { 0x000000011c71c736ULL, 0xffffffffc71c71e2ULL, },
-        { 0x1c71c71e27d27d42ULL, 0xfa4fa4fa49f49f66ULL, },
-        { 0x00000001aaaaaac5ULL, 0xffffffffaaaaaac7ULL, },
-        { 0x35ba781b4587e6d2ULL, 0x0fcd6e9d6b74f050ULL, },
-        { 0x0000000238e38e54ULL, 0xffffffff8e38e3acULL, },
-        { 0x00000001aaaaaac7ULL, 0xffffffffaaaaaac9ULL, },    /*  56  */
-        { 0x00000001aaaaaac7ULL, 0xffffffffaaaaaac9ULL, },
-        { 0xd097b427a12f6869ULL, 0x097b425ebda12f87ULL, },
-        { 0x000000011c71c73aULL, 0xffffffffc71c71e6ULL, },
-        { 0xe38e38e477777796ULL, 0x05b05b05aaaaaacaULL, },
-        { 0x000000008e38e3adULL, 0xffffffffe38e3903ULL, },
-        { 0xca4587e781948b2fULL, 0xf032916206522c5fULL, },
-        { 0x0000000000000020ULL, 0x0000000000000020ULL, },
-        { 0x3e3ad4ae1266c2b0ULL, 0x1637d725aebdb734ULL, },    /*  64  */
-        { 0x4c74e0d60a3d6d94ULL, 0x1badd2dd9f4dac90ULL, },
-        { 0x6874e8f94205b90cULL, 0x27eb0c41af2c3022ULL, },
-        { 0x42dab657e16f25e8ULL, 0x06d6782e137656f2ULL, },
-        { 0x5114c27fd945d0ccULL, 0x0c4c73e604064c4eULL, },
-        { 0x68a91e898c276755ULL, 0x0f77ad378bdfb302ULL, },
-        { 0x54c82cde41d1cf13ULL, 0x0b6108a5f38e1598ULL, },
-        { 0x6f755d3eddd1234aULL, 0xfbbaace2f5421908ULL, },
-        { 0x8b75656215996ec2ULL, 0x07f7e64705209c9aULL, },    /*  72  */
-        { 0x779473b6cb43d680ULL, 0x03e141b56cceff30ULL, },
-        { 0xa6279a1866fb9f64ULL, 0x2631668db9e53ac1ULL, },
-        { 0x67a1f71bd99e4586ULL, 0x312ec9f6206e6e69ULL, },
-        { 0x4207c47a7907b262ULL, 0x101a35e284b89539ULL, },
-        { 0x5cb4f4db15070699ULL, 0x0073da1f866c98a9ULL, },
-        { 0x1e2f51de87a9acbbULL, 0x0b713d87ecf5cc51ULL, },
-        { 0x721d49ba5f0acfa8ULL, 0x5ba5bbe9afeae691ULL, },
-        { 0x4bcd68690d995de0ULL, 0x771da6b4b6c967ebULL, },    /*  80  */
-        { 0x4ea9a2cfbb5acd7bULL, 0x79dd6a73439e6387ULL, },
-        { 0x47c800b999dd2371ULL, 0x766d25914ef7a7a0ULL, },
-        { 0x41b0fa10eb77cf84ULL, 0x26e85189458965f8ULL, },
-        { 0x1fc448ce062c2944ULL, 0x31f490a9422a80e6ULL, },
-        { 0x211bdfadfd79770eULL, 0x3b25f4cac5763378ULL, },
-        { 0x16fbb87edd87b6f0ULL, 0x57c0b65fabdda20eULL, },
-        { 0x14621091eac4a5f6ULL, 0x4d29a25d32fa9ef6ULL, },
-        { 0x07832ded1c464b02ULL, 0x6396905709e3cfa4ULL, },    /*  88  */
-        { 0x0ff4a84eab8df3b9ULL, 0x6bc9a7d8c6adf2eaULL, },
-        { 0x21e53326bfbd0b05ULL, 0x8f8f3b9c679dff5aULL, },
-        { 0x191ed6a24e1576f9ULL, 0x9e8c2e402760373aULL, },
-        { 0x19b438400fc27751ULL, 0x819c4bbfd3ee6972ULL, },
-        { 0x1e0d5dc1094ae999ULL, 0x7496a289f5eff010ULL, },
-        { 0x11af620b7bc03943ULL, 0x8a11f229836addc7ULL, },
-        { 0x46fa45d0e84440fcULL, 0xe8d2c0211fb042bfULL, },
-        { 0x22142516b5a8adbcULL, 0xe1cf1923e186aad1ULL, },    /*  96  */
-        { 0x066ebbbb4ff6da44ULL, 0xd918d7e6a7e61877ULL, },
-        { 0x100acc9d22839a48ULL, 0xce291932929e367fULL, },
-        { 0x0dfe419d62a62f64ULL, 0xc020fe45a8cf7acfULL, },
-        { 0x2ba79b6ffbf3c63bULL, 0xb428f52c49fce695ULL, },
-        { 0x29b3b85200bdf100ULL, 0xb4ae7ea2f52aa5b9ULL, },
-        { 0x293bb84d6360c0b6ULL, 0xae33b26e4c493c49ULL, },
-        { 0x46a99fdf54f4862dULL, 0xae790dc5055f6f51ULL, },
-        { 0x18480e0fd728c7c3ULL, 0xa000ad7b15f8ebe0ULL, },    /* 104  */
-        { 0x1b8b97aa205e1239ULL, 0x89c78b8909c4a8e5ULL, },
-        { 0x09abb26b05ef649dULL, 0x74242fa1bd49e740ULL, },
-        { 0x04e233bc861d272bULL, 0x9c5343ab30f62f9fULL, },
-        { 0xda2da0d0884dc3d1ULL, 0xb824f201640b4147ULL, },
-        { 0x9d8b22ee1b9a2e0fULL, 0xb642ddf1edb0747fULL, },
-        { 0x7c81956533686a37ULL, 0xdd5181781dc3ad37ULL, },
-        { 0xc60b1905717ff25aULL, 0xe2af726e71ad7ad7ULL, },
+        { 0x0000000100000001ULL, 0x0000000100000001ULL, },    /*   0  */
+        { 0x0000000100000001ULL, 0x0000000100000001ULL, },
+        { 0x5555555755555557ULL, 0x5555555755555557ULL, },
+        { 0x0000000200000002ULL, 0x0000000200000002ULL, },
+        { 0x3333333633333336ULL, 0x3333333633333336ULL, },
+        { 0x0000000300000003ULL, 0x0000000300000003ULL, },
+        { 0x1c71c72071c71c75ULL, 0xc71c71cb1c71c720ULL, },
+        { 0x0000000400000004ULL, 0x0000000400000004ULL, },
+        { 0x0000000400000004ULL, 0x0000000400000004ULL, },    /*   8  */
+        { 0x0000000400000004ULL, 0x0000000400000004ULL, },
+        { 0x0000000400000004ULL, 0x0000000400000004ULL, },
+        { 0x0000000400000004ULL, 0x0000000400000004ULL, },
+        { 0x0000000400000004ULL, 0x0000000400000004ULL, },
+        { 0x0000000400000004ULL, 0x0000000400000004ULL, },
+        { 0x0000000400000004ULL, 0x0000000400000004ULL, },
+        { 0x0000000400000004ULL, 0x0000000400000004ULL, },
+        { 0x5555555a5555555aULL, 0x5555555a5555555aULL, },    /*  16  */
+        { 0x5555555a5555555aULL, 0x5555555a5555555aULL, },
+        { 0x38e38e3e38e38e3eULL, 0x38e38e3e38e38e3eULL, },
+        { 0xaaaaaab0aaaaaab0ULL, 0xaaaaaab0aaaaaab0ULL, },
+        { 0x2222222822222228ULL, 0x2222222822222228ULL, },
+        { 0x0000000600000006ULL, 0x0000000600000006ULL, },
+        { 0x12f684c4a12f6852ULL, 0x84bda13612f684c4ULL, },
+        { 0x5555555c5555555cULL, 0x5555555c5555555cULL, },
+        { 0x0000000700000007ULL, 0x0000000700000007ULL, },    /*  24  */
+        { 0x0000000700000007ULL, 0x0000000700000007ULL, },
+        { 0x71c71c7971c71c79ULL, 0x71c71c7971c71c79ULL, },
+        { 0xaaaaaab2aaaaaab2ULL, 0xaaaaaab2aaaaaab2ULL, },
+        { 0x6666666e6666666eULL, 0x6666666e6666666eULL, },
+        { 0x5555555d5555555dULL, 0x5555555d5555555dULL, },
+        { 0x5ed097bc25ed0983ULL, 0x97b425f55ed097bcULL, },
+        { 0x0000000800000008ULL, 0x0000000800000008ULL, },
+        { 0x3333333c3333333cULL, 0x3333333c3333333cULL, },    /*  32  */
+        { 0x3333333c3333333cULL, 0x3333333c3333333cULL, },
+        { 0xaaaaaab4aaaaaab4ULL, 0xaaaaaab4aaaaaab4ULL, },
+        { 0x6666667066666670ULL, 0x6666667066666670ULL, },
+        { 0x8f5c29008f5c2900ULL, 0x8f5c29008f5c2900ULL, },
+        { 0x999999a4999999a4ULL, 0x999999a4999999a4ULL, },
+        { 0x7d27d288c16c16ccULL, 0x38e38e447d27d288ULL, },
+        { 0xccccccd8ccccccd8ULL, 0xccccccd8ccccccd8ULL, },
+        { 0x999999a5999999a5ULL, 0x999999a5999999a5ULL, },    /*  40  */
+        { 0x999999a5999999a5ULL, 0x999999a5999999a5ULL, },
+        { 0x7777778377777783ULL, 0x7777778377777783ULL, },
+        { 0x6666667266666672ULL, 0x6666667266666672ULL, },
+        { 0x70a3d71670a3d716ULL, 0x70a3d71670a3d716ULL, },
+        { 0x3333333f3333333fULL, 0x3333333f3333333fULL, },
+        { 0x6c16c1787d27d289ULL, 0x5b05b0676c16c178ULL, },
+        { 0x0000000c0000000cULL, 0x0000000c0000000cULL, },
+        { 0x1c71c72971c71c7eULL, 0xc71c71d41c71c729ULL, },    /*  48  */
+        { 0x1c71c72971c71c7eULL, 0xc71c71d41c71c729ULL, },
+        { 0x2f684be712f684caULL, 0x4bda13042f684be7ULL, },
+        { 0x38e38e46e38e38f0ULL, 0x8e38e39c38e38e46ULL, },
+        { 0x1c71c72a0b60b618ULL, 0x2d82d83c1c71c72aULL, },
+        { 0x5555556355555562ULL, 0x5555556455555563ULL, },
+        { 0x0fcd6eac35ba7826ULL, 0x5ba781a40fcd6eacULL, },
+        { 0x71c71c80c71c71d4ULL, 0x1c71c72c71c71c80ULL, },
+        { 0x5555556455555563ULL, 0x5555556555555564ULL, },    /*  56  */
+        { 0x5555556455555563ULL, 0x5555556555555564ULL, },
+        { 0x97b425fc097b426dULL, 0x25ed098b97b425fcULL, },
+        { 0x38e38e48e38e38f2ULL, 0x8e38e39e38e38e48ULL, },
+        { 0x88888898eeeeeefeULL, 0x2222223288888898ULL, },
+        { 0x1c71c72c71c71c81ULL, 0xc71c71d71c71c72cULL, },
+        { 0x7e6b75000329162fULL, 0x87e6b75f7e6b7500ULL, },
+        { 0x0000001000000010ULL, 0x0000001000000010ULL, },
+        { 0xb10332a061639010ULL, 0x3a253694749880a0ULL, },    /*  64  */
+        { 0xc1c27384487afa10ULL, 0xbb9c0820e3b1a470ULL, },
+        { 0x35565efc0caf5a10ULL, 0x735b0ec23bd12160ULL, },
+        { 0xe6475258fb27d390ULL, 0x49d49612c9a1c0e0ULL, },
+        { 0xf706933ce23f3d90ULL, 0xcb4b679e38bae4b0ULL, },
+        { 0xabfab985e02cadd0ULL, 0x0836664283a94cc0ULL, },
+        { 0xa33845439e9989d0ULL, 0x5b9fe12897ee3470ULL, },
+        { 0x1df3e50abfdd3e40ULL, 0x6d858f1887bc89f0ULL, },
+        { 0x9187d08284119e40ULL, 0x254495badfdc06e0ULL, },    /*  72  */
+        { 0x88c55c40427e7a40ULL, 0x78ae10a0f420ee90ULL, },
+        { 0x3f78e5242782ba40ULL, 0x93ad82a12637b820ULL, },
+        { 0x28380a46b1663b40ULL, 0x255be1c9fb128ca0ULL, },
+        { 0xd928fda29fdeb4c0ULL, 0xfbd5691988e32c20ULL, },
+        { 0x53e49d69c1226930ULL, 0x0dbb170978b181a0ULL, },
+        { 0x3ca3c28b4b05ea30ULL, 0x9f6976314d8c5620ULL, },
+        { 0x621b15b4fcefb9f4ULL, 0x7f3fac7130ab3a20ULL, },
+        { 0x81b8192421043af4ULL, 0x7180d8efde07f3a0ULL, },    /*  80  */
+        { 0xa0a1d210b115be94ULL, 0x33a676350e450520ULL, },
+        { 0xe27e30b0181b6494ULL, 0x359b330061c70ba0ULL, },
+        { 0xe0f1f5a03792b1acULL, 0xe6a63b00d5b18fa0ULL, },
+        { 0x38af7120b51538acULL, 0x7938e500aea24b20ULL, },
+        { 0x7a4830802390b20cULL, 0x4b472700af547ea0ULL, },
+        { 0xcc2f6580204a3c0cULL, 0x37510000bd1b8320ULL, },
+        { 0x9ba9ed0066371fb4ULL, 0xeba90000264fb720ULL, },
+        { 0x7400c900846dd0b4ULL, 0xb6b700007c524ca0ULL, },    /*  88  */
+        { 0x7e4e840000744254ULL, 0xf24d00003540fa20ULL, },
+        { 0x242a2c00b0850854ULL, 0xdb00000025db24a0ULL, },
+        { 0x38a168005a7bb9ecULL, 0xa3000000566748a0ULL, },
+        { 0x6cb048001a7d90ecULL, 0x7d0000000a0cb020ULL, },
+        { 0xe4dc2000bd958c4cULL, 0x2f000000f6d44fa0ULL, },
+        { 0xbcc9600018fcf64cULL, 0x000000002ecca820ULL, },
+        { 0x739b4000140b1974ULL, 0x000000009361fc20ULL, },
+        { 0x8ed24000a4acfa74ULL, 0x00000000bcafcda0ULL, },    /*  96  */
+        { 0xc3dd40003f7c1b74ULL, 0x00000000fe2b7120ULL, },
+        { 0x1fac4000f6087c74ULL, 0x00000000e05abea0ULL, },
+        { 0x9e6f40000de21d74ULL, 0x000000001e89ae20ULL, },
+        { 0x637500000f743514ULL, 0x00000000c1b755a0ULL, },
+        { 0xd9b400005ed469b4ULL, 0x000000005dfcdf20ULL, },
+        { 0x0a50000049fea354ULL, 0x000000006b40c2a0ULL, },
+        { 0x07400000982609f4ULL, 0x00000000c2b79820ULL, },
+        { 0x57c00000b2de7ff4ULL, 0x000000006f6c1aa0ULL, },    /* 104  */
+        { 0x1d400000bbe3f5f4ULL, 0x000000001c974f20ULL, },
+        { 0x09c00000a8b66bf4ULL, 0x00000000e1391da0ULL, },
+        { 0x03400000aed5e1f4ULL, 0x0000000094d78e20ULL, },
+        { 0x7d8000009d2e224cULL, 0x00000000ab48a220ULL, },
+        { 0x3d000000b40fad74ULL, 0x00000000c40e3620ULL, },
+        { 0x96000000332aeeccULL, 0x00000000ecf84a20ULL, },
+        { 0xb40000004e1bc8f4ULL, 0x0000000075d6de20ULL, },
     };
 
     reset_msa_registers();
diff --git a/tests/tcg/mips/user/ase/msa/int-multiply/test_msa_msubv_b.c b/tests/tcg/mips/user/ase/msa/int-multiply/test_msa_msubv_b.c
index b68b57f51d..808c49d050 100644
--- a/tests/tcg/mips/user/ase/msa/int-multiply/test_msa_msubv_b.c
+++ b/tests/tcg/mips/user/ase/msa/int-multiply/test_msa_msubv_b.c
@@ -43,118 +43,118 @@ int32_t main(void)
 
     uint64_t b128_result[TEST_COUNT_TOTAL][2];
     uint64_t b128_expect[TEST_COUNT_TOTAL][2] = {
-        { 0x0000000000000002ULL, 0x0000000000000002ULL, },    /*   0  */
-        { 0x0000000000000002ULL, 0x0000000000000002ULL, },
-        { 0x00000000aaaaaaaeULL, 0x00000000aaaaaaaeULL, },
-        { 0x0000000000000004ULL, 0x0000000000000004ULL, },
-        { 0x000000006666666cULL, 0x000000006666666cULL, },
-        { 0x0000000000000006ULL, 0x0000000000000006ULL, },
-        { 0x000000008e38e395ULL, 0xffffffffe38e38ebULL, },
-        { 0x0000000000000008ULL, 0x0000000000000008ULL, },
-        { 0x0000000000000008ULL, 0x0000000000000008ULL, },    /*   8  */
-        { 0x0000000000000008ULL, 0x0000000000000008ULL, },
-        { 0x0000000000000008ULL, 0x0000000000000008ULL, },
-        { 0x0000000000000008ULL, 0x0000000000000008ULL, },
-        { 0x0000000000000008ULL, 0x0000000000000008ULL, },
-        { 0x0000000000000008ULL, 0x0000000000000008ULL, },
-        { 0x0000000000000008ULL, 0x0000000000000008ULL, },
-        { 0x0000000000000008ULL, 0x0000000000000008ULL, },
-        { 0x00000000aaaaaab4ULL, 0x00000000aaaaaab4ULL, },    /*  16  */
-        { 0x00000000aaaaaab4ULL, 0x00000000aaaaaab4ULL, },
-        { 0x38e38e3a71c71c7cULL, 0x38e38e3a71c71c7cULL, },
-        { 0x0000000155555560ULL, 0x0000000155555560ULL, },
-        { 0x2222222444444450ULL, 0x2222222444444450ULL, },
-        { 0x000000020000000cULL, 0x000000020000000cULL, },
-        { 0x2f684bdcb425ed16ULL, 0xf684bda397b425faULL, },
-        { 0x00000002aaaaaab8ULL, 0x00000002aaaaaab8ULL, },
-        { 0x000000020000000eULL, 0x000000020000000eULL, },    /*  24  */
-        { 0x000000020000000eULL, 0x000000020000000eULL, },
-        { 0xc71c71c8e38e38f2ULL, 0xc71c71c8e38e38f2ULL, },
-        { 0x0000000155555564ULL, 0x0000000155555564ULL, },
-        { 0xdddddddeccccccdcULL, 0xdddddddeccccccdcULL, },
-        { 0x00000000aaaaaabaULL, 0x00000000aaaaaabaULL, },
-        { 0xd097b42684bda13fULL, 0x097b425ef684bdb1ULL, },
-        { 0x0000000000000010ULL, 0x0000000000000010ULL, },
-        { 0x0000000066666678ULL, 0x0000000066666678ULL, },    /*  32  */
-        { 0x0000000066666678ULL, 0x0000000066666678ULL, },
-        { 0x2222222355555568ULL, 0x2222222355555568ULL, },
-        { 0x00000000cccccce0ULL, 0x00000000cccccce0ULL, },
-        { 0x147ae1491eb85200ULL, 0x147ae1491eb85200ULL, },
-        { 0x0000000133333348ULL, 0x0000000133333348ULL, },
-        { 0x1c71c71e3e93e954ULL, 0xfa4fa4fbb60b60ccULL, },
-        { 0x00000001999999b0ULL, 0x00000001999999b0ULL, },
-        { 0x000000013333334aULL, 0x000000013333334aULL, },    /*  40  */
-        { 0x000000013333334aULL, 0x000000013333334aULL, },
-        { 0xdddddddeeeeeef06ULL, 0xdddddddeeeeeef06ULL, },
-        { 0x00000000cccccce4ULL, 0x00000000cccccce4ULL, },
-        { 0xeb851eb8e147ae2cULL, 0xeb851eb8e147ae2cULL, },
-        { 0x000000006666667eULL, 0x000000006666667eULL, },
-        { 0xe38e38e3e93e9401ULL, 0x05b05b05c71c71dfULL, },
-        { 0x0000000000000018ULL, 0x0000000000000018ULL, },
-        { 0x000000008e38e3a7ULL, 0xffffffffe38e38fdULL, },    /*  48  */
-        { 0x000000008e38e3a7ULL, 0xffffffffe38e38fdULL, },
-        { 0x2f684bdb425ed0b1ULL, 0xf684bda17b425eebULL, },
-        { 0x000000011c71c736ULL, 0xffffffffc71c71e2ULL, },
-        { 0x1c71c71e27d27d42ULL, 0xfa4fa4fa49f49f66ULL, },
-        { 0x00000001aaaaaac5ULL, 0xffffffffaaaaaac7ULL, },
-        { 0x35ba781b4587e6d2ULL, 0x0fcd6e9d6b74f050ULL, },
-        { 0x0000000238e38e54ULL, 0xffffffff8e38e3acULL, },
-        { 0x00000001aaaaaac7ULL, 0xffffffffaaaaaac9ULL, },    /*  56  */
-        { 0x00000001aaaaaac7ULL, 0xffffffffaaaaaac9ULL, },
-        { 0xd097b427a12f6869ULL, 0x097b425ebda12f87ULL, },
-        { 0x000000011c71c73aULL, 0xffffffffc71c71e6ULL, },
-        { 0xe38e38e477777796ULL, 0x05b05b05aaaaaacaULL, },
-        { 0x000000008e38e3adULL, 0xffffffffe38e3903ULL, },
-        { 0xca4587e781948b2fULL, 0xf032916206522c5fULL, },
-        { 0x0000000000000020ULL, 0x0000000000000020ULL, },
-        { 0x3e3ad4ae1266c2b0ULL, 0x1637d725aebdb734ULL, },    /*  64  */
-        { 0x4c74e0d60a3d6d94ULL, 0x1badd2dd9f4dac90ULL, },
-        { 0x6874e8f94205b90cULL, 0x27eb0c41af2c3022ULL, },
-        { 0x42dab657e16f25e8ULL, 0x06d6782e137656f2ULL, },
-        { 0x5114c27fd945d0ccULL, 0x0c4c73e604064c4eULL, },
-        { 0x68a91e898c276755ULL, 0x0f77ad378bdfb302ULL, },
-        { 0x54c82cde41d1cf13ULL, 0x0b6108a5f38e1598ULL, },
-        { 0x6f755d3eddd1234aULL, 0xfbbaace2f5421908ULL, },
-        { 0x8b75656215996ec2ULL, 0x07f7e64705209c9aULL, },    /*  72  */
-        { 0x779473b6cb43d680ULL, 0x03e141b56cceff30ULL, },
-        { 0xa6279a1866fb9f64ULL, 0x2631668db9e53ac1ULL, },
-        { 0x67a1f71bd99e4586ULL, 0x312ec9f6206e6e69ULL, },
-        { 0x4207c47a7907b262ULL, 0x101a35e284b89539ULL, },
-        { 0x5cb4f4db15070699ULL, 0x0073da1f866c98a9ULL, },
-        { 0x1e2f51de87a9acbbULL, 0x0b713d87ecf5cc51ULL, },
-        { 0x721d49ba5f0acfa8ULL, 0x5ba5bbe9afeae691ULL, },
-        { 0x4bcd68690d995de0ULL, 0x771da6b4b6c967ebULL, },    /*  80  */
-        { 0x4ea9a2cfbb5acd7bULL, 0x79dd6a73439e6387ULL, },
-        { 0x47c800b999dd2371ULL, 0x766d25914ef7a7a0ULL, },
-        { 0x41b0fa10eb77cf84ULL, 0x26e85189458965f8ULL, },
-        { 0x1fc448ce062c2944ULL, 0x31f490a9422a80e6ULL, },
-        { 0x211bdfadfd79770eULL, 0x3b25f4cac5763378ULL, },
-        { 0x16fbb87edd87b6f0ULL, 0x57c0b65fabdda20eULL, },
-        { 0x14621091eac4a5f6ULL, 0x4d29a25d32fa9ef6ULL, },
-        { 0x07832ded1c464b02ULL, 0x6396905709e3cfa4ULL, },    /*  88  */
-        { 0x0ff4a84eab8df3b9ULL, 0x6bc9a7d8c6adf2eaULL, },
-        { 0x21e53326bfbd0b05ULL, 0x8f8f3b9c679dff5aULL, },
-        { 0x191ed6a24e1576f9ULL, 0x9e8c2e402760373aULL, },
-        { 0x19b438400fc27751ULL, 0x819c4bbfd3ee6972ULL, },
-        { 0x1e0d5dc1094ae999ULL, 0x7496a289f5eff010ULL, },
-        { 0x11af620b7bc03943ULL, 0x8a11f229836addc7ULL, },
-        { 0x46fa45d0e84440fcULL, 0xe8d2c0211fb042bfULL, },
-        { 0x22142516b5a8adbcULL, 0xe1cf1923e186aad1ULL, },    /*  96  */
-        { 0x066ebbbb4ff6da44ULL, 0xd918d7e6a7e61877ULL, },
-        { 0x100acc9d22839a48ULL, 0xce291932929e367fULL, },
-        { 0x0dfe419d62a62f64ULL, 0xc020fe45a8cf7acfULL, },
-        { 0x2ba79b6ffbf3c63bULL, 0xb428f52c49fce695ULL, },
-        { 0x29b3b85200bdf100ULL, 0xb4ae7ea2f52aa5b9ULL, },
-        { 0x293bb84d6360c0b6ULL, 0xae33b26e4c493c49ULL, },
-        { 0x46a99fdf54f4862dULL, 0xae790dc5055f6f51ULL, },
-        { 0x18480e0fd728c7c3ULL, 0xa000ad7b15f8ebe0ULL, },    /* 104  */
-        { 0x1b8b97aa205e1239ULL, 0x89c78b8909c4a8e5ULL, },
-        { 0x09abb26b05ef649dULL, 0x74242fa1bd49e740ULL, },
-        { 0x04e233bc861d272bULL, 0x9c5343ab30f62f9fULL, },
-        { 0xda2da0d0884dc3d1ULL, 0xb824f201640b4147ULL, },
-        { 0x9d8b22ee1b9a2e0fULL, 0xb642ddf1edb0747fULL, },
-        { 0x7c81956533686a37ULL, 0xdd5181781dc3ad37ULL, },
-        { 0xc60b1905717ff25aULL, 0xe2af726e71ad7ad7ULL, },
+        { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },    /*   0  */
+        { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+        { 0xa9a9a9a9a9a9a9a9ULL, 0xa9a9a9a9a9a9a9a9ULL, },
+        { 0xfefefefefefefefeULL, 0xfefefefefefefefeULL, },
+        { 0xcacacacacacacacaULL, 0xcacacacacacacacaULL, },
+        { 0xfdfdfdfdfdfdfdfdULL, 0xfdfdfdfdfdfdfdfdULL, },
+        { 0xe08b35e08b35e08bULL, 0x35e08b35e08b35e0ULL, },
+        { 0xfcfcfcfcfcfcfcfcULL, 0xfcfcfcfcfcfcfcfcULL, },
+        { 0xfcfcfcfcfcfcfcfcULL, 0xfcfcfcfcfcfcfcfcULL, },    /*   8  */
+        { 0xfcfcfcfcfcfcfcfcULL, 0xfcfcfcfcfcfcfcfcULL, },
+        { 0xfcfcfcfcfcfcfcfcULL, 0xfcfcfcfcfcfcfcfcULL, },
+        { 0xfcfcfcfcfcfcfcfcULL, 0xfcfcfcfcfcfcfcfcULL, },
+        { 0xfcfcfcfcfcfcfcfcULL, 0xfcfcfcfcfcfcfcfcULL, },
+        { 0xfcfcfcfcfcfcfcfcULL, 0xfcfcfcfcfcfcfcfcULL, },
+        { 0xfcfcfcfcfcfcfcfcULL, 0xfcfcfcfcfcfcfcfcULL, },
+        { 0xfcfcfcfcfcfcfcfcULL, 0xfcfcfcfcfcfcfcfcULL, },
+        { 0xa6a6a6a6a6a6a6a6ULL, 0xa6a6a6a6a6a6a6a6ULL, },    /*  16  */
+        { 0xa6a6a6a6a6a6a6a6ULL, 0xa6a6a6a6a6a6a6a6ULL, },
+        { 0xc2c2c2c2c2c2c2c2ULL, 0xc2c2c2c2c2c2c2c2ULL, },
+        { 0x5050505050505050ULL, 0x5050505050505050ULL, },
+        { 0xd8d8d8d8d8d8d8d8ULL, 0xd8d8d8d8d8d8d8d8ULL, },
+        { 0xfafafafafafafafaULL, 0xfafafafafafafafaULL, },
+        { 0x3caeca3caeca3caeULL, 0xca3caeca3caeca3cULL, },
+        { 0xa4a4a4a4a4a4a4a4ULL, 0xa4a4a4a4a4a4a4a4ULL, },
+        { 0xf9f9f9f9f9f9f9f9ULL, 0xf9f9f9f9f9f9f9f9ULL, },    /*  24  */
+        { 0xf9f9f9f9f9f9f9f9ULL, 0xf9f9f9f9f9f9f9f9ULL, },
+        { 0x8787878787878787ULL, 0x8787878787878787ULL, },
+        { 0x4e4e4e4e4e4e4e4eULL, 0x4e4e4e4e4e4e4e4eULL, },
+        { 0x9292929292929292ULL, 0x9292929292929292ULL, },
+        { 0xa3a3a3a3a3a3a3a3ULL, 0xa3a3a3a3a3a3a3a3ULL, },
+        { 0x447d0b447d0b447dULL, 0x0b447d0b447d0b44ULL, },
+        { 0xf8f8f8f8f8f8f8f8ULL, 0xf8f8f8f8f8f8f8f8ULL, },
+        { 0xc4c4c4c4c4c4c4c4ULL, 0xc4c4c4c4c4c4c4c4ULL, },    /*  32  */
+        { 0xc4c4c4c4c4c4c4c4ULL, 0xc4c4c4c4c4c4c4c4ULL, },
+        { 0x4c4c4c4c4c4c4c4cULL, 0x4c4c4c4c4c4c4c4cULL, },
+        { 0x9090909090909090ULL, 0x9090909090909090ULL, },
+        { 0x0000000000000000ULL, 0x0000000000000000ULL, },
+        { 0x5c5c5c5c5c5c5c5cULL, 0x5c5c5c5c5c5c5c5cULL, },
+        { 0x7834bc7834bc7834ULL, 0xbc7834bc7834bc78ULL, },
+        { 0x2828282828282828ULL, 0x2828282828282828ULL, },
+        { 0x5b5b5b5b5b5b5b5bULL, 0x5b5b5b5b5b5b5b5bULL, },    /*  40  */
+        { 0x5b5b5b5b5b5b5b5bULL, 0x5b5b5b5b5b5b5b5bULL, },
+        { 0x7d7d7d7d7d7d7d7dULL, 0x7d7d7d7d7d7d7d7dULL, },
+        { 0x8e8e8e8e8e8e8e8eULL, 0x8e8e8e8e8e8e8e8eULL, },
+        { 0xeaeaeaeaeaeaeaeaULL, 0xeaeaeaeaeaeaeaeaULL, },
+        { 0xc1c1c1c1c1c1c1c1ULL, 0xc1c1c1c1c1c1c1c1ULL, },
+        { 0x8877998877998877ULL, 0x9988779988779988ULL, },
+        { 0xf4f4f4f4f4f4f4f4ULL, 0xf4f4f4f4f4f4f4f4ULL, },
+        { 0xd7822cd7822cd782ULL, 0x2cd7822cd7822cd7ULL, },    /*  48  */
+        { 0xd7822cd7822cd782ULL, 0x2cd7822cd7822cd7ULL, },
+        { 0x1936fc1936fc1936ULL, 0xfc1936fc1936fc19ULL, },
+        { 0xba1064ba1064ba10ULL, 0x64ba1064ba1064baULL, },
+        { 0xd6e8c4d6e8c4d6e8ULL, 0xc4d6e8c4d6e8c4d6ULL, },
+        { 0x9d9e9c9d9e9c9d9eULL, 0x9c9d9e9c9d9e9c9dULL, },
+        { 0x54da5c54da5c54daULL, 0x5c54da5c54da5c54ULL, },
+        { 0x802cd4802cd4802cULL, 0xd4802cd4802cd480ULL, },
+        { 0x9c9d9b9c9d9b9c9dULL, 0x9b9c9d9b9c9d9b9cULL, },    /*  56  */
+        { 0x9c9d9b9c9d9b9c9dULL, 0x9b9c9d9b9c9d9b9cULL, },
+        { 0x0493750493750493ULL, 0x7504937504937504ULL, },
+        { 0xb80e62b80e62b80eULL, 0x62b80e62b80e62b8ULL, },
+        { 0x6802ce6802ce6802ULL, 0xce6802ce6802ce68ULL, },
+        { 0xd47f29d47f29d47fULL, 0x29d47f29d47f29d4ULL, },
+        { 0x00d1a100d1a100d1ULL, 0xa100d1a100d1a100ULL, },
+        { 0xf0f0f0f0f0f0f0f0ULL, 0xf0f0f0f0f0f0f0f0ULL, },
+        { 0xb00c4c60b06cb7f0ULL, 0xf77f776cecd7f060ULL, },    /*  64  */
+        { 0x58604c7ca826a4f0ULL, 0xb11e6ee016929090ULL, },
+        { 0xf81cf804c0e87df0ULL, 0x4436ec3e6ce920a0ULL, },
+        { 0x786634a810267370ULL, 0xf53f14eebe33c020ULL, },
+        { 0x20ba34c408e06070ULL, 0xafde0b62e8ee6050ULL, },
+        { 0x07b6347bdf77af30ULL, 0x6b8d72be2f6d1c40ULL, },
+        { 0x63ea34bd3a9aa230ULL, 0xad25d0d828d84290ULL, },
+        { 0x934834f6f477f4c0ULL, 0xc39e78e84b9ade10ULL, },
+        { 0x3304e07e0c39cdc0ULL, 0x56b6f646a1f16e20ULL, },    /*  72  */
+        { 0x8f38e0c0675cc0c0ULL, 0x984e54609a5c9470ULL, },
+        { 0xff949cdcb6fb47c0ULL, 0xa70e305f61233be0ULL, },
+        { 0xbfcea8bac85c91c0ULL, 0x2cb600377e0d9160ULL, },
+        { 0x3f18e45e189a8740ULL, 0xddbf28e7d05731e0ULL, },
+        { 0x6f76e497d277d9d0ULL, 0xf338d0f7f319cd60ULL, },
+        { 0x2fb0f075e4d823d0ULL, 0x78e0a0cf100323e0ULL, },
+        { 0x2f4f0c4c60779f0cULL, 0xcfff608f7fff9fe0ULL, },
+        { 0x379944bc60e9d40cULL, 0x2a66400d7d7a4f60ULL, },    /*  80  */
+        { 0x4a0b4408801e08acULL, 0x36fc80bb3c7401e0ULL, },
+        { 0x922d0cb800dcb0acULL, 0xfc5c807628f8dc60ULL, },
+        { 0xb24a046000c05044ULL, 0x30c080e6c008a460ULL, },
+        { 0x22a66ce00040c044ULL, 0x208000724030e4e0ULL, },
+        { 0xcc726c4000808024ULL, 0xe00000de0060dc60ULL, },
+        { 0xbc5e04c000000024ULL, 0xc00000bc004010e0ULL, },
+        { 0x7c5cac000000002cULL, 0x0000001c00c0f0e0ULL, },
+        { 0x9c4424000000002cULL, 0x000000d40080f060ULL, },    /*  88  */
+        { 0xa8cc2400000000ccULL, 0x0000004c000010e0ULL, },
+        { 0xc814ac00000000ccULL, 0x000000980000c060ULL, },
+        { 0x48e8e400000000a4ULL, 0x0000005800004060ULL, },
+        { 0x08d80c00000000a4ULL, 0x00000008000040e0ULL, },
+        { 0x30880c0000000084ULL, 0x000000380000c060ULL, },
+        { 0xf0b8e40000000084ULL, 0x00000070000000e0ULL, },
+        { 0xf0f04c000000004cULL, 0x000000f0000000e0ULL, },
+        { 0x709004000000004cULL, 0x000000d000000060ULL, },    /*  96  */
+        { 0xf0f06c000000004cULL, 0x00000070000000e0ULL, },
+        { 0x709064000000004cULL, 0x0000005000000060ULL, },
+        { 0xf0f08c000000004cULL, 0x000000f0000000e0ULL, },
+        { 0xa0d08c00000000ecULL, 0x0000009000000060ULL, },
+        { 0xc0708c000000008cULL, 0x000000f0000000e0ULL, },
+        { 0x80508c000000002cULL, 0x0000009000000060ULL, },
+        { 0x00f08c00000000ccULL, 0x000000f0000000e0ULL, },
+        { 0x00906400000000ccULL, 0x000000e000000060ULL, },    /* 104  */
+        { 0x00f06c00000000ccULL, 0x000000c0000000e0ULL, },
+        { 0x00900400000000ccULL, 0x0000008000000060ULL, },
+        { 0x00f04c00000000ccULL, 0x00000000000000e0ULL, },
+        { 0x00e0c400000000a4ULL, 0x00000000000000e0ULL, },
+        { 0x00c0ec00000000acULL, 0x00000000000000e0ULL, },
+        { 0x0080a40000000044ULL, 0x00000000000000e0ULL, },
+        { 0x00008c000000008cULL, 0x00000000000000e0ULL, },
     };
 
     reset_msa_registers();
diff --git a/tests/tcg/mips/user/ase/msa/int-multiply/test_msa_msubv_d.c b/tests/tcg/mips/user/ase/msa/int-multiply/test_msa_msubv_d.c
index 5a0549ae3b..9722dbd99f 100644
--- a/tests/tcg/mips/user/ase/msa/int-multiply/test_msa_msubv_d.c
+++ b/tests/tcg/mips/user/ase/msa/int-multiply/test_msa_msubv_d.c
@@ -43,118 +43,118 @@ int32_t main(void)
 
     uint64_t b128_result[TEST_COUNT_TOTAL][2];
     uint64_t b128_expect[TEST_COUNT_TOTAL][2] = {
-        { 0x0000000000000002ULL, 0x0000000000000002ULL, },    /*   0  */
-        { 0x0000000000000002ULL, 0x0000000000000002ULL, },
-        { 0x00000000aaaaaaaeULL, 0x00000000aaaaaaaeULL, },
-        { 0x0000000000000004ULL, 0x0000000000000004ULL, },
-        { 0x000000006666666cULL, 0x000000006666666cULL, },
-        { 0x0000000000000006ULL, 0x0000000000000006ULL, },
-        { 0x000000008e38e395ULL, 0xffffffffe38e38ebULL, },
-        { 0x0000000000000008ULL, 0x0000000000000008ULL, },
-        { 0x0000000000000008ULL, 0x0000000000000008ULL, },    /*   8  */
-        { 0x0000000000000008ULL, 0x0000000000000008ULL, },
-        { 0x0000000000000008ULL, 0x0000000000000008ULL, },
-        { 0x0000000000000008ULL, 0x0000000000000008ULL, },
-        { 0x0000000000000008ULL, 0x0000000000000008ULL, },
-        { 0x0000000000000008ULL, 0x0000000000000008ULL, },
-        { 0x0000000000000008ULL, 0x0000000000000008ULL, },
-        { 0x0000000000000008ULL, 0x0000000000000008ULL, },
-        { 0x00000000aaaaaab4ULL, 0x00000000aaaaaab4ULL, },    /*  16  */
-        { 0x00000000aaaaaab4ULL, 0x00000000aaaaaab4ULL, },
-        { 0x38e38e3a71c71c7cULL, 0x38e38e3a71c71c7cULL, },
-        { 0x0000000155555560ULL, 0x0000000155555560ULL, },
-        { 0x2222222444444450ULL, 0x2222222444444450ULL, },
-        { 0x000000020000000cULL, 0x000000020000000cULL, },
-        { 0x2f684bdcb425ed16ULL, 0xf684bda397b425faULL, },
-        { 0x00000002aaaaaab8ULL, 0x00000002aaaaaab8ULL, },
-        { 0x000000020000000eULL, 0x000000020000000eULL, },    /*  24  */
-        { 0x000000020000000eULL, 0x000000020000000eULL, },
-        { 0xc71c71c8e38e38f2ULL, 0xc71c71c8e38e38f2ULL, },
-        { 0x0000000155555564ULL, 0x0000000155555564ULL, },
-        { 0xdddddddeccccccdcULL, 0xdddddddeccccccdcULL, },
-        { 0x00000000aaaaaabaULL, 0x00000000aaaaaabaULL, },
-        { 0xd097b42684bda13fULL, 0x097b425ef684bdb1ULL, },
-        { 0x0000000000000010ULL, 0x0000000000000010ULL, },
-        { 0x0000000066666678ULL, 0x0000000066666678ULL, },    /*  32  */
-        { 0x0000000066666678ULL, 0x0000000066666678ULL, },
-        { 0x2222222355555568ULL, 0x2222222355555568ULL, },
-        { 0x00000000cccccce0ULL, 0x00000000cccccce0ULL, },
-        { 0x147ae1491eb85200ULL, 0x147ae1491eb85200ULL, },
-        { 0x0000000133333348ULL, 0x0000000133333348ULL, },
-        { 0x1c71c71e3e93e954ULL, 0xfa4fa4fbb60b60ccULL, },
-        { 0x00000001999999b0ULL, 0x00000001999999b0ULL, },
-        { 0x000000013333334aULL, 0x000000013333334aULL, },    /*  40  */
-        { 0x000000013333334aULL, 0x000000013333334aULL, },
-        { 0xdddddddeeeeeef06ULL, 0xdddddddeeeeeef06ULL, },
-        { 0x00000000cccccce4ULL, 0x00000000cccccce4ULL, },
-        { 0xeb851eb8e147ae2cULL, 0xeb851eb8e147ae2cULL, },
-        { 0x000000006666667eULL, 0x000000006666667eULL, },
-        { 0xe38e38e3e93e9401ULL, 0x05b05b05c71c71dfULL, },
-        { 0x0000000000000018ULL, 0x0000000000000018ULL, },
-        { 0x000000008e38e3a7ULL, 0xffffffffe38e38fdULL, },    /*  48  */
-        { 0x000000008e38e3a7ULL, 0xffffffffe38e38fdULL, },
-        { 0x2f684bdb425ed0b1ULL, 0xf684bda17b425eebULL, },
-        { 0x000000011c71c736ULL, 0xffffffffc71c71e2ULL, },
-        { 0x1c71c71e27d27d42ULL, 0xfa4fa4fa49f49f66ULL, },
-        { 0x00000001aaaaaac5ULL, 0xffffffffaaaaaac7ULL, },
-        { 0x35ba781b4587e6d2ULL, 0x0fcd6e9d6b74f050ULL, },
-        { 0x0000000238e38e54ULL, 0xffffffff8e38e3acULL, },
-        { 0x00000001aaaaaac7ULL, 0xffffffffaaaaaac9ULL, },    /*  56  */
-        { 0x00000001aaaaaac7ULL, 0xffffffffaaaaaac9ULL, },
-        { 0xd097b427a12f6869ULL, 0x097b425ebda12f87ULL, },
-        { 0x000000011c71c73aULL, 0xffffffffc71c71e6ULL, },
-        { 0xe38e38e477777796ULL, 0x05b05b05aaaaaacaULL, },
-        { 0x000000008e38e3adULL, 0xffffffffe38e3903ULL, },
-        { 0xca4587e781948b2fULL, 0xf032916206522c5fULL, },
-        { 0x0000000000000020ULL, 0x0000000000000020ULL, },
-        { 0x3e3ad4ae1266c2b0ULL, 0x1637d725aebdb734ULL, },    /*  64  */
-        { 0x4c74e0d60a3d6d94ULL, 0x1badd2dd9f4dac90ULL, },
-        { 0x6874e8f94205b90cULL, 0x27eb0c41af2c3022ULL, },
-        { 0x42dab657e16f25e8ULL, 0x06d6782e137656f2ULL, },
-        { 0x5114c27fd945d0ccULL, 0x0c4c73e604064c4eULL, },
-        { 0x68a91e898c276755ULL, 0x0f77ad378bdfb302ULL, },
-        { 0x54c82cde41d1cf13ULL, 0x0b6108a5f38e1598ULL, },
-        { 0x6f755d3eddd1234aULL, 0xfbbaace2f5421908ULL, },
-        { 0x8b75656215996ec2ULL, 0x07f7e64705209c9aULL, },    /*  72  */
-        { 0x779473b6cb43d680ULL, 0x03e141b56cceff30ULL, },
-        { 0xa6279a1866fb9f64ULL, 0x2631668db9e53ac1ULL, },
-        { 0x67a1f71bd99e4586ULL, 0x312ec9f6206e6e69ULL, },
-        { 0x4207c47a7907b262ULL, 0x101a35e284b89539ULL, },
-        { 0x5cb4f4db15070699ULL, 0x0073da1f866c98a9ULL, },
-        { 0x1e2f51de87a9acbbULL, 0x0b713d87ecf5cc51ULL, },
-        { 0x721d49ba5f0acfa8ULL, 0x5ba5bbe9afeae691ULL, },
-        { 0x4bcd68690d995de0ULL, 0x771da6b4b6c967ebULL, },    /*  80  */
-        { 0x4ea9a2cfbb5acd7bULL, 0x79dd6a73439e6387ULL, },
-        { 0x47c800b999dd2371ULL, 0x766d25914ef7a7a0ULL, },
-        { 0x41b0fa10eb77cf84ULL, 0x26e85189458965f8ULL, },
-        { 0x1fc448ce062c2944ULL, 0x31f490a9422a80e6ULL, },
-        { 0x211bdfadfd79770eULL, 0x3b25f4cac5763378ULL, },
-        { 0x16fbb87edd87b6f0ULL, 0x57c0b65fabdda20eULL, },
-        { 0x14621091eac4a5f6ULL, 0x4d29a25d32fa9ef6ULL, },
-        { 0x07832ded1c464b02ULL, 0x6396905709e3cfa4ULL, },    /*  88  */
-        { 0x0ff4a84eab8df3b9ULL, 0x6bc9a7d8c6adf2eaULL, },
-        { 0x21e53326bfbd0b05ULL, 0x8f8f3b9c679dff5aULL, },
-        { 0x191ed6a24e1576f9ULL, 0x9e8c2e402760373aULL, },
-        { 0x19b438400fc27751ULL, 0x819c4bbfd3ee6972ULL, },
-        { 0x1e0d5dc1094ae999ULL, 0x7496a289f5eff010ULL, },
-        { 0x11af620b7bc03943ULL, 0x8a11f229836addc7ULL, },
-        { 0x46fa45d0e84440fcULL, 0xe8d2c0211fb042bfULL, },
-        { 0x22142516b5a8adbcULL, 0xe1cf1923e186aad1ULL, },    /*  96  */
-        { 0x066ebbbb4ff6da44ULL, 0xd918d7e6a7e61877ULL, },
-        { 0x100acc9d22839a48ULL, 0xce291932929e367fULL, },
-        { 0x0dfe419d62a62f64ULL, 0xc020fe45a8cf7acfULL, },
-        { 0x2ba79b6ffbf3c63bULL, 0xb428f52c49fce695ULL, },
-        { 0x29b3b85200bdf100ULL, 0xb4ae7ea2f52aa5b9ULL, },
-        { 0x293bb84d6360c0b6ULL, 0xae33b26e4c493c49ULL, },
-        { 0x46a99fdf54f4862dULL, 0xae790dc5055f6f51ULL, },
-        { 0x18480e0fd728c7c3ULL, 0xa000ad7b15f8ebe0ULL, },    /* 104  */
-        { 0x1b8b97aa205e1239ULL, 0x89c78b8909c4a8e5ULL, },
-        { 0x09abb26b05ef649dULL, 0x74242fa1bd49e740ULL, },
-        { 0x04e233bc861d272bULL, 0x9c5343ab30f62f9fULL, },
-        { 0xda2da0d0884dc3d1ULL, 0xb824f201640b4147ULL, },
-        { 0x9d8b22ee1b9a2e0fULL, 0xb642ddf1edb0747fULL, },
-        { 0x7c81956533686a37ULL, 0xdd5181781dc3ad37ULL, },
-        { 0xc60b1905717ff25aULL, 0xe2af726e71ad7ad7ULL, },
+        { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },    /*   0  */
+        { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+        { 0xaaaaaaaaaaaaaaa9ULL, 0xaaaaaaaaaaaaaaa9ULL, },
+        { 0xfffffffffffffffeULL, 0xfffffffffffffffeULL, },
+        { 0xcccccccccccccccaULL, 0xcccccccccccccccaULL, },
+        { 0xfffffffffffffffdULL, 0xfffffffffffffffdULL, },
+        { 0xe38e38e38e38e38bULL, 0x38e38e38e38e38e0ULL, },
+        { 0xfffffffffffffffcULL, 0xfffffffffffffffcULL, },
+        { 0xfffffffffffffffcULL, 0xfffffffffffffffcULL, },    /*   8  */
+        { 0xfffffffffffffffcULL, 0xfffffffffffffffcULL, },
+        { 0xfffffffffffffffcULL, 0xfffffffffffffffcULL, },
+        { 0xfffffffffffffffcULL, 0xfffffffffffffffcULL, },
+        { 0xfffffffffffffffcULL, 0xfffffffffffffffcULL, },
+        { 0xfffffffffffffffcULL, 0xfffffffffffffffcULL, },
+        { 0xfffffffffffffffcULL, 0xfffffffffffffffcULL, },
+        { 0xfffffffffffffffcULL, 0xfffffffffffffffcULL, },
+        { 0xaaaaaaaaaaaaaaa6ULL, 0xaaaaaaaaaaaaaaa6ULL, },    /*  16  */
+        { 0xaaaaaaaaaaaaaaa6ULL, 0xaaaaaaaaaaaaaaa6ULL, },
+        { 0x71c71c71c71c71c2ULL, 0x71c71c71c71c71c2ULL, },
+        { 0x5555555555555550ULL, 0x5555555555555550ULL, },
+        { 0xddddddddddddddd8ULL, 0xddddddddddddddd8ULL, },
+        { 0xfffffffffffffffaULL, 0xfffffffffffffffaULL, },
+        { 0xed097b425ed097aeULL, 0xd097b425ed097b3cULL, },
+        { 0xaaaaaaaaaaaaaaa4ULL, 0xaaaaaaaaaaaaaaa4ULL, },
+        { 0xfffffffffffffff9ULL, 0xfffffffffffffff9ULL, },    /*  24  */
+        { 0xfffffffffffffff9ULL, 0xfffffffffffffff9ULL, },
+        { 0xe38e38e38e38e387ULL, 0xe38e38e38e38e387ULL, },
+        { 0x555555555555554eULL, 0x555555555555554eULL, },
+        { 0x9999999999999992ULL, 0x9999999999999992ULL, },
+        { 0xaaaaaaaaaaaaaaa3ULL, 0xaaaaaaaaaaaaaaa3ULL, },
+        { 0xa12f684bda12f67dULL, 0x12f684bda12f6844ULL, },
+        { 0xfffffffffffffff8ULL, 0xfffffffffffffff8ULL, },
+        { 0xccccccccccccccc4ULL, 0xccccccccccccccc4ULL, },    /*  32  */
+        { 0xccccccccccccccc4ULL, 0xccccccccccccccc4ULL, },
+        { 0x555555555555554cULL, 0x555555555555554cULL, },
+        { 0x9999999999999990ULL, 0x9999999999999990ULL, },
+        { 0xa3d70a3d70a3d700ULL, 0xa3d70a3d70a3d700ULL, },
+        { 0x666666666666665cULL, 0x666666666666665cULL, },
+        { 0xe93e93e93e93e934ULL, 0x2d82d82d82d82d78ULL, },
+        { 0x3333333333333328ULL, 0x3333333333333328ULL, },
+        { 0x666666666666665bULL, 0x666666666666665bULL, },    /*  40  */
+        { 0x666666666666665bULL, 0x666666666666665bULL, },
+        { 0x888888888888887dULL, 0x888888888888887dULL, },
+        { 0x999999999999998eULL, 0x999999999999998eULL, },
+        { 0x5c28f5c28f5c28eaULL, 0x5c28f5c28f5c28eaULL, },
+        { 0xccccccccccccccc1ULL, 0xccccccccccccccc1ULL, },
+        { 0x2d82d82d82d82d77ULL, 0x3e93e93e93e93e88ULL, },
+        { 0xfffffffffffffff4ULL, 0xfffffffffffffff4ULL, },
+        { 0xe38e38e38e38e382ULL, 0x38e38e38e38e38d7ULL, },    /*  48  */
+        { 0xe38e38e38e38e382ULL, 0x38e38e38e38e38d7ULL, },
+        { 0xd097b425ed097b36ULL, 0x097b425ed097b419ULL, },
+        { 0xc71c71c71c71c710ULL, 0x71c71c71c71c71baULL, },
+        { 0x49f49f49f49f49e8ULL, 0x38e38e38e38e38d6ULL, },
+        { 0xaaaaaaaaaaaaaa9eULL, 0xaaaaaaaaaaaaaa9dULL, },
+        { 0xf9add3c0ca4587daULL, 0x587e6b74f0329154ULL, },
+        { 0x8e38e38e38e38e2cULL, 0xe38e38e38e38e380ULL, },
+        { 0xaaaaaaaaaaaaaa9dULL, 0xaaaaaaaaaaaaaa9cULL, },    /*  56  */
+        { 0xaaaaaaaaaaaaaa9dULL, 0xaaaaaaaaaaaaaa9cULL, },
+        { 0x684bda12f684bd93ULL, 0x84bda12f684bda04ULL, },
+        { 0xc71c71c71c71c70eULL, 0x71c71c71c71c71b8ULL, },
+        { 0x1111111111111102ULL, 0x7777777777777768ULL, },
+        { 0xe38e38e38e38e37fULL, 0x38e38e38e38e38d4ULL, },
+        { 0x781948b0fcd6e9d1ULL, 0xc3f35ba781948b00ULL, },
+        { 0xfffffffffffffff0ULL, 0xfffffffffffffff0ULL, },
+        { 0x52ba41969e9c6ff0ULL, 0xcd6802158b677f60ULL, },    /*  64  */
+        { 0x63129bf5b78505f0ULL, 0x1556f7f61c4e5b90ULL, },
+        { 0x5a4c8855f350a5f0ULL, 0x6a36586fc42edea0ULL, },
+        { 0x5e6b001b04d82c70ULL, 0xe819332c365e3f20ULL, },
+        { 0x6ec35a7a1dc0c270ULL, 0x3008290cc7451b50ULL, },
+        { 0x37152f411fd35230ULL, 0xc7e3b2957c56b340ULL, },
+        { 0xcc49f1d861667630ULL, 0x1808e0646811cb90ULL, },
+        { 0xde8a7f544022c1c0ULL, 0x9886bc9978437610ULL, },
+        { 0xd5c46bb47bee61c0ULL, 0xed661d132023f920ULL, },    /*  72  */
+        { 0x6af92e4bbd8185c0ULL, 0x3d8b4ae20bdf1170ULL, },
+        { 0xe4d44869d87d45c0ULL, 0x6409d23bd9c847e0ULL, },
+        { 0x6e2e9ce94e99c4c0ULL, 0xc30837db04ed7360ULL, },
+        { 0x724d14ae60214b40ULL, 0x40eb1297771cd3e0ULL, },
+        { 0x848da22a3edd96d0ULL, 0xc168eecc874e7e60ULL, },
+        { 0x0de7f6a9b4fa15d0ULL, 0x2067546bb273a9e0ULL, },
+        { 0xc233bfd40310460cULL, 0x0d9585bacf54c5e0ULL, },
+        { 0x061015122724c70cULL, 0x0169d01f7cb17f60ULL, },    /*  80  */
+        { 0x23dacc726f603aacULL, 0xf3ea8c4eaa8b5ce0ULL, },
+        { 0xd82df953c25380acULL, 0xba87b7f0f99bbb60ULL, },
+        { 0x546cb94a0c5e7444ULL, 0x3818c320ce1bdf60ULL, },
+        { 0xa38f9428761ecf44ULL, 0x63113b9e681b66e0ULL, },
+        { 0x7dc23fbe59fe7924ULL, 0x156ddd68750e6260ULL, },
+        { 0x8a17717d36df5b24ULL, 0x36b1f5939596d2e0ULL, },
+        { 0x7e854cd9a677ce2cULL, 0xf2b6202eb36946e0ULL, },
+        { 0x246d8d067437a72cULL, 0x04c6347e9c1ff460ULL, },    /*  88  */
+        { 0xc48a013a554339ccULL, 0xcb81fd31acc4a5e0ULL, },
+        { 0xb971282c0b508fccULL, 0x20d62d6344ce5060ULL, },
+        { 0x835f812f0bc6a7a4ULL, 0x17bd6b5a08275460ULL, },
+        { 0xc0ee1b9557ab4aa4ULL, 0x170471a9d22d5fe0ULL, },
+        { 0xc6f66d89431f7984ULL, 0x5c6f5a646cad3f60ULL, },
+        { 0x5ae0b289f6ac0b84ULL, 0x6f9f6bc81fdb6be0ULL, },
+        { 0x2f584ee03fd2014cULL, 0xa7e34ccbd1bc3fe0ULL, },
+        { 0x5947927731cb724cULL, 0xf76af1f9a05f4160ULL, },    /*  96  */
+        { 0x68112ad490e3a34cULL, 0x7f944a22f5d630e0ULL, },
+        { 0x1cf6705c5faa944cULL, 0x801292d47291e660ULL, },
+        { 0x5519f2782cb0454cULL, 0x3d691c2dd53919e0ULL, },
+        { 0xe5c979861aac06ecULL, 0x585247d6e899e160ULL, },
+        { 0x2450b27896665b8cULL, 0x8276d8ad504f46e0ULL, },
+        { 0x2716d456a4a5ab2cULL, 0x46e1f3460c71c260ULL, },
+        { 0x5751460331251dccULL, 0xdc1dc7a4a693abe0ULL, },
+        { 0x3bf387b7f37473ccULL, 0x8efb4ff7cc92de60ULL, },    /* 104  */
+        { 0xc3103a3df066c9ccULL, 0x7d3b07351cd59ee0ULL, },
+        { 0x0d612554557c1fccULL, 0x5dbabfc2ac8ed560ULL, },
+        { 0x1cd018ef103475ccULL, 0xca277277956f49e0ULL, },
+        { 0x15d520225c2e79a4ULL, 0x08f2025804e95de0ULL, },
+        { 0x820f9c65be3ea1acULL, 0x37094edbda6ef1e0ULL, },
+        { 0x0f18515c62838744ULL, 0xcfbd4b5627d005e0ULL, },
+        { 0x11d549f26502488cULL, 0x8de999d53cdc99e0ULL, },
     };
 
     reset_msa_registers();
diff --git a/tests/tcg/mips/user/ase/msa/int-multiply/test_msa_msubv_h.c b/tests/tcg/mips/user/ase/msa/int-multiply/test_msa_msubv_h.c
index 17bccc8ad1..6c059c779c 100644
--- a/tests/tcg/mips/user/ase/msa/int-multiply/test_msa_msubv_h.c
+++ b/tests/tcg/mips/user/ase/msa/int-multiply/test_msa_msubv_h.c
@@ -43,118 +43,118 @@ int32_t main(void)
 
     uint64_t b128_result[TEST_COUNT_TOTAL][2];
     uint64_t b128_expect[TEST_COUNT_TOTAL][2] = {
-        { 0x0000000000000002ULL, 0x0000000000000002ULL, },    /*   0  */
-        { 0x0000000000000002ULL, 0x0000000000000002ULL, },
-        { 0x00000000aaaaaaaeULL, 0x00000000aaaaaaaeULL, },
-        { 0x0000000000000004ULL, 0x0000000000000004ULL, },
-        { 0x000000006666666cULL, 0x000000006666666cULL, },
-        { 0x0000000000000006ULL, 0x0000000000000006ULL, },
-        { 0x000000008e38e395ULL, 0xffffffffe38e38ebULL, },
-        { 0x0000000000000008ULL, 0x0000000000000008ULL, },
-        { 0x0000000000000008ULL, 0x0000000000000008ULL, },    /*   8  */
-        { 0x0000000000000008ULL, 0x0000000000000008ULL, },
-        { 0x0000000000000008ULL, 0x0000000000000008ULL, },
-        { 0x0000000000000008ULL, 0x0000000000000008ULL, },
-        { 0x0000000000000008ULL, 0x0000000000000008ULL, },
-        { 0x0000000000000008ULL, 0x0000000000000008ULL, },
-        { 0x0000000000000008ULL, 0x0000000000000008ULL, },
-        { 0x0000000000000008ULL, 0x0000000000000008ULL, },
-        { 0x00000000aaaaaab4ULL, 0x00000000aaaaaab4ULL, },    /*  16  */
-        { 0x00000000aaaaaab4ULL, 0x00000000aaaaaab4ULL, },
-        { 0x38e38e3a71c71c7cULL, 0x38e38e3a71c71c7cULL, },
-        { 0x0000000155555560ULL, 0x0000000155555560ULL, },
-        { 0x2222222444444450ULL, 0x2222222444444450ULL, },
-        { 0x000000020000000cULL, 0x000000020000000cULL, },
-        { 0x2f684bdcb425ed16ULL, 0xf684bda397b425faULL, },
-        { 0x00000002aaaaaab8ULL, 0x00000002aaaaaab8ULL, },
-        { 0x000000020000000eULL, 0x000000020000000eULL, },    /*  24  */
-        { 0x000000020000000eULL, 0x000000020000000eULL, },
-        { 0xc71c71c8e38e38f2ULL, 0xc71c71c8e38e38f2ULL, },
-        { 0x0000000155555564ULL, 0x0000000155555564ULL, },
-        { 0xdddddddeccccccdcULL, 0xdddddddeccccccdcULL, },
-        { 0x00000000aaaaaabaULL, 0x00000000aaaaaabaULL, },
-        { 0xd097b42684bda13fULL, 0x097b425ef684bdb1ULL, },
-        { 0x0000000000000010ULL, 0x0000000000000010ULL, },
-        { 0x0000000066666678ULL, 0x0000000066666678ULL, },    /*  32  */
-        { 0x0000000066666678ULL, 0x0000000066666678ULL, },
-        { 0x2222222355555568ULL, 0x2222222355555568ULL, },
-        { 0x00000000cccccce0ULL, 0x00000000cccccce0ULL, },
-        { 0x147ae1491eb85200ULL, 0x147ae1491eb85200ULL, },
-        { 0x0000000133333348ULL, 0x0000000133333348ULL, },
-        { 0x1c71c71e3e93e954ULL, 0xfa4fa4fbb60b60ccULL, },
-        { 0x00000001999999b0ULL, 0x00000001999999b0ULL, },
-        { 0x000000013333334aULL, 0x000000013333334aULL, },    /*  40  */
-        { 0x000000013333334aULL, 0x000000013333334aULL, },
-        { 0xdddddddeeeeeef06ULL, 0xdddddddeeeeeef06ULL, },
-        { 0x00000000cccccce4ULL, 0x00000000cccccce4ULL, },
-        { 0xeb851eb8e147ae2cULL, 0xeb851eb8e147ae2cULL, },
-        { 0x000000006666667eULL, 0x000000006666667eULL, },
-        { 0xe38e38e3e93e9401ULL, 0x05b05b05c71c71dfULL, },
-        { 0x0000000000000018ULL, 0x0000000000000018ULL, },
-        { 0x000000008e38e3a7ULL, 0xffffffffe38e38fdULL, },    /*  48  */
-        { 0x000000008e38e3a7ULL, 0xffffffffe38e38fdULL, },
-        { 0x2f684bdb425ed0b1ULL, 0xf684bda17b425eebULL, },
-        { 0x000000011c71c736ULL, 0xffffffffc71c71e2ULL, },
-        { 0x1c71c71e27d27d42ULL, 0xfa4fa4fa49f49f66ULL, },
-        { 0x00000001aaaaaac5ULL, 0xffffffffaaaaaac7ULL, },
-        { 0x35ba781b4587e6d2ULL, 0x0fcd6e9d6b74f050ULL, },
-        { 0x0000000238e38e54ULL, 0xffffffff8e38e3acULL, },
-        { 0x00000001aaaaaac7ULL, 0xffffffffaaaaaac9ULL, },    /*  56  */
-        { 0x00000001aaaaaac7ULL, 0xffffffffaaaaaac9ULL, },
-        { 0xd097b427a12f6869ULL, 0x097b425ebda12f87ULL, },
-        { 0x000000011c71c73aULL, 0xffffffffc71c71e6ULL, },
-        { 0xe38e38e477777796ULL, 0x05b05b05aaaaaacaULL, },
-        { 0x000000008e38e3adULL, 0xffffffffe38e3903ULL, },
-        { 0xca4587e781948b2fULL, 0xf032916206522c5fULL, },
-        { 0x0000000000000020ULL, 0x0000000000000020ULL, },
-        { 0x3e3ad4ae1266c2b0ULL, 0x1637d725aebdb734ULL, },    /*  64  */
-        { 0x4c74e0d60a3d6d94ULL, 0x1badd2dd9f4dac90ULL, },
-        { 0x6874e8f94205b90cULL, 0x27eb0c41af2c3022ULL, },
-        { 0x42dab657e16f25e8ULL, 0x06d6782e137656f2ULL, },
-        { 0x5114c27fd945d0ccULL, 0x0c4c73e604064c4eULL, },
-        { 0x68a91e898c276755ULL, 0x0f77ad378bdfb302ULL, },
-        { 0x54c82cde41d1cf13ULL, 0x0b6108a5f38e1598ULL, },
-        { 0x6f755d3eddd1234aULL, 0xfbbaace2f5421908ULL, },
-        { 0x8b75656215996ec2ULL, 0x07f7e64705209c9aULL, },    /*  72  */
-        { 0x779473b6cb43d680ULL, 0x03e141b56cceff30ULL, },
-        { 0xa6279a1866fb9f64ULL, 0x2631668db9e53ac1ULL, },
-        { 0x67a1f71bd99e4586ULL, 0x312ec9f6206e6e69ULL, },
-        { 0x4207c47a7907b262ULL, 0x101a35e284b89539ULL, },
-        { 0x5cb4f4db15070699ULL, 0x0073da1f866c98a9ULL, },
-        { 0x1e2f51de87a9acbbULL, 0x0b713d87ecf5cc51ULL, },
-        { 0x721d49ba5f0acfa8ULL, 0x5ba5bbe9afeae691ULL, },
-        { 0x4bcd68690d995de0ULL, 0x771da6b4b6c967ebULL, },    /*  80  */
-        { 0x4ea9a2cfbb5acd7bULL, 0x79dd6a73439e6387ULL, },
-        { 0x47c800b999dd2371ULL, 0x766d25914ef7a7a0ULL, },
-        { 0x41b0fa10eb77cf84ULL, 0x26e85189458965f8ULL, },
-        { 0x1fc448ce062c2944ULL, 0x31f490a9422a80e6ULL, },
-        { 0x211bdfadfd79770eULL, 0x3b25f4cac5763378ULL, },
-        { 0x16fbb87edd87b6f0ULL, 0x57c0b65fabdda20eULL, },
-        { 0x14621091eac4a5f6ULL, 0x4d29a25d32fa9ef6ULL, },
-        { 0x07832ded1c464b02ULL, 0x6396905709e3cfa4ULL, },    /*  88  */
-        { 0x0ff4a84eab8df3b9ULL, 0x6bc9a7d8c6adf2eaULL, },
-        { 0x21e53326bfbd0b05ULL, 0x8f8f3b9c679dff5aULL, },
-        { 0x191ed6a24e1576f9ULL, 0x9e8c2e402760373aULL, },
-        { 0x19b438400fc27751ULL, 0x819c4bbfd3ee6972ULL, },
-        { 0x1e0d5dc1094ae999ULL, 0x7496a289f5eff010ULL, },
-        { 0x11af620b7bc03943ULL, 0x8a11f229836addc7ULL, },
-        { 0x46fa45d0e84440fcULL, 0xe8d2c0211fb042bfULL, },
-        { 0x22142516b5a8adbcULL, 0xe1cf1923e186aad1ULL, },    /*  96  */
-        { 0x066ebbbb4ff6da44ULL, 0xd918d7e6a7e61877ULL, },
-        { 0x100acc9d22839a48ULL, 0xce291932929e367fULL, },
-        { 0x0dfe419d62a62f64ULL, 0xc020fe45a8cf7acfULL, },
-        { 0x2ba79b6ffbf3c63bULL, 0xb428f52c49fce695ULL, },
-        { 0x29b3b85200bdf100ULL, 0xb4ae7ea2f52aa5b9ULL, },
-        { 0x293bb84d6360c0b6ULL, 0xae33b26e4c493c49ULL, },
-        { 0x46a99fdf54f4862dULL, 0xae790dc5055f6f51ULL, },
-        { 0x18480e0fd728c7c3ULL, 0xa000ad7b15f8ebe0ULL, },    /* 104  */
-        { 0x1b8b97aa205e1239ULL, 0x89c78b8909c4a8e5ULL, },
-        { 0x09abb26b05ef649dULL, 0x74242fa1bd49e740ULL, },
-        { 0x04e233bc861d272bULL, 0x9c5343ab30f62f9fULL, },
-        { 0xda2da0d0884dc3d1ULL, 0xb824f201640b4147ULL, },
-        { 0x9d8b22ee1b9a2e0fULL, 0xb642ddf1edb0747fULL, },
-        { 0x7c81956533686a37ULL, 0xdd5181781dc3ad37ULL, },
-        { 0xc60b1905717ff25aULL, 0xe2af726e71ad7ad7ULL, },
+        { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },    /*   0  */
+        { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+        { 0xaaa9aaa9aaa9aaa9ULL, 0xaaa9aaa9aaa9aaa9ULL, },
+        { 0xfffefffefffefffeULL, 0xfffefffefffefffeULL, },
+        { 0xcccacccacccacccaULL, 0xcccacccacccacccaULL, },
+        { 0xfffdfffdfffdfffdULL, 0xfffdfffdfffdfffdULL, },
+        { 0xe38b38e08e35e38bULL, 0x38e08e35e38b38e0ULL, },
+        { 0xfffcfffcfffcfffcULL, 0xfffcfffcfffcfffcULL, },
+        { 0xfffcfffcfffcfffcULL, 0xfffcfffcfffcfffcULL, },    /*   8  */
+        { 0xfffcfffcfffcfffcULL, 0xfffcfffcfffcfffcULL, },
+        { 0xfffcfffcfffcfffcULL, 0xfffcfffcfffcfffcULL, },
+        { 0xfffcfffcfffcfffcULL, 0xfffcfffcfffcfffcULL, },
+        { 0xfffcfffcfffcfffcULL, 0xfffcfffcfffcfffcULL, },
+        { 0xfffcfffcfffcfffcULL, 0xfffcfffcfffcfffcULL, },
+        { 0xfffcfffcfffcfffcULL, 0xfffcfffcfffcfffcULL, },
+        { 0xfffcfffcfffcfffcULL, 0xfffcfffcfffcfffcULL, },
+        { 0xaaa6aaa6aaa6aaa6ULL, 0xaaa6aaa6aaa6aaa6ULL, },    /*  16  */
+        { 0xaaa6aaa6aaa6aaa6ULL, 0xaaa6aaa6aaa6aaa6ULL, },
+        { 0x71c271c271c271c2ULL, 0x71c271c271c271c2ULL, },
+        { 0x5550555055505550ULL, 0x5550555055505550ULL, },
+        { 0xddd8ddd8ddd8ddd8ULL, 0xddd8ddd8ddd8ddd8ULL, },
+        { 0xfffafffafffafffaULL, 0xfffafffafffafffaULL, },
+        { 0x97ae7b3c5eca97aeULL, 0x7b3c5eca97ae7b3cULL, },
+        { 0xaaa4aaa4aaa4aaa4ULL, 0xaaa4aaa4aaa4aaa4ULL, },
+        { 0xfff9fff9fff9fff9ULL, 0xfff9fff9fff9fff9ULL, },    /*  24  */
+        { 0xfff9fff9fff9fff9ULL, 0xfff9fff9fff9fff9ULL, },
+        { 0xe387e387e387e387ULL, 0xe387e387e387e387ULL, },
+        { 0x554e554e554e554eULL, 0x554e554e554e554eULL, },
+        { 0x9992999299929992ULL, 0x9992999299929992ULL, },
+        { 0xaaa3aaa3aaa3aaa3ULL, 0xaaa3aaa3aaa3aaa3ULL, },
+        { 0xf67d6844da0bf67dULL, 0x6844da0bf67d6844ULL, },
+        { 0xfff8fff8fff8fff8ULL, 0xfff8fff8fff8fff8ULL, },
+        { 0xccc4ccc4ccc4ccc4ULL, 0xccc4ccc4ccc4ccc4ULL, },    /*  32  */
+        { 0xccc4ccc4ccc4ccc4ULL, 0xccc4ccc4ccc4ccc4ULL, },
+        { 0x554c554c554c554cULL, 0x554c554c554c554cULL, },
+        { 0x9990999099909990ULL, 0x9990999099909990ULL, },
+        { 0xd700d700d700d700ULL, 0xd700d700d700d700ULL, },
+        { 0x665c665c665c665cULL, 0x665c665c665c665cULL, },
+        { 0xe9342d7871bce934ULL, 0x2d7871bce9342d78ULL, },
+        { 0x3328332833283328ULL, 0x3328332833283328ULL, },
+        { 0x665b665b665b665bULL, 0x665b665b665b665bULL, },    /*  40  */
+        { 0x665b665b665b665bULL, 0x665b665b665b665bULL, },
+        { 0x887d887d887d887dULL, 0x887d887d887d887dULL, },
+        { 0x998e998e998e998eULL, 0x998e998e998e998eULL, },
+        { 0x28ea28ea28ea28eaULL, 0x28ea28ea28ea28eaULL, },
+        { 0xccc1ccc1ccc1ccc1ULL, 0xccc1ccc1ccc1ccc1ULL, },
+        { 0x2d773e884f992d77ULL, 0x3e884f992d773e88ULL, },
+        { 0xfff4fff4fff4fff4ULL, 0xfff4fff4fff4fff4ULL, },
+        { 0xe38238d78e2ce382ULL, 0x38d78e2ce38238d7ULL, },    /*  48  */
+        { 0xe38238d78e2ce382ULL, 0x38d78e2ce38238d7ULL, },
+        { 0x7b36b419ecfc7b36ULL, 0xb419ecfc7b36b419ULL, },
+        { 0xc71071ba1c64c710ULL, 0x71ba1c64c71071baULL, },
+        { 0x49e838d627c449e8ULL, 0x38d627c449e838d6ULL, },
+        { 0xaa9eaa9daa9caa9eULL, 0xaa9daa9caa9eaa9dULL, },
+        { 0x87da91547e5c87daULL, 0x91547e5c87da9154ULL, },
+        { 0x8e2ce38038d48e2cULL, 0xe38038d48e2ce380ULL, },
+        { 0xaa9daa9caa9baa9dULL, 0xaa9caa9baa9daa9cULL, },    /*  56  */
+        { 0xaa9daa9caa9baa9dULL, 0xaa9caa9baa9daa9cULL, },
+        { 0xbd93da04f675bd93ULL, 0xda04f675bd93da04ULL, },
+        { 0xc70e71b81c62c70eULL, 0x71b81c62c70e71b8ULL, },
+        { 0x11027768ddce1102ULL, 0x7768ddce11027768ULL, },
+        { 0xe37f38d48e29e37fULL, 0x38d48e29e37f38d4ULL, },
+        { 0xe9d18b0048a1e9d1ULL, 0x8b0048a1e9d18b00ULL, },
+        { 0xfff0fff0fff0fff0ULL, 0xfff0fff0fff0fff0ULL, },
+        { 0x340ccd603a6c6ff0ULL, 0x7c7fc96cb0d77f60ULL, },    /*  64  */
+        { 0x07608c7c902605f0ULL, 0x7e1ef7e0f9925b90ULL, },
+        { 0xda1ca10416e8a5f0ULL, 0x2e36f13e11e9dea0ULL, },
+        { 0x6166ada860262c70ULL, 0x773f69ee43333f20ULL, },
+        { 0x34ba6cc4b5e0c270ULL, 0x78de98628bee1b50ULL, },
+        { 0x13b6467bf3775230ULL, 0xce8d99be266db340ULL, },
+        { 0xeaeababdfe9a7630ULL, 0x2d251ed87fd8cb90ULL, },
+        { 0x1b481af62b77c1c0ULL, 0x479e70e86e9a7610ULL, },
+        { 0xee042f7eb23961c0ULL, 0xf7b66a4686f1f920ULL, },    /*  72  */
+        { 0xc538a3c0bd5c85c0ULL, 0x564eef60e05c1170ULL, },
+        { 0xb5941adce7fb45c0ULL, 0xd00e7d5f672347e0ULL, },
+        { 0x25cef5ba555cc4c0ULL, 0x55b61e37e30d7360ULL, },
+        { 0xad18025e9e9a4b40ULL, 0x9ebf96e71457d3e0ULL, },
+        { 0xdd766297cb7796d0ULL, 0xb938e8f703197e60ULL, },
+        { 0x4db03d7538d815d0ULL, 0x3ee089cf7f03a9e0ULL, },
+        { 0x154fea4c3377460cULL, 0xe1ff538f49ffc5e0ULL, },
+        { 0x4a99edbce7e9c70cULL, 0x3f66800dba7a7f60ULL, },    /*  80  */
+        { 0xea0bfe08a81e3aacULL, 0xe7fcffbbd4745ce0ULL, },
+        { 0x3e2ddcb809dc80acULL, 0xc75ca276a8f8bb60ULL, },
+        { 0x5e4aa9605ec07444ULL, 0x6dc0dee66108df60ULL, },
+        { 0x03a670e01940cf44ULL, 0x05802472d23066e0ULL, },
+        { 0x8c72ca4059807924ULL, 0xb7002ade28606260ULL, },
+        { 0x945efbc07b005b24ULL, 0x4f00c3bc4040d2e0ULL, },
+        { 0xab5cc300f000ce2cULL, 0xf000bd1c6fc046e0ULL, },
+        { 0xd7445f001000a72cULL, 0x600018d43e80f460ULL, },    /*  88  */
+        { 0x66cca200e00039ccULL, 0xc000b74c5d00a5e0ULL, },
+        { 0x33140e00c0008fccULL, 0xc0005a98be005060ULL, },
+        { 0xafe8d8000000a7a4ULL, 0x00002a58c2005460ULL, },
+        { 0x99d8b80000004aa4ULL, 0x0000d6088c005fe0ULL, },
+        { 0xa388900000007984ULL, 0x0000413818003f60ULL, },
+        { 0xc5b8f00000000b84ULL, 0x0000fa7010006be0ULL, },
+        { 0x41f0c0000000014cULL, 0x00002bf0f0003fe0ULL, },
+        { 0x7490c0000000724cULL, 0x0000b9d0a0004160ULL, },    /*  96  */
+        { 0xb0f0c0000000a34cULL, 0x00008f70c00030e0ULL, },
+        { 0xed90c0000000944cULL, 0x000014508000e660ULL, },
+        { 0x0ff0c0000000454cULL, 0x00002ef0000019e0ULL, },
+        { 0xebd08000000006ecULL, 0x00001a900000e160ULL, },
+        { 0xf770000000005b8cULL, 0x000037f0000046e0ULL, },
+        { 0x825000000000ab2cULL, 0x000039900000c260ULL, },
+        { 0x5af0000000001dccULL, 0x000030f00000abe0ULL, },
+        { 0x22900000000073ccULL, 0x0000d1e00000de60ULL, },    /* 104  */
+        { 0x3bf000000000c9ccULL, 0x000083c000009ee0ULL, },
+        { 0xe990000000001fccULL, 0x0000c7800000d560ULL, },
+        { 0x0cf00000000075ccULL, 0x00000f00000049e0ULL, },
+        { 0x0ee00000000079a4ULL, 0x0000670000005de0ULL, },
+        { 0x77c000000000a1acULL, 0x00007f000000f1e0ULL, },
+        { 0x8380000000008744ULL, 0x00005700000005e0ULL, },
+        { 0xef0000000000488cULL, 0x0000ef00000099e0ULL, },
     };
 
     reset_msa_registers();
diff --git a/tests/tcg/mips/user/ase/msa/int-multiply/test_msa_msubv_w.c b/tests/tcg/mips/user/ase/msa/int-multiply/test_msa_msubv_w.c
index 171b717f14..0a83db4787 100644
--- a/tests/tcg/mips/user/ase/msa/int-multiply/test_msa_msubv_w.c
+++ b/tests/tcg/mips/user/ase/msa/int-multiply/test_msa_msubv_w.c
@@ -43,118 +43,118 @@ int32_t main(void)
 
     uint64_t b128_result[TEST_COUNT_TOTAL][2];
     uint64_t b128_expect[TEST_COUNT_TOTAL][2] = {
-        { 0x0000000000000002ULL, 0x0000000000000002ULL, },    /*   0  */
-        { 0x0000000000000002ULL, 0x0000000000000002ULL, },
-        { 0x00000000aaaaaaaeULL, 0x00000000aaaaaaaeULL, },
-        { 0x0000000000000004ULL, 0x0000000000000004ULL, },
-        { 0x000000006666666cULL, 0x000000006666666cULL, },
-        { 0x0000000000000006ULL, 0x0000000000000006ULL, },
-        { 0x000000008e38e395ULL, 0xffffffffe38e38ebULL, },
-        { 0x0000000000000008ULL, 0x0000000000000008ULL, },
-        { 0x0000000000000008ULL, 0x0000000000000008ULL, },    /*   8  */
-        { 0x0000000000000008ULL, 0x0000000000000008ULL, },
-        { 0x0000000000000008ULL, 0x0000000000000008ULL, },
-        { 0x0000000000000008ULL, 0x0000000000000008ULL, },
-        { 0x0000000000000008ULL, 0x0000000000000008ULL, },
-        { 0x0000000000000008ULL, 0x0000000000000008ULL, },
-        { 0x0000000000000008ULL, 0x0000000000000008ULL, },
-        { 0x0000000000000008ULL, 0x0000000000000008ULL, },
-        { 0x00000000aaaaaab4ULL, 0x00000000aaaaaab4ULL, },    /*  16  */
-        { 0x00000000aaaaaab4ULL, 0x00000000aaaaaab4ULL, },
-        { 0x38e38e3a71c71c7cULL, 0x38e38e3a71c71c7cULL, },
-        { 0x0000000155555560ULL, 0x0000000155555560ULL, },
-        { 0x2222222444444450ULL, 0x2222222444444450ULL, },
-        { 0x000000020000000cULL, 0x000000020000000cULL, },
-        { 0x2f684bdcb425ed16ULL, 0xf684bda397b425faULL, },
-        { 0x00000002aaaaaab8ULL, 0x00000002aaaaaab8ULL, },
-        { 0x000000020000000eULL, 0x000000020000000eULL, },    /*  24  */
-        { 0x000000020000000eULL, 0x000000020000000eULL, },
-        { 0xc71c71c8e38e38f2ULL, 0xc71c71c8e38e38f2ULL, },
-        { 0x0000000155555564ULL, 0x0000000155555564ULL, },
-        { 0xdddddddeccccccdcULL, 0xdddddddeccccccdcULL, },
-        { 0x00000000aaaaaabaULL, 0x00000000aaaaaabaULL, },
-        { 0xd097b42684bda13fULL, 0x097b425ef684bdb1ULL, },
-        { 0x0000000000000010ULL, 0x0000000000000010ULL, },
-        { 0x0000000066666678ULL, 0x0000000066666678ULL, },    /*  32  */
-        { 0x0000000066666678ULL, 0x0000000066666678ULL, },
-        { 0x2222222355555568ULL, 0x2222222355555568ULL, },
-        { 0x00000000cccccce0ULL, 0x00000000cccccce0ULL, },
-        { 0x147ae1491eb85200ULL, 0x147ae1491eb85200ULL, },
-        { 0x0000000133333348ULL, 0x0000000133333348ULL, },
-        { 0x1c71c71e3e93e954ULL, 0xfa4fa4fbb60b60ccULL, },
-        { 0x00000001999999b0ULL, 0x00000001999999b0ULL, },
-        { 0x000000013333334aULL, 0x000000013333334aULL, },    /*  40  */
-        { 0x000000013333334aULL, 0x000000013333334aULL, },
-        { 0xdddddddeeeeeef06ULL, 0xdddddddeeeeeef06ULL, },
-        { 0x00000000cccccce4ULL, 0x00000000cccccce4ULL, },
-        { 0xeb851eb8e147ae2cULL, 0xeb851eb8e147ae2cULL, },
-        { 0x000000006666667eULL, 0x000000006666667eULL, },
-        { 0xe38e38e3e93e9401ULL, 0x05b05b05c71c71dfULL, },
-        { 0x0000000000000018ULL, 0x0000000000000018ULL, },
-        { 0x000000008e38e3a7ULL, 0xffffffffe38e38fdULL, },    /*  48  */
-        { 0x000000008e38e3a7ULL, 0xffffffffe38e38fdULL, },
-        { 0x2f684bdb425ed0b1ULL, 0xf684bda17b425eebULL, },
-        { 0x000000011c71c736ULL, 0xffffffffc71c71e2ULL, },
-        { 0x1c71c71e27d27d42ULL, 0xfa4fa4fa49f49f66ULL, },
-        { 0x00000001aaaaaac5ULL, 0xffffffffaaaaaac7ULL, },
-        { 0x35ba781b4587e6d2ULL, 0x0fcd6e9d6b74f050ULL, },
-        { 0x0000000238e38e54ULL, 0xffffffff8e38e3acULL, },
-        { 0x00000001aaaaaac7ULL, 0xffffffffaaaaaac9ULL, },    /*  56  */
-        { 0x00000001aaaaaac7ULL, 0xffffffffaaaaaac9ULL, },
-        { 0xd097b427a12f6869ULL, 0x097b425ebda12f87ULL, },
-        { 0x000000011c71c73aULL, 0xffffffffc71c71e6ULL, },
-        { 0xe38e38e477777796ULL, 0x05b05b05aaaaaacaULL, },
-        { 0x000000008e38e3adULL, 0xffffffffe38e3903ULL, },
-        { 0xca4587e781948b2fULL, 0xf032916206522c5fULL, },
-        { 0x0000000000000020ULL, 0x0000000000000020ULL, },
-        { 0x3e3ad4ae1266c2b0ULL, 0x1637d725aebdb734ULL, },    /*  64  */
-        { 0x4c74e0d60a3d6d94ULL, 0x1badd2dd9f4dac90ULL, },
-        { 0x6874e8f94205b90cULL, 0x27eb0c41af2c3022ULL, },
-        { 0x42dab657e16f25e8ULL, 0x06d6782e137656f2ULL, },
-        { 0x5114c27fd945d0ccULL, 0x0c4c73e604064c4eULL, },
-        { 0x68a91e898c276755ULL, 0x0f77ad378bdfb302ULL, },
-        { 0x54c82cde41d1cf13ULL, 0x0b6108a5f38e1598ULL, },
-        { 0x6f755d3eddd1234aULL, 0xfbbaace2f5421908ULL, },
-        { 0x8b75656215996ec2ULL, 0x07f7e64705209c9aULL, },    /*  72  */
-        { 0x779473b6cb43d680ULL, 0x03e141b56cceff30ULL, },
-        { 0xa6279a1866fb9f64ULL, 0x2631668db9e53ac1ULL, },
-        { 0x67a1f71bd99e4586ULL, 0x312ec9f6206e6e69ULL, },
-        { 0x4207c47a7907b262ULL, 0x101a35e284b89539ULL, },
-        { 0x5cb4f4db15070699ULL, 0x0073da1f866c98a9ULL, },
-        { 0x1e2f51de87a9acbbULL, 0x0b713d87ecf5cc51ULL, },
-        { 0x721d49ba5f0acfa8ULL, 0x5ba5bbe9afeae691ULL, },
-        { 0x4bcd68690d995de0ULL, 0x771da6b4b6c967ebULL, },    /*  80  */
-        { 0x4ea9a2cfbb5acd7bULL, 0x79dd6a73439e6387ULL, },
-        { 0x47c800b999dd2371ULL, 0x766d25914ef7a7a0ULL, },
-        { 0x41b0fa10eb77cf84ULL, 0x26e85189458965f8ULL, },
-        { 0x1fc448ce062c2944ULL, 0x31f490a9422a80e6ULL, },
-        { 0x211bdfadfd79770eULL, 0x3b25f4cac5763378ULL, },
-        { 0x16fbb87edd87b6f0ULL, 0x57c0b65fabdda20eULL, },
-        { 0x14621091eac4a5f6ULL, 0x4d29a25d32fa9ef6ULL, },
-        { 0x07832ded1c464b02ULL, 0x6396905709e3cfa4ULL, },    /*  88  */
-        { 0x0ff4a84eab8df3b9ULL, 0x6bc9a7d8c6adf2eaULL, },
-        { 0x21e53326bfbd0b05ULL, 0x8f8f3b9c679dff5aULL, },
-        { 0x191ed6a24e1576f9ULL, 0x9e8c2e402760373aULL, },
-        { 0x19b438400fc27751ULL, 0x819c4bbfd3ee6972ULL, },
-        { 0x1e0d5dc1094ae999ULL, 0x7496a289f5eff010ULL, },
-        { 0x11af620b7bc03943ULL, 0x8a11f229836addc7ULL, },
-        { 0x46fa45d0e84440fcULL, 0xe8d2c0211fb042bfULL, },
-        { 0x22142516b5a8adbcULL, 0xe1cf1923e186aad1ULL, },    /*  96  */
-        { 0x066ebbbb4ff6da44ULL, 0xd918d7e6a7e61877ULL, },
-        { 0x100acc9d22839a48ULL, 0xce291932929e367fULL, },
-        { 0x0dfe419d62a62f64ULL, 0xc020fe45a8cf7acfULL, },
-        { 0x2ba79b6ffbf3c63bULL, 0xb428f52c49fce695ULL, },
-        { 0x29b3b85200bdf100ULL, 0xb4ae7ea2f52aa5b9ULL, },
-        { 0x293bb84d6360c0b6ULL, 0xae33b26e4c493c49ULL, },
-        { 0x46a99fdf54f4862dULL, 0xae790dc5055f6f51ULL, },
-        { 0x18480e0fd728c7c3ULL, 0xa000ad7b15f8ebe0ULL, },    /* 104  */
-        { 0x1b8b97aa205e1239ULL, 0x89c78b8909c4a8e5ULL, },
-        { 0x09abb26b05ef649dULL, 0x74242fa1bd49e740ULL, },
-        { 0x04e233bc861d272bULL, 0x9c5343ab30f62f9fULL, },
-        { 0xda2da0d0884dc3d1ULL, 0xb824f201640b4147ULL, },
-        { 0x9d8b22ee1b9a2e0fULL, 0xb642ddf1edb0747fULL, },
-        { 0x7c81956533686a37ULL, 0xdd5181781dc3ad37ULL, },
-        { 0xc60b1905717ff25aULL, 0xe2af726e71ad7ad7ULL, },
+        { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },    /*   0  */
+        { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
+        { 0xaaaaaaa9aaaaaaa9ULL, 0xaaaaaaa9aaaaaaa9ULL, },
+        { 0xfffffffefffffffeULL, 0xfffffffefffffffeULL, },
+        { 0xcccccccacccccccaULL, 0xcccccccacccccccaULL, },
+        { 0xfffffffdfffffffdULL, 0xfffffffdfffffffdULL, },
+        { 0xe38e38e08e38e38bULL, 0x38e38e35e38e38e0ULL, },
+        { 0xfffffffcfffffffcULL, 0xfffffffcfffffffcULL, },
+        { 0xfffffffcfffffffcULL, 0xfffffffcfffffffcULL, },    /*   8  */
+        { 0xfffffffcfffffffcULL, 0xfffffffcfffffffcULL, },
+        { 0xfffffffcfffffffcULL, 0xfffffffcfffffffcULL, },
+        { 0xfffffffcfffffffcULL, 0xfffffffcfffffffcULL, },
+        { 0xfffffffcfffffffcULL, 0xfffffffcfffffffcULL, },
+        { 0xfffffffcfffffffcULL, 0xfffffffcfffffffcULL, },
+        { 0xfffffffcfffffffcULL, 0xfffffffcfffffffcULL, },
+        { 0xfffffffcfffffffcULL, 0xfffffffcfffffffcULL, },
+        { 0xaaaaaaa6aaaaaaa6ULL, 0xaaaaaaa6aaaaaaa6ULL, },    /*  16  */
+        { 0xaaaaaaa6aaaaaaa6ULL, 0xaaaaaaa6aaaaaaa6ULL, },
+        { 0xc71c71c2c71c71c2ULL, 0xc71c71c2c71c71c2ULL, },
+        { 0x5555555055555550ULL, 0x5555555055555550ULL, },
+        { 0xddddddd8ddddddd8ULL, 0xddddddd8ddddddd8ULL, },
+        { 0xfffffffafffffffaULL, 0xfffffffafffffffaULL, },
+        { 0xed097b3c5ed097aeULL, 0x7b425ecaed097b3cULL, },
+        { 0xaaaaaaa4aaaaaaa4ULL, 0xaaaaaaa4aaaaaaa4ULL, },
+        { 0xfffffff9fffffff9ULL, 0xfffffff9fffffff9ULL, },    /*  24  */
+        { 0xfffffff9fffffff9ULL, 0xfffffff9fffffff9ULL, },
+        { 0x8e38e3878e38e387ULL, 0x8e38e3878e38e387ULL, },
+        { 0x5555554e5555554eULL, 0x5555554e5555554eULL, },
+        { 0x9999999299999992ULL, 0x9999999299999992ULL, },
+        { 0xaaaaaaa3aaaaaaa3ULL, 0xaaaaaaa3aaaaaaa3ULL, },
+        { 0xa12f6844da12f67dULL, 0x684bda0ba12f6844ULL, },
+        { 0xfffffff8fffffff8ULL, 0xfffffff8fffffff8ULL, },
+        { 0xccccccc4ccccccc4ULL, 0xccccccc4ccccccc4ULL, },    /*  32  */
+        { 0xccccccc4ccccccc4ULL, 0xccccccc4ccccccc4ULL, },
+        { 0x5555554c5555554cULL, 0x5555554c5555554cULL, },
+        { 0x9999999099999990ULL, 0x9999999099999990ULL, },
+        { 0x70a3d70070a3d700ULL, 0x70a3d70070a3d700ULL, },
+        { 0x6666665c6666665cULL, 0x6666665c6666665cULL, },
+        { 0x82d82d783e93e934ULL, 0xc71c71bc82d82d78ULL, },
+        { 0x3333332833333328ULL, 0x3333332833333328ULL, },
+        { 0x6666665b6666665bULL, 0x6666665b6666665bULL, },    /*  40  */
+        { 0x6666665b6666665bULL, 0x6666665b6666665bULL, },
+        { 0x8888887d8888887dULL, 0x8888887d8888887dULL, },
+        { 0x9999998e9999998eULL, 0x9999998e9999998eULL, },
+        { 0x8f5c28ea8f5c28eaULL, 0x8f5c28ea8f5c28eaULL, },
+        { 0xccccccc1ccccccc1ULL, 0xccccccc1ccccccc1ULL, },
+        { 0x93e93e8882d82d77ULL, 0xa4fa4f9993e93e88ULL, },
+        { 0xfffffff4fffffff4ULL, 0xfffffff4fffffff4ULL, },
+        { 0xe38e38d78e38e382ULL, 0x38e38e2ce38e38d7ULL, },    /*  48  */
+        { 0xe38e38d78e38e382ULL, 0x38e38e2ce38e38d7ULL, },
+        { 0xd097b419ed097b36ULL, 0xb425ecfcd097b419ULL, },
+        { 0xc71c71ba1c71c710ULL, 0x71c71c64c71c71baULL, },
+        { 0xe38e38d6f49f49e8ULL, 0xd27d27c4e38e38d6ULL, },
+        { 0xaaaaaa9daaaaaa9eULL, 0xaaaaaa9caaaaaa9dULL, },
+        { 0xf0329154ca4587daULL, 0xa4587e5cf0329154ULL, },
+        { 0x8e38e38038e38e2cULL, 0xe38e38d48e38e380ULL, },
+        { 0xaaaaaa9caaaaaa9dULL, 0xaaaaaa9baaaaaa9cULL, },    /*  56  */
+        { 0xaaaaaa9caaaaaa9dULL, 0xaaaaaa9baaaaaa9cULL, },
+        { 0x684bda04f684bd93ULL, 0xda12f675684bda04ULL, },
+        { 0xc71c71b81c71c70eULL, 0x71c71c62c71c71b8ULL, },
+        { 0x7777776811111102ULL, 0xddddddce77777768ULL, },
+        { 0xe38e38d48e38e37fULL, 0x38e38e29e38e38d4ULL, },
+        { 0x81948b00fcd6e9d1ULL, 0x781948a181948b00ULL, },
+        { 0xfffffff0fffffff0ULL, 0xfffffff0fffffff0ULL, },
+        { 0x4efccd609e9c6ff0ULL, 0xc5dac96c8b677f60ULL, },    /*  64  */
+        { 0x3e3d8c7cb78505f0ULL, 0x4463f7e01c4e5b90ULL, },
+        { 0xcaa9a104f350a5f0ULL, 0x8ca4f13ec42edea0ULL, },
+        { 0x19b8ada804d82c70ULL, 0xb62b69ee365e3f20ULL, },
+        { 0x08f96cc41dc0c270ULL, 0x34b49862c7451b50ULL, },
+        { 0x5405467b1fd35230ULL, 0xf7c999be7c56b340ULL, },
+        { 0x5cc7babd61667630ULL, 0xa4601ed86811cb90ULL, },
+        { 0xe20c1af64022c1c0ULL, 0x927a70e878437610ULL, },
+        { 0x6e782f7e7bee61c0ULL, 0xdabb6a462023f920ULL, },    /*  72  */
+        { 0x773aa3c0bd8185c0ULL, 0x8751ef600bdf1170ULL, },
+        { 0xc0871adcd87d45c0ULL, 0x6c527d5fd9c847e0ULL, },
+        { 0xd7c7f5ba4e99c4c0ULL, 0xdaa41e3704ed7360ULL, },
+        { 0x26d7025e60214b40ULL, 0x042a96e7771cd3e0ULL, },
+        { 0xac1b62973edd96d0ULL, 0xf244e8f7874e7e60ULL, },
+        { 0xc35c3d75b4fa15d0ULL, 0x609689cfb273a9e0ULL, },
+        { 0x9de4ea4c0310460cULL, 0x80c0538fcf54c5e0ULL, },
+        { 0xbd81edbc2724c70cULL, 0x7301800d7cb17f60ULL, },    /*  80  */
+        { 0xaebafe086f603aacULL, 0x35c5ffbbaa8b5ce0ULL, },
+        { 0xdf14dcb8c25380acULL, 0x3ef9a276f99bbb60ULL, },
+        { 0x5e0ea9600c5e7444ULL, 0x8ef3dee6ce1bdf60ULL, },
+        { 0x1c7370e0761ecf44ULL, 0x864a2472681b66e0ULL, },
+        { 0xb58eca4059fe7924ULL, 0x8c252ade750e6260ULL, },
+        { 0xfcc4fbc036df5b24ULL, 0x36a7c3bc9596d2e0ULL, },
+        { 0x57a2c300a677ce2cULL, 0x2922bd1cb36946e0ULL, },
+        { 0x88bd5f007437a72cULL, 0x45fd18d49c1ff460ULL, },    /*  88  */
+        { 0x2581a200554339ccULL, 0x6c99b74cacc4a5e0ULL, },
+        { 0x2d500e000b508fccULL, 0x1f975a9844ce5060ULL, },
+        { 0x5907d8000bc6a7a4ULL, 0x0eaa2a5808275460ULL, },
+        { 0xeab7b80057ab4aa4ULL, 0x8af4d608d22d5fe0ULL, },
+        { 0x95ab9000431f7984ULL, 0x840741386cad3f60ULL, },
+        { 0xf5ddf000f6ac0b84ULL, 0xd51bfa701fdb6be0ULL, },
+        { 0xdf7cc0003fd2014cULL, 0xb5052bf0d1bc3fe0ULL, },
+        { 0x3393c00031cb724cULL, 0x06abb9d0a05f4160ULL, },    /*  96  */
+        { 0xdb56c00090e3a34cULL, 0x7ff18f70f5d630e0ULL, },
+        { 0xa1b5c0005faa944cULL, 0x9e0514507291e660ULL, },
+        { 0xfa60c0002cb0454cULL, 0xc4182ef0d53919e0ULL, },
+        { 0xa6f680001aac06ecULL, 0x05ca1a90e899e160ULL, },
+        { 0x15a3000096665b8cULL, 0x0cec37f0504f46e0ULL, },
+        { 0xb79a0000a4a5ab2cULL, 0x578239900c71c260ULL, },
+        { 0xb70c000031251dccULL, 0xaa4c30f0a693abe0ULL, },
+        { 0x01140000f37473ccULL, 0x400dd1e0cc92de60ULL, },    /* 104  */
+        { 0xb1cc0000f066c9ccULL, 0x8cf683c01cd59ee0ULL, },
+        { 0xf8540000557c1fccULL, 0x0f82c780ac8ed560ULL, },
+        { 0xf88c0000103475ccULL, 0xa1f10f00956f49e0ULL, },
+        { 0x2e7000005c2e79a4ULL, 0xcf94670004e95de0ULL, },
+        { 0x96c00000be3ea1acULL, 0xdca57f00da6ef1e0ULL, },
+        { 0xbf00000062838744ULL, 0x368a570027d005e0ULL, },
+        { 0x4c0000006502488cULL, 0xcc98ef003cdc99e0ULL, },
     };
 
     reset_msa_registers();
diff --git a/tests/tcg/mips/user/ase/msa/test_msa_compile_32r6eb.sh b/tests/tcg/mips/user/ase/msa/test_msa_compile_32r6eb.sh
index 7a88ca20d4..25192137b0 100755
--- a/tests/tcg/mips/user/ase/msa/test_msa_compile_32r6eb.sh
+++ b/tests/tcg/mips/user/ase/msa/test_msa_compile_32r6eb.sh
@@ -88,6 +88,22 @@
 # Fixed Multiply
 # --------------
 #
+/opt/img/bin/mips-img-linux-gnu-gcc  fixed-multiply/test_msa_madd_q_h.c        \
+-EB -static -mabi=32 -march=mips32r6 -mmsa -o  /tmp/test_msa_madd_q_h_32r6eb
+/opt/img/bin/mips-img-linux-gnu-gcc  fixed-multiply/test_msa_madd_q_w.c        \
+-EB -static -mabi=32 -march=mips32r6 -mmsa -o  /tmp/test_msa_madd_q_w_32r6eb
+/opt/img/bin/mips-img-linux-gnu-gcc  fixed-multiply/test_msa_maddr_q_h.c       \
+-EB -static -mabi=32 -march=mips32r6 -mmsa -o  /tmp/test_msa_maddr_q_h_32r6eb
+/opt/img/bin/mips-img-linux-gnu-gcc  fixed-multiply/test_msa_maddr_q_w.c       \
+-EB -static -mabi=32 -march=mips32r6 -mmsa -o  /tmp/test_msa_maddr_q_w_32r6eb
+/opt/img/bin/mips-img-linux-gnu-gcc  fixed-multiply/test_msa_msub_q_h.c        \
+-EB -static -mabi=32 -march=mips32r6 -mmsa -o  /tmp/test_msa_msub_q_h_32r6eb
+/opt/img/bin/mips-img-linux-gnu-gcc  fixed-multiply/test_msa_msub_q_w.c        \
+-EB -static -mabi=32 -march=mips32r6 -mmsa -o  /tmp/test_msa_msub_q_w_32r6eb
+/opt/img/bin/mips-img-linux-gnu-gcc  fixed-multiply/test_msa_msubr_q_h.c       \
+-EB -static -mabi=32 -march=mips32r6 -mmsa -o  /tmp/test_msa_msubr_q_h_32r6eb
+/opt/img/bin/mips-img-linux-gnu-gcc  fixed-multiply/test_msa_msubr_q_w.c       \
+-EB -static -mabi=32 -march=mips32r6 -mmsa -o  /tmp/test_msa_msubr_q_w_32r6eb
 /opt/img/bin/mips-img-linux-gnu-gcc  fixed-multiply/test_msa_mul_q_h.c         \
 -EB -static -mabi=32 -march=mips32r6 -mmsa -o  /tmp/test_msa_mul_q_h_32r6eb
 /opt/img/bin/mips-img-linux-gnu-gcc  fixed-multiply/test_msa_mul_q_w.c         \
@@ -470,14 +486,6 @@
 -EB -static -mabi=32 -march=mips32r6 -mmsa -o  /tmp/test_msa_subs_u_w_32r6eb
 /opt/img/bin/mips-img-linux-gnu-gcc    int-subtract/test_msa_subs_u_d.c        \
 -EB -static -mabi=32 -march=mips32r6 -mmsa -o  /tmp/test_msa_subs_u_d_32r6eb
-/opt/img/bin/mips-img-linux-gnu-gcc    int-subtract/test_msa_subsuu_s_b.c      \
--EB -static -mabi=32 -march=mips32r6 -mmsa -o  /tmp/test_msa_subsuu_s_b_32r6eb
-/opt/img/bin/mips-img-linux-gnu-gcc    int-subtract/test_msa_subsuu_s_h.c      \
--EB -static -mabi=32 -march=mips32r6 -mmsa -o  /tmp/test_msa_subsuu_s_h_32r6eb
-/opt/img/bin/mips-img-linux-gnu-gcc    int-subtract/test_msa_subsuu_s_w.c      \
--EB -static -mabi=32 -march=mips32r6 -mmsa -o  /tmp/test_msa_subsuu_s_w_32r6eb
-/opt/img/bin/mips-img-linux-gnu-gcc    int-subtract/test_msa_subsuu_s_d.c      \
--EB -static -mabi=32 -march=mips32r6 -mmsa -o  /tmp/test_msa_subsuu_s_d_32r6eb
 /opt/img/bin/mips-img-linux-gnu-gcc    int-subtract/test_msa_subsus_u_b.c      \
 -EB -static -mabi=32 -march=mips32r6 -mmsa -o  /tmp/test_msa_subsus_u_b_32r6eb
 /opt/img/bin/mips-img-linux-gnu-gcc    int-subtract/test_msa_subsus_u_h.c      \
@@ -486,6 +494,14 @@
 -EB -static -mabi=32 -march=mips32r6 -mmsa -o  /tmp/test_msa_subsus_u_w_32r6eb
 /opt/img/bin/mips-img-linux-gnu-gcc    int-subtract/test_msa_subsus_u_d.c      \
 -EB -static -mabi=32 -march=mips32r6 -mmsa -o  /tmp/test_msa_subsus_u_d_32r6eb
+/opt/img/bin/mips-img-linux-gnu-gcc    int-subtract/test_msa_subsuu_s_b.c      \
+-EB -static -mabi=32 -march=mips32r6 -mmsa -o  /tmp/test_msa_subsuu_s_b_32r6eb
+/opt/img/bin/mips-img-linux-gnu-gcc    int-subtract/test_msa_subsuu_s_h.c      \
+-EB -static -mabi=32 -march=mips32r6 -mmsa -o  /tmp/test_msa_subsuu_s_h_32r6eb
+/opt/img/bin/mips-img-linux-gnu-gcc    int-subtract/test_msa_subsuu_s_w.c      \
+-EB -static -mabi=32 -march=mips32r6 -mmsa -o  /tmp/test_msa_subsuu_s_w_32r6eb
+/opt/img/bin/mips-img-linux-gnu-gcc    int-subtract/test_msa_subsuu_s_d.c      \
+-EB -static -mabi=32 -march=mips32r6 -mmsa -o  /tmp/test_msa_subsuu_s_d_32r6eb
 /opt/img/bin/mips-img-linux-gnu-gcc    int-subtract/test_msa_subv_b.c          \
 -EB -static -mabi=32 -march=mips32r6 -mmsa -o  /tmp/test_msa_subv_b_32r6eb
 /opt/img/bin/mips-img-linux-gnu-gcc    int-subtract/test_msa_subv_h.c          \
diff --git a/tests/tcg/mips/user/ase/msa/test_msa_compile_32r6el.sh b/tests/tcg/mips/user/ase/msa/test_msa_compile_32r6el.sh
index dbe04dc2b3..1e10ff7621 100755
--- a/tests/tcg/mips/user/ase/msa/test_msa_compile_32r6el.sh
+++ b/tests/tcg/mips/user/ase/msa/test_msa_compile_32r6el.sh
@@ -88,6 +88,22 @@
 # Fixed Multiply
 # --------------
 #
+/opt/img/bin/mips-img-linux-gnu-gcc  fixed-multiply/test_msa_madd_q_h.c        \
+-EL -static -mabi=32 -march=mips32r6 -mmsa -o  /tmp/test_msa_madd_q_h_32r6el
+/opt/img/bin/mips-img-linux-gnu-gcc  fixed-multiply/test_msa_madd_q_w.c        \
+-EL -static -mabi=32 -march=mips32r6 -mmsa -o  /tmp/test_msa_madd_q_w_32r6el
+/opt/img/bin/mips-img-linux-gnu-gcc  fixed-multiply/test_msa_maddr_q_h.c       \
+-EL -static -mabi=32 -march=mips32r6 -mmsa -o  /tmp/test_msa_maddr_q_h_32r6el
+/opt/img/bin/mips-img-linux-gnu-gcc  fixed-multiply/test_msa_maddr_q_w.c       \
+-EL -static -mabi=32 -march=mips32r6 -mmsa -o  /tmp/test_msa_maddr_q_w_32r6el
+/opt/img/bin/mips-img-linux-gnu-gcc  fixed-multiply/test_msa_msub_q_h.c        \
+-EL -static -mabi=32 -march=mips32r6 -mmsa -o  /tmp/test_msa_msub_q_h_32r6el
+/opt/img/bin/mips-img-linux-gnu-gcc  fixed-multiply/test_msa_msub_q_w.c        \
+-EL -static -mabi=32 -march=mips32r6 -mmsa -o  /tmp/test_msa_msub_q_w_32r6el
+/opt/img/bin/mips-img-linux-gnu-gcc  fixed-multiply/test_msa_msubr_q_h.c       \
+-EL -static -mabi=32 -march=mips32r6 -mmsa -o  /tmp/test_msa_msubr_q_h_32r6el
+/opt/img/bin/mips-img-linux-gnu-gcc  fixed-multiply/test_msa_msubr_q_w.c       \
+-EL -static -mabi=32 -march=mips32r6 -mmsa -o  /tmp/test_msa_msubr_q_w_32r6el
 /opt/img/bin/mips-img-linux-gnu-gcc  fixed-multiply/test_msa_mul_q_h.c         \
 -EL -static -mabi=32 -march=mips32r6 -mmsa -o  /tmp/test_msa_mul_q_h_32r6el
 /opt/img/bin/mips-img-linux-gnu-gcc  fixed-multiply/test_msa_mul_q_w.c         \
@@ -470,14 +486,6 @@
 -EL -static -mabi=32 -march=mips32r6 -mmsa -o  /tmp/test_msa_subs_u_w_32r6el
 /opt/img/bin/mips-img-linux-gnu-gcc    int-subtract/test_msa_subs_u_d.c        \
 -EL -static -mabi=32 -march=mips32r6 -mmsa -o  /tmp/test_msa_subs_u_d_32r6el
-/opt/img/bin/mips-img-linux-gnu-gcc    int-subtract/test_msa_subsuu_s_b.c      \
--EL -static -mabi=32 -march=mips32r6 -mmsa -o  /tmp/test_msa_subsuu_s_b_32r6el
-/opt/img/bin/mips-img-linux-gnu-gcc    int-subtract/test_msa_subsuu_s_h.c      \
--EL -static -mabi=32 -march=mips32r6 -mmsa -o  /tmp/test_msa_subsuu_s_h_32r6el
-/opt/img/bin/mips-img-linux-gnu-gcc    int-subtract/test_msa_subsuu_s_w.c      \
--EL -static -mabi=32 -march=mips32r6 -mmsa -o  /tmp/test_msa_subsuu_s_w_32r6el
-/opt/img/bin/mips-img-linux-gnu-gcc    int-subtract/test_msa_subsuu_s_d.c      \
--EL -static -mabi=32 -march=mips32r6 -mmsa -o  /tmp/test_msa_subsuu_s_d_32r6el
 /opt/img/bin/mips-img-linux-gnu-gcc    int-subtract/test_msa_subsus_u_b.c      \
 -EL -static -mabi=32 -march=mips32r6 -mmsa -o  /tmp/test_msa_subsus_u_b_32r6el
 /opt/img/bin/mips-img-linux-gnu-gcc    int-subtract/test_msa_subsus_u_h.c      \
@@ -486,6 +494,14 @@
 -EL -static -mabi=32 -march=mips32r6 -mmsa -o  /tmp/test_msa_subsus_u_w_32r6el
 /opt/img/bin/mips-img-linux-gnu-gcc    int-subtract/test_msa_subsus_u_d.c      \
 -EL -static -mabi=32 -march=mips32r6 -mmsa -o  /tmp/test_msa_subsus_u_d_32r6el
+/opt/img/bin/mips-img-linux-gnu-gcc    int-subtract/test_msa_subsuu_s_b.c      \
+-EL -static -mabi=32 -march=mips32r6 -mmsa -o  /tmp/test_msa_subsuu_s_b_32r6el
+/opt/img/bin/mips-img-linux-gnu-gcc    int-subtract/test_msa_subsuu_s_h.c      \
+-EL -static -mabi=32 -march=mips32r6 -mmsa -o  /tmp/test_msa_subsuu_s_h_32r6el
+/opt/img/bin/mips-img-linux-gnu-gcc    int-subtract/test_msa_subsuu_s_w.c      \
+-EL -static -mabi=32 -march=mips32r6 -mmsa -o  /tmp/test_msa_subsuu_s_w_32r6el
+/opt/img/bin/mips-img-linux-gnu-gcc    int-subtract/test_msa_subsuu_s_d.c      \
+-EL -static -mabi=32 -march=mips32r6 -mmsa -o  /tmp/test_msa_subsuu_s_d_32r6el
 /opt/img/bin/mips-img-linux-gnu-gcc    int-subtract/test_msa_subv_b.c          \
 -EL -static -mabi=32 -march=mips32r6 -mmsa -o  /tmp/test_msa_subv_b_32r6el
 /opt/img/bin/mips-img-linux-gnu-gcc    int-subtract/test_msa_subv_h.c          \
diff --git a/tests/tcg/mips/user/ase/msa/test_msa_compile_64r6eb.sh b/tests/tcg/mips/user/ase/msa/test_msa_compile_64r6eb.sh
index 73adabb295..6bc8907a53 100755
--- a/tests/tcg/mips/user/ase/msa/test_msa_compile_64r6eb.sh
+++ b/tests/tcg/mips/user/ase/msa/test_msa_compile_64r6eb.sh
@@ -88,6 +88,22 @@
 # Fixed Multiply
 # --------------
 #
+/opt/img/bin/mips-img-linux-gnu-gcc  fixed-multiply/test_msa_madd_q_h.c        \
+-EB -static -mabi=64 -march=mips64r6 -mmsa -o  /tmp/test_msa_madd_q_h_64r6eb
+/opt/img/bin/mips-img-linux-gnu-gcc  fixed-multiply/test_msa_madd_q_w.c        \
+-EB -static -mabi=64 -march=mips64r6 -mmsa -o  /tmp/test_msa_madd_q_w_64r6eb
+/opt/img/bin/mips-img-linux-gnu-gcc  fixed-multiply/test_msa_maddr_q_h.c       \
+-EB -static -mabi=64 -march=mips64r6 -mmsa -o  /tmp/test_msa_maddr_q_h_64r6eb
+/opt/img/bin/mips-img-linux-gnu-gcc  fixed-multiply/test_msa_maddr_q_w.c       \
+-EB -static -mabi=64 -march=mips64r6 -mmsa -o  /tmp/test_msa_maddr_q_w_64r6eb
+/opt/img/bin/mips-img-linux-gnu-gcc  fixed-multiply/test_msa_msub_q_h.c        \
+-EB -static -mabi=64 -march=mips64r6 -mmsa -o  /tmp/test_msa_msub_q_h_64r6eb
+/opt/img/bin/mips-img-linux-gnu-gcc  fixed-multiply/test_msa_msub_q_w.c        \
+-EB -static -mabi=64 -march=mips64r6 -mmsa -o  /tmp/test_msa_msub_q_w_64r6eb
+/opt/img/bin/mips-img-linux-gnu-gcc  fixed-multiply/test_msa_msubr_q_h.c       \
+-EB -static -mabi=64 -march=mips64r6 -mmsa -o  /tmp/test_msa_msubr_q_h_64r6eb
+/opt/img/bin/mips-img-linux-gnu-gcc  fixed-multiply/test_msa_msubr_q_w.c       \
+-EB -static -mabi=64 -march=mips64r6 -mmsa -o  /tmp/test_msa_msubr_q_w_64r6eb
 /opt/img/bin/mips-img-linux-gnu-gcc  fixed-multiply/test_msa_mul_q_h.c         \
 -EB -static -mabi=64 -march=mips64r6 -mmsa -o  /tmp/test_msa_mul_q_h_64r6eb
 /opt/img/bin/mips-img-linux-gnu-gcc  fixed-multiply/test_msa_mul_q_w.c         \
@@ -470,14 +486,6 @@
 -EB -static -mabi=64 -march=mips64r6 -mmsa -o  /tmp/test_msa_subs_u_w_64r6eb
 /opt/img/bin/mips-img-linux-gnu-gcc    int-subtract/test_msa_subs_u_d.c        \
 -EB -static -mabi=64 -march=mips64r6 -mmsa -o  /tmp/test_msa_subs_u_d_64r6eb
-/opt/img/bin/mips-img-linux-gnu-gcc    int-subtract/test_msa_subsuu_s_b.c      \
--EB -static -mabi=64 -march=mips64r6 -mmsa -o  /tmp/test_msa_subsuu_s_b_64r6eb
-/opt/img/bin/mips-img-linux-gnu-gcc    int-subtract/test_msa_subsuu_s_h.c      \
--EB -static -mabi=64 -march=mips64r6 -mmsa -o  /tmp/test_msa_subsuu_s_h_64r6eb
-/opt/img/bin/mips-img-linux-gnu-gcc    int-subtract/test_msa_subsuu_s_w.c      \
--EB -static -mabi=64 -march=mips64r6 -mmsa -o  /tmp/test_msa_subsuu_s_w_64r6eb
-/opt/img/bin/mips-img-linux-gnu-gcc    int-subtract/test_msa_subsuu_s_d.c      \
--EB -static -mabi=64 -march=mips64r6 -mmsa -o  /tmp/test_msa_subsuu_s_d_64r6eb
 /opt/img/bin/mips-img-linux-gnu-gcc    int-subtract/test_msa_subsus_u_b.c      \
 -EB -static -mabi=64 -march=mips64r6 -mmsa -o  /tmp/test_msa_subsus_u_b_64r6eb
 /opt/img/bin/mips-img-linux-gnu-gcc    int-subtract/test_msa_subsus_u_h.c      \
@@ -486,6 +494,14 @@
 -EB -static -mabi=64 -march=mips64r6 -mmsa -o  /tmp/test_msa_subsus_u_w_64r6eb
 /opt/img/bin/mips-img-linux-gnu-gcc    int-subtract/test_msa_subsus_u_d.c      \
 -EB -static -mabi=64 -march=mips64r6 -mmsa -o  /tmp/test_msa_subsus_u_d_64r6eb
+/opt/img/bin/mips-img-linux-gnu-gcc    int-subtract/test_msa_subsuu_s_b.c      \
+-EB -static -mabi=64 -march=mips64r6 -mmsa -o  /tmp/test_msa_subsuu_s_b_64r6eb
+/opt/img/bin/mips-img-linux-gnu-gcc    int-subtract/test_msa_subsuu_s_h.c      \
+-EB -static -mabi=64 -march=mips64r6 -mmsa -o  /tmp/test_msa_subsuu_s_h_64r6eb
+/opt/img/bin/mips-img-linux-gnu-gcc    int-subtract/test_msa_subsuu_s_w.c      \
+-EB -static -mabi=64 -march=mips64r6 -mmsa -o  /tmp/test_msa_subsuu_s_w_64r6eb
+/opt/img/bin/mips-img-linux-gnu-gcc    int-subtract/test_msa_subsuu_s_d.c      \
+-EB -static -mabi=64 -march=mips64r6 -mmsa -o  /tmp/test_msa_subsuu_s_d_64r6eb
 /opt/img/bin/mips-img-linux-gnu-gcc    int-subtract/test_msa_subv_b.c          \
 -EB -static -mabi=64 -march=mips64r6 -mmsa -o  /tmp/test_msa_subv_b_64r6eb
 /opt/img/bin/mips-img-linux-gnu-gcc    int-subtract/test_msa_subv_h.c          \
diff --git a/tests/tcg/mips/user/ase/msa/test_msa_compile_64r6el.sh b/tests/tcg/mips/user/ase/msa/test_msa_compile_64r6el.sh
index afe4311a88..4a92c55a4e 100755
--- a/tests/tcg/mips/user/ase/msa/test_msa_compile_64r6el.sh
+++ b/tests/tcg/mips/user/ase/msa/test_msa_compile_64r6el.sh
@@ -88,6 +88,22 @@
 # Fixed Multiply
 # --------------
 #
+/opt/img/bin/mips-img-linux-gnu-gcc  fixed-multiply/test_msa_madd_q_h.c        \
+-EL -static -mabi=64 -march=mips64r6 -mmsa -o  /tmp/test_msa_madd_q_h_64r6el
+/opt/img/bin/mips-img-linux-gnu-gcc  fixed-multiply/test_msa_madd_q_w.c        \
+-EL -static -mabi=64 -march=mips64r6 -mmsa -o  /tmp/test_msa_madd_q_w_64r6el
+/opt/img/bin/mips-img-linux-gnu-gcc  fixed-multiply/test_msa_maddr_q_h.c       \
+-EL -static -mabi=64 -march=mips64r6 -mmsa -o  /tmp/test_msa_maddr_q_h_64r6el
+/opt/img/bin/mips-img-linux-gnu-gcc  fixed-multiply/test_msa_maddr_q_w.c       \
+-EL -static -mabi=64 -march=mips64r6 -mmsa -o  /tmp/test_msa_maddr_q_w_64r6el
+/opt/img/bin/mips-img-linux-gnu-gcc  fixed-multiply/test_msa_msub_q_h.c        \
+-EL -static -mabi=64 -march=mips64r6 -mmsa -o  /tmp/test_msa_msub_q_h_64r6el
+/opt/img/bin/mips-img-linux-gnu-gcc  fixed-multiply/test_msa_msub_q_w.c        \
+-EL -static -mabi=64 -march=mips64r6 -mmsa -o  /tmp/test_msa_msub_q_w_64r6el
+/opt/img/bin/mips-img-linux-gnu-gcc  fixed-multiply/test_msa_msubr_q_h.c       \
+-EL -static -mabi=64 -march=mips64r6 -mmsa -o  /tmp/test_msa_msubr_q_h_64r6el
+/opt/img/bin/mips-img-linux-gnu-gcc  fixed-multiply/test_msa_msubr_q_w.c       \
+-EL -static -mabi=64 -march=mips64r6 -mmsa -o  /tmp/test_msa_msubr_q_w_64r6el
 /opt/img/bin/mips-img-linux-gnu-gcc  fixed-multiply/test_msa_mul_q_h.c         \
 -EL -static -mabi=64 -march=mips64r6 -mmsa -o  /tmp/test_msa_mul_q_h_64r6el
 /opt/img/bin/mips-img-linux-gnu-gcc  fixed-multiply/test_msa_mul_q_w.c         \
@@ -470,14 +486,6 @@
 -EL -static -mabi=64 -march=mips64r6 -mmsa -o  /tmp/test_msa_subs_u_w_64r6el
 /opt/img/bin/mips-img-linux-gnu-gcc    int-subtract/test_msa_subs_u_d.c        \
 -EL -static -mabi=64 -march=mips64r6 -mmsa -o  /tmp/test_msa_subs_u_d_64r6el
-/opt/img/bin/mips-img-linux-gnu-gcc    int-subtract/test_msa_subsuu_s_b.c      \
--EL -static -mabi=64 -march=mips64r6 -mmsa -o  /tmp/test_msa_subsuu_s_b_64r6el
-/opt/img/bin/mips-img-linux-gnu-gcc    int-subtract/test_msa_subsuu_s_h.c      \
--EL -static -mabi=64 -march=mips64r6 -mmsa -o  /tmp/test_msa_subsuu_s_h_64r6el
-/opt/img/bin/mips-img-linux-gnu-gcc    int-subtract/test_msa_subsuu_s_w.c      \
--EL -static -mabi=64 -march=mips64r6 -mmsa -o  /tmp/test_msa_subsuu_s_w_64r6el
-/opt/img/bin/mips-img-linux-gnu-gcc    int-subtract/test_msa_subsuu_s_d.c      \
--EL -static -mabi=64 -march=mips64r6 -mmsa -o  /tmp/test_msa_subsuu_s_d_64r6el
 /opt/img/bin/mips-img-linux-gnu-gcc    int-subtract/test_msa_subsus_u_b.c      \
 -EL -static -mabi=64 -march=mips64r6 -mmsa -o  /tmp/test_msa_subsus_u_b_64r6el
 /opt/img/bin/mips-img-linux-gnu-gcc    int-subtract/test_msa_subsus_u_h.c      \
@@ -486,6 +494,14 @@
 -EL -static -mabi=64 -march=mips64r6 -mmsa -o  /tmp/test_msa_subsus_u_w_64r6el
 /opt/img/bin/mips-img-linux-gnu-gcc    int-subtract/test_msa_subsus_u_d.c      \
 -EL -static -mabi=64 -march=mips64r6 -mmsa -o  /tmp/test_msa_subsus_u_d_64r6el
+/opt/img/bin/mips-img-linux-gnu-gcc    int-subtract/test_msa_subsuu_s_b.c      \
+-EL -static -mabi=64 -march=mips64r6 -mmsa -o  /tmp/test_msa_subsuu_s_b_64r6el
+/opt/img/bin/mips-img-linux-gnu-gcc    int-subtract/test_msa_subsuu_s_h.c      \
+-EL -static -mabi=64 -march=mips64r6 -mmsa -o  /tmp/test_msa_subsuu_s_h_64r6el
+/opt/img/bin/mips-img-linux-gnu-gcc    int-subtract/test_msa_subsuu_s_w.c      \
+-EL -static -mabi=64 -march=mips64r6 -mmsa -o  /tmp/test_msa_subsuu_s_w_64r6el
+/opt/img/bin/mips-img-linux-gnu-gcc    int-subtract/test_msa_subsuu_s_d.c      \
+-EL -static -mabi=64 -march=mips64r6 -mmsa -o  /tmp/test_msa_subsuu_s_d_64r6el
 /opt/img/bin/mips-img-linux-gnu-gcc    int-subtract/test_msa_subv_b.c          \
 -EL -static -mabi=64 -march=mips64r6 -mmsa -o  /tmp/test_msa_subv_b_64r6el
 /opt/img/bin/mips-img-linux-gnu-gcc    int-subtract/test_msa_subv_h.c          \
diff --git a/tests/tcg/mips/user/ase/msa/test_msa_run_32r6eb.sh b/tests/tcg/mips/user/ase/msa/test_msa_run_32r6eb.sh
index 70b2549de5..6c95e452cd 100644
--- a/tests/tcg/mips/user/ase/msa/test_msa_run_32r6eb.sh
+++ b/tests/tcg/mips/user/ase/msa/test_msa_run_32r6eb.sh
@@ -55,6 +55,14 @@ $PATH_TO_QEMU -cpu I6400  /tmp/test_msa_bset_d_32r6eb
 # Fixed Multiply
 # --------------
 #
+$PATH_TO_QEMU -cpu I6400  /tmp/test_msa_madd_q_h_32r6eb
+$PATH_TO_QEMU -cpu I6400  /tmp/test_msa_madd_q_w_32r6eb
+$PATH_TO_QEMU -cpu I6400  /tmp/test_msa_maddr_q_h_32r6eb
+$PATH_TO_QEMU -cpu I6400  /tmp/test_msa_maddr_q_w_32r6eb
+$PATH_TO_QEMU -cpu I6400  /tmp/test_msa_msub_q_h_32r6eb
+$PATH_TO_QEMU -cpu I6400  /tmp/test_msa_msub_q_w_32r6eb
+$PATH_TO_QEMU -cpu I6400  /tmp/test_msa_msubr_q_h_32r6eb
+$PATH_TO_QEMU -cpu I6400  /tmp/test_msa_msubr_q_w_32r6eb
 $PATH_TO_QEMU -cpu I6400  /tmp/test_msa_mul_q_h_32r6eb
 $PATH_TO_QEMU -cpu I6400  /tmp/test_msa_mul_q_w_32r6eb
 $PATH_TO_QEMU -cpu I6400  /tmp/test_msa_mulr_q_h_32r6eb
@@ -271,14 +279,14 @@ $PATH_TO_QEMU -cpu I6400  /tmp/test_msa_subs_u_b_32r6eb
 $PATH_TO_QEMU -cpu I6400  /tmp/test_msa_subs_u_h_32r6eb
 $PATH_TO_QEMU -cpu I6400  /tmp/test_msa_subs_u_w_32r6eb
 $PATH_TO_QEMU -cpu I6400  /tmp/test_msa_subs_u_d_32r6eb
-$PATH_TO_QEMU -cpu I6400  /tmp/test_msa_subsuu_s_b_32r6eb
-$PATH_TO_QEMU -cpu I6400  /tmp/test_msa_subsuu_s_h_32r6eb
-$PATH_TO_QEMU -cpu I6400  /tmp/test_msa_subsuu_s_w_32r6eb
-$PATH_TO_QEMU -cpu I6400  /tmp/test_msa_subsuu_s_d_32r6eb
 $PATH_TO_QEMU -cpu I6400  /tmp/test_msa_subsus_u_b_32r6eb
 $PATH_TO_QEMU -cpu I6400  /tmp/test_msa_subsus_u_h_32r6eb
 $PATH_TO_QEMU -cpu I6400  /tmp/test_msa_subsus_u_w_32r6eb
 $PATH_TO_QEMU -cpu I6400  /tmp/test_msa_subsus_u_d_32r6eb
+$PATH_TO_QEMU -cpu I6400  /tmp/test_msa_subsuu_s_b_32r6eb
+$PATH_TO_QEMU -cpu I6400  /tmp/test_msa_subsuu_s_h_32r6eb
+$PATH_TO_QEMU -cpu I6400  /tmp/test_msa_subsuu_s_w_32r6eb
+$PATH_TO_QEMU -cpu I6400  /tmp/test_msa_subsuu_s_d_32r6eb
 $PATH_TO_QEMU -cpu I6400  /tmp/test_msa_subv_b_32r6eb
 $PATH_TO_QEMU -cpu I6400  /tmp/test_msa_subv_h_32r6eb
 $PATH_TO_QEMU -cpu I6400  /tmp/test_msa_subv_w_32r6eb
diff --git a/tests/tcg/mips/user/ase/msa/test_msa_run_32r6el.sh b/tests/tcg/mips/user/ase/msa/test_msa_run_32r6el.sh
index 4e079304d8..d4945da5e5 100755
--- a/tests/tcg/mips/user/ase/msa/test_msa_run_32r6el.sh
+++ b/tests/tcg/mips/user/ase/msa/test_msa_run_32r6el.sh
@@ -55,6 +55,14 @@ $PATH_TO_QEMU -cpu I6400  /tmp/test_msa_bset_d_32r6el
 # Fixed Multiply
 # --------------
 #
+$PATH_TO_QEMU -cpu I6400  /tmp/test_msa_madd_q_h_32r6el
+$PATH_TO_QEMU -cpu I6400  /tmp/test_msa_madd_q_w_32r6el
+$PATH_TO_QEMU -cpu I6400  /tmp/test_msa_maddr_q_h_32r6el
+$PATH_TO_QEMU -cpu I6400  /tmp/test_msa_maddr_q_w_32r6el
+$PATH_TO_QEMU -cpu I6400  /tmp/test_msa_msub_q_h_32r6el
+$PATH_TO_QEMU -cpu I6400  /tmp/test_msa_msub_q_w_32r6el
+$PATH_TO_QEMU -cpu I6400  /tmp/test_msa_msubr_q_h_32r6el
+$PATH_TO_QEMU -cpu I6400  /tmp/test_msa_msubr_q_w_32r6el
 $PATH_TO_QEMU -cpu I6400  /tmp/test_msa_mul_q_h_32r6el
 $PATH_TO_QEMU -cpu I6400  /tmp/test_msa_mul_q_w_32r6el
 $PATH_TO_QEMU -cpu I6400  /tmp/test_msa_mulr_q_h_32r6el
@@ -271,14 +279,14 @@ $PATH_TO_QEMU -cpu I6400  /tmp/test_msa_subs_u_b_32r6el
 $PATH_TO_QEMU -cpu I6400  /tmp/test_msa_subs_u_h_32r6el
 $PATH_TO_QEMU -cpu I6400  /tmp/test_msa_subs_u_w_32r6el
 $PATH_TO_QEMU -cpu I6400  /tmp/test_msa_subs_u_d_32r6el
-$PATH_TO_QEMU -cpu I6400  /tmp/test_msa_subsuu_s_b_32r6el
-$PATH_TO_QEMU -cpu I6400  /tmp/test_msa_subsuu_s_h_32r6el
-$PATH_TO_QEMU -cpu I6400  /tmp/test_msa_subsuu_s_w_32r6el
-$PATH_TO_QEMU -cpu I6400  /tmp/test_msa_subsuu_s_d_32r6el
 $PATH_TO_QEMU -cpu I6400  /tmp/test_msa_subsus_u_b_32r6el
 $PATH_TO_QEMU -cpu I6400  /tmp/test_msa_subsus_u_h_32r6el
 $PATH_TO_QEMU -cpu I6400  /tmp/test_msa_subsus_u_w_32r6el
 $PATH_TO_QEMU -cpu I6400  /tmp/test_msa_subsus_u_d_32r6el
+$PATH_TO_QEMU -cpu I6400  /tmp/test_msa_subsuu_s_b_32r6el
+$PATH_TO_QEMU -cpu I6400  /tmp/test_msa_subsuu_s_h_32r6el
+$PATH_TO_QEMU -cpu I6400  /tmp/test_msa_subsuu_s_w_32r6el
+$PATH_TO_QEMU -cpu I6400  /tmp/test_msa_subsuu_s_d_32r6el
 $PATH_TO_QEMU -cpu I6400  /tmp/test_msa_subv_b_32r6el
 $PATH_TO_QEMU -cpu I6400  /tmp/test_msa_subv_h_32r6el
 $PATH_TO_QEMU -cpu I6400  /tmp/test_msa_subv_w_32r6el
diff --git a/tests/tcg/mips/user/ase/msa/test_msa_run_64r6eb.sh b/tests/tcg/mips/user/ase/msa/test_msa_run_64r6eb.sh
index c127c1a6dc..6de6d7cacf 100755
--- a/tests/tcg/mips/user/ase/msa/test_msa_run_64r6eb.sh
+++ b/tests/tcg/mips/user/ase/msa/test_msa_run_64r6eb.sh
@@ -55,6 +55,14 @@ $PATH_TO_QEMU -cpu I6400  /tmp/test_msa_bset_d_64r6eb
 # Fixed Multiply
 # --------------
 #
+$PATH_TO_QEMU -cpu I6400  /tmp/test_msa_madd_q_h_64r6eb
+$PATH_TO_QEMU -cpu I6400  /tmp/test_msa_madd_q_w_64r6eb
+$PATH_TO_QEMU -cpu I6400  /tmp/test_msa_maddr_q_h_64r6eb
+$PATH_TO_QEMU -cpu I6400  /tmp/test_msa_maddr_q_w_64r6eb
+$PATH_TO_QEMU -cpu I6400  /tmp/test_msa_msub_q_h_64r6eb
+$PATH_TO_QEMU -cpu I6400  /tmp/test_msa_msub_q_w_64r6eb
+$PATH_TO_QEMU -cpu I6400  /tmp/test_msa_msubr_q_h_64r6eb
+$PATH_TO_QEMU -cpu I6400  /tmp/test_msa_msubr_q_w_64r6eb
 $PATH_TO_QEMU -cpu I6400  /tmp/test_msa_mul_q_h_64r6eb
 $PATH_TO_QEMU -cpu I6400  /tmp/test_msa_mul_q_w_64r6eb
 $PATH_TO_QEMU -cpu I6400  /tmp/test_msa_mulr_q_h_64r6eb
@@ -271,14 +279,14 @@ $PATH_TO_QEMU -cpu I6400  /tmp/test_msa_subs_u_b_64r6eb
 $PATH_TO_QEMU -cpu I6400  /tmp/test_msa_subs_u_h_64r6eb
 $PATH_TO_QEMU -cpu I6400  /tmp/test_msa_subs_u_w_64r6eb
 $PATH_TO_QEMU -cpu I6400  /tmp/test_msa_subs_u_d_64r6eb
-$PATH_TO_QEMU -cpu I6400  /tmp/test_msa_subsuu_s_b_64r6eb
-$PATH_TO_QEMU -cpu I6400  /tmp/test_msa_subsuu_s_h_64r6eb
-$PATH_TO_QEMU -cpu I6400  /tmp/test_msa_subsuu_s_w_64r6eb
-$PATH_TO_QEMU -cpu I6400  /tmp/test_msa_subsuu_s_d_64r6eb
 $PATH_TO_QEMU -cpu I6400  /tmp/test_msa_subsus_u_b_64r6eb
 $PATH_TO_QEMU -cpu I6400  /tmp/test_msa_subsus_u_h_64r6eb
 $PATH_TO_QEMU -cpu I6400  /tmp/test_msa_subsus_u_w_64r6eb
 $PATH_TO_QEMU -cpu I6400  /tmp/test_msa_subsus_u_d_64r6eb
+$PATH_TO_QEMU -cpu I6400  /tmp/test_msa_subsuu_s_b_64r6eb
+$PATH_TO_QEMU -cpu I6400  /tmp/test_msa_subsuu_s_h_64r6eb
+$PATH_TO_QEMU -cpu I6400  /tmp/test_msa_subsuu_s_w_64r6eb
+$PATH_TO_QEMU -cpu I6400  /tmp/test_msa_subsuu_s_d_64r6eb
 $PATH_TO_QEMU -cpu I6400  /tmp/test_msa_subv_b_64r6eb
 $PATH_TO_QEMU -cpu I6400  /tmp/test_msa_subv_h_64r6eb
 $PATH_TO_QEMU -cpu I6400  /tmp/test_msa_subv_w_64r6eb
diff --git a/tests/tcg/mips/user/ase/msa/test_msa_run_64r6el.sh b/tests/tcg/mips/user/ase/msa/test_msa_run_64r6el.sh
index 380d876364..979057df74 100755
--- a/tests/tcg/mips/user/ase/msa/test_msa_run_64r6el.sh
+++ b/tests/tcg/mips/user/ase/msa/test_msa_run_64r6el.sh
@@ -55,6 +55,14 @@ $PATH_TO_QEMU -cpu I6400  /tmp/test_msa_bset_d_64r6el
 # Fixed Multiply
 # --------------
 #
+$PATH_TO_QEMU -cpu I6400  /tmp/test_msa_madd_q_h_64r6el
+$PATH_TO_QEMU -cpu I6400  /tmp/test_msa_madd_q_w_64r6el
+$PATH_TO_QEMU -cpu I6400  /tmp/test_msa_maddr_q_h_64r6el
+$PATH_TO_QEMU -cpu I6400  /tmp/test_msa_maddr_q_w_64r6el
+$PATH_TO_QEMU -cpu I6400  /tmp/test_msa_msub_q_h_64r6el
+$PATH_TO_QEMU -cpu I6400  /tmp/test_msa_msub_q_w_64r6el
+$PATH_TO_QEMU -cpu I6400  /tmp/test_msa_msubr_q_h_64r6el
+$PATH_TO_QEMU -cpu I6400  /tmp/test_msa_msubr_q_w_64r6el
 $PATH_TO_QEMU -cpu I6400  /tmp/test_msa_mul_q_h_64r6el
 $PATH_TO_QEMU -cpu I6400  /tmp/test_msa_mul_q_w_64r6el
 $PATH_TO_QEMU -cpu I6400  /tmp/test_msa_mulr_q_h_64r6el
@@ -271,14 +279,14 @@ $PATH_TO_QEMU -cpu I6400  /tmp/test_msa_subs_u_b_64r6el
 $PATH_TO_QEMU -cpu I6400  /tmp/test_msa_subs_u_h_64r6el
 $PATH_TO_QEMU -cpu I6400  /tmp/test_msa_subs_u_w_64r6el
 $PATH_TO_QEMU -cpu I6400  /tmp/test_msa_subs_u_d_64r6el
-$PATH_TO_QEMU -cpu I6400  /tmp/test_msa_subsuu_s_b_64r6el
-$PATH_TO_QEMU -cpu I6400  /tmp/test_msa_subsuu_s_h_64r6el
-$PATH_TO_QEMU -cpu I6400  /tmp/test_msa_subsuu_s_w_64r6el
-$PATH_TO_QEMU -cpu I6400  /tmp/test_msa_subsuu_s_d_64r6el
 $PATH_TO_QEMU -cpu I6400  /tmp/test_msa_subsus_u_b_64r6el
 $PATH_TO_QEMU -cpu I6400  /tmp/test_msa_subsus_u_h_64r6el
 $PATH_TO_QEMU -cpu I6400  /tmp/test_msa_subsus_u_w_64r6el
 $PATH_TO_QEMU -cpu I6400  /tmp/test_msa_subsus_u_d_64r6el
+$PATH_TO_QEMU -cpu I6400  /tmp/test_msa_subsuu_s_b_64r6el
+$PATH_TO_QEMU -cpu I6400  /tmp/test_msa_subsuu_s_h_64r6el
+$PATH_TO_QEMU -cpu I6400  /tmp/test_msa_subsuu_s_w_64r6el
+$PATH_TO_QEMU -cpu I6400  /tmp/test_msa_subsuu_s_d_64r6el
 $PATH_TO_QEMU -cpu I6400  /tmp/test_msa_subv_b_64r6el
 $PATH_TO_QEMU -cpu I6400  /tmp/test_msa_subv_h_64r6el
 $PATH_TO_QEMU -cpu I6400  /tmp/test_msa_subv_w_64r6el
diff --git a/vl.c b/vl.c
index 99a56b5556..ddefa75c1d 100644
--- a/vl.c
+++ b/vl.c
@@ -55,7 +55,6 @@ int main(int argc, char **argv)
 #include "qemu/error-report.h"
 #include "qemu/sockets.h"
 #include "hw/hw.h"
-#include "hw/boards.h"
 #include "sysemu/accel.h"
 #include "hw/usb.h"
 #include "hw/isa/isa.h"
@@ -125,7 +124,6 @@ int main(int argc, char **argv)
 #include "qapi/qapi-visit-block-core.h"
 #include "qapi/qapi-visit-ui.h"
 #include "qapi/qapi-commands-block-core.h"
-#include "qapi/qapi-commands-misc.h"
 #include "qapi/qapi-commands-run-state.h"
 #include "qapi/qapi-commands-ui.h"
 #include "qapi/qmp/qerror.h"
@@ -1406,41 +1404,6 @@ static MachineClass *find_default_machine(GSList *machines)
     return NULL;
 }
 
-MachineInfoList *qmp_query_machines(Error **errp)
-{
-    GSList *el, *machines = object_class_get_list(TYPE_MACHINE, false);
-    MachineInfoList *mach_list = NULL;
-
-    for (el = machines; el; el = el->next) {
-        MachineClass *mc = el->data;
-        MachineInfoList *entry;
-        MachineInfo *info;
-
-        info = g_malloc0(sizeof(*info));
-        if (mc->is_default) {
-            info->has_is_default = true;
-            info->is_default = true;
-        }
-
-        if (mc->alias) {
-            info->has_alias = true;
-            info->alias = g_strdup(mc->alias);
-        }
-
-        info->name = g_strdup(mc->name);
-        info->cpu_max = !mc->max_cpus ? 1 : mc->max_cpus;
-        info->hotpluggable_cpus = mc->has_hotpluggable_cpus;
-
-        entry = g_malloc0(sizeof(*entry));
-        entry->value = info;
-        entry->next = mach_list;
-        mach_list = entry;
-    }
-
-    g_slist_free(machines);
-    return mach_list;
-}
-
 static int machine_help_func(QemuOpts *opts, MachineState *machine)
 {
     ObjectProperty *prop;
@@ -1739,14 +1702,6 @@ bool qemu_wakeup_suspend_enabled(void)
     return wakeup_suspend_enabled;
 }
 
-CurrentMachineParams *qmp_query_current_machine(Error **errp)
-{
-    CurrentMachineParams *params = g_malloc0(sizeof(*params));
-    params->wakeup_suspend_support = qemu_wakeup_suspend_enabled();
-
-    return params;
-}
-
 void qemu_system_killed(int signal, pid_t pid)
 {
     shutdown_signal = signal;