diff options
201 files changed, 12541 insertions, 484 deletions
diff --git a/hw/display/Kconfig b/hw/display/Kconfig index a96ea763a8..86c1d544c5 100644 --- a/hw/display/Kconfig +++ b/hw/display/Kconfig @@ -106,3 +106,9 @@ config VIRTIO_VGA config DPCD bool + +config ATI_VGA + bool + default y if PCI_DEVICES + depends on PCI + select VGA diff --git a/hw/display/Makefile.objs b/hw/display/Makefile.objs index 576fca4eb6..dbd453ab1b 100644 --- a/hw/display/Makefile.objs +++ b/hw/display/Makefile.objs @@ -51,3 +51,5 @@ virtio-gpu-3d.o-cflags := $(VIRGL_CFLAGS) virtio-gpu-3d.o-libs += $(VIRGL_LIBS) obj-$(CONFIG_DPCD) += dpcd.o obj-$(CONFIG_XLNX_ZYNQMP_ARM) += xlnx_dp.o + +obj-$(CONFIG_ATI_VGA) += ati.o ati_2d.o ati_dbg.o diff --git a/hw/display/ati.c b/hw/display/ati.c new file mode 100644 index 0000000000..8322f52aff --- /dev/null +++ b/hw/display/ati.c @@ -0,0 +1,865 @@ +/* + * QEMU ATI SVGA emulation + * + * Copyright (c) 2019 BALATON Zoltan + * + * This work is licensed under the GNU GPL license version 2 or later. + */ + +/* + * WARNING: + * This is very incomplete and only enough for Linux console and some + * unaccelerated X output at the moment. + * Currently it's little more than a frame buffer with minimal functions, + * other more advanced features of the hardware are yet to be implemented. + * We only aim for Rage 128 Pro (and some RV100) and 2D only at first, + * No 3D at all yet (maybe after 2D works, but feel free to improve it) + */ + +#include "ati_int.h" +#include "ati_regs.h" +#include "vga_regs.h" +#include "qemu/log.h" +#include "qemu/error-report.h" +#include "qapi/error.h" +#include "hw/hw.h" +#include "ui/console.h" +#include "trace.h" + +#define ATI_DEBUG_HW_CURSOR 0 + +static const struct { + const char *name; + uint16_t dev_id; +} ati_model_aliases[] = { + { "rage128p", PCI_DEVICE_ID_ATI_RAGE128_PF }, + { "rv100", PCI_DEVICE_ID_ATI_RADEON_QY }, +}; + +enum { VGA_MODE, EXT_MODE }; + +static void ati_vga_switch_mode(ATIVGAState *s) +{ + DPRINTF("%d -> %d\n", + s->mode, !!(s->regs.crtc_gen_cntl & CRTC2_EXT_DISP_EN)); + if (s->regs.crtc_gen_cntl & CRTC2_EXT_DISP_EN) { + /* Extended mode enabled */ + s->mode = EXT_MODE; + if (s->regs.crtc_gen_cntl & CRTC2_EN) { + /* CRT controller enabled, use CRTC values */ + uint32_t offs = s->regs.crtc_offset & 0x07ffffff; + int stride = (s->regs.crtc_pitch & 0x7ff) * 8; + int bpp = 0; + int h, v; + + if (s->regs.crtc_h_total_disp == 0) { + s->regs.crtc_h_total_disp = ((640 / 8) - 1) << 16; + } + if (s->regs.crtc_v_total_disp == 0) { + s->regs.crtc_v_total_disp = (480 - 1) << 16; + } + h = ((s->regs.crtc_h_total_disp >> 16) + 1) * 8; + v = (s->regs.crtc_v_total_disp >> 16) + 1; + switch (s->regs.crtc_gen_cntl & CRTC_PIX_WIDTH_MASK) { + case CRTC_PIX_WIDTH_4BPP: + bpp = 4; + break; + case CRTC_PIX_WIDTH_8BPP: + bpp = 8; + break; + case CRTC_PIX_WIDTH_15BPP: + bpp = 15; + break; + case CRTC_PIX_WIDTH_16BPP: + bpp = 16; + break; + case CRTC_PIX_WIDTH_24BPP: + bpp = 24; + break; + case CRTC_PIX_WIDTH_32BPP: + bpp = 32; + break; + default: + qemu_log_mask(LOG_UNIMP, "Unsupported bpp value\n"); + } + assert(bpp != 0); + DPRINTF("Switching to %dx%d %d %d @ %x\n", h, v, stride, bpp, offs); + vbe_ioport_write_index(&s->vga, 0, VBE_DISPI_INDEX_ENABLE); + vbe_ioport_write_data(&s->vga, 0, VBE_DISPI_DISABLED); + /* reset VBE regs then set up mode */ + s->vga.vbe_regs[VBE_DISPI_INDEX_XRES] = h; + s->vga.vbe_regs[VBE_DISPI_INDEX_YRES] = v; + s->vga.vbe_regs[VBE_DISPI_INDEX_BPP] = bpp; + /* enable mode via ioport so it updates vga regs */ + vbe_ioport_write_index(&s->vga, 0, VBE_DISPI_INDEX_ENABLE); + vbe_ioport_write_data(&s->vga, 0, VBE_DISPI_ENABLED | + VBE_DISPI_LFB_ENABLED | VBE_DISPI_NOCLEARMEM | + (s->regs.dac_cntl & DAC_8BIT_EN ? VBE_DISPI_8BIT_DAC : 0)); + /* now set offset and stride after enable as that resets these */ + if (stride) { + vbe_ioport_write_index(&s->vga, 0, VBE_DISPI_INDEX_VIRT_WIDTH); + vbe_ioport_write_data(&s->vga, 0, stride); + if (offs % stride == 0) { + vbe_ioport_write_index(&s->vga, 0, VBE_DISPI_INDEX_Y_OFFSET); + vbe_ioport_write_data(&s->vga, 0, offs / stride); + } else { + /* FIXME what to do with this? */ + error_report("VGA offset is not multiple of pitch, " + "expect bad picture"); + } + } + } + } else { + /* VGA mode enabled */ + s->mode = VGA_MODE; + vbe_ioport_write_index(&s->vga, 0, VBE_DISPI_INDEX_ENABLE); + vbe_ioport_write_data(&s->vga, 0, VBE_DISPI_DISABLED); + } +} + +/* Used by host side hardware cursor */ +static void ati_cursor_define(ATIVGAState *s) +{ + uint8_t data[1024]; + uint8_t *src; + int i, j, idx = 0; + + if ((s->regs.cur_offset & BIT(31)) || s->cursor_guest_mode) { + return; /* Do not update cursor if locked or rendered by guest */ + } + /* FIXME handle cur_hv_offs correctly */ + src = s->vga.vram_ptr + (s->regs.crtc_offset & 0x07ffffff) + + s->regs.cur_offset - (s->regs.cur_hv_offs >> 16) - + (s->regs.cur_hv_offs & 0xffff) * 16; + for (i = 0; i < 64; i++) { + for (j = 0; j < 8; j++, idx++) { + data[idx] = src[i * 16 + j]; + data[512 + idx] = src[i * 16 + j + 8]; + } + } + if (!s->cursor) { + s->cursor = cursor_alloc(64, 64); + } + cursor_set_mono(s->cursor, s->regs.cur_color1, s->regs.cur_color0, + &data[512], 1, &data[0]); + dpy_cursor_define(s->vga.con, s->cursor); +} + +/* Alternatively support guest rendered hardware cursor */ +static void ati_cursor_invalidate(VGACommonState *vga) +{ + ATIVGAState *s = container_of(vga, ATIVGAState, vga); + int size = (s->regs.crtc_gen_cntl & CRTC2_CUR_EN) ? 64 : 0; + + if (s->regs.cur_offset & BIT(31)) { + return; /* Do not update cursor if locked */ + } + if (s->cursor_size != size || + vga->hw_cursor_x != s->regs.cur_hv_pos >> 16 || + vga->hw_cursor_y != (s->regs.cur_hv_pos & 0xffff) || + s->cursor_offset != s->regs.cur_offset - (s->regs.cur_hv_offs >> 16) - + (s->regs.cur_hv_offs & 0xffff) * 16) { + /* Remove old cursor then update and show new one if needed */ + vga_invalidate_scanlines(vga, vga->hw_cursor_y, vga->hw_cursor_y + 63); + vga->hw_cursor_x = s->regs.cur_hv_pos >> 16; + vga->hw_cursor_y = s->regs.cur_hv_pos & 0xffff; + s->cursor_offset = s->regs.cur_offset - (s->regs.cur_hv_offs >> 16) - + (s->regs.cur_hv_offs & 0xffff) * 16; + s->cursor_size = size; + if (size) { + vga_invalidate_scanlines(vga, + vga->hw_cursor_y, vga->hw_cursor_y + 63); + } + } +} + +static void ati_cursor_draw_line(VGACommonState *vga, uint8_t *d, int scr_y) +{ + ATIVGAState *s = container_of(vga, ATIVGAState, vga); + uint8_t *src; + uint32_t *dp = (uint32_t *)d; + int i, j, h; + + if (!(s->regs.crtc_gen_cntl & CRTC2_CUR_EN) || + scr_y < vga->hw_cursor_y || scr_y >= vga->hw_cursor_y + 64 || + scr_y > s->regs.crtc_v_total_disp >> 16) { + return; + } + /* FIXME handle cur_hv_offs correctly */ + src = s->vga.vram_ptr + (s->regs.crtc_offset & 0x07ffffff) + + s->cursor_offset + (scr_y - vga->hw_cursor_y) * 16; + dp = &dp[vga->hw_cursor_x]; + h = ((s->regs.crtc_h_total_disp >> 16) + 1) * 8; + for (i = 0; i < 8; i++) { + uint32_t color; + uint8_t abits = src[i]; + uint8_t xbits = src[i + 8]; + for (j = 0; j < 8; j++, abits <<= 1, xbits <<= 1) { + if (abits & BIT(7)) { + if (xbits & BIT(7)) { + color = dp[i * 8 + j] ^ 0xffffffff; /* complement */ + } else { + continue; /* transparent, no change */ + } + } else { + color = (xbits & BIT(7) ? s->regs.cur_color1 : + s->regs.cur_color0) << 8 | 0xff; + } + if (vga->hw_cursor_x + i * 8 + j >= h) { + return; /* end of screen, don't span to next line */ + } + dp[i * 8 + j] = color; + } + } +} + +static inline uint64_t ati_reg_read_offs(uint32_t reg, int offs, + unsigned int size) +{ + if (offs == 0 && size == 4) { + return reg; + } else { + return extract32(reg, offs * BITS_PER_BYTE, size * BITS_PER_BYTE); + } +} + +static uint64_t ati_mm_read(void *opaque, hwaddr addr, unsigned int size) +{ + ATIVGAState *s = opaque; + uint64_t val = 0; + + switch (addr) { + case MM_INDEX: + val = s->regs.mm_index; + break; + case MM_DATA ... MM_DATA + 3: + /* indexed access to regs or memory */ + if (s->regs.mm_index & BIT(31)) { + if (s->regs.mm_index <= s->vga.vram_size - size) { + int i = size - 1; + while (i >= 0) { + val <<= 8; + val |= s->vga.vram_ptr[s->regs.mm_index + i--]; + } + } + } else { + val = ati_mm_read(s, s->regs.mm_index + addr - MM_DATA, size); + } + break; + case BIOS_0_SCRATCH ... BUS_CNTL - 1: + { + int i = (addr - BIOS_0_SCRATCH) / 4; + if (s->dev_id == PCI_DEVICE_ID_ATI_RAGE128_PF && i > 3) { + break; + } + val = ati_reg_read_offs(s->regs.bios_scratch[i], + addr - (BIOS_0_SCRATCH + i * 4), size); + break; + } + case CRTC_GEN_CNTL ... CRTC_GEN_CNTL + 3: + val = ati_reg_read_offs(s->regs.crtc_gen_cntl, + addr - CRTC_GEN_CNTL, size); + break; + case CRTC_EXT_CNTL ... CRTC_EXT_CNTL + 3: + val = ati_reg_read_offs(s->regs.crtc_ext_cntl, + addr - CRTC_EXT_CNTL, size); + break; + case DAC_CNTL: + val = s->regs.dac_cntl; + break; +/* case GPIO_MONID: FIXME hook up DDC I2C here */ + case PALETTE_INDEX: + /* FIXME unaligned access */ + val = vga_ioport_read(&s->vga, VGA_PEL_IR) << 16; + val |= vga_ioport_read(&s->vga, VGA_PEL_IW) & 0xff; + break; + case PALETTE_DATA: + val = vga_ioport_read(&s->vga, VGA_PEL_D); + break; + case CNFG_MEMSIZE: + val = s->vga.vram_size; + break; + case MC_STATUS: + val = 5; + break; + case RBBM_STATUS: + case GUI_STAT: + val = 64; /* free CMDFIFO entries */ + break; + case CRTC_H_TOTAL_DISP: + val = s->regs.crtc_h_total_disp; + break; + case CRTC_H_SYNC_STRT_WID: + val = s->regs.crtc_h_sync_strt_wid; + break; + case CRTC_V_TOTAL_DISP: + val = s->regs.crtc_v_total_disp; + break; + case CRTC_V_SYNC_STRT_WID: + val = s->regs.crtc_v_sync_strt_wid; + break; + case CRTC_OFFSET: + val = s->regs.crtc_offset; + break; + case CRTC_OFFSET_CNTL: + val = s->regs.crtc_offset_cntl; + break; + case CRTC_PITCH: + val = s->regs.crtc_pitch; + break; + case 0xf00 ... 0xfff: + val = pci_default_read_config(&s->dev, addr - 0xf00, size); + break; + case CUR_OFFSET: + val = s->regs.cur_offset; + break; + case CUR_HORZ_VERT_POSN: + val = s->regs.cur_hv_pos; + val |= s->regs.cur_offset & BIT(31); + break; + case CUR_HORZ_VERT_OFF: + val = s->regs.cur_hv_offs; + val |= s->regs.cur_offset & BIT(31); + break; + case CUR_CLR0: + val = s->regs.cur_color0; + break; + case CUR_CLR1: + val = s->regs.cur_color1; + break; + case DST_OFFSET: + val = s->regs.dst_offset; + break; + case DST_PITCH: + val = s->regs.dst_pitch; + if (s->dev_id == PCI_DEVICE_ID_ATI_RAGE128_PF) { + val &= s->regs.dst_tile << 16; + } + break; + case DST_WIDTH: + val = s->regs.dst_width; + break; + case DST_HEIGHT: + val = s->regs.dst_height; + break; + case SRC_X: + val = s->regs.src_x; + break; + case SRC_Y: + val = s->regs.src_y; + break; + case DST_X: + val = s->regs.dst_x; + break; + case DST_Y: + val = s->regs.dst_y; + break; + case DP_GUI_MASTER_CNTL: + val = s->regs.dp_gui_master_cntl; + break; + case SRC_OFFSET: + val = s->regs.src_offset; + break; + case SRC_PITCH: + val = s->regs.src_pitch; + if (s->dev_id == PCI_DEVICE_ID_ATI_RAGE128_PF) { + val &= s->regs.src_tile << 16; + } + break; + case DP_BRUSH_BKGD_CLR: + val = s->regs.dp_brush_bkgd_clr; + break; + case DP_BRUSH_FRGD_CLR: + val = s->regs.dp_brush_frgd_clr; + break; + case DP_SRC_FRGD_CLR: + val = s->regs.dp_src_frgd_clr; + break; + case DP_SRC_BKGD_CLR: + val = s->regs.dp_src_bkgd_clr; + break; + case DP_CNTL: + val = s->regs.dp_cntl; + break; + case DP_DATATYPE: + val = s->regs.dp_datatype; + break; + case DP_MIX: + val = s->regs.dp_mix; + break; + case DP_WRITE_MASK: + val = s->regs.dp_write_mask; + break; + case DEFAULT_OFFSET: + val = s->regs.default_offset; + break; + case DEFAULT_PITCH: + val = s->regs.default_pitch; + break; + case DEFAULT_SC_BOTTOM_RIGHT: + val = s->regs.default_sc_bottom_right; + break; + default: + break; + } + if (addr < CUR_OFFSET || addr > CUR_CLR1 || ATI_DEBUG_HW_CURSOR) { + trace_ati_mm_read(size, addr, ati_reg_name(addr & ~3ULL), val); + } + return val; +} + +static inline void ati_reg_write_offs(uint32_t *reg, int offs, + uint64_t data, unsigned int size) +{ + if (offs == 0 && size == 4) { + *reg = data; + } else { + *reg = deposit32(*reg, offs * BITS_PER_BYTE, size * BITS_PER_BYTE, + data); + } +} + +static void ati_mm_write(void *opaque, hwaddr addr, + uint64_t data, unsigned int size) +{ + ATIVGAState *s = opaque; + + if (addr < CUR_OFFSET || addr > CUR_CLR1 || ATI_DEBUG_HW_CURSOR) { + trace_ati_mm_write(size, addr, ati_reg_name(addr & ~3ULL), data); + } + switch (addr) { + case MM_INDEX: + s->regs.mm_index = data; + break; + case MM_DATA ... MM_DATA + 3: + /* indexed access to regs or memory */ + if (s->regs.mm_index & BIT(31)) { + if (s->regs.mm_index <= s->vga.vram_size - size) { + int i = 0; + while (i < size) { + s->vga.vram_ptr[s->regs.mm_index + i] = data & 0xff; + data >>= 8; + } + } + } else { + ati_mm_write(s, s->regs.mm_index + addr - MM_DATA, data, size); + } + break; + case BIOS_0_SCRATCH ... BUS_CNTL - 1: + { + int i = (addr - BIOS_0_SCRATCH) / 4; + if (s->dev_id == PCI_DEVICE_ID_ATI_RAGE128_PF && i > 3) { + break; + } + ati_reg_write_offs(&s->regs.bios_scratch[i], + addr - (BIOS_0_SCRATCH + i * 4), data, size); + break; + } + case CRTC_GEN_CNTL ... CRTC_GEN_CNTL + 3: + { + uint32_t val = s->regs.crtc_gen_cntl; + ati_reg_write_offs(&s->regs.crtc_gen_cntl, + addr - CRTC_GEN_CNTL, data, size); + if ((val & CRTC2_CUR_EN) != (s->regs.crtc_gen_cntl & CRTC2_CUR_EN)) { + if (s->cursor_guest_mode) { + s->vga.force_shadow = !!(s->regs.crtc_gen_cntl & CRTC2_CUR_EN); + } else { + if (s->regs.crtc_gen_cntl & CRTC2_CUR_EN) { + ati_cursor_define(s); + } + dpy_mouse_set(s->vga.con, s->regs.cur_hv_pos >> 16, + s->regs.cur_hv_pos & 0xffff, + (s->regs.crtc_gen_cntl & CRTC2_CUR_EN) != 0); + } + } + if ((val & (CRTC2_EXT_DISP_EN | CRTC2_EN)) != + (s->regs.crtc_gen_cntl & (CRTC2_EXT_DISP_EN | CRTC2_EN))) { + ati_vga_switch_mode(s); + } + break; + } + case CRTC_EXT_CNTL ... CRTC_EXT_CNTL + 3: + { + uint32_t val = s->regs.crtc_ext_cntl; + ati_reg_write_offs(&s->regs.crtc_ext_cntl, + addr - CRTC_EXT_CNTL, data, size); + if (s->regs.crtc_ext_cntl & CRT_CRTC_DISPLAY_DIS) { + DPRINTF("Display disabled\n"); + s->vga.ar_index &= ~BIT(5); + } else { + DPRINTF("Display enabled\n"); + s->vga.ar_index |= BIT(5); + ati_vga_switch_mode(s); + } + if ((val & CRT_CRTC_DISPLAY_DIS) != + (s->regs.crtc_ext_cntl & CRT_CRTC_DISPLAY_DIS)) { + ati_vga_switch_mode(s); + } + break; + } + case DAC_CNTL: + s->regs.dac_cntl = data & 0xffffe3ff; + s->vga.dac_8bit = !!(data & DAC_8BIT_EN); + break; +/* case GPIO_MONID: FIXME hook up DDC I2C here */ + case PALETTE_INDEX ... PALETTE_INDEX + 3: + if (size == 4) { + vga_ioport_write(&s->vga, VGA_PEL_IR, (data >> 16) & 0xff); + vga_ioport_write(&s->vga, VGA_PEL_IW, data & 0xff); + } else { + if (addr == PALETTE_INDEX) { + vga_ioport_write(&s->vga, VGA_PEL_IW, data & 0xff); + } else { + vga_ioport_write(&s->vga, VGA_PEL_IR, data & 0xff); + } + } + break; + case PALETTE_DATA ... PALETTE_DATA + 3: + data <<= addr - PALETTE_DATA; + data = bswap32(data) >> 8; + vga_ioport_write(&s->vga, VGA_PEL_D, data & 0xff); + data >>= 8; + vga_ioport_write(&s->vga, VGA_PEL_D, data & 0xff); + data >>= 8; + vga_ioport_write(&s->vga, VGA_PEL_D, data & 0xff); + break; + case CRTC_H_TOTAL_DISP: + s->regs.crtc_h_total_disp = data & 0x07ff07ff; + break; + case CRTC_H_SYNC_STRT_WID: + s->regs.crtc_h_sync_strt_wid = data & 0x17bf1fff; + break; + case CRTC_V_TOTAL_DISP: + s->regs.crtc_v_total_disp = data & 0x0fff0fff; + break; + case CRTC_V_SYNC_STRT_WID: + s->regs.crtc_v_sync_strt_wid = data & 0x9f0fff; + break; + case CRTC_OFFSET: + s->regs.crtc_offset = data & 0xc7ffffff; + break; + case CRTC_OFFSET_CNTL: + s->regs.crtc_offset_cntl = data; /* FIXME */ + break; + case CRTC_PITCH: + s->regs.crtc_pitch = data & 0x07ff07ff; + break; + case 0xf00 ... 0xfff: + /* read-only copy of PCI config space so ignore writes */ + break; + case CUR_OFFSET: + if (s->regs.cur_offset != (data & 0x87fffff0)) { + s->regs.cur_offset = data & 0x87fffff0; + ati_cursor_define(s); + } + break; + case CUR_HORZ_VERT_POSN: + s->regs.cur_hv_pos = data & 0x3fff0fff; + if (data & BIT(31)) { + s->regs.cur_offset |= data & BIT(31); + } else if (s->regs.cur_offset & BIT(31)) { + s->regs.cur_offset &= ~BIT(31); + ati_cursor_define(s); + } + if (!s->cursor_guest_mode && + (s->regs.crtc_gen_cntl & CRTC2_CUR_EN) && !(data & BIT(31))) { + dpy_mouse_set(s->vga.con, s->regs.cur_hv_pos >> 16, + s->regs.cur_hv_pos & 0xffff, 1); + } + break; + case CUR_HORZ_VERT_OFF: + s->regs.cur_hv_offs = data & 0x3f003f; + if (data & BIT(31)) { + s->regs.cur_offset |= data & BIT(31); + } else if (s->regs.cur_offset & BIT(31)) { + s->regs.cur_offset &= ~BIT(31); + ati_cursor_define(s); + } + break; + case CUR_CLR0: + if (s->regs.cur_color0 != (data & 0xffffff)) { + s->regs.cur_color0 = data & 0xffffff; + ati_cursor_define(s); + } + break; + case CUR_CLR1: + /* + * Update cursor unconditionally here because some clients set up + * other registers before actually writing cursor data to memory at + * offset so we would miss cursor change unless always updating here + */ + s->regs.cur_color1 = data & 0xffffff; + ati_cursor_define(s); + break; + case DST_OFFSET: + if (s->dev_id == PCI_DEVICE_ID_ATI_RAGE128_PF) { + s->regs.dst_offset = data & 0xfffffff0; + } else { + s->regs.dst_offset = data & 0xfffffc00; + } + break; + case DST_PITCH: + if (s->dev_id == PCI_DEVICE_ID_ATI_RAGE128_PF) { + s->regs.dst_pitch = data & 0x3fff; + s->regs.dst_tile = (data >> 16) & 1; + } else { + s->regs.dst_pitch = data & 0x3ff0; + } + break; + case DST_TILE: + if (s->dev_id == PCI_DEVICE_ID_ATI_RADEON_QY) { + s->regs.dst_tile = data & 3; + } + break; + case DST_WIDTH: + s->regs.dst_width = data & 0x3fff; + ati_2d_blt(s); + break; + case DST_HEIGHT: + s->regs.dst_height = data & 0x3fff; + break; + case SRC_X: + s->regs.src_x = data & 0x3fff; + break; + case SRC_Y: + s->regs.src_y = data & 0x3fff; + break; + case DST_X: + s->regs.dst_x = data & 0x3fff; + break; + case DST_Y: + s->regs.dst_y = data & 0x3fff; + break; + case SRC_PITCH_OFFSET: + if (s->dev_id == PCI_DEVICE_ID_ATI_RAGE128_PF) { + s->regs.src_offset = (data & 0x1fffff) << 5; + s->regs.src_pitch = (data >> 21) & 0x3ff; + s->regs.src_tile = data >> 31; + } else { + s->regs.src_offset = (data & 0x3fffff) << 11; + s->regs.src_pitch = (data & 0x3fc00000) >> 16; + s->regs.src_tile = (data >> 30) & 1; + } + break; + case DST_PITCH_OFFSET: + if (s->dev_id == PCI_DEVICE_ID_ATI_RAGE128_PF) { + s->regs.dst_offset = (data & 0x1fffff) << 5; + s->regs.dst_pitch = (data >> 21) & 0x3ff; + s->regs.dst_tile = data >> 31; + } else { + s->regs.dst_offset = (data & 0x3fffff) << 11; + s->regs.dst_pitch = (data & 0x3fc00000) >> 16; + s->regs.dst_tile = data >> 30; + } + break; + case SRC_Y_X: + s->regs.src_x = data & 0x3fff; + s->regs.src_y = (data >> 16) & 0x3fff; + break; + case DST_Y_X: + s->regs.dst_x = data & 0x3fff; + s->regs.dst_y = (data >> 16) & 0x3fff; + break; + case DST_HEIGHT_WIDTH: + s->regs.dst_width = data & 0x3fff; + s->regs.dst_height = (data >> 16) & 0x3fff; + ati_2d_blt(s); + break; + case DP_GUI_MASTER_CNTL: + s->regs.dp_gui_master_cntl = data & 0xf800000f; + s->regs.dp_datatype = (data & 0x0f00) >> 8 | (data & 0x30f0) << 4 | + (data & 0x4000) << 16; + s->regs.dp_mix = (data & GMC_ROP3_MASK) | (data & 0x7000000) >> 16; + break; + case DST_WIDTH_X: + s->regs.dst_x = data & 0x3fff; + s->regs.dst_width = (data >> 16) & 0x3fff; + ati_2d_blt(s); + break; + case SRC_X_Y: + s->regs.src_y = data & 0x3fff; + s->regs.src_x = (data >> 16) & 0x3fff; + break; + case DST_X_Y: + s->regs.dst_y = data & 0x3fff; + s->regs.dst_x = (data >> 16) & 0x3fff; + break; + case DST_WIDTH_HEIGHT: + s->regs.dst_height = data & 0x3fff; + s->regs.dst_width = (data >> 16) & 0x3fff; + ati_2d_blt(s); + break; + case DST_HEIGHT_Y: + s->regs.dst_y = data & 0x3fff; + s->regs.dst_height = (data >> 16) & 0x3fff; + break; + case SRC_OFFSET: + if (s->dev_id == PCI_DEVICE_ID_ATI_RAGE128_PF) { + s->regs.src_offset = data & 0xfffffff0; + } else { + s->regs.src_offset = data & 0xfffffc00; + } + break; + case SRC_PITCH: + if (s->dev_id == PCI_DEVICE_ID_ATI_RAGE128_PF) { + s->regs.src_pitch = data & 0x3fff; + s->regs.src_tile = (data >> 16) & 1; + } else { + s->regs.src_pitch = data & 0x3ff0; + } + break; + case DP_BRUSH_BKGD_CLR: + s->regs.dp_brush_bkgd_clr = data; + break; + case DP_BRUSH_FRGD_CLR: + s->regs.dp_brush_frgd_clr = data; + break; + case DP_CNTL: + s->regs.dp_cntl = data; + break; + case DP_DATATYPE: + s->regs.dp_datatype = data & 0xe0070f0f; + break; + case DP_MIX: + s->regs.dp_mix = data & 0x00ff0700; + break; + case DP_WRITE_MASK: + s->regs.dp_write_mask = data; + break; + case DEFAULT_OFFSET: + data &= (s->dev_id == PCI_DEVICE_ID_ATI_RAGE128_PF ? + 0x03fffc00 : 0xfffffc00); + s->regs.default_offset = data; + break; + case DEFAULT_PITCH: + if (s->dev_id == PCI_DEVICE_ID_ATI_RAGE128_PF) { + s->regs.default_pitch = data & 0x103ff; + } + break; + case DEFAULT_SC_BOTTOM_RIGHT: + s->regs.default_sc_bottom_right = data & 0x3fff3fff; + break; + default: + break; + } +} + +static const MemoryRegionOps ati_mm_ops = { + .read = ati_mm_read, + .write = ati_mm_write, + .endianness = DEVICE_LITTLE_ENDIAN, +}; + +static void ati_vga_realize(PCIDevice *dev, Error **errp) +{ + ATIVGAState *s = ATI_VGA(dev); + VGACommonState *vga = &s->vga; + + if (s->model) { + int i; + for (i = 0; i < ARRAY_SIZE(ati_model_aliases); i++) { + if (!strcmp(s->model, ati_model_aliases[i].name)) { + s->dev_id = ati_model_aliases[i].dev_id; + break; + } + } + if (i >= ARRAY_SIZE(ati_model_aliases)) { + warn_report("Unknown ATI VGA model name, " + "using default rage128p"); + } + } + if (s->dev_id != PCI_DEVICE_ID_ATI_RAGE128_PF && + s->dev_id != PCI_DEVICE_ID_ATI_RADEON_QY) { + error_setg(errp, "Unknown ATI VGA device id, " + "only 0x5046 and 0x5159 are supported"); + return; + } + pci_set_word(dev->config + PCI_DEVICE_ID, s->dev_id); + + if (s->dev_id == PCI_DEVICE_ID_ATI_RADEON_QY && + s->vga.vram_size_mb < 16) { + warn_report("Too small video memory for device id"); + s->vga.vram_size_mb = 16; + } + + /* init vga bits */ + vga_common_init(vga, OBJECT(s)); + vga_init(vga, OBJECT(s), pci_address_space(dev), + pci_address_space_io(dev), true); + vga->con = graphic_console_init(DEVICE(s), 0, s->vga.hw_ops, &s->vga); + if (s->cursor_guest_mode) { + vga->cursor_invalidate = ati_cursor_invalidate; + vga->cursor_draw_line = ati_cursor_draw_line; + } + + /* mmio register space */ + memory_region_init_io(&s->mm, OBJECT(s), &ati_mm_ops, s, + "ati.mmregs", 0x4000); + /* io space is alias to beginning of mmregs */ + memory_region_init_alias(&s->io, OBJECT(s), "ati.io", &s->mm, 0, 0x100); + + pci_register_bar(dev, 0, PCI_BASE_ADDRESS_MEM_PREFETCH, &vga->vram); + pci_register_bar(dev, 1, PCI_BASE_ADDRESS_SPACE_IO, &s->io); + pci_register_bar(dev, 2, PCI_BASE_ADDRESS_SPACE_MEMORY, &s->mm); +} + +static void ati_vga_reset(DeviceState *dev) +{ + ATIVGAState *s = ATI_VGA(dev); + + /* reset vga */ + vga_common_reset(&s->vga); + s->mode = VGA_MODE; +} + +static void ati_vga_exit(PCIDevice *dev) +{ + ATIVGAState *s = ATI_VGA(dev); + + graphic_console_close(s->vga.con); +} + +static Property ati_vga_properties[] = { + DEFINE_PROP_UINT32("vgamem_mb", ATIVGAState, vga.vram_size_mb, 16), + DEFINE_PROP_STRING("model", ATIVGAState, model), + DEFINE_PROP_UINT16("x-device-id", ATIVGAState, dev_id, + PCI_DEVICE_ID_ATI_RAGE128_PF), + DEFINE_PROP_BOOL("guest_hwcursor", ATIVGAState, cursor_guest_mode, false), + DEFINE_PROP_END_OF_LIST() +}; + +static void ati_vga_class_init(ObjectClass *klass, void *data) +{ + DeviceClass *dc = DEVICE_CLASS(klass); + PCIDeviceClass *k = PCI_DEVICE_CLASS(klass); + + dc->reset = ati_vga_reset; + dc->props = ati_vga_properties; + dc->hotpluggable = false; + set_bit(DEVICE_CATEGORY_DISPLAY, dc->categories); + + k->class_id = PCI_CLASS_DISPLAY_VGA; + k->vendor_id = PCI_VENDOR_ID_ATI; + k->device_id = PCI_DEVICE_ID_ATI_RAGE128_PF; + k->romfile = "vgabios-stdvga.bin"; + k->realize = ati_vga_realize; + k->exit = ati_vga_exit; +} + +static const TypeInfo ati_vga_info = { + .name = TYPE_ATI_VGA, + .parent = TYPE_PCI_DEVICE, + .instance_size = sizeof(ATIVGAState), + .class_init = ati_vga_class_init, + .interfaces = (InterfaceInfo[]) { + { INTERFACE_CONVENTIONAL_PCI_DEVICE }, + { }, + }, +}; + +static void ati_vga_register_types(void) +{ + type_register_static(&ati_vga_info); +} + +type_init(ati_vga_register_types) diff --git a/hw/display/ati_2d.c b/hw/display/ati_2d.c new file mode 100644 index 0000000000..bc98ba6eeb --- /dev/null +++ b/hw/display/ati_2d.c @@ -0,0 +1,167 @@ +/* + * QEMU ATI SVGA emulation + * 2D engine functions + * + * Copyright (c) 2019 BALATON Zoltan + * + * This work is licensed under the GNU GPL license version 2 or later. + */ + +#include "ati_int.h" +#include "ati_regs.h" +#include "qemu/log.h" +#include "ui/pixel_ops.h" + +/* + * NOTE: + * This is 2D _acceleration_ and supposed to be fast. Therefore, don't try to + * reinvent the wheel (unlikely to get better with a naive implementation than + * existing libraries) and avoid (poorly) reimplementing gfx primitives. + * That is unnecessary and would become a performance problem. Instead, try to + * map to and reuse existing optimised facilities (e.g. pixman) wherever + * possible. + */ + +static int ati_bpp_from_datatype(ATIVGAState *s) +{ + switch (s->regs.dp_datatype & 0xf) { + case 2: + return 8; + case 3: + case 4: + return 16; + case 5: + return 24; + case 6: + return 32; + default: + qemu_log_mask(LOG_UNIMP, "Unknown dst datatype %d\n", + s->regs.dp_datatype & 0xf); + return 0; + } +} + +void ati_2d_blt(ATIVGAState *s) +{ + /* FIXME it is probably more complex than this and may need to be */ + /* rewritten but for now as a start just to get some output: */ + DisplaySurface *ds = qemu_console_surface(s->vga.con); + DPRINTF("%p %u ds: %p %d %d rop: %x\n", s->vga.vram_ptr, + s->vga.vbe_start_addr, surface_data(ds), surface_stride(ds), + surface_bits_per_pixel(ds), + (s->regs.dp_mix & GMC_ROP3_MASK) >> 16); + DPRINTF("%d %d, %d %d, (%d,%d) -> (%d,%d) %dx%d\n", s->regs.src_offset, + s->regs.dst_offset, s->regs.src_pitch, s->regs.dst_pitch, + s->regs.src_x, s->regs.src_y, s->regs.dst_x, s->regs.dst_y, + s->regs.dst_width, s->regs.dst_height); + switch (s->regs.dp_mix & GMC_ROP3_MASK) { + case ROP3_SRCCOPY: + { + uint8_t *src_bits, *dst_bits, *end; + int src_stride, dst_stride, bpp = ati_bpp_from_datatype(s); + src_bits = s->vga.vram_ptr + s->regs.src_offset; + dst_bits = s->vga.vram_ptr + s->regs.dst_offset; + src_stride = s->regs.src_pitch; + dst_stride = s->regs.dst_pitch; + + if (s->dev_id == PCI_DEVICE_ID_ATI_RAGE128_PF) { + src_bits += s->regs.crtc_offset & 0x07ffffff; + dst_bits += s->regs.crtc_offset & 0x07ffffff; + src_stride *= bpp; + dst_stride *= bpp; + } + src_stride /= sizeof(uint32_t); + dst_stride /= sizeof(uint32_t); + + DPRINTF("pixman_blt(%p, %p, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d)\n", + src_bits, dst_bits, src_stride, dst_stride, bpp, bpp, + s->regs.src_x, s->regs.src_y, s->regs.dst_x, s->regs.dst_y, + s->regs.dst_width, s->regs.dst_height); + end = s->vga.vram_ptr + s->vga.vram_size; + if (src_bits >= end || dst_bits >= end || + src_bits + (s->regs.src_y + s->regs.dst_height) * src_stride + + s->regs.src_x >= end || + dst_bits + (s->regs.dst_y + s->regs.dst_height) * dst_stride + + s->regs.dst_x >= end) { + qemu_log_mask(LOG_UNIMP, "blt outside vram not implemented\n"); + return; + } + pixman_blt((uint32_t *)src_bits, (uint32_t *)dst_bits, + src_stride, dst_stride, bpp, bpp, + s->regs.src_x, s->regs.src_y, + s->regs.dst_x, s->regs.dst_y, + s->regs.dst_width, s->regs.dst_height); + if (dst_bits >= s->vga.vram_ptr + s->vga.vbe_start_addr && + dst_bits < s->vga.vram_ptr + s->vga.vbe_start_addr + + s->vga.vbe_regs[VBE_DISPI_INDEX_YRES] * s->vga.vbe_line_offset) { + memory_region_set_dirty(&s->vga.vram, s->vga.vbe_start_addr + + s->regs.dst_offset + + s->regs.dst_y * surface_stride(ds), + s->regs.dst_height * surface_stride(ds)); + } + s->regs.dst_x += s->regs.dst_width; + s->regs.dst_y += s->regs.dst_height; + break; + } + case ROP3_PATCOPY: + case ROP3_BLACKNESS: + case ROP3_WHITENESS: + { + uint8_t *dst_bits, *end; + int dst_stride, bpp = ati_bpp_from_datatype(s); + uint32_t filler = 0; + dst_bits = s->vga.vram_ptr + s->regs.dst_offset; + dst_stride = s->regs.dst_pitch; + + if (s->dev_id == PCI_DEVICE_ID_ATI_RAGE128_PF) { + dst_bits += s->regs.crtc_offset & 0x07ffffff; + dst_stride *= bpp; + } + dst_stride /= sizeof(uint32_t); + + switch (s->regs.dp_mix & GMC_ROP3_MASK) { + case ROP3_PATCOPY: + filler = bswap32(s->regs.dp_brush_frgd_clr); + break; + case ROP3_BLACKNESS: + filler = rgb_to_pixel32(s->vga.palette[0], s->vga.palette[1], + s->vga.palette[2]) << 8 | 0xff; + break; + case ROP3_WHITENESS: + filler = rgb_to_pixel32(s->vga.palette[3], s->vga.palette[4], + s->vga.palette[5]) << 8 | 0xff; + break; + } + + DPRINTF("pixman_fill(%p, %d, %d, %d, %d, %d, %d, %x)\n", + dst_bits, dst_stride, bpp, + s->regs.dst_x, s->regs.dst_y, + s->regs.dst_width, s->regs.dst_height, + filler); + end = s->vga.vram_ptr + s->vga.vram_size; + if (dst_bits >= end || + dst_bits + (s->regs.dst_y + s->regs.dst_height) * dst_stride + + s->regs.dst_x >= end) { + qemu_log_mask(LOG_UNIMP, "blt outside vram not implemented\n"); + return; + } + pixman_fill((uint32_t *)dst_bits, dst_stride, bpp, + s->regs.dst_x, s->regs.dst_y, + s->regs.dst_width, s->regs.dst_height, + filler); + if (dst_bits >= s->vga.vram_ptr + s->vga.vbe_start_addr && + dst_bits < s->vga.vram_ptr + s->vga.vbe_start_addr + + s->vga.vbe_regs[VBE_DISPI_INDEX_YRES] * s->vga.vbe_line_offset) { + memory_region_set_dirty(&s->vga.vram, s->vga.vbe_start_addr + + s->regs.dst_offset + + s->regs.dst_y * surface_stride(ds), + s->regs.dst_height * surface_stride(ds)); + } + s->regs.dst_y += s->regs.dst_height; + break; + } + default: + qemu_log_mask(LOG_UNIMP, "Unimplemented ati_2d blt op %x\n", + (s->regs.dp_mix & GMC_ROP3_MASK) >> 16); + } +} diff --git a/hw/display/ati_dbg.c b/hw/display/ati_dbg.c new file mode 100644 index 0000000000..1e6c32624e --- /dev/null +++ b/hw/display/ati_dbg.c @@ -0,0 +1,259 @@ +#include "ati_int.h" + +#ifdef DEBUG_ATI +struct ati_regdesc { + const char *name; + int num; +}; + +static struct ati_regdesc ati_reg_names[] = { + {"MM_INDEX", 0x0000}, + {"MM_DATA", 0x0004}, + {"CLOCK_CNTL_INDEX", 0x0008}, + {"CLOCK_CNTL_DATA", 0x000c}, + {"BIOS_0_SCRATCH", 0x0010}, + {"BUS_CNTL", 0x0030}, + {"BUS_CNTL1", 0x0034}, + {"GEN_INT_CNTL", 0x0040}, + {"CRTC_GEN_CNTL", 0x0050}, + {"CRTC_EXT_CNTL", 0x0054}, + {"DAC_CNTL", 0x0058}, + {"GPIO_MONID", 0x0068}, + {"I2C_CNTL_1", 0x0094}, + {"PALETTE_INDEX", 0x00b0}, + {"PALETTE_DATA", 0x00b4}, + {"CNFG_CNTL", 0x00e0}, + {"GEN_RESET_CNTL", 0x00f0}, + {"CNFG_MEMSIZE", 0x00f8}, + {"MEM_CNTL", 0x0140}, + {"MC_FB_LOCATION", 0x0148}, + {"MC_AGP_LOCATION", 0x014C}, + {"MC_STATUS", 0x0150}, + {"MEM_POWER_MISC", 0x015c}, + {"AGP_BASE", 0x0170}, + {"AGP_CNTL", 0x0174}, + {"AGP_APER_OFFSET", 0x0178}, + {"PCI_GART_PAGE", 0x017c}, + {"PC_NGUI_MODE", 0x0180}, + {"PC_NGUI_CTLSTAT", 0x0184}, + {"MPP_TB_CONFIG", 0x01C0}, + {"MPP_GP_CONFIG", 0x01C8}, + {"VIPH_CONTROL", 0x01D0}, + {"CRTC_H_TOTAL_DISP", 0x0200}, + {"CRTC_H_SYNC_STRT_WID", 0x0204}, + {"CRTC_V_TOTAL_DISP", 0x0208}, + {"CRTC_V_SYNC_STRT_WID", 0x020c}, + {"CRTC_VLINE_CRNT_VLINE", 0x0210}, + {"CRTC_CRNT_FRAME", 0x0214}, + {"CRTC_GUI_TRIG_VLINE", 0x0218}, + {"CRTC_OFFSET", 0x0224}, + {"CRTC_OFFSET_CNTL", 0x0228}, + {"CRTC_PITCH", 0x022c}, + {"OVR_CLR", 0x0230}, + {"OVR_WID_LEFT_RIGHT", 0x0234}, + {"OVR_WID_TOP_BOTTOM", 0x0238}, + {"CUR_OFFSET", 0x0260}, + {"CUR_HORZ_VERT_POSN", 0x0264}, + {"CUR_HORZ_VERT_OFF", 0x0268}, + {"CUR_CLR0", 0x026c}, + {"CUR_CLR1", 0x0270}, + {"LVDS_GEN_CNTL", 0x02d0}, + {"DDA_CONFIG", 0x02e0}, + {"DDA_ON_OFF", 0x02e4}, + {"VGA_DDA_CONFIG", 0x02e8}, + {"VGA_DDA_ON_OFF", 0x02ec}, + {"CRTC2_H_TOTAL_DISP", 0x0300}, + {"CRTC2_H_SYNC_STRT_WID", 0x0304}, + {"CRTC2_V_TOTAL_DISP", 0x0308}, + {"CRTC2_V_SYNC_STRT_WID", 0x030c}, + {"CRTC2_VLINE_CRNT_VLINE", 0x0310}, + {"CRTC2_CRNT_FRAME", 0x0314}, + {"CRTC2_GUI_TRIG_VLINE", 0x0318}, + {"CRTC2_OFFSET", 0x0324}, + {"CRTC2_OFFSET_CNTL", 0x0328}, + {"CRTC2_PITCH", 0x032c}, + {"DDA2_CONFIG", 0x03e0}, + {"DDA2_ON_OFF", 0x03e4}, + {"CRTC2_GEN_CNTL", 0x03f8}, + {"CRTC2_STATUS", 0x03fc}, + {"OV0_SCALE_CNTL", 0x0420}, + {"SUBPIC_CNTL", 0x0540}, + {"PM4_BUFFER_OFFSET", 0x0700}, + {"PM4_BUFFER_CNTL", 0x0704}, + {"PM4_BUFFER_WM_CNTL", 0x0708}, + {"PM4_BUFFER_DL_RPTR_ADDR", 0x070c}, + {"PM4_BUFFER_DL_RPTR", 0x0710}, + {"PM4_BUFFER_DL_WPTR", 0x0714}, + {"PM4_VC_FPU_SETUP", 0x071c}, + {"PM4_FPU_CNTL", 0x0720}, + {"PM4_VC_FORMAT", 0x0724}, + {"PM4_VC_CNTL", 0x0728}, + {"PM4_VC_I01", 0x072c}, + {"PM4_VC_VLOFF", 0x0730}, + {"PM4_VC_VLSIZE", 0x0734}, + {"PM4_IW_INDOFF", 0x0738}, + {"PM4_IW_INDSIZE", 0x073c}, + {"PM4_FPU_FPX0", 0x0740}, + {"PM4_FPU_FPY0", 0x0744}, + {"PM4_FPU_FPX1", 0x0748}, + {"PM4_FPU_FPY1", 0x074c}, + {"PM4_FPU_FPX2", 0x0750}, + {"PM4_FPU_FPY2", 0x0754}, + {"PM4_FPU_FPY3", 0x0758}, + {"PM4_FPU_FPY4", 0x075c}, + {"PM4_FPU_FPY5", 0x0760}, + {"PM4_FPU_FPY6", 0x0764}, + {"PM4_FPU_FPR", 0x0768}, + {"PM4_FPU_FPG", 0x076c}, + {"PM4_FPU_FPB", 0x0770}, + {"PM4_FPU_FPA", 0x0774}, + {"PM4_FPU_INTXY0", 0x0780}, + {"PM4_FPU_INTXY1", 0x0784}, + {"PM4_FPU_INTXY2", 0x0788}, + {"PM4_FPU_INTARGB", 0x078c}, + {"PM4_FPU_FPTWICEAREA", 0x0790}, + {"PM4_FPU_DMAJOR01", 0x0794}, + {"PM4_FPU_DMAJOR12", 0x0798}, + {"PM4_FPU_DMAJOR02", 0x079c}, + {"PM4_FPU_STAT", 0x07a0}, + {"PM4_STAT", 0x07b8}, + {"PM4_TEST_CNTL", 0x07d0}, + {"PM4_MICROCODE_ADDR", 0x07d4}, + {"PM4_MICROCODE_RADDR", 0x07d8}, + {"PM4_MICROCODE_DATAH", 0x07dc}, + {"PM4_MICROCODE_DATAL", 0x07e0}, + {"PM4_CMDFIFO_ADDR", 0x07e4}, + {"PM4_CMDFIFO_DATAH", 0x07e8}, + {"PM4_CMDFIFO_DATAL", 0x07ec}, + {"PM4_BUFFER_ADDR", 0x07f0}, + {"PM4_BUFFER_DATAH", 0x07f4}, + {"PM4_BUFFER_DATAL", 0x07f8}, + {"PM4_MICRO_CNTL", 0x07fc}, + {"CAP0_TRIG_CNTL", 0x0950}, + {"CAP1_TRIG_CNTL", 0x09c0}, + {"RBBM_STATUS", 0x0e40}, + {"PM4_FIFO_DATA_EVEN", 0x1000}, + {"PM4_FIFO_DATA_ODD", 0x1004}, + {"DST_OFFSET", 0x1404}, + {"DST_PITCH", 0x1408}, + {"DST_WIDTH", 0x140c}, + {"DST_HEIGHT", 0x1410}, + {"SRC_X", 0x1414}, + {"SRC_Y", 0x1418}, + {"DST_X", 0x141c}, + {"DST_Y", 0x1420}, + {"SRC_PITCH_OFFSET", 0x1428}, + {"DST_PITCH_OFFSET", 0x142c}, + {"SRC_Y_X", 0x1434}, + {"DST_Y_X", 0x1438}, + {"DST_HEIGHT_WIDTH", 0x143c}, + {"DP_GUI_MASTER_CNTL", 0x146c}, + {"BRUSH_SCALE", 0x1470}, + {"BRUSH_Y_X", 0x1474}, + {"DP_BRUSH_BKGD_CLR", 0x1478}, + {"DP_BRUSH_FRGD_CLR", 0x147c}, + {"DST_WIDTH_X", 0x1588}, + {"DST_HEIGHT_WIDTH_8", 0x158c}, + {"SRC_X_Y", 0x1590}, + {"DST_X_Y", 0x1594}, + {"DST_WIDTH_HEIGHT", 0x1598}, + {"DST_WIDTH_X_INCY", 0x159c}, + {"DST_HEIGHT_Y", 0x15a0}, + {"DST_X_SUB", 0x15a4}, + {"DST_Y_SUB", 0x15a8}, + {"SRC_OFFSET", 0x15ac}, + {"SRC_PITCH", 0x15b0}, + {"DST_HEIGHT_WIDTH_BW", 0x15b4}, + {"CLR_CMP_CNTL", 0x15c0}, + {"CLR_CMP_CLR_SRC", 0x15c4}, + {"CLR_CMP_CLR_DST", 0x15c8}, + {"CLR_CMP_MASK", 0x15cc}, + {"DP_SRC_FRGD_CLR", 0x15d8}, + {"DP_SRC_BKGD_CLR", 0x15dc}, + {"DST_BRES_ERR", 0x1628}, + {"DST_BRES_INC", 0x162c}, + {"DST_BRES_DEC", 0x1630}, + {"DST_BRES_LNTH", 0x1634}, + {"DST_BRES_LNTH_SUB", 0x1638}, + {"SC_LEFT", 0x1640}, + {"SC_RIGHT", 0x1644}, + {"SC_TOP", 0x1648}, + {"SC_BOTTOM", 0x164c}, + {"SRC_SC_RIGHT", 0x1654}, + {"SRC_SC_BOTTOM", 0x165c}, + {"GUI_DEBUG0", 0x16a0}, + {"GUI_DEBUG1", 0x16a4}, + {"GUI_TIMEOUT", 0x16b0}, + {"GUI_TIMEOUT0", 0x16b4}, + {"GUI_TIMEOUT1", 0x16b8}, + {"GUI_PROBE", 0x16bc}, + {"DP_CNTL", 0x16c0}, + {"DP_DATATYPE", 0x16c4}, + {"DP_MIX", 0x16c8}, + {"DP_WRITE_MASK", 0x16cc}, + {"DP_CNTL_XDIR_YDIR_YMAJOR", 0x16d0}, + {"DEFAULT_OFFSET", 0x16e0}, + {"DEFAULT_PITCH", 0x16e4}, + {"DEFAULT_SC_BOTTOM_RIGHT", 0x16e8}, + {"SC_TOP_LEFT", 0x16ec}, + {"SC_BOTTOM_RIGHT", 0x16f0}, + {"SRC_SC_BOTTOM_RIGHT", 0x16f4}, + {"DST_TILE", 0x1700}, + {"WAIT_UNTIL", 0x1720}, + {"CACHE_CNTL", 0x1724}, + {"GUI_STAT", 0x1740}, + {"PC_GUI_MODE", 0x1744}, + {"PC_GUI_CTLSTAT", 0x1748}, + {"PC_DEBUG_MODE", 0x1760}, + {"BRES_DST_ERR_DEC", 0x1780}, + {"TRAIL_BRES_T12_ERR_DEC", 0x1784}, + {"TRAIL_BRES_T12_INC", 0x1788}, + {"DP_T12_CNTL", 0x178c}, + {"DST_BRES_T1_LNTH", 0x1790}, + {"DST_BRES_T2_LNTH", 0x1794}, + {"SCALE_SRC_HEIGHT_WIDTH", 0x1994}, + {"SCALE_OFFSET_0", 0x1998}, + {"SCALE_PITCH", 0x199c}, + {"SCALE_X_INC", 0x19a0}, + {"SCALE_Y_INC", 0x19a4}, + {"SCALE_HACC", 0x19a8}, + {"SCALE_VACC", 0x19ac}, + {"SCALE_DST_X_Y", 0x19b0}, + {"SCALE_DST_HEIGHT_WIDTH", 0x19b4}, + {"SCALE_3D_CNTL", 0x1a00}, + {"SCALE_3D_DATATYPE", 0x1a20}, + {"SETUP_CNTL", 0x1bc4}, + {"SOLID_COLOR", 0x1bc8}, + {"WINDOW_XY_OFFSET", 0x1bcc}, + {"DRAW_LINE_POINT", 0x1bd0}, + {"SETUP_CNTL_PM4", 0x1bd4}, + {"DST_PITCH_OFFSET_C", 0x1c80}, + {"DP_GUI_MASTER_CNTL_C", 0x1c84}, + {"SC_TOP_LEFT_C", 0x1c88}, + {"SC_BOTTOM_RIGHT_C", 0x1c8c}, + {"CLR_CMP_MASK_3D", 0x1A28}, + {"MISC_3D_STATE_CNTL_REG", 0x1CA0}, + {"MC_SRC1_CNTL", 0x19D8}, + {"TEX_CNTL", 0x1800}, + {"RAGE128_MPP_TB_CONFIG", 0x01c0}, + {NULL, -1} +}; + +const char *ati_reg_name(int num) +{ + int i; + + num &= ~3; + for (i = 0; ati_reg_names[i].name; i++) { + if (ati_reg_names[i].num == num) { + return ati_reg_names[i].name; + } + } + return "unknown"; +} +#else +const char *ati_reg_name(int num) +{ + return ""; +} +#endif diff --git a/hw/display/ati_int.h b/hw/display/ati_int.h new file mode 100644 index 0000000000..a6f3e20e63 --- /dev/null +++ b/hw/display/ati_int.h @@ -0,0 +1,96 @@ +/* + * QEMU ATI SVGA emulation + * + * Copyright (c) 2019 BALATON Zoltan + * + * This work is licensed under the GNU GPL license version 2 or later. + */ + +#ifndef ATI_INT_H +#define ATI_INT_H + +#include "qemu/osdep.h" +#include "hw/pci/pci.h" +#include "vga_int.h" + +/*#define DEBUG_ATI*/ + +#ifdef DEBUG_ATI +#define DPRINTF(fmt, ...) printf("%s: " fmt, __func__, ## __VA_ARGS__) +#else +#define DPRINTF(fmt, ...) do {} while (0) +#endif + +#define PCI_VENDOR_ID_ATI 0x1002 +/* Rage128 Pro GL */ +#define PCI_DEVICE_ID_ATI_RAGE128_PF 0x5046 +/* Radeon RV100 (VE) */ +#define PCI_DEVICE_ID_ATI_RADEON_QY 0x5159 + +#define TYPE_ATI_VGA "ati-vga" +#define ATI_VGA(obj) OBJECT_CHECK(ATIVGAState, (obj), TYPE_ATI_VGA) + +typedef struct ATIVGARegs { + uint32_t mm_index; + uint32_t bios_scratch[8]; + uint32_t crtc_gen_cntl; + uint32_t crtc_ext_cntl; + uint32_t dac_cntl; + uint32_t crtc_h_total_disp; + uint32_t crtc_h_sync_strt_wid; + uint32_t crtc_v_total_disp; + uint32_t crtc_v_sync_strt_wid; + uint32_t crtc_offset; + uint32_t crtc_offset_cntl; + uint32_t crtc_pitch; + uint32_t cur_offset; + uint32_t cur_hv_pos; + uint32_t cur_hv_offs; + uint32_t cur_color0; + uint32_t cur_color1; + uint32_t dst_offset; + uint32_t dst_pitch; + uint32_t dst_tile; + uint32_t dst_width; + uint32_t dst_height; + uint32_t src_offset; + uint32_t src_pitch; + uint32_t src_tile; + uint32_t src_x; + uint32_t src_y; + uint32_t dst_x; + uint32_t dst_y; + uint32_t dp_gui_master_cntl; + uint32_t dp_brush_bkgd_clr; + uint32_t dp_brush_frgd_clr; + uint32_t dp_src_frgd_clr; + uint32_t dp_src_bkgd_clr; + uint32_t dp_cntl; + uint32_t dp_datatype; + uint32_t dp_mix; + uint32_t dp_write_mask; + uint32_t default_offset; + uint32_t default_pitch; + uint32_t default_sc_bottom_right; +} ATIVGARegs; + +typedef struct ATIVGAState { + PCIDevice dev; + VGACommonState vga; + char *model; + uint16_t dev_id; + uint8_t mode; + bool cursor_guest_mode; + uint16_t cursor_size; + uint32_t cursor_offset; + QEMUCursor *cursor; + MemoryRegion io; + MemoryRegion mm; + ATIVGARegs regs; +} ATIVGAState; + +const char *ati_reg_name(int num); + +void ati_2d_blt(ATIVGAState *s); + +#endif /* ATI_INT_H */ diff --git a/hw/display/ati_regs.h b/hw/display/ati_regs.h new file mode 100644 index 0000000000..923bfd33ce --- /dev/null +++ b/hw/display/ati_regs.h @@ -0,0 +1,461 @@ +/* + * ATI VGA register definitions + * + * based on: + * linux/include/video/aty128.h + * Register definitions for ATI Rage128 boards + * Anthony Tong <atong@uiuc.edu>, 1999 + * Brad Douglas <brad@neruo.com>, 2000 + * + * and linux/include/video/radeon.h + * + * This work is licensed under the GNU GPL license version 2. + */ + +/* + * Register mapping: + * 0x0000-0x00ff Misc regs also accessible via io and mmio space + * 0x0100-0x0eff Misc regs only accessible via mmio + * 0x0f00-0x0fff Read-only copy of PCI config regs + * 0x1000-0x13ff Concurrent Command Engine (CCE) regs + * 0x1400-0x1fff GUI (drawing engine) regs + */ + +#ifndef ATI_REGS_H +#define ATI_REGS_H + +#undef DEFAULT_PITCH /* needed for mingw builds */ + +#define MM_INDEX 0x0000 +#define MM_DATA 0x0004 +#define CLOCK_CNTL_INDEX 0x0008 +#define CLOCK_CNTL_DATA 0x000c +#define BIOS_0_SCRATCH 0x0010 +#define BUS_CNTL 0x0030 +#define BUS_CNTL1 0x0034 +#define GEN_INT_CNTL 0x0040 +#define CRTC_GEN_CNTL 0x0050 +#define CRTC_EXT_CNTL 0x0054 +#define DAC_CNTL 0x0058 +#define GPIO_MONID 0x0068 +#define I2C_CNTL_1 0x0094 +#define PALETTE_INDEX 0x00b0 +#define PALETTE_DATA 0x00b4 +#define CNFG_CNTL 0x00e0 +#define GEN_RESET_CNTL 0x00f0 +#define CNFG_MEMSIZE 0x00f8 +#define MEM_CNTL 0x0140 +#define MC_FB_LOCATION 0x0148 +#define MC_AGP_LOCATION 0x014C +#define MC_STATUS 0x0150 +#define MEM_POWER_MISC 0x015c +#define AGP_BASE 0x0170 +#define AGP_CNTL 0x0174 +#define AGP_APER_OFFSET 0x0178 +#define PCI_GART_PAGE 0x017c +#define PC_NGUI_MODE 0x0180 +#define PC_NGUI_CTLSTAT 0x0184 +#define MPP_TB_CONFIG 0x01C0 +#define MPP_GP_CONFIG 0x01C8 +#define VIPH_CONTROL 0x01D0 +#define CRTC_H_TOTAL_DISP 0x0200 +#define CRTC_H_SYNC_STRT_WID 0x0204 +#define CRTC_V_TOTAL_DISP 0x0208 +#define CRTC_V_SYNC_STRT_WID 0x020c +#define CRTC_VLINE_CRNT_VLINE 0x0210 +#define CRTC_CRNT_FRAME 0x0214 +#define CRTC_GUI_TRIG_VLINE 0x0218 +#define CRTC_OFFSET 0x0224 +#define CRTC_OFFSET_CNTL 0x0228 +#define CRTC_PITCH 0x022c +#define OVR_CLR 0x0230 +#define OVR_WID_LEFT_RIGHT 0x0234 +#define OVR_WID_TOP_BOTTOM 0x0238 +#define CUR_OFFSET 0x0260 +#define CUR_HORZ_VERT_POSN 0x0264 +#define CUR_HORZ_VERT_OFF 0x0268 +#define CUR_CLR0 0x026c +#define CUR_CLR1 0x0270 +#define LVDS_GEN_CNTL 0x02d0 +#define DDA_CONFIG 0x02e0 +#define DDA_ON_OFF 0x02e4 +#define VGA_DDA_CONFIG 0x02e8 +#define VGA_DDA_ON_OFF 0x02ec +#define CRTC2_H_TOTAL_DISP 0x0300 +#define CRTC2_H_SYNC_STRT_WID 0x0304 +#define CRTC2_V_TOTAL_DISP 0x0308 +#define CRTC2_V_SYNC_STRT_WID 0x030c +#define CRTC2_VLINE_CRNT_VLINE 0x0310 +#define CRTC2_CRNT_FRAME 0x0314 +#define CRTC2_GUI_TRIG_VLINE 0x0318 +#define CRTC2_OFFSET 0x0324 +#define CRTC2_OFFSET_CNTL 0x0328 +#define CRTC2_PITCH 0x032c +#define DDA2_CONFIG 0x03e0 +#define DDA2_ON_OFF 0x03e4 +#define CRTC2_GEN_CNTL 0x03f8 +#define CRTC2_STATUS 0x03fc +#define OV0_SCALE_CNTL 0x0420 +#define SUBPIC_CNTL 0x0540 +#define PM4_BUFFER_OFFSET 0x0700 +#define PM4_BUFFER_CNTL 0x0704 +#define PM4_BUFFER_WM_CNTL 0x0708 +#define PM4_BUFFER_DL_RPTR_ADDR 0x070c +#define PM4_BUFFER_DL_RPTR 0x0710 +#define PM4_BUFFER_DL_WPTR 0x0714 +#define PM4_VC_FPU_SETUP 0x071c +#define PM4_FPU_CNTL 0x0720 +#define PM4_VC_FORMAT 0x0724 +#define PM4_VC_CNTL 0x0728 +#define PM4_VC_I01 0x072c +#define PM4_VC_VLOFF 0x0730 +#define PM4_VC_VLSIZE 0x0734 +#define PM4_IW_INDOFF 0x0738 +#define PM4_IW_INDSIZE 0x073c +#define PM4_FPU_FPX0 0x0740 +#define PM4_FPU_FPY0 0x0744 +#define PM4_FPU_FPX1 0x0748 +#define PM4_FPU_FPY1 0x074c +#define PM4_FPU_FPX2 0x0750 +#define PM4_FPU_FPY2 0x0754 +#define PM4_FPU_FPY3 0x0758 +#define PM4_FPU_FPY4 0x075c +#define PM4_FPU_FPY5 0x0760 +#define PM4_FPU_FPY6 0x0764 +#define PM4_FPU_FPR 0x0768 +#define PM4_FPU_FPG 0x076c +#define PM4_FPU_FPB 0x0770 +#define PM4_FPU_FPA 0x0774 +#define PM4_FPU_INTXY0 0x0780 +#define PM4_FPU_INTXY1 0x0784 +#define PM4_FPU_INTXY2 0x0788 +#define PM4_FPU_INTARGB 0x078c +#define PM4_FPU_FPTWICEAREA 0x0790 +#define PM4_FPU_DMAJOR01 0x0794 +#define PM4_FPU_DMAJOR12 0x0798 +#define PM4_FPU_DMAJOR02 0x079c +#define PM4_FPU_STAT 0x07a0 +#define PM4_STAT 0x07b8 +#define PM4_TEST_CNTL 0x07d0 +#define PM4_MICROCODE_ADDR 0x07d4 +#define PM4_MICROCODE_RADDR 0x07d8 +#define PM4_MICROCODE_DATAH 0x07dc +#define PM4_MICROCODE_DATAL 0x07e0 +#define PM4_CMDFIFO_ADDR 0x07e4 +#define PM4_CMDFIFO_DATAH 0x07e8 +#define PM4_CMDFIFO_DATAL 0x07ec +#define PM4_BUFFER_ADDR 0x07f0 +#define PM4_BUFFER_DATAH 0x07f4 +#define PM4_BUFFER_DATAL 0x07f8 +#define PM4_MICRO_CNTL 0x07fc +#define CAP0_TRIG_CNTL 0x0950 +#define CAP1_TRIG_CNTL 0x09c0 + +#define RBBM_STATUS 0x0e40 + +/* + * GUI Block Memory Mapped Registers + * These registers are FIFOed. + */ +#define PM4_FIFO_DATA_EVEN 0x1000 +#define PM4_FIFO_DATA_ODD 0x1004 + +#define DST_OFFSET 0x1404 +#define DST_PITCH 0x1408 +#define DST_WIDTH 0x140c +#define DST_HEIGHT 0x1410 +#define SRC_X 0x1414 +#define SRC_Y 0x1418 +#define DST_X 0x141c +#define DST_Y 0x1420 +#define SRC_PITCH_OFFSET 0x1428 +#define DST_PITCH_OFFSET 0x142c +#define SRC_Y_X 0x1434 +#define DST_Y_X 0x1438 +#define DST_HEIGHT_WIDTH 0x143c +#define DP_GUI_MASTER_CNTL 0x146c +#define BRUSH_SCALE 0x1470 +#define BRUSH_Y_X 0x1474 +#define DP_BRUSH_BKGD_CLR 0x1478 +#define DP_BRUSH_FRGD_CLR 0x147c +#define DST_WIDTH_X 0x1588 +#define DST_HEIGHT_WIDTH_8 0x158c +#define SRC_X_Y 0x1590 +#define DST_X_Y 0x1594 +#define DST_WIDTH_HEIGHT 0x1598 +#define DST_WIDTH_X_INCY 0x159c +#define DST_HEIGHT_Y 0x15a0 +#define DST_X_SUB 0x15a4 +#define DST_Y_SUB 0x15a8 +#define SRC_OFFSET 0x15ac +#define SRC_PITCH 0x15b0 +#define DST_HEIGHT_WIDTH_BW 0x15b4 +#define CLR_CMP_CNTL 0x15c0 +#define CLR_CMP_CLR_SRC 0x15c4 +#define CLR_CMP_CLR_DST 0x15c8 +#define CLR_CMP_MASK 0x15cc +#define DP_SRC_FRGD_CLR 0x15d8 +#define DP_SRC_BKGD_CLR 0x15dc +#define DST_BRES_ERR 0x1628 +#define DST_BRES_INC 0x162c +#define DST_BRES_DEC 0x1630 +#define DST_BRES_LNTH 0x1634 +#define DST_BRES_LNTH_SUB 0x1638 +#define SC_LEFT 0x1640 +#define SC_RIGHT 0x1644 +#define SC_TOP 0x1648 +#define SC_BOTTOM 0x164c +#define SRC_SC_RIGHT 0x1654 +#define SRC_SC_BOTTOM 0x165c +#define GUI_DEBUG0 0x16a0 +#define GUI_DEBUG1 0x16a4 +#define GUI_TIMEOUT 0x16b0 +#define GUI_TIMEOUT0 0x16b4 +#define GUI_TIMEOUT1 0x16b8 +#define GUI_PROBE 0x16bc +#define DP_CNTL 0x16c0 +#define DP_DATATYPE 0x16c4 +#define DP_MIX 0x16c8 +#define DP_WRITE_MASK 0x16cc +#define DP_CNTL_XDIR_YDIR_YMAJOR 0x16d0 +#define DEFAULT_OFFSET 0x16e0 +#define DEFAULT_PITCH 0x16e4 +#define DEFAULT_SC_BOTTOM_RIGHT 0x16e8 +#define SC_TOP_LEFT 0x16ec +#define SC_BOTTOM_RIGHT 0x16f0 +#define SRC_SC_BOTTOM_RIGHT 0x16f4 +#define DST_TILE 0x1700 +#define WAIT_UNTIL 0x1720 +#define CACHE_CNTL 0x1724 +#define GUI_STAT 0x1740 +#define PC_GUI_MODE 0x1744 +#define PC_GUI_CTLSTAT 0x1748 +#define PC_DEBUG_MODE 0x1760 +#define BRES_DST_ERR_DEC 0x1780 +#define TRAIL_BRES_T12_ERR_DEC 0x1784 +#define TRAIL_BRES_T12_INC 0x1788 +#define DP_T12_CNTL 0x178c +#define DST_BRES_T1_LNTH 0x1790 +#define DST_BRES_T2_LNTH 0x1794 +#define SCALE_SRC_HEIGHT_WIDTH 0x1994 +#define SCALE_OFFSET_0 0x1998 +#define SCALE_PITCH 0x199c +#define SCALE_X_INC 0x19a0 +#define SCALE_Y_INC 0x19a4 +#define SCALE_HACC 0x19a8 +#define SCALE_VACC 0x19ac +#define SCALE_DST_X_Y 0x19b0 +#define SCALE_DST_HEIGHT_WIDTH 0x19b4 +#define SCALE_3D_CNTL 0x1a00 +#define SCALE_3D_DATATYPE 0x1a20 +#define SETUP_CNTL 0x1bc4 +#define SOLID_COLOR 0x1bc8 +#define WINDOW_XY_OFFSET 0x1bcc +#define DRAW_LINE_POINT 0x1bd0 +#define SETUP_CNTL_PM4 0x1bd4 +#define DST_PITCH_OFFSET_C 0x1c80 +#define DP_GUI_MASTER_CNTL_C 0x1c84 +#define SC_TOP_LEFT_C 0x1c88 +#define SC_BOTTOM_RIGHT_C 0x1c8c + +#define CLR_CMP_MASK_3D 0x1A28 +#define MISC_3D_STATE_CNTL_REG 0x1CA0 +#define MC_SRC1_CNTL 0x19D8 +#define TEX_CNTL 0x1800 + +/* CONSTANTS */ +#define GUI_ACTIVE 0x80000000 +#define ENGINE_IDLE 0x0 + +#define PLL_WR_EN 0x00000080 + +#define CLK_PIN_CNTL 0x01 +#define PPLL_CNTL 0x02 +#define PPLL_REF_DIV 0x03 +#define PPLL_DIV_0 0x04 +#define PPLL_DIV_1 0x05 +#define PPLL_DIV_2 0x06 +#define PPLL_DIV_3 0x07 +#define VCLK_ECP_CNTL 0x08 +#define HTOTAL_CNTL 0x09 +#define X_MPLL_REF_FB_DIV 0x0a +#define XPLL_CNTL 0x0b +#define XDLL_CNTL 0x0c +#define XCLK_CNTL 0x0d +#define MPLL_CNTL 0x0e +#define MCLK_CNTL 0x0f +#define AGP_PLL_CNTL 0x10 +#define FCP_CNTL 0x12 +#define PLL_TEST_CNTL 0x13 +#define P2PLL_CNTL 0x2a +#define P2PLL_REF_DIV 0x2b +#define P2PLL_DIV_0 0x2b +#define POWER_MANAGEMENT 0x2f + +#define PPLL_RESET 0x00000001 +#define PPLL_ATOMIC_UPDATE_EN 0x00010000 +#define PPLL_VGA_ATOMIC_UPDATE_EN 0x00020000 +#define PPLL_REF_DIV_MASK 0x000003FF +#define PPLL_FB3_DIV_MASK 0x000007FF +#define PPLL_POST3_DIV_MASK 0x00070000 +#define PPLL_ATOMIC_UPDATE_R 0x00008000 +#define PPLL_ATOMIC_UPDATE_W 0x00008000 +#define MEM_CFG_TYPE_MASK 0x00000003 +#define XCLK_SRC_SEL_MASK 0x00000007 +#define XPLL_FB_DIV_MASK 0x0000FF00 +#define X_MPLL_REF_DIV_MASK 0x000000FF + +/* Config control values (CONFIG_CNTL) */ +#define CFG_VGA_IO_DIS 0x00000400 + +/* CRTC control values (CRTC_GEN_CNTL) */ +#define CRTC_CSYNC_EN 0x00000010 + +#define CRTC2_DBL_SCAN_EN 0x00000001 +#define CRTC2_DISPLAY_DIS 0x00800000 +#define CRTC2_FIFO_EXTSENSE 0x00200000 +#define CRTC2_ICON_EN 0x00100000 +#define CRTC2_CUR_EN 0x00010000 +#define CRTC2_EXT_DISP_EN 0x01000000 +#define CRTC2_EN 0x02000000 +#define CRTC2_DISP_REQ_EN_B 0x04000000 + +#define CRTC_PIX_WIDTH_MASK 0x00000700 +#define CRTC_PIX_WIDTH_4BPP 0x00000100 +#define CRTC_PIX_WIDTH_8BPP 0x00000200 +#define CRTC_PIX_WIDTH_15BPP 0x00000300 +#define CRTC_PIX_WIDTH_16BPP 0x00000400 +#define CRTC_PIX_WIDTH_24BPP 0x00000500 +#define CRTC_PIX_WIDTH_32BPP 0x00000600 + +/* DAC_CNTL bit constants */ +#define DAC_8BIT_EN 0x00000100 +#define DAC_MASK 0xFF000000 +#define DAC_BLANKING 0x00000004 +#define DAC_RANGE_CNTL 0x00000003 +#define DAC_CLK_SEL 0x00000010 +#define DAC_PALETTE_ACCESS_CNTL 0x00000020 +#define DAC_PALETTE2_SNOOP_EN 0x00000040 +#define DAC_PDWN 0x00008000 + +/* CRTC_EXT_CNTL */ +#define CRT_CRTC_DISPLAY_DIS 0x00000400 +#define CRT_CRTC_ON 0x00008000 + +/* GEN_RESET_CNTL bit constants */ +#define SOFT_RESET_GUI 0x00000001 +#define SOFT_RESET_VCLK 0x00000100 +#define SOFT_RESET_PCLK 0x00000200 +#define SOFT_RESET_ECP 0x00000400 +#define SOFT_RESET_DISPENG_XCLK 0x00000800 + +/* PC_GUI_CTLSTAT bit constants */ +#define PC_BUSY_INIT 0x10000000 +#define PC_BUSY_GUI 0x20000000 +#define PC_BUSY_NGUI 0x40000000 +#define PC_BUSY 0x80000000 + +#define BUS_MASTER_DIS 0x00000040 +#define PM4_BUFFER_CNTL_NONPM4 0x00000000 + +/* DP_DATATYPE bit constants */ +#define DST_8BPP 0x00000002 +#define DST_15BPP 0x00000003 +#define DST_16BPP 0x00000004 +#define DST_24BPP 0x00000005 +#define DST_32BPP 0x00000006 + +#define BRUSH_SOLIDCOLOR 0x00000d00 + +/* DP_GUI_MASTER_CNTL bit constants */ +#define GMC_SRC_PITCH_OFFSET_DEFAULT 0x00000000 +#define GMC_DST_PITCH_OFFSET_DEFAULT 0x00000000 +#define GMC_SRC_CLIP_DEFAULT 0x00000000 +#define GMC_DST_CLIP_DEFAULT 0x00000000 +#define GMC_BRUSH_SOLIDCOLOR 0x000000d0 +#define GMC_SRC_DSTCOLOR 0x00003000 +#define GMC_BYTE_ORDER_MSB_TO_LSB 0x00000000 +#define GMC_DP_SRC_RECT 0x02000000 +#define GMC_3D_FCN_EN_CLR 0x00000000 +#define GMC_AUX_CLIP_CLEAR 0x20000000 +#define GMC_DST_CLR_CMP_FCN_CLEAR 0x10000000 +#define GMC_WRITE_MASK_SET 0x40000000 +#define GMC_DP_CONVERSION_TEMP_6500 0x00000000 + +/* DP_GUI_MASTER_CNTL ROP3 named constants */ +#define GMC_ROP3_MASK 0x00ff0000 +#define ROP3_BLACKNESS 0x00000000 +#define ROP3_SRCCOPY 0x00cc0000 +#define ROP3_PATCOPY 0x00f00000 +#define ROP3_WHITENESS 0x00ff0000 + +#define SRC_DSTCOLOR 0x00030000 + +/* DP_CNTL bit constants */ +#define DST_X_RIGHT_TO_LEFT 0x00000000 +#define DST_X_LEFT_TO_RIGHT 0x00000001 +#define DST_Y_BOTTOM_TO_TOP 0x00000000 +#define DST_Y_TOP_TO_BOTTOM 0x00000002 +#define DST_X_MAJOR 0x00000000 +#define DST_Y_MAJOR 0x00000004 +#define DST_X_TILE 0x00000008 +#define DST_Y_TILE 0x00000010 +#define DST_LAST_PEL 0x00000020 +#define DST_TRAIL_X_RIGHT_TO_LEFT 0x00000000 +#define DST_TRAIL_X_LEFT_TO_RIGHT 0x00000040 +#define DST_TRAP_FILL_RIGHT_TO_LEFT 0x00000000 +#define DST_TRAP_FILL_LEFT_TO_RIGHT 0x00000080 +#define DST_BRES_SIGN 0x00000100 +#define DST_HOST_BIG_ENDIAN_EN 0x00000200 +#define DST_POLYLINE_NONLAST 0x00008000 +#define DST_RASTER_STALL 0x00010000 +#define DST_POLY_EDGE 0x00040000 + +/* DP_MIX bit constants */ +#define DP_SRC_RECT 0x00000200 +#define DP_SRC_HOST 0x00000300 +#define DP_SRC_HOST_BYTEALIGN 0x00000400 + +/* LVDS_GEN_CNTL constants */ +#define LVDS_BL_MOD_LEVEL_MASK 0x0000ff00 +#define LVDS_BL_MOD_LEVEL_SHIFT 8 +#define LVDS_BL_MOD_EN 0x00010000 +#define LVDS_DIGION 0x00040000 +#define LVDS_BLON 0x00080000 +#define LVDS_ON 0x00000001 +#define LVDS_DISPLAY_DIS 0x00000002 +#define LVDS_PANEL_TYPE_2PIX_PER_CLK 0x00000004 +#define LVDS_PANEL_24BITS_TFT 0x00000008 +#define LVDS_FRAME_MOD_NO 0x00000000 +#define LVDS_FRAME_MOD_2_LEVELS 0x00000010 +#define LVDS_FRAME_MOD_4_LEVELS 0x00000020 +#define LVDS_RST_FM 0x00000040 +#define LVDS_EN 0x00000080 + +/* CRTC2_GEN_CNTL constants */ +#define CRTC2_EN 0x02000000 + +/* POWER_MANAGEMENT constants */ +#define PWR_MGT_ON 0x00000001 +#define PWR_MGT_MODE_MASK 0x00000006 +#define PWR_MGT_MODE_PIN 0x00000000 +#define PWR_MGT_MODE_REGISTER 0x00000002 +#define PWR_MGT_MODE_TIMER 0x00000004 +#define PWR_MGT_MODE_PCI 0x00000006 +#define PWR_MGT_AUTO_PWR_UP_EN 0x00000008 +#define PWR_MGT_ACTIVITY_PIN_ON 0x00000010 +#define PWR_MGT_STANDBY_POL 0x00000020 +#define PWR_MGT_SUSPEND_POL 0x00000040 +#define PWR_MGT_SELF_REFRESH 0x00000080 +#define PWR_MGT_ACTIVITY_PIN_EN 0x00000100 +#define PWR_MGT_KEYBD_SNOOP 0x00000200 +#define PWR_MGT_TRISTATE_MEM_EN 0x00000800 +#define PWR_MGT_SELW4MS 0x00001000 +#define PWR_MGT_SLOWDOWN_MCLK 0x00002000 + +#define PMI_PMSCR_REG 0x60 + +/* used by ATI bug fix for hardware ROM */ +#define RAGE128_MPP_TB_CONFIG 0x01c0 + +#endif /* ATI_REGS_H */ diff --git a/hw/display/trace-events b/hw/display/trace-events index 37d3264bb2..80993cc4d9 100644 --- a/hw/display/trace-events +++ b/hw/display/trace-events @@ -138,3 +138,7 @@ vga_cirrus_write_blt(uint32_t offset, uint32_t val) "offset 0x%x, val 0x%x" sii9022_read_reg(uint8_t addr, uint8_t val) "addr 0x%02x, val 0x%02x" sii9022_write_reg(uint8_t addr, uint8_t val) "addr 0x%02x, val 0x%02x" sii9022_switch_mode(const char *mode) "mode: %s" + +# hw/display/ati*.c +ati_mm_read(unsigned int size, uint64_t addr, const char *name, uint64_t val) "%u 0x%"HWADDR_PRIx " %s -> 0x%"PRIx64 +ati_mm_write(unsigned int size, uint64_t addr, const char *name, uint64_t val) "%u 0x%"HWADDR_PRIx " %s <- 0x%"PRIx64 diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c index a3627f58a9..4dbf48e424 100644 --- a/hw/display/virtio-gpu.c +++ b/hw/display/virtio-gpu.c @@ -1346,7 +1346,7 @@ static void virtio_gpu_instance_init(Object *obj) { } -void virtio_gpu_reset(VirtIODevice *vdev) +static void virtio_gpu_reset(VirtIODevice *vdev) { VirtIOGPU *g = VIRTIO_GPU(vdev); struct virtio_gpu_simple_resource *res, *tmp; diff --git a/hw/display/virtio-vga.c b/hw/display/virtio-vga.c index 1e48009b74..a2b803b75f 100644 --- a/hw/display/virtio-vga.c +++ b/hw/display/virtio-vga.c @@ -12,6 +12,10 @@ #define TYPE_VIRTIO_VGA "virtio-vga" #define VIRTIO_VGA(obj) \ OBJECT_CHECK(VirtIOVGA, (obj), TYPE_VIRTIO_VGA) +#define VIRTIO_VGA_GET_CLASS(obj) \ + OBJECT_GET_CLASS(VirtIOVGAClass, obj, TYPE_VIRTIO_VGA) +#define VIRTIO_VGA_CLASS(klass) \ + OBJECT_CLASS_CHECK(VirtIOVGAClass, klass, TYPE_VIRTIO_VGA) typedef struct VirtIOVGA { VirtIOPCIProxy parent_obj; @@ -20,6 +24,11 @@ typedef struct VirtIOVGA { MemoryRegion vga_mrs[3]; } VirtIOVGA; +typedef struct VirtIOVGAClass { + VirtioPCIClass parent_class; + DeviceReset parent_reset; +} VirtIOVGAClass; + static void virtio_vga_invalidate_display(void *opaque) { VirtIOVGA *vvga = opaque; @@ -168,10 +177,11 @@ static void virtio_vga_realize(VirtIOPCIProxy *vpci_dev, Error **errp) static void virtio_vga_reset(DeviceState *dev) { + VirtIOVGAClass *klass = VIRTIO_VGA_GET_CLASS(dev); VirtIOVGA *vvga = VIRTIO_VGA(dev); /* reset virtio-gpu */ - virtio_gpu_reset(VIRTIO_DEVICE(&vvga->vdev)); + klass->parent_reset(dev); /* reset vga */ vga_common_reset(&vvga->vga); @@ -187,13 +197,15 @@ static void virtio_vga_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); VirtioPCIClass *k = VIRTIO_PCI_CLASS(klass); + VirtIOVGAClass *v = VIRTIO_VGA_CLASS(klass); PCIDeviceClass *pcidev_k = PCI_DEVICE_CLASS(klass); set_bit(DEVICE_CATEGORY_DISPLAY, dc->categories); dc->props = virtio_vga_properties; - dc->reset = virtio_vga_reset; dc->vmsd = &vmstate_virtio_vga; dc->hotpluggable = false; + device_class_set_parent_reset(dc, virtio_vga_reset, + &v->parent_reset); k->realize = virtio_vga_realize; pcidev_k->romfile = "vgabios-virtio.bin"; @@ -212,6 +224,7 @@ static VirtioPCIDeviceTypeInfo virtio_vga_info = { .generic_name = TYPE_VIRTIO_VGA, .instance_size = sizeof(struct VirtIOVGA), .instance_init = virtio_vga_inst_initfn, + .class_size = sizeof(struct VirtIOVGAClass), .class_init = virtio_vga_class_init, }; diff --git a/hw/mips/mips_fulong2e.c b/hw/mips/mips_fulong2e.c index fbbc543eed..9d7480ed31 100644 --- a/hw/mips/mips_fulong2e.c +++ b/hw/mips/mips_fulong2e.c @@ -287,6 +287,7 @@ static void mips_fulong2e_init(MachineState *machine) I2CBus *smbus; MIPSCPU *cpu; CPUMIPSState *env; + DeviceState *dev; /* init CPUs */ cpu = MIPS_CPU(cpu_create(machine->cpu_type)); @@ -347,6 +348,12 @@ static void mips_fulong2e_init(MachineState *machine) vt82c686b_southbridge_init(pci_bus, FULONG2E_VIA_SLOT, env->irq[5], &smbus, &isa_bus); + /* GPU */ + dev = DEVICE(pci_create(pci_bus, -1, "ati-vga")); + qdev_prop_set_uint32(dev, "vgamem_mb", 16); + qdev_prop_set_uint16(dev, "x-device-id", 0x5159); + qdev_init_nofail(dev); + /* Populate SPD eeprom data */ spd_data = spd_data_generate(DDR, ram_size, &err); if (err) { diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c index e978bfe760..cb44e19b67 100644 --- a/hw/virtio/virtio-pci.c +++ b/hw/virtio/virtio-pci.c @@ -1935,6 +1935,7 @@ void virtio_pci_types_register(const VirtioPCIDeviceTypeInfo *t) .parent = t->parent ? t->parent : TYPE_VIRTIO_PCI, .instance_size = t->instance_size, .instance_init = t->instance_init, + .class_size = t->class_size, .class_init = virtio_pci_base_class_init, .class_data = (void *)t, .abstract = true, diff --git a/hw/virtio/virtio-pci.h b/hw/virtio/virtio-pci.h index bd223a6e3b..18581854ca 100644 --- a/hw/virtio/virtio-pci.h +++ b/hw/virtio/virtio-pci.h @@ -230,6 +230,7 @@ typedef struct VirtioPCIDeviceTypeInfo { /* Same as TypeInfo fields: */ size_t instance_size; + size_t class_size; void (*instance_init)(Object *obj); void (*class_init)(ObjectClass *klass, void *data); } VirtioPCIDeviceTypeInfo; diff --git a/include/hw/virtio/virtio-gpu.h b/include/hw/virtio/virtio-gpu.h index 98504f9075..ce0ca72171 100644 --- a/include/hw/virtio/virtio-gpu.h +++ b/include/hw/virtio/virtio-gpu.h @@ -148,7 +148,6 @@ extern const GraphicHwOps virtio_gpu_ops; } while (0) /* virtio-gpu.c */ -void virtio_gpu_reset(VirtIODevice *vdev); void virtio_gpu_ctrl_response(VirtIOGPU *g, struct virtio_gpu_ctrl_command *cmd, struct virtio_gpu_ctrl_hdr *resp, diff --git a/target/s390x/Makefile.objs b/target/s390x/Makefile.objs index 22a9a9927a..68eeee3d2f 100644 --- a/target/s390x/Makefile.objs +++ b/target/s390x/Makefile.objs @@ -1,6 +1,7 @@ obj-y += cpu.o cpu_models.o cpu_features.o gdbstub.o interrupt.o helper.o obj-$(CONFIG_TCG) += translate.o cc_helper.o excp_helper.o fpu_helper.o obj-$(CONFIG_TCG) += int_helper.o mem_helper.o misc_helper.o crypto_helper.o +obj-$(CONFIG_TCG) += vec_helper.o obj-$(CONFIG_SOFTMMU) += machine.o ioinst.o arch_dump.o mmu_helper.o diag.o obj-$(CONFIG_SOFTMMU) += sigp.o obj-$(CONFIG_KVM) += kvm.o diff --git a/target/s390x/cpu.h b/target/s390x/cpu.h index b71ac5183d..cb6d77053a 100644 --- a/target/s390x/cpu.h +++ b/target/s390x/cpu.h @@ -257,6 +257,7 @@ extern const struct VMStateDescription vmstate_s390_cpu; /* PSW defines */ #undef PSW_MASK_PER #undef PSW_MASK_UNUSED_2 +#undef PSW_MASK_UNUSED_3 #undef PSW_MASK_DAT #undef PSW_MASK_IO #undef PSW_MASK_EXT @@ -276,6 +277,7 @@ extern const struct VMStateDescription vmstate_s390_cpu; #define PSW_MASK_PER 0x4000000000000000ULL #define PSW_MASK_UNUSED_2 0x2000000000000000ULL +#define PSW_MASK_UNUSED_3 0x1000000000000000ULL #define PSW_MASK_DAT 0x0400000000000000ULL #define PSW_MASK_IO 0x0200000000000000ULL #define PSW_MASK_EXT 0x0100000000000000ULL @@ -323,12 +325,14 @@ extern const struct VMStateDescription vmstate_s390_cpu; /* we'll use some unused PSW positions to store CR flags in tb flags */ #define FLAG_MASK_AFP (PSW_MASK_UNUSED_2 >> FLAG_MASK_PSW_SHIFT) +#define FLAG_MASK_VECTOR (PSW_MASK_UNUSED_3 >> FLAG_MASK_PSW_SHIFT) /* Control register 0 bits */ #define CR0_LOWPROT 0x0000000010000000ULL #define CR0_SECONDARY 0x0000000004000000ULL #define CR0_EDAT 0x0000000000800000ULL #define CR0_AFP 0x0000000000040000ULL +#define CR0_VECTOR 0x0000000000020000ULL #define CR0_EMERGENCY_SIGNAL_SC 0x0000000000004000ULL #define CR0_EXTERNAL_CALL_SC 0x0000000000002000ULL #define CR0_CKC_SC 0x0000000000000800ULL @@ -373,6 +377,9 @@ static inline void cpu_get_tb_cpu_state(CPUS390XState* env, target_ulong *pc, if (env->cregs[0] & CR0_AFP) { *flags |= FLAG_MASK_AFP; } + if (env->cregs[0] & CR0_VECTOR) { + *flags |= FLAG_MASK_VECTOR; + } } /* PER bits from control register 9 */ diff --git a/target/s390x/helper.h b/target/s390x/helper.h index bb659257f6..0b494a2fd2 100644 --- a/target/s390x/helper.h +++ b/target/s390x/helper.h @@ -123,6 +123,27 @@ DEF_HELPER_4(cu42, i32, env, i32, i32, i32) DEF_HELPER_5(msa, i32, env, i32, i32, i32, i32) DEF_HELPER_FLAGS_1(stpt, TCG_CALL_NO_RWG, i64, env) DEF_HELPER_FLAGS_1(stck, TCG_CALL_NO_RWG_SE, i64, env) +DEF_HELPER_FLAGS_3(probe_write_access, TCG_CALL_NO_WG, void, env, i64, i64) + +/* === Vector Support Instructions === */ +DEF_HELPER_FLAGS_4(vll, TCG_CALL_NO_WG, void, env, ptr, i64, i64) +DEF_HELPER_FLAGS_4(gvec_vpk16, TCG_CALL_NO_RWG, void, ptr, cptr, cptr, i32) +DEF_HELPER_FLAGS_4(gvec_vpk32, TCG_CALL_NO_RWG, void, ptr, cptr, cptr, i32) +DEF_HELPER_FLAGS_4(gvec_vpk64, TCG_CALL_NO_RWG, void, ptr, cptr, cptr, i32) +DEF_HELPER_FLAGS_4(gvec_vpks16, TCG_CALL_NO_RWG, void, ptr, cptr, cptr, i32) +DEF_HELPER_FLAGS_4(gvec_vpks32, TCG_CALL_NO_RWG, void, ptr, cptr, cptr, i32) +DEF_HELPER_FLAGS_4(gvec_vpks64, TCG_CALL_NO_RWG, void, ptr, cptr, cptr, i32) +DEF_HELPER_5(gvec_vpks_cc16, void, ptr, cptr, cptr, env, i32) +DEF_HELPER_5(gvec_vpks_cc32, void, ptr, cptr, cptr, env, i32) +DEF_HELPER_5(gvec_vpks_cc64, void, ptr, cptr, cptr, env, i32) +DEF_HELPER_FLAGS_4(gvec_vpkls16, TCG_CALL_NO_RWG, void, ptr, cptr, cptr, i32) +DEF_HELPER_FLAGS_4(gvec_vpkls32, TCG_CALL_NO_RWG, void, ptr, cptr, cptr, i32) +DEF_HELPER_FLAGS_4(gvec_vpkls64, TCG_CALL_NO_RWG, void, ptr, cptr, cptr, i32) +DEF_HELPER_5(gvec_vpkls_cc16, void, ptr, cptr, cptr, env, i32) +DEF_HELPER_5(gvec_vpkls_cc32, void, ptr, cptr, cptr, env, i32) +DEF_HELPER_5(gvec_vpkls_cc64, void, ptr, cptr, cptr, env, i32) +DEF_HELPER_FLAGS_5(gvec_vperm, TCG_CALL_NO_RWG, void, ptr, cptr, cptr, cptr, i32) +DEF_HELPER_FLAGS_4(vstl, TCG_CALL_NO_WG, void, env, cptr, i64, i64) #ifndef CONFIG_USER_ONLY DEF_HELPER_3(servc, i32, env, i64, i64) diff --git a/target/s390x/insn-data.def b/target/s390x/insn-data.def index 61b750a855..71fa9b8d6c 100644 --- a/target/s390x/insn-data.def +++ b/target/s390x/insn-data.def @@ -972,6 +972,88 @@ D(0xb93e, KIMD, RRE, MSA, 0, 0, 0, 0, msa, 0, S390_FEAT_TYPE_KIMD) D(0xb93f, KLMD, RRE, MSA, 0, 0, 0, 0, msa, 0, S390_FEAT_TYPE_KLMD) +/* === Vector Support Instructions === */ + +/* VECTOR GATHER ELEMENT */ + E(0xe713, VGEF, VRV, V, la2, 0, 0, 0, vge, 0, ES_32, IF_VEC) + E(0xe712, VGEG, VRV, V, la2, 0, 0, 0, vge, 0, ES_64, IF_VEC) +/* VECTOR GENERATE BYTE MASK */ + F(0xe744, VGBM, VRI_a, V, 0, 0, 0, 0, vgbm, 0, IF_VEC) +/* VECTOR GENERATE MASK */ + F(0xe746, VGM, VRI_b, V, 0, 0, 0, 0, vgm, 0, IF_VEC) +/* VECTOR LOAD */ + F(0xe706, VL, VRX, V, la2, 0, 0, 0, vl, 0, IF_VEC) + F(0xe756, VLR, VRR_a, V, 0, 0, 0, 0, vlr, 0, IF_VEC) +/* VECTOR LOAD AND REPLICATE */ + F(0xe705, VLREP, VRX, V, la2, 0, 0, 0, vlrep, 0, IF_VEC) +/* VECTOR LOAD ELEMENT */ + E(0xe700, VLEB, VRX, V, la2, 0, 0, 0, vle, 0, ES_8, IF_VEC) + E(0xe701, VLEH, VRX, V, la2, 0, 0, 0, vle, 0, ES_16, IF_VEC) + E(0xe703, VLEF, VRX, V, la2, 0, 0, 0, vle, 0, ES_32, IF_VEC) + E(0xe702, VLEG, VRX, V, la2, 0, 0, 0, vle, 0, ES_64, IF_VEC) +/* VECTOR LOAD ELEMENT IMMEDIATE */ + E(0xe740, VLEIB, VRI_a, V, 0, 0, 0, 0, vlei, 0, ES_8, IF_VEC) + E(0xe741, VLEIH, VRI_a, V, 0, 0, 0, 0, vlei, 0, ES_16, IF_VEC) + E(0xe743, VLEIF, VRI_a, V, 0, 0, 0, 0, vlei, 0, ES_32, IF_VEC) + E(0xe742, VLEIG, VRI_a, V, 0, 0, 0, 0, vlei, 0, ES_64, IF_VEC) +/* VECTOR LOAD GR FROM VR ELEMENT */ + F(0xe721, VLGV, VRS_c, V, la2, 0, r1, 0, vlgv, 0, IF_VEC) +/* VECTOR LOAD LOGICAL ELEMENT AND ZERO */ + F(0xe704, VLLEZ, VRX, V, la2, 0, 0, 0, vllez, 0, IF_VEC) +/* VECTOR LOAD MULTIPLE */ + F(0xe736, VLM, VRS_a, V, la2, 0, 0, 0, vlm, 0, IF_VEC) +/* VECTOR LOAD TO BLOCK BOUNDARY */ + F(0xe707, VLBB, VRX, V, la2, 0, 0, 0, vlbb, 0, IF_VEC) +/* VECTOR LOAD VR ELEMENT FROM GR */ + F(0xe722, VLVG, VRS_b, V, la2, r3, 0, 0, vlvg, 0, IF_VEC) +/* VECTOR LOAD VR FROM GRS DISJOINT */ + F(0xe762, VLVGP, VRR_f, V, r2, r3, 0, 0, vlvgp, 0, IF_VEC) +/* VECTOR LOAD WITH LENGTH */ + F(0xe737, VLL, VRS_b, V, la2, r3_32u, 0, 0, vll, 0, IF_VEC) +/* VECTOR MERGE HIGH */ + F(0xe761, VMRH, VRR_c, V, 0, 0, 0, 0, vmr, 0, IF_VEC) +/* VECTOR MERGE LOW */ + F(0xe760, VMRL, VRR_c, V, 0, 0, 0, 0, vmr, 0, IF_VEC) +/* VECTOR PACK */ + F(0xe794, VPK, VRR_c, V, 0, 0, 0, 0, vpk, 0, IF_VEC) +/* VECTOR PACK SATURATE */ + F(0xe797, VPKS, VRR_b, V, 0, 0, 0, 0, vpk, 0, IF_VEC) +/* VECTOR PACK LOGICAL SATURATE */ + F(0xe795, VPKLS, VRR_b, V, 0, 0, 0, 0, vpk, 0, IF_VEC) + F(0xe78c, VPERM, VRR_e, V, 0, 0, 0, 0, vperm, 0, IF_VEC) +/* VECTOR PERMUTE DOUBLEWORD IMMEDIATE */ + F(0xe784, VPDI, VRR_c, V, 0, 0, 0, 0, vpdi, 0, IF_VEC) +/* VECTOR REPLICATE */ + F(0xe74d, VREP, VRI_c, V, 0, 0, 0, 0, vrep, 0, IF_VEC) +/* VECTOR REPLICATE IMMEDIATE */ + F(0xe745, VREPI, VRI_a, V, 0, 0, 0, 0, vrepi, 0, IF_VEC) +/* VECTOR SCATTER ELEMENT */ + E(0xe71b, VSCEF, VRV, V, la2, 0, 0, 0, vsce, 0, ES_32, IF_VEC) + E(0xe71a, VSCEG, VRV, V, la2, 0, 0, 0, vsce, 0, ES_64, IF_VEC) +/* VECTOR SELECT */ + F(0xe78d, VSEL, VRR_e, V, 0, 0, 0, 0, vsel, 0, IF_VEC) +/* VECTOR SIGN EXTEND TO DOUBLEWORD */ + F(0xe75f, VSEG, VRR_a, V, 0, 0, 0, 0, vseg, 0, IF_VEC) +/* VECTOR STORE */ + F(0xe70e, VST, VRX, V, la2, 0, 0, 0, vst, 0, IF_VEC) +/* VECTOR STORE ELEMENT */ + E(0xe708, VSTEB, VRX, V, la2, 0, 0, 0, vste, 0, ES_8, IF_VEC) + E(0xe709, VSTEH, VRX, V, la2, 0, 0, 0, vste, 0, ES_16, IF_VEC) + E(0xe70b, VSTEF, VRX, V, la2, 0, 0, 0, vste, 0, ES_32, IF_VEC) + E(0xe70a, VSTEG, VRX, V, la2, 0, 0, 0, vste, 0, ES_64, IF_VEC) +/* VECTOR STORE MULTIPLE */ + F(0xe73e, VSTM, VRS_a, V, la2, 0, 0, 0, vstm, 0, IF_VEC) +/* VECTOR STORE WITH LENGTH */ + F(0xe73f, VSTL, VRS_b, V, la2, r3_32u, 0, 0, vstl, 0, IF_VEC) +/* VECTOR UNPACK HIGH */ + F(0xe7d7, VUPH, VRR_a, V, 0, 0, 0, 0, vup, 0, IF_VEC) +/* VECTOR UNPACK LOGICAL HIGH */ + F(0xe7d5, VUPLH, VRR_a, V, 0, 0, 0, 0, vup, 0, IF_VEC) +/* VECTOR UNPACK LOW */ + F(0xe7d6, VUPL, VRR_a, V, 0, 0, 0, 0, vup, 0, IF_VEC) +/* VECTOR UNPACK LOGICAL LOW */ + F(0xe7d4, VUPLL, VRR_a, V, 0, 0, 0, 0, vup, 0, IF_VEC) + #ifndef CONFIG_USER_ONLY /* COMPARE AND SWAP AND PURGE */ E(0xb250, CSP, RRE, Z, r1_32u, ra2, r1_P, 0, csp, 0, MO_TEUL, IF_PRIV) diff --git a/target/s390x/insn-format.def b/target/s390x/insn-format.def index 4297ff4165..6253edbd19 100644 --- a/target/s390x/insn-format.def +++ b/target/s390x/insn-format.def @@ -54,3 +54,28 @@ F4(SS_e, R(1, 8), BD(2,16,20), R(3,12), BD(4,32,36)) F3(SS_f, BD(1,16,20), L(2,8,8), BD(2,32,36)) F2(SSE, BD(1,16,20), BD(2,32,36)) F3(SSF, BD(1,16,20), BD(2,32,36), R(3,8)) +F3(VRI_a, V(1,8), I(2,16,16), M(3,32)) +F4(VRI_b, V(1,8), I(2,16,8), I(3,24,8), M(4,32)) +F4(VRI_c, V(1,8), V(3,12), I(2,16,16), M(4,32)) +F5(VRI_d, V(1,8), V(2,12), V(3,16), I(4,24,8), M(5,32)) +F5(VRI_e, V(1,8), V(2,12), I(3,16,12), M(5,28), M(4,32)) +F5(VRI_f, V(1,8), V(2,12), V(3,16), M(5,24), I(4,28,8)) +F5(VRI_g, V(1,8), V(2,12), I(4,16,8), M(5,24), I(3,28,8)) +F3(VRI_h, V(1,8), I(2,16,16), I(3,32,4)) +F4(VRI_i, V(1,8), R(2,12), M(4,24), I(3,28,8)) +F5(VRR_a, V(1,8), V(2,12), M(5,24), M(4,28), M(3,32)) +F5(VRR_b, V(1,8), V(2,12), V(3,16), M(5,24), M(4,32)) +F6(VRR_c, V(1,8), V(2,12), V(3,16), M(6,24), M(5,28), M(4,32)) +F6(VRR_d, V(1,8), V(2,12), V(3,16), M(5,20), M(6,24), V(4,32)) +F6(VRR_e, V(1,8), V(2,12), V(3,16), M(6,20), M(5,28), V(4,32)) +F3(VRR_f, V(1,8), R(2,12), R(3,16)) +F1(VRR_g, V(1,12)) +F3(VRR_h, V(1,12), V(2,16), M(3,24)) +F3(VRR_i, R(1,8), V(2,12), M(3,24)) +F4(VRS_a, V(1,8), V(3,12), BD(2,16,20), M(4,32)) +F4(VRS_b, V(1,8), R(3,12), BD(2,16,20), M(4,32)) +F4(VRS_c, R(1,8), V(3,12), BD(2,16,20), M(4,32)) +F3(VRS_d, R(3,12), BD(2,16,20), V(1,32)) +F4(VRV, V(1,8), V(2,12), BD(2,16,20), M(3,32)) +F3(VRX, V(1,8), BXD(2), M(3,32)) +F3(VSI, I(3,8,8), BD(2,16,20), V(1,32)) diff --git a/target/s390x/internal.h b/target/s390x/internal.h index 7baf0e2404..3b4855c175 100644 --- a/target/s390x/internal.h +++ b/target/s390x/internal.h @@ -63,45 +63,7 @@ typedef struct LowCore { PSW program_new_psw; /* 0x1d0 */ PSW mcck_new_psw; /* 0x1e0 */ PSW io_new_psw; /* 0x1f0 */ - PSW return_psw; /* 0x200 */ - uint8_t irb[64]; /* 0x210 */ - uint64_t sync_enter_timer; /* 0x250 */ - uint64_t async_enter_timer; /* 0x258 */ - uint64_t exit_timer; /* 0x260 */ - uint64_t last_update_timer; /* 0x268 */ - uint64_t user_timer; /* 0x270 */ - uint64_t system_timer; /* 0x278 */ - uint64_t last_update_clock; /* 0x280 */ - uint64_t steal_clock; /* 0x288 */ - PSW return_mcck_psw; /* 0x290 */ - uint8_t pad9[0xc00 - 0x2a0]; /* 0x2a0 */ - /* System info area */ - uint64_t save_area[16]; /* 0xc00 */ - uint8_t pad10[0xd40 - 0xc80]; /* 0xc80 */ - uint64_t kernel_stack; /* 0xd40 */ - uint64_t thread_info; /* 0xd48 */ - uint64_t async_stack; /* 0xd50 */ - uint64_t kernel_asce; /* 0xd58 */ - uint64_t user_asce; /* 0xd60 */ - uint64_t panic_stack; /* 0xd68 */ - uint64_t user_exec_asce; /* 0xd70 */ - uint8_t pad11[0xdc0 - 0xd78]; /* 0xd78 */ - - /* SMP info area: defined by DJB */ - uint64_t clock_comparator; /* 0xdc0 */ - uint64_t ext_call_fast; /* 0xdc8 */ - uint64_t percpu_offset; /* 0xdd0 */ - uint64_t current_task; /* 0xdd8 */ - uint32_t softirq_pending; /* 0xde0 */ - uint32_t pad_0x0de4; /* 0xde4 */ - uint64_t int_clock; /* 0xde8 */ - uint8_t pad12[0xe00 - 0xdf0]; /* 0xdf0 */ - - /* 0xe00 is used as indicator for dump tools */ - /* whether the kernel died with panic() or not */ - uint32_t panic_magic; /* 0xe00 */ - - uint8_t pad13[0x11b0 - 0xe04]; /* 0xe04 */ + uint8_t pad13[0x11b0 - 0x200]; /* 0x200 */ uint64_t mcesad; /* 0x11B0 */ @@ -130,6 +92,7 @@ typedef struct LowCore { uint8_t pad18[0x2000 - 0x1400]; /* 0x1400 */ } QEMU_PACKED LowCore; +QEMU_BUILD_BUG_ON(sizeof(LowCore) != 8192); #endif /* CONFIG_USER_ONLY */ #define MAX_ILEN 6 @@ -386,6 +349,8 @@ void ioinst_handle_sal(S390CPU *cpu, uint64_t reg1, uintptr_t ra); /* mem_helper.c */ target_ulong mmu_real2abs(CPUS390XState *env, target_ulong raddr); +void probe_write_access(CPUS390XState *env, uint64_t addr, uint64_t len, + uintptr_t ra); /* mmu_helper.c */ diff --git a/target/s390x/mem_helper.c b/target/s390x/mem_helper.c index a506d9ef99..3f76a8abfd 100644 --- a/target/s390x/mem_helper.c +++ b/target/s390x/mem_helper.c @@ -2623,3 +2623,29 @@ uint32_t HELPER(cu42)(CPUS390XState *env, uint32_t r1, uint32_t r2, uint32_t m3) return convert_unicode(env, r1, r2, m3, GETPC(), decode_utf32, encode_utf16); } + +void probe_write_access(CPUS390XState *env, uint64_t addr, uint64_t len, + uintptr_t ra) +{ +#ifdef CONFIG_USER_ONLY + if (!h2g_valid(addr) || !h2g_valid(addr + len - 1) || + page_check_range(addr, len, PAGE_WRITE) < 0) { + s390_program_interrupt(env, PGM_ADDRESSING, ILEN_AUTO, ra); + } +#else + /* test the actual access, not just any access to the page due to LAP */ + while (len) { + const uint64_t pagelen = -(addr | -TARGET_PAGE_MASK); + const uint64_t curlen = MIN(pagelen, len); + + probe_write(env, addr, curlen, cpu_mmu_index(env, false), ra); + addr = wrap_address(env, addr + curlen); + len -= curlen; + } +#endif +} + +void HELPER(probe_write_access)(CPUS390XState *env, uint64_t addr, uint64_t len) +{ + probe_write_access(env, addr, len, GETPC()); +} diff --git a/target/s390x/translate.c b/target/s390x/translate.c index 41fb466bb4..0afa8f7ca5 100644 --- a/target/s390x/translate.c +++ b/target/s390x/translate.c @@ -34,6 +34,7 @@ #include "disas/disas.h" #include "exec/exec-all.h" #include "tcg-op.h" +#include "tcg-op-gvec.h" #include "qemu/log.h" #include "qemu/host-utils.h" #include "exec/cpu_ldst.h" @@ -985,6 +986,7 @@ static void free_compare(DisasCompare *c) #define F3(N, X1, X2, X3) F0(N) #define F4(N, X1, X2, X3, X4) F0(N) #define F5(N, X1, X2, X3, X4, X5) F0(N) +#define F6(N, X1, X2, X3, X4, X5, X6) F0(N) typedef enum { #include "insn-format.def" @@ -996,6 +998,7 @@ typedef enum { #undef F3 #undef F4 #undef F5 +#undef F6 /* Define a structure to hold the decoded fields. We'll store each inside an array indexed by an enum. In order to conserve memory, we'll arrange @@ -1010,6 +1013,8 @@ enum DisasFieldIndexO { FLD_O_m1, FLD_O_m3, FLD_O_m4, + FLD_O_m5, + FLD_O_m6, FLD_O_b1, FLD_O_b2, FLD_O_b4, @@ -1023,7 +1028,11 @@ enum DisasFieldIndexO { FLD_O_i2, FLD_O_i3, FLD_O_i4, - FLD_O_i5 + FLD_O_i5, + FLD_O_v1, + FLD_O_v2, + FLD_O_v3, + FLD_O_v4, }; enum DisasFieldIndexC { @@ -1031,6 +1040,7 @@ enum DisasFieldIndexC { FLD_C_m1 = 0, FLD_C_b1 = 0, FLD_C_i1 = 0, + FLD_C_v1 = 0, FLD_C_r2 = 1, FLD_C_b2 = 1, @@ -1039,20 +1049,25 @@ enum DisasFieldIndexC { FLD_C_r3 = 2, FLD_C_m3 = 2, FLD_C_i3 = 2, + FLD_C_v3 = 2, FLD_C_m4 = 3, FLD_C_b4 = 3, FLD_C_i4 = 3, FLD_C_l1 = 3, + FLD_C_v4 = 3, FLD_C_i5 = 4, FLD_C_d1 = 4, + FLD_C_m5 = 4, FLD_C_d2 = 5, + FLD_C_m6 = 5, FLD_C_d4 = 6, FLD_C_x2 = 6, FLD_C_l2 = 6, + FLD_C_v2 = 6, NUM_C_FIELD = 7 }; @@ -1097,6 +1112,7 @@ typedef struct DisasFormatInfo { #define R(N, B) { B, 4, 0, FLD_C_r##N, FLD_O_r##N } #define M(N, B) { B, 4, 0, FLD_C_m##N, FLD_O_m##N } +#define V(N, B) { B, 4, 3, FLD_C_v##N, FLD_O_v##N } #define BD(N, BB, BD) { BB, 4, 0, FLD_C_b##N, FLD_O_b##N }, \ { BD, 12, 0, FLD_C_d##N, FLD_O_d##N } #define BXD(N) { 16, 4, 0, FLD_C_b##N, FLD_O_b##N }, \ @@ -1116,6 +1132,7 @@ typedef struct DisasFormatInfo { #define F3(N, X1, X2, X3) { { X1, X2, X3 } }, #define F4(N, X1, X2, X3, X4) { { X1, X2, X3, X4 } }, #define F5(N, X1, X2, X3, X4, X5) { { X1, X2, X3, X4, X5 } }, +#define F6(N, X1, X2, X3, X4, X5, X6) { { X1, X2, X3, X4, X5, X6 } }, static const DisasFormatInfo format_info[] = { #include "insn-format.def" @@ -1127,8 +1144,10 @@ static const DisasFormatInfo format_info[] = { #undef F3 #undef F4 #undef F5 +#undef F6 #undef R #undef M +#undef V #undef BD #undef BXD #undef BDL @@ -1185,6 +1204,7 @@ typedef struct { #define IF_BFP 0x0008 /* binary floating point instruction */ #define IF_DFP 0x0010 /* decimal floating point instruction */ #define IF_PRIV 0x0020 /* privileged instruction */ +#define IF_VEC 0x0040 /* vector instruction */ struct DisasInsn { unsigned opc:16; @@ -5101,6 +5121,8 @@ static DisasJumpType op_mpcifc(DisasContext *s, DisasOps *o) } #endif +#include "translate_vx.inc.c" + /* ====================================================================== */ /* The "Cc OUTput" generators. Given the generated output (and in some cases the original inputs), update the various cc data structures in order to @@ -5772,6 +5794,13 @@ static void in2_r3_sr32(DisasContext *s, DisasFields *f, DisasOps *o) } #define SPEC_in2_r3_sr32 0 +static void in2_r3_32u(DisasContext *s, DisasFields *f, DisasOps *o) +{ + o->in2 = tcg_temp_new_i64(); + tcg_gen_ext32u_i64(o->in2, regs[get_field(f, r3)]); +} +#define SPEC_in2_r3_32u 0 + static void in2_r2_32s(DisasContext *s, DisasFields *f, DisasOps *o) { o->in2 = tcg_temp_new_i64(); @@ -6119,6 +6148,25 @@ static void extract_field(DisasFields *o, const DisasField *f, uint64_t insn) case 2: /* dl+dh split, signed 20 bit. */ r = ((int8_t)r << 12) | (r >> 8); break; + case 3: /* MSB stored in RXB */ + g_assert(f->size == 4); + switch (f->beg) { + case 8: + r |= extract64(insn, 63 - 36, 1) << 4; + break; + case 12: + r |= extract64(insn, 63 - 37, 1) << 4; + break; + case 16: + r |= extract64(insn, 63 - 38, 1) << 4; + break; + case 32: + r |= extract64(insn, 63 - 39, 1) << 4; + break; + default: + g_assert_not_reached(); + } + break; default: abort(); } @@ -6300,11 +6348,22 @@ static DisasJumpType translate_one(CPUS390XState *env, DisasContext *s) if (insn->flags & IF_DFP) { dxc = 3; } + if (insn->flags & IF_VEC) { + dxc = 0xfe; + } if (dxc) { gen_data_exception(dxc); return DISAS_NORETURN; } } + + /* if vector instructions not enabled, executing them is forbidden */ + if (insn->flags & IF_VEC) { + if (!((s->base.tb->flags & FLAG_MASK_VECTOR))) { + gen_data_exception(0xfe); + return DISAS_NORETURN; + } + } } /* Check for insn specification exceptions. */ diff --git a/target/s390x/translate_vx.inc.c b/target/s390x/translate_vx.inc.c new file mode 100644 index 0000000000..76f9a5d939 --- /dev/null +++ b/target/s390x/translate_vx.inc.c @@ -0,0 +1,935 @@ +/* + * QEMU TCG support -- s390x vector instruction translation functions + * + * Copyright (C) 2019 Red Hat Inc + * + * Authors: + * David Hildenbrand <david@redhat.com> + * + * This work is licensed under the terms of the GNU GPL, version 2 or later. + * See the COPYING file in the top-level directory. + */ + +/* + * For most instructions that use the same element size for reads and + * writes, we can use real gvec vector expansion, which potantially uses + * real host vector instructions. As they only work up to 64 bit elements, + * 128 bit elements (vector is a single element) have to be handled + * differently. Operations that are too complicated to encode via TCG ops + * are handled via gvec ool (out-of-line) handlers. + * + * As soon as instructions use different element sizes for reads and writes + * or access elements "out of their element scope" we expand them manually + * in fancy loops, as gvec expansion does not deal with actual element + * numbers and does also not support access to other elements. + * + * 128 bit elements: + * As we only have i32/i64, such elements have to be loaded into two + * i64 values and can then be processed e.g. by tcg_gen_add2_i64. + * + * Sizes: + * On s390x, the operand size (oprsz) and the maximum size (maxsz) are + * always 16 (128 bit). What gvec code calls "vece", s390x calls "es", + * a.k.a. "element size". These values nicely map to MO_8 ... MO_64. Only + * 128 bit element size has to be treated in a special way (MO_64 + 1). + * We will use ES_* instead of MO_* for this reason in this file. + * + * CC handling: + * As gvec ool-helpers can currently not return values (besides via + * pointers like vectors or cpu_env), whenever we have to set the CC and + * can't conclude the value from the result vector, we will directly + * set it in "env->cc_op" and mark it as static via set_cc_static()". + * Whenever this is done, the helper writes globals (cc_op). + */ + +#define NUM_VEC_ELEMENT_BYTES(es) (1 << (es)) +#define NUM_VEC_ELEMENTS(es) (16 / NUM_VEC_ELEMENT_BYTES(es)) +#define NUM_VEC_ELEMENT_BITS(es) (NUM_VEC_ELEMENT_BYTES(es) * BITS_PER_BYTE) + +#define ES_8 MO_8 +#define ES_16 MO_16 +#define ES_32 MO_32 +#define ES_64 MO_64 +#define ES_128 4 + +static inline bool valid_vec_element(uint8_t enr, TCGMemOp es) +{ + return !(enr & ~(NUM_VEC_ELEMENTS(es) - 1)); +} + +static void read_vec_element_i64(TCGv_i64 dst, uint8_t reg, uint8_t enr, + TCGMemOp memop) +{ + const int offs = vec_reg_offset(reg, enr, memop & MO_SIZE); + + switch (memop) { + case ES_8: + tcg_gen_ld8u_i64(dst, cpu_env, offs); + break; + case ES_16: + tcg_gen_ld16u_i64(dst, cpu_env, offs); + break; + case ES_32: + tcg_gen_ld32u_i64(dst, cpu_env, offs); + break; + case ES_8 | MO_SIGN: + tcg_gen_ld8s_i64(dst, cpu_env, offs); + break; + case ES_16 | MO_SIGN: + tcg_gen_ld16s_i64(dst, cpu_env, offs); + break; + case ES_32 | MO_SIGN: + tcg_gen_ld32s_i64(dst, cpu_env, offs); + break; + case ES_64: + case ES_64 | MO_SIGN: + tcg_gen_ld_i64(dst, cpu_env, offs); + break; + default: + g_assert_not_reached(); + } +} + +static void write_vec_element_i64(TCGv_i64 src, int reg, uint8_t enr, + TCGMemOp memop) +{ + const int offs = vec_reg_offset(reg, enr, memop & MO_SIZE); + + switch (memop) { + case ES_8: + tcg_gen_st8_i64(src, cpu_env, offs); + break; + case ES_16: + tcg_gen_st16_i64(src, cpu_env, offs); + break; + case ES_32: + tcg_gen_st32_i64(src, cpu_env, offs); + break; + case ES_64: + tcg_gen_st_i64(src, cpu_env, offs); + break; + default: + g_assert_not_reached(); + } +} + + +static void get_vec_element_ptr_i64(TCGv_ptr ptr, uint8_t reg, TCGv_i64 enr, + uint8_t es) +{ + TCGv_i64 tmp = tcg_temp_new_i64(); + + /* mask off invalid parts from the element nr */ + tcg_gen_andi_i64(tmp, enr, NUM_VEC_ELEMENTS(es) - 1); + + /* convert it to an element offset relative to cpu_env (vec_reg_offset() */ + tcg_gen_shli_i64(tmp, tmp, es); +#ifndef HOST_WORDS_BIGENDIAN + tcg_gen_xori_i64(tmp, tmp, 8 - NUM_VEC_ELEMENT_BYTES(es)); +#endif + tcg_gen_addi_i64(tmp, tmp, vec_full_reg_offset(reg)); + + /* generate the final ptr by adding cpu_env */ + tcg_gen_trunc_i64_ptr(ptr, tmp); + tcg_gen_add_ptr(ptr, ptr, cpu_env); + + tcg_temp_free_i64(tmp); +} + +#define gen_gvec_3_ool(v1, v2, v3, data, fn) \ + tcg_gen_gvec_3_ool(vec_full_reg_offset(v1), vec_full_reg_offset(v2), \ + vec_full_reg_offset(v3), 16, 16, data, fn) +#define gen_gvec_3_ptr(v1, v2, v3, ptr, data, fn) \ + tcg_gen_gvec_3_ptr(vec_full_reg_offset(v1), vec_full_reg_offset(v2), \ + vec_full_reg_offset(v3), ptr, 16, 16, data, fn) +#define gen_gvec_4(v1, v2, v3, v4, gen) \ + tcg_gen_gvec_4(vec_full_reg_offset(v1), vec_full_reg_offset(v2), \ + vec_full_reg_offset(v3), vec_full_reg_offset(v4), \ + 16, 16, gen) +#define gen_gvec_4_ool(v1, v2, v3, v4, data, fn) \ + tcg_gen_gvec_4_ool(vec_full_reg_offset(v1), vec_full_reg_offset(v2), \ + vec_full_reg_offset(v3), vec_full_reg_offset(v4), \ + 16, 16, data, fn) +#define gen_gvec_dup_i64(es, v1, c) \ + tcg_gen_gvec_dup_i64(es, vec_full_reg_offset(v1), 16, 16, c) +#define gen_gvec_mov(v1, v2) \ + tcg_gen_gvec_mov(0, vec_full_reg_offset(v1), vec_full_reg_offset(v2), 16, \ + 16) +#define gen_gvec_dup64i(v1, c) \ + tcg_gen_gvec_dup64i(vec_full_reg_offset(v1), 16, 16, c) + +static void gen_gvec_dupi(uint8_t es, uint8_t reg, uint64_t c) +{ + switch (es) { + case ES_8: + tcg_gen_gvec_dup8i(vec_full_reg_offset(reg), 16, 16, c); + break; + case ES_16: + tcg_gen_gvec_dup16i(vec_full_reg_offset(reg), 16, 16, c); + break; + case ES_32: + tcg_gen_gvec_dup32i(vec_full_reg_offset(reg), 16, 16, c); + break; + case ES_64: + gen_gvec_dup64i(reg, c); + break; + default: + g_assert_not_reached(); + } +} + +static void zero_vec(uint8_t reg) +{ + tcg_gen_gvec_dup8i(vec_full_reg_offset(reg), 16, 16, 0); +} + +static DisasJumpType op_vge(DisasContext *s, DisasOps *o) +{ + const uint8_t es = s->insn->data; + const uint8_t enr = get_field(s->fields, m3); + TCGv_i64 tmp; + + if (!valid_vec_element(enr, es)) { + gen_program_exception(s, PGM_SPECIFICATION); + return DISAS_NORETURN; + } + + tmp = tcg_temp_new_i64(); + read_vec_element_i64(tmp, get_field(s->fields, v2), enr, es); + tcg_gen_add_i64(o->addr1, o->addr1, tmp); + gen_addi_and_wrap_i64(s, o->addr1, o->addr1, 0); + + tcg_gen_qemu_ld_i64(tmp, o->addr1, get_mem_index(s), MO_TE | es); + write_vec_element_i64(tmp, get_field(s->fields, v1), enr, es); + tcg_temp_free_i64(tmp); + return DISAS_NEXT; +} + +static uint64_t generate_byte_mask(uint8_t mask) +{ + uint64_t r = 0; + int i; + + for (i = 0; i < 8; i++) { + if ((mask >> i) & 1) { + r |= 0xffull << (i * 8); + } + } + return r; +} + +static DisasJumpType op_vgbm(DisasContext *s, DisasOps *o) +{ + const uint16_t i2 = get_field(s->fields, i2); + + if (i2 == (i2 & 0xff) * 0x0101) { + /* + * Masks for both 64 bit elements of the vector are the same. + * Trust tcg to produce a good constant loading. + */ + gen_gvec_dup64i(get_field(s->fields, v1), + generate_byte_mask(i2 & 0xff)); + } else { + TCGv_i64 t = tcg_temp_new_i64(); + + tcg_gen_movi_i64(t, generate_byte_mask(i2 >> 8)); + write_vec_element_i64(t, get_field(s->fields, v1), 0, ES_64); + tcg_gen_movi_i64(t, generate_byte_mask(i2)); + write_vec_element_i64(t, get_field(s->fields, v1), 1, ES_64); + tcg_temp_free_i64(t); + } + return DISAS_NEXT; +} + +static DisasJumpType op_vgm(DisasContext *s, DisasOps *o) +{ + const uint8_t es = get_field(s->fields, m4); + const uint8_t bits = NUM_VEC_ELEMENT_BITS(es); + const uint8_t i2 = get_field(s->fields, i2) & (bits - 1); + const uint8_t i3 = get_field(s->fields, i3) & (bits - 1); + uint64_t mask = 0; + int i; + + if (es > ES_64) { + gen_program_exception(s, PGM_SPECIFICATION); + return DISAS_NORETURN; + } + + /* generate the mask - take care of wrapping */ + for (i = i2; ; i = (i + 1) % bits) { + mask |= 1ull << (bits - i - 1); + if (i == i3) { + break; + } + } + + gen_gvec_dupi(es, get_field(s->fields, v1), mask); + return DISAS_NEXT; +} + +static DisasJumpType op_vl(DisasContext *s, DisasOps *o) +{ + TCGv_i64 t0 = tcg_temp_new_i64(); + TCGv_i64 t1 = tcg_temp_new_i64(); + + tcg_gen_qemu_ld_i64(t0, o->addr1, get_mem_index(s), MO_TEQ); + gen_addi_and_wrap_i64(s, o->addr1, o->addr1, 8); + tcg_gen_qemu_ld_i64(t1, o->addr1, get_mem_index(s), MO_TEQ); + write_vec_element_i64(t0, get_field(s->fields, v1), 0, ES_64); + write_vec_element_i64(t1, get_field(s->fields, v1), 1, ES_64); + tcg_temp_free(t0); + tcg_temp_free(t1); + return DISAS_NEXT; +} + +static DisasJumpType op_vlr(DisasContext *s, DisasOps *o) +{ + gen_gvec_mov(get_field(s->fields, v1), get_field(s->fields, v2)); + return DISAS_NEXT; +} + +static DisasJumpType op_vlrep(DisasContext *s, DisasOps *o) +{ + const uint8_t es = get_field(s->fields, m3); + TCGv_i64 tmp; + + if (es > ES_64) { + gen_program_exception(s, PGM_SPECIFICATION); + return DISAS_NORETURN; + } + + tmp = tcg_temp_new_i64(); + tcg_gen_qemu_ld_i64(tmp, o->addr1, get_mem_index(s), MO_TE | es); + gen_gvec_dup_i64(es, get_field(s->fields, v1), tmp); + tcg_temp_free_i64(tmp); + return DISAS_NEXT; +} + +static DisasJumpType op_vle(DisasContext *s, DisasOps *o) +{ + const uint8_t es = s->insn->data; + const uint8_t enr = get_field(s->fields, m3); + TCGv_i64 tmp; + + if (!valid_vec_element(enr, es)) { + gen_program_exception(s, PGM_SPECIFICATION); + return DISAS_NORETURN; + } + + tmp = tcg_temp_new_i64(); + tcg_gen_qemu_ld_i64(tmp, o->addr1, get_mem_index(s), MO_TE | es); + write_vec_element_i64(tmp, get_field(s->fields, v1), enr, es); + tcg_temp_free_i64(tmp); + return DISAS_NEXT; +} + +static DisasJumpType op_vlei(DisasContext *s, DisasOps *o) +{ + const uint8_t es = s->insn->data; + const uint8_t enr = get_field(s->fields, m3); + TCGv_i64 tmp; + + if (!valid_vec_element(enr, es)) { + gen_program_exception(s, PGM_SPECIFICATION); + return DISAS_NORETURN; + } + + tmp = tcg_const_i64((int16_t)get_field(s->fields, i2)); + write_vec_element_i64(tmp, get_field(s->fields, v1), enr, es); + tcg_temp_free_i64(tmp); + return DISAS_NEXT; +} + +static DisasJumpType op_vlgv(DisasContext *s, DisasOps *o) +{ + const uint8_t es = get_field(s->fields, m4); + TCGv_ptr ptr; + + if (es > ES_64) { + gen_program_exception(s, PGM_SPECIFICATION); + return DISAS_NORETURN; + } + + /* fast path if we don't need the register content */ + if (!get_field(s->fields, b2)) { + uint8_t enr = get_field(s->fields, d2) & (NUM_VEC_ELEMENTS(es) - 1); + + read_vec_element_i64(o->out, get_field(s->fields, v3), enr, es); + return DISAS_NEXT; + } + + ptr = tcg_temp_new_ptr(); + get_vec_element_ptr_i64(ptr, get_field(s->fields, v3), o->addr1, es); + switch (es) { + case ES_8: + tcg_gen_ld8u_i64(o->out, ptr, 0); + break; + case ES_16: + tcg_gen_ld16u_i64(o->out, ptr, 0); + break; + case ES_32: + tcg_gen_ld32u_i64(o->out, ptr, 0); + break; + case ES_64: + tcg_gen_ld_i64(o->out, ptr, 0); + break; + default: + g_assert_not_reached(); + } + tcg_temp_free_ptr(ptr); + + return DISAS_NEXT; +} + +static DisasJumpType op_vllez(DisasContext *s, DisasOps *o) +{ + uint8_t es = get_field(s->fields, m3); + uint8_t enr; + TCGv_i64 t; + + switch (es) { + /* rightmost sub-element of leftmost doubleword */ + case ES_8: + enr = 7; + break; + case ES_16: + enr = 3; + break; + case ES_32: + enr = 1; + break; + case ES_64: + enr = 0; + break; + /* leftmost sub-element of leftmost doubleword */ + case 6: + if (s390_has_feat(S390_FEAT_VECTOR_ENH)) { + es = ES_32; + enr = 0; + break; + } + default: + /* fallthrough */ + gen_program_exception(s, PGM_SPECIFICATION); + return DISAS_NORETURN; + } + + t = tcg_temp_new_i64(); + tcg_gen_qemu_ld_i64(t, o->addr1, get_mem_index(s), MO_TE | es); + zero_vec(get_field(s->fields, v1)); + write_vec_element_i64(t, get_field(s->fields, v1), enr, es); + tcg_temp_free_i64(t); + return DISAS_NEXT; +} + +static DisasJumpType op_vlm(DisasContext *s, DisasOps *o) +{ + const uint8_t v3 = get_field(s->fields, v3); + uint8_t v1 = get_field(s->fields, v1); + TCGv_i64 t0, t1; + + if (v3 < v1 || (v3 - v1 + 1) > 16) { + gen_program_exception(s, PGM_SPECIFICATION); + return DISAS_NORETURN; + } + + /* + * Check for possible access exceptions by trying to load the last + * element. The first element will be checked first next. + */ + t0 = tcg_temp_new_i64(); + t1 = tcg_temp_new_i64(); + gen_addi_and_wrap_i64(s, t0, o->addr1, (v3 - v1) * 16 + 8); + tcg_gen_qemu_ld_i64(t0, t0, get_mem_index(s), MO_TEQ); + + for (;; v1++) { + tcg_gen_qemu_ld_i64(t1, o->addr1, get_mem_index(s), MO_TEQ); + write_vec_element_i64(t1, v1, 0, ES_64); + if (v1 == v3) { + break; + } + gen_addi_and_wrap_i64(s, o->addr1, o->addr1, 8); + tcg_gen_qemu_ld_i64(t1, o->addr1, get_mem_index(s), MO_TEQ); + write_vec_element_i64(t1, v1, 1, ES_64); + gen_addi_and_wrap_i64(s, o->addr1, o->addr1, 8); + } + + /* Store the last element, loaded first */ + write_vec_element_i64(t0, v1, 1, ES_64); + + tcg_temp_free_i64(t0); + tcg_temp_free_i64(t1); + return DISAS_NEXT; +} + +static DisasJumpType op_vlbb(DisasContext *s, DisasOps *o) +{ + const int64_t block_size = (1ull << (get_field(s->fields, m3) + 6)); + const int v1_offs = vec_full_reg_offset(get_field(s->fields, v1)); + TCGv_ptr a0; + TCGv_i64 bytes; + + if (get_field(s->fields, m3) > 6) { + gen_program_exception(s, PGM_SPECIFICATION); + return DISAS_NORETURN; + } + + bytes = tcg_temp_new_i64(); + a0 = tcg_temp_new_ptr(); + /* calculate the number of bytes until the next block boundary */ + tcg_gen_ori_i64(bytes, o->addr1, -block_size); + tcg_gen_neg_i64(bytes, bytes); + + tcg_gen_addi_ptr(a0, cpu_env, v1_offs); + gen_helper_vll(cpu_env, a0, o->addr1, bytes); + tcg_temp_free_i64(bytes); + tcg_temp_free_ptr(a0); + return DISAS_NEXT; +} + +static DisasJumpType op_vlvg(DisasContext *s, DisasOps *o) +{ + const uint8_t es = get_field(s->fields, m4); + TCGv_ptr ptr; + + if (es > ES_64) { + gen_program_exception(s, PGM_SPECIFICATION); + return DISAS_NORETURN; + } + + /* fast path if we don't need the register content */ + if (!get_field(s->fields, b2)) { + uint8_t enr = get_field(s->fields, d2) & (NUM_VEC_ELEMENTS(es) - 1); + + write_vec_element_i64(o->in2, get_field(s->fields, v1), enr, es); + return DISAS_NEXT; + } + + ptr = tcg_temp_new_ptr(); + get_vec_element_ptr_i64(ptr, get_field(s->fields, v1), o->addr1, es); + switch (es) { + case ES_8: + tcg_gen_st8_i64(o->in2, ptr, 0); + break; + case ES_16: + tcg_gen_st16_i64(o->in2, ptr, 0); + break; + case ES_32: + tcg_gen_st32_i64(o->in2, ptr, 0); + break; + case ES_64: + tcg_gen_st_i64(o->in2, ptr, 0); + break; + default: + g_assert_not_reached(); + } + tcg_temp_free_ptr(ptr); + + return DISAS_NEXT; +} + +static DisasJumpType op_vlvgp(DisasContext *s, DisasOps *o) +{ + write_vec_element_i64(o->in1, get_field(s->fields, v1), 0, ES_64); + write_vec_element_i64(o->in2, get_field(s->fields, v1), 1, ES_64); + return DISAS_NEXT; +} + +static DisasJumpType op_vll(DisasContext *s, DisasOps *o) +{ + const int v1_offs = vec_full_reg_offset(get_field(s->fields, v1)); + TCGv_ptr a0 = tcg_temp_new_ptr(); + + /* convert highest index into an actual length */ + tcg_gen_addi_i64(o->in2, o->in2, 1); + tcg_gen_addi_ptr(a0, cpu_env, v1_offs); + gen_helper_vll(cpu_env, a0, o->addr1, o->in2); + tcg_temp_free_ptr(a0); + return DISAS_NEXT; +} + +static DisasJumpType op_vmr(DisasContext *s, DisasOps *o) +{ + const uint8_t v1 = get_field(s->fields, v1); + const uint8_t v2 = get_field(s->fields, v2); + const uint8_t v3 = get_field(s->fields, v3); + const uint8_t es = get_field(s->fields, m4); + int dst_idx, src_idx; + TCGv_i64 tmp; + + if (es > ES_64) { + gen_program_exception(s, PGM_SPECIFICATION); + return DISAS_NORETURN; + } + + tmp = tcg_temp_new_i64(); + if (s->fields->op2 == 0x61) { + /* iterate backwards to avoid overwriting data we might need later */ + for (dst_idx = NUM_VEC_ELEMENTS(es) - 1; dst_idx >= 0; dst_idx--) { + src_idx = dst_idx / 2; + if (dst_idx % 2 == 0) { + read_vec_element_i64(tmp, v2, src_idx, es); + } else { + read_vec_element_i64(tmp, v3, src_idx, es); + } + write_vec_element_i64(tmp, v1, dst_idx, es); + } + } else { + /* iterate forward to avoid overwriting data we might need later */ + for (dst_idx = 0; dst_idx < NUM_VEC_ELEMENTS(es); dst_idx++) { + src_idx = (dst_idx + NUM_VEC_ELEMENTS(es)) / 2; + if (dst_idx % 2 == 0) { + read_vec_element_i64(tmp, v2, src_idx, es); + } else { + read_vec_element_i64(tmp, v3, src_idx, es); + } + write_vec_element_i64(tmp, v1, dst_idx, es); + } + } + tcg_temp_free_i64(tmp); + return DISAS_NEXT; +} + +static DisasJumpType op_vpk(DisasContext *s, DisasOps *o) +{ + const uint8_t v1 = get_field(s->fields, v1); + const uint8_t v2 = get_field(s->fields, v2); + const uint8_t v3 = get_field(s->fields, v3); + const uint8_t es = get_field(s->fields, m4); + static gen_helper_gvec_3 * const vpk[3] = { + gen_helper_gvec_vpk16, + gen_helper_gvec_vpk32, + gen_helper_gvec_vpk64, + }; + static gen_helper_gvec_3 * const vpks[3] = { + gen_helper_gvec_vpks16, + gen_helper_gvec_vpks32, + gen_helper_gvec_vpks64, + }; + static gen_helper_gvec_3_ptr * const vpks_cc[3] = { + gen_helper_gvec_vpks_cc16, + gen_helper_gvec_vpks_cc32, + gen_helper_gvec_vpks_cc64, + }; + static gen_helper_gvec_3 * const vpkls[3] = { + gen_helper_gvec_vpkls16, + gen_helper_gvec_vpkls32, + gen_helper_gvec_vpkls64, + }; + static gen_helper_gvec_3_ptr * const vpkls_cc[3] = { + gen_helper_gvec_vpkls_cc16, + gen_helper_gvec_vpkls_cc32, + gen_helper_gvec_vpkls_cc64, + }; + + if (es == ES_8 || es > ES_64) { + gen_program_exception(s, PGM_SPECIFICATION); + return DISAS_NORETURN; + } + + switch (s->fields->op2) { + case 0x97: + if (get_field(s->fields, m5) & 0x1) { + gen_gvec_3_ptr(v1, v2, v3, cpu_env, 0, vpks_cc[es - 1]); + set_cc_static(s); + } else { + gen_gvec_3_ool(v1, v2, v3, 0, vpks[es - 1]); + } + break; + case 0x95: + if (get_field(s->fields, m5) & 0x1) { + gen_gvec_3_ptr(v1, v2, v3, cpu_env, 0, vpkls_cc[es - 1]); + set_cc_static(s); + } else { + gen_gvec_3_ool(v1, v2, v3, 0, vpkls[es - 1]); + } + break; + case 0x94: + /* If sources and destination dont't overlap -> fast path */ + if (v1 != v2 && v1 != v3) { + const uint8_t src_es = get_field(s->fields, m4); + const uint8_t dst_es = src_es - 1; + TCGv_i64 tmp = tcg_temp_new_i64(); + int dst_idx, src_idx; + + for (dst_idx = 0; dst_idx < NUM_VEC_ELEMENTS(dst_es); dst_idx++) { + src_idx = dst_idx; + if (src_idx < NUM_VEC_ELEMENTS(src_es)) { + read_vec_element_i64(tmp, v2, src_idx, src_es); + } else { + src_idx -= NUM_VEC_ELEMENTS(src_es); + read_vec_element_i64(tmp, v3, src_idx, src_es); + } + write_vec_element_i64(tmp, v1, dst_idx, dst_es); + } + tcg_temp_free_i64(tmp); + } else { + gen_gvec_3_ool(v1, v2, v3, 0, vpk[es - 1]); + } + break; + default: + g_assert_not_reached(); + } + return DISAS_NEXT; +} + +static DisasJumpType op_vperm(DisasContext *s, DisasOps *o) +{ + gen_gvec_4_ool(get_field(s->fields, v1), get_field(s->fields, v2), + get_field(s->fields, v3), get_field(s->fields, v4), + 0, gen_helper_gvec_vperm); + return DISAS_NEXT; +} + +static DisasJumpType op_vpdi(DisasContext *s, DisasOps *o) +{ + const uint8_t i2 = extract32(get_field(s->fields, m4), 2, 1); + const uint8_t i3 = extract32(get_field(s->fields, m4), 0, 1); + TCGv_i64 t0 = tcg_temp_new_i64(); + TCGv_i64 t1 = tcg_temp_new_i64(); + + read_vec_element_i64(t0, get_field(s->fields, v2), i2, ES_64); + read_vec_element_i64(t1, get_field(s->fields, v3), i3, ES_64); + write_vec_element_i64(t0, get_field(s->fields, v1), 0, ES_64); + write_vec_element_i64(t1, get_field(s->fields, v1), 1, ES_64); + tcg_temp_free_i64(t0); + tcg_temp_free_i64(t1); + return DISAS_NEXT; +} + +static DisasJumpType op_vrep(DisasContext *s, DisasOps *o) +{ + const uint8_t enr = get_field(s->fields, i2); + const uint8_t es = get_field(s->fields, m4); + + if (es > ES_64 || !valid_vec_element(enr, es)) { + gen_program_exception(s, PGM_SPECIFICATION); + return DISAS_NORETURN; + } + + tcg_gen_gvec_dup_mem(es, vec_full_reg_offset(get_field(s->fields, v1)), + vec_reg_offset(get_field(s->fields, v3), enr, es), + 16, 16); + return DISAS_NEXT; +} + +static DisasJumpType op_vrepi(DisasContext *s, DisasOps *o) +{ + const int64_t data = (int16_t)get_field(s->fields, i2); + const uint8_t es = get_field(s->fields, m3); + + if (es > ES_64) { + gen_program_exception(s, PGM_SPECIFICATION); + return DISAS_NORETURN; + } + + gen_gvec_dupi(es, get_field(s->fields, v1), data); + return DISAS_NEXT; +} + +static DisasJumpType op_vsce(DisasContext *s, DisasOps *o) +{ + const uint8_t es = s->insn->data; + const uint8_t enr = get_field(s->fields, m3); + TCGv_i64 tmp; + + if (!valid_vec_element(enr, es)) { + gen_program_exception(s, PGM_SPECIFICATION); + return DISAS_NORETURN; + } + + tmp = tcg_temp_new_i64(); + read_vec_element_i64(tmp, get_field(s->fields, v2), enr, es); + tcg_gen_add_i64(o->addr1, o->addr1, tmp); + gen_addi_and_wrap_i64(s, o->addr1, o->addr1, 0); + + read_vec_element_i64(tmp, get_field(s->fields, v1), enr, es); + tcg_gen_qemu_st_i64(tmp, o->addr1, get_mem_index(s), MO_TE | es); + tcg_temp_free_i64(tmp); + return DISAS_NEXT; +} + +static void gen_sel_i64(TCGv_i64 d, TCGv_i64 a, TCGv_i64 b, TCGv_i64 c) +{ + TCGv_i64 t = tcg_temp_new_i64(); + + /* bit in c not set -> copy bit from b */ + tcg_gen_andc_i64(t, b, c); + /* bit in c set -> copy bit from a */ + tcg_gen_and_i64(d, a, c); + /* merge the results */ + tcg_gen_or_i64(d, d, t); + tcg_temp_free_i64(t); +} + +static void gen_sel_vec(unsigned vece, TCGv_vec d, TCGv_vec a, TCGv_vec b, + TCGv_vec c) +{ + TCGv_vec t = tcg_temp_new_vec_matching(d); + + tcg_gen_andc_vec(vece, t, b, c); + tcg_gen_and_vec(vece, d, a, c); + tcg_gen_or_vec(vece, d, d, t); + tcg_temp_free_vec(t); +} + +static DisasJumpType op_vsel(DisasContext *s, DisasOps *o) +{ + static const GVecGen4 gvec_op = { + .fni8 = gen_sel_i64, + .fniv = gen_sel_vec, + .prefer_i64 = TCG_TARGET_REG_BITS == 64, + }; + + gen_gvec_4(get_field(s->fields, v1), get_field(s->fields, v2), + get_field(s->fields, v3), get_field(s->fields, v4), &gvec_op); + return DISAS_NEXT; +} + +static DisasJumpType op_vseg(DisasContext *s, DisasOps *o) +{ + const uint8_t es = get_field(s->fields, m3); + int idx1, idx2; + TCGv_i64 tmp; + + switch (es) { + case ES_8: + idx1 = 7; + idx2 = 15; + break; + case ES_16: + idx1 = 3; + idx2 = 7; + break; + case ES_32: + idx1 = 1; + idx2 = 3; + break; + default: + gen_program_exception(s, PGM_SPECIFICATION); + return DISAS_NORETURN; + } + + tmp = tcg_temp_new_i64(); + read_vec_element_i64(tmp, get_field(s->fields, v2), idx1, es | MO_SIGN); + write_vec_element_i64(tmp, get_field(s->fields, v1), 0, ES_64); + read_vec_element_i64(tmp, get_field(s->fields, v2), idx2, es | MO_SIGN); + write_vec_element_i64(tmp, get_field(s->fields, v1), 1, ES_64); + tcg_temp_free_i64(tmp); + return DISAS_NEXT; +} + +static DisasJumpType op_vst(DisasContext *s, DisasOps *o) +{ + TCGv_i64 tmp = tcg_const_i64(16); + + /* Probe write access before actually modifying memory */ + gen_helper_probe_write_access(cpu_env, o->addr1, tmp); + + read_vec_element_i64(tmp, get_field(s->fields, v1), 0, ES_64); + tcg_gen_qemu_st_i64(tmp, o->addr1, get_mem_index(s), MO_TEQ); + gen_addi_and_wrap_i64(s, o->addr1, o->addr1, 8); + read_vec_element_i64(tmp, get_field(s->fields, v1), 1, ES_64); + tcg_gen_qemu_st_i64(tmp, o->addr1, get_mem_index(s), MO_TEQ); + tcg_temp_free_i64(tmp); + return DISAS_NEXT; +} + +static DisasJumpType op_vste(DisasContext *s, DisasOps *o) +{ + const uint8_t es = s->insn->data; + const uint8_t enr = get_field(s->fields, m3); + TCGv_i64 tmp; + + if (!valid_vec_element(enr, es)) { + gen_program_exception(s, PGM_SPECIFICATION); + return DISAS_NORETURN; + } + + tmp = tcg_temp_new_i64(); + read_vec_element_i64(tmp, get_field(s->fields, v1), enr, es); + tcg_gen_qemu_st_i64(tmp, o->addr1, get_mem_index(s), MO_TE | es); + tcg_temp_free_i64(tmp); + return DISAS_NEXT; +} + +static DisasJumpType op_vstm(DisasContext *s, DisasOps *o) +{ + const uint8_t v3 = get_field(s->fields, v3); + uint8_t v1 = get_field(s->fields, v1); + TCGv_i64 tmp; + + while (v3 < v1 || (v3 - v1 + 1) > 16) { + gen_program_exception(s, PGM_SPECIFICATION); + return DISAS_NORETURN; + } + + /* Probe write access before actually modifying memory */ + tmp = tcg_const_i64((v3 - v1 + 1) * 16); + gen_helper_probe_write_access(cpu_env, o->addr1, tmp); + + for (;; v1++) { + read_vec_element_i64(tmp, v1, 0, ES_64); + tcg_gen_qemu_st_i64(tmp, o->addr1, get_mem_index(s), MO_TEQ); + gen_addi_and_wrap_i64(s, o->addr1, o->addr1, 8); + read_vec_element_i64(tmp, v1, 1, ES_64); + tcg_gen_qemu_st_i64(tmp, o->addr1, get_mem_index(s), MO_TEQ); + if (v1 == v3) { + break; + } + gen_addi_and_wrap_i64(s, o->addr1, o->addr1, 8); + } + tcg_temp_free_i64(tmp); + return DISAS_NEXT; +} + +static DisasJumpType op_vstl(DisasContext *s, DisasOps *o) +{ + const int v1_offs = vec_full_reg_offset(get_field(s->fields, v1)); + TCGv_ptr a0 = tcg_temp_new_ptr(); + + /* convert highest index into an actual length */ + tcg_gen_addi_i64(o->in2, o->in2, 1); + tcg_gen_addi_ptr(a0, cpu_env, v1_offs); + gen_helper_vstl(cpu_env, a0, o->addr1, o->in2); + tcg_temp_free_ptr(a0); + return DISAS_NEXT; +} + +static DisasJumpType op_vup(DisasContext *s, DisasOps *o) +{ + const bool logical = s->fields->op2 == 0xd4 || s->fields->op2 == 0xd5; + const uint8_t v1 = get_field(s->fields, v1); + const uint8_t v2 = get_field(s->fields, v2); + const uint8_t src_es = get_field(s->fields, m3); + const uint8_t dst_es = src_es + 1; + int dst_idx, src_idx; + TCGv_i64 tmp; + + if (src_es > ES_32) { + gen_program_exception(s, PGM_SPECIFICATION); + return DISAS_NORETURN; + } + + tmp = tcg_temp_new_i64(); + if (s->fields->op2 == 0xd7 || s->fields->op2 == 0xd5) { + /* iterate backwards to avoid overwriting data we might need later */ + for (dst_idx = NUM_VEC_ELEMENTS(dst_es) - 1; dst_idx >= 0; dst_idx--) { + src_idx = dst_idx; + read_vec_element_i64(tmp, v2, src_idx, + src_es | (logical ? 0 : MO_SIGN)); + write_vec_element_i64(tmp, v1, dst_idx, dst_es); + } + + } else { + /* iterate forward to avoid overwriting data we might need later */ + for (dst_idx = 0; dst_idx < NUM_VEC_ELEMENTS(dst_es); dst_idx++) { + src_idx = dst_idx + NUM_VEC_ELEMENTS(src_es) / 2; + read_vec_element_i64(tmp, v2, src_idx, + src_es | (logical ? 0 : MO_SIGN)); + write_vec_element_i64(tmp, v1, dst_idx, dst_es); + } + } + tcg_temp_free_i64(tmp); + return DISAS_NEXT; +} diff --git a/target/s390x/vec.h b/target/s390x/vec.h new file mode 100644 index 0000000000..3313fb43ee --- /dev/null +++ b/target/s390x/vec.h @@ -0,0 +1,101 @@ +/* + * QEMU TCG support -- s390x vector utilitites + * + * Copyright (C) 2019 Red Hat Inc + * + * Authors: + * David Hildenbrand <david@redhat.com> + * + * This work is licensed under the terms of the GNU GPL, version 2 or later. + * See the COPYING file in the top-level directory. + */ +#ifndef S390X_VEC_H +#define S390X_VEC_H + +typedef union S390Vector { + uint64_t doubleword[2]; + uint32_t word[4]; + uint16_t halfword[8]; + uint8_t byte[16]; +} S390Vector; + +/* + * Each vector is stored as two 64bit host values. So when talking about + * byte/halfword/word numbers, we have to take care of proper translation + * between element numbers. + * + * Big Endian (target/possible host) + * B: [ 0][ 1][ 2][ 3][ 4][ 5][ 6][ 7] - [ 8][ 9][10][11][12][13][14][15] + * HW: [ 0][ 1][ 2][ 3] - [ 4][ 5][ 6][ 7] + * W: [ 0][ 1] - [ 2][ 3] + * DW: [ 0] - [ 1] + * + * Little Endian (possible host) + * B: [ 7][ 6][ 5][ 4][ 3][ 2][ 1][ 0] - [15][14][13][12][11][10][ 9][ 8] + * HW: [ 3][ 2][ 1][ 0] - [ 7][ 6][ 5][ 4] + * W: [ 1][ 0] - [ 3][ 2] + * DW: [ 0] - [ 1] + */ +#ifndef HOST_WORDS_BIGENDIAN +#define H1(x) ((x) ^ 7) +#define H2(x) ((x) ^ 3) +#define H4(x) ((x) ^ 1) +#else +#define H1(x) (x) +#define H2(x) (x) +#define H4(x) (x) +#endif + +static inline uint8_t s390_vec_read_element8(const S390Vector *v, uint8_t enr) +{ + g_assert(enr < 16); + return v->byte[H1(enr)]; +} + +static inline uint16_t s390_vec_read_element16(const S390Vector *v, uint8_t enr) +{ + g_assert(enr < 8); + return v->halfword[H2(enr)]; +} + +static inline uint32_t s390_vec_read_element32(const S390Vector *v, uint8_t enr) +{ + g_assert(enr < 4); + return v->word[H4(enr)]; +} + +static inline uint64_t s390_vec_read_element64(const S390Vector *v, uint8_t enr) +{ + g_assert(enr < 2); + return v->doubleword[enr]; +} + +static inline void s390_vec_write_element8(S390Vector *v, uint8_t enr, + uint8_t data) +{ + g_assert(enr < 16); + v->byte[H1(enr)] = data; +} + +static inline void s390_vec_write_element16(S390Vector *v, uint8_t enr, + uint16_t data) +{ + g_assert(enr < 8); + v->halfword[H2(enr)] = data; +} + +static inline void s390_vec_write_element32(S390Vector *v, uint8_t enr, + uint32_t data) +{ + g_assert(enr < 4); + v->word[H4(enr)] = data; +} + +static inline void s390_vec_write_element64(S390Vector *v, uint8_t enr, + uint64_t data) +{ + g_assert(enr < 2); + v->doubleword[enr] = data; +} + +#endif /* S390X_VEC_H */ diff --git a/target/s390x/vec_helper.c b/target/s390x/vec_helper.c new file mode 100644 index 0000000000..bb4c9304f0 --- /dev/null +++ b/target/s390x/vec_helper.c @@ -0,0 +1,193 @@ +/* + * QEMU TCG support -- s390x vector support instructions + * + * Copyright (C) 2019 Red Hat Inc + * + * Authors: + * David Hildenbrand <david@redhat.com> + * + * 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 "qemu-common.h" +#include "cpu.h" +#include "internal.h" +#include "vec.h" +#include "tcg/tcg.h" +#include "tcg/tcg-gvec-desc.h" +#include "exec/helper-proto.h" +#include "exec/cpu_ldst.h" +#include "exec/exec-all.h" + +void HELPER(vll)(CPUS390XState *env, void *v1, uint64_t addr, uint64_t bytes) +{ + if (likely(bytes >= 16)) { + uint64_t t0, t1; + + t0 = cpu_ldq_data_ra(env, addr, GETPC()); + addr = wrap_address(env, addr + 8); + t1 = cpu_ldq_data_ra(env, addr, GETPC()); + s390_vec_write_element64(v1, 0, t0); + s390_vec_write_element64(v1, 1, t1); + } else { + S390Vector tmp = {}; + int i; + + for (i = 0; i < bytes; i++) { + uint8_t byte = cpu_ldub_data_ra(env, addr, GETPC()); + + s390_vec_write_element8(&tmp, i, byte); + addr = wrap_address(env, addr + 1); + } + *(S390Vector *)v1 = tmp; + } +} + +#define DEF_VPK_HFN(BITS, TBITS) \ +typedef uint##TBITS##_t (*vpk##BITS##_fn)(uint##BITS##_t, int *); \ +static int vpk##BITS##_hfn(S390Vector *v1, const S390Vector *v2, \ + const S390Vector *v3, vpk##BITS##_fn fn) \ +{ \ + int i, saturated = 0; \ + S390Vector tmp; \ + \ + for (i = 0; i < (128 / TBITS); i++) { \ + uint##BITS##_t src; \ + \ + if (i < (128 / BITS)) { \ + src = s390_vec_read_element##BITS(v2, i); \ + } else { \ + src = s390_vec_read_element##BITS(v3, i - (128 / BITS)); \ + } \ + s390_vec_write_element##TBITS(&tmp, i, fn(src, &saturated)); \ + } \ + *v1 = tmp; \ + return saturated; \ +} +DEF_VPK_HFN(64, 32) +DEF_VPK_HFN(32, 16) +DEF_VPK_HFN(16, 8) + +#define DEF_VPK(BITS, TBITS) \ +static uint##TBITS##_t vpk##BITS##e(uint##BITS##_t src, int *saturated) \ +{ \ + return src; \ +} \ +void HELPER(gvec_vpk##BITS)(void *v1, const void *v2, const void *v3, \ + uint32_t desc) \ +{ \ + vpk##BITS##_hfn(v1, v2, v3, vpk##BITS##e); \ +} +DEF_VPK(64, 32) +DEF_VPK(32, 16) +DEF_VPK(16, 8) + +#define DEF_VPKS(BITS, TBITS) \ +static uint##TBITS##_t vpks##BITS##e(uint##BITS##_t src, int *saturated) \ +{ \ + if ((int##BITS##_t)src > INT##TBITS##_MAX) { \ + (*saturated)++; \ + return INT##TBITS##_MAX; \ + } else if ((int##BITS##_t)src < INT##TBITS##_MIN) { \ + (*saturated)++; \ + return INT##TBITS##_MIN; \ + } \ + return src; \ +} \ +void HELPER(gvec_vpks##BITS)(void *v1, const void *v2, const void *v3, \ + uint32_t desc) \ +{ \ + vpk##BITS##_hfn(v1, v2, v3, vpks##BITS##e); \ +} \ +void HELPER(gvec_vpks_cc##BITS)(void *v1, const void *v2, const void *v3, \ + CPUS390XState *env, uint32_t desc) \ +{ \ + int saturated = vpk##BITS##_hfn(v1, v2, v3, vpks##BITS##e); \ + \ + if (saturated == (128 / TBITS)) { \ + env->cc_op = 3; \ + } else if (saturated) { \ + env->cc_op = 1; \ + } else { \ + env->cc_op = 0; \ + } \ +} +DEF_VPKS(64, 32) +DEF_VPKS(32, 16) +DEF_VPKS(16, 8) + +#define DEF_VPKLS(BITS, TBITS) \ +static uint##TBITS##_t vpkls##BITS##e(uint##BITS##_t src, int *saturated) \ +{ \ + if (src > UINT##TBITS##_MAX) { \ + (*saturated)++; \ + return UINT##TBITS##_MAX; \ + } \ + return src; \ +} \ +void HELPER(gvec_vpkls##BITS)(void *v1, const void *v2, const void *v3, \ + uint32_t desc) \ +{ \ + vpk##BITS##_hfn(v1, v2, v3, vpkls##BITS##e); \ +} \ +void HELPER(gvec_vpkls_cc##BITS)(void *v1, const void *v2, const void *v3, \ + CPUS390XState *env, uint32_t desc) \ +{ \ + int saturated = vpk##BITS##_hfn(v1, v2, v3, vpkls##BITS##e); \ + \ + if (saturated == (128 / TBITS)) { \ + env->cc_op = 3; \ + } else if (saturated) { \ + env->cc_op = 1; \ + } else { \ + env->cc_op = 0; \ + } \ +} +DEF_VPKLS(64, 32) +DEF_VPKLS(32, 16) +DEF_VPKLS(16, 8) + +void HELPER(gvec_vperm)(void *v1, const void *v2, const void *v3, + const void *v4, uint32_t desc) +{ + S390Vector tmp; + int i; + + for (i = 0; i < 16; i++) { + const uint8_t selector = s390_vec_read_element8(v4, i) & 0x1f; + uint8_t byte; + + if (selector < 16) { + byte = s390_vec_read_element8(v2, selector); + } else { + byte = s390_vec_read_element8(v3, selector - 16); + } + s390_vec_write_element8(&tmp, i, byte); + } + *(S390Vector *)v1 = tmp; +} + +void HELPER(vstl)(CPUS390XState *env, const void *v1, uint64_t addr, + uint64_t bytes) +{ + /* Probe write access before actually modifying memory */ + probe_write_access(env, addr, bytes, GETPC()); + + if (likely(bytes >= 16)) { + cpu_stq_data_ra(env, addr, s390_vec_read_element64(v1, 0), GETPC()); + addr = wrap_address(env, addr + 8); + cpu_stq_data_ra(env, addr, s390_vec_read_element64(v1, 1), GETPC()); + } else { + S390Vector tmp = {}; + int i; + + for (i = 0; i < bytes; i++) { + uint8_t byte = s390_vec_read_element8(v1, i); + + cpu_stb_data_ra(env, addr, byte, GETPC()); + addr = wrap_address(env, addr + 1); + } + *(S390Vector *)v1 = tmp; + } +} diff --git a/tests/tcg/mips/include/test_inputs.h b/tests/tcg/mips/include/test_inputs_128.h index 5406e4e2df..e4c22dde6e 100644 --- a/tests/tcg/mips/include/test_inputs.h +++ b/tests/tcg/mips/include/test_inputs_128.h @@ -1,8 +1,8 @@ /* * Header file for pattern and random test inputs * - * Copyright (C) 2018 Wave Computing, Inc. - * Copyright (C) 2018 Aleksandar Markovic <amarkovic@wavecomp.com> + * Copyright (C) 2019 Wave Computing, Inc. + * Copyright (C) 2019 Aleksandar Markovic <amarkovic@wavecomp.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -19,8 +19,8 @@ * */ -#ifndef TEST_INPUTS_H -#define TEST_INPUTS_H +#ifndef TEST_INPUTS_128_H +#define TEST_INPUTS_128_H #include <stdint.h> diff --git a/tests/tcg/mips/include/test_utils.h b/tests/tcg/mips/include/test_utils_128.h index 9672903eb5..cfd7ad3188 100644 --- a/tests/tcg/mips/include/test_utils.h +++ b/tests/tcg/mips/include/test_utils_128.h @@ -1,8 +1,8 @@ /* * Header file for test utilities * - * Copyright (C) 2018 Wave Computing, Inc. - * Copyright (C) 2018 Aleksandar Markovic <amarkovic@wavecomp.com> + * Copyright (C) 2019 Wave Computing, Inc. + * Copyright (C) 2019 Aleksandar Markovic <amarkovic@wavecomp.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -19,8 +19,8 @@ * */ -#ifndef TEST_UTILS_H -#define TEST_UTILS_H +#ifndef TEST_UTILS_128_H +#define TEST_UTILS_128_H #include <stdio.h> #include <stdint.h> diff --git a/tests/tcg/mips/include/wrappers_msa.h b/tests/tcg/mips/include/wrappers_msa.h index 9cffd55591..254e215b8a 100644 --- a/tests/tcg/mips/include/wrappers_msa.h +++ b/tests/tcg/mips/include/wrappers_msa.h @@ -1,8 +1,8 @@ /* * Header file for wrappers around MSA instructions assembler invocations * - * Copyright (C) 2018 Wave Computing, Inc. - * Copyright (C) 2018 Aleksandar Markovic <amarkovic@wavecomp.com> + * Copyright (C) 2019 Wave Computing, Inc. + * Copyright (C) 2019 Aleksandar Markovic <amarkovic@wavecomp.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/tests/tcg/mips/user/ase/msa/bit-count/test_msa_nloc_b.c b/tests/tcg/mips/user/ase/msa/bit-count/test_msa_nloc_b.c index d62943123e..c73ed2464e 100644 --- a/tests/tcg/mips/user/ase/msa/bit-count/test_msa_nloc_b.c +++ b/tests/tcg/mips/user/ase/msa/bit-count/test_msa_nloc_b.c @@ -1,8 +1,8 @@ /* * Test program for MSA instruction NLOC.B * - * Copyright (C) 2018 Wave Computing, Inc. - * Copyright (C) 2018 Aleksandar Markovic <amarkovic@wavecomp.com> + * Copyright (C) 2019 Wave Computing, Inc. + * Copyright (C) 2019 Aleksandar Markovic <amarkovic@wavecomp.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -23,8 +23,8 @@ #include <stdint.h> #include "../../../../include/wrappers_msa.h" -#include "../../../../include/test_inputs.h" -#include "../../../../include/test_utils.h" +#include "../../../../include/test_inputs_128.h" +#include "../../../../include/test_utils_128.h" #define TEST_COUNT_TOTAL (PATTERN_INPUTS_COUNT + RANDOM_INPUTS_COUNT) diff --git a/tests/tcg/mips/user/ase/msa/bit-count/test_msa_nloc_d.c b/tests/tcg/mips/user/ase/msa/bit-count/test_msa_nloc_d.c index fad220ce0f..b10fb23e88 100644 --- a/tests/tcg/mips/user/ase/msa/bit-count/test_msa_nloc_d.c +++ b/tests/tcg/mips/user/ase/msa/bit-count/test_msa_nloc_d.c @@ -1,8 +1,8 @@ /* * Test program for MSA instruction NLOC.D * - * Copyright (C) 2018 Wave Computing, Inc. - * Copyright (C) 2018 Aleksandar Markovic <amarkovic@wavecomp.com> + * Copyright (C) 2019 Wave Computing, Inc. + * Copyright (C) 2019 Aleksandar Markovic <amarkovic@wavecomp.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -23,8 +23,8 @@ #include <stdint.h> #include "../../../../include/wrappers_msa.h" -#include "../../../../include/test_inputs.h" -#include "../../../../include/test_utils.h" +#include "../../../../include/test_inputs_128.h" +#include "../../../../include/test_utils_128.h" #define TEST_COUNT_TOTAL (PATTERN_INPUTS_COUNT + RANDOM_INPUTS_COUNT) diff --git a/tests/tcg/mips/user/ase/msa/bit-count/test_msa_nloc_h.c b/tests/tcg/mips/user/ase/msa/bit-count/test_msa_nloc_h.c index 84cf974635..c1dc0754e6 100644 --- a/tests/tcg/mips/user/ase/msa/bit-count/test_msa_nloc_h.c +++ b/tests/tcg/mips/user/ase/msa/bit-count/test_msa_nloc_h.c @@ -1,8 +1,8 @@ /* * Test program for MSA instruction NLOC.H * - * Copyright (C) 2018 Wave Computing, Inc. - * Copyright (C) 2018 Aleksandar Markovic <amarkovic@wavecomp.com> + * Copyright (C) 2019 Wave Computing, Inc. + * Copyright (C) 2019 Aleksandar Markovic <amarkovic@wavecomp.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -23,8 +23,8 @@ #include <stdint.h> #include "../../../../include/wrappers_msa.h" -#include "../../../../include/test_inputs.h" -#include "../../../../include/test_utils.h" +#include "../../../../include/test_inputs_128.h" +#include "../../../../include/test_utils_128.h" #define TEST_COUNT_TOTAL (PATTERN_INPUTS_COUNT + RANDOM_INPUTS_COUNT) diff --git a/tests/tcg/mips/user/ase/msa/bit-count/test_msa_nloc_w.c b/tests/tcg/mips/user/ase/msa/bit-count/test_msa_nloc_w.c index a0ed2020d6..4f7a556dec 100644 --- a/tests/tcg/mips/user/ase/msa/bit-count/test_msa_nloc_w.c +++ b/tests/tcg/mips/user/ase/msa/bit-count/test_msa_nloc_w.c @@ -1,8 +1,8 @@ /* * Test program for MSA instruction NLOC.W * - * Copyright (C) 2018 Wave Computing, Inc. - * Copyright (C) 2018 Aleksandar Markovic <amarkovic@wavecomp.com> + * Copyright (C) 2019 Wave Computing, Inc. + * Copyright (C) 2019 Aleksandar Markovic <amarkovic@wavecomp.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -23,8 +23,8 @@ #include <stdint.h> #include "../../../../include/wrappers_msa.h" -#include "../../../../include/test_inputs.h" -#include "../../../../include/test_utils.h" +#include "../../../../include/test_inputs_128.h" +#include "../../../../include/test_utils_128.h" #define TEST_COUNT_TOTAL (PATTERN_INPUTS_COUNT + RANDOM_INPUTS_COUNT) diff --git a/tests/tcg/mips/user/ase/msa/bit-count/test_msa_nlzc_b.c b/tests/tcg/mips/user/ase/msa/bit-count/test_msa_nlzc_b.c index 9906eae987..c202ba4856 100644 --- a/tests/tcg/mips/user/ase/msa/bit-count/test_msa_nlzc_b.c +++ b/tests/tcg/mips/user/ase/msa/bit-count/test_msa_nlzc_b.c @@ -1,8 +1,8 @@ /* * Test program for MSA instruction NLZC.B * - * Copyright (C) 2018 Wave Computing, Inc. - * Copyright (C) 2018 Aleksandar Markovic <amarkovic@wavecomp.com> + * Copyright (C) 2019 Wave Computing, Inc. + * Copyright (C) 2019 Aleksandar Markovic <amarkovic@wavecomp.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -23,8 +23,8 @@ #include <stdint.h> #include "../../../../include/wrappers_msa.h" -#include "../../../../include/test_inputs.h" -#include "../../../../include/test_utils.h" +#include "../../../../include/test_inputs_128.h" +#include "../../../../include/test_utils_128.h" #define TEST_COUNT_TOTAL (PATTERN_INPUTS_COUNT + RANDOM_INPUTS_COUNT) diff --git a/tests/tcg/mips/user/ase/msa/bit-count/test_msa_nlzc_d.c b/tests/tcg/mips/user/ase/msa/bit-count/test_msa_nlzc_d.c index 21222e30e8..1edead2860 100644 --- a/tests/tcg/mips/user/ase/msa/bit-count/test_msa_nlzc_d.c +++ b/tests/tcg/mips/user/ase/msa/bit-count/test_msa_nlzc_d.c @@ -1,8 +1,8 @@ /* * Test program for MSA instruction NLZC.D * - * Copyright (C) 2018 Wave Computing, Inc. - * Copyright (C) 2018 Aleksandar Markovic <amarkovic@wavecomp.com> + * Copyright (C) 2019 Wave Computing, Inc. + * Copyright (C) 2019 Aleksandar Markovic <amarkovic@wavecomp.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -23,8 +23,8 @@ #include <stdint.h> #include "../../../../include/wrappers_msa.h" -#include "../../../../include/test_inputs.h" -#include "../../../../include/test_utils.h" +#include "../../../../include/test_inputs_128.h" +#include "../../../../include/test_utils_128.h" #define TEST_COUNT_TOTAL (PATTERN_INPUTS_COUNT + RANDOM_INPUTS_COUNT) diff --git a/tests/tcg/mips/user/ase/msa/bit-count/test_msa_nlzc_h.c b/tests/tcg/mips/user/ase/msa/bit-count/test_msa_nlzc_h.c index fbab9c3f3a..b2724c532e 100644 --- a/tests/tcg/mips/user/ase/msa/bit-count/test_msa_nlzc_h.c +++ b/tests/tcg/mips/user/ase/msa/bit-count/test_msa_nlzc_h.c @@ -1,8 +1,8 @@ /* * Test program for MSA instruction NLZC.H * - * Copyright (C) 2018 Wave Computing, Inc. - * Copyright (C) 2018 Aleksandar Markovic <amarkovic@wavecomp.com> + * Copyright (C) 2019 Wave Computing, Inc. + * Copyright (C) 2019 Aleksandar Markovic <amarkovic@wavecomp.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -23,8 +23,8 @@ #include <stdint.h> #include "../../../../include/wrappers_msa.h" -#include "../../../../include/test_inputs.h" -#include "../../../../include/test_utils.h" +#include "../../../../include/test_inputs_128.h" +#include "../../../../include/test_utils_128.h" #define TEST_COUNT_TOTAL (PATTERN_INPUTS_COUNT + RANDOM_INPUTS_COUNT) diff --git a/tests/tcg/mips/user/ase/msa/bit-count/test_msa_nlzc_w.c b/tests/tcg/mips/user/ase/msa/bit-count/test_msa_nlzc_w.c index dc33366d9e..b547c73621 100644 --- a/tests/tcg/mips/user/ase/msa/bit-count/test_msa_nlzc_w.c +++ b/tests/tcg/mips/user/ase/msa/bit-count/test_msa_nlzc_w.c @@ -1,8 +1,8 @@ /* * Test program for MSA instruction NLZC.W * - * Copyright (C) 2018 Wave Computing, Inc. - * Copyright (C) 2018 Aleksandar Markovic <amarkovic@wavecomp.com> + * Copyright (C) 2019 Wave Computing, Inc. + * Copyright (C) 2019 Aleksandar Markovic <amarkovic@wavecomp.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -23,8 +23,8 @@ #include <stdint.h> #include "../../../../include/wrappers_msa.h" -#include "../../../../include/test_inputs.h" -#include "../../../../include/test_utils.h" +#include "../../../../include/test_inputs_128.h" +#include "../../../../include/test_utils_128.h" #define TEST_COUNT_TOTAL (PATTERN_INPUTS_COUNT + RANDOM_INPUTS_COUNT) diff --git a/tests/tcg/mips/user/ase/msa/bit-count/test_msa_pcnt_b.c b/tests/tcg/mips/user/ase/msa/bit-count/test_msa_pcnt_b.c index f9033c7ee1..5918e7fcf3 100644 --- a/tests/tcg/mips/user/ase/msa/bit-count/test_msa_pcnt_b.c +++ b/tests/tcg/mips/user/ase/msa/bit-count/test_msa_pcnt_b.c @@ -1,8 +1,8 @@ /* * Test program for MSA instruction PCNT.B * - * Copyright (C) 2018 Wave Computing, Inc. - * Copyright (C) 2018 Aleksandar Markovic <amarkovic@wavecomp.com> + * Copyright (C) 2019 Wave Computing, Inc. + * Copyright (C) 2019 Aleksandar Markovic <amarkovic@wavecomp.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -23,8 +23,8 @@ #include <stdint.h> #include "../../../../include/wrappers_msa.h" -#include "../../../../include/test_inputs.h" -#include "../../../../include/test_utils.h" +#include "../../../../include/test_inputs_128.h" +#include "../../../../include/test_utils_128.h" #define TEST_COUNT_TOTAL (PATTERN_INPUTS_COUNT + RANDOM_INPUTS_COUNT) diff --git a/tests/tcg/mips/user/ase/msa/bit-count/test_msa_pcnt_d.c b/tests/tcg/mips/user/ase/msa/bit-count/test_msa_pcnt_d.c index 132b4d0f4d..667ca3112a 100644 --- a/tests/tcg/mips/user/ase/msa/bit-count/test_msa_pcnt_d.c +++ b/tests/tcg/mips/user/ase/msa/bit-count/test_msa_pcnt_d.c @@ -1,8 +1,8 @@ /* * Test program for MSA instruction PCNT.D * - * Copyright (C) 2018 Wave Computing, Inc. - * Copyright (C) 2018 Aleksandar Markovic <amarkovic@wavecomp.com> + * Copyright (C) 2019 Wave Computing, Inc. + * Copyright (C) 2019 Aleksandar Markovic <amarkovic@wavecomp.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -23,8 +23,8 @@ #include <stdint.h> #include "../../../../include/wrappers_msa.h" -#include "../../../../include/test_inputs.h" -#include "../../../../include/test_utils.h" +#include "../../../../include/test_inputs_128.h" +#include "../../../../include/test_utils_128.h" #define TEST_COUNT_TOTAL (PATTERN_INPUTS_COUNT + RANDOM_INPUTS_COUNT) diff --git a/tests/tcg/mips/user/ase/msa/bit-count/test_msa_pcnt_h.c b/tests/tcg/mips/user/ase/msa/bit-count/test_msa_pcnt_h.c index f469c09e17..2951f86983 100644 --- a/tests/tcg/mips/user/ase/msa/bit-count/test_msa_pcnt_h.c +++ b/tests/tcg/mips/user/ase/msa/bit-count/test_msa_pcnt_h.c @@ -1,8 +1,8 @@ /* * Test program for MSA instruction PCNT.H * - * Copyright (C) 2018 Wave Computing, Inc. - * Copyright (C) 2018 Aleksandar Markovic <amarkovic@wavecomp.com> + * Copyright (C) 2019 Wave Computing, Inc. + * Copyright (C) 2019 Aleksandar Markovic <amarkovic@wavecomp.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -23,8 +23,8 @@ #include <stdint.h> #include "../../../../include/wrappers_msa.h" -#include "../../../../include/test_inputs.h" -#include "../../../../include/test_utils.h" +#include "../../../../include/test_inputs_128.h" +#include "../../../../include/test_utils_128.h" #define TEST_COUNT_TOTAL (PATTERN_INPUTS_COUNT + RANDOM_INPUTS_COUNT) diff --git a/tests/tcg/mips/user/ase/msa/bit-count/test_msa_pcnt_w.c b/tests/tcg/mips/user/ase/msa/bit-count/test_msa_pcnt_w.c index d73eff7a88..ab43ea92cd 100644 --- a/tests/tcg/mips/user/ase/msa/bit-count/test_msa_pcnt_w.c +++ b/tests/tcg/mips/user/ase/msa/bit-count/test_msa_pcnt_w.c @@ -1,8 +1,8 @@ /* * Test program for MSA instruction PCNT.W * - * Copyright (C) 2018 Wave Computing, Inc. - * Copyright (C) 2018 Aleksandar Markovic <amarkovic@wavecomp.com> + * Copyright (C) 2019 Wave Computing, Inc. + * Copyright (C) 2019 Aleksandar Markovic <amarkovic@wavecomp.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -23,8 +23,8 @@ #include <stdint.h> #include "../../../../include/wrappers_msa.h" -#include "../../../../include/test_inputs.h" -#include "../../../../include/test_utils.h" +#include "../../../../include/test_inputs_128.h" +#include "../../../../include/test_utils_128.h" #define TEST_COUNT_TOTAL (PATTERN_INPUTS_COUNT + RANDOM_INPUTS_COUNT) diff --git a/tests/tcg/mips/user/ase/msa/int-add/test_msa_add_a_b.c b/tests/tcg/mips/user/ase/msa/int-add/test_msa_add_a_b.c index 9dca167638..d2ea54f43d 100644 --- a/tests/tcg/mips/user/ase/msa/int-add/test_msa_add_a_b.c +++ b/tests/tcg/mips/user/ase/msa/int-add/test_msa_add_a_b.c @@ -1,7 +1,7 @@ /* * Test program for MSA instruction ADD_A.B * - * Copyright (C) 2019 Wave Computing, Inc. + * 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 @@ -23,8 +23,8 @@ #include <stdint.h> #include "../../../../include/wrappers_msa.h" -#include "../../../../include/test_inputs.h" -#include "../../../../include/test_utils.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) + \ diff --git a/tests/tcg/mips/user/ase/msa/int-add/test_msa_add_a_d.c b/tests/tcg/mips/user/ase/msa/int-add/test_msa_add_a_d.c index 06a7a502a0..56b81f9090 100644 --- a/tests/tcg/mips/user/ase/msa/int-add/test_msa_add_a_d.c +++ b/tests/tcg/mips/user/ase/msa/int-add/test_msa_add_a_d.c @@ -1,7 +1,7 @@ /* * Test program for MSA instruction ADD_A.D * - * Copyright (C) 2019 Wave Computing, Inc. + * 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 @@ -23,8 +23,8 @@ #include <stdint.h> #include "../../../../include/wrappers_msa.h" -#include "../../../../include/test_inputs.h" -#include "../../../../include/test_utils.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) + \ diff --git a/tests/tcg/mips/user/ase/msa/int-add/test_msa_add_a_h.c b/tests/tcg/mips/user/ase/msa/int-add/test_msa_add_a_h.c index 5e591425aa..fe3c664997 100644 --- a/tests/tcg/mips/user/ase/msa/int-add/test_msa_add_a_h.c +++ b/tests/tcg/mips/user/ase/msa/int-add/test_msa_add_a_h.c @@ -1,7 +1,7 @@ /* * Test program for MSA instruction ADD_A.H * - * Copyright (C) 2019 Wave Computing, Inc. + * 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 @@ -23,8 +23,8 @@ #include <stdint.h> #include "../../../../include/wrappers_msa.h" -#include "../../../../include/test_inputs.h" -#include "../../../../include/test_utils.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) + \ diff --git a/tests/tcg/mips/user/ase/msa/int-add/test_msa_add_a_w.c b/tests/tcg/mips/user/ase/msa/int-add/test_msa_add_a_w.c index a12f9b9ac7..205117ea95 100644 --- a/tests/tcg/mips/user/ase/msa/int-add/test_msa_add_a_w.c +++ b/tests/tcg/mips/user/ase/msa/int-add/test_msa_add_a_w.c @@ -1,7 +1,7 @@ /* * Test program for MSA instruction ADD_A.W * - * Copyright (C) 2019 Wave Computing, Inc. + * 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 @@ -23,8 +23,8 @@ #include <stdint.h> #include "../../../../include/wrappers_msa.h" -#include "../../../../include/test_inputs.h" -#include "../../../../include/test_utils.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) + \ diff --git a/tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_a_b.c b/tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_a_b.c index 61b8e6e768..6939e91fe4 100644 --- a/tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_a_b.c +++ b/tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_a_b.c @@ -1,7 +1,7 @@ /* * Test program for MSA instruction ADDS_A.B * - * Copyright (C) 2019 Wave Computing, Inc. + * 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 @@ -23,8 +23,8 @@ #include <stdint.h> #include "../../../../include/wrappers_msa.h" -#include "../../../../include/test_inputs.h" -#include "../../../../include/test_utils.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) + \ diff --git a/tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_a_d.c b/tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_a_d.c index 8350f8f266..af0f3d3700 100644 --- a/tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_a_d.c +++ b/tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_a_d.c @@ -1,7 +1,7 @@ /* * Test program for MSA instruction ADDS_A.D * - * Copyright (C) 2019 Wave Computing, Inc. + * 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 @@ -23,8 +23,8 @@ #include <stdint.h> #include "../../../../include/wrappers_msa.h" -#include "../../../../include/test_inputs.h" -#include "../../../../include/test_utils.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) + \ diff --git a/tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_a_h.c b/tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_a_h.c index 952f9f892c..4d3774fef2 100644 --- a/tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_a_h.c +++ b/tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_a_h.c @@ -1,7 +1,7 @@ /* * Test program for MSA instruction ADDS_A.H * - * Copyright (C) 2019 Wave Computing, Inc. + * 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 @@ -23,8 +23,8 @@ #include <stdint.h> #include "../../../../include/wrappers_msa.h" -#include "../../../../include/test_inputs.h" -#include "../../../../include/test_utils.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) + \ diff --git a/tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_a_w.c b/tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_a_w.c index d058c64cc4..6f06fdc7cd 100644 --- a/tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_a_w.c +++ b/tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_a_w.c @@ -1,7 +1,7 @@ /* * Test program for MSA instruction ADDS_A.W * - * Copyright (C) 2019 Wave Computing, Inc. + * 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 @@ -23,8 +23,8 @@ #include <stdint.h> #include "../../../../include/wrappers_msa.h" -#include "../../../../include/test_inputs.h" -#include "../../../../include/test_utils.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) + \ diff --git a/tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_s_b.c b/tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_s_b.c index 63e27da626..e6cb9871f5 100644 --- a/tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_s_b.c +++ b/tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_s_b.c @@ -1,7 +1,7 @@ /* * Test program for MSA instruction ADDS_S.B * - * Copyright (C) 2019 Wave Computing, Inc. + * 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 @@ -23,8 +23,8 @@ #include <stdint.h> #include "../../../../include/wrappers_msa.h" -#include "../../../../include/test_inputs.h" -#include "../../../../include/test_utils.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) + \ diff --git a/tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_s_d.c b/tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_s_d.c index 2719cee6d6..2cda5d9661 100644 --- a/tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_s_d.c +++ b/tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_s_d.c @@ -1,7 +1,7 @@ /* * Test program for MSA instruction ADDS_S.D * - * Copyright (C) 2019 Wave Computing, Inc. + * 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 @@ -23,8 +23,8 @@ #include <stdint.h> #include "../../../../include/wrappers_msa.h" -#include "../../../../include/test_inputs.h" -#include "../../../../include/test_utils.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) + \ diff --git a/tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_s_h.c b/tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_s_h.c index 52740964a9..5539322423 100644 --- a/tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_s_h.c +++ b/tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_s_h.c @@ -1,7 +1,7 @@ /* * Test program for MSA instruction ADDS_S.H * - * Copyright (C) 2019 Wave Computing, Inc. + * 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 @@ -23,8 +23,8 @@ #include <stdint.h> #include "../../../../include/wrappers_msa.h" -#include "../../../../include/test_inputs.h" -#include "../../../../include/test_utils.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) + \ diff --git a/tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_s_w.c b/tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_s_w.c index c3a6292d89..4f2cc3862e 100644 --- a/tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_s_w.c +++ b/tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_s_w.c @@ -1,7 +1,7 @@ /* * Test program for MSA instruction ADDS_S.W * - * Copyright (C) 2019 Wave Computing, Inc. + * 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 @@ -23,8 +23,8 @@ #include <stdint.h> #include "../../../../include/wrappers_msa.h" -#include "../../../../include/test_inputs.h" -#include "../../../../include/test_utils.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) + \ diff --git a/tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_u_b.c b/tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_u_b.c index df5d85f2e9..e2d9be38e7 100644 --- a/tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_u_b.c +++ b/tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_u_b.c @@ -1,7 +1,7 @@ /* * Test program for MSA instruction ADDS_U.B * - * Copyright (C) 2019 Wave Computing, Inc. + * 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 @@ -23,8 +23,8 @@ #include <stdint.h> #include "../../../../include/wrappers_msa.h" -#include "../../../../include/test_inputs.h" -#include "../../../../include/test_utils.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) + \ diff --git a/tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_u_d.c b/tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_u_d.c index 10c665bcd7..8418c636b6 100644 --- a/tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_u_d.c +++ b/tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_u_d.c @@ -1,7 +1,7 @@ /* * Test program for MSA instruction ADDS_U.D * - * Copyright (C) 2019 Wave Computing, Inc. + * 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 @@ -23,8 +23,8 @@ #include <stdint.h> #include "../../../../include/wrappers_msa.h" -#include "../../../../include/test_inputs.h" -#include "../../../../include/test_utils.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) + \ diff --git a/tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_u_h.c b/tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_u_h.c index 1e32f000a8..8a3b5c5cf5 100644 --- a/tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_u_h.c +++ b/tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_u_h.c @@ -1,7 +1,7 @@ /* * Test program for MSA instruction ADDS_U.H * - * Copyright (C) 2019 Wave Computing, Inc. + * 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 @@ -23,8 +23,8 @@ #include <stdint.h> #include "../../../../include/wrappers_msa.h" -#include "../../../../include/test_inputs.h" -#include "../../../../include/test_utils.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) + \ diff --git a/tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_u_w.c b/tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_u_w.c index 938d2da8f4..b18bdc3ea0 100644 --- a/tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_u_w.c +++ b/tests/tcg/mips/user/ase/msa/int-add/test_msa_adds_u_w.c @@ -1,7 +1,7 @@ /* * Test program for MSA instruction ADDS_U.W * - * Copyright (C) 2019 Wave Computing, Inc. + * 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 @@ -23,8 +23,8 @@ #include <stdint.h> #include "../../../../include/wrappers_msa.h" -#include "../../../../include/test_inputs.h" -#include "../../../../include/test_utils.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) + \ diff --git a/tests/tcg/mips/user/ase/msa/int-add/test_msa_addv_b.c b/tests/tcg/mips/user/ase/msa/int-add/test_msa_addv_b.c index 5dba38661d..c86c99291e 100644 --- a/tests/tcg/mips/user/ase/msa/int-add/test_msa_addv_b.c +++ b/tests/tcg/mips/user/ase/msa/int-add/test_msa_addv_b.c @@ -1,7 +1,7 @@ /* * Test program for MSA instruction ADDV.B * - * Copyright (C) 2019 Wave Computing, Inc. + * 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 @@ -23,8 +23,8 @@ #include <stdint.h> #include "../../../../include/wrappers_msa.h" -#include "../../../../include/test_inputs.h" -#include "../../../../include/test_utils.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) + \ diff --git a/tests/tcg/mips/user/ase/msa/int-add/test_msa_addv_d.c b/tests/tcg/mips/user/ase/msa/int-add/test_msa_addv_d.c index 339878c608..0f301515b3 100644 --- a/tests/tcg/mips/user/ase/msa/int-add/test_msa_addv_d.c +++ b/tests/tcg/mips/user/ase/msa/int-add/test_msa_addv_d.c @@ -1,7 +1,7 @@ /* * Test program for MSA instruction ADDV.D * - * Copyright (C) 2019 Wave Computing, Inc. + * 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 @@ -23,8 +23,8 @@ #include <stdint.h> #include "../../../../include/wrappers_msa.h" -#include "../../../../include/test_inputs.h" -#include "../../../../include/test_utils.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) + \ diff --git a/tests/tcg/mips/user/ase/msa/int-add/test_msa_addv_h.c b/tests/tcg/mips/user/ase/msa/int-add/test_msa_addv_h.c index 3add379f19..c6b4cf697b 100644 --- a/tests/tcg/mips/user/ase/msa/int-add/test_msa_addv_h.c +++ b/tests/tcg/mips/user/ase/msa/int-add/test_msa_addv_h.c @@ -1,7 +1,7 @@ /* * Test program for MSA instruction ADDV.H * - * Copyright (C) 2019 Wave Computing, Inc. + * 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 @@ -23,8 +23,8 @@ #include <stdint.h> #include "../../../../include/wrappers_msa.h" -#include "../../../../include/test_inputs.h" -#include "../../../../include/test_utils.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) + \ diff --git a/tests/tcg/mips/user/ase/msa/int-add/test_msa_addv_w.c b/tests/tcg/mips/user/ase/msa/int-add/test_msa_addv_w.c index 41f86abb18..2a565e8ed4 100644 --- a/tests/tcg/mips/user/ase/msa/int-add/test_msa_addv_w.c +++ b/tests/tcg/mips/user/ase/msa/int-add/test_msa_addv_w.c @@ -1,7 +1,7 @@ /* * Test program for MSA instruction ADDV.W * - * Copyright (C) 2019 Wave Computing, Inc. + * 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 @@ -23,8 +23,8 @@ #include <stdint.h> #include "../../../../include/wrappers_msa.h" -#include "../../../../include/test_inputs.h" -#include "../../../../include/test_utils.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) + \ diff --git a/tests/tcg/mips/user/ase/msa/int-add/test_msa_hadd_s_d.c b/tests/tcg/mips/user/ase/msa/int-add/test_msa_hadd_s_d.c index a6975e7931..7845dc0218 100644 --- a/tests/tcg/mips/user/ase/msa/int-add/test_msa_hadd_s_d.c +++ b/tests/tcg/mips/user/ase/msa/int-add/test_msa_hadd_s_d.c @@ -1,7 +1,7 @@ /* * Test program for MSA instruction HADD_S.D * - * Copyright (C) 2019 Wave Computing, Inc. + * 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 @@ -23,8 +23,8 @@ #include <stdint.h> #include "../../../../include/wrappers_msa.h" -#include "../../../../include/test_inputs.h" -#include "../../../../include/test_utils.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) + \ diff --git a/tests/tcg/mips/user/ase/msa/int-add/test_msa_hadd_s_h.c b/tests/tcg/mips/user/ase/msa/int-add/test_msa_hadd_s_h.c index 3b95551d4d..ddc2de3ff2 100644 --- a/tests/tcg/mips/user/ase/msa/int-add/test_msa_hadd_s_h.c +++ b/tests/tcg/mips/user/ase/msa/int-add/test_msa_hadd_s_h.c @@ -1,7 +1,7 @@ /* * Test program for MSA instruction HADD_S.H * - * Copyright (C) 2019 Wave Computing, Inc. + * 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 @@ -23,8 +23,8 @@ #include <stdint.h> #include "../../../../include/wrappers_msa.h" -#include "../../../../include/test_inputs.h" -#include "../../../../include/test_utils.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) + \ diff --git a/tests/tcg/mips/user/ase/msa/int-add/test_msa_hadd_s_w.c b/tests/tcg/mips/user/ase/msa/int-add/test_msa_hadd_s_w.c index 7a940b23cf..887cd1cd5c 100644 --- a/tests/tcg/mips/user/ase/msa/int-add/test_msa_hadd_s_w.c +++ b/tests/tcg/mips/user/ase/msa/int-add/test_msa_hadd_s_w.c @@ -1,7 +1,7 @@ /* * Test program for MSA instruction HADD_S.W * - * Copyright (C) 2019 Wave Computing, Inc. + * 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 @@ -23,8 +23,8 @@ #include <stdint.h> #include "../../../../include/wrappers_msa.h" -#include "../../../../include/test_inputs.h" -#include "../../../../include/test_utils.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) + \ diff --git a/tests/tcg/mips/user/ase/msa/int-add/test_msa_hadd_u_d.c b/tests/tcg/mips/user/ase/msa/int-add/test_msa_hadd_u_d.c index d4cbe44dfd..f0710f15de 100644 --- a/tests/tcg/mips/user/ase/msa/int-add/test_msa_hadd_u_d.c +++ b/tests/tcg/mips/user/ase/msa/int-add/test_msa_hadd_u_d.c @@ -1,7 +1,7 @@ /* * Test program for MSA instruction HADD_U.D * - * Copyright (C) 2019 Wave Computing, Inc. + * 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 @@ -23,8 +23,8 @@ #include <stdint.h> #include "../../../../include/wrappers_msa.h" -#include "../../../../include/test_inputs.h" -#include "../../../../include/test_utils.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) + \ diff --git a/tests/tcg/mips/user/ase/msa/int-add/test_msa_hadd_u_h.c b/tests/tcg/mips/user/ase/msa/int-add/test_msa_hadd_u_h.c index ca250575ed..fe55d3eaee 100644 --- a/tests/tcg/mips/user/ase/msa/int-add/test_msa_hadd_u_h.c +++ b/tests/tcg/mips/user/ase/msa/int-add/test_msa_hadd_u_h.c @@ -1,7 +1,7 @@ /* * Test program for MSA instruction HADD_U.H * - * Copyright (C) 2019 Wave Computing, Inc. + * 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 @@ -23,8 +23,8 @@ #include <stdint.h> #include "../../../../include/wrappers_msa.h" -#include "../../../../include/test_inputs.h" -#include "../../../../include/test_utils.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) + \ diff --git a/tests/tcg/mips/user/ase/msa/int-add/test_msa_hadd_u_w.c b/tests/tcg/mips/user/ase/msa/int-add/test_msa_hadd_u_w.c index b302727f29..babe04d586 100644 --- a/tests/tcg/mips/user/ase/msa/int-add/test_msa_hadd_u_w.c +++ b/tests/tcg/mips/user/ase/msa/int-add/test_msa_hadd_u_w.c @@ -1,7 +1,7 @@ /* * Test program for MSA instruction HADD_U.W * - * Copyright (C) 2019 Wave Computing, Inc. + * 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 @@ -23,8 +23,8 @@ #include <stdint.h> #include "../../../../include/wrappers_msa.h" -#include "../../../../include/test_inputs.h" -#include "../../../../include/test_utils.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) + \ diff --git a/tests/tcg/mips/user/ase/msa/int-average/test_msa_ave_s_b.c b/tests/tcg/mips/user/ase/msa/int-average/test_msa_ave_s_b.c new file mode 100644 index 0000000000..675fb90c72 --- /dev/null +++ b/tests/tcg/mips/user/ase/msa/int-average/test_msa_ave_s_b.c @@ -0,0 +1,151 @@ +/* + * Test program for MSA instruction AVE_S.B + * + * Copyright (C) 2018 Wave Computing, Inc. + * Copyright (C) 2018 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.h" +#include "../../../../include/test_utils.h" + +#define TEST_COUNT_TOTAL ( \ + (PATTERN_INPUTS_SHORT_COUNT) * (PATTERN_INPUTS_SHORT_COUNT) + \ + (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT)) + + +int32_t main(void) +{ + char *instruction_name = "AVE_S.B"; + int32_t ret; + uint32_t i, j; + struct timeval start, end; + double elapsed_time; + + uint64_t b128_result[TEST_COUNT_TOTAL][2]; + uint64_t b128_expect[TEST_COUNT_TOTAL][2] = { + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 0 */ + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, + { 0xd4d4d4d4d4d4d4d4ULL, 0xd4d4d4d4d4d4d4d4ULL, }, + { 0x2a2a2a2a2a2a2a2aULL, 0x2a2a2a2a2a2a2a2aULL, }, + { 0xe5e5e5e5e5e5e5e5ULL, 0xe5e5e5e5e5e5e5e5ULL, }, + { 0x1919191919191919ULL, 0x1919191919191919ULL, }, + { 0xf1c61bf1c61bf1c6ULL, 0x1bf1c61bf1c61bf1ULL, }, + { 0x0d38e30d38e30d38ULL, 0xe30d38e30d38e30dULL, }, + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 8 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0xd5d5d5d5d5d5d5d5ULL, 0xd5d5d5d5d5d5d5d5ULL, }, + { 0x2a2a2a2a2a2a2a2aULL, 0x2a2a2a2a2a2a2a2aULL, }, + { 0xe6e6e6e6e6e6e6e6ULL, 0xe6e6e6e6e6e6e6e6ULL, }, + { 0x1919191919191919ULL, 0x1919191919191919ULL, }, + { 0xf1c71cf1c71cf1c7ULL, 0x1cf1c71cf1c71cf1ULL, }, + { 0x0e38e30e38e30e38ULL, 0xe30e38e30e38e30eULL, }, + { 0xd4d4d4d4d4d4d4d4ULL, 0xd4d4d4d4d4d4d4d4ULL, }, /* 16 */ + { 0xd5d5d5d5d5d5d5d5ULL, 0xd5d5d5d5d5d5d5d5ULL, }, + { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, }, + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, + { 0xbbbbbbbbbbbbbbbbULL, 0xbbbbbbbbbbbbbbbbULL, }, + { 0xeeeeeeeeeeeeeeeeULL, 0xeeeeeeeeeeeeeeeeULL, }, + { 0xc69cf1c69cf1c69cULL, 0xf1c69cf1c69cf1c6ULL, }, + { 0xe30db8e30db8e30dULL, 0xb8e30db8e30db8e3ULL, }, + { 0x2a2a2a2a2a2a2a2aULL, 0x2a2a2a2a2a2a2a2aULL, }, /* 24 */ + { 0x2a2a2a2a2a2a2a2aULL, 0x2a2a2a2a2a2a2a2aULL, }, + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, + { 0x5555555555555555ULL, 0x5555555555555555ULL, }, + { 0x1010101010101010ULL, 0x1010101010101010ULL, }, + { 0x4444444444444444ULL, 0x4444444444444444ULL, }, + { 0x1cf1461cf1461cf1ULL, 0x461cf1461cf1461cULL, }, + { 0x38630e38630e3863ULL, 0x0e38630e38630e38ULL, }, + { 0xe5e5e5e5e5e5e5e5ULL, 0xe5e5e5e5e5e5e5e5ULL, }, /* 32 */ + { 0xe6e6e6e6e6e6e6e6ULL, 0xe6e6e6e6e6e6e6e6ULL, }, + { 0xbbbbbbbbbbbbbbbbULL, 0xbbbbbbbbbbbbbbbbULL, }, + { 0x1010101010101010ULL, 0x1010101010101010ULL, }, + { 0xccccccccccccccccULL, 0xccccccccccccccccULL, }, + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, + { 0xd7ad02d7ad02d7adULL, 0x02d7ad02d7ad02d7ULL, }, + { 0xf41ec9f41ec9f41eULL, 0xc9f41ec9f41ec9f4ULL, }, + { 0x1919191919191919ULL, 0x1919191919191919ULL, }, /* 40 */ + { 0x1919191919191919ULL, 0x1919191919191919ULL, }, + { 0xeeeeeeeeeeeeeeeeULL, 0xeeeeeeeeeeeeeeeeULL, }, + { 0x4444444444444444ULL, 0x4444444444444444ULL, }, + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, + { 0x3333333333333333ULL, 0x3333333333333333ULL, }, + { 0x0be0350be0350be0ULL, 0x350be0350be0350bULL, }, + { 0x2752fd2752fd2752ULL, 0xfd2752fd2752fd27ULL, }, + { 0xf1c61bf1c61bf1c6ULL, 0x1bf1c61bf1c61bf1ULL, }, /* 48 */ + { 0xf1c71cf1c71cf1c7ULL, 0x1cf1c71cf1c71cf1ULL, }, + { 0xc69cf1c69cf1c69cULL, 0xf1c69cf1c69cf1c6ULL, }, + { 0x1cf1461cf1461cf1ULL, 0x461cf1461cf1461cULL, }, + { 0xd7ad02d7ad02d7adULL, 0x02d7ad02d7ad02d7ULL, }, + { 0x0be0350be0350be0ULL, 0x350be0350be0350bULL, }, + { 0xe38e38e38e38e38eULL, 0x38e38e38e38e38e3ULL, }, + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, + { 0x0d38e30d38e30d38ULL, 0xe30d38e30d38e30dULL, }, /* 56 */ + { 0x0e38e30e38e30e38ULL, 0xe30e38e30e38e30eULL, }, + { 0xe30db8e30db8e30dULL, 0xb8e30db8e30db8e3ULL, }, + { 0x38630e38630e3863ULL, 0x0e38630e38630e38ULL, }, + { 0xf41ec9f41ec9f41eULL, 0xc9f41ec9f41ec9f4ULL, }, + { 0x2752fd2752fd2752ULL, 0xfd2752fd2752fd27ULL, }, + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, + { 0x1c71c71c71c71c71ULL, 0xc71c71c71c71c71cULL, }, + { 0x886ae6cc28625540ULL, 0x4b670b5efe7bb00cULL, }, /* 64 */ + { 0xc114f3173afa0e24ULL, 0x2e2fe33c095d0104ULL, }, + { 0x9a62cabbf018f0e0ULL, 0x391fe82ed453ea10ULL, }, + { 0xfc5cfe0c43491b47ULL, 0xec2cc91bd35ec9d6ULL, }, + { 0xc114f3173afa0e24ULL, 0x2e2fe33c095d0104ULL, }, + { 0xfbbe00634d93c708ULL, 0x12f7bb1a153f52fcULL, }, + { 0xd30cd70603b1a9c4ULL, 0x1ce7c00ce0353b08ULL, }, + { 0x35060b5855e2d42bULL, 0xcff4a1f9df401aceULL, }, + { 0x9a62cabbf018f0e0ULL, 0x391fe82ed453ea10ULL, }, /* 72 */ + { 0xd30cd70603b1a9c4ULL, 0x1ce7c00ce0353b08ULL, }, + { 0xac5aaeaab9cf8b80ULL, 0x27d8c6ffab2b2514ULL, }, + { 0x0e54e2fb0b00b6e7ULL, 0xdae4a7ebaa3603daULL, }, + { 0xfc5cfe0c43491b47ULL, 0xec2cc91bd35ec9d6ULL, }, + { 0x35060b5855e2d42bULL, 0xcff4a1f9df401aceULL, }, +}; + + gettimeofday(&start, NULL); + + for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) { + for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) { + do_msa_AVE_S_B(b128_pattern[i], b128_pattern[j], + b128_result[PATTERN_INPUTS_SHORT_COUNT * i + j]); + } + } + + for (i = 0; i < RANDOM_INPUTS_SHORT_COUNT; i++) { + for (j = 0; j < RANDOM_INPUTS_SHORT_COUNT; j++) { + do_msa_AVE_S_B(b128_random[i], b128_random[j], + b128_result[((PATTERN_INPUTS_SHORT_COUNT) * + (PATTERN_INPUTS_SHORT_COUNT)) + + RANDOM_INPUTS_SHORT_COUNT * i + j]); + } + } + + gettimeofday(&end, NULL); + + elapsed_time = (end.tv_sec - start.tv_sec) * 1000.0; + elapsed_time += (end.tv_usec - start.tv_usec) / 1000.0; + + ret = check_results(instruction_name, TEST_COUNT_TOTAL, elapsed_time, + &b128_result[0][0], &b128_expect[0][0]); + + return ret; +} diff --git a/tests/tcg/mips/user/ase/msa/int-average/test_msa_ave_s_d.c b/tests/tcg/mips/user/ase/msa/int-average/test_msa_ave_s_d.c new file mode 100644 index 0000000000..e87d414b5f --- /dev/null +++ b/tests/tcg/mips/user/ase/msa/int-average/test_msa_ave_s_d.c @@ -0,0 +1,151 @@ +/* + * Test program for MSA instruction AVE_S.D + * + * Copyright (C) 2018 Wave Computing, Inc. + * Copyright (C) 2018 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.h" +#include "../../../../include/test_utils.h" + +#define TEST_COUNT_TOTAL ( \ + (PATTERN_INPUTS_SHORT_COUNT) * (PATTERN_INPUTS_SHORT_COUNT) + \ + (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT)) + + +int32_t main(void) +{ + char *instruction_name = "AVE_S.D"; + int32_t ret; + uint32_t i, j; + struct timeval start, end; + double elapsed_time; + + uint64_t b128_result[TEST_COUNT_TOTAL][2]; + uint64_t b128_expect[TEST_COUNT_TOTAL][2] = { + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 0 */ + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, + { 0xd555555555555554ULL, 0xd555555555555554ULL, }, + { 0x2aaaaaaaaaaaaaaaULL, 0x2aaaaaaaaaaaaaaaULL, }, + { 0xe666666666666665ULL, 0xe666666666666665ULL, }, + { 0x1999999999999999ULL, 0x1999999999999999ULL, }, + { 0xf1c71c71c71c71c6ULL, 0x1c71c71c71c71c71ULL, }, + { 0x0e38e38e38e38e38ULL, 0xe38e38e38e38e38dULL, }, + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 8 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0xd555555555555555ULL, 0xd555555555555555ULL, }, + { 0x2aaaaaaaaaaaaaaaULL, 0x2aaaaaaaaaaaaaaaULL, }, + { 0xe666666666666666ULL, 0xe666666666666666ULL, }, + { 0x1999999999999999ULL, 0x1999999999999999ULL, }, + { 0xf1c71c71c71c71c7ULL, 0x1c71c71c71c71c71ULL, }, + { 0x0e38e38e38e38e38ULL, 0xe38e38e38e38e38eULL, }, + { 0xd555555555555554ULL, 0xd555555555555554ULL, }, /* 16 */ + { 0xd555555555555555ULL, 0xd555555555555555ULL, }, + { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, }, + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, + { 0xbbbbbbbbbbbbbbbbULL, 0xbbbbbbbbbbbbbbbbULL, }, + { 0xeeeeeeeeeeeeeeeeULL, 0xeeeeeeeeeeeeeeeeULL, }, + { 0xc71c71c71c71c71cULL, 0xf1c71c71c71c71c6ULL, }, + { 0xe38e38e38e38e38dULL, 0xb8e38e38e38e38e3ULL, }, + { 0x2aaaaaaaaaaaaaaaULL, 0x2aaaaaaaaaaaaaaaULL, }, /* 24 */ + { 0x2aaaaaaaaaaaaaaaULL, 0x2aaaaaaaaaaaaaaaULL, }, + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, + { 0x5555555555555555ULL, 0x5555555555555555ULL, }, + { 0x1111111111111110ULL, 0x1111111111111110ULL, }, + { 0x4444444444444444ULL, 0x4444444444444444ULL, }, + { 0x1c71c71c71c71c71ULL, 0x471c71c71c71c71cULL, }, + { 0x38e38e38e38e38e3ULL, 0x0e38e38e38e38e38ULL, }, + { 0xe666666666666665ULL, 0xe666666666666665ULL, }, /* 32 */ + { 0xe666666666666666ULL, 0xe666666666666666ULL, }, + { 0xbbbbbbbbbbbbbbbbULL, 0xbbbbbbbbbbbbbbbbULL, }, + { 0x1111111111111110ULL, 0x1111111111111110ULL, }, + { 0xccccccccccccccccULL, 0xccccccccccccccccULL, }, + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, + { 0xd82d82d82d82d82dULL, 0x02d82d82d82d82d7ULL, }, + { 0xf49f49f49f49f49eULL, 0xc9f49f49f49f49f4ULL, }, + { 0x1999999999999999ULL, 0x1999999999999999ULL, }, /* 40 */ + { 0x1999999999999999ULL, 0x1999999999999999ULL, }, + { 0xeeeeeeeeeeeeeeeeULL, 0xeeeeeeeeeeeeeeeeULL, }, + { 0x4444444444444444ULL, 0x4444444444444444ULL, }, + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, + { 0x3333333333333333ULL, 0x3333333333333333ULL, }, + { 0x0b60b60b60b60b60ULL, 0x360b60b60b60b60bULL, }, + { 0x27d27d27d27d27d2ULL, 0xfd27d27d27d27d27ULL, }, + { 0xf1c71c71c71c71c6ULL, 0x1c71c71c71c71c71ULL, }, /* 48 */ + { 0xf1c71c71c71c71c7ULL, 0x1c71c71c71c71c71ULL, }, + { 0xc71c71c71c71c71cULL, 0xf1c71c71c71c71c6ULL, }, + { 0x1c71c71c71c71c71ULL, 0x471c71c71c71c71cULL, }, + { 0xd82d82d82d82d82dULL, 0x02d82d82d82d82d7ULL, }, + { 0x0b60b60b60b60b60ULL, 0x360b60b60b60b60bULL, }, + { 0xe38e38e38e38e38eULL, 0x38e38e38e38e38e3ULL, }, + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, + { 0x0e38e38e38e38e38ULL, 0xe38e38e38e38e38dULL, }, /* 56 */ + { 0x0e38e38e38e38e38ULL, 0xe38e38e38e38e38eULL, }, + { 0xe38e38e38e38e38dULL, 0xb8e38e38e38e38e3ULL, }, + { 0x38e38e38e38e38e3ULL, 0x0e38e38e38e38e38ULL, }, + { 0xf49f49f49f49f49eULL, 0xc9f49f49f49f49f4ULL, }, + { 0x27d27d27d27d27d2ULL, 0xfd27d27d27d27d27ULL, }, + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, + { 0x1c71c71c71c71c71ULL, 0xc71c71c71c71c71cULL, }, + { 0x886ae6cc28625540ULL, 0x4b670b5efe7bb00cULL, }, /* 64 */ + { 0xc2147397bafb0e24ULL, 0x2f2f633c89dd8184ULL, }, + { 0x9a62cabb7118f060ULL, 0x399fe92f54d36a90ULL, }, + { 0xfc5cfe8cc34a1bc7ULL, 0xecac4a1bd3df4956ULL, }, + { 0xc2147397bafb0e24ULL, 0x2f2f633c89dd8184ULL, }, + { 0xfbbe00634d93c708ULL, 0x12f7bb1a153f52fcULL, }, + { 0xd40c578703b1a944ULL, 0x1d68410ce0353c08ULL, }, + { 0x36068b5855e2d4abULL, 0xd074a1f95f411aceULL, }, + { 0x9a62cabb7118f060ULL, 0x399fe92f54d36a90ULL, }, /* 72 */ + { 0xd40c578703b1a944ULL, 0x1d68410ce0353c08ULL, }, + { 0xac5aaeaab9cf8b80ULL, 0x27d8c6ffab2b2514ULL, }, + { 0x0e54e27c0c00b6e7ULL, 0xdae527ec2a3703daULL, }, + { 0xfc5cfe8cc34a1bc7ULL, 0xecac4a1bd3df4956ULL, }, + { 0x36068b5855e2d4abULL, 0xd074a1f95f411aceULL, }, +}; + + gettimeofday(&start, NULL); + + for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) { + for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) { + do_msa_AVE_S_D(b128_pattern[i], b128_pattern[j], + b128_result[PATTERN_INPUTS_SHORT_COUNT * i + j]); + } + } + + for (i = 0; i < RANDOM_INPUTS_SHORT_COUNT; i++) { + for (j = 0; j < RANDOM_INPUTS_SHORT_COUNT; j++) { + do_msa_AVE_S_D(b128_random[i], b128_random[j], + b128_result[((PATTERN_INPUTS_SHORT_COUNT) * + (PATTERN_INPUTS_SHORT_COUNT)) + + RANDOM_INPUTS_SHORT_COUNT * i + j]); + } + } + + gettimeofday(&end, NULL); + + elapsed_time = (end.tv_sec - start.tv_sec) * 1000.0; + elapsed_time += (end.tv_usec - start.tv_usec) / 1000.0; + + ret = check_results(instruction_name, TEST_COUNT_TOTAL, elapsed_time, + &b128_result[0][0], &b128_expect[0][0]); + + return ret; +} diff --git a/tests/tcg/mips/user/ase/msa/int-average/test_msa_ave_s_h.c b/tests/tcg/mips/user/ase/msa/int-average/test_msa_ave_s_h.c new file mode 100644 index 0000000000..c850543587 --- /dev/null +++ b/tests/tcg/mips/user/ase/msa/int-average/test_msa_ave_s_h.c @@ -0,0 +1,151 @@ +/* + * Test program for MSA instruction AVE_S.H + * + * Copyright (C) 2018 Wave Computing, Inc. + * Copyright (C) 2018 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.h" +#include "../../../../include/test_utils.h" + +#define TEST_COUNT_TOTAL ( \ + (PATTERN_INPUTS_SHORT_COUNT) * (PATTERN_INPUTS_SHORT_COUNT) + \ + (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT)) + + +int32_t main(void) +{ + char *instruction_name = "AVE_S.H"; + int32_t ret; + uint32_t i, j; + struct timeval start, end; + double elapsed_time; + + uint64_t b128_result[TEST_COUNT_TOTAL][2]; + uint64_t b128_expect[TEST_COUNT_TOTAL][2] = { + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 0 */ + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, + { 0xd554d554d554d554ULL, 0xd554d554d554d554ULL, }, + { 0x2aaa2aaa2aaa2aaaULL, 0x2aaa2aaa2aaa2aaaULL, }, + { 0xe665e665e665e665ULL, 0xe665e665e665e665ULL, }, + { 0x1999199919991999ULL, 0x1999199919991999ULL, }, + { 0xf1c61c71c71bf1c6ULL, 0x1c71c71bf1c61c71ULL, }, + { 0x0e38e38d38e30e38ULL, 0xe38d38e30e38e38dULL, }, + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 8 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0xd555d555d555d555ULL, 0xd555d555d555d555ULL, }, + { 0x2aaa2aaa2aaa2aaaULL, 0x2aaa2aaa2aaa2aaaULL, }, + { 0xe666e666e666e666ULL, 0xe666e666e666e666ULL, }, + { 0x1999199919991999ULL, 0x1999199919991999ULL, }, + { 0xf1c71c71c71cf1c7ULL, 0x1c71c71cf1c71c71ULL, }, + { 0x0e38e38e38e30e38ULL, 0xe38e38e30e38e38eULL, }, + { 0xd554d554d554d554ULL, 0xd554d554d554d554ULL, }, /* 16 */ + { 0xd555d555d555d555ULL, 0xd555d555d555d555ULL, }, + { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, }, + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, + { 0xbbbbbbbbbbbbbbbbULL, 0xbbbbbbbbbbbbbbbbULL, }, + { 0xeeeeeeeeeeeeeeeeULL, 0xeeeeeeeeeeeeeeeeULL, }, + { 0xc71cf1c69c71c71cULL, 0xf1c69c71c71cf1c6ULL, }, + { 0xe38db8e30e38e38dULL, 0xb8e30e38e38db8e3ULL, }, + { 0x2aaa2aaa2aaa2aaaULL, 0x2aaa2aaa2aaa2aaaULL, }, /* 24 */ + { 0x2aaa2aaa2aaa2aaaULL, 0x2aaa2aaa2aaa2aaaULL, }, + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, + { 0x5555555555555555ULL, 0x5555555555555555ULL, }, + { 0x1110111011101110ULL, 0x1110111011101110ULL, }, + { 0x4444444444444444ULL, 0x4444444444444444ULL, }, + { 0x1c71471cf1c61c71ULL, 0x471cf1c61c71471cULL, }, + { 0x38e30e38638e38e3ULL, 0x0e38638e38e30e38ULL, }, + { 0xe665e665e665e665ULL, 0xe665e665e665e665ULL, }, /* 32 */ + { 0xe666e666e666e666ULL, 0xe666e666e666e666ULL, }, + { 0xbbbbbbbbbbbbbbbbULL, 0xbbbbbbbbbbbbbbbbULL, }, + { 0x1110111011101110ULL, 0x1110111011101110ULL, }, + { 0xccccccccccccccccULL, 0xccccccccccccccccULL, }, + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, + { 0xd82d02d7ad82d82dULL, 0x02d7ad82d82d02d7ULL, }, + { 0xf49ec9f41f49f49eULL, 0xc9f41f49f49ec9f4ULL, }, + { 0x1999199919991999ULL, 0x1999199919991999ULL, }, /* 40 */ + { 0x1999199919991999ULL, 0x1999199919991999ULL, }, + { 0xeeeeeeeeeeeeeeeeULL, 0xeeeeeeeeeeeeeeeeULL, }, + { 0x4444444444444444ULL, 0x4444444444444444ULL, }, + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, + { 0x3333333333333333ULL, 0x3333333333333333ULL, }, + { 0x0b60360be0b50b60ULL, 0x360be0b50b60360bULL, }, + { 0x27d2fd27527d27d2ULL, 0xfd27527d27d2fd27ULL, }, + { 0xf1c61c71c71bf1c6ULL, 0x1c71c71bf1c61c71ULL, }, /* 48 */ + { 0xf1c71c71c71cf1c7ULL, 0x1c71c71cf1c71c71ULL, }, + { 0xc71cf1c69c71c71cULL, 0xf1c69c71c71cf1c6ULL, }, + { 0x1c71471cf1c61c71ULL, 0x471cf1c61c71471cULL, }, + { 0xd82d02d7ad82d82dULL, 0x02d7ad82d82d02d7ULL, }, + { 0x0b60360be0b50b60ULL, 0x360be0b50b60360bULL, }, + { 0xe38e38e38e38e38eULL, 0x38e38e38e38e38e3ULL, }, + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, + { 0x0e38e38d38e30e38ULL, 0xe38d38e30e38e38dULL, }, /* 56 */ + { 0x0e38e38e38e30e38ULL, 0xe38e38e30e38e38eULL, }, + { 0xe38db8e30e38e38dULL, 0xb8e30e38e38db8e3ULL, }, + { 0x38e30e38638e38e3ULL, 0x0e38638e38e30e38ULL, }, + { 0xf49ec9f41f49f49eULL, 0xc9f41f49f49ec9f4ULL, }, + { 0x27d2fd27527d27d2ULL, 0xfd27527d27d2fd27ULL, }, + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, + { 0x1c71c71c71c71c71ULL, 0xc71c71c71c71c71cULL, }, + { 0x886ae6cc28625540ULL, 0x4b670b5efe7bb00cULL, }, /* 64 */ + { 0xc214f3973afa0e24ULL, 0x2f2fe33c09dd0184ULL, }, + { 0x9a62cabbf118f060ULL, 0x399fe92ed4d3ea90ULL, }, + { 0xfc5cfe8c43491bc7ULL, 0xecacca1bd3dec956ULL, }, + { 0xc214f3973afa0e24ULL, 0x2f2fe33c09dd0184ULL, }, + { 0xfbbe00634d93c708ULL, 0x12f7bb1a153f52fcULL, }, + { 0xd40cd78603b1a944ULL, 0x1d67c10ce0353c08ULL, }, + { 0x36060b5855e2d4abULL, 0xd074a1f9df401aceULL, }, + { 0x9a62cabbf118f060ULL, 0x399fe92ed4d3ea90ULL, }, /* 72 */ + { 0xd40cd78603b1a944ULL, 0x1d67c10ce0353c08ULL, }, + { 0xac5aaeaab9cf8b80ULL, 0x27d8c6ffab2b2514ULL, }, + { 0x0e54e27b0c00b6e7ULL, 0xdae4a7ebaa3603daULL, }, + { 0xfc5cfe8c43491bc7ULL, 0xecacca1bd3dec956ULL, }, + { 0x36060b5855e2d4abULL, 0xd074a1f9df401aceULL, }, +}; + + gettimeofday(&start, NULL); + + for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) { + for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) { + do_msa_AVE_S_H(b128_pattern[i], b128_pattern[j], + b128_result[PATTERN_INPUTS_SHORT_COUNT * i + j]); + } + } + + for (i = 0; i < RANDOM_INPUTS_SHORT_COUNT; i++) { + for (j = 0; j < RANDOM_INPUTS_SHORT_COUNT; j++) { + do_msa_AVE_S_H(b128_random[i], b128_random[j], + b128_result[((PATTERN_INPUTS_SHORT_COUNT) * + (PATTERN_INPUTS_SHORT_COUNT)) + + RANDOM_INPUTS_SHORT_COUNT * i + j]); + } + } + + gettimeofday(&end, NULL); + + elapsed_time = (end.tv_sec - start.tv_sec) * 1000.0; + elapsed_time += (end.tv_usec - start.tv_usec) / 1000.0; + + ret = check_results(instruction_name, TEST_COUNT_TOTAL, elapsed_time, + &b128_result[0][0], &b128_expect[0][0]); + + return ret; +} diff --git a/tests/tcg/mips/user/ase/msa/int-average/test_msa_ave_s_w.c b/tests/tcg/mips/user/ase/msa/int-average/test_msa_ave_s_w.c new file mode 100644 index 0000000000..3220574ca0 --- /dev/null +++ b/tests/tcg/mips/user/ase/msa/int-average/test_msa_ave_s_w.c @@ -0,0 +1,151 @@ +/* + * Test program for MSA instruction AVE_S.W + * + * Copyright (C) 2018 Wave Computing, Inc. + * Copyright (C) 2018 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.h" +#include "../../../../include/test_utils.h" + +#define TEST_COUNT_TOTAL ( \ + (PATTERN_INPUTS_SHORT_COUNT) * (PATTERN_INPUTS_SHORT_COUNT) + \ + (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT)) + + +int32_t main(void) +{ + char *instruction_name = "AVE_S.W"; + int32_t ret; + uint32_t i, j; + struct timeval start, end; + double elapsed_time; + + uint64_t b128_result[TEST_COUNT_TOTAL][2]; + uint64_t b128_expect[TEST_COUNT_TOTAL][2] = { + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 0 */ + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, + { 0xd5555554d5555554ULL, 0xd5555554d5555554ULL, }, + { 0x2aaaaaaa2aaaaaaaULL, 0x2aaaaaaa2aaaaaaaULL, }, + { 0xe6666665e6666665ULL, 0xe6666665e6666665ULL, }, + { 0x1999999919999999ULL, 0x1999999919999999ULL, }, + { 0xf1c71c71c71c71c6ULL, 0x1c71c71bf1c71c71ULL, }, + { 0x0e38e38d38e38e38ULL, 0xe38e38e30e38e38dULL, }, + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 8 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0xd5555555d5555555ULL, 0xd5555555d5555555ULL, }, + { 0x2aaaaaaa2aaaaaaaULL, 0x2aaaaaaa2aaaaaaaULL, }, + { 0xe6666666e6666666ULL, 0xe6666666e6666666ULL, }, + { 0x1999999919999999ULL, 0x1999999919999999ULL, }, + { 0xf1c71c71c71c71c7ULL, 0x1c71c71cf1c71c71ULL, }, + { 0x0e38e38e38e38e38ULL, 0xe38e38e30e38e38eULL, }, + { 0xd5555554d5555554ULL, 0xd5555554d5555554ULL, }, /* 16 */ + { 0xd5555555d5555555ULL, 0xd5555555d5555555ULL, }, + { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, }, + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, + { 0xbbbbbbbbbbbbbbbbULL, 0xbbbbbbbbbbbbbbbbULL, }, + { 0xeeeeeeeeeeeeeeeeULL, 0xeeeeeeeeeeeeeeeeULL, }, + { 0xc71c71c69c71c71cULL, 0xf1c71c71c71c71c6ULL, }, + { 0xe38e38e30e38e38dULL, 0xb8e38e38e38e38e3ULL, }, + { 0x2aaaaaaa2aaaaaaaULL, 0x2aaaaaaa2aaaaaaaULL, }, /* 24 */ + { 0x2aaaaaaa2aaaaaaaULL, 0x2aaaaaaa2aaaaaaaULL, }, + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, + { 0x5555555555555555ULL, 0x5555555555555555ULL, }, + { 0x1111111011111110ULL, 0x1111111011111110ULL, }, + { 0x4444444444444444ULL, 0x4444444444444444ULL, }, + { 0x1c71c71cf1c71c71ULL, 0x471c71c61c71c71cULL, }, + { 0x38e38e38638e38e3ULL, 0x0e38e38e38e38e38ULL, }, + { 0xe6666665e6666665ULL, 0xe6666665e6666665ULL, }, /* 32 */ + { 0xe6666666e6666666ULL, 0xe6666666e6666666ULL, }, + { 0xbbbbbbbbbbbbbbbbULL, 0xbbbbbbbbbbbbbbbbULL, }, + { 0x1111111011111110ULL, 0x1111111011111110ULL, }, + { 0xccccccccccccccccULL, 0xccccccccccccccccULL, }, + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, + { 0xd82d82d7ad82d82dULL, 0x02d82d82d82d82d7ULL, }, + { 0xf49f49f41f49f49eULL, 0xc9f49f49f49f49f4ULL, }, + { 0x1999999919999999ULL, 0x1999999919999999ULL, }, /* 40 */ + { 0x1999999919999999ULL, 0x1999999919999999ULL, }, + { 0xeeeeeeeeeeeeeeeeULL, 0xeeeeeeeeeeeeeeeeULL, }, + { 0x4444444444444444ULL, 0x4444444444444444ULL, }, + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, + { 0x3333333333333333ULL, 0x3333333333333333ULL, }, + { 0x0b60b60be0b60b60ULL, 0x360b60b50b60b60bULL, }, + { 0x27d27d27527d27d2ULL, 0xfd27d27d27d27d27ULL, }, + { 0xf1c71c71c71c71c6ULL, 0x1c71c71bf1c71c71ULL, }, /* 48 */ + { 0xf1c71c71c71c71c7ULL, 0x1c71c71cf1c71c71ULL, }, + { 0xc71c71c69c71c71cULL, 0xf1c71c71c71c71c6ULL, }, + { 0x1c71c71cf1c71c71ULL, 0x471c71c61c71c71cULL, }, + { 0xd82d82d7ad82d82dULL, 0x02d82d82d82d82d7ULL, }, + { 0x0b60b60be0b60b60ULL, 0x360b60b50b60b60bULL, }, + { 0xe38e38e38e38e38eULL, 0x38e38e38e38e38e3ULL, }, + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, + { 0x0e38e38d38e38e38ULL, 0xe38e38e30e38e38dULL, }, /* 56 */ + { 0x0e38e38e38e38e38ULL, 0xe38e38e30e38e38eULL, }, + { 0xe38e38e30e38e38dULL, 0xb8e38e38e38e38e3ULL, }, + { 0x38e38e38638e38e3ULL, 0x0e38e38e38e38e38ULL, }, + { 0xf49f49f41f49f49eULL, 0xc9f49f49f49f49f4ULL, }, + { 0x27d27d27527d27d2ULL, 0xfd27d27d27d27d27ULL, }, + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, + { 0x1c71c71c71c71c71ULL, 0xc71c71c71c71c71cULL, }, + { 0x886ae6cc28625540ULL, 0x4b670b5efe7bb00cULL, }, /* 64 */ + { 0xc21473973afb0e24ULL, 0x2f2f633c09dd8184ULL, }, + { 0x9a62cabbf118f060ULL, 0x399fe92ed4d36a90ULL, }, + { 0xfc5cfe8c434a1bc7ULL, 0xecac4a1bd3df4956ULL, }, + { 0xc21473973afb0e24ULL, 0x2f2f633c09dd8184ULL, }, + { 0xfbbe00634d93c708ULL, 0x12f7bb1a153f52fcULL, }, + { 0xd40c578603b1a944ULL, 0x1d68410ce0353c08ULL, }, + { 0x36068b5855e2d4abULL, 0xd074a1f9df411aceULL, }, + { 0x9a62cabbf118f060ULL, 0x399fe92ed4d36a90ULL, }, /* 72 */ + { 0xd40c578603b1a944ULL, 0x1d68410ce0353c08ULL, }, + { 0xac5aaeaab9cf8b80ULL, 0x27d8c6ffab2b2514ULL, }, + { 0x0e54e27b0c00b6e7ULL, 0xdae527ebaa3703daULL, }, + { 0xfc5cfe8c434a1bc7ULL, 0xecac4a1bd3df4956ULL, }, + { 0x36068b5855e2d4abULL, 0xd074a1f9df411aceULL, }, +}; + + gettimeofday(&start, NULL); + + for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) { + for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) { + do_msa_AVE_S_W(b128_pattern[i], b128_pattern[j], + b128_result[PATTERN_INPUTS_SHORT_COUNT * i + j]); + } + } + + for (i = 0; i < RANDOM_INPUTS_SHORT_COUNT; i++) { + for (j = 0; j < RANDOM_INPUTS_SHORT_COUNT; j++) { + do_msa_AVE_S_W(b128_random[i], b128_random[j], + b128_result[((PATTERN_INPUTS_SHORT_COUNT) * + (PATTERN_INPUTS_SHORT_COUNT)) + + RANDOM_INPUTS_SHORT_COUNT * i + j]); + } + } + + gettimeofday(&end, NULL); + + elapsed_time = (end.tv_sec - start.tv_sec) * 1000.0; + elapsed_time += (end.tv_usec - start.tv_usec) / 1000.0; + + ret = check_results(instruction_name, TEST_COUNT_TOTAL, elapsed_time, + &b128_result[0][0], &b128_expect[0][0]); + + return ret; +} diff --git a/tests/tcg/mips/user/ase/msa/int-average/test_msa_ave_u_b.c b/tests/tcg/mips/user/ase/msa/int-average/test_msa_ave_u_b.c new file mode 100644 index 0000000000..c3f96a6a5f --- /dev/null +++ b/tests/tcg/mips/user/ase/msa/int-average/test_msa_ave_u_b.c @@ -0,0 +1,151 @@ +/* + * Test program for MSA instruction AVE_U.B + * + * Copyright (C) 2018 Wave Computing, Inc. + * Copyright (C) 2018 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.h" +#include "../../../../include/test_utils.h" + +#define TEST_COUNT_TOTAL ( \ + (PATTERN_INPUTS_SHORT_COUNT) * (PATTERN_INPUTS_SHORT_COUNT) + \ + (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT)) + + +int32_t main(void) +{ + char *instruction_name = "AVE_U.B"; + int32_t ret; + uint32_t i, j; + struct timeval start, end; + double elapsed_time; + + uint64_t b128_result[TEST_COUNT_TOTAL][2]; + uint64_t b128_expect[TEST_COUNT_TOTAL][2] = { + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 0 */ + { 0x7f7f7f7f7f7f7f7fULL, 0x7f7f7f7f7f7f7f7fULL, }, + { 0xd4d4d4d4d4d4d4d4ULL, 0xd4d4d4d4d4d4d4d4ULL, }, + { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, }, + { 0xe5e5e5e5e5e5e5e5ULL, 0xe5e5e5e5e5e5e5e5ULL, }, + { 0x9999999999999999ULL, 0x9999999999999999ULL, }, + { 0xf1c69bf1c69bf1c6ULL, 0x9bf1c69bf1c69bf1ULL, }, + { 0x8db8e38db8e38db8ULL, 0xe38db8e38db8e38dULL, }, + { 0x7f7f7f7f7f7f7f7fULL, 0x7f7f7f7f7f7f7f7fULL, }, /* 8 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x5555555555555555ULL, 0x5555555555555555ULL, }, + { 0x2a2a2a2a2a2a2a2aULL, 0x2a2a2a2a2a2a2a2aULL, }, + { 0x6666666666666666ULL, 0x6666666666666666ULL, }, + { 0x1919191919191919ULL, 0x1919191919191919ULL, }, + { 0x71471c71471c7147ULL, 0x1c71471c71471c71ULL, }, + { 0x0e38630e38630e38ULL, 0x630e38630e38630eULL, }, + { 0xd4d4d4d4d4d4d4d4ULL, 0xd4d4d4d4d4d4d4d4ULL, }, /* 16 */ + { 0x5555555555555555ULL, 0x5555555555555555ULL, }, + { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, }, + { 0x7f7f7f7f7f7f7f7fULL, 0x7f7f7f7f7f7f7f7fULL, }, + { 0xbbbbbbbbbbbbbbbbULL, 0xbbbbbbbbbbbbbbbbULL, }, + { 0x6e6e6e6e6e6e6e6eULL, 0x6e6e6e6e6e6e6e6eULL, }, + { 0xc69c71c69c71c69cULL, 0x71c69c71c69c71c6ULL, }, + { 0x638db8638db8638dULL, 0xb8638db8638db863ULL, }, + { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, }, /* 24 */ + { 0x2a2a2a2a2a2a2a2aULL, 0x2a2a2a2a2a2a2a2aULL, }, + { 0x7f7f7f7f7f7f7f7fULL, 0x7f7f7f7f7f7f7f7fULL, }, + { 0x5555555555555555ULL, 0x5555555555555555ULL, }, + { 0x9090909090909090ULL, 0x9090909090909090ULL, }, + { 0x4444444444444444ULL, 0x4444444444444444ULL, }, + { 0x9c71469c71469c71ULL, 0x469c71469c71469cULL, }, + { 0x38638e38638e3863ULL, 0x8e38638e38638e38ULL, }, + { 0xe5e5e5e5e5e5e5e5ULL, 0xe5e5e5e5e5e5e5e5ULL, }, /* 32 */ + { 0x6666666666666666ULL, 0x6666666666666666ULL, }, + { 0xbbbbbbbbbbbbbbbbULL, 0xbbbbbbbbbbbbbbbbULL, }, + { 0x9090909090909090ULL, 0x9090909090909090ULL, }, + { 0xccccccccccccccccULL, 0xccccccccccccccccULL, }, + { 0x7f7f7f7f7f7f7f7fULL, 0x7f7f7f7f7f7f7f7fULL, }, + { 0xd7ad82d7ad82d7adULL, 0x82d7ad82d7ad82d7ULL, }, + { 0x749ec9749ec9749eULL, 0xc9749ec9749ec974ULL, }, + { 0x9999999999999999ULL, 0x9999999999999999ULL, }, /* 40 */ + { 0x1919191919191919ULL, 0x1919191919191919ULL, }, + { 0x6e6e6e6e6e6e6e6eULL, 0x6e6e6e6e6e6e6e6eULL, }, + { 0x4444444444444444ULL, 0x4444444444444444ULL, }, + { 0x7f7f7f7f7f7f7f7fULL, 0x7f7f7f7f7f7f7f7fULL, }, + { 0x3333333333333333ULL, 0x3333333333333333ULL, }, + { 0x8b60358b60358b60ULL, 0x358b60358b60358bULL, }, + { 0x27527d27527d2752ULL, 0x7d27527d27527d27ULL, }, + { 0xf1c69bf1c69bf1c6ULL, 0x9bf1c69bf1c69bf1ULL, }, /* 48 */ + { 0x71471c71471c7147ULL, 0x1c71471c71471c71ULL, }, + { 0xc69c71c69c71c69cULL, 0x71c69c71c69c71c6ULL, }, + { 0x9c71469c71469c71ULL, 0x469c71469c71469cULL, }, + { 0xd7ad82d7ad82d7adULL, 0x82d7ad82d7ad82d7ULL, }, + { 0x8b60358b60358b60ULL, 0x358b60358b60358bULL, }, + { 0xe38e38e38e38e38eULL, 0x38e38e38e38e38e3ULL, }, + { 0x7f7f7f7f7f7f7f7fULL, 0x7f7f7f7f7f7f7f7fULL, }, + { 0x8db8e38db8e38db8ULL, 0xe38db8e38db8e38dULL, }, /* 56 */ + { 0x0e38630e38630e38ULL, 0x630e38630e38630eULL, }, + { 0x638db8638db8638dULL, 0xb8638db8638db863ULL, }, + { 0x38638e38638e3863ULL, 0x8e38638e38638e38ULL, }, + { 0x749ec9749ec9749eULL, 0xc9749ec9749ec974ULL, }, + { 0x27527d27527d2752ULL, 0x7d27527d27527d27ULL, }, + { 0x7f7f7f7f7f7f7f7fULL, 0x7f7f7f7f7f7f7f7fULL, }, + { 0x1c71c71c71c71c71ULL, 0xc71c71c71c71c71cULL, }, + { 0x886ae6cc28625540ULL, 0x4b670b5efe7bb00cULL, }, /* 64 */ + { 0xc19473973a7a8e24ULL, 0x2eaf633c895d8184ULL, }, + { 0x9a62cabb70987060ULL, 0x399f68aed4536a10ULL, }, + { 0x7c5c7e8c43499b47ULL, 0x6cac499bd35ec956ULL, }, + { 0xc19473973a7a8e24ULL, 0x2eaf633c895d8184ULL, }, + { 0xfbbe00634d93c708ULL, 0x12f7bb1a153f52fcULL, }, + { 0xd38c578683b1a944ULL, 0x1ce7c08c60353b88ULL, }, + { 0xb5860b585562d42bULL, 0x4ff4a1795f409aceULL, }, + { 0x9a62cabb70987060ULL, 0x399f68aed4536a10ULL, }, /* 72 */ + { 0xd38c578683b1a944ULL, 0x1ce7c08c60353b88ULL, }, + { 0xac5aaeaab9cf8b80ULL, 0x27d8c6ffab2b2514ULL, }, + { 0x8e54627b8b80b667ULL, 0x5ae4a7ebaa36835aULL, }, + { 0x7c5c7e8c43499b47ULL, 0x6cac499bd35ec956ULL, }, + { 0xb5860b585562d42bULL, 0x4ff4a1795f409aceULL, }, +}; + + gettimeofday(&start, NULL); + + for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) { + for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) { + do_msa_AVE_U_B(b128_pattern[i], b128_pattern[j], + b128_result[PATTERN_INPUTS_SHORT_COUNT * i + j]); + } + } + + for (i = 0; i < RANDOM_INPUTS_SHORT_COUNT; i++) { + for (j = 0; j < RANDOM_INPUTS_SHORT_COUNT; j++) { + do_msa_AVE_U_B(b128_random[i], b128_random[j], + b128_result[((PATTERN_INPUTS_SHORT_COUNT) * + (PATTERN_INPUTS_SHORT_COUNT)) + + RANDOM_INPUTS_SHORT_COUNT * i + j]); + } + } + + gettimeofday(&end, NULL); + + elapsed_time = (end.tv_sec - start.tv_sec) * 1000.0; + elapsed_time += (end.tv_usec - start.tv_usec) / 1000.0; + + ret = check_results(instruction_name, TEST_COUNT_TOTAL, elapsed_time, + &b128_result[0][0], &b128_expect[0][0]); + + return ret; +} diff --git a/tests/tcg/mips/user/ase/msa/int-average/test_msa_ave_u_d.c b/tests/tcg/mips/user/ase/msa/int-average/test_msa_ave_u_d.c new file mode 100644 index 0000000000..3a78629cd8 --- /dev/null +++ b/tests/tcg/mips/user/ase/msa/int-average/test_msa_ave_u_d.c @@ -0,0 +1,151 @@ +/* + * Test program for MSA instruction AVE_U.D + * + * Copyright (C) 2018 Wave Computing, Inc. + * Copyright (C) 2018 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.h" +#include "../../../../include/test_utils.h" + +#define TEST_COUNT_TOTAL ( \ + (PATTERN_INPUTS_SHORT_COUNT) * (PATTERN_INPUTS_SHORT_COUNT) + \ + (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT)) + + +int32_t main(void) +{ + char *instruction_name = "AVE_U.D"; + int32_t ret; + uint32_t i, j; + struct timeval start, end; + double elapsed_time; + + uint64_t b128_result[TEST_COUNT_TOTAL][2]; + uint64_t b128_expect[TEST_COUNT_TOTAL][2] = { + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 0 */ + { 0x7fffffffffffffffULL, 0x7fffffffffffffffULL, }, + { 0xd555555555555554ULL, 0xd555555555555554ULL, }, + { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, }, + { 0xe666666666666665ULL, 0xe666666666666665ULL, }, + { 0x9999999999999999ULL, 0x9999999999999999ULL, }, + { 0xf1c71c71c71c71c6ULL, 0x9c71c71c71c71c71ULL, }, + { 0x8e38e38e38e38e38ULL, 0xe38e38e38e38e38dULL, }, + { 0x7fffffffffffffffULL, 0x7fffffffffffffffULL, }, /* 8 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x5555555555555555ULL, 0x5555555555555555ULL, }, + { 0x2aaaaaaaaaaaaaaaULL, 0x2aaaaaaaaaaaaaaaULL, }, + { 0x6666666666666666ULL, 0x6666666666666666ULL, }, + { 0x1999999999999999ULL, 0x1999999999999999ULL, }, + { 0x71c71c71c71c71c7ULL, 0x1c71c71c71c71c71ULL, }, + { 0x0e38e38e38e38e38ULL, 0x638e38e38e38e38eULL, }, + { 0xd555555555555554ULL, 0xd555555555555554ULL, }, /* 16 */ + { 0x5555555555555555ULL, 0x5555555555555555ULL, }, + { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, }, + { 0x7fffffffffffffffULL, 0x7fffffffffffffffULL, }, + { 0xbbbbbbbbbbbbbbbbULL, 0xbbbbbbbbbbbbbbbbULL, }, + { 0x6eeeeeeeeeeeeeeeULL, 0x6eeeeeeeeeeeeeeeULL, }, + { 0xc71c71c71c71c71cULL, 0x71c71c71c71c71c6ULL, }, + { 0x638e38e38e38e38dULL, 0xb8e38e38e38e38e3ULL, }, + { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, }, /* 24 */ + { 0x2aaaaaaaaaaaaaaaULL, 0x2aaaaaaaaaaaaaaaULL, }, + { 0x7fffffffffffffffULL, 0x7fffffffffffffffULL, }, + { 0x5555555555555555ULL, 0x5555555555555555ULL, }, + { 0x9111111111111110ULL, 0x9111111111111110ULL, }, + { 0x4444444444444444ULL, 0x4444444444444444ULL, }, + { 0x9c71c71c71c71c71ULL, 0x471c71c71c71c71cULL, }, + { 0x38e38e38e38e38e3ULL, 0x8e38e38e38e38e38ULL, }, + { 0xe666666666666665ULL, 0xe666666666666665ULL, }, /* 32 */ + { 0x6666666666666666ULL, 0x6666666666666666ULL, }, + { 0xbbbbbbbbbbbbbbbbULL, 0xbbbbbbbbbbbbbbbbULL, }, + { 0x9111111111111110ULL, 0x9111111111111110ULL, }, + { 0xccccccccccccccccULL, 0xccccccccccccccccULL, }, + { 0x7fffffffffffffffULL, 0x7fffffffffffffffULL, }, + { 0xd82d82d82d82d82dULL, 0x82d82d82d82d82d7ULL, }, + { 0x749f49f49f49f49eULL, 0xc9f49f49f49f49f4ULL, }, + { 0x9999999999999999ULL, 0x9999999999999999ULL, }, /* 40 */ + { 0x1999999999999999ULL, 0x1999999999999999ULL, }, + { 0x6eeeeeeeeeeeeeeeULL, 0x6eeeeeeeeeeeeeeeULL, }, + { 0x4444444444444444ULL, 0x4444444444444444ULL, }, + { 0x7fffffffffffffffULL, 0x7fffffffffffffffULL, }, + { 0x3333333333333333ULL, 0x3333333333333333ULL, }, + { 0x8b60b60b60b60b60ULL, 0x360b60b60b60b60bULL, }, + { 0x27d27d27d27d27d2ULL, 0x7d27d27d27d27d27ULL, }, + { 0xf1c71c71c71c71c6ULL, 0x9c71c71c71c71c71ULL, }, /* 48 */ + { 0x71c71c71c71c71c7ULL, 0x1c71c71c71c71c71ULL, }, + { 0xc71c71c71c71c71cULL, 0x71c71c71c71c71c6ULL, }, + { 0x9c71c71c71c71c71ULL, 0x471c71c71c71c71cULL, }, + { 0xd82d82d82d82d82dULL, 0x82d82d82d82d82d7ULL, }, + { 0x8b60b60b60b60b60ULL, 0x360b60b60b60b60bULL, }, + { 0xe38e38e38e38e38eULL, 0x38e38e38e38e38e3ULL, }, + { 0x7fffffffffffffffULL, 0x7fffffffffffffffULL, }, + { 0x8e38e38e38e38e38ULL, 0xe38e38e38e38e38dULL, }, /* 56 */ + { 0x0e38e38e38e38e38ULL, 0x638e38e38e38e38eULL, }, + { 0x638e38e38e38e38dULL, 0xb8e38e38e38e38e3ULL, }, + { 0x38e38e38e38e38e3ULL, 0x8e38e38e38e38e38ULL, }, + { 0x749f49f49f49f49eULL, 0xc9f49f49f49f49f4ULL, }, + { 0x27d27d27d27d27d2ULL, 0x7d27d27d27d27d27ULL, }, + { 0x7fffffffffffffffULL, 0x7fffffffffffffffULL, }, + { 0x1c71c71c71c71c71ULL, 0xc71c71c71c71c71cULL, }, + { 0x886ae6cc28625540ULL, 0x4b670b5efe7bb00cULL, }, /* 64 */ + { 0xc2147397bafb0e24ULL, 0x2f2f633c89dd8184ULL, }, + { 0x9a62cabb7118f060ULL, 0x399fe92f54d36a90ULL, }, + { 0x7c5cfe8cc34a1bc7ULL, 0x6cac4a1bd3df4956ULL, }, + { 0xc2147397bafb0e24ULL, 0x2f2f633c89dd8184ULL, }, + { 0xfbbe00634d93c708ULL, 0x12f7bb1a153f52fcULL, }, + { 0xd40c578703b1a944ULL, 0x1d68410ce0353c08ULL, }, + { 0xb6068b5855e2d4abULL, 0x5074a1f95f411aceULL, }, + { 0x9a62cabb7118f060ULL, 0x399fe92f54d36a90ULL, }, /* 72 */ + { 0xd40c578703b1a944ULL, 0x1d68410ce0353c08ULL, }, + { 0xac5aaeaab9cf8b80ULL, 0x27d8c6ffab2b2514ULL, }, + { 0x8e54e27c0c00b6e7ULL, 0x5ae527ec2a3703daULL, }, + { 0x7c5cfe8cc34a1bc7ULL, 0x6cac4a1bd3df4956ULL, }, + { 0xb6068b5855e2d4abULL, 0x5074a1f95f411aceULL, }, +}; + + gettimeofday(&start, NULL); + + for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) { + for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) { + do_msa_AVE_U_D(b128_pattern[i], b128_pattern[j], + b128_result[PATTERN_INPUTS_SHORT_COUNT * i + j]); + } + } + + for (i = 0; i < RANDOM_INPUTS_SHORT_COUNT; i++) { + for (j = 0; j < RANDOM_INPUTS_SHORT_COUNT; j++) { + do_msa_AVE_U_D(b128_random[i], b128_random[j], + b128_result[((PATTERN_INPUTS_SHORT_COUNT) * + (PATTERN_INPUTS_SHORT_COUNT)) + + RANDOM_INPUTS_SHORT_COUNT * i + j]); + } + } + + gettimeofday(&end, NULL); + + elapsed_time = (end.tv_sec - start.tv_sec) * 1000.0; + elapsed_time += (end.tv_usec - start.tv_usec) / 1000.0; + + ret = check_results(instruction_name, TEST_COUNT_TOTAL, elapsed_time, + &b128_result[0][0], &b128_expect[0][0]); + + return ret; +} diff --git a/tests/tcg/mips/user/ase/msa/int-average/test_msa_ave_u_h.c b/tests/tcg/mips/user/ase/msa/int-average/test_msa_ave_u_h.c new file mode 100644 index 0000000000..b7db518afb --- /dev/null +++ b/tests/tcg/mips/user/ase/msa/int-average/test_msa_ave_u_h.c @@ -0,0 +1,151 @@ +/* + * Test program for MSA instruction AVE_U.H + * + * Copyright (C) 2018 Wave Computing, Inc. + * Copyright (C) 2018 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.h" +#include "../../../../include/test_utils.h" + +#define TEST_COUNT_TOTAL ( \ + (PATTERN_INPUTS_SHORT_COUNT) * (PATTERN_INPUTS_SHORT_COUNT) + \ + (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT)) + + +int32_t main(void) +{ + char *instruction_name = "AVE_U.H"; + int32_t ret; + uint32_t i, j; + struct timeval start, end; + double elapsed_time; + + uint64_t b128_result[TEST_COUNT_TOTAL][2]; + uint64_t b128_expect[TEST_COUNT_TOTAL][2] = { + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 0 */ + { 0x7fff7fff7fff7fffULL, 0x7fff7fff7fff7fffULL, }, + { 0xd554d554d554d554ULL, 0xd554d554d554d554ULL, }, + { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, }, + { 0xe665e665e665e665ULL, 0xe665e665e665e665ULL, }, + { 0x9999999999999999ULL, 0x9999999999999999ULL, }, + { 0xf1c69c71c71bf1c6ULL, 0x9c71c71bf1c69c71ULL, }, + { 0x8e38e38db8e38e38ULL, 0xe38db8e38e38e38dULL, }, + { 0x7fff7fff7fff7fffULL, 0x7fff7fff7fff7fffULL, }, /* 8 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x5555555555555555ULL, 0x5555555555555555ULL, }, + { 0x2aaa2aaa2aaa2aaaULL, 0x2aaa2aaa2aaa2aaaULL, }, + { 0x6666666666666666ULL, 0x6666666666666666ULL, }, + { 0x1999199919991999ULL, 0x1999199919991999ULL, }, + { 0x71c71c71471c71c7ULL, 0x1c71471c71c71c71ULL, }, + { 0x0e38638e38e30e38ULL, 0x638e38e30e38638eULL, }, + { 0xd554d554d554d554ULL, 0xd554d554d554d554ULL, }, /* 16 */ + { 0x5555555555555555ULL, 0x5555555555555555ULL, }, + { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, }, + { 0x7fff7fff7fff7fffULL, 0x7fff7fff7fff7fffULL, }, + { 0xbbbbbbbbbbbbbbbbULL, 0xbbbbbbbbbbbbbbbbULL, }, + { 0x6eee6eee6eee6eeeULL, 0x6eee6eee6eee6eeeULL, }, + { 0xc71c71c69c71c71cULL, 0x71c69c71c71c71c6ULL, }, + { 0x638db8e38e38638dULL, 0xb8e38e38638db8e3ULL, }, + { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, }, /* 24 */ + { 0x2aaa2aaa2aaa2aaaULL, 0x2aaa2aaa2aaa2aaaULL, }, + { 0x7fff7fff7fff7fffULL, 0x7fff7fff7fff7fffULL, }, + { 0x5555555555555555ULL, 0x5555555555555555ULL, }, + { 0x9110911091109110ULL, 0x9110911091109110ULL, }, + { 0x4444444444444444ULL, 0x4444444444444444ULL, }, + { 0x9c71471c71c69c71ULL, 0x471c71c69c71471cULL, }, + { 0x38e38e38638e38e3ULL, 0x8e38638e38e38e38ULL, }, + { 0xe665e665e665e665ULL, 0xe665e665e665e665ULL, }, /* 32 */ + { 0x6666666666666666ULL, 0x6666666666666666ULL, }, + { 0xbbbbbbbbbbbbbbbbULL, 0xbbbbbbbbbbbbbbbbULL, }, + { 0x9110911091109110ULL, 0x9110911091109110ULL, }, + { 0xccccccccccccccccULL, 0xccccccccccccccccULL, }, + { 0x7fff7fff7fff7fffULL, 0x7fff7fff7fff7fffULL, }, + { 0xd82d82d7ad82d82dULL, 0x82d7ad82d82d82d7ULL, }, + { 0x749ec9f49f49749eULL, 0xc9f49f49749ec9f4ULL, }, + { 0x9999999999999999ULL, 0x9999999999999999ULL, }, /* 40 */ + { 0x1999199919991999ULL, 0x1999199919991999ULL, }, + { 0x6eee6eee6eee6eeeULL, 0x6eee6eee6eee6eeeULL, }, + { 0x4444444444444444ULL, 0x4444444444444444ULL, }, + { 0x7fff7fff7fff7fffULL, 0x7fff7fff7fff7fffULL, }, + { 0x3333333333333333ULL, 0x3333333333333333ULL, }, + { 0x8b60360b60b58b60ULL, 0x360b60b58b60360bULL, }, + { 0x27d27d27527d27d2ULL, 0x7d27527d27d27d27ULL, }, + { 0xf1c69c71c71bf1c6ULL, 0x9c71c71bf1c69c71ULL, }, /* 48 */ + { 0x71c71c71471c71c7ULL, 0x1c71471c71c71c71ULL, }, + { 0xc71c71c69c71c71cULL, 0x71c69c71c71c71c6ULL, }, + { 0x9c71471c71c69c71ULL, 0x471c71c69c71471cULL, }, + { 0xd82d82d7ad82d82dULL, 0x82d7ad82d82d82d7ULL, }, + { 0x8b60360b60b58b60ULL, 0x360b60b58b60360bULL, }, + { 0xe38e38e38e38e38eULL, 0x38e38e38e38e38e3ULL, }, + { 0x7fff7fff7fff7fffULL, 0x7fff7fff7fff7fffULL, }, + { 0x8e38e38db8e38e38ULL, 0xe38db8e38e38e38dULL, }, /* 56 */ + { 0x0e38638e38e30e38ULL, 0x638e38e30e38638eULL, }, + { 0x638db8e38e38638dULL, 0xb8e38e38638db8e3ULL, }, + { 0x38e38e38638e38e3ULL, 0x8e38638e38e38e38ULL, }, + { 0x749ec9f49f49749eULL, 0xc9f49f49749ec9f4ULL, }, + { 0x27d27d27527d27d2ULL, 0x7d27527d27d27d27ULL, }, + { 0x7fff7fff7fff7fffULL, 0x7fff7fff7fff7fffULL, }, + { 0x1c71c71c71c71c71ULL, 0xc71c71c71c71c71cULL, }, + { 0x886ae6cc28625540ULL, 0x4b670b5efe7bb00cULL, }, /* 64 */ + { 0xc21473973afa8e24ULL, 0x2f2f633c89dd8184ULL, }, + { 0x9a62cabb71187060ULL, 0x399f692ed4d36a90ULL, }, + { 0x7c5c7e8c43499bc7ULL, 0x6cac4a1bd3dec956ULL, }, + { 0xc21473973afa8e24ULL, 0x2f2f633c89dd8184ULL, }, + { 0xfbbe00634d93c708ULL, 0x12f7bb1a153f52fcULL, }, + { 0xd40c578683b1a944ULL, 0x1d67c10c60353c08ULL, }, + { 0xb6060b5855e2d4abULL, 0x5074a1f95f409aceULL, }, + { 0x9a62cabb71187060ULL, 0x399f692ed4d36a90ULL, }, /* 72 */ + { 0xd40c578683b1a944ULL, 0x1d67c10c60353c08ULL, }, + { 0xac5aaeaab9cf8b80ULL, 0x27d8c6ffab2b2514ULL, }, + { 0x8e54627b8c00b6e7ULL, 0x5ae4a7ebaa3683daULL, }, + { 0x7c5c7e8c43499bc7ULL, 0x6cac4a1bd3dec956ULL, }, + { 0xb6060b5855e2d4abULL, 0x5074a1f95f409aceULL, }, +}; + + gettimeofday(&start, NULL); + + for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) { + for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) { + do_msa_AVE_U_H(b128_pattern[i], b128_pattern[j], + b128_result[PATTERN_INPUTS_SHORT_COUNT * i + j]); + } + } + + for (i = 0; i < RANDOM_INPUTS_SHORT_COUNT; i++) { + for (j = 0; j < RANDOM_INPUTS_SHORT_COUNT; j++) { + do_msa_AVE_U_H(b128_random[i], b128_random[j], + b128_result[((PATTERN_INPUTS_SHORT_COUNT) * + (PATTERN_INPUTS_SHORT_COUNT)) + + RANDOM_INPUTS_SHORT_COUNT * i + j]); + } + } + + gettimeofday(&end, NULL); + + elapsed_time = (end.tv_sec - start.tv_sec) * 1000.0; + elapsed_time += (end.tv_usec - start.tv_usec) / 1000.0; + + ret = check_results(instruction_name, TEST_COUNT_TOTAL, elapsed_time, + &b128_result[0][0], &b128_expect[0][0]); + + return ret; +} diff --git a/tests/tcg/mips/user/ase/msa/int-average/test_msa_ave_u_w.c b/tests/tcg/mips/user/ase/msa/int-average/test_msa_ave_u_w.c new file mode 100644 index 0000000000..75e2409f1f --- /dev/null +++ b/tests/tcg/mips/user/ase/msa/int-average/test_msa_ave_u_w.c @@ -0,0 +1,151 @@ +/* + * Test program for MSA instruction AVE_U.W + * + * Copyright (C) 2018 Wave Computing, Inc. + * Copyright (C) 2018 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.h" +#include "../../../../include/test_utils.h" + +#define TEST_COUNT_TOTAL ( \ + (PATTERN_INPUTS_SHORT_COUNT) * (PATTERN_INPUTS_SHORT_COUNT) + \ + (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT)) + + +int32_t main(void) +{ + char *instruction_name = "AVE_U.W"; + int32_t ret; + uint32_t i, j; + struct timeval start, end; + double elapsed_time; + + uint64_t b128_result[TEST_COUNT_TOTAL][2]; + uint64_t b128_expect[TEST_COUNT_TOTAL][2] = { + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 0 */ + { 0x7fffffff7fffffffULL, 0x7fffffff7fffffffULL, }, + { 0xd5555554d5555554ULL, 0xd5555554d5555554ULL, }, + { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, }, + { 0xe6666665e6666665ULL, 0xe6666665e6666665ULL, }, + { 0x9999999999999999ULL, 0x9999999999999999ULL, }, + { 0xf1c71c71c71c71c6ULL, 0x9c71c71bf1c71c71ULL, }, + { 0x8e38e38db8e38e38ULL, 0xe38e38e38e38e38dULL, }, + { 0x7fffffff7fffffffULL, 0x7fffffff7fffffffULL, }, /* 8 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x5555555555555555ULL, 0x5555555555555555ULL, }, + { 0x2aaaaaaa2aaaaaaaULL, 0x2aaaaaaa2aaaaaaaULL, }, + { 0x6666666666666666ULL, 0x6666666666666666ULL, }, + { 0x1999999919999999ULL, 0x1999999919999999ULL, }, + { 0x71c71c71471c71c7ULL, 0x1c71c71c71c71c71ULL, }, + { 0x0e38e38e38e38e38ULL, 0x638e38e30e38e38eULL, }, + { 0xd5555554d5555554ULL, 0xd5555554d5555554ULL, }, /* 16 */ + { 0x5555555555555555ULL, 0x5555555555555555ULL, }, + { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, }, + { 0x7fffffff7fffffffULL, 0x7fffffff7fffffffULL, }, + { 0xbbbbbbbbbbbbbbbbULL, 0xbbbbbbbbbbbbbbbbULL, }, + { 0x6eeeeeee6eeeeeeeULL, 0x6eeeeeee6eeeeeeeULL, }, + { 0xc71c71c69c71c71cULL, 0x71c71c71c71c71c6ULL, }, + { 0x638e38e38e38e38dULL, 0xb8e38e38638e38e3ULL, }, + { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, }, /* 24 */ + { 0x2aaaaaaa2aaaaaaaULL, 0x2aaaaaaa2aaaaaaaULL, }, + { 0x7fffffff7fffffffULL, 0x7fffffff7fffffffULL, }, + { 0x5555555555555555ULL, 0x5555555555555555ULL, }, + { 0x9111111091111110ULL, 0x9111111091111110ULL, }, + { 0x4444444444444444ULL, 0x4444444444444444ULL, }, + { 0x9c71c71c71c71c71ULL, 0x471c71c69c71c71cULL, }, + { 0x38e38e38638e38e3ULL, 0x8e38e38e38e38e38ULL, }, + { 0xe6666665e6666665ULL, 0xe6666665e6666665ULL, }, /* 32 */ + { 0x6666666666666666ULL, 0x6666666666666666ULL, }, + { 0xbbbbbbbbbbbbbbbbULL, 0xbbbbbbbbbbbbbbbbULL, }, + { 0x9111111091111110ULL, 0x9111111091111110ULL, }, + { 0xccccccccccccccccULL, 0xccccccccccccccccULL, }, + { 0x7fffffff7fffffffULL, 0x7fffffff7fffffffULL, }, + { 0xd82d82d7ad82d82dULL, 0x82d82d82d82d82d7ULL, }, + { 0x749f49f49f49f49eULL, 0xc9f49f49749f49f4ULL, }, + { 0x9999999999999999ULL, 0x9999999999999999ULL, }, /* 40 */ + { 0x1999999919999999ULL, 0x1999999919999999ULL, }, + { 0x6eeeeeee6eeeeeeeULL, 0x6eeeeeee6eeeeeeeULL, }, + { 0x4444444444444444ULL, 0x4444444444444444ULL, }, + { 0x7fffffff7fffffffULL, 0x7fffffff7fffffffULL, }, + { 0x3333333333333333ULL, 0x3333333333333333ULL, }, + { 0x8b60b60b60b60b60ULL, 0x360b60b58b60b60bULL, }, + { 0x27d27d27527d27d2ULL, 0x7d27d27d27d27d27ULL, }, + { 0xf1c71c71c71c71c6ULL, 0x9c71c71bf1c71c71ULL, }, /* 48 */ + { 0x71c71c71471c71c7ULL, 0x1c71c71c71c71c71ULL, }, + { 0xc71c71c69c71c71cULL, 0x71c71c71c71c71c6ULL, }, + { 0x9c71c71c71c71c71ULL, 0x471c71c69c71c71cULL, }, + { 0xd82d82d7ad82d82dULL, 0x82d82d82d82d82d7ULL, }, + { 0x8b60b60b60b60b60ULL, 0x360b60b58b60b60bULL, }, + { 0xe38e38e38e38e38eULL, 0x38e38e38e38e38e3ULL, }, + { 0x7fffffff7fffffffULL, 0x7fffffff7fffffffULL, }, + { 0x8e38e38db8e38e38ULL, 0xe38e38e38e38e38dULL, }, /* 56 */ + { 0x0e38e38e38e38e38ULL, 0x638e38e30e38e38eULL, }, + { 0x638e38e38e38e38dULL, 0xb8e38e38638e38e3ULL, }, + { 0x38e38e38638e38e3ULL, 0x8e38e38e38e38e38ULL, }, + { 0x749f49f49f49f49eULL, 0xc9f49f49749f49f4ULL, }, + { 0x27d27d27527d27d2ULL, 0x7d27d27d27d27d27ULL, }, + { 0x7fffffff7fffffffULL, 0x7fffffff7fffffffULL, }, + { 0x1c71c71c71c71c71ULL, 0xc71c71c71c71c71cULL, }, + { 0x886ae6cc28625540ULL, 0x4b670b5efe7bb00cULL, }, /* 64 */ + { 0xc21473973afb0e24ULL, 0x2f2f633c89dd8184ULL, }, + { 0x9a62cabb7118f060ULL, 0x399fe92ed4d36a90ULL, }, + { 0x7c5cfe8c434a1bc7ULL, 0x6cac4a1bd3df4956ULL, }, + { 0xc21473973afb0e24ULL, 0x2f2f633c89dd8184ULL, }, + { 0xfbbe00634d93c708ULL, 0x12f7bb1a153f52fcULL, }, + { 0xd40c578683b1a944ULL, 0x1d68410c60353c08ULL, }, + { 0xb6068b5855e2d4abULL, 0x5074a1f95f411aceULL, }, + { 0x9a62cabb7118f060ULL, 0x399fe92ed4d36a90ULL, }, /* 72 */ + { 0xd40c578683b1a944ULL, 0x1d68410c60353c08ULL, }, + { 0xac5aaeaab9cf8b80ULL, 0x27d8c6ffab2b2514ULL, }, + { 0x8e54e27b8c00b6e7ULL, 0x5ae527ebaa3703daULL, }, + { 0x7c5cfe8c434a1bc7ULL, 0x6cac4a1bd3df4956ULL, }, + { 0xb6068b5855e2d4abULL, 0x5074a1f95f411aceULL, }, +}; + + gettimeofday(&start, NULL); + + for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) { + for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) { + do_msa_AVE_U_W(b128_pattern[i], b128_pattern[j], + b128_result[PATTERN_INPUTS_SHORT_COUNT * i + j]); + } + } + + for (i = 0; i < RANDOM_INPUTS_SHORT_COUNT; i++) { + for (j = 0; j < RANDOM_INPUTS_SHORT_COUNT; j++) { + do_msa_AVE_U_W(b128_random[i], b128_random[j], + b128_result[((PATTERN_INPUTS_SHORT_COUNT) * + (PATTERN_INPUTS_SHORT_COUNT)) + + RANDOM_INPUTS_SHORT_COUNT * i + j]); + } + } + + gettimeofday(&end, NULL); + + elapsed_time = (end.tv_sec - start.tv_sec) * 1000.0; + elapsed_time += (end.tv_usec - start.tv_usec) / 1000.0; + + ret = check_results(instruction_name, TEST_COUNT_TOTAL, elapsed_time, + &b128_result[0][0], &b128_expect[0][0]); + + return ret; +} diff --git a/tests/tcg/mips/user/ase/msa/int-average/test_msa_aver_s_b.c b/tests/tcg/mips/user/ase/msa/int-average/test_msa_aver_s_b.c new file mode 100644 index 0000000000..59bba28d2e --- /dev/null +++ b/tests/tcg/mips/user/ase/msa/int-average/test_msa_aver_s_b.c @@ -0,0 +1,151 @@ +/* + * Test program for MSA instruction AVER_S.B + * + * Copyright (C) 2018 Wave Computing, Inc. + * Copyright (C) 2018 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.h" +#include "../../../../include/test_utils.h" + +#define TEST_COUNT_TOTAL ( \ + (PATTERN_INPUTS_SHORT_COUNT) * (PATTERN_INPUTS_SHORT_COUNT) + \ + (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT)) + + +int32_t main(void) +{ + char *instruction_name = "AVER_S.B"; + int32_t ret; + uint32_t i, j; + struct timeval start, end; + double elapsed_time; + + uint64_t b128_result[TEST_COUNT_TOTAL][2]; + uint64_t b128_expect[TEST_COUNT_TOTAL][2] = { + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 0 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0xd5d5d5d5d5d5d5d5ULL, 0xd5d5d5d5d5d5d5d5ULL, }, + { 0x2a2a2a2a2a2a2a2aULL, 0x2a2a2a2a2a2a2a2aULL, }, + { 0xe6e6e6e6e6e6e6e6ULL, 0xe6e6e6e6e6e6e6e6ULL, }, + { 0x1919191919191919ULL, 0x1919191919191919ULL, }, + { 0xf1c71cf1c71cf1c7ULL, 0x1cf1c71cf1c71cf1ULL, }, + { 0x0e38e30e38e30e38ULL, 0xe30e38e30e38e30eULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 8 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0xd5d5d5d5d5d5d5d5ULL, 0xd5d5d5d5d5d5d5d5ULL, }, + { 0x2b2b2b2b2b2b2b2bULL, 0x2b2b2b2b2b2b2b2bULL, }, + { 0xe6e6e6e6e6e6e6e6ULL, 0xe6e6e6e6e6e6e6e6ULL, }, + { 0x1a1a1a1a1a1a1a1aULL, 0x1a1a1a1a1a1a1a1aULL, }, + { 0xf2c71cf2c71cf2c7ULL, 0x1cf2c71cf2c71cf2ULL, }, + { 0x0e39e40e39e40e39ULL, 0xe40e39e40e39e40eULL, }, + { 0xd5d5d5d5d5d5d5d5ULL, 0xd5d5d5d5d5d5d5d5ULL, }, /* 16 */ + { 0xd5d5d5d5d5d5d5d5ULL, 0xd5d5d5d5d5d5d5d5ULL, }, + { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0xbbbbbbbbbbbbbbbbULL, 0xbbbbbbbbbbbbbbbbULL, }, + { 0xefefefefefefefefULL, 0xefefefefefefefefULL, }, + { 0xc79cf1c79cf1c79cULL, 0xf1c79cf1c79cf1c7ULL, }, + { 0xe30eb9e30eb9e30eULL, 0xb9e30eb9e30eb9e3ULL, }, + { 0x2a2a2a2a2a2a2a2aULL, 0x2a2a2a2a2a2a2a2aULL, }, /* 24 */ + { 0x2b2b2b2b2b2b2b2bULL, 0x2b2b2b2b2b2b2b2bULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x5555555555555555ULL, 0x5555555555555555ULL, }, + { 0x1111111111111111ULL, 0x1111111111111111ULL, }, + { 0x4444444444444444ULL, 0x4444444444444444ULL, }, + { 0x1cf2471cf2471cf2ULL, 0x471cf2471cf2471cULL, }, + { 0x39630e39630e3963ULL, 0x0e39630e39630e39ULL, }, + { 0xe6e6e6e6e6e6e6e6ULL, 0xe6e6e6e6e6e6e6e6ULL, }, /* 32 */ + { 0xe6e6e6e6e6e6e6e6ULL, 0xe6e6e6e6e6e6e6e6ULL, }, + { 0xbbbbbbbbbbbbbbbbULL, 0xbbbbbbbbbbbbbbbbULL, }, + { 0x1111111111111111ULL, 0x1111111111111111ULL, }, + { 0xccccccccccccccccULL, 0xccccccccccccccccULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0xd8ad02d8ad02d8adULL, 0x02d8ad02d8ad02d8ULL, }, + { 0xf41fcaf41fcaf41fULL, 0xcaf41fcaf41fcaf4ULL, }, + { 0x1919191919191919ULL, 0x1919191919191919ULL, }, /* 40 */ + { 0x1a1a1a1a1a1a1a1aULL, 0x1a1a1a1a1a1a1a1aULL, }, + { 0xefefefefefefefefULL, 0xefefefefefefefefULL, }, + { 0x4444444444444444ULL, 0x4444444444444444ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x3333333333333333ULL, 0x3333333333333333ULL, }, + { 0x0be1360be1360be1ULL, 0x360be1360be1360bULL, }, + { 0x2852fd2852fd2852ULL, 0xfd2852fd2852fd28ULL, }, + { 0xf1c71cf1c71cf1c7ULL, 0x1cf1c71cf1c71cf1ULL, }, /* 48 */ + { 0xf2c71cf2c71cf2c7ULL, 0x1cf2c71cf2c71cf2ULL, }, + { 0xc79cf1c79cf1c79cULL, 0xf1c79cf1c79cf1c7ULL, }, + { 0x1cf2471cf2471cf2ULL, 0x471cf2471cf2471cULL, }, + { 0xd8ad02d8ad02d8adULL, 0x02d8ad02d8ad02d8ULL, }, + { 0x0be1360be1360be1ULL, 0x360be1360be1360bULL, }, + { 0xe38e38e38e38e38eULL, 0x38e38e38e38e38e3ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0e38e30e38e30e38ULL, 0xe30e38e30e38e30eULL, }, /* 56 */ + { 0x0e39e40e39e40e39ULL, 0xe40e39e40e39e40eULL, }, + { 0xe30eb9e30eb9e30eULL, 0xb9e30eb9e30eb9e3ULL, }, + { 0x39630e39630e3963ULL, 0x0e39630e39630e39ULL, }, + { 0xf41fcaf41fcaf41fULL, 0xcaf41fcaf41fcaf4ULL, }, + { 0x2852fd2852fd2852ULL, 0xfd2852fd2852fd28ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x1c71c71c71c71c71ULL, 0xc71c71c71c71c71cULL, }, + { 0x886ae6cc28625540ULL, 0x4b670b5efe7bb00cULL, }, /* 64 */ + { 0xc214f3183bfb0e24ULL, 0x2f2fe33c0a5d0104ULL, }, + { 0x9a62cabbf119f0e0ULL, 0x3920e92fd553eb10ULL, }, + { 0xfc5dfe0d434a1c47ULL, 0xec2cca1bd45fc9d6ULL, }, + { 0xc214f3183bfb0e24ULL, 0x2f2fe33c0a5d0104ULL, }, + { 0xfbbe00634d93c708ULL, 0x12f7bb1a153f52fcULL, }, + { 0xd40cd70703b1a9c4ULL, 0x1de8c10de0353c08ULL, }, + { 0x36070b5856e2d52bULL, 0xd0f4a2f9df411aceULL, }, + { 0x9a62cabbf119f0e0ULL, 0x3920e92fd553eb10ULL, }, /* 72 */ + { 0xd40cd70703b1a9c4ULL, 0x1de8c10de0353c08ULL, }, + { 0xac5aaeaab9cf8b80ULL, 0x27d8c6ffab2b2514ULL, }, + { 0x0e55e2fc0c00b7e7ULL, 0xdae5a7ecaa3704daULL, }, + { 0xfc5dfe0d434a1c47ULL, 0xec2cca1bd45fc9d6ULL, }, + { 0x36070b5856e2d52bULL, 0xd0f4a2f9df411aceULL, }, +}; + + gettimeofday(&start, NULL); + + for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) { + for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) { + do_msa_AVER_S_B(b128_pattern[i], b128_pattern[j], + b128_result[PATTERN_INPUTS_SHORT_COUNT * i + j]); + } + } + + for (i = 0; i < RANDOM_INPUTS_SHORT_COUNT; i++) { + for (j = 0; j < RANDOM_INPUTS_SHORT_COUNT; j++) { + do_msa_AVER_S_B(b128_random[i], b128_random[j], + b128_result[((PATTERN_INPUTS_SHORT_COUNT) * + (PATTERN_INPUTS_SHORT_COUNT)) + + RANDOM_INPUTS_SHORT_COUNT * i + j]); + } + } + + gettimeofday(&end, NULL); + + elapsed_time = (end.tv_sec - start.tv_sec) * 1000.0; + elapsed_time += (end.tv_usec - start.tv_usec) / 1000.0; + + ret = check_results(instruction_name, TEST_COUNT_TOTAL, elapsed_time, + &b128_result[0][0], &b128_expect[0][0]); + + return ret; +} diff --git a/tests/tcg/mips/user/ase/msa/int-average/test_msa_aver_s_d.c b/tests/tcg/mips/user/ase/msa/int-average/test_msa_aver_s_d.c new file mode 100644 index 0000000000..435c09f9bf --- /dev/null +++ b/tests/tcg/mips/user/ase/msa/int-average/test_msa_aver_s_d.c @@ -0,0 +1,151 @@ +/* + * Test program for MSA instruction AVER_S.D + * + * Copyright (C) 2018 Wave Computing, Inc. + * Copyright (C) 2018 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.h" +#include "../../../../include/test_utils.h" + +#define TEST_COUNT_TOTAL ( \ + (PATTERN_INPUTS_SHORT_COUNT) * (PATTERN_INPUTS_SHORT_COUNT) + \ + (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT)) + + +int32_t main(void) +{ + char *instruction_name = "AVER_S.D"; + int32_t ret; + uint32_t i, j; + struct timeval start, end; + double elapsed_time; + + uint64_t b128_result[TEST_COUNT_TOTAL][2]; + uint64_t b128_expect[TEST_COUNT_TOTAL][2] = { + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 0 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0xd555555555555555ULL, 0xd555555555555555ULL, }, + { 0x2aaaaaaaaaaaaaaaULL, 0x2aaaaaaaaaaaaaaaULL, }, + { 0xe666666666666666ULL, 0xe666666666666666ULL, }, + { 0x1999999999999999ULL, 0x1999999999999999ULL, }, + { 0xf1c71c71c71c71c7ULL, 0x1c71c71c71c71c71ULL, }, + { 0x0e38e38e38e38e38ULL, 0xe38e38e38e38e38eULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 8 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0xd555555555555555ULL, 0xd555555555555555ULL, }, + { 0x2aaaaaaaaaaaaaabULL, 0x2aaaaaaaaaaaaaabULL, }, + { 0xe666666666666666ULL, 0xe666666666666666ULL, }, + { 0x199999999999999aULL, 0x199999999999999aULL, }, + { 0xf1c71c71c71c71c7ULL, 0x1c71c71c71c71c72ULL, }, + { 0x0e38e38e38e38e39ULL, 0xe38e38e38e38e38eULL, }, + { 0xd555555555555555ULL, 0xd555555555555555ULL, }, /* 16 */ + { 0xd555555555555555ULL, 0xd555555555555555ULL, }, + { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0xbbbbbbbbbbbbbbbbULL, 0xbbbbbbbbbbbbbbbbULL, }, + { 0xeeeeeeeeeeeeeeefULL, 0xeeeeeeeeeeeeeeefULL, }, + { 0xc71c71c71c71c71cULL, 0xf1c71c71c71c71c7ULL, }, + { 0xe38e38e38e38e38eULL, 0xb8e38e38e38e38e3ULL, }, + { 0x2aaaaaaaaaaaaaaaULL, 0x2aaaaaaaaaaaaaaaULL, }, /* 24 */ + { 0x2aaaaaaaaaaaaaabULL, 0x2aaaaaaaaaaaaaabULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x5555555555555555ULL, 0x5555555555555555ULL, }, + { 0x1111111111111111ULL, 0x1111111111111111ULL, }, + { 0x4444444444444444ULL, 0x4444444444444444ULL, }, + { 0x1c71c71c71c71c72ULL, 0x471c71c71c71c71cULL, }, + { 0x38e38e38e38e38e3ULL, 0x0e38e38e38e38e39ULL, }, + { 0xe666666666666666ULL, 0xe666666666666666ULL, }, /* 32 */ + { 0xe666666666666666ULL, 0xe666666666666666ULL, }, + { 0xbbbbbbbbbbbbbbbbULL, 0xbbbbbbbbbbbbbbbbULL, }, + { 0x1111111111111111ULL, 0x1111111111111111ULL, }, + { 0xccccccccccccccccULL, 0xccccccccccccccccULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0xd82d82d82d82d82dULL, 0x02d82d82d82d82d8ULL, }, + { 0xf49f49f49f49f49fULL, 0xc9f49f49f49f49f4ULL, }, + { 0x1999999999999999ULL, 0x1999999999999999ULL, }, /* 40 */ + { 0x199999999999999aULL, 0x199999999999999aULL, }, + { 0xeeeeeeeeeeeeeeefULL, 0xeeeeeeeeeeeeeeefULL, }, + { 0x4444444444444444ULL, 0x4444444444444444ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x3333333333333333ULL, 0x3333333333333333ULL, }, + { 0x0b60b60b60b60b61ULL, 0x360b60b60b60b60bULL, }, + { 0x27d27d27d27d27d2ULL, 0xfd27d27d27d27d28ULL, }, + { 0xf1c71c71c71c71c7ULL, 0x1c71c71c71c71c71ULL, }, /* 48 */ + { 0xf1c71c71c71c71c7ULL, 0x1c71c71c71c71c72ULL, }, + { 0xc71c71c71c71c71cULL, 0xf1c71c71c71c71c7ULL, }, + { 0x1c71c71c71c71c72ULL, 0x471c71c71c71c71cULL, }, + { 0xd82d82d82d82d82dULL, 0x02d82d82d82d82d8ULL, }, + { 0x0b60b60b60b60b61ULL, 0x360b60b60b60b60bULL, }, + { 0xe38e38e38e38e38eULL, 0x38e38e38e38e38e3ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0e38e38e38e38e38ULL, 0xe38e38e38e38e38eULL, }, /* 56 */ + { 0x0e38e38e38e38e39ULL, 0xe38e38e38e38e38eULL, }, + { 0xe38e38e38e38e38eULL, 0xb8e38e38e38e38e3ULL, }, + { 0x38e38e38e38e38e3ULL, 0x0e38e38e38e38e39ULL, }, + { 0xf49f49f49f49f49fULL, 0xc9f49f49f49f49f4ULL, }, + { 0x27d27d27d27d27d2ULL, 0xfd27d27d27d27d28ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x1c71c71c71c71c71ULL, 0xc71c71c71c71c71cULL, }, + { 0x886ae6cc28625540ULL, 0x4b670b5efe7bb00cULL, }, /* 64 */ + { 0xc2147397bafb0e24ULL, 0x2f2f633c89dd8184ULL, }, + { 0x9a62cabb7118f060ULL, 0x399fe92f54d36a90ULL, }, + { 0xfc5cfe8cc34a1bc7ULL, 0xecac4a1bd3df4956ULL, }, + { 0xc2147397bafb0e24ULL, 0x2f2f633c89dd8184ULL, }, + { 0xfbbe00634d93c708ULL, 0x12f7bb1a153f52fcULL, }, + { 0xd40c578703b1a944ULL, 0x1d68410ce0353c08ULL, }, + { 0x36068b5855e2d4abULL, 0xd074a1f95f411aceULL, }, + { 0x9a62cabb7118f060ULL, 0x399fe92f54d36a90ULL, }, /* 72 */ + { 0xd40c578703b1a944ULL, 0x1d68410ce0353c08ULL, }, + { 0xac5aaeaab9cf8b80ULL, 0x27d8c6ffab2b2514ULL, }, + { 0x0e54e27c0c00b6e7ULL, 0xdae527ec2a3703daULL, }, + { 0xfc5cfe8cc34a1bc7ULL, 0xecac4a1bd3df4956ULL, }, + { 0x36068b5855e2d4abULL, 0xd074a1f95f411aceULL, }, +}; + + gettimeofday(&start, NULL); + + for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) { + for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) { + do_msa_AVER_S_D(b128_pattern[i], b128_pattern[j], + b128_result[PATTERN_INPUTS_SHORT_COUNT * i + j]); + } + } + + for (i = 0; i < RANDOM_INPUTS_SHORT_COUNT; i++) { + for (j = 0; j < RANDOM_INPUTS_SHORT_COUNT; j++) { + do_msa_AVER_S_D(b128_random[i], b128_random[j], + b128_result[((PATTERN_INPUTS_SHORT_COUNT) * + (PATTERN_INPUTS_SHORT_COUNT)) + + RANDOM_INPUTS_SHORT_COUNT * i + j]); + } + } + + gettimeofday(&end, NULL); + + elapsed_time = (end.tv_sec - start.tv_sec) * 1000.0; + elapsed_time += (end.tv_usec - start.tv_usec) / 1000.0; + + ret = check_results(instruction_name, TEST_COUNT_TOTAL, elapsed_time, + &b128_result[0][0], &b128_expect[0][0]); + + return ret; +} diff --git a/tests/tcg/mips/user/ase/msa/int-average/test_msa_aver_s_h.c b/tests/tcg/mips/user/ase/msa/int-average/test_msa_aver_s_h.c new file mode 100644 index 0000000000..0902e508ec --- /dev/null +++ b/tests/tcg/mips/user/ase/msa/int-average/test_msa_aver_s_h.c @@ -0,0 +1,151 @@ +/* + * Test program for MSA instruction AVER_S.H + * + * Copyright (C) 2018 Wave Computing, Inc. + * Copyright (C) 2018 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.h" +#include "../../../../include/test_utils.h" + +#define TEST_COUNT_TOTAL ( \ + (PATTERN_INPUTS_SHORT_COUNT) * (PATTERN_INPUTS_SHORT_COUNT) + \ + (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT)) + + +int32_t main(void) +{ + char *instruction_name = "AVER_S.H"; + int32_t ret; + uint32_t i, j; + struct timeval start, end; + double elapsed_time; + + uint64_t b128_result[TEST_COUNT_TOTAL][2]; + uint64_t b128_expect[TEST_COUNT_TOTAL][2] = { + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 0 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0xd555d555d555d555ULL, 0xd555d555d555d555ULL, }, + { 0x2aaa2aaa2aaa2aaaULL, 0x2aaa2aaa2aaa2aaaULL, }, + { 0xe666e666e666e666ULL, 0xe666e666e666e666ULL, }, + { 0x1999199919991999ULL, 0x1999199919991999ULL, }, + { 0xf1c71c71c71cf1c7ULL, 0x1c71c71cf1c71c71ULL, }, + { 0x0e38e38e38e30e38ULL, 0xe38e38e30e38e38eULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 8 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0xd555d555d555d555ULL, 0xd555d555d555d555ULL, }, + { 0x2aab2aab2aab2aabULL, 0x2aab2aab2aab2aabULL, }, + { 0xe666e666e666e666ULL, 0xe666e666e666e666ULL, }, + { 0x199a199a199a199aULL, 0x199a199a199a199aULL, }, + { 0xf1c71c72c71cf1c7ULL, 0x1c72c71cf1c71c72ULL, }, + { 0x0e39e38e38e40e39ULL, 0xe38e38e40e39e38eULL, }, + { 0xd555d555d555d555ULL, 0xd555d555d555d555ULL, }, /* 16 */ + { 0xd555d555d555d555ULL, 0xd555d555d555d555ULL, }, + { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0xbbbbbbbbbbbbbbbbULL, 0xbbbbbbbbbbbbbbbbULL, }, + { 0xeeefeeefeeefeeefULL, 0xeeefeeefeeefeeefULL, }, + { 0xc71cf1c79c71c71cULL, 0xf1c79c71c71cf1c7ULL, }, + { 0xe38eb8e30e39e38eULL, 0xb8e30e39e38eb8e3ULL, }, + { 0x2aaa2aaa2aaa2aaaULL, 0x2aaa2aaa2aaa2aaaULL, }, /* 24 */ + { 0x2aab2aab2aab2aabULL, 0x2aab2aab2aab2aabULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x5555555555555555ULL, 0x5555555555555555ULL, }, + { 0x1111111111111111ULL, 0x1111111111111111ULL, }, + { 0x4444444444444444ULL, 0x4444444444444444ULL, }, + { 0x1c72471cf1c71c72ULL, 0x471cf1c71c72471cULL, }, + { 0x38e30e39638e38e3ULL, 0x0e39638e38e30e39ULL, }, + { 0xe666e666e666e666ULL, 0xe666e666e666e666ULL, }, /* 32 */ + { 0xe666e666e666e666ULL, 0xe666e666e666e666ULL, }, + { 0xbbbbbbbbbbbbbbbbULL, 0xbbbbbbbbbbbbbbbbULL, }, + { 0x1111111111111111ULL, 0x1111111111111111ULL, }, + { 0xccccccccccccccccULL, 0xccccccccccccccccULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0xd82d02d8ad82d82dULL, 0x02d8ad82d82d02d8ULL, }, + { 0xf49fc9f41f4af49fULL, 0xc9f41f4af49fc9f4ULL, }, + { 0x1999199919991999ULL, 0x1999199919991999ULL, }, /* 40 */ + { 0x199a199a199a199aULL, 0x199a199a199a199aULL, }, + { 0xeeefeeefeeefeeefULL, 0xeeefeeefeeefeeefULL, }, + { 0x4444444444444444ULL, 0x4444444444444444ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x3333333333333333ULL, 0x3333333333333333ULL, }, + { 0x0b61360be0b60b61ULL, 0x360be0b60b61360bULL, }, + { 0x27d2fd28527d27d2ULL, 0xfd28527d27d2fd28ULL, }, + { 0xf1c71c71c71cf1c7ULL, 0x1c71c71cf1c71c71ULL, }, /* 48 */ + { 0xf1c71c72c71cf1c7ULL, 0x1c72c71cf1c71c72ULL, }, + { 0xc71cf1c79c71c71cULL, 0xf1c79c71c71cf1c7ULL, }, + { 0x1c72471cf1c71c72ULL, 0x471cf1c71c72471cULL, }, + { 0xd82d02d8ad82d82dULL, 0x02d8ad82d82d02d8ULL, }, + { 0x0b61360be0b60b61ULL, 0x360be0b60b61360bULL, }, + { 0xe38e38e38e38e38eULL, 0x38e38e38e38e38e3ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0e38e38e38e30e38ULL, 0xe38e38e30e38e38eULL, }, /* 56 */ + { 0x0e39e38e38e40e39ULL, 0xe38e38e40e39e38eULL, }, + { 0xe38eb8e30e39e38eULL, 0xb8e30e39e38eb8e3ULL, }, + { 0x38e30e39638e38e3ULL, 0x0e39638e38e30e39ULL, }, + { 0xf49fc9f41f4af49fULL, 0xc9f41f4af49fc9f4ULL, }, + { 0x27d2fd28527d27d2ULL, 0xfd28527d27d2fd28ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x1c71c71c71c71c71ULL, 0xc71c71c71c71c71cULL, }, + { 0x886ae6cc28625540ULL, 0x4b670b5efe7bb00cULL, }, /* 64 */ + { 0xc214f3983afb0e24ULL, 0x2f2fe33c09dd0184ULL, }, + { 0x9a62cabbf119f060ULL, 0x39a0e92fd4d3ea90ULL, }, + { 0xfc5dfe8d434a1bc7ULL, 0xecacca1bd3dfc956ULL, }, + { 0xc214f3983afb0e24ULL, 0x2f2fe33c09dd0184ULL, }, + { 0xfbbe00634d93c708ULL, 0x12f7bb1a153f52fcULL, }, + { 0xd40cd78703b1a944ULL, 0x1d68c10de0353c08ULL, }, + { 0x36070b5855e2d4abULL, 0xd074a1f9df411aceULL, }, + { 0x9a62cabbf119f060ULL, 0x39a0e92fd4d3ea90ULL, }, /* 72 */ + { 0xd40cd78703b1a944ULL, 0x1d68c10de0353c08ULL, }, + { 0xac5aaeaab9cf8b80ULL, 0x27d8c6ffab2b2514ULL, }, + { 0x0e55e27c0c00b6e7ULL, 0xdae5a7ecaa3703daULL, }, + { 0xfc5dfe8d434a1bc7ULL, 0xecacca1bd3dfc956ULL, }, + { 0x36070b5855e2d4abULL, 0xd074a1f9df411aceULL, }, +}; + + gettimeofday(&start, NULL); + + for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) { + for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) { + do_msa_AVER_S_H(b128_pattern[i], b128_pattern[j], + b128_result[PATTERN_INPUTS_SHORT_COUNT * i + j]); + } + } + + for (i = 0; i < RANDOM_INPUTS_SHORT_COUNT; i++) { + for (j = 0; j < RANDOM_INPUTS_SHORT_COUNT; j++) { + do_msa_AVER_S_H(b128_random[i], b128_random[j], + b128_result[((PATTERN_INPUTS_SHORT_COUNT) * + (PATTERN_INPUTS_SHORT_COUNT)) + + RANDOM_INPUTS_SHORT_COUNT * i + j]); + } + } + + gettimeofday(&end, NULL); + + elapsed_time = (end.tv_sec - start.tv_sec) * 1000.0; + elapsed_time += (end.tv_usec - start.tv_usec) / 1000.0; + + ret = check_results(instruction_name, TEST_COUNT_TOTAL, elapsed_time, + &b128_result[0][0], &b128_expect[0][0]); + + return ret; +} diff --git a/tests/tcg/mips/user/ase/msa/int-average/test_msa_aver_s_w.c b/tests/tcg/mips/user/ase/msa/int-average/test_msa_aver_s_w.c new file mode 100644 index 0000000000..31f4553916 --- /dev/null +++ b/tests/tcg/mips/user/ase/msa/int-average/test_msa_aver_s_w.c @@ -0,0 +1,151 @@ +/* + * Test program for MSA instruction AVER_S.W + * + * Copyright (C) 2018 Wave Computing, Inc. + * Copyright (C) 2018 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.h" +#include "../../../../include/test_utils.h" + +#define TEST_COUNT_TOTAL ( \ + (PATTERN_INPUTS_SHORT_COUNT) * (PATTERN_INPUTS_SHORT_COUNT) + \ + (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT)) + + +int32_t main(void) +{ + char *instruction_name = "AVER_S.W"; + int32_t ret; + uint32_t i, j; + struct timeval start, end; + double elapsed_time; + + uint64_t b128_result[TEST_COUNT_TOTAL][2]; + uint64_t b128_expect[TEST_COUNT_TOTAL][2] = { + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 0 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0xd5555555d5555555ULL, 0xd5555555d5555555ULL, }, + { 0x2aaaaaaa2aaaaaaaULL, 0x2aaaaaaa2aaaaaaaULL, }, + { 0xe6666666e6666666ULL, 0xe6666666e6666666ULL, }, + { 0x1999999919999999ULL, 0x1999999919999999ULL, }, + { 0xf1c71c71c71c71c7ULL, 0x1c71c71cf1c71c71ULL, }, + { 0x0e38e38e38e38e38ULL, 0xe38e38e30e38e38eULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 8 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0xd5555555d5555555ULL, 0xd5555555d5555555ULL, }, + { 0x2aaaaaab2aaaaaabULL, 0x2aaaaaab2aaaaaabULL, }, + { 0xe6666666e6666666ULL, 0xe6666666e6666666ULL, }, + { 0x1999999a1999999aULL, 0x1999999a1999999aULL, }, + { 0xf1c71c72c71c71c7ULL, 0x1c71c71cf1c71c72ULL, }, + { 0x0e38e38e38e38e39ULL, 0xe38e38e40e38e38eULL, }, + { 0xd5555555d5555555ULL, 0xd5555555d5555555ULL, }, /* 16 */ + { 0xd5555555d5555555ULL, 0xd5555555d5555555ULL, }, + { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0xbbbbbbbbbbbbbbbbULL, 0xbbbbbbbbbbbbbbbbULL, }, + { 0xeeeeeeefeeeeeeefULL, 0xeeeeeeefeeeeeeefULL, }, + { 0xc71c71c79c71c71cULL, 0xf1c71c71c71c71c7ULL, }, + { 0xe38e38e30e38e38eULL, 0xb8e38e39e38e38e3ULL, }, + { 0x2aaaaaaa2aaaaaaaULL, 0x2aaaaaaa2aaaaaaaULL, }, /* 24 */ + { 0x2aaaaaab2aaaaaabULL, 0x2aaaaaab2aaaaaabULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x5555555555555555ULL, 0x5555555555555555ULL, }, + { 0x1111111111111111ULL, 0x1111111111111111ULL, }, + { 0x4444444444444444ULL, 0x4444444444444444ULL, }, + { 0x1c71c71cf1c71c72ULL, 0x471c71c71c71c71cULL, }, + { 0x38e38e39638e38e3ULL, 0x0e38e38e38e38e39ULL, }, + { 0xe6666666e6666666ULL, 0xe6666666e6666666ULL, }, /* 32 */ + { 0xe6666666e6666666ULL, 0xe6666666e6666666ULL, }, + { 0xbbbbbbbbbbbbbbbbULL, 0xbbbbbbbbbbbbbbbbULL, }, + { 0x1111111111111111ULL, 0x1111111111111111ULL, }, + { 0xccccccccccccccccULL, 0xccccccccccccccccULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0xd82d82d8ad82d82dULL, 0x02d82d82d82d82d8ULL, }, + { 0xf49f49f41f49f49fULL, 0xc9f49f4af49f49f4ULL, }, + { 0x1999999919999999ULL, 0x1999999919999999ULL, }, /* 40 */ + { 0x1999999a1999999aULL, 0x1999999a1999999aULL, }, + { 0xeeeeeeefeeeeeeefULL, 0xeeeeeeefeeeeeeefULL, }, + { 0x4444444444444444ULL, 0x4444444444444444ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x3333333333333333ULL, 0x3333333333333333ULL, }, + { 0x0b60b60be0b60b61ULL, 0x360b60b60b60b60bULL, }, + { 0x27d27d28527d27d2ULL, 0xfd27d27d27d27d28ULL, }, + { 0xf1c71c71c71c71c7ULL, 0x1c71c71cf1c71c71ULL, }, /* 48 */ + { 0xf1c71c72c71c71c7ULL, 0x1c71c71cf1c71c72ULL, }, + { 0xc71c71c79c71c71cULL, 0xf1c71c71c71c71c7ULL, }, + { 0x1c71c71cf1c71c72ULL, 0x471c71c71c71c71cULL, }, + { 0xd82d82d8ad82d82dULL, 0x02d82d82d82d82d8ULL, }, + { 0x0b60b60be0b60b61ULL, 0x360b60b60b60b60bULL, }, + { 0xe38e38e38e38e38eULL, 0x38e38e38e38e38e3ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0e38e38e38e38e38ULL, 0xe38e38e30e38e38eULL, }, /* 56 */ + { 0x0e38e38e38e38e39ULL, 0xe38e38e40e38e38eULL, }, + { 0xe38e38e30e38e38eULL, 0xb8e38e39e38e38e3ULL, }, + { 0x38e38e39638e38e3ULL, 0x0e38e38e38e38e39ULL, }, + { 0xf49f49f41f49f49fULL, 0xc9f49f4af49f49f4ULL, }, + { 0x27d27d28527d27d2ULL, 0xfd27d27d27d27d28ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x1c71c71c71c71c71ULL, 0xc71c71c71c71c71cULL, }, + { 0x886ae6cc28625540ULL, 0x4b670b5efe7bb00cULL, }, /* 64 */ + { 0xc21473983afb0e24ULL, 0x2f2f633c09dd8184ULL, }, + { 0x9a62cabbf118f060ULL, 0x399fe92fd4d36a90ULL, }, + { 0xfc5cfe8d434a1bc7ULL, 0xecac4a1bd3df4956ULL, }, + { 0xc21473983afb0e24ULL, 0x2f2f633c09dd8184ULL, }, + { 0xfbbe00634d93c708ULL, 0x12f7bb1a153f52fcULL, }, + { 0xd40c578703b1a944ULL, 0x1d68410de0353c08ULL, }, + { 0x36068b5855e2d4abULL, 0xd074a1f9df411aceULL, }, + { 0x9a62cabbf118f060ULL, 0x399fe92fd4d36a90ULL, }, /* 72 */ + { 0xd40c578703b1a944ULL, 0x1d68410de0353c08ULL, }, + { 0xac5aaeaab9cf8b80ULL, 0x27d8c6ffab2b2514ULL, }, + { 0x0e54e27c0c00b6e7ULL, 0xdae527ecaa3703daULL, }, + { 0xfc5cfe8d434a1bc7ULL, 0xecac4a1bd3df4956ULL, }, + { 0x36068b5855e2d4abULL, 0xd074a1f9df411aceULL, }, +}; + + gettimeofday(&start, NULL); + + for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) { + for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) { + do_msa_AVER_S_W(b128_pattern[i], b128_pattern[j], + b128_result[PATTERN_INPUTS_SHORT_COUNT * i + j]); + } + } + + for (i = 0; i < RANDOM_INPUTS_SHORT_COUNT; i++) { + for (j = 0; j < RANDOM_INPUTS_SHORT_COUNT; j++) { + do_msa_AVER_S_W(b128_random[i], b128_random[j], + b128_result[((PATTERN_INPUTS_SHORT_COUNT) * + (PATTERN_INPUTS_SHORT_COUNT)) + + RANDOM_INPUTS_SHORT_COUNT * i + j]); + } + } + + gettimeofday(&end, NULL); + + elapsed_time = (end.tv_sec - start.tv_sec) * 1000.0; + elapsed_time += (end.tv_usec - start.tv_usec) / 1000.0; + + ret = check_results(instruction_name, TEST_COUNT_TOTAL, elapsed_time, + &b128_result[0][0], &b128_expect[0][0]); + + return ret; +} diff --git a/tests/tcg/mips/user/ase/msa/int-average/test_msa_aver_u_b.c b/tests/tcg/mips/user/ase/msa/int-average/test_msa_aver_u_b.c new file mode 100644 index 0000000000..8aa7ec6a41 --- /dev/null +++ b/tests/tcg/mips/user/ase/msa/int-average/test_msa_aver_u_b.c @@ -0,0 +1,151 @@ +/* + * Test program for MSA instruction AVER_U.B + * + * Copyright (C) 2018 Wave Computing, Inc. + * Copyright (C) 2018 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.h" +#include "../../../../include/test_utils.h" + +#define TEST_COUNT_TOTAL ( \ + (PATTERN_INPUTS_SHORT_COUNT) * (PATTERN_INPUTS_SHORT_COUNT) + \ + (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT)) + + +int32_t main(void) +{ + char *instruction_name = "AVER_U.B"; + int32_t ret; + uint32_t i, j; + struct timeval start, end; + double elapsed_time; + + uint64_t b128_result[TEST_COUNT_TOTAL][2]; + uint64_t b128_expect[TEST_COUNT_TOTAL][2] = { + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 0 */ + { 0x8080808080808080ULL, 0x8080808080808080ULL, }, + { 0xd5d5d5d5d5d5d5d5ULL, 0xd5d5d5d5d5d5d5d5ULL, }, + { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, }, + { 0xe6e6e6e6e6e6e6e6ULL, 0xe6e6e6e6e6e6e6e6ULL, }, + { 0x9999999999999999ULL, 0x9999999999999999ULL, }, + { 0xf1c79cf1c79cf1c7ULL, 0x9cf1c79cf1c79cf1ULL, }, + { 0x8eb8e38eb8e38eb8ULL, 0xe38eb8e38eb8e38eULL, }, + { 0x8080808080808080ULL, 0x8080808080808080ULL, }, /* 8 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x5555555555555555ULL, 0x5555555555555555ULL, }, + { 0x2b2b2b2b2b2b2b2bULL, 0x2b2b2b2b2b2b2b2bULL, }, + { 0x6666666666666666ULL, 0x6666666666666666ULL, }, + { 0x1a1a1a1a1a1a1a1aULL, 0x1a1a1a1a1a1a1a1aULL, }, + { 0x72471c72471c7247ULL, 0x1c72471c72471c72ULL, }, + { 0x0e39640e39640e39ULL, 0x640e39640e39640eULL, }, + { 0xd5d5d5d5d5d5d5d5ULL, 0xd5d5d5d5d5d5d5d5ULL, }, /* 16 */ + { 0x5555555555555555ULL, 0x5555555555555555ULL, }, + { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, }, + { 0x8080808080808080ULL, 0x8080808080808080ULL, }, + { 0xbbbbbbbbbbbbbbbbULL, 0xbbbbbbbbbbbbbbbbULL, }, + { 0x6f6f6f6f6f6f6f6fULL, 0x6f6f6f6f6f6f6f6fULL, }, + { 0xc79c71c79c71c79cULL, 0x71c79c71c79c71c7ULL, }, + { 0x638eb9638eb9638eULL, 0xb9638eb9638eb963ULL, }, + { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, }, /* 24 */ + { 0x2b2b2b2b2b2b2b2bULL, 0x2b2b2b2b2b2b2b2bULL, }, + { 0x8080808080808080ULL, 0x8080808080808080ULL, }, + { 0x5555555555555555ULL, 0x5555555555555555ULL, }, + { 0x9191919191919191ULL, 0x9191919191919191ULL, }, + { 0x4444444444444444ULL, 0x4444444444444444ULL, }, + { 0x9c72479c72479c72ULL, 0x479c72479c72479cULL, }, + { 0x39638e39638e3963ULL, 0x8e39638e39638e39ULL, }, + { 0xe6e6e6e6e6e6e6e6ULL, 0xe6e6e6e6e6e6e6e6ULL, }, /* 32 */ + { 0x6666666666666666ULL, 0x6666666666666666ULL, }, + { 0xbbbbbbbbbbbbbbbbULL, 0xbbbbbbbbbbbbbbbbULL, }, + { 0x9191919191919191ULL, 0x9191919191919191ULL, }, + { 0xccccccccccccccccULL, 0xccccccccccccccccULL, }, + { 0x8080808080808080ULL, 0x8080808080808080ULL, }, + { 0xd8ad82d8ad82d8adULL, 0x82d8ad82d8ad82d8ULL, }, + { 0x749fca749fca749fULL, 0xca749fca749fca74ULL, }, + { 0x9999999999999999ULL, 0x9999999999999999ULL, }, /* 40 */ + { 0x1a1a1a1a1a1a1a1aULL, 0x1a1a1a1a1a1a1a1aULL, }, + { 0x6f6f6f6f6f6f6f6fULL, 0x6f6f6f6f6f6f6f6fULL, }, + { 0x4444444444444444ULL, 0x4444444444444444ULL, }, + { 0x8080808080808080ULL, 0x8080808080808080ULL, }, + { 0x3333333333333333ULL, 0x3333333333333333ULL, }, + { 0x8b61368b61368b61ULL, 0x368b61368b61368bULL, }, + { 0x28527d28527d2852ULL, 0x7d28527d28527d28ULL, }, + { 0xf1c79cf1c79cf1c7ULL, 0x9cf1c79cf1c79cf1ULL, }, /* 48 */ + { 0x72471c72471c7247ULL, 0x1c72471c72471c72ULL, }, + { 0xc79c71c79c71c79cULL, 0x71c79c71c79c71c7ULL, }, + { 0x9c72479c72479c72ULL, 0x479c72479c72479cULL, }, + { 0xd8ad82d8ad82d8adULL, 0x82d8ad82d8ad82d8ULL, }, + { 0x8b61368b61368b61ULL, 0x368b61368b61368bULL, }, + { 0xe38e38e38e38e38eULL, 0x38e38e38e38e38e3ULL, }, + { 0x8080808080808080ULL, 0x8080808080808080ULL, }, + { 0x8eb8e38eb8e38eb8ULL, 0xe38eb8e38eb8e38eULL, }, /* 56 */ + { 0x0e39640e39640e39ULL, 0x640e39640e39640eULL, }, + { 0x638eb9638eb9638eULL, 0xb9638eb9638eb963ULL, }, + { 0x39638e39638e3963ULL, 0x8e39638e39638e39ULL, }, + { 0x749fca749fca749fULL, 0xca749fca749fca74ULL, }, + { 0x28527d28527d2852ULL, 0x7d28527d28527d28ULL, }, + { 0x8080808080808080ULL, 0x8080808080808080ULL, }, + { 0x1c71c71c71c71c71ULL, 0xc71c71c71c71c71cULL, }, + { 0x886ae6cc28625540ULL, 0x4b670b5efe7bb00cULL, }, /* 64 */ + { 0xc29473983b7b8e24ULL, 0x2faf633c8a5d8184ULL, }, + { 0x9a62cabb71997060ULL, 0x39a069afd5536b10ULL, }, + { 0x7c5d7e8d434a9c47ULL, 0x6cac4a9bd45fc956ULL, }, + { 0xc29473983b7b8e24ULL, 0x2faf633c8a5d8184ULL, }, + { 0xfbbe00634d93c708ULL, 0x12f7bb1a153f52fcULL, }, + { 0xd48c578783b1a944ULL, 0x1de8c18d60353c88ULL, }, + { 0xb6870b585662d52bULL, 0x50f4a2795f419aceULL, }, + { 0x9a62cabb71997060ULL, 0x39a069afd5536b10ULL, }, /* 72 */ + { 0xd48c578783b1a944ULL, 0x1de8c18d60353c88ULL, }, + { 0xac5aaeaab9cf8b80ULL, 0x27d8c6ffab2b2514ULL, }, + { 0x8e55627c8c80b767ULL, 0x5ae5a7ecaa37845aULL, }, + { 0x7c5d7e8d434a9c47ULL, 0x6cac4a9bd45fc956ULL, }, + { 0xb6870b585662d52bULL, 0x50f4a2795f419aceULL, }, +}; + + gettimeofday(&start, NULL); + + for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) { + for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) { + do_msa_AVER_U_B(b128_pattern[i], b128_pattern[j], + b128_result[PATTERN_INPUTS_SHORT_COUNT * i + j]); + } + } + + for (i = 0; i < RANDOM_INPUTS_SHORT_COUNT; i++) { + for (j = 0; j < RANDOM_INPUTS_SHORT_COUNT; j++) { + do_msa_AVER_U_B(b128_random[i], b128_random[j], + b128_result[((PATTERN_INPUTS_SHORT_COUNT) * + (PATTERN_INPUTS_SHORT_COUNT)) + + RANDOM_INPUTS_SHORT_COUNT * i + j]); + } + } + + gettimeofday(&end, NULL); + + elapsed_time = (end.tv_sec - start.tv_sec) * 1000.0; + elapsed_time += (end.tv_usec - start.tv_usec) / 1000.0; + + ret = check_results(instruction_name, TEST_COUNT_TOTAL, elapsed_time, + &b128_result[0][0], &b128_expect[0][0]); + + return ret; +} diff --git a/tests/tcg/mips/user/ase/msa/int-average/test_msa_aver_u_d.c b/tests/tcg/mips/user/ase/msa/int-average/test_msa_aver_u_d.c new file mode 100644 index 0000000000..9b16e1250f --- /dev/null +++ b/tests/tcg/mips/user/ase/msa/int-average/test_msa_aver_u_d.c @@ -0,0 +1,151 @@ +/* + * Test program for MSA instruction AVER_U.D + * + * Copyright (C) 2018 Wave Computing, Inc. + * Copyright (C) 2018 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.h" +#include "../../../../include/test_utils.h" + +#define TEST_COUNT_TOTAL ( \ + (PATTERN_INPUTS_SHORT_COUNT) * (PATTERN_INPUTS_SHORT_COUNT) + \ + (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT)) + + +int32_t main(void) +{ + char *instruction_name = "AVER_U.D"; + int32_t ret; + uint32_t i, j; + struct timeval start, end; + double elapsed_time; + + uint64_t b128_result[TEST_COUNT_TOTAL][2]; + uint64_t b128_expect[TEST_COUNT_TOTAL][2] = { + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 0 */ + { 0x8000000000000000ULL, 0x8000000000000000ULL, }, + { 0xd555555555555555ULL, 0xd555555555555555ULL, }, + { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, }, + { 0xe666666666666666ULL, 0xe666666666666666ULL, }, + { 0x9999999999999999ULL, 0x9999999999999999ULL, }, + { 0xf1c71c71c71c71c7ULL, 0x9c71c71c71c71c71ULL, }, + { 0x8e38e38e38e38e38ULL, 0xe38e38e38e38e38eULL, }, + { 0x8000000000000000ULL, 0x8000000000000000ULL, }, /* 8 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x5555555555555555ULL, 0x5555555555555555ULL, }, + { 0x2aaaaaaaaaaaaaabULL, 0x2aaaaaaaaaaaaaabULL, }, + { 0x6666666666666666ULL, 0x6666666666666666ULL, }, + { 0x199999999999999aULL, 0x199999999999999aULL, }, + { 0x71c71c71c71c71c7ULL, 0x1c71c71c71c71c72ULL, }, + { 0x0e38e38e38e38e39ULL, 0x638e38e38e38e38eULL, }, + { 0xd555555555555555ULL, 0xd555555555555555ULL, }, /* 16 */ + { 0x5555555555555555ULL, 0x5555555555555555ULL, }, + { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, }, + { 0x8000000000000000ULL, 0x8000000000000000ULL, }, + { 0xbbbbbbbbbbbbbbbbULL, 0xbbbbbbbbbbbbbbbbULL, }, + { 0x6eeeeeeeeeeeeeefULL, 0x6eeeeeeeeeeeeeefULL, }, + { 0xc71c71c71c71c71cULL, 0x71c71c71c71c71c7ULL, }, + { 0x638e38e38e38e38eULL, 0xb8e38e38e38e38e3ULL, }, + { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, }, /* 24 */ + { 0x2aaaaaaaaaaaaaabULL, 0x2aaaaaaaaaaaaaabULL, }, + { 0x8000000000000000ULL, 0x8000000000000000ULL, }, + { 0x5555555555555555ULL, 0x5555555555555555ULL, }, + { 0x9111111111111111ULL, 0x9111111111111111ULL, }, + { 0x4444444444444444ULL, 0x4444444444444444ULL, }, + { 0x9c71c71c71c71c72ULL, 0x471c71c71c71c71cULL, }, + { 0x38e38e38e38e38e3ULL, 0x8e38e38e38e38e39ULL, }, + { 0xe666666666666666ULL, 0xe666666666666666ULL, }, /* 32 */ + { 0x6666666666666666ULL, 0x6666666666666666ULL, }, + { 0xbbbbbbbbbbbbbbbbULL, 0xbbbbbbbbbbbbbbbbULL, }, + { 0x9111111111111111ULL, 0x9111111111111111ULL, }, + { 0xccccccccccccccccULL, 0xccccccccccccccccULL, }, + { 0x8000000000000000ULL, 0x8000000000000000ULL, }, + { 0xd82d82d82d82d82dULL, 0x82d82d82d82d82d8ULL, }, + { 0x749f49f49f49f49fULL, 0xc9f49f49f49f49f4ULL, }, + { 0x9999999999999999ULL, 0x9999999999999999ULL, }, /* 40 */ + { 0x199999999999999aULL, 0x199999999999999aULL, }, + { 0x6eeeeeeeeeeeeeefULL, 0x6eeeeeeeeeeeeeefULL, }, + { 0x4444444444444444ULL, 0x4444444444444444ULL, }, + { 0x8000000000000000ULL, 0x8000000000000000ULL, }, + { 0x3333333333333333ULL, 0x3333333333333333ULL, }, + { 0x8b60b60b60b60b61ULL, 0x360b60b60b60b60bULL, }, + { 0x27d27d27d27d27d2ULL, 0x7d27d27d27d27d28ULL, }, + { 0xf1c71c71c71c71c7ULL, 0x9c71c71c71c71c71ULL, }, /* 48 */ + { 0x71c71c71c71c71c7ULL, 0x1c71c71c71c71c72ULL, }, + { 0xc71c71c71c71c71cULL, 0x71c71c71c71c71c7ULL, }, + { 0x9c71c71c71c71c72ULL, 0x471c71c71c71c71cULL, }, + { 0xd82d82d82d82d82dULL, 0x82d82d82d82d82d8ULL, }, + { 0x8b60b60b60b60b61ULL, 0x360b60b60b60b60bULL, }, + { 0xe38e38e38e38e38eULL, 0x38e38e38e38e38e3ULL, }, + { 0x8000000000000000ULL, 0x8000000000000000ULL, }, + { 0x8e38e38e38e38e38ULL, 0xe38e38e38e38e38eULL, }, /* 56 */ + { 0x0e38e38e38e38e39ULL, 0x638e38e38e38e38eULL, }, + { 0x638e38e38e38e38eULL, 0xb8e38e38e38e38e3ULL, }, + { 0x38e38e38e38e38e3ULL, 0x8e38e38e38e38e39ULL, }, + { 0x749f49f49f49f49fULL, 0xc9f49f49f49f49f4ULL, }, + { 0x27d27d27d27d27d2ULL, 0x7d27d27d27d27d28ULL, }, + { 0x8000000000000000ULL, 0x8000000000000000ULL, }, + { 0x1c71c71c71c71c71ULL, 0xc71c71c71c71c71cULL, }, + { 0x886ae6cc28625540ULL, 0x4b670b5efe7bb00cULL, }, /* 64 */ + { 0xc2147397bafb0e24ULL, 0x2f2f633c89dd8184ULL, }, + { 0x9a62cabb7118f060ULL, 0x399fe92f54d36a90ULL, }, + { 0x7c5cfe8cc34a1bc7ULL, 0x6cac4a1bd3df4956ULL, }, + { 0xc2147397bafb0e24ULL, 0x2f2f633c89dd8184ULL, }, + { 0xfbbe00634d93c708ULL, 0x12f7bb1a153f52fcULL, }, + { 0xd40c578703b1a944ULL, 0x1d68410ce0353c08ULL, }, + { 0xb6068b5855e2d4abULL, 0x5074a1f95f411aceULL, }, + { 0x9a62cabb7118f060ULL, 0x399fe92f54d36a90ULL, }, /* 72 */ + { 0xd40c578703b1a944ULL, 0x1d68410ce0353c08ULL, }, + { 0xac5aaeaab9cf8b80ULL, 0x27d8c6ffab2b2514ULL, }, + { 0x8e54e27c0c00b6e7ULL, 0x5ae527ec2a3703daULL, }, + { 0x7c5cfe8cc34a1bc7ULL, 0x6cac4a1bd3df4956ULL, }, + { 0xb6068b5855e2d4abULL, 0x5074a1f95f411aceULL, }, +}; + + gettimeofday(&start, NULL); + + for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) { + for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) { + do_msa_AVER_U_D(b128_pattern[i], b128_pattern[j], + b128_result[PATTERN_INPUTS_SHORT_COUNT * i + j]); + } + } + + for (i = 0; i < RANDOM_INPUTS_SHORT_COUNT; i++) { + for (j = 0; j < RANDOM_INPUTS_SHORT_COUNT; j++) { + do_msa_AVER_U_D(b128_random[i], b128_random[j], + b128_result[((PATTERN_INPUTS_SHORT_COUNT) * + (PATTERN_INPUTS_SHORT_COUNT)) + + RANDOM_INPUTS_SHORT_COUNT * i + j]); + } + } + + gettimeofday(&end, NULL); + + elapsed_time = (end.tv_sec - start.tv_sec) * 1000.0; + elapsed_time += (end.tv_usec - start.tv_usec) / 1000.0; + + ret = check_results(instruction_name, TEST_COUNT_TOTAL, elapsed_time, + &b128_result[0][0], &b128_expect[0][0]); + + return ret; +} diff --git a/tests/tcg/mips/user/ase/msa/int-average/test_msa_aver_u_h.c b/tests/tcg/mips/user/ase/msa/int-average/test_msa_aver_u_h.c new file mode 100644 index 0000000000..191e4acbdc --- /dev/null +++ b/tests/tcg/mips/user/ase/msa/int-average/test_msa_aver_u_h.c @@ -0,0 +1,151 @@ +/* + * Test program for MSA instruction AVER_U.H + * + * Copyright (C) 2018 Wave Computing, Inc. + * Copyright (C) 2018 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.h" +#include "../../../../include/test_utils.h" + +#define TEST_COUNT_TOTAL ( \ + (PATTERN_INPUTS_SHORT_COUNT) * (PATTERN_INPUTS_SHORT_COUNT) + \ + (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT)) + + +int32_t main(void) +{ + char *instruction_name = "AVER_U.H"; + int32_t ret; + uint32_t i, j; + struct timeval start, end; + double elapsed_time; + + uint64_t b128_result[TEST_COUNT_TOTAL][2]; + uint64_t b128_expect[TEST_COUNT_TOTAL][2] = { + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 0 */ + { 0x8000800080008000ULL, 0x8000800080008000ULL, }, + { 0xd555d555d555d555ULL, 0xd555d555d555d555ULL, }, + { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, }, + { 0xe666e666e666e666ULL, 0xe666e666e666e666ULL, }, + { 0x9999999999999999ULL, 0x9999999999999999ULL, }, + { 0xf1c79c71c71cf1c7ULL, 0x9c71c71cf1c79c71ULL, }, + { 0x8e38e38eb8e38e38ULL, 0xe38eb8e38e38e38eULL, }, + { 0x8000800080008000ULL, 0x8000800080008000ULL, }, /* 8 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x5555555555555555ULL, 0x5555555555555555ULL, }, + { 0x2aab2aab2aab2aabULL, 0x2aab2aab2aab2aabULL, }, + { 0x6666666666666666ULL, 0x6666666666666666ULL, }, + { 0x199a199a199a199aULL, 0x199a199a199a199aULL, }, + { 0x71c71c72471c71c7ULL, 0x1c72471c71c71c72ULL, }, + { 0x0e39638e38e40e39ULL, 0x638e38e40e39638eULL, }, + { 0xd555d555d555d555ULL, 0xd555d555d555d555ULL, }, /* 16 */ + { 0x5555555555555555ULL, 0x5555555555555555ULL, }, + { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, }, + { 0x8000800080008000ULL, 0x8000800080008000ULL, }, + { 0xbbbbbbbbbbbbbbbbULL, 0xbbbbbbbbbbbbbbbbULL, }, + { 0x6eef6eef6eef6eefULL, 0x6eef6eef6eef6eefULL, }, + { 0xc71c71c79c71c71cULL, 0x71c79c71c71c71c7ULL, }, + { 0x638eb8e38e39638eULL, 0xb8e38e39638eb8e3ULL, }, + { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, }, /* 24 */ + { 0x2aab2aab2aab2aabULL, 0x2aab2aab2aab2aabULL, }, + { 0x8000800080008000ULL, 0x8000800080008000ULL, }, + { 0x5555555555555555ULL, 0x5555555555555555ULL, }, + { 0x9111911191119111ULL, 0x9111911191119111ULL, }, + { 0x4444444444444444ULL, 0x4444444444444444ULL, }, + { 0x9c72471c71c79c72ULL, 0x471c71c79c72471cULL, }, + { 0x38e38e39638e38e3ULL, 0x8e39638e38e38e39ULL, }, + { 0xe666e666e666e666ULL, 0xe666e666e666e666ULL, }, /* 32 */ + { 0x6666666666666666ULL, 0x6666666666666666ULL, }, + { 0xbbbbbbbbbbbbbbbbULL, 0xbbbbbbbbbbbbbbbbULL, }, + { 0x9111911191119111ULL, 0x9111911191119111ULL, }, + { 0xccccccccccccccccULL, 0xccccccccccccccccULL, }, + { 0x8000800080008000ULL, 0x8000800080008000ULL, }, + { 0xd82d82d8ad82d82dULL, 0x82d8ad82d82d82d8ULL, }, + { 0x749fc9f49f4a749fULL, 0xc9f49f4a749fc9f4ULL, }, + { 0x9999999999999999ULL, 0x9999999999999999ULL, }, /* 40 */ + { 0x199a199a199a199aULL, 0x199a199a199a199aULL, }, + { 0x6eef6eef6eef6eefULL, 0x6eef6eef6eef6eefULL, }, + { 0x4444444444444444ULL, 0x4444444444444444ULL, }, + { 0x8000800080008000ULL, 0x8000800080008000ULL, }, + { 0x3333333333333333ULL, 0x3333333333333333ULL, }, + { 0x8b61360b60b68b61ULL, 0x360b60b68b61360bULL, }, + { 0x27d27d28527d27d2ULL, 0x7d28527d27d27d28ULL, }, + { 0xf1c79c71c71cf1c7ULL, 0x9c71c71cf1c79c71ULL, }, /* 48 */ + { 0x71c71c72471c71c7ULL, 0x1c72471c71c71c72ULL, }, + { 0xc71c71c79c71c71cULL, 0x71c79c71c71c71c7ULL, }, + { 0x9c72471c71c79c72ULL, 0x471c71c79c72471cULL, }, + { 0xd82d82d8ad82d82dULL, 0x82d8ad82d82d82d8ULL, }, + { 0x8b61360b60b68b61ULL, 0x360b60b68b61360bULL, }, + { 0xe38e38e38e38e38eULL, 0x38e38e38e38e38e3ULL, }, + { 0x8000800080008000ULL, 0x8000800080008000ULL, }, + { 0x8e38e38eb8e38e38ULL, 0xe38eb8e38e38e38eULL, }, /* 56 */ + { 0x0e39638e38e40e39ULL, 0x638e38e40e39638eULL, }, + { 0x638eb8e38e39638eULL, 0xb8e38e39638eb8e3ULL, }, + { 0x38e38e39638e38e3ULL, 0x8e39638e38e38e39ULL, }, + { 0x749fc9f49f4a749fULL, 0xc9f49f4a749fc9f4ULL, }, + { 0x27d27d28527d27d2ULL, 0x7d28527d27d27d28ULL, }, + { 0x8000800080008000ULL, 0x8000800080008000ULL, }, + { 0x1c71c71c71c71c71ULL, 0xc71c71c71c71c71cULL, }, + { 0x886ae6cc28625540ULL, 0x4b670b5efe7bb00cULL, }, /* 64 */ + { 0xc21473983afb8e24ULL, 0x2f2f633c89dd8184ULL, }, + { 0x9a62cabb71197060ULL, 0x39a0692fd4d36a90ULL, }, + { 0x7c5d7e8d434a9bc7ULL, 0x6cac4a1bd3dfc956ULL, }, + { 0xc21473983afb8e24ULL, 0x2f2f633c89dd8184ULL, }, + { 0xfbbe00634d93c708ULL, 0x12f7bb1a153f52fcULL, }, + { 0xd40c578783b1a944ULL, 0x1d68c10d60353c08ULL, }, + { 0xb6070b5855e2d4abULL, 0x5074a1f95f419aceULL, }, + { 0x9a62cabb71197060ULL, 0x39a0692fd4d36a90ULL, }, /* 72 */ + { 0xd40c578783b1a944ULL, 0x1d68c10d60353c08ULL, }, + { 0xac5aaeaab9cf8b80ULL, 0x27d8c6ffab2b2514ULL, }, + { 0x8e55627c8c00b6e7ULL, 0x5ae5a7ecaa3783daULL, }, + { 0x7c5d7e8d434a9bc7ULL, 0x6cac4a1bd3dfc956ULL, }, + { 0xb6070b5855e2d4abULL, 0x5074a1f95f419aceULL, }, +}; + + gettimeofday(&start, NULL); + + for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) { + for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) { + do_msa_AVER_U_H(b128_pattern[i], b128_pattern[j], + b128_result[PATTERN_INPUTS_SHORT_COUNT * i + j]); + } + } + + for (i = 0; i < RANDOM_INPUTS_SHORT_COUNT; i++) { + for (j = 0; j < RANDOM_INPUTS_SHORT_COUNT; j++) { + do_msa_AVER_U_H(b128_random[i], b128_random[j], + b128_result[((PATTERN_INPUTS_SHORT_COUNT) * + (PATTERN_INPUTS_SHORT_COUNT)) + + RANDOM_INPUTS_SHORT_COUNT * i + j]); + } + } + + gettimeofday(&end, NULL); + + elapsed_time = (end.tv_sec - start.tv_sec) * 1000.0; + elapsed_time += (end.tv_usec - start.tv_usec) / 1000.0; + + ret = check_results(instruction_name, TEST_COUNT_TOTAL, elapsed_time, + &b128_result[0][0], &b128_expect[0][0]); + + return ret; +} diff --git a/tests/tcg/mips/user/ase/msa/int-average/test_msa_aver_u_w.c b/tests/tcg/mips/user/ase/msa/int-average/test_msa_aver_u_w.c new file mode 100644 index 0000000000..e0d6b177c4 --- /dev/null +++ b/tests/tcg/mips/user/ase/msa/int-average/test_msa_aver_u_w.c @@ -0,0 +1,151 @@ +/* + * Test program for MSA instruction AVER_U.W + * + * Copyright (C) 2018 Wave Computing, Inc. + * Copyright (C) 2018 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.h" +#include "../../../../include/test_utils.h" + +#define TEST_COUNT_TOTAL ( \ + (PATTERN_INPUTS_SHORT_COUNT) * (PATTERN_INPUTS_SHORT_COUNT) + \ + (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT)) + + +int32_t main(void) +{ + char *instruction_name = "AVER_U.W"; + int32_t ret; + uint32_t i, j; + struct timeval start, end; + double elapsed_time; + + uint64_t b128_result[TEST_COUNT_TOTAL][2]; + uint64_t b128_expect[TEST_COUNT_TOTAL][2] = { + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 0 */ + { 0x8000000080000000ULL, 0x8000000080000000ULL, }, + { 0xd5555555d5555555ULL, 0xd5555555d5555555ULL, }, + { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, }, + { 0xe6666666e6666666ULL, 0xe6666666e6666666ULL, }, + { 0x9999999999999999ULL, 0x9999999999999999ULL, }, + { 0xf1c71c71c71c71c7ULL, 0x9c71c71cf1c71c71ULL, }, + { 0x8e38e38eb8e38e38ULL, 0xe38e38e38e38e38eULL, }, + { 0x8000000080000000ULL, 0x8000000080000000ULL, }, /* 8 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x5555555555555555ULL, 0x5555555555555555ULL, }, + { 0x2aaaaaab2aaaaaabULL, 0x2aaaaaab2aaaaaabULL, }, + { 0x6666666666666666ULL, 0x6666666666666666ULL, }, + { 0x1999999a1999999aULL, 0x1999999a1999999aULL, }, + { 0x71c71c72471c71c7ULL, 0x1c71c71c71c71c72ULL, }, + { 0x0e38e38e38e38e39ULL, 0x638e38e40e38e38eULL, }, + { 0xd5555555d5555555ULL, 0xd5555555d5555555ULL, }, /* 16 */ + { 0x5555555555555555ULL, 0x5555555555555555ULL, }, + { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, }, + { 0x8000000080000000ULL, 0x8000000080000000ULL, }, + { 0xbbbbbbbbbbbbbbbbULL, 0xbbbbbbbbbbbbbbbbULL, }, + { 0x6eeeeeef6eeeeeefULL, 0x6eeeeeef6eeeeeefULL, }, + { 0xc71c71c79c71c71cULL, 0x71c71c71c71c71c7ULL, }, + { 0x638e38e38e38e38eULL, 0xb8e38e39638e38e3ULL, }, + { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, }, /* 24 */ + { 0x2aaaaaab2aaaaaabULL, 0x2aaaaaab2aaaaaabULL, }, + { 0x8000000080000000ULL, 0x8000000080000000ULL, }, + { 0x5555555555555555ULL, 0x5555555555555555ULL, }, + { 0x9111111191111111ULL, 0x9111111191111111ULL, }, + { 0x4444444444444444ULL, 0x4444444444444444ULL, }, + { 0x9c71c71c71c71c72ULL, 0x471c71c79c71c71cULL, }, + { 0x38e38e39638e38e3ULL, 0x8e38e38e38e38e39ULL, }, + { 0xe6666666e6666666ULL, 0xe6666666e6666666ULL, }, /* 32 */ + { 0x6666666666666666ULL, 0x6666666666666666ULL, }, + { 0xbbbbbbbbbbbbbbbbULL, 0xbbbbbbbbbbbbbbbbULL, }, + { 0x9111111191111111ULL, 0x9111111191111111ULL, }, + { 0xccccccccccccccccULL, 0xccccccccccccccccULL, }, + { 0x8000000080000000ULL, 0x8000000080000000ULL, }, + { 0xd82d82d8ad82d82dULL, 0x82d82d82d82d82d8ULL, }, + { 0x749f49f49f49f49fULL, 0xc9f49f4a749f49f4ULL, }, + { 0x9999999999999999ULL, 0x9999999999999999ULL, }, /* 40 */ + { 0x1999999a1999999aULL, 0x1999999a1999999aULL, }, + { 0x6eeeeeef6eeeeeefULL, 0x6eeeeeef6eeeeeefULL, }, + { 0x4444444444444444ULL, 0x4444444444444444ULL, }, + { 0x8000000080000000ULL, 0x8000000080000000ULL, }, + { 0x3333333333333333ULL, 0x3333333333333333ULL, }, + { 0x8b60b60b60b60b61ULL, 0x360b60b68b60b60bULL, }, + { 0x27d27d28527d27d2ULL, 0x7d27d27d27d27d28ULL, }, + { 0xf1c71c71c71c71c7ULL, 0x9c71c71cf1c71c71ULL, }, /* 48 */ + { 0x71c71c72471c71c7ULL, 0x1c71c71c71c71c72ULL, }, + { 0xc71c71c79c71c71cULL, 0x71c71c71c71c71c7ULL, }, + { 0x9c71c71c71c71c72ULL, 0x471c71c79c71c71cULL, }, + { 0xd82d82d8ad82d82dULL, 0x82d82d82d82d82d8ULL, }, + { 0x8b60b60b60b60b61ULL, 0x360b60b68b60b60bULL, }, + { 0xe38e38e38e38e38eULL, 0x38e38e38e38e38e3ULL, }, + { 0x8000000080000000ULL, 0x8000000080000000ULL, }, + { 0x8e38e38eb8e38e38ULL, 0xe38e38e38e38e38eULL, }, /* 56 */ + { 0x0e38e38e38e38e39ULL, 0x638e38e40e38e38eULL, }, + { 0x638e38e38e38e38eULL, 0xb8e38e39638e38e3ULL, }, + { 0x38e38e39638e38e3ULL, 0x8e38e38e38e38e39ULL, }, + { 0x749f49f49f49f49fULL, 0xc9f49f4a749f49f4ULL, }, + { 0x27d27d28527d27d2ULL, 0x7d27d27d27d27d28ULL, }, + { 0x8000000080000000ULL, 0x8000000080000000ULL, }, + { 0x1c71c71c71c71c71ULL, 0xc71c71c71c71c71cULL, }, + { 0x886ae6cc28625540ULL, 0x4b670b5efe7bb00cULL, }, /* 64 */ + { 0xc21473983afb0e24ULL, 0x2f2f633c89dd8184ULL, }, + { 0x9a62cabb7118f060ULL, 0x399fe92fd4d36a90ULL, }, + { 0x7c5cfe8d434a1bc7ULL, 0x6cac4a1bd3df4956ULL, }, + { 0xc21473983afb0e24ULL, 0x2f2f633c89dd8184ULL, }, + { 0xfbbe00634d93c708ULL, 0x12f7bb1a153f52fcULL, }, + { 0xd40c578783b1a944ULL, 0x1d68410d60353c08ULL, }, + { 0xb6068b5855e2d4abULL, 0x5074a1f95f411aceULL, }, + { 0x9a62cabb7118f060ULL, 0x399fe92fd4d36a90ULL, }, /* 72 */ + { 0xd40c578783b1a944ULL, 0x1d68410d60353c08ULL, }, + { 0xac5aaeaab9cf8b80ULL, 0x27d8c6ffab2b2514ULL, }, + { 0x8e54e27c8c00b6e7ULL, 0x5ae527ecaa3703daULL, }, + { 0x7c5cfe8d434a1bc7ULL, 0x6cac4a1bd3df4956ULL, }, + { 0xb6068b5855e2d4abULL, 0x5074a1f95f411aceULL, }, +}; + + gettimeofday(&start, NULL); + + for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) { + for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) { + do_msa_AVER_U_W(b128_pattern[i], b128_pattern[j], + b128_result[PATTERN_INPUTS_SHORT_COUNT * i + j]); + } + } + + for (i = 0; i < RANDOM_INPUTS_SHORT_COUNT; i++) { + for (j = 0; j < RANDOM_INPUTS_SHORT_COUNT; j++) { + do_msa_AVER_U_W(b128_random[i], b128_random[j], + b128_result[((PATTERN_INPUTS_SHORT_COUNT) * + (PATTERN_INPUTS_SHORT_COUNT)) + + RANDOM_INPUTS_SHORT_COUNT * i + j]); + } + } + + gettimeofday(&end, NULL); + + elapsed_time = (end.tv_sec - start.tv_sec) * 1000.0; + elapsed_time += (end.tv_usec - start.tv_usec) / 1000.0; + + ret = check_results(instruction_name, TEST_COUNT_TOTAL, elapsed_time, + &b128_result[0][0], &b128_expect[0][0]); + + return ret; +} diff --git a/tests/tcg/mips/user/ase/msa/int-compare/test_msa_ceq_b.c b/tests/tcg/mips/user/ase/msa/int-compare/test_msa_ceq_b.c index b47b42e76e..bb884ee752 100644 --- a/tests/tcg/mips/user/ase/msa/int-compare/test_msa_ceq_b.c +++ b/tests/tcg/mips/user/ase/msa/int-compare/test_msa_ceq_b.c @@ -1,8 +1,8 @@ /* * Test program for MSA instruction CEQ.B * - * Copyright (C) 2018 Wave Computing, Inc. - * Copyright (C) 2018 Aleksandar Markovic <amarkovic@wavecomp.com> + * Copyright (C) 2019 Wave Computing, Inc. + * Copyright (C) 2019 Aleksandar Markovic <amarkovic@wavecomp.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -23,8 +23,8 @@ #include <stdint.h> #include "../../../../include/wrappers_msa.h" -#include "../../../../include/test_inputs.h" -#include "../../../../include/test_utils.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) + \ diff --git a/tests/tcg/mips/user/ase/msa/int-compare/test_msa_ceq_d.c b/tests/tcg/mips/user/ase/msa/int-compare/test_msa_ceq_d.c index e169bdc320..ef13f7d05d 100644 --- a/tests/tcg/mips/user/ase/msa/int-compare/test_msa_ceq_d.c +++ b/tests/tcg/mips/user/ase/msa/int-compare/test_msa_ceq_d.c @@ -1,8 +1,8 @@ /* * Test program for MSA instruction CEQ.D * - * Copyright (C) 2018 Wave Computing, Inc. - * Copyright (C) 2018 Aleksandar Markovic <amarkovic@wavecomp.com> + * Copyright (C) 2019 Wave Computing, Inc. + * Copyright (C) 2019 Aleksandar Markovic <amarkovic@wavecomp.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -23,8 +23,8 @@ #include <stdint.h> #include "../../../../include/wrappers_msa.h" -#include "../../../../include/test_inputs.h" -#include "../../../../include/test_utils.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) + \ diff --git a/tests/tcg/mips/user/ase/msa/int-compare/test_msa_ceq_h.c b/tests/tcg/mips/user/ase/msa/int-compare/test_msa_ceq_h.c index 9f03cb0b2b..1c43d40ee1 100644 --- a/tests/tcg/mips/user/ase/msa/int-compare/test_msa_ceq_h.c +++ b/tests/tcg/mips/user/ase/msa/int-compare/test_msa_ceq_h.c @@ -1,8 +1,8 @@ /* * Test program for MSA instruction CEQ.H * - * Copyright (C) 2018 Wave Computing, Inc. - * Copyright (C) 2018 Aleksandar Markovic <amarkovic@wavecomp.com> + * Copyright (C) 2019 Wave Computing, Inc. + * Copyright (C) 2019 Aleksandar Markovic <amarkovic@wavecomp.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -23,8 +23,8 @@ #include <stdint.h> #include "../../../../include/wrappers_msa.h" -#include "../../../../include/test_inputs.h" -#include "../../../../include/test_utils.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) + \ diff --git a/tests/tcg/mips/user/ase/msa/int-compare/test_msa_ceq_w.c b/tests/tcg/mips/user/ase/msa/int-compare/test_msa_ceq_w.c index a927d96a89..1297d41f29 100644 --- a/tests/tcg/mips/user/ase/msa/int-compare/test_msa_ceq_w.c +++ b/tests/tcg/mips/user/ase/msa/int-compare/test_msa_ceq_w.c @@ -1,8 +1,8 @@ /* * Test program for MSA instruction CEQ.W * - * Copyright (C) 2018 Wave Computing, Inc. - * Copyright (C) 2018 Aleksandar Markovic <amarkovic@wavecomp.com> + * Copyright (C) 2019 Wave Computing, Inc. + * Copyright (C) 2019 Aleksandar Markovic <amarkovic@wavecomp.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -23,8 +23,8 @@ #include <stdint.h> #include "../../../../include/wrappers_msa.h" -#include "../../../../include/test_inputs.h" -#include "../../../../include/test_utils.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) + \ diff --git a/tests/tcg/mips/user/ase/msa/int-compare/test_msa_cle_s_b.c b/tests/tcg/mips/user/ase/msa/int-compare/test_msa_cle_s_b.c index 1c1cb3bc4a..afd5f635f0 100644 --- a/tests/tcg/mips/user/ase/msa/int-compare/test_msa_cle_s_b.c +++ b/tests/tcg/mips/user/ase/msa/int-compare/test_msa_cle_s_b.c @@ -1,8 +1,8 @@ /* * Test program for MSA instruction CLE_S.B * - * Copyright (C) 2018 Wave Computing, Inc. - * Copyright (C) 2018 Aleksandar Markovic <amarkovic@wavecomp.com> + * Copyright (C) 2019 Wave Computing, Inc. + * Copyright (C) 2019 Aleksandar Markovic <amarkovic@wavecomp.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -23,8 +23,8 @@ #include <stdint.h> #include "../../../../include/wrappers_msa.h" -#include "../../../../include/test_inputs.h" -#include "../../../../include/test_utils.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) + \ diff --git a/tests/tcg/mips/user/ase/msa/int-compare/test_msa_cle_s_d.c b/tests/tcg/mips/user/ase/msa/int-compare/test_msa_cle_s_d.c index b51907cbc0..04d58d103c 100644 --- a/tests/tcg/mips/user/ase/msa/int-compare/test_msa_cle_s_d.c +++ b/tests/tcg/mips/user/ase/msa/int-compare/test_msa_cle_s_d.c @@ -1,8 +1,8 @@ /* * Test program for MSA instruction CLE_S.D * - * Copyright (C) 2018 Wave Computing, Inc. - * Copyright (C) 2018 Aleksandar Markovic <amarkovic@wavecomp.com> + * Copyright (C) 2019 Wave Computing, Inc. + * Copyright (C) 2019 Aleksandar Markovic <amarkovic@wavecomp.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -23,8 +23,8 @@ #include <stdint.h> #include "../../../../include/wrappers_msa.h" -#include "../../../../include/test_inputs.h" -#include "../../../../include/test_utils.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) + \ diff --git a/tests/tcg/mips/user/ase/msa/int-compare/test_msa_cle_s_h.c b/tests/tcg/mips/user/ase/msa/int-compare/test_msa_cle_s_h.c index 20ebbfbafb..ed1a1e21bd 100644 --- a/tests/tcg/mips/user/ase/msa/int-compare/test_msa_cle_s_h.c +++ b/tests/tcg/mips/user/ase/msa/int-compare/test_msa_cle_s_h.c @@ -1,8 +1,8 @@ /* * Test program for MSA instruction CLE_S.H * - * Copyright (C) 2018 Wave Computing, Inc. - * Copyright (C) 2018 Aleksandar Markovic <amarkovic@wavecomp.com> + * Copyright (C) 2019 Wave Computing, Inc. + * Copyright (C) 2019 Aleksandar Markovic <amarkovic@wavecomp.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -23,8 +23,8 @@ #include <stdint.h> #include "../../../../include/wrappers_msa.h" -#include "../../../../include/test_inputs.h" -#include "../../../../include/test_utils.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) + \ diff --git a/tests/tcg/mips/user/ase/msa/int-compare/test_msa_cle_s_w.c b/tests/tcg/mips/user/ase/msa/int-compare/test_msa_cle_s_w.c index 4a78cce460..ea4dc1a30b 100644 --- a/tests/tcg/mips/user/ase/msa/int-compare/test_msa_cle_s_w.c +++ b/tests/tcg/mips/user/ase/msa/int-compare/test_msa_cle_s_w.c @@ -1,8 +1,8 @@ /* * Test program for MSA instruction CLE_S.W * - * Copyright (C) 2018 Wave Computing, Inc. - * Copyright (C) 2018 Aleksandar Markovic <amarkovic@wavecomp.com> + * Copyright (C) 2019 Wave Computing, Inc. + * Copyright (C) 2019 Aleksandar Markovic <amarkovic@wavecomp.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -23,8 +23,8 @@ #include <stdint.h> #include "../../../../include/wrappers_msa.h" -#include "../../../../include/test_inputs.h" -#include "../../../../include/test_utils.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) + \ diff --git a/tests/tcg/mips/user/ase/msa/int-compare/test_msa_cle_u_b.c b/tests/tcg/mips/user/ase/msa/int-compare/test_msa_cle_u_b.c index 9990a5b08a..6e4fdd83ec 100644 --- a/tests/tcg/mips/user/ase/msa/int-compare/test_msa_cle_u_b.c +++ b/tests/tcg/mips/user/ase/msa/int-compare/test_msa_cle_u_b.c @@ -1,8 +1,8 @@ /* * Test program for MSA instruction CLE_U.B * - * Copyright (C) 2018 Wave Computing, Inc. - * Copyright (C) 2018 Aleksandar Markovic <amarkovic@wavecomp.com> + * Copyright (C) 2019 Wave Computing, Inc. + * Copyright (C) 2019 Aleksandar Markovic <amarkovic@wavecomp.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -23,8 +23,8 @@ #include <stdint.h> #include "../../../../include/wrappers_msa.h" -#include "../../../../include/test_inputs.h" -#include "../../../../include/test_utils.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) + \ diff --git a/tests/tcg/mips/user/ase/msa/int-compare/test_msa_cle_u_d.c b/tests/tcg/mips/user/ase/msa/int-compare/test_msa_cle_u_d.c index cde86d824a..b2b2f557b8 100644 --- a/tests/tcg/mips/user/ase/msa/int-compare/test_msa_cle_u_d.c +++ b/tests/tcg/mips/user/ase/msa/int-compare/test_msa_cle_u_d.c @@ -1,8 +1,8 @@ /* * Test program for MSA instruction CLE_U.D * - * Copyright (C) 2018 Wave Computing, Inc. - * Copyright (C) 2018 Aleksandar Markovic <amarkovic@wavecomp.com> + * Copyright (C) 2019 Wave Computing, Inc. + * Copyright (C) 2019 Aleksandar Markovic <amarkovic@wavecomp.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -23,8 +23,8 @@ #include <stdint.h> #include "../../../../include/wrappers_msa.h" -#include "../../../../include/test_inputs.h" -#include "../../../../include/test_utils.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) + \ diff --git a/tests/tcg/mips/user/ase/msa/int-compare/test_msa_cle_u_h.c b/tests/tcg/mips/user/ase/msa/int-compare/test_msa_cle_u_h.c index 70e4b48de5..b2267752eb 100644 --- a/tests/tcg/mips/user/ase/msa/int-compare/test_msa_cle_u_h.c +++ b/tests/tcg/mips/user/ase/msa/int-compare/test_msa_cle_u_h.c @@ -1,8 +1,8 @@ /* * Test program for MSA instruction CLE_U.H * - * Copyright (C) 2018 Wave Computing, Inc. - * Copyright (C) 2018 Aleksandar Markovic <amarkovic@wavecomp.com> + * Copyright (C) 2019 Wave Computing, Inc. + * Copyright (C) 2019 Aleksandar Markovic <amarkovic@wavecomp.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -23,8 +23,8 @@ #include <stdint.h> #include "../../../../include/wrappers_msa.h" -#include "../../../../include/test_inputs.h" -#include "../../../../include/test_utils.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) + \ diff --git a/tests/tcg/mips/user/ase/msa/int-compare/test_msa_cle_u_w.c b/tests/tcg/mips/user/ase/msa/int-compare/test_msa_cle_u_w.c index f38feacef2..00e930c0c7 100644 --- a/tests/tcg/mips/user/ase/msa/int-compare/test_msa_cle_u_w.c +++ b/tests/tcg/mips/user/ase/msa/int-compare/test_msa_cle_u_w.c @@ -1,8 +1,8 @@ /* * Test program for MSA instruction CLE_U.W * - * Copyright (C) 2018 Wave Computing, Inc. - * Copyright (C) 2018 Aleksandar Markovic <amarkovic@wavecomp.com> + * Copyright (C) 2019 Wave Computing, Inc. + * Copyright (C) 2019 Aleksandar Markovic <amarkovic@wavecomp.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -23,8 +23,8 @@ #include <stdint.h> #include "../../../../include/wrappers_msa.h" -#include "../../../../include/test_inputs.h" -#include "../../../../include/test_utils.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) + \ diff --git a/tests/tcg/mips/user/ase/msa/int-compare/test_msa_clt_s_b.c b/tests/tcg/mips/user/ase/msa/int-compare/test_msa_clt_s_b.c index b81b569498..4a52ebe491 100644 --- a/tests/tcg/mips/user/ase/msa/int-compare/test_msa_clt_s_b.c +++ b/tests/tcg/mips/user/ase/msa/int-compare/test_msa_clt_s_b.c @@ -1,8 +1,8 @@ /* * Test program for MSA instruction CLT_S.B * - * Copyright (C) 2018 Wave Computing, Inc. - * Copyright (C) 2018 Aleksandar Markovic <amarkovic@wavecomp.com> + * Copyright (C) 2019 Wave Computing, Inc. + * Copyright (C) 2019 Aleksandar Markovic <amarkovic@wavecomp.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -23,8 +23,8 @@ #include <stdint.h> #include "../../../../include/wrappers_msa.h" -#include "../../../../include/test_inputs.h" -#include "../../../../include/test_utils.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) + \ diff --git a/tests/tcg/mips/user/ase/msa/int-compare/test_msa_clt_s_d.c b/tests/tcg/mips/user/ase/msa/int-compare/test_msa_clt_s_d.c index 393457a3c1..cc945cdf8d 100644 --- a/tests/tcg/mips/user/ase/msa/int-compare/test_msa_clt_s_d.c +++ b/tests/tcg/mips/user/ase/msa/int-compare/test_msa_clt_s_d.c @@ -1,8 +1,8 @@ /* * Test program for MSA instruction CLT_S.D * - * Copyright (C) 2018 Wave Computing, Inc. - * Copyright (C) 2018 Aleksandar Markovic <amarkovic@wavecomp.com> + * Copyright (C) 2019 Wave Computing, Inc. + * Copyright (C) 2019 Aleksandar Markovic <amarkovic@wavecomp.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -23,8 +23,8 @@ #include <stdint.h> #include "../../../../include/wrappers_msa.h" -#include "../../../../include/test_inputs.h" -#include "../../../../include/test_utils.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) + \ diff --git a/tests/tcg/mips/user/ase/msa/int-compare/test_msa_clt_s_h.c b/tests/tcg/mips/user/ase/msa/int-compare/test_msa_clt_s_h.c index 56860d7bcc..b228dfe7f5 100644 --- a/tests/tcg/mips/user/ase/msa/int-compare/test_msa_clt_s_h.c +++ b/tests/tcg/mips/user/ase/msa/int-compare/test_msa_clt_s_h.c @@ -1,8 +1,8 @@ /* * Test program for MSA instruction CLT_S.H * - * Copyright (C) 2018 Wave Computing, Inc. - * Copyright (C) 2018 Aleksandar Markovic <amarkovic@wavecomp.com> + * Copyright (C) 2019 Wave Computing, Inc. + * Copyright (C) 2019 Aleksandar Markovic <amarkovic@wavecomp.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -23,8 +23,8 @@ #include <stdint.h> #include "../../../../include/wrappers_msa.h" -#include "../../../../include/test_inputs.h" -#include "../../../../include/test_utils.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) + \ diff --git a/tests/tcg/mips/user/ase/msa/int-compare/test_msa_clt_s_w.c b/tests/tcg/mips/user/ase/msa/int-compare/test_msa_clt_s_w.c index 346b2939bb..6cb192a851 100644 --- a/tests/tcg/mips/user/ase/msa/int-compare/test_msa_clt_s_w.c +++ b/tests/tcg/mips/user/ase/msa/int-compare/test_msa_clt_s_w.c @@ -1,8 +1,8 @@ /* * Test program for MSA instruction CLT_S.W * - * Copyright (C) 2018 Wave Computing, Inc. - * Copyright (C) 2018 Aleksandar Markovic <amarkovic@wavecomp.com> + * Copyright (C) 2019 Wave Computing, Inc. + * Copyright (C) 2019 Aleksandar Markovic <amarkovic@wavecomp.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -23,8 +23,8 @@ #include <stdint.h> #include "../../../../include/wrappers_msa.h" -#include "../../../../include/test_inputs.h" -#include "../../../../include/test_utils.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) + \ diff --git a/tests/tcg/mips/user/ase/msa/int-compare/test_msa_clt_u_b.c b/tests/tcg/mips/user/ase/msa/int-compare/test_msa_clt_u_b.c index be79646b45..b6189d6b72 100644 --- a/tests/tcg/mips/user/ase/msa/int-compare/test_msa_clt_u_b.c +++ b/tests/tcg/mips/user/ase/msa/int-compare/test_msa_clt_u_b.c @@ -1,8 +1,8 @@ /* * Test program for MSA instruction CLT_U.B * - * Copyright (C) 2018 Wave Computing, Inc. - * Copyright (C) 2018 Aleksandar Markovic <amarkovic@wavecomp.com> + * Copyright (C) 2019 Wave Computing, Inc. + * Copyright (C) 2019 Aleksandar Markovic <amarkovic@wavecomp.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -23,8 +23,8 @@ #include <stdint.h> #include "../../../../include/wrappers_msa.h" -#include "../../../../include/test_inputs.h" -#include "../../../../include/test_utils.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) + \ diff --git a/tests/tcg/mips/user/ase/msa/int-compare/test_msa_clt_u_d.c b/tests/tcg/mips/user/ase/msa/int-compare/test_msa_clt_u_d.c index afbe4904f8..4f547d8f0b 100644 --- a/tests/tcg/mips/user/ase/msa/int-compare/test_msa_clt_u_d.c +++ b/tests/tcg/mips/user/ase/msa/int-compare/test_msa_clt_u_d.c @@ -1,8 +1,8 @@ /* * Test program for MSA instruction CLT_U.D * - * Copyright (C) 2018 Wave Computing, Inc. - * Copyright (C) 2018 Aleksandar Markovic <amarkovic@wavecomp.com> + * Copyright (C) 2019 Wave Computing, Inc. + * Copyright (C) 2019 Aleksandar Markovic <amarkovic@wavecomp.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -23,8 +23,8 @@ #include <stdint.h> #include "../../../../include/wrappers_msa.h" -#include "../../../../include/test_inputs.h" -#include "../../../../include/test_utils.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) + \ diff --git a/tests/tcg/mips/user/ase/msa/int-compare/test_msa_clt_u_h.c b/tests/tcg/mips/user/ase/msa/int-compare/test_msa_clt_u_h.c index 126597af9d..9fcd81c653 100644 --- a/tests/tcg/mips/user/ase/msa/int-compare/test_msa_clt_u_h.c +++ b/tests/tcg/mips/user/ase/msa/int-compare/test_msa_clt_u_h.c @@ -1,8 +1,8 @@ /* * Test program for MSA instruction CLT_U.H * - * Copyright (C) 2018 Wave Computing, Inc. - * Copyright (C) 2018 Aleksandar Markovic <amarkovic@wavecomp.com> + * Copyright (C) 2019 Wave Computing, Inc. + * Copyright (C) 2019 Aleksandar Markovic <amarkovic@wavecomp.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -23,8 +23,8 @@ #include <stdint.h> #include "../../../../include/wrappers_msa.h" -#include "../../../../include/test_inputs.h" -#include "../../../../include/test_utils.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) + \ diff --git a/tests/tcg/mips/user/ase/msa/int-compare/test_msa_clt_u_w.c b/tests/tcg/mips/user/ase/msa/int-compare/test_msa_clt_u_w.c index b4059292cd..8f648afa62 100644 --- a/tests/tcg/mips/user/ase/msa/int-compare/test_msa_clt_u_w.c +++ b/tests/tcg/mips/user/ase/msa/int-compare/test_msa_clt_u_w.c @@ -1,8 +1,8 @@ /* * Test program for MSA instruction CLT_U.W * - * Copyright (C) 2018 Wave Computing, Inc. - * Copyright (C) 2018 Aleksandar Markovic <amarkovic@wavecomp.com> + * Copyright (C) 2019 Wave Computing, Inc. + * Copyright (C) 2019 Aleksandar Markovic <amarkovic@wavecomp.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -23,8 +23,8 @@ #include <stdint.h> #include "../../../../include/wrappers_msa.h" -#include "../../../../include/test_inputs.h" -#include "../../../../include/test_utils.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) + \ diff --git a/tests/tcg/mips/user/ase/msa/int-divide/test_msa_div_s_b.c b/tests/tcg/mips/user/ase/msa/int-divide/test_msa_div_s_b.c new file mode 100644 index 0000000000..38e3670422 --- /dev/null +++ b/tests/tcg/mips/user/ase/msa/int-divide/test_msa_div_s_b.c @@ -0,0 +1,151 @@ +/* + * Test program for MSA instruction DIV_S.B + * + * Copyright (C) 2018 Wave Computing, Inc. + * Copyright (C) 2018 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.h" +#include "../../../../include/test_utils.h" + +#define TEST_COUNT_TOTAL ( \ + (PATTERN_INPUTS_SHORT_COUNT) * (PATTERN_INPUTS_SHORT_COUNT) + \ + (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT)) + + +int32_t main(void) +{ + char *instruction_name = "DIV_S.B"; + int32_t ret; + uint32_t i, j; + struct timeval start, end; + double elapsed_time; + + uint64_t b128_result[TEST_COUNT_TOTAL][2]; + uint64_t b128_expect[TEST_COUNT_TOTAL][2] = { + { 0x0101010101010101ULL, 0x0101010101010101ULL, }, /* 0 */ + { 0x0101010101010101ULL, 0x0101010101010101ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 8 */ + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x5656565656565656ULL, 0x5656565656565656ULL, }, /* 16 */ + { 0x0101010101010101ULL, 0x0101010101010101ULL, }, + { 0x0101010101010101ULL, 0x0101010101010101ULL, }, + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, + { 0x0101010101010101ULL, 0x0101010101010101ULL, }, + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, + { 0x0200ff0200ff0200ULL, 0xff0200ff0200ff02ULL, }, + { 0xfd0001fd0001fd00ULL, 0x01fd0001fd0001fdULL, }, + { 0xababababababababULL, 0xababababababababULL, }, /* 24 */ + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0101010101010101ULL, 0x0101010101010101ULL, }, + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, + { 0x0101010101010101ULL, 0x0101010101010101ULL, }, + { 0xfe0001fe0001fe00ULL, 0x01fe0001fe0001feULL, }, + { 0x0300ff0300ff0300ULL, 0xff0300ff0300ff03ULL, }, + { 0x3434343434343434ULL, 0x3434343434343434ULL, }, /* 32 */ + { 0x0101010101010101ULL, 0x0101010101010101ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0101010101010101ULL, 0x0101010101010101ULL, }, + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, + { 0x0100000100000100ULL, 0x0001000001000001ULL, }, + { 0xff0000ff0000ff00ULL, 0x00ff0000ff0000ffULL, }, + { 0xcdcdcdcdcdcdcdcdULL, 0xcdcdcdcdcdcdcdcdULL, }, /* 40 */ + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0101010101010101ULL, 0x0101010101010101ULL, }, + { 0xff0000ff0000ff00ULL, 0x00ff0000ff0000ffULL, }, + { 0x0100000100000100ULL, 0x0001000001000001ULL, }, + { 0x1d72c81d72c81d72ULL, 0xc81d72c81d72c81dULL, }, /* 48 */ + { 0x0101ff0101ff0101ULL, 0xff0101ff0101ff01ULL, }, + { 0x0001000001000001ULL, 0x0000010000010000ULL, }, + { 0x00ff0000ff0000ffULL, 0x0000ff0000ff0000ULL, }, + { 0x0002ff0002ff0002ULL, 0xff0002ff0002ff00ULL, }, + { 0x00fe0100fe0100feULL, 0x0100fe0100fe0100ULL, }, + { 0x0101010101010101ULL, 0x0101010101010101ULL, }, + { 0xffff00ffff00ffffULL, 0x00ffff00ffff00ffULL, }, + { 0xe48f39e48f39e48fULL, 0x39e48f39e48f39e4ULL, }, /* 56 */ + { 0xffff01ffff01ffffULL, 0x01ffff01ffff01ffULL, }, + { 0x00ff0000ff0000ffULL, 0x0000ff0000ff0000ULL, }, + { 0x0001000001000001ULL, 0x0000010000010000ULL, }, + { 0x00fe0100fe0100feULL, 0x0100fe0100fe0100ULL, }, + { 0x0002ff0002ff0002ULL, 0xff0002ff0002ff00ULL, }, + { 0x0000ff0000ff0000ULL, 0xff0000ff0000ff00ULL, }, + { 0x0101010101010101ULL, 0x0101010101010101ULL, }, + { 0x0101010101010101ULL, 0x0101010101010101ULL, }, /* 64 */ + { 0x18ff01000000ff08ULL, 0x04f50003000100fdULL, }, + { 0x0101000000fe0000ULL, 0x01fe00a20002fe00ULL, }, + { 0xff01ff000002fe00ULL, 0x00fa00fe00010200ULL, }, + { 0x000000ff01ff0000ULL, 0x0000fa00f600ff00ULL, }, + { 0x0101ff0101010101ULL, 0x0101010101010101ULL, }, + { 0x000000ffff020000ULL, 0x000001e600010200ULL, }, + { 0x0000000100fe0100ULL, 0x000000000000fe00ULL, }, + { 0x00000301ff00fffeULL, 0x0000fb002a000001ULL, }, /* 72 */ + { 0x10ff0100000002f0ULL, 0x02040000fc0000fbULL, }, + { 0x0101010101010101ULL, 0x0101010101010101ULL, }, + { 0x0001fdff00ff03ffULL, 0x000200000000ff00ULL, }, + { 0x000000ff02000001ULL, 0xff00f6002b0000f8ULL, }, + { 0xeaffff0001000009ULL, 0xfa0101fffc010018ULL, }, +}; + + gettimeofday(&start, NULL); + + for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) { + for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) { + do_msa_DIV_S_B(b128_pattern[i], b128_pattern[j], + b128_result[PATTERN_INPUTS_SHORT_COUNT * i + j]); + } + } + + for (i = 0; i < RANDOM_INPUTS_SHORT_COUNT; i++) { + for (j = 0; j < RANDOM_INPUTS_SHORT_COUNT; j++) { + do_msa_DIV_S_B(b128_random[i], b128_random[j], + b128_result[((PATTERN_INPUTS_SHORT_COUNT) * + (PATTERN_INPUTS_SHORT_COUNT)) + + RANDOM_INPUTS_SHORT_COUNT * i + j]); + } + } + + gettimeofday(&end, NULL); + + elapsed_time = (end.tv_sec - start.tv_sec) * 1000.0; + elapsed_time += (end.tv_usec - start.tv_usec) / 1000.0; + + ret = check_results(instruction_name, TEST_COUNT_TOTAL, elapsed_time, + &b128_result[0][0], &b128_expect[0][0]); + + return ret; +} diff --git a/tests/tcg/mips/user/ase/msa/int-divide/test_msa_div_s_d.c b/tests/tcg/mips/user/ase/msa/int-divide/test_msa_div_s_d.c new file mode 100644 index 0000000000..d92b6953e8 --- /dev/null +++ b/tests/tcg/mips/user/ase/msa/int-divide/test_msa_div_s_d.c @@ -0,0 +1,151 @@ +/* + * Test program for MSA instruction DIV_S.D + * + * Copyright (C) 2018 Wave Computing, Inc. + * Copyright (C) 2018 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.h" +#include "../../../../include/test_utils.h" + +#define TEST_COUNT_TOTAL ( \ + (PATTERN_INPUTS_SHORT_COUNT) * (PATTERN_INPUTS_SHORT_COUNT) + \ + (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT)) + + +int32_t main(void) +{ + char *instruction_name = "DIV_S.D"; + int32_t ret; + uint32_t i, j; + struct timeval start, end; + double elapsed_time; + + uint64_t b128_result[TEST_COUNT_TOTAL][2]; + uint64_t b128_expect[TEST_COUNT_TOTAL][2] = { + { 0x0000000000000001ULL, 0x0000000000000001ULL, }, /* 0 */ + { 0x0000000000000001ULL, 0x0000000000000001ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 8 */ + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x5555555555555556ULL, 0x5555555555555556ULL, }, /* 16 */ + { 0x0000000000000001ULL, 0x0000000000000001ULL, }, + { 0x0000000000000001ULL, 0x0000000000000001ULL, }, + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, + { 0x0000000000000001ULL, 0x0000000000000001ULL, }, + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, + { 0x0000000000000003ULL, 0xffffffffffffffffULL, }, + { 0xfffffffffffffffdULL, 0x0000000000000001ULL, }, + { 0xaaaaaaaaaaaaaaabULL, 0xaaaaaaaaaaaaaaabULL, }, /* 24 */ + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000001ULL, 0x0000000000000001ULL, }, + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, + { 0x0000000000000001ULL, 0x0000000000000001ULL, }, + { 0xfffffffffffffffeULL, 0x0000000000000001ULL, }, + { 0x0000000000000003ULL, 0xffffffffffffffffULL, }, + { 0x3333333333333334ULL, 0x3333333333333334ULL, }, /* 32 */ + { 0x0000000000000001ULL, 0x0000000000000001ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000001ULL, 0x0000000000000001ULL, }, + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, + { 0x0000000000000001ULL, 0x0000000000000000ULL, }, + { 0xffffffffffffffffULL, 0x0000000000000000ULL, }, + { 0xcccccccccccccccdULL, 0xcccccccccccccccdULL, }, /* 40 */ + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000001ULL, 0x0000000000000001ULL, }, + { 0xffffffffffffffffULL, 0x0000000000000000ULL, }, + { 0x0000000000000001ULL, 0x0000000000000000ULL, }, + { 0x1c71c71c71c71c72ULL, 0xc71c71c71c71c71dULL, }, /* 48 */ + { 0x0000000000000001ULL, 0xffffffffffffffffULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0xffffffffffffffffULL, }, + { 0x0000000000000000ULL, 0x0000000000000001ULL, }, + { 0x0000000000000001ULL, 0x0000000000000001ULL, }, + { 0xffffffffffffffffULL, 0x0000000000000000ULL, }, + { 0xe38e38e38e38e38fULL, 0x38e38e38e38e38e4ULL, }, /* 56 */ + { 0xffffffffffffffffULL, 0x0000000000000001ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000001ULL, }, + { 0x0000000000000000ULL, 0xffffffffffffffffULL, }, + { 0x0000000000000000ULL, 0xffffffffffffffffULL, }, + { 0x0000000000000001ULL, 0x0000000000000001ULL, }, + { 0x0000000000000001ULL, 0x0000000000000001ULL, }, /* 64 */ + { 0x000000000000001cULL, 0x0000000000000003ULL, }, + { 0x0000000000000001ULL, 0x0000000000000001ULL, }, + { 0xffffffffffffffffULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000001ULL, 0x0000000000000001ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 72 */ + { 0x0000000000000013ULL, 0x0000000000000002ULL, }, + { 0x0000000000000001ULL, 0x0000000000000001ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0xffffffffffffffffULL, }, + { 0xffffffffffffffe6ULL, 0xfffffffffffffffaULL, }, +}; + + gettimeofday(&start, NULL); + + for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) { + for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) { + do_msa_DIV_S_D(b128_pattern[i], b128_pattern[j], + b128_result[PATTERN_INPUTS_SHORT_COUNT * i + j]); + } + } + + for (i = 0; i < RANDOM_INPUTS_SHORT_COUNT; i++) { + for (j = 0; j < RANDOM_INPUTS_SHORT_COUNT; j++) { + do_msa_DIV_S_D(b128_random[i], b128_random[j], + b128_result[((PATTERN_INPUTS_SHORT_COUNT) * + (PATTERN_INPUTS_SHORT_COUNT)) + + RANDOM_INPUTS_SHORT_COUNT * i + j]); + } + } + + gettimeofday(&end, NULL); + + elapsed_time = (end.tv_sec - start.tv_sec) * 1000.0; + elapsed_time += (end.tv_usec - start.tv_usec) / 1000.0; + + ret = check_results(instruction_name, TEST_COUNT_TOTAL, elapsed_time, + &b128_result[0][0], &b128_expect[0][0]); + + return ret; +} diff --git a/tests/tcg/mips/user/ase/msa/int-divide/test_msa_div_s_h.c b/tests/tcg/mips/user/ase/msa/int-divide/test_msa_div_s_h.c new file mode 100644 index 0000000000..f191b985b1 --- /dev/null +++ b/tests/tcg/mips/user/ase/msa/int-divide/test_msa_div_s_h.c @@ -0,0 +1,151 @@ +/* + * Test program for MSA instruction DIV_S.H + * + * Copyright (C) 2018 Wave Computing, Inc. + * Copyright (C) 2018 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.h" +#include "../../../../include/test_utils.h" + +#define TEST_COUNT_TOTAL ( \ + (PATTERN_INPUTS_SHORT_COUNT) * (PATTERN_INPUTS_SHORT_COUNT) + \ + (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT)) + + +int32_t main(void) +{ + char *instruction_name = "DIV_S.H"; + int32_t ret; + uint32_t i, j; + struct timeval start, end; + double elapsed_time; + + uint64_t b128_result[TEST_COUNT_TOTAL][2]; + uint64_t b128_expect[TEST_COUNT_TOTAL][2] = { + { 0x0001000100010001ULL, 0x0001000100010001ULL, }, /* 0 */ + { 0x0001000100010001ULL, 0x0001000100010001ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 8 */ + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x5556555655565556ULL, 0x5556555655565556ULL, }, /* 16 */ + { 0x0001000100010001ULL, 0x0001000100010001ULL, }, + { 0x0001000100010001ULL, 0x0001000100010001ULL, }, + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, + { 0x0001000100010001ULL, 0x0001000100010001ULL, }, + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, + { 0x0003ffff00000003ULL, 0xffff00000003ffffULL, }, + { 0xfffd00010000fffdULL, 0x00010000fffd0001ULL, }, + { 0xaaabaaabaaabaaabULL, 0xaaabaaabaaabaaabULL, }, /* 24 */ + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0001000100010001ULL, 0x0001000100010001ULL, }, + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, + { 0x0001000100010001ULL, 0x0001000100010001ULL, }, + { 0xfffe00010000fffeULL, 0x00010000fffe0001ULL, }, + { 0x0003ffff00000003ULL, 0xffff00000003ffffULL, }, + { 0x3334333433343334ULL, 0x3334333433343334ULL, }, /* 32 */ + { 0x0001000100010001ULL, 0x0001000100010001ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0001000100010001ULL, 0x0001000100010001ULL, }, + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, + { 0x0001000000000001ULL, 0x0000000000010000ULL, }, + { 0xffff00000000ffffULL, 0x00000000ffff0000ULL, }, + { 0xcccdcccdcccdcccdULL, 0xcccdcccdcccdcccdULL, }, /* 40 */ + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0001000100010001ULL, 0x0001000100010001ULL, }, + { 0xffff00000000ffffULL, 0x00000000ffff0000ULL, }, + { 0x0001000000000001ULL, 0x0000000000010000ULL, }, + { 0x1c72c71d71c81c72ULL, 0xc71d71c81c72c71dULL, }, /* 48 */ + { 0x0001ffff00010001ULL, 0xffff00010001ffffULL, }, + { 0x0000000000010000ULL, 0x0000000100000000ULL, }, + { 0x00000000ffff0000ULL, 0x0000ffff00000000ULL, }, + { 0x0000ffff00020000ULL, 0xffff00020000ffffULL, }, + { 0x00000001fffe0000ULL, 0x0001fffe00000001ULL, }, + { 0x0001000100010001ULL, 0x0001000100010001ULL, }, + { 0xffff0000ffffffffULL, 0x0000ffffffff0000ULL, }, + { 0xe38f38e48e39e38fULL, 0x38e48e39e38f38e4ULL, }, /* 56 */ + { 0xffff0001ffffffffULL, 0x0001ffffffff0001ULL, }, + { 0x00000000ffff0000ULL, 0x0000ffff00000000ULL, }, + { 0x0000000000010000ULL, 0x0000000100000000ULL, }, + { 0x00000001fffe0000ULL, 0x0001fffe00000001ULL, }, + { 0x0000ffff00020000ULL, 0xffff00020000ffffULL, }, + { 0x0000ffff00000000ULL, 0xffff00000000ffffULL, }, + { 0x0001000100010001ULL, 0x0001000100010001ULL, }, + { 0x0001000100010001ULL, 0x0001000100010001ULL, }, /* 64 */ + { 0x001cffbf0000ffffULL, 0x0003000000000000ULL, }, + { 0x0001000000000000ULL, 0x000100000000fffeULL, }, + { 0xffffffff0000fffeULL, 0x0000000000000002ULL, }, + { 0x0000000000010000ULL, 0x0000fffafff3ffffULL, }, + { 0x0001000100010001ULL, 0x0001000100010001ULL, }, + { 0x00000000ffff0000ULL, 0x0000000100000002ULL, }, + { 0x0000000000000001ULL, 0x000000000000fffeULL, }, + { 0x00000003ffffffffULL, 0x0000fffb00370000ULL, }, /* 72 */ + { 0x0013ff2e00000002ULL, 0x00020000fffd0000ULL, }, + { 0x0001000100010001ULL, 0x0001000100010001ULL, }, + { 0x0000fffd00000003ULL, 0x000000000000ffffULL, }, + { 0x0000000000020000ULL, 0xfffffff600390000ULL, }, + { 0xffe6003900010000ULL, 0xfffa0001fffc0000ULL, }, +}; + + gettimeofday(&start, NULL); + + for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) { + for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) { + do_msa_DIV_S_H(b128_pattern[i], b128_pattern[j], + b128_result[PATTERN_INPUTS_SHORT_COUNT * i + j]); + } + } + + for (i = 0; i < RANDOM_INPUTS_SHORT_COUNT; i++) { + for (j = 0; j < RANDOM_INPUTS_SHORT_COUNT; j++) { + do_msa_DIV_S_H(b128_random[i], b128_random[j], + b128_result[((PATTERN_INPUTS_SHORT_COUNT) * + (PATTERN_INPUTS_SHORT_COUNT)) + + RANDOM_INPUTS_SHORT_COUNT * i + j]); + } + } + + gettimeofday(&end, NULL); + + elapsed_time = (end.tv_sec - start.tv_sec) * 1000.0; + elapsed_time += (end.tv_usec - start.tv_usec) / 1000.0; + + ret = check_results(instruction_name, TEST_COUNT_TOTAL, elapsed_time, + &b128_result[0][0], &b128_expect[0][0]); + + return ret; +} diff --git a/tests/tcg/mips/user/ase/msa/int-divide/test_msa_div_s_w.c b/tests/tcg/mips/user/ase/msa/int-divide/test_msa_div_s_w.c new file mode 100644 index 0000000000..0baaff10f9 --- /dev/null +++ b/tests/tcg/mips/user/ase/msa/int-divide/test_msa_div_s_w.c @@ -0,0 +1,151 @@ +/* + * Test program for MSA instruction DIV_S.W + * + * Copyright (C) 2018 Wave Computing, Inc. + * Copyright (C) 2018 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.h" +#include "../../../../include/test_utils.h" + +#define TEST_COUNT_TOTAL ( \ + (PATTERN_INPUTS_SHORT_COUNT) * (PATTERN_INPUTS_SHORT_COUNT) + \ + (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT)) + + +int32_t main(void) +{ + char *instruction_name = "DIV_S.W"; + int32_t ret; + uint32_t i, j; + struct timeval start, end; + double elapsed_time; + + uint64_t b128_result[TEST_COUNT_TOTAL][2]; + uint64_t b128_expect[TEST_COUNT_TOTAL][2] = { + { 0x0000000100000001ULL, 0x0000000100000001ULL, }, /* 0 */ + { 0x0000000100000001ULL, 0x0000000100000001ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 8 */ + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x5555555655555556ULL, 0x5555555655555556ULL, }, /* 16 */ + { 0x0000000100000001ULL, 0x0000000100000001ULL, }, + { 0x0000000100000001ULL, 0x0000000100000001ULL, }, + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, + { 0x0000000100000001ULL, 0x0000000100000001ULL, }, + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, + { 0x0000000200000000ULL, 0xffffffff00000002ULL, }, + { 0xfffffffd00000000ULL, 0x00000001fffffffdULL, }, + { 0xaaaaaaabaaaaaaabULL, 0xaaaaaaabaaaaaaabULL, }, /* 24 */ + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000100000001ULL, 0x0000000100000001ULL, }, + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, + { 0x0000000100000001ULL, 0x0000000100000001ULL, }, + { 0xfffffffe00000000ULL, 0x00000001fffffffeULL, }, + { 0x0000000300000000ULL, 0xffffffff00000003ULL, }, + { 0x3333333433333334ULL, 0x3333333433333334ULL, }, /* 32 */ + { 0x0000000100000001ULL, 0x0000000100000001ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000100000001ULL, 0x0000000100000001ULL, }, + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, + { 0x0000000100000000ULL, 0x0000000000000001ULL, }, + { 0xffffffff00000000ULL, 0x00000000ffffffffULL, }, + { 0xcccccccdcccccccdULL, 0xcccccccdcccccccdULL, }, /* 40 */ + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000100000001ULL, 0x0000000100000001ULL, }, + { 0xffffffff00000000ULL, 0x00000000ffffffffULL, }, + { 0x0000000100000000ULL, 0x0000000000000001ULL, }, + { 0x1c71c71d71c71c72ULL, 0xc71c71c81c71c71dULL, }, /* 48 */ + { 0x0000000100000001ULL, 0xffffffff00000001ULL, }, + { 0x0000000000000001ULL, 0x0000000000000000ULL, }, + { 0x00000000ffffffffULL, 0x0000000000000000ULL, }, + { 0x0000000000000002ULL, 0xffffffff00000000ULL, }, + { 0x00000000fffffffeULL, 0x0000000100000000ULL, }, + { 0x0000000100000001ULL, 0x0000000100000001ULL, }, + { 0xffffffffffffffffULL, 0x00000000ffffffffULL, }, + { 0xe38e38e48e38e38fULL, 0x38e38e39e38e38e4ULL, }, /* 56 */ + { 0xffffffffffffffffULL, 0x00000001ffffffffULL, }, + { 0x00000000ffffffffULL, 0x0000000000000000ULL, }, + { 0x0000000000000001ULL, 0x0000000000000000ULL, }, + { 0x00000000fffffffeULL, 0x0000000100000000ULL, }, + { 0x0000000000000002ULL, 0xffffffff00000000ULL, }, + { 0x0000000000000000ULL, 0xffffffff00000000ULL, }, + { 0x0000000100000001ULL, 0x0000000100000001ULL, }, + { 0x0000000100000001ULL, 0x0000000100000001ULL, }, /* 64 */ + { 0x0000001c00000000ULL, 0x0000000300000000ULL, }, + { 0x0000000100000000ULL, 0x0000000100000000ULL, }, + { 0xffffffff00000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000001ULL, 0x00000000fffffff2ULL, }, + { 0x0000000100000001ULL, 0x0000000100000001ULL, }, + { 0x00000000ffffffffULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x00000000ffffffffULL, 0x0000000000000037ULL, }, /* 72 */ + { 0x0000001300000000ULL, 0x00000002fffffffdULL, }, + { 0x0000000100000001ULL, 0x0000000100000001ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000002ULL, 0xffffffff00000039ULL, }, + { 0xffffffe600000001ULL, 0xfffffffafffffffcULL, }, +}; + + gettimeofday(&start, NULL); + + for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) { + for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) { + do_msa_DIV_S_W(b128_pattern[i], b128_pattern[j], + b128_result[PATTERN_INPUTS_SHORT_COUNT * i + j]); + } + } + + for (i = 0; i < RANDOM_INPUTS_SHORT_COUNT; i++) { + for (j = 0; j < RANDOM_INPUTS_SHORT_COUNT; j++) { + do_msa_DIV_S_W(b128_random[i], b128_random[j], + b128_result[((PATTERN_INPUTS_SHORT_COUNT) * + (PATTERN_INPUTS_SHORT_COUNT)) + + RANDOM_INPUTS_SHORT_COUNT * i + j]); + } + } + + gettimeofday(&end, NULL); + + elapsed_time = (end.tv_sec - start.tv_sec) * 1000.0; + elapsed_time += (end.tv_usec - start.tv_usec) / 1000.0; + + ret = check_results(instruction_name, TEST_COUNT_TOTAL, elapsed_time, + &b128_result[0][0], &b128_expect[0][0]); + + return ret; +} diff --git a/tests/tcg/mips/user/ase/msa/int-divide/test_msa_div_u_b.c b/tests/tcg/mips/user/ase/msa/int-divide/test_msa_div_u_b.c new file mode 100644 index 0000000000..770544a2de --- /dev/null +++ b/tests/tcg/mips/user/ase/msa/int-divide/test_msa_div_u_b.c @@ -0,0 +1,151 @@ +/* + * Test program for MSA instruction DIV_U.B + * + * Copyright (C) 2018 Wave Computing, Inc. + * Copyright (C) 2018 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.h" +#include "../../../../include/test_utils.h" + +#define TEST_COUNT_TOTAL ( \ + (PATTERN_INPUTS_SHORT_COUNT) * (PATTERN_INPUTS_SHORT_COUNT) + \ + (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT)) + + +int32_t main(void) +{ + char *instruction_name = "DIV_U.B"; + int32_t ret; + uint32_t i, j; + struct timeval start, end; + double elapsed_time; + + uint64_t b128_result[TEST_COUNT_TOTAL][2]; + uint64_t b128_expect[TEST_COUNT_TOTAL][2] = { + { 0x0101010101010101ULL, 0x0101010101010101ULL, }, /* 0 */ + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, + { 0x0101010101010101ULL, 0x0101010101010101ULL, }, + { 0x0303030303030303ULL, 0x0303030303030303ULL, }, + { 0x0101010101010101ULL, 0x0101010101010101ULL, }, + { 0x0505050505050505ULL, 0x0505050505050505ULL, }, + { 0x0101040101040101ULL, 0x0401010401010401ULL, }, + { 0x0902010902010902ULL, 0x0109020109020109ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 8 */ + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 16 */ + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, + { 0x0101010101010101ULL, 0x0101010101010101ULL, }, + { 0x0202020202020202ULL, 0x0202020202020202ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0303030303030303ULL, 0x0303030303030303ULL, }, + { 0x0001030001030001ULL, 0x0300010300010300ULL, }, + { 0x0601000601000601ULL, 0x0006010006010006ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 24 */ + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0101010101010101ULL, 0x0101010101010101ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0101010101010101ULL, 0x0101010101010101ULL, }, + { 0x0000010000010000ULL, 0x0100000100000100ULL, }, + { 0x0300000300000300ULL, 0x0003000003000003ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 32 */ + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, + { 0x0101010101010101ULL, 0x0101010101010101ULL, }, + { 0x0202020202020202ULL, 0x0202020202020202ULL, }, + { 0x0101010101010101ULL, 0x0101010101010101ULL, }, + { 0x0404040404040404ULL, 0x0404040404040404ULL, }, + { 0x0001030001030001ULL, 0x0300010300010300ULL, }, + { 0x0701010701010701ULL, 0x0107010107010107ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 40 */ + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0101010101010101ULL, 0x0101010101010101ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0100000100000100ULL, 0x0001000001000001ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 48 */ + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, + { 0x0100000100000100ULL, 0x0001000001000001ULL, }, + { 0x0201000201000201ULL, 0x0002010002010002ULL, }, + { 0x0100000100000100ULL, 0x0001000001000001ULL, }, + { 0x0402010402010402ULL, 0x0104020104020104ULL, }, + { 0x0101010101010101ULL, 0x0101010101010101ULL, }, + { 0x0801000801000801ULL, 0x0008010008010008ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 56 */ + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, + { 0x0000010000010000ULL, 0x0100000100000100ULL, }, + { 0x0001020001020001ULL, 0x0200010200010200ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0002030002030002ULL, 0x0300020300020300ULL, }, + { 0x0000030000030000ULL, 0x0300000300000300ULL, }, + { 0x0101010101010101ULL, 0x0101010101010101ULL, }, + { 0x0101010101010101ULL, 0x0101010101010101ULL, }, /* 64 */ + { 0x0000ff0200000008ULL, 0x040000030c010200ULL, }, + { 0x0001010100000000ULL, 0x0100000001020400ULL, }, + { 0x01010a0200020000ULL, 0x0000000001010000ULL, }, + { 0x0101000001010200ULL, 0x0002110000000015ULL, }, + { 0x0101ff0101010101ULL, 0x0101010101010101ULL, }, + { 0x0102000000000100ULL, 0x000100000001020cULL, }, + { 0x0202000100030000ULL, 0x0001010000000001ULL, }, + { 0x0100000004020102ULL, 0x0002120200000001ULL, }, /* 72 */ + { 0x0000ff0102010010ULL, 0x0200010908000000ULL, }, + { 0x0101010101010101ULL, 0x0101010101010101ULL, }, + { 0x0101070201040001ULL, 0x0000010101000000ULL, }, + { 0x0000000002000201ULL, 0x01020c020000010dULL, }, + { 0x0000ff0001000109ULL, 0x0700000808010200ULL, }, +}; + + gettimeofday(&start, NULL); + + for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) { + for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) { + do_msa_DIV_U_B(b128_pattern[i], b128_pattern[j], + b128_result[PATTERN_INPUTS_SHORT_COUNT * i + j]); + } + } + + for (i = 0; i < RANDOM_INPUTS_SHORT_COUNT; i++) { + for (j = 0; j < RANDOM_INPUTS_SHORT_COUNT; j++) { + do_msa_DIV_U_B(b128_random[i], b128_random[j], + b128_result[((PATTERN_INPUTS_SHORT_COUNT) * + (PATTERN_INPUTS_SHORT_COUNT)) + + RANDOM_INPUTS_SHORT_COUNT * i + j]); + } + } + + gettimeofday(&end, NULL); + + elapsed_time = (end.tv_sec - start.tv_sec) * 1000.0; + elapsed_time += (end.tv_usec - start.tv_usec) / 1000.0; + + ret = check_results(instruction_name, TEST_COUNT_TOTAL, elapsed_time, + &b128_result[0][0], &b128_expect[0][0]); + + return ret; +} diff --git a/tests/tcg/mips/user/ase/msa/int-divide/test_msa_div_u_d.c b/tests/tcg/mips/user/ase/msa/int-divide/test_msa_div_u_d.c new file mode 100644 index 0000000000..9653e7db5c --- /dev/null +++ b/tests/tcg/mips/user/ase/msa/int-divide/test_msa_div_u_d.c @@ -0,0 +1,151 @@ +/* + * Test program for MSA instruction DIV_U.D + * + * Copyright (C) 2018 Wave Computing, Inc. + * Copyright (C) 2018 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.h" +#include "../../../../include/test_utils.h" + +#define TEST_COUNT_TOTAL ( \ + (PATTERN_INPUTS_SHORT_COUNT) * (PATTERN_INPUTS_SHORT_COUNT) + \ + (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT)) + + +int32_t main(void) +{ + char *instruction_name = "DIV_U.D"; + int32_t ret; + uint32_t i, j; + struct timeval start, end; + double elapsed_time; + + uint64_t b128_result[TEST_COUNT_TOTAL][2]; + uint64_t b128_expect[TEST_COUNT_TOTAL][2] = { + { 0x0000000000000001ULL, 0x0000000000000001ULL, }, /* 0 */ + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, + { 0x0000000000000001ULL, 0x0000000000000001ULL, }, + { 0x0000000000000003ULL, 0x0000000000000003ULL, }, + { 0x0000000000000001ULL, 0x0000000000000001ULL, }, + { 0x0000000000000005ULL, 0x0000000000000005ULL, }, + { 0x0000000000000001ULL, 0x0000000000000004ULL, }, + { 0x0000000000000009ULL, 0x0000000000000001ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 8 */ + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 16 */ + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, + { 0x0000000000000001ULL, 0x0000000000000001ULL, }, + { 0x0000000000000002ULL, 0x0000000000000002ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000003ULL, 0x0000000000000003ULL, }, + { 0x0000000000000000ULL, 0x0000000000000003ULL, }, + { 0x0000000000000006ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 24 */ + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000001ULL, 0x0000000000000001ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000001ULL, 0x0000000000000001ULL, }, + { 0x0000000000000000ULL, 0x0000000000000001ULL, }, + { 0x0000000000000003ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 32 */ + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, + { 0x0000000000000001ULL, 0x0000000000000001ULL, }, + { 0x0000000000000002ULL, 0x0000000000000002ULL, }, + { 0x0000000000000001ULL, 0x0000000000000001ULL, }, + { 0x0000000000000004ULL, 0x0000000000000004ULL, }, + { 0x0000000000000000ULL, 0x0000000000000003ULL, }, + { 0x0000000000000007ULL, 0x0000000000000001ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 40 */ + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000001ULL, 0x0000000000000001ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000001ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 48 */ + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, + { 0x0000000000000001ULL, 0x0000000000000000ULL, }, + { 0x0000000000000002ULL, 0x0000000000000000ULL, }, + { 0x0000000000000001ULL, 0x0000000000000000ULL, }, + { 0x0000000000000004ULL, 0x0000000000000001ULL, }, + { 0x0000000000000001ULL, 0x0000000000000001ULL, }, + { 0x0000000000000008ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 56 */ + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, + { 0x0000000000000000ULL, 0x0000000000000001ULL, }, + { 0x0000000000000000ULL, 0x0000000000000002ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000003ULL, }, + { 0x0000000000000000ULL, 0x0000000000000003ULL, }, + { 0x0000000000000001ULL, 0x0000000000000001ULL, }, + { 0x0000000000000001ULL, 0x0000000000000001ULL, }, /* 64 */ + { 0x0000000000000000ULL, 0x0000000000000003ULL, }, + { 0x0000000000000000ULL, 0x0000000000000001ULL, }, + { 0x0000000000000001ULL, 0x0000000000000000ULL, }, + { 0x0000000000000001ULL, 0x0000000000000000ULL, }, + { 0x0000000000000001ULL, 0x0000000000000001ULL, }, + { 0x0000000000000001ULL, 0x0000000000000000ULL, }, + { 0x0000000000000002ULL, 0x0000000000000000ULL, }, + { 0x0000000000000001ULL, 0x0000000000000000ULL, }, /* 72 */ + { 0x0000000000000000ULL, 0x0000000000000002ULL, }, + { 0x0000000000000001ULL, 0x0000000000000001ULL, }, + { 0x0000000000000001ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000001ULL, }, + { 0x0000000000000000ULL, 0x0000000000000007ULL, }, +}; + + gettimeofday(&start, NULL); + + for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) { + for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) { + do_msa_DIV_U_D(b128_pattern[i], b128_pattern[j], + b128_result[PATTERN_INPUTS_SHORT_COUNT * i + j]); + } + } + + for (i = 0; i < RANDOM_INPUTS_SHORT_COUNT; i++) { + for (j = 0; j < RANDOM_INPUTS_SHORT_COUNT; j++) { + do_msa_DIV_U_D(b128_random[i], b128_random[j], + b128_result[((PATTERN_INPUTS_SHORT_COUNT) * + (PATTERN_INPUTS_SHORT_COUNT)) + + RANDOM_INPUTS_SHORT_COUNT * i + j]); + } + } + + gettimeofday(&end, NULL); + + elapsed_time = (end.tv_sec - start.tv_sec) * 1000.0; + elapsed_time += (end.tv_usec - start.tv_usec) / 1000.0; + + ret = check_results(instruction_name, TEST_COUNT_TOTAL, elapsed_time, + &b128_result[0][0], &b128_expect[0][0]); + + return ret; +} diff --git a/tests/tcg/mips/user/ase/msa/int-divide/test_msa_div_u_h.c b/tests/tcg/mips/user/ase/msa/int-divide/test_msa_div_u_h.c new file mode 100644 index 0000000000..3dcd30bee9 --- /dev/null +++ b/tests/tcg/mips/user/ase/msa/int-divide/test_msa_div_u_h.c @@ -0,0 +1,151 @@ +/* + * Test program for MSA instruction DIV_U.H + * + * Copyright (C) 2018 Wave Computing, Inc. + * Copyright (C) 2018 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.h" +#include "../../../../include/test_utils.h" + +#define TEST_COUNT_TOTAL ( \ + (PATTERN_INPUTS_SHORT_COUNT) * (PATTERN_INPUTS_SHORT_COUNT) + \ + (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT)) + + +int32_t main(void) +{ + char *instruction_name = "DIV_U.H"; + int32_t ret; + uint32_t i, j; + struct timeval start, end; + double elapsed_time; + + uint64_t b128_result[TEST_COUNT_TOTAL][2]; + uint64_t b128_expect[TEST_COUNT_TOTAL][2] = { + { 0x0001000100010001ULL, 0x0001000100010001ULL, }, /* 0 */ + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, + { 0x0001000100010001ULL, 0x0001000100010001ULL, }, + { 0x0003000300030003ULL, 0x0003000300030003ULL, }, + { 0x0001000100010001ULL, 0x0001000100010001ULL, }, + { 0x0005000500050005ULL, 0x0005000500050005ULL, }, + { 0x0001000400010001ULL, 0x0004000100010004ULL, }, + { 0x0009000100020009ULL, 0x0001000200090001ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 8 */ + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 16 */ + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, + { 0x0001000100010001ULL, 0x0001000100010001ULL, }, + { 0x0002000200020002ULL, 0x0002000200020002ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0003000300030003ULL, 0x0003000300030003ULL, }, + { 0x0000000300010000ULL, 0x0003000100000003ULL, }, + { 0x0006000000010006ULL, 0x0000000100060000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 24 */ + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0001000100010001ULL, 0x0001000100010001ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0001000100010001ULL, 0x0001000100010001ULL, }, + { 0x0000000100000000ULL, 0x0001000000000001ULL, }, + { 0x0003000000000003ULL, 0x0000000000030000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 32 */ + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, + { 0x0001000100010001ULL, 0x0001000100010001ULL, }, + { 0x0002000200020002ULL, 0x0002000200020002ULL, }, + { 0x0001000100010001ULL, 0x0001000100010001ULL, }, + { 0x0004000400040004ULL, 0x0004000400040004ULL, }, + { 0x0000000300010000ULL, 0x0003000100000003ULL, }, + { 0x0007000100010007ULL, 0x0001000100070001ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 40 */ + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0001000100010001ULL, 0x0001000100010001ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0001000000000001ULL, 0x0000000000010000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 48 */ + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, + { 0x0001000000000001ULL, 0x0000000000010000ULL, }, + { 0x0002000000010002ULL, 0x0000000100020000ULL, }, + { 0x0001000000000001ULL, 0x0000000000010000ULL, }, + { 0x0004000100020004ULL, 0x0001000200040001ULL, }, + { 0x0001000100010001ULL, 0x0001000100010001ULL, }, + { 0x0008000000010008ULL, 0x0000000100080000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 56 */ + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, + { 0x0000000100000000ULL, 0x0001000000000001ULL, }, + { 0x0000000200010000ULL, 0x0002000100000002ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000300020000ULL, 0x0003000200000003ULL, }, + { 0x0000000300000000ULL, 0x0003000000000003ULL, }, + { 0x0001000100010001ULL, 0x0001000100010001ULL, }, + { 0x0001000100010001ULL, 0x0001000100010001ULL, }, /* 64 */ + { 0x0000025400000000ULL, 0x00030000000b0002ULL, }, + { 0x0000000100000000ULL, 0x0001000000010004ULL, }, + { 0x0001000a00000000ULL, 0x0000000000010000ULL, }, + { 0x0001000000010002ULL, 0x0000001000000000ULL, }, + { 0x0001000100010001ULL, 0x0001000100010001ULL, }, + { 0x0001000000000001ULL, 0x0000000000000002ULL, }, + { 0x0002000000000000ULL, 0x0000000100000000ULL, }, + { 0x0001000000040001ULL, 0x0000001100000000ULL, }, /* 72 */ + { 0x000001c300020000ULL, 0x0002000100080000ULL, }, + { 0x0001000100010001ULL, 0x0001000100010001ULL, }, + { 0x0001000700010000ULL, 0x0000000100010000ULL, }, + { 0x0000000000020002ULL, 0x0001000c00000001ULL, }, + { 0x0000003900010001ULL, 0x0007000000070002ULL, }, +}; + + gettimeofday(&start, NULL); + + for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) { + for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) { + do_msa_DIV_U_H(b128_pattern[i], b128_pattern[j], + b128_result[PATTERN_INPUTS_SHORT_COUNT * i + j]); + } + } + + for (i = 0; i < RANDOM_INPUTS_SHORT_COUNT; i++) { + for (j = 0; j < RANDOM_INPUTS_SHORT_COUNT; j++) { + do_msa_DIV_U_H(b128_random[i], b128_random[j], + b128_result[((PATTERN_INPUTS_SHORT_COUNT) * + (PATTERN_INPUTS_SHORT_COUNT)) + + RANDOM_INPUTS_SHORT_COUNT * i + j]); + } + } + + gettimeofday(&end, NULL); + + elapsed_time = (end.tv_sec - start.tv_sec) * 1000.0; + elapsed_time += (end.tv_usec - start.tv_usec) / 1000.0; + + ret = check_results(instruction_name, TEST_COUNT_TOTAL, elapsed_time, + &b128_result[0][0], &b128_expect[0][0]); + + return ret; +} diff --git a/tests/tcg/mips/user/ase/msa/int-divide/test_msa_div_u_w.c b/tests/tcg/mips/user/ase/msa/int-divide/test_msa_div_u_w.c new file mode 100644 index 0000000000..fd395ef5e9 --- /dev/null +++ b/tests/tcg/mips/user/ase/msa/int-divide/test_msa_div_u_w.c @@ -0,0 +1,151 @@ +/* + * Test program for MSA instruction DIV_U.W + * + * Copyright (C) 2018 Wave Computing, Inc. + * Copyright (C) 2018 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.h" +#include "../../../../include/test_utils.h" + +#define TEST_COUNT_TOTAL ( \ + (PATTERN_INPUTS_SHORT_COUNT) * (PATTERN_INPUTS_SHORT_COUNT) + \ + (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT)) + + +int32_t main(void) +{ + char *instruction_name = "DIV_U.W"; + int32_t ret; + uint32_t i, j; + struct timeval start, end; + double elapsed_time; + + uint64_t b128_result[TEST_COUNT_TOTAL][2]; + uint64_t b128_expect[TEST_COUNT_TOTAL][2] = { + { 0x0000000100000001ULL, 0x0000000100000001ULL, }, /* 0 */ + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, + { 0x0000000100000001ULL, 0x0000000100000001ULL, }, + { 0x0000000300000003ULL, 0x0000000300000003ULL, }, + { 0x0000000100000001ULL, 0x0000000100000001ULL, }, + { 0x0000000500000005ULL, 0x0000000500000005ULL, }, + { 0x0000000100000001ULL, 0x0000000400000001ULL, }, + { 0x0000000900000002ULL, 0x0000000100000009ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 8 */ + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 16 */ + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, + { 0x0000000100000001ULL, 0x0000000100000001ULL, }, + { 0x0000000200000002ULL, 0x0000000200000002ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000300000003ULL, 0x0000000300000003ULL, }, + { 0x0000000000000001ULL, 0x0000000300000000ULL, }, + { 0x0000000600000001ULL, 0x0000000000000006ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 24 */ + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000100000001ULL, 0x0000000100000001ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000100000001ULL, 0x0000000100000001ULL, }, + { 0x0000000000000000ULL, 0x0000000100000000ULL, }, + { 0x0000000300000000ULL, 0x0000000000000003ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 32 */ + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, + { 0x0000000100000001ULL, 0x0000000100000001ULL, }, + { 0x0000000200000002ULL, 0x0000000200000002ULL, }, + { 0x0000000100000001ULL, 0x0000000100000001ULL, }, + { 0x0000000400000004ULL, 0x0000000400000004ULL, }, + { 0x0000000000000001ULL, 0x0000000300000000ULL, }, + { 0x0000000700000001ULL, 0x0000000100000007ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 40 */ + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000100000001ULL, 0x0000000100000001ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000100000000ULL, 0x0000000000000001ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 48 */ + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, + { 0x0000000100000000ULL, 0x0000000000000001ULL, }, + { 0x0000000200000001ULL, 0x0000000000000002ULL, }, + { 0x0000000100000000ULL, 0x0000000000000001ULL, }, + { 0x0000000400000002ULL, 0x0000000100000004ULL, }, + { 0x0000000100000001ULL, 0x0000000100000001ULL, }, + { 0x0000000800000001ULL, 0x0000000000000008ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 56 */ + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, + { 0x0000000000000000ULL, 0x0000000100000000ULL, }, + { 0x0000000000000001ULL, 0x0000000200000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000002ULL, 0x0000000300000000ULL, }, + { 0x0000000000000000ULL, 0x0000000300000000ULL, }, + { 0x0000000100000001ULL, 0x0000000100000001ULL, }, + { 0x0000000100000001ULL, 0x0000000100000001ULL, }, /* 64 */ + { 0x0000000000000000ULL, 0x000000030000000bULL, }, + { 0x0000000000000000ULL, 0x0000000100000001ULL, }, + { 0x0000000100000000ULL, 0x0000000000000001ULL, }, + { 0x0000000100000001ULL, 0x0000000000000000ULL, }, + { 0x0000000100000001ULL, 0x0000000100000001ULL, }, + { 0x0000000100000000ULL, 0x0000000000000000ULL, }, + { 0x0000000200000000ULL, 0x0000000000000000ULL, }, + { 0x0000000100000004ULL, 0x0000000000000000ULL, }, /* 72 */ + { 0x0000000000000002ULL, 0x0000000200000008ULL, }, + { 0x0000000100000001ULL, 0x0000000100000001ULL, }, + { 0x0000000100000001ULL, 0x0000000000000001ULL, }, + { 0x0000000000000002ULL, 0x0000000100000000ULL, }, + { 0x0000000000000001ULL, 0x0000000700000007ULL, }, +}; + + gettimeofday(&start, NULL); + + for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) { + for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) { + do_msa_DIV_U_W(b128_pattern[i], b128_pattern[j], + b128_result[PATTERN_INPUTS_SHORT_COUNT * i + j]); + } + } + + for (i = 0; i < RANDOM_INPUTS_SHORT_COUNT; i++) { + for (j = 0; j < RANDOM_INPUTS_SHORT_COUNT; j++) { + do_msa_DIV_U_W(b128_random[i], b128_random[j], + b128_result[((PATTERN_INPUTS_SHORT_COUNT) * + (PATTERN_INPUTS_SHORT_COUNT)) + + RANDOM_INPUTS_SHORT_COUNT * i + j]); + } + } + + gettimeofday(&end, NULL); + + elapsed_time = (end.tv_sec - start.tv_sec) * 1000.0; + elapsed_time += (end.tv_usec - start.tv_usec) / 1000.0; + + ret = check_results(instruction_name, TEST_COUNT_TOTAL, elapsed_time, + &b128_result[0][0], &b128_expect[0][0]); + + return ret; +} diff --git a/tests/tcg/mips/user/ase/msa/int-dot-product/test_msa_dotp_s_d.c b/tests/tcg/mips/user/ase/msa/int-dot-product/test_msa_dotp_s_d.c new file mode 100644 index 0000000000..af8d609bea --- /dev/null +++ b/tests/tcg/mips/user/ase/msa/int-dot-product/test_msa_dotp_s_d.c @@ -0,0 +1,151 @@ +/* + * Test program for MSA instruction DOTP_S.D + * + * Copyright (C) 2018 Wave Computing, Inc. + * Copyright (C) 2018 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.h" +#include "../../../../include/test_utils.h" + +#define TEST_COUNT_TOTAL ( \ + (PATTERN_INPUTS_SHORT_COUNT) * (PATTERN_INPUTS_SHORT_COUNT) + \ + (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT)) + + +int32_t main(void) +{ + char *instruction_name = "DOTP_S.D"; + int32_t ret; + uint32_t i, j; + struct timeval start, end; + double elapsed_time; + + uint64_t b128_result[TEST_COUNT_TOTAL][2]; + uint64_t b128_expect[TEST_COUNT_TOTAL][2] = { + { 0x0000000000000002ULL, 0x0000000000000002ULL, }, /* 0 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x00000000aaaaaaacULL, 0x00000000aaaaaaacULL, }, + { 0xffffffff55555556ULL, 0xffffffff55555556ULL, }, + { 0x0000000066666668ULL, 0x0000000066666668ULL, }, + { 0xffffffff9999999aULL, 0xffffffff9999999aULL, }, + { 0x000000008e38e38fULL, 0xffffffffe38e38e5ULL, }, + { 0xffffffff71c71c73ULL, 0x000000001c71c71dULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 8 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x00000000aaaaaaacULL, 0x00000000aaaaaaacULL, }, /* 16 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x38e38e39c71c71c8ULL, 0x38e38e39c71c71c8ULL, }, + { 0xc71c71c6e38e38e4ULL, 0xc71c71c6e38e38e4ULL, }, + { 0x22222222eeeeeef0ULL, 0x22222222eeeeeef0ULL, }, + { 0xddddddddbbbbbbbcULL, 0xddddddddbbbbbbbcULL, }, + { 0x2f684bdab425ed0aULL, 0xf684bda197b425eeULL, }, + { 0xd097b425f684bda2ULL, 0x097b425f12f684beULL, }, + { 0xffffffff55555556ULL, 0xffffffff55555556ULL, }, /* 24 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0xc71c71c6e38e38e4ULL, 0xc71c71c6e38e38e4ULL, }, + { 0x38e38e3871c71c72ULL, 0x38e38e3871c71c72ULL, }, + { 0xdddddddd77777778ULL, 0xdddddddd77777778ULL, }, + { 0x22222221dddddddeULL, 0x22222221dddddddeULL, }, + { 0xd097b425da12f685ULL, 0x097b425e4bda12f7ULL, }, + { 0x2f684bd97b425ed1ULL, 0xf684bda1097b425fULL, }, + { 0x0000000066666668ULL, 0x0000000066666668ULL, }, /* 32 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x22222222eeeeeef0ULL, 0x22222222eeeeeef0ULL, }, + { 0xdddddddd77777778ULL, 0xdddddddd77777778ULL, }, + { 0x147ae14851eb8520ULL, 0x147ae14851eb8520ULL, }, + { 0xeb851eb8147ae148ULL, 0xeb851eb8147ae148ULL, }, + { 0x1c71c71d0b60b60cULL, 0xfa4fa4fa82d82d84ULL, }, + { 0xe38e38e35b05b05cULL, 0x05b05b05e38e38e4ULL, }, + { 0xffffffff9999999aULL, 0xffffffff9999999aULL, }, /* 40 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0xddddddddbbbbbbbcULL, 0xddddddddbbbbbbbcULL, }, + { 0x22222221dddddddeULL, 0x22222221dddddddeULL, }, + { 0xeb851eb8147ae148ULL, 0xeb851eb8147ae148ULL, }, + { 0x147ae147851eb852ULL, 0x147ae147851eb852ULL, }, + { 0xe38e38e382d82d83ULL, 0x05b05b0560b60b61ULL, }, + { 0x1c71c71c16c16c17ULL, 0xfa4fa4fa38e38e39ULL, }, + { 0x000000008e38e38fULL, 0xffffffffe38e38e5ULL, }, /* 48 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x2f684bdab425ed0aULL, 0xf684bda197b425eeULL, }, + { 0xd097b425da12f685ULL, 0x097b425e4bda12f7ULL, }, + { 0x1c71c71d0b60b60cULL, 0xfa4fa4fa82d82d84ULL, }, + { 0xe38e38e382d82d83ULL, 0x05b05b0560b60b61ULL, }, + { 0x35ba78199add3c0dULL, 0x0fcd6e9dc0ca4589ULL, }, + { 0xca4587e6f35ba782ULL, 0xf032916222c3f35cULL, }, + { 0xffffffff71c71c73ULL, 0x000000001c71c71dULL, }, /* 56 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0xd097b425f684bda2ULL, 0x097b425f12f684beULL, }, + { 0x2f684bd97b425ed1ULL, 0xf684bda1097b425fULL, }, + { 0xe38e38e35b05b05cULL, 0x05b05b05e38e38e4ULL, }, + { 0x1c71c71c16c16c17ULL, 0xfa4fa4fa38e38e39ULL, }, + { 0xca4587e6f35ba782ULL, 0xf032916222c3f35cULL, }, + { 0x35ba78187e6b74f1ULL, 0x0fcd6e9df9add3c1ULL, }, + { 0x3e3ad4ae1266c290ULL, 0x1637d725aebdb714ULL, }, /* 64 */ + { 0x0e3a0c27f7d6aae4ULL, 0x0575fbb7f08ff55cULL, }, + { 0x1c00082337c84b78ULL, 0x0c3d39640fde8392ULL, }, + { 0xda65cd5e9f696cdcULL, 0xdeeb6bec644a26d0ULL, }, + { 0x0e3a0c27f7d6aae4ULL, 0x0575fbb7f08ff55cULL, }, + { 0x17945c09b2e19689ULL, 0x032b395187d966b4ULL, }, + { 0xec1f0e54b5aa67beULL, 0xfbe95b6e67ae6296ULL, }, + { 0x1aad30609bff5437ULL, 0xf059a43d01b40370ULL, }, + { 0x1c00082337c84b78ULL, 0x0c3d39640fde8392ULL, }, /* 72 */ + { 0xec1f0e54b5aa67beULL, 0xfbe95b6e67ae6296ULL, }, + { 0x2e9326619bb7c8e4ULL, 0x225024d84d163b91ULL, }, + { 0xc17a5d0372a2a622ULL, 0x0afd6368668933a8ULL, }, + { 0xda65cd5e9f696cdcULL, 0xdeeb6bec644a26d0ULL, }, + { 0x1aad30609bff5437ULL, 0xf059a43d01b40370ULL, }, +}; + + gettimeofday(&start, NULL); + + for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) { + for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) { + do_msa_DOTP_S_D(b128_pattern[i], b128_pattern[j], + b128_result[PATTERN_INPUTS_SHORT_COUNT * i + j]); + } + } + + for (i = 0; i < RANDOM_INPUTS_SHORT_COUNT; i++) { + for (j = 0; j < RANDOM_INPUTS_SHORT_COUNT; j++) { + do_msa_DOTP_S_D(b128_random[i], b128_random[j], + b128_result[((PATTERN_INPUTS_SHORT_COUNT) * + (PATTERN_INPUTS_SHORT_COUNT)) + + RANDOM_INPUTS_SHORT_COUNT * i + j]); + } + } + + gettimeofday(&end, NULL); + + elapsed_time = (end.tv_sec - start.tv_sec) * 1000.0; + elapsed_time += (end.tv_usec - start.tv_usec) / 1000.0; + + ret = check_results(instruction_name, TEST_COUNT_TOTAL, elapsed_time, + &b128_result[0][0], &b128_expect[0][0]); + + return ret; +} diff --git a/tests/tcg/mips/user/ase/msa/int-dot-product/test_msa_dotp_s_h.c b/tests/tcg/mips/user/ase/msa/int-dot-product/test_msa_dotp_s_h.c new file mode 100644 index 0000000000..40de72ae97 --- /dev/null +++ b/tests/tcg/mips/user/ase/msa/int-dot-product/test_msa_dotp_s_h.c @@ -0,0 +1,151 @@ +/* + * Test program for MSA instruction DOTP_S.H + * + * Copyright (C) 2018 Wave Computing, Inc. + * Copyright (C) 2018 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.h" +#include "../../../../include/test_utils.h" + +#define TEST_COUNT_TOTAL ( \ + (PATTERN_INPUTS_SHORT_COUNT) * (PATTERN_INPUTS_SHORT_COUNT) + \ + (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT)) + + +int32_t main(void) +{ + char *instruction_name = "DOTP_S.H"; + int32_t ret; + uint32_t i, j; + struct timeval start, end; + double elapsed_time; + + uint64_t b128_result[TEST_COUNT_TOTAL][2]; + uint64_t b128_expect[TEST_COUNT_TOTAL][2] = { + { 0x0002000200020002ULL, 0x0002000200020002ULL, }, /* 0 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x00ac00ac00ac00acULL, 0x00ac00ac00ac00acULL, }, + { 0xff56ff56ff56ff56ULL, 0xff56ff56ff56ff56ULL, }, + { 0x0068006800680068ULL, 0x0068006800680068ULL, }, + { 0xff9aff9aff9aff9aULL, 0xff9aff9aff9aff9aULL, }, + { 0x008fffe5003a008fULL, 0xffe5003a008fffe5ULL, }, + { 0xff73001dffc8ff73ULL, 0x001dffc8ff73001dULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 8 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x00ac00ac00ac00acULL, 0x00ac00ac00ac00acULL, }, /* 16 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x39c839c839c839c8ULL, 0x39c839c839c839c8ULL, }, + { 0xc6e4c6e4c6e4c6e4ULL, 0xc6e4c6e4c6e4c6e4ULL, }, + { 0x22f022f022f022f0ULL, 0x22f022f022f022f0ULL, }, + { 0xddbcddbcddbcddbcULL, 0xddbcddbcddbcddbcULL, }, + { 0x300af6ee137c300aULL, 0xf6ee137c300af6eeULL, }, + { 0xd0a209beed30d0a2ULL, 0x09beed30d0a209beULL, }, + { 0xff56ff56ff56ff56ULL, 0xff56ff56ff56ff56ULL, }, /* 24 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0xc6e4c6e4c6e4c6e4ULL, 0xc6e4c6e4c6e4c6e4ULL, }, + { 0x3872387238723872ULL, 0x3872387238723872ULL, }, + { 0xdd78dd78dd78dd78ULL, 0xdd78dd78dd78dd78ULL, }, + { 0x21de21de21de21deULL, 0x21de21de21de21deULL, }, + { 0xd08508f7ecbed085ULL, 0x08f7ecbed08508f7ULL, }, + { 0x2ed1f65f12982ed1ULL, 0xf65f12982ed1f65fULL, }, + { 0x0068006800680068ULL, 0x0068006800680068ULL, }, /* 32 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x22f022f022f022f0ULL, 0x22f022f022f022f0ULL, }, + { 0xdd78dd78dd78dd78ULL, 0xdd78dd78dd78dd78ULL, }, + { 0x1520152015201520ULL, 0x1520152015201520ULL, }, + { 0xeb48eb48eb48eb48ULL, 0xeb48eb48eb48eb48ULL, }, + { 0x1d0cfa840bc81d0cULL, 0xfa840bc81d0cfa84ULL, }, + { 0xe35c05e4f4a0e35cULL, 0x05e4f4a0e35c05e4ULL, }, + { 0xff9aff9aff9aff9aULL, 0xff9aff9aff9aff9aULL, }, /* 40 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0xddbcddbcddbcddbcULL, 0xddbcddbcddbcddbcULL, }, + { 0x21de21de21de21deULL, 0x21de21de21de21deULL, }, + { 0xeb48eb48eb48eb48ULL, 0xeb48eb48eb48eb48ULL, }, + { 0x1452145214521452ULL, 0x1452145214521452ULL, }, + { 0xe3830561f472e383ULL, 0x0561f472e3830561ULL, }, + { 0x1c17fa390b281c17ULL, 0xfa390b281c17fa39ULL, }, + { 0x008fffe5003a008fULL, 0xffe5003a008fffe5ULL, }, /* 48 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x300af6ee137c300aULL, 0xf6ee137c300af6eeULL, }, + { 0xd08508f7ecbed085ULL, 0x08f7ecbed08508f7ULL, }, + { 0x1d0cfa840bc81d0cULL, 0xfa840bc81d0cfa84ULL, }, + { 0xe3830561f472e383ULL, 0x0561f472e3830561ULL, }, + { 0x360d0f893f04360dULL, 0x0f893f04360d0f89ULL, }, + { 0xca82f05cc136ca82ULL, 0xf05cc136ca82f05cULL, }, + { 0xff73001dffc8ff73ULL, 0x001dffc8ff73001dULL, }, /* 56 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0xd0a209beed30d0a2ULL, 0x09beed30d0a209beULL, }, + { 0x2ed1f65f12982ed1ULL, 0xf65f12982ed1f65fULL, }, + { 0xe35c05e4f4a0e35cULL, 0x05e4f4a0e35c05e4ULL, }, + { 0x1c17fa390b281c17ULL, 0xfa390b281c17fa39ULL, }, + { 0xca82f05cc136ca82ULL, 0xf05cc136ca82f05cULL, }, + { 0x34f10fc13e9234f1ULL, 0x0fc13e9234f10fc1ULL, }, + { 0x64240d342bc42c39ULL, 0x3f6a22fd3b1d1990ULL, }, /* 64 */ + { 0xe704ebe4e24eef13ULL, 0x01a706951e1be630ULL, }, + { 0x4ca419cce226b927ULL, 0xfb55fd241553f560ULL, }, + { 0xec36ee202172098aULL, 0xd846ec28206404e0ULL, }, + { 0xe704ebe4e24eef13ULL, 0x01a706951e1be630ULL, }, + { 0x111d264945920cf1ULL, 0x0195153d113a1a54ULL, }, + { 0xea70debeff82160dULL, 0x04260f88039c0b8aULL, }, + { 0xe9721dc70769091eULL, 0xf8711c48091bf7e4ULL, }, + { 0x4ca419cce226b927ULL, 0xfb55fd241553f560ULL, }, /* 72 */ + { 0xea70debeff82160dULL, 0x04260f88039c0b8aULL, }, + { 0x3b3437281d127579ULL, 0x0c310d25237206e9ULL, }, + { 0xf706df16dc8de6b6ULL, 0xf0d31b5827f9f42aULL, }, + { 0xec36ee202172098aULL, 0xd846ec28206404e0ULL, }, + { 0xe9721dc70769091eULL, 0xf8711c48091bf7e4ULL, }, +}; + + gettimeofday(&start, NULL); + + for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) { + for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) { + do_msa_DOTP_S_H(b128_pattern[i], b128_pattern[j], + b128_result[PATTERN_INPUTS_SHORT_COUNT * i + j]); + } + } + + for (i = 0; i < RANDOM_INPUTS_SHORT_COUNT; i++) { + for (j = 0; j < RANDOM_INPUTS_SHORT_COUNT; j++) { + do_msa_DOTP_S_H(b128_random[i], b128_random[j], + b128_result[((PATTERN_INPUTS_SHORT_COUNT) * + (PATTERN_INPUTS_SHORT_COUNT)) + + RANDOM_INPUTS_SHORT_COUNT * i + j]); + } + } + + gettimeofday(&end, NULL); + + elapsed_time = (end.tv_sec - start.tv_sec) * 1000.0; + elapsed_time += (end.tv_usec - start.tv_usec) / 1000.0; + + ret = check_results(instruction_name, TEST_COUNT_TOTAL, elapsed_time, + &b128_result[0][0], &b128_expect[0][0]); + + return ret; +} diff --git a/tests/tcg/mips/user/ase/msa/int-dot-product/test_msa_dotp_s_w.c b/tests/tcg/mips/user/ase/msa/int-dot-product/test_msa_dotp_s_w.c new file mode 100644 index 0000000000..2f1d23be6f --- /dev/null +++ b/tests/tcg/mips/user/ase/msa/int-dot-product/test_msa_dotp_s_w.c @@ -0,0 +1,151 @@ +/* + * Test program for MSA instruction DOTP_S.W + * + * Copyright (C) 2018 Wave Computing, Inc. + * Copyright (C) 2018 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.h" +#include "../../../../include/test_utils.h" + +#define TEST_COUNT_TOTAL ( \ + (PATTERN_INPUTS_SHORT_COUNT) * (PATTERN_INPUTS_SHORT_COUNT) + \ + (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT)) + + +int32_t main(void) +{ + char *instruction_name = "DOTP_S.W"; + int32_t ret; + uint32_t i, j; + struct timeval start, end; + double elapsed_time; + + uint64_t b128_result[TEST_COUNT_TOTAL][2]; + uint64_t b128_expect[TEST_COUNT_TOTAL][2] = { + { 0x0000000200000002ULL, 0x0000000200000002ULL, }, /* 0 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000aaac0000aaacULL, 0x0000aaac0000aaacULL, }, + { 0xffff5556ffff5556ULL, 0xffff5556ffff5556ULL, }, + { 0x0000666800006668ULL, 0x0000666800006668ULL, }, + { 0xffff999affff999aULL, 0xffff999affff999aULL, }, + { 0xffffe38f00008e3aULL, 0x000038e5ffffe38fULL, }, + { 0x00001c73ffff71c8ULL, 0xffffc71d00001c73ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 8 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000aaac0000aaacULL, 0x0000aaac0000aaacULL, }, /* 16 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x38e471c838e471c8ULL, 0x38e471c838e471c8ULL, }, + { 0xc71c38e4c71c38e4ULL, 0xc71c38e4c71c38e4ULL, }, + { 0x2222eef02222eef0ULL, 0x2222eef02222eef0ULL, }, + { 0xddddbbbcddddbbbcULL, 0xddddbbbcddddbbbcULL, }, + { 0xf684ed0a2f69097cULL, 0x12f725eef684ed0aULL, }, + { 0x097bbda2d097a130ULL, 0xed0984be097bbda2ULL, }, + { 0xffff5556ffff5556ULL, 0xffff5556ffff5556ULL, }, /* 24 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0xc71c38e4c71c38e4ULL, 0xc71c38e4c71c38e4ULL, }, + { 0x38e31c7238e31c72ULL, 0x38e31c7238e31c72ULL, }, + { 0xdddd7778dddd7778ULL, 0xdddd7778dddd7778ULL, }, + { 0x2221ddde2221dddeULL, 0x2221ddde2221dddeULL, }, + { 0x097af685d09784beULL, 0xed0912f7097af685ULL, }, + { 0xf6845ed12f67d098ULL, 0x12f6425ff6845ed1ULL, }, + { 0x0000666800006668ULL, 0x0000666800006668ULL, }, /* 32 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x2222eef02222eef0ULL, 0x2222eef02222eef0ULL, }, + { 0xdddd7778dddd7778ULL, 0xdddd7778dddd7778ULL, }, + { 0x147b8520147b8520ULL, 0x147b8520147b8520ULL, }, + { 0xeb84e148eb84e148ULL, 0xeb84e148eb84e148ULL, }, + { 0xfa4fb60c1c7271c8ULL, 0x0b612d84fa4fb60cULL, }, + { 0x05b0b05ce38df4a0ULL, 0xf49f38e405b0b05cULL, }, + { 0xffff999affff999aULL, 0xffff999affff999aULL, }, /* 40 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0xddddbbbcddddbbbcULL, 0xddddbbbcddddbbbcULL, }, + { 0x2221ddde2221dddeULL, 0x2221ddde2221dddeULL, }, + { 0xeb84e148eb84e148ULL, 0xeb84e148eb84e148ULL, }, + { 0x147ab852147ab852ULL, 0x147ab852147ab852ULL, }, + { 0x05b02d83e38e1c72ULL, 0xf49f0b6105b02d83ULL, }, + { 0xfa4f6c171c717d28ULL, 0x0b608e39fa4f6c17ULL, }, + { 0xffffe38f00008e3aULL, 0x000038e5ffffe38fULL, }, /* 48 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0xf684ed0a2f69097cULL, 0x12f725eef684ed0aULL, }, + { 0x097af685d09784beULL, 0xed0912f7097af685ULL, }, + { 0xfa4fb60c1c7271c8ULL, 0x0b612d84fa4fb60cULL, }, + { 0x05b02d83e38e1c72ULL, 0xf49f0b6105b02d83ULL, }, + { 0x0fcd3c0d35bb4f04ULL, 0x3f3645890fcd3c0dULL, }, + { 0xf032a782ca453f36ULL, 0xc0c9f35cf032a782ULL, }, + { 0x00001c73ffff71c8ULL, 0xffffc71d00001c73ULL, }, /* 56 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x097bbda2d097a130ULL, 0xed0984be097bbda2ULL, }, + { 0xf6845ed12f67d098ULL, 0x12f6425ff6845ed1ULL, }, + { 0x05b0b05ce38df4a0ULL, 0xf49f38e405b0b05cULL, }, + { 0xfa4f6c171c717d28ULL, 0x0b608e39fa4f6c17ULL, }, + { 0xf032a782ca453f36ULL, 0xc0c9f35cf032a782ULL, }, + { 0x0fcd74f135ba3292ULL, 0x3f35d3c10fcd74f1ULL, }, + { 0x3a57fe7422c25584ULL, 0x16b6b9f518facfa9ULL, }, /* 64 */ + { 0x01f36d90f9441446ULL, 0x0286cfede5f4db15ULL, }, + { 0x2f1518bcce21d93eULL, 0x0934568af4ec6499ULL, }, + { 0xc9576c1204f83042ULL, 0xd91d3e4709b06e36ULL, }, + { 0x01f36d90f9441446ULL, 0x0286cfede5f4db15ULL, }, + { 0x0012474d242f32a9ULL, 0x13f2a8f51ca9cd91ULL, }, + { 0x0144b48a04a7d0ddULL, 0x124b1c4e04fa8e45ULL, }, + { 0xfe2a6f6923268793ULL, 0x179e9377ef4766beULL, }, + { 0x2f1518bcce21d93eULL, 0x0934568af4ec6499ULL, }, /* 72 */ + { 0x0144b48a04a7d0ddULL, 0x124b1c4e04fa8e45ULL, }, + { 0x352c988848431561ULL, 0x12e4f841217b42c9ULL, }, + { 0xd437b4e8f3b0139fULL, 0x08c7d980187d5896ULL, }, + { 0xc9576c1204f83042ULL, 0xd91d3e4709b06e36ULL, }, + { 0xfe2a6f6923268793ULL, 0x179e9377ef4766beULL, }, +}; + + gettimeofday(&start, NULL); + + for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) { + for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) { + do_msa_DOTP_S_W(b128_pattern[i], b128_pattern[j], + b128_result[PATTERN_INPUTS_SHORT_COUNT * i + j]); + } + } + + for (i = 0; i < RANDOM_INPUTS_SHORT_COUNT; i++) { + for (j = 0; j < RANDOM_INPUTS_SHORT_COUNT; j++) { + do_msa_DOTP_S_W(b128_random[i], b128_random[j], + b128_result[((PATTERN_INPUTS_SHORT_COUNT) * + (PATTERN_INPUTS_SHORT_COUNT)) + + RANDOM_INPUTS_SHORT_COUNT * i + j]); + } + } + + gettimeofday(&end, NULL); + + elapsed_time = (end.tv_sec - start.tv_sec) * 1000.0; + elapsed_time += (end.tv_usec - start.tv_usec) / 1000.0; + + ret = check_results(instruction_name, TEST_COUNT_TOTAL, elapsed_time, + &b128_result[0][0], &b128_expect[0][0]); + + return ret; +} diff --git a/tests/tcg/mips/user/ase/msa/int-dot-product/test_msa_dotp_u_d.c b/tests/tcg/mips/user/ase/msa/int-dot-product/test_msa_dotp_u_d.c new file mode 100644 index 0000000000..e998e00410 --- /dev/null +++ b/tests/tcg/mips/user/ase/msa/int-dot-product/test_msa_dotp_u_d.c @@ -0,0 +1,151 @@ +/* + * Test program for MSA instruction DOTP_U.D + * + * Copyright (C) 2018 Wave Computing, Inc. + * Copyright (C) 2018 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.h" +#include "../../../../include/test_utils.h" + +#define TEST_COUNT_TOTAL ( \ + (PATTERN_INPUTS_SHORT_COUNT) * (PATTERN_INPUTS_SHORT_COUNT) + \ + (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT)) + + +int32_t main(void) +{ + char *instruction_name = "DOTP_U.D"; + int32_t ret; + uint32_t i, j; + struct timeval start, end; + double elapsed_time; + + uint64_t b128_result[TEST_COUNT_TOTAL][2]; + uint64_t b128_expect[TEST_COUNT_TOTAL][2] = { + { 0xfffffffc00000002ULL, 0xfffffffc00000002ULL, }, /* 0 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x55555552aaaaaaacULL, 0x55555552aaaaaaacULL, }, + { 0xaaaaaaa955555556ULL, 0xaaaaaaa955555556ULL, }, + { 0x9999999666666668ULL, 0x9999999666666668ULL, }, + { 0x666666659999999aULL, 0x666666659999999aULL, }, + { 0x71c71c6f8e38e38fULL, 0x1c71c719e38e38e5ULL, }, + { 0x8e38e38c71c71c73ULL, 0xe38e38e21c71c71dULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 8 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x55555552aaaaaaacULL, 0x55555552aaaaaaacULL, }, /* 16 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0xe38e38e1c71c71c8ULL, 0xe38e38e1c71c71c8ULL, }, + { 0x71c71c70e38e38e4ULL, 0x71c71c70e38e38e4ULL, }, + { 0x1111110eeeeeeef0ULL, 0x1111110eeeeeeef0ULL, }, + { 0x44444443bbbbbbbcULL, 0x44444443bbbbbbbcULL, }, + { 0xf684bd9fb425ed0aULL, 0xbda12f6697b425eeULL, }, + { 0x5ed097b2f684bda2ULL, 0x97b425ec12f684beULL, }, + { 0xaaaaaaa955555556ULL, 0xaaaaaaa955555556ULL, }, /* 24 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x71c71c70e38e38e4ULL, 0x71c71c70e38e38e4ULL, }, + { 0x38e38e3871c71c72ULL, 0x38e38e3871c71c72ULL, }, + { 0x8888888777777778ULL, 0x8888888777777778ULL, }, + { 0x22222221dddddddeULL, 0x22222221dddddddeULL, }, + { 0x7b425ecfda12f685ULL, 0x5ed097b34bda12f7ULL, }, + { 0x2f684bd97b425ed1ULL, 0x4bda12f6097b425fULL, }, + { 0x9999999666666668ULL, 0x9999999666666668ULL, }, /* 32 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x1111110eeeeeeef0ULL, 0x1111110eeeeeeef0ULL, }, + { 0x8888888777777778ULL, 0x8888888777777778ULL, }, + { 0x47ae147851eb8520ULL, 0x47ae147851eb8520ULL, }, + { 0x51eb851e147ae148ULL, 0x51eb851e147ae148ULL, }, + { 0x27d27d260b60b60cULL, 0xe38e38e182d82d84ULL, }, + { 0x71c71c705b05b05cULL, 0xb60b60b4e38e38e4ULL, }, + { 0x666666659999999aULL, 0x666666659999999aULL, }, /* 40 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x44444443bbbbbbbcULL, 0x44444443bbbbbbbcULL, }, + { 0x22222221dddddddeULL, 0x22222221dddddddeULL, }, + { 0x51eb851e147ae148ULL, 0x51eb851e147ae148ULL, }, + { 0x147ae147851eb852ULL, 0x147ae147851eb852ULL, }, + { 0x49f49f4982d82d83ULL, 0x38e38e3860b60b61ULL, }, + { 0x1c71c71c16c16c17ULL, 0x2d82d82d38e38e39ULL, }, + { 0x71c71c6f8e38e38fULL, 0x1c71c719e38e38e5ULL, }, /* 48 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0xf684bd9fb425ed0aULL, 0xbda12f6697b425eeULL, }, + { 0x7b425ecfda12f685ULL, 0x5ed097b34bda12f7ULL, }, + { 0x27d27d260b60b60cULL, 0xe38e38e182d82d84ULL, }, + { 0x49f49f4982d82d83ULL, 0x38e38e3860b60b61ULL, }, + { 0x1948b0fb9add3c0dULL, 0xd6e9e063c0ca4589ULL, }, + { 0x587e6b73f35ba782ULL, 0x4587e6b622c3f35cULL, }, + { 0x8e38e38c71c71c73ULL, 0xe38e38e21c71c71dULL, }, /* 56 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x5ed097b2f684bda2ULL, 0x97b425ec12f684beULL, }, + { 0x2f684bd97b425ed1ULL, 0x4bda12f6097b425fULL, }, + { 0x71c71c705b05b05cULL, 0xb60b60b4e38e38e4ULL, }, + { 0x1c71c71c16c16c17ULL, 0x2d82d82d38e38e39ULL, }, + { 0x587e6b73f35ba782ULL, 0x4587e6b622c3f35cULL, }, + { 0x35ba78187e6b74f1ULL, 0x9e06522bf9add3c1ULL, }, + { 0x4f10a2461266c290ULL, 0x132f373daebdb714ULL, }, /* 64 */ + { 0x9262f356f7d6aae4ULL, 0x1ab54eb3f08ff55cULL, }, + { 0x7927f2d937c84b78ULL, 0xb5e40e840fde8392ULL, }, + { 0x4ab4e3ab9f696cdcULL, 0xd21109f6644a26d0ULL, }, + { 0x9262f356f7d6aae4ULL, 0x1ab54eb3f08ff55cULL, }, + { 0x0f105ccfb2e19689ULL, 0x032b395187d966b4ULL, }, + { 0xe1cb8469b5aa67beULL, 0x1128ae6a67ae6296ULL, }, + { 0x8afc46ad9bff5437ULL, 0x1890b25301b40370ULL, }, + { 0x7927f2d937c84b78ULL, 0xb5e40e840fde8392ULL, }, /* 72 */ + { 0xe1cb8469b5aa67beULL, 0x1128ae6a67ae6296ULL, }, + { 0xfae79ab59bb7c8e4ULL, 0x78a66f004d163b91ULL, }, + { 0x8ffb559e72a2a622ULL, 0x8744321b668933a8ULL, }, + { 0x4ab4e3ab9f696cdcULL, 0xd21109f6644a26d0ULL, }, + { 0x8afc46ad9bff5437ULL, 0x1890b25301b40370ULL, }, +}; + + gettimeofday(&start, NULL); + + for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) { + for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) { + do_msa_DOTP_U_D(b128_pattern[i], b128_pattern[j], + b128_result[PATTERN_INPUTS_SHORT_COUNT * i + j]); + } + } + + for (i = 0; i < RANDOM_INPUTS_SHORT_COUNT; i++) { + for (j = 0; j < RANDOM_INPUTS_SHORT_COUNT; j++) { + do_msa_DOTP_U_D(b128_random[i], b128_random[j], + b128_result[((PATTERN_INPUTS_SHORT_COUNT) * + (PATTERN_INPUTS_SHORT_COUNT)) + + RANDOM_INPUTS_SHORT_COUNT * i + j]); + } + } + + gettimeofday(&end, NULL); + + elapsed_time = (end.tv_sec - start.tv_sec) * 1000.0; + elapsed_time += (end.tv_usec - start.tv_usec) / 1000.0; + + ret = check_results(instruction_name, TEST_COUNT_TOTAL, elapsed_time, + &b128_result[0][0], &b128_expect[0][0]); + + return ret; +} diff --git a/tests/tcg/mips/user/ase/msa/int-dot-product/test_msa_dotp_u_h.c b/tests/tcg/mips/user/ase/msa/int-dot-product/test_msa_dotp_u_h.c new file mode 100644 index 0000000000..e8db601a74 --- /dev/null +++ b/tests/tcg/mips/user/ase/msa/int-dot-product/test_msa_dotp_u_h.c @@ -0,0 +1,151 @@ +/* + * Test program for MSA instruction DOTP_U.H + * + * Copyright (C) 2018 Wave Computing, Inc. + * Copyright (C) 2018 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.h" +#include "../../../../include/test_utils.h" + +#define TEST_COUNT_TOTAL ( \ + (PATTERN_INPUTS_SHORT_COUNT) * (PATTERN_INPUTS_SHORT_COUNT) + \ + (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT)) + + +int32_t main(void) +{ + char *instruction_name = "DOTP_U.H"; + int32_t ret; + uint32_t i, j; + struct timeval start, end; + double elapsed_time; + + uint64_t b128_result[TEST_COUNT_TOTAL][2]; + uint64_t b128_expect[TEST_COUNT_TOTAL][2] = { + { 0xfc02fc02fc02fc02ULL, 0xfc02fc02fc02fc02ULL, }, /* 0 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x52ac52ac52ac52acULL, 0x52ac52ac52ac52acULL, }, + { 0xa956a956a956a956ULL, 0xa956a956a956a956ULL, }, + { 0x9668966896689668ULL, 0x9668966896689668ULL, }, + { 0x659a659a659a659aULL, 0x659a659a659a659aULL, }, + { 0x6f8f19e5c53a6f8fULL, 0x19e5c53a6f8f19e5ULL, }, + { 0x8c73e21d36c88c73ULL, 0xe21d36c88c73e21dULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 8 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x52ac52ac52ac52acULL, 0x52ac52ac52ac52acULL, }, /* 16 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0xe1c8e1c8e1c8e1c8ULL, 0xe1c8e1c8e1c8e1c8ULL, }, + { 0x70e470e470e470e4ULL, 0x70e470e470e470e4ULL, }, + { 0x0ef00ef00ef00ef0ULL, 0x0ef00ef00ef00ef0ULL, }, + { 0x43bc43bc43bc43bcULL, 0x43bc43bc43bc43bcULL, }, + { 0xf50abbee837cf50aULL, 0xbbee837cf50abbeeULL, }, + { 0x5da296becf305da2ULL, 0x96becf305da296beULL, }, + { 0xa956a956a956a956ULL, 0xa956a956a956a956ULL, }, /* 24 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x70e470e470e470e4ULL, 0x70e470e470e470e4ULL, }, + { 0x3872387238723872ULL, 0x3872387238723872ULL, }, + { 0x8778877887788778ULL, 0x8778877887788778ULL, }, + { 0x21de21de21de21deULL, 0x21de21de21de21deULL, }, + { 0x7a855df741be7a85ULL, 0x5df741be7a855df7ULL, }, + { 0x2ed14b5f67982ed1ULL, 0x4b5f67982ed14b5fULL, }, + { 0x9668966896689668ULL, 0x9668966896689668ULL, }, /* 32 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0ef00ef00ef00ef0ULL, 0x0ef00ef00ef00ef0ULL, }, + { 0x8778877887788778ULL, 0x8778877887788778ULL, }, + { 0x4520452045204520ULL, 0x4520452045204520ULL, }, + { 0x5148514851485148ULL, 0x5148514851485148ULL, }, + { 0x260ce1849dc8260cULL, 0xe1849dc8260ce184ULL, }, + { 0x705cb4e4f8a0705cULL, 0xb4e4f8a0705cb4e4ULL, }, + { 0x659a659a659a659aULL, 0x659a659a659a659aULL, }, /* 40 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x43bc43bc43bc43bcULL, 0x43bc43bc43bc43bcULL, }, + { 0x21de21de21de21deULL, 0x21de21de21de21deULL, }, + { 0x5148514851485148ULL, 0x5148514851485148ULL, }, + { 0x1452145214521452ULL, 0x1452145214521452ULL, }, + { 0x4983386127724983ULL, 0x3861277249833861ULL, }, + { 0x1c172d393e281c17ULL, 0x2d393e281c172d39ULL, }, + { 0x6f8f19e5c53a6f8fULL, 0x19e5c53a6f8f19e5ULL, }, /* 48 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0xf50abbee837cf50aULL, 0xbbee837cf50abbeeULL, }, + { 0x7a855df741be7a85ULL, 0x5df741be7a855df7ULL, }, + { 0x260ce1849dc8260cULL, 0xe1849dc8260ce184ULL, }, + { 0x4983386127724983ULL, 0x3861277249833861ULL, }, + { 0x180dd5895b04180dULL, 0xd5895b04180dd589ULL, }, + { 0x5782445c6a365782ULL, 0x445c6a365782445cULL, }, + { 0x8c73e21d36c88c73ULL, 0xe21d36c88c73e21dULL, }, /* 56 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x5da296becf305da2ULL, 0x96becf305da296beULL, }, + { 0x2ed14b5f67982ed1ULL, 0x4b5f67982ed14b5fULL, }, + { 0x705cb4e4f8a0705cULL, 0xb4e4f8a0705cb4e4ULL, }, + { 0x1c172d393e281c17ULL, 0x2d393e281c172d39ULL, }, + { 0x5782445c6a365782ULL, 0x445c6a365782445cULL, }, + { 0x34f19dc1cc9234f1ULL, 0x9dc1cc9234f19dc1ULL, }, + { 0x742471342bc42c39ULL, 0x3f6a22fd371d7990ULL, }, /* 64 */ + { 0xd4044ee4444e4413ULL, 0x68a71195331b4430ULL, }, + { 0x80a423cc6c264e27ULL, 0x62556624be531a60ULL, }, + { 0x5c36512021725e8aULL, 0x8a465528c764a2e0ULL, }, + { 0xd4044ee4444e4413ULL, 0x68a71195331b4430ULL, }, + { 0x831d26496b929af1ULL, 0xef958b3d113a1254ULL, }, + { 0xeb7041beae82700dULL, 0xd326aa88189c1f8aULL, }, + { 0xa8721dc73869b21eULL, 0xf27179481e1be5e4ULL, }, + { 0x80a423cc6c264e27ULL, 0x62556624be531a60ULL, }, /* 72 */ + { 0xeb7041beae82700dULL, 0xd326aa88189c1f8aULL, }, + { 0x9334e7282d128b79ULL, 0xbc319725797206e9ULL, }, + { 0x670642166b8da1b6ULL, 0xe0d340587bf92d2aULL, }, + { 0x5c36512021725e8aULL, 0x8a465528c764a2e0ULL, }, + { 0xa8721dc73869b21eULL, 0xf27179481e1be5e4ULL, }, +}; + + gettimeofday(&start, NULL); + + for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) { + for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) { + do_msa_DOTP_U_H(b128_pattern[i], b128_pattern[j], + b128_result[PATTERN_INPUTS_SHORT_COUNT * i + j]); + } + } + + for (i = 0; i < RANDOM_INPUTS_SHORT_COUNT; i++) { + for (j = 0; j < RANDOM_INPUTS_SHORT_COUNT; j++) { + do_msa_DOTP_U_H(b128_random[i], b128_random[j], + b128_result[((PATTERN_INPUTS_SHORT_COUNT) * + (PATTERN_INPUTS_SHORT_COUNT)) + + RANDOM_INPUTS_SHORT_COUNT * i + j]); + } + } + + gettimeofday(&end, NULL); + + elapsed_time = (end.tv_sec - start.tv_sec) * 1000.0; + elapsed_time += (end.tv_usec - start.tv_usec) / 1000.0; + + ret = check_results(instruction_name, TEST_COUNT_TOTAL, elapsed_time, + &b128_result[0][0], &b128_expect[0][0]); + + return ret; +} diff --git a/tests/tcg/mips/user/ase/msa/int-dot-product/test_msa_dotp_u_w.c b/tests/tcg/mips/user/ase/msa/int-dot-product/test_msa_dotp_u_w.c new file mode 100644 index 0000000000..cf5bd13f48 --- /dev/null +++ b/tests/tcg/mips/user/ase/msa/int-dot-product/test_msa_dotp_u_w.c @@ -0,0 +1,151 @@ +/* + * Test program for MSA instruction DOTP_U.W + * + * Copyright (C) 2018 Wave Computing, Inc. + * Copyright (C) 2018 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.h" +#include "../../../../include/test_utils.h" + +#define TEST_COUNT_TOTAL ( \ + (PATTERN_INPUTS_SHORT_COUNT) * (PATTERN_INPUTS_SHORT_COUNT) + \ + (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT)) + + +int32_t main(void) +{ + char *instruction_name = "DOTP_U.W"; + int32_t ret; + uint32_t i, j; + struct timeval start, end; + double elapsed_time; + + uint64_t b128_result[TEST_COUNT_TOTAL][2]; + uint64_t b128_expect[TEST_COUNT_TOTAL][2] = { + { 0xfffc0002fffc0002ULL, 0xfffc0002fffc0002ULL, }, /* 0 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x5552aaac5552aaacULL, 0x5552aaac5552aaacULL, }, + { 0xaaa95556aaa95556ULL, 0xaaa95556aaa95556ULL, }, + { 0x9996666899966668ULL, 0x9996666899966668ULL, }, + { 0x6665999a6665999aULL, 0x6665999a6665999aULL, }, + { 0x1c6fe38f71c48e3aULL, 0xc71a38e51c6fe38fULL, }, + { 0xe38c1c738e3771c8ULL, 0x38e1c71de38c1c73ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 8 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x5552aaac5552aaacULL, 0x5552aaac5552aaacULL, }, /* 16 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0xe38c71c8e38c71c8ULL, 0xe38c71c8e38c71c8ULL, }, + { 0x71c638e471c638e4ULL, 0x71c638e471c638e4ULL, }, + { 0x110eeef0110eeef0ULL, 0x110eeef0110eeef0ULL, }, + { 0x4443bbbc4443bbbcULL, 0x4443bbbc4443bbbcULL, }, + { 0xbd9fed0af683097cULL, 0x84bc25eebd9fed0aULL, }, + { 0x97b2bda25ecfa130ULL, 0xd09684be97b2bda2ULL, }, + { 0xaaa95556aaa95556ULL, 0xaaa95556aaa95556ULL, }, /* 24 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x71c638e471c638e4ULL, 0x71c638e471c638e4ULL, }, + { 0x38e31c7238e31c72ULL, 0x38e31c7238e31c72ULL, }, + { 0x8887777888877778ULL, 0x8887777888877778ULL, }, + { 0x2221ddde2221dddeULL, 0x2221ddde2221dddeULL, }, + { 0x5ecff6857b4184beULL, 0x425e12f75ecff685ULL, }, + { 0x4bd95ed12f67d098ULL, 0x684b425f4bd95ed1ULL, }, + { 0x9996666899966668ULL, 0x9996666899966668ULL, }, /* 32 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x110eeef0110eeef0ULL, 0x110eeef0110eeef0ULL, }, + { 0x8887777888877778ULL, 0x8887777888877778ULL, }, + { 0x47ab852047ab8520ULL, 0x47ab852047ab8520ULL, }, + { 0x51eae14851eae148ULL, 0x51eae14851eae148ULL, }, + { 0xe38cb60c27d071c8ULL, 0x9f482d84e38cb60cULL, }, + { 0xb609b05c71c5f4a0ULL, 0xfa4e38e4b609b05cULL, }, + { 0x6665999a6665999aULL, 0x6665999a6665999aULL, }, /* 40 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x4443bbbc4443bbbcULL, 0x4443bbbc4443bbbcULL, }, + { 0x2221ddde2221dddeULL, 0x2221ddde2221dddeULL, }, + { 0x51eae14851eae148ULL, 0x51eae14851eae148ULL, }, + { 0x147ab852147ab852ULL, 0x147ab852147ab852ULL, }, + { 0x38e32d8349f41c72ULL, 0x27d20b6138e32d83ULL, }, + { 0x2d826c171c717d28ULL, 0x3e938e392d826c17ULL, }, + { 0x1c6fe38f71c48e3aULL, 0xc71a38e51c6fe38fULL, }, /* 48 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0xbd9fed0af683097cULL, 0x84bc25eebd9fed0aULL, }, + { 0x5ecff6857b4184beULL, 0x425e12f75ecff685ULL, }, + { 0xe38cb60c27d071c8ULL, 0x9f482d84e38cb60cULL, }, + { 0x38e32d8349f41c72ULL, 0x27d20b6138e32d83ULL, }, + { 0xd6e93c0d19474f04ULL, 0x5ba64589d6e93c0dULL, }, + { 0x4586a782587d3f36ULL, 0x6b73f35c4586a782ULL, }, + { 0xe38c1c738e3771c8ULL, 0x38e1c71de38c1c73ULL, }, /* 56 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x97b2bda25ecfa130ULL, 0xd09684be97b2bda2ULL, }, + { 0x4bd95ed12f67d098ULL, 0x684b425f4bd95ed1ULL, }, + { 0xb609b05c71c5f4a0ULL, 0xfa4e38e4b609b05cULL, }, + { 0x2d826c171c717d28ULL, 0x3e938e392d826c17ULL, }, + { 0x4586a782587d3f36ULL, 0x6b73f35c4586a782ULL, }, + { 0x9e0574f135ba3292ULL, 0xcd6dd3c19e0574f1ULL, }, + { 0x18c3fe7422c25584ULL, 0x16b6b9f57608cfa9ULL, }, /* 64 */ + { 0x867e6d904e841446ULL, 0x0de4cfed4e2fdb15ULL, }, + { 0xf94f18bc4bc3d93eULL, 0x1492568ac3a66499ULL, }, + { 0x4ff36c125a383042ULL, 0x2fe23e4744196e36ULL, }, + { 0x867e6d904e841446ULL, 0x0de4cfed4e2fdb15ULL, }, + { 0xf78e474db23f32a9ULL, 0x8a26a8f51ca9cd91ULL, }, + { 0xa9bfb48aa4c2d0ddULL, 0x94641c4e1a398e45ULL, }, + { 0x6e796f69cc7c8793ULL, 0x6e879377578266beULL, }, + { 0xf94f18bc4bc3d93eULL, 0x1492568ac3a66499ULL, }, /* 72 */ + { 0xa9bfb48aa4c2d0ddULL, 0x94641c4e1a398e45ULL, }, + { 0xeb349888d2e11561ULL, 0xa0e2f84177d142c9ULL, }, + { 0x5ad3b4e8bfaf139fULL, 0x8076d98091fe5896ULL, }, + { 0x4ff36c125a383042ULL, 0x2fe23e4744196e36ULL, }, + { 0x6e796f69cc7c8793ULL, 0x6e879377578266beULL, }, +}; + + gettimeofday(&start, NULL); + + for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) { + for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) { + do_msa_DOTP_U_W(b128_pattern[i], b128_pattern[j], + b128_result[PATTERN_INPUTS_SHORT_COUNT * i + j]); + } + } + + for (i = 0; i < RANDOM_INPUTS_SHORT_COUNT; i++) { + for (j = 0; j < RANDOM_INPUTS_SHORT_COUNT; j++) { + do_msa_DOTP_U_W(b128_random[i], b128_random[j], + b128_result[((PATTERN_INPUTS_SHORT_COUNT) * + (PATTERN_INPUTS_SHORT_COUNT)) + + RANDOM_INPUTS_SHORT_COUNT * i + j]); + } + } + + gettimeofday(&end, NULL); + + elapsed_time = (end.tv_sec - start.tv_sec) * 1000.0; + elapsed_time += (end.tv_usec - start.tv_usec) / 1000.0; + + ret = check_results(instruction_name, TEST_COUNT_TOTAL, elapsed_time, + &b128_result[0][0], &b128_expect[0][0]); + + return ret; +} diff --git a/tests/tcg/mips/user/ase/msa/int-max-min/test_msa_max_a_b.c b/tests/tcg/mips/user/ase/msa/int-max-min/test_msa_max_a_b.c index b7a9a61548..5fa2644c30 100644 --- a/tests/tcg/mips/user/ase/msa/int-max-min/test_msa_max_a_b.c +++ b/tests/tcg/mips/user/ase/msa/int-max-min/test_msa_max_a_b.c @@ -1,8 +1,8 @@ /* * Test program for MSA instruction MAX_A.B * - * Copyright (C) 2018 Wave Computing, Inc. - * Copyright (C) 2018 Aleksandar Markovic <amarkovic@wavecomp.com> + * Copyright (C) 2019 Wave Computing, Inc. + * Copyright (C) 2019 Aleksandar Markovic <amarkovic@wavecomp.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -23,8 +23,8 @@ #include <stdint.h> #include "../../../../include/wrappers_msa.h" -#include "../../../../include/test_inputs.h" -#include "../../../../include/test_utils.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) + \ diff --git a/tests/tcg/mips/user/ase/msa/int-max-min/test_msa_max_a_d.c b/tests/tcg/mips/user/ase/msa/int-max-min/test_msa_max_a_d.c index dfffaf5b5e..9d97982ab5 100644 --- a/tests/tcg/mips/user/ase/msa/int-max-min/test_msa_max_a_d.c +++ b/tests/tcg/mips/user/ase/msa/int-max-min/test_msa_max_a_d.c @@ -1,8 +1,8 @@ /* * Test program for MSA instruction MAX_A.D * - * Copyright (C) 2018 Wave Computing, Inc. - * Copyright (C) 2018 Aleksandar Markovic <amarkovic@wavecomp.com> + * Copyright (C) 2019 Wave Computing, Inc. + * Copyright (C) 2019 Aleksandar Markovic <amarkovic@wavecomp.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -23,8 +23,8 @@ #include <stdint.h> #include "../../../../include/wrappers_msa.h" -#include "../../../../include/test_inputs.h" -#include "../../../../include/test_utils.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) + \ diff --git a/tests/tcg/mips/user/ase/msa/int-max-min/test_msa_max_a_h.c b/tests/tcg/mips/user/ase/msa/int-max-min/test_msa_max_a_h.c index e0c1bd4c4b..3365f726a2 100644 --- a/tests/tcg/mips/user/ase/msa/int-max-min/test_msa_max_a_h.c +++ b/tests/tcg/mips/user/ase/msa/int-max-min/test_msa_max_a_h.c @@ -1,8 +1,8 @@ /* * Test program for MSA instruction MAX_A.H * - * Copyright (C) 2018 Wave Computing, Inc. - * Copyright (C) 2018 Aleksandar Markovic <amarkovic@wavecomp.com> + * Copyright (C) 2019 Wave Computing, Inc. + * Copyright (C) 2019 Aleksandar Markovic <amarkovic@wavecomp.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -23,8 +23,8 @@ #include <stdint.h> #include "../../../../include/wrappers_msa.h" -#include "../../../../include/test_inputs.h" -#include "../../../../include/test_utils.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) + \ diff --git a/tests/tcg/mips/user/ase/msa/int-max-min/test_msa_max_a_w.c b/tests/tcg/mips/user/ase/msa/int-max-min/test_msa_max_a_w.c index 40c30c5569..b33f4b7d79 100644 --- a/tests/tcg/mips/user/ase/msa/int-max-min/test_msa_max_a_w.c +++ b/tests/tcg/mips/user/ase/msa/int-max-min/test_msa_max_a_w.c @@ -1,8 +1,8 @@ /* * Test program for MSA instruction MAX_A.W * - * Copyright (C) 2018 Wave Computing, Inc. - * Copyright (C) 2018 Aleksandar Markovic <amarkovic@wavecomp.com> + * Copyright (C) 2019 Wave Computing, Inc. + * Copyright (C) 2019 Aleksandar Markovic <amarkovic@wavecomp.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -23,8 +23,8 @@ #include <stdint.h> #include "../../../../include/wrappers_msa.h" -#include "../../../../include/test_inputs.h" -#include "../../../../include/test_utils.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) + \ diff --git a/tests/tcg/mips/user/ase/msa/int-max-min/test_msa_max_s_b.c b/tests/tcg/mips/user/ase/msa/int-max-min/test_msa_max_s_b.c index ab50eee187..71e571d0c4 100644 --- a/tests/tcg/mips/user/ase/msa/int-max-min/test_msa_max_s_b.c +++ b/tests/tcg/mips/user/ase/msa/int-max-min/test_msa_max_s_b.c @@ -1,8 +1,8 @@ /* * Test program for MSA instruction MAX_S.B * - * Copyright (C) 2018 Wave Computing, Inc. - * Copyright (C) 2018 Aleksandar Markovic <amarkovic@wavecomp.com> + * Copyright (C) 2019 Wave Computing, Inc. + * Copyright (C) 2019 Aleksandar Markovic <amarkovic@wavecomp.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -23,8 +23,8 @@ #include <stdint.h> #include "../../../../include/wrappers_msa.h" -#include "../../../../include/test_inputs.h" -#include "../../../../include/test_utils.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) + \ diff --git a/tests/tcg/mips/user/ase/msa/int-max-min/test_msa_max_s_d.c b/tests/tcg/mips/user/ase/msa/int-max-min/test_msa_max_s_d.c index 2957db4abc..e088ab99e3 100644 --- a/tests/tcg/mips/user/ase/msa/int-max-min/test_msa_max_s_d.c +++ b/tests/tcg/mips/user/ase/msa/int-max-min/test_msa_max_s_d.c @@ -1,8 +1,8 @@ /* * Test program for MSA instruction MAX_S.D * - * Copyright (C) 2018 Wave Computing, Inc. - * Copyright (C) 2018 Aleksandar Markovic <amarkovic@wavecomp.com> + * Copyright (C) 2019 Wave Computing, Inc. + * Copyright (C) 2019 Aleksandar Markovic <amarkovic@wavecomp.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -23,8 +23,8 @@ #include <stdint.h> #include "../../../../include/wrappers_msa.h" -#include "../../../../include/test_inputs.h" -#include "../../../../include/test_utils.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) + \ diff --git a/tests/tcg/mips/user/ase/msa/int-max-min/test_msa_max_s_h.c b/tests/tcg/mips/user/ase/msa/int-max-min/test_msa_max_s_h.c index e101764d73..6d1b81a119 100644 --- a/tests/tcg/mips/user/ase/msa/int-max-min/test_msa_max_s_h.c +++ b/tests/tcg/mips/user/ase/msa/int-max-min/test_msa_max_s_h.c @@ -1,8 +1,8 @@ /* * Test program for MSA instruction MAX_S.H * - * Copyright (C) 2018 Wave Computing, Inc. - * Copyright (C) 2018 Aleksandar Markovic <amarkovic@wavecomp.com> + * Copyright (C) 2019 Wave Computing, Inc. + * Copyright (C) 2019 Aleksandar Markovic <amarkovic@wavecomp.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -23,8 +23,8 @@ #include <stdint.h> #include "../../../../include/wrappers_msa.h" -#include "../../../../include/test_inputs.h" -#include "../../../../include/test_utils.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) + \ diff --git a/tests/tcg/mips/user/ase/msa/int-max-min/test_msa_max_s_w.c b/tests/tcg/mips/user/ase/msa/int-max-min/test_msa_max_s_w.c index 119f03ffba..bd64294322 100644 --- a/tests/tcg/mips/user/ase/msa/int-max-min/test_msa_max_s_w.c +++ b/tests/tcg/mips/user/ase/msa/int-max-min/test_msa_max_s_w.c @@ -1,8 +1,8 @@ /* * Test program for MSA instruction MAX_S.W * - * Copyright (C) 2018 Wave Computing, Inc. - * Copyright (C) 2018 Aleksandar Markovic <amarkovic@wavecomp.com> + * Copyright (C) 2019 Wave Computing, Inc. + * Copyright (C) 2019 Aleksandar Markovic <amarkovic@wavecomp.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -23,8 +23,8 @@ #include <stdint.h> #include "../../../../include/wrappers_msa.h" -#include "../../../../include/test_inputs.h" -#include "../../../../include/test_utils.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) + \ diff --git a/tests/tcg/mips/user/ase/msa/int-max-min/test_msa_max_u_b.c b/tests/tcg/mips/user/ase/msa/int-max-min/test_msa_max_u_b.c index d18b6bf0cc..206d907a26 100644 --- a/tests/tcg/mips/user/ase/msa/int-max-min/test_msa_max_u_b.c +++ b/tests/tcg/mips/user/ase/msa/int-max-min/test_msa_max_u_b.c @@ -1,8 +1,8 @@ /* * Test program for MSA instruction MAX_U.B * - * Copyright (C) 2018 Wave Computing, Inc. - * Copyright (C) 2018 Aleksandar Markovic <amarkovic@wavecomp.com> + * Copyright (C) 2019 Wave Computing, Inc. + * Copyright (C) 2019 Aleksandar Markovic <amarkovic@wavecomp.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -23,8 +23,8 @@ #include <stdint.h> #include "../../../../include/wrappers_msa.h" -#include "../../../../include/test_inputs.h" -#include "../../../../include/test_utils.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) + \ diff --git a/tests/tcg/mips/user/ase/msa/int-max-min/test_msa_max_u_d.c b/tests/tcg/mips/user/ase/msa/int-max-min/test_msa_max_u_d.c index 1396e740ff..4dd247f54a 100644 --- a/tests/tcg/mips/user/ase/msa/int-max-min/test_msa_max_u_d.c +++ b/tests/tcg/mips/user/ase/msa/int-max-min/test_msa_max_u_d.c @@ -1,8 +1,8 @@ /* * Test program for MSA instruction MAX_U.D * - * Copyright (C) 2018 Wave Computing, Inc. - * Copyright (C) 2018 Aleksandar Markovic <amarkovic@wavecomp.com> + * Copyright (C) 2019 Wave Computing, Inc. + * Copyright (C) 2019 Aleksandar Markovic <amarkovic@wavecomp.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -23,8 +23,8 @@ #include <stdint.h> #include "../../../../include/wrappers_msa.h" -#include "../../../../include/test_inputs.h" -#include "../../../../include/test_utils.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) + \ diff --git a/tests/tcg/mips/user/ase/msa/int-max-min/test_msa_max_u_h.c b/tests/tcg/mips/user/ase/msa/int-max-min/test_msa_max_u_h.c index c7dff10709..0e6a7651eb 100644 --- a/tests/tcg/mips/user/ase/msa/int-max-min/test_msa_max_u_h.c +++ b/tests/tcg/mips/user/ase/msa/int-max-min/test_msa_max_u_h.c @@ -1,8 +1,8 @@ /* * Test program for MSA instruction MAX_U.H * - * Copyright (C) 2018 Wave Computing, Inc. - * Copyright (C) 2018 Aleksandar Markovic <amarkovic@wavecomp.com> + * Copyright (C) 2019 Wave Computing, Inc. + * Copyright (C) 2019 Aleksandar Markovic <amarkovic@wavecomp.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -23,8 +23,8 @@ #include <stdint.h> #include "../../../../include/wrappers_msa.h" -#include "../../../../include/test_inputs.h" -#include "../../../../include/test_utils.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) + \ diff --git a/tests/tcg/mips/user/ase/msa/int-max-min/test_msa_max_u_w.c b/tests/tcg/mips/user/ase/msa/int-max-min/test_msa_max_u_w.c index 910dbfc0ca..db61440551 100644 --- a/tests/tcg/mips/user/ase/msa/int-max-min/test_msa_max_u_w.c +++ b/tests/tcg/mips/user/ase/msa/int-max-min/test_msa_max_u_w.c @@ -1,8 +1,8 @@ /* * Test program for MSA instruction MAX_U.W * - * Copyright (C) 2018 Wave Computing, Inc. - * Copyright (C) 2018 Aleksandar Markovic <amarkovic@wavecomp.com> + * Copyright (C) 2019 Wave Computing, Inc. + * Copyright (C) 2019 Aleksandar Markovic <amarkovic@wavecomp.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -23,8 +23,8 @@ #include <stdint.h> #include "../../../../include/wrappers_msa.h" -#include "../../../../include/test_inputs.h" -#include "../../../../include/test_utils.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) + \ diff --git a/tests/tcg/mips/user/ase/msa/int-max-min/test_msa_min_a_b.c b/tests/tcg/mips/user/ase/msa/int-max-min/test_msa_min_a_b.c index c632fe974f..d2a93a2e44 100644 --- a/tests/tcg/mips/user/ase/msa/int-max-min/test_msa_min_a_b.c +++ b/tests/tcg/mips/user/ase/msa/int-max-min/test_msa_min_a_b.c @@ -1,8 +1,8 @@ /* * Test program for MSA instruction MIN_A.B * - * Copyright (C) 2018 Wave Computing, Inc. - * Copyright (C) 2018 Aleksandar Markovic <amarkovic@wavecomp.com> + * Copyright (C) 2019 Wave Computing, Inc. + * Copyright (C) 2019 Aleksandar Markovic <amarkovic@wavecomp.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -23,8 +23,8 @@ #include <stdint.h> #include "../../../../include/wrappers_msa.h" -#include "../../../../include/test_inputs.h" -#include "../../../../include/test_utils.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) + \ diff --git a/tests/tcg/mips/user/ase/msa/int-max-min/test_msa_min_a_d.c b/tests/tcg/mips/user/ase/msa/int-max-min/test_msa_min_a_d.c index 5f9a9d4706..69fd3c7662 100644 --- a/tests/tcg/mips/user/ase/msa/int-max-min/test_msa_min_a_d.c +++ b/tests/tcg/mips/user/ase/msa/int-max-min/test_msa_min_a_d.c @@ -1,8 +1,8 @@ /* * Test program for MSA instruction MIN_A.D * - * Copyright (C) 2018 Wave Computing, Inc. - * Copyright (C) 2018 Aleksandar Markovic <amarkovic@wavecomp.com> + * Copyright (C) 2019 Wave Computing, Inc. + * Copyright (C) 2019 Aleksandar Markovic <amarkovic@wavecomp.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -23,8 +23,8 @@ #include <stdint.h> #include "../../../../include/wrappers_msa.h" -#include "../../../../include/test_inputs.h" -#include "../../../../include/test_utils.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) + \ diff --git a/tests/tcg/mips/user/ase/msa/int-max-min/test_msa_min_a_h.c b/tests/tcg/mips/user/ase/msa/int-max-min/test_msa_min_a_h.c index dc73927bb7..9f45b55539 100644 --- a/tests/tcg/mips/user/ase/msa/int-max-min/test_msa_min_a_h.c +++ b/tests/tcg/mips/user/ase/msa/int-max-min/test_msa_min_a_h.c @@ -1,8 +1,8 @@ /* * Test program for MSA instruction MIN_A.H * - * Copyright (C) 2018 Wave Computing, Inc. - * Copyright (C) 2018 Aleksandar Markovic <amarkovic@wavecomp.com> + * Copyright (C) 2019 Wave Computing, Inc. + * Copyright (C) 2019 Aleksandar Markovic <amarkovic@wavecomp.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -23,8 +23,8 @@ #include <stdint.h> #include "../../../../include/wrappers_msa.h" -#include "../../../../include/test_inputs.h" -#include "../../../../include/test_utils.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) + \ diff --git a/tests/tcg/mips/user/ase/msa/int-max-min/test_msa_min_a_w.c b/tests/tcg/mips/user/ase/msa/int-max-min/test_msa_min_a_w.c index 67b33f3751..b08231d65f 100644 --- a/tests/tcg/mips/user/ase/msa/int-max-min/test_msa_min_a_w.c +++ b/tests/tcg/mips/user/ase/msa/int-max-min/test_msa_min_a_w.c @@ -1,8 +1,8 @@ /* * Test program for MSA instruction MIN_A.W * - * Copyright (C) 2018 Wave Computing, Inc. - * Copyright (C) 2018 Aleksandar Markovic <amarkovic@wavecomp.com> + * Copyright (C) 2019 Wave Computing, Inc. + * Copyright (C) 2019 Aleksandar Markovic <amarkovic@wavecomp.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -23,8 +23,8 @@ #include <stdint.h> #include "../../../../include/wrappers_msa.h" -#include "../../../../include/test_inputs.h" -#include "../../../../include/test_utils.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) + \ diff --git a/tests/tcg/mips/user/ase/msa/int-max-min/test_msa_min_s_b.c b/tests/tcg/mips/user/ase/msa/int-max-min/test_msa_min_s_b.c index 76bb133da7..80b5201be1 100644 --- a/tests/tcg/mips/user/ase/msa/int-max-min/test_msa_min_s_b.c +++ b/tests/tcg/mips/user/ase/msa/int-max-min/test_msa_min_s_b.c @@ -1,8 +1,8 @@ /* * Test program for MSA instruction MIN_S.B * - * Copyright (C) 2018 Wave Computing, Inc. - * Copyright (C) 2018 Aleksandar Markovic <amarkovic@wavecomp.com> + * Copyright (C) 2019 Wave Computing, Inc. + * Copyright (C) 2019 Aleksandar Markovic <amarkovic@wavecomp.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -23,8 +23,8 @@ #include <stdint.h> #include "../../../../include/wrappers_msa.h" -#include "../../../../include/test_inputs.h" -#include "../../../../include/test_utils.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) + \ diff --git a/tests/tcg/mips/user/ase/msa/int-max-min/test_msa_min_s_d.c b/tests/tcg/mips/user/ase/msa/int-max-min/test_msa_min_s_d.c index 8ef57a9533..0ed319024c 100644 --- a/tests/tcg/mips/user/ase/msa/int-max-min/test_msa_min_s_d.c +++ b/tests/tcg/mips/user/ase/msa/int-max-min/test_msa_min_s_d.c @@ -1,8 +1,8 @@ /* * Test program for MSA instruction MIN_S.D * - * Copyright (C) 2018 Wave Computing, Inc. - * Copyright (C) 2018 Aleksandar Markovic <amarkovic@wavecomp.com> + * Copyright (C) 2019 Wave Computing, Inc. + * Copyright (C) 2019 Aleksandar Markovic <amarkovic@wavecomp.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -23,8 +23,8 @@ #include <stdint.h> #include "../../../../include/wrappers_msa.h" -#include "../../../../include/test_inputs.h" -#include "../../../../include/test_utils.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) + \ diff --git a/tests/tcg/mips/user/ase/msa/int-max-min/test_msa_min_s_h.c b/tests/tcg/mips/user/ase/msa/int-max-min/test_msa_min_s_h.c index e206040f98..b049054d9f 100644 --- a/tests/tcg/mips/user/ase/msa/int-max-min/test_msa_min_s_h.c +++ b/tests/tcg/mips/user/ase/msa/int-max-min/test_msa_min_s_h.c @@ -1,8 +1,8 @@ /* * Test program for MSA instruction MIN_S.H * - * Copyright (C) 2018 Wave Computing, Inc. - * Copyright (C) 2018 Aleksandar Markovic <amarkovic@wavecomp.com> + * Copyright (C) 2019 Wave Computing, Inc. + * Copyright (C) 2019 Aleksandar Markovic <amarkovic@wavecomp.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -23,8 +23,8 @@ #include <stdint.h> #include "../../../../include/wrappers_msa.h" -#include "../../../../include/test_inputs.h" -#include "../../../../include/test_utils.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) + \ diff --git a/tests/tcg/mips/user/ase/msa/int-max-min/test_msa_min_s_w.c b/tests/tcg/mips/user/ase/msa/int-max-min/test_msa_min_s_w.c index 7532bce550..2bcd0a00ef 100644 --- a/tests/tcg/mips/user/ase/msa/int-max-min/test_msa_min_s_w.c +++ b/tests/tcg/mips/user/ase/msa/int-max-min/test_msa_min_s_w.c @@ -1,8 +1,8 @@ /* * Test program for MSA instruction MIN_S.W * - * Copyright (C) 2018 Wave Computing, Inc. - * Copyright (C) 2018 Aleksandar Markovic <amarkovic@wavecomp.com> + * Copyright (C) 2019 Wave Computing, Inc. + * Copyright (C) 2019 Aleksandar Markovic <amarkovic@wavecomp.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -23,8 +23,8 @@ #include <stdint.h> #include "../../../../include/wrappers_msa.h" -#include "../../../../include/test_inputs.h" -#include "../../../../include/test_utils.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) + \ diff --git a/tests/tcg/mips/user/ase/msa/int-max-min/test_msa_min_u_b.c b/tests/tcg/mips/user/ase/msa/int-max-min/test_msa_min_u_b.c index 1f611453a2..2a06b43379 100644 --- a/tests/tcg/mips/user/ase/msa/int-max-min/test_msa_min_u_b.c +++ b/tests/tcg/mips/user/ase/msa/int-max-min/test_msa_min_u_b.c @@ -1,8 +1,8 @@ /* * Test program for MSA instruction MIN_U.B * - * Copyright (C) 2018 Wave Computing, Inc. - * Copyright (C) 2018 Aleksandar Markovic <amarkovic@wavecomp.com> + * Copyright (C) 2019 Wave Computing, Inc. + * Copyright (C) 2019 Aleksandar Markovic <amarkovic@wavecomp.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -23,8 +23,8 @@ #include <stdint.h> #include "../../../../include/wrappers_msa.h" -#include "../../../../include/test_inputs.h" -#include "../../../../include/test_utils.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) + \ diff --git a/tests/tcg/mips/user/ase/msa/int-max-min/test_msa_min_u_d.c b/tests/tcg/mips/user/ase/msa/int-max-min/test_msa_min_u_d.c index 4626c62354..37924f3038 100644 --- a/tests/tcg/mips/user/ase/msa/int-max-min/test_msa_min_u_d.c +++ b/tests/tcg/mips/user/ase/msa/int-max-min/test_msa_min_u_d.c @@ -1,8 +1,8 @@ /* * Test program for MSA instruction MIN_U.D * - * Copyright (C) 2018 Wave Computing, Inc. - * Copyright (C) 2018 Aleksandar Markovic <amarkovic@wavecomp.com> + * Copyright (C) 2019 Wave Computing, Inc. + * Copyright (C) 2019 Aleksandar Markovic <amarkovic@wavecomp.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -23,8 +23,8 @@ #include <stdint.h> #include "../../../../include/wrappers_msa.h" -#include "../../../../include/test_inputs.h" -#include "../../../../include/test_utils.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) + \ diff --git a/tests/tcg/mips/user/ase/msa/int-max-min/test_msa_min_u_h.c b/tests/tcg/mips/user/ase/msa/int-max-min/test_msa_min_u_h.c index 5eeb8d034b..1846995ce4 100644 --- a/tests/tcg/mips/user/ase/msa/int-max-min/test_msa_min_u_h.c +++ b/tests/tcg/mips/user/ase/msa/int-max-min/test_msa_min_u_h.c @@ -1,8 +1,8 @@ /* * Test program for MSA instruction MIN_U.H * - * Copyright (C) 2018 Wave Computing, Inc. - * Copyright (C) 2018 Aleksandar Markovic <amarkovic@wavecomp.com> + * Copyright (C) 2019 Wave Computing, Inc. + * Copyright (C) 2019 Aleksandar Markovic <amarkovic@wavecomp.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -23,8 +23,8 @@ #include <stdint.h> #include "../../../../include/wrappers_msa.h" -#include "../../../../include/test_inputs.h" -#include "../../../../include/test_utils.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) + \ diff --git a/tests/tcg/mips/user/ase/msa/int-max-min/test_msa_min_u_w.c b/tests/tcg/mips/user/ase/msa/int-max-min/test_msa_min_u_w.c index e70964afa8..8b20c05440 100644 --- a/tests/tcg/mips/user/ase/msa/int-max-min/test_msa_min_u_w.c +++ b/tests/tcg/mips/user/ase/msa/int-max-min/test_msa_min_u_w.c @@ -1,8 +1,8 @@ /* * Test program for MSA instruction MIN_U.W * - * Copyright (C) 2018 Wave Computing, Inc. - * Copyright (C) 2018 Aleksandar Markovic <amarkovic@wavecomp.com> + * Copyright (C) 2019 Wave Computing, Inc. + * Copyright (C) 2019 Aleksandar Markovic <amarkovic@wavecomp.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -23,8 +23,8 @@ #include <stdint.h> #include "../../../../include/wrappers_msa.h" -#include "../../../../include/test_inputs.h" -#include "../../../../include/test_utils.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) + \ diff --git a/tests/tcg/mips/user/ase/msa/int-multiply/test_msa_mul_q_h.c b/tests/tcg/mips/user/ase/msa/int-multiply/test_msa_mul_q_h.c new file mode 100644 index 0000000000..f1526087fa --- /dev/null +++ b/tests/tcg/mips/user/ase/msa/int-multiply/test_msa_mul_q_h.c @@ -0,0 +1,151 @@ +/* + * Test program for MSA instruction MUL_Q.H + * + * Copyright (C) 2018 Wave Computing, Inc. + * Copyright (C) 2018 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.h" +#include "../../../../include/test_utils.h" + +#define TEST_COUNT_TOTAL ( \ + (PATTERN_INPUTS_SHORT_COUNT) * (PATTERN_INPUTS_SHORT_COUNT) + \ + (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT)) + + +int32_t main(void) +{ + char *instruction_name = "MUL_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, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, + { 0x0000ffff00000000ULL, 0xffff00000000ffffULL, }, + { 0xffff0000ffffffffULL, 0x0000ffffffff0000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 8 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 16 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x38e438e438e438e4ULL, 0x38e438e438e438e4ULL, }, + { 0xc71cc71cc71cc71cULL, 0xc71cc71cc71cc71cULL, }, + { 0x2222222222222222ULL, 0x2222222222222222ULL, }, + { 0xddddddddddddddddULL, 0xddddddddddddddddULL, }, + { 0x12f6da134bdb12f6ULL, 0xda134bdb12f6da13ULL, }, + { 0xed0925edb425ed09ULL, 0x25edb425ed0925edULL, }, + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 24 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0xc71cc71cc71cc71cULL, 0xc71cc71cc71cc71cULL, }, + { 0x38e338e338e338e3ULL, 0x38e338e338e338e3ULL, }, + { 0xddddddddddddddddULL, 0xddddddddddddddddULL, }, + { 0x2221222122212221ULL, 0x2221222122212221ULL, }, + { 0xed0925ecb425ed09ULL, 0x25ecb425ed0925ecULL, }, + { 0x12f5da124bd912f5ULL, 0xda124bd912f5da12ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 32 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x2222222222222222ULL, 0x2222222222222222ULL, }, + { 0xddddddddddddddddULL, 0xddddddddddddddddULL, }, + { 0x147b147b147b147bULL, 0x147b147b147b147bULL, }, + { 0xeb84eb84eb84eb84ULL, 0xeb84eb84eb84eb84ULL, }, + { 0x0b60e93e2d830b60ULL, 0xe93e2d830b60e93eULL, }, + { 0xf49f16c1d27cf49fULL, 0x16c1d27cf49f16c1ULL, }, + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 40 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0xddddddddddddddddULL, 0xddddddddddddddddULL, }, + { 0x2221222122212221ULL, 0x2221222122212221ULL, }, + { 0xeb84eb84eb84eb84ULL, 0xeb84eb84eb84eb84ULL, }, + { 0x147a147a147a147aULL, 0x147a147a147a147aULL, }, + { 0xf49f16c1d27cf49fULL, 0x16c1d27cf49f16c1ULL, }, + { 0x0b60e93e2d820b60ULL, 0xe93e2d820b60e93eULL, }, + { 0x0000ffff00000000ULL, 0xffff00000000ffffULL, }, /* 48 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x12f6da134bdb12f6ULL, 0xda134bdb12f6da13ULL, }, + { 0xed0925ecb425ed09ULL, 0x25ecb425ed0925ecULL, }, + { 0x0b60e93e2d830b60ULL, 0xe93e2d830b60e93eULL, }, + { 0xf49f16c1d27cf49fULL, 0x16c1d27cf49f16c1ULL, }, + { 0x0652194865240652ULL, 0x1948652406521948ULL, }, + { 0xf9ade6b79adcf9adULL, 0xe6b79adcf9ade6b7ULL, }, + { 0xffff0000ffffffffULL, 0x0000ffffffff0000ULL, }, /* 56 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0xed0925edb425ed09ULL, 0x25edb425ed0925edULL, }, + { 0x12f5da124bd912f5ULL, 0xda124bd912f5da12ULL, }, + { 0xf49f16c1d27cf49fULL, 0x16c1d27cf49f16c1ULL, }, + { 0x0b60e93e2d820b60ULL, 0xe93e2d820b60e93eULL, }, + { 0xf9ade6b79adcf9adULL, 0xe6b79adcf9ade6b7ULL, }, + { 0x0651194965220651ULL, 0x1949652206511949ULL, }, + { 0x6fb904f60cbd38c7ULL, 0x2c6b0102000431f1ULL, }, /* 64 */ + { 0x03faffec1879da0eULL, 0x0b2bf9e1ffbfcc2aULL, }, + { 0x4e261003e9dab268ULL, 0x1778faf00101e8d6ULL, }, + { 0x9712fb9b1db7ec38ULL, 0xbccff56b01071259ULL, }, + { 0x03faffec1879da0eULL, 0x0b2bf9e1ffbfcc2aULL, }, + { 0x002400002f03195aULL, 0x02cf2515038635ccULL, }, + { 0x02c8ffc1d57533d9ULL, 0x05e71eaef1eb1809ULL, }, + { 0xfc43001139150d37ULL, 0xef194023f19aecf4ULL, }, + { 0x4e261003e9dab268ULL, 0x1778faf00101e8d6ULL, }, /* 72 */ + { 0x02c8ffc1d57533d9ULL, 0x05e71eaef1eb1809ULL, }, + { 0x36aa33af267d6a08ULL, 0x0c67196238380abdULL, }, + { 0xb69bf1d4cc591b07ULL, 0xdc7e3510397df77dULL, }, + { 0x9712fb9b1db7ec38ULL, 0xbccff56b01071259ULL, }, + { 0xfc43001139150d37ULL, 0xef194023f19aecf4ULL, }, +}; + + gettimeofday(&start, NULL); + + for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) { + for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) { + do_msa_MUL_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_MUL_Q_H(b128_random[i], b128_random[j], + b128_result[((PATTERN_INPUTS_SHORT_COUNT) * + (PATTERN_INPUTS_SHORT_COUNT)) + + RANDOM_INPUTS_SHORT_COUNT * i + j]); + } + } + + gettimeofday(&end, NULL); + + elapsed_time = (end.tv_sec - start.tv_sec) * 1000.0; + elapsed_time += (end.tv_usec - start.tv_usec) / 1000.0; + + ret = check_results(instruction_name, TEST_COUNT_TOTAL, elapsed_time, + &b128_result[0][0], &b128_expect[0][0]); + + return ret; +} diff --git a/tests/tcg/mips/user/ase/msa/int-multiply/test_msa_mul_q_w.c b/tests/tcg/mips/user/ase/msa/int-multiply/test_msa_mul_q_w.c new file mode 100644 index 0000000000..df815ee9da --- /dev/null +++ b/tests/tcg/mips/user/ase/msa/int-multiply/test_msa_mul_q_w.c @@ -0,0 +1,151 @@ +/* + * Test program for MSA instruction MUL_Q.W + * + * Copyright (C) 2018 Wave Computing, Inc. + * Copyright (C) 2018 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.h" +#include "../../../../include/test_utils.h" + +#define TEST_COUNT_TOTAL ( \ + (PATTERN_INPUTS_SHORT_COUNT) * (PATTERN_INPUTS_SHORT_COUNT) + \ + (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT)) + + +int32_t main(void) +{ + char *instruction_name = "MUL_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, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, + { 0x0000000000000000ULL, 0xffffffff00000000ULL, }, + { 0xffffffffffffffffULL, 0x00000000ffffffffULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 8 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 16 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x38e38e3938e38e39ULL, 0x38e38e3938e38e39ULL, }, + { 0xc71c71c6c71c71c6ULL, 0xc71c71c6c71c71c6ULL, }, + { 0x2222222222222222ULL, 0x2222222222222222ULL, }, + { 0xddddddddddddddddULL, 0xddddddddddddddddULL, }, + { 0x12f684be4bda12f7ULL, 0xda12f68512f684beULL, }, + { 0xed097b42b425ed09ULL, 0x25ed097bed097b42ULL, }, + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 24 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0xc71c71c6c71c71c6ULL, 0xc71c71c6c71c71c6ULL, }, + { 0x38e38e3838e38e38ULL, 0x38e38e3838e38e38ULL, }, + { 0xddddddddddddddddULL, 0xddddddddddddddddULL, }, + { 0x2222222122222221ULL, 0x2222222122222221ULL, }, + { 0xed097b42b425ed09ULL, 0x25ed097aed097b42ULL, }, + { 0x12f684bd4bda12f5ULL, 0xda12f68412f684bdULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 32 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x2222222222222222ULL, 0x2222222222222222ULL, }, + { 0xddddddddddddddddULL, 0xddddddddddddddddULL, }, + { 0x147ae148147ae148ULL, 0x147ae148147ae148ULL, }, + { 0xeb851eb8eb851eb8ULL, 0xeb851eb8eb851eb8ULL, }, + { 0x0b60b60b2d82d82eULL, 0xe93e93e90b60b60bULL, }, + { 0xf49f49f4d27d27d2ULL, 0x16c16c17f49f49f4ULL, }, + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 40 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0xddddddddddddddddULL, 0xddddddddddddddddULL, }, + { 0x2222222122222221ULL, 0x2222222122222221ULL, }, + { 0xeb851eb8eb851eb8ULL, 0xeb851eb8eb851eb8ULL, }, + { 0x147ae147147ae147ULL, 0x147ae147147ae147ULL, }, + { 0xf49f49f4d27d27d2ULL, 0x16c16c16f49f49f4ULL, }, + { 0x0b60b60b2d82d82dULL, 0xe93e93e90b60b60bULL, }, + { 0x0000000000000000ULL, 0xffffffff00000000ULL, }, /* 48 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x12f684be4bda12f7ULL, 0xda12f68512f684beULL, }, + { 0xed097b42b425ed09ULL, 0x25ed097aed097b42ULL, }, + { 0x0b60b60b2d82d82eULL, 0xe93e93e90b60b60bULL, }, + { 0xf49f49f4d27d27d2ULL, 0x16c16c16f49f49f4ULL, }, + { 0x06522c3f6522c3f3ULL, 0x1948b0fc06522c3fULL, }, + { 0xf9add3c09add3c0dULL, 0xe6b74f03f9add3c0ULL, }, + { 0xffffffffffffffffULL, 0x00000000ffffffffULL, }, /* 56 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0xed097b42b425ed09ULL, 0x25ed097bed097b42ULL, }, + { 0x12f684bd4bda12f5ULL, 0xda12f68412f684bdULL, }, + { 0xf49f49f4d27d27d2ULL, 0x16c16c17f49f49f4ULL, }, + { 0x0b60b60b2d82d82dULL, 0xe93e93e90b60b60bULL, }, + { 0xf9add3c09add3c0dULL, 0xe6b74f03f9add3c0ULL, }, + { 0x06522c3f6522c3f1ULL, 0x1948b0fc06522c3fULL, }, + { 0x6fb7e8890cbdc0d2ULL, 0x2c6b144600049a04ULL, }, /* 64 */ + { 0x03fa514e1879c701ULL, 0x0b2c6ca9ffbf8ac6ULL, }, + { 0x4e252086e9daefbfULL, 0x1779189301015a34ULL, }, + { 0x9713a7171db7f3a5ULL, 0xbccfb4690107236fULL, }, + { 0x03fa514e1879c701ULL, 0x0b2c6ca9ffbf8ac6ULL, }, + { 0x002442012f047611ULL, 0x02cf8c140386e68eULL, }, + { 0x02c84b87d575d121ULL, 0x05e79a8af1eb1c52ULL, }, + { 0xfc439edc3916c1e4ULL, 0xef19389cf19a0fddULL, }, + { 0x4e252086e9daefbfULL, 0x1779189301015a34ULL, }, /* 72 */ + { 0x02c84b87d575d121ULL, 0x05e79a8af1eb1c52ULL, }, + { 0x36a93aff267d11c3ULL, 0x0c6788643838c14cULL, }, + { 0xb69baa39cc590fcdULL, 0xdc7e6df7397c58d9ULL, }, + { 0x9713a7171db7f3a5ULL, 0xbccfb4690107236fULL, }, + { 0xfc439edc3916c1e4ULL, 0xef19389cf19a0fddULL, }, +}; + + gettimeofday(&start, NULL); + + for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) { + for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) { + do_msa_MUL_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_MUL_Q_W(b128_random[i], b128_random[j], + b128_result[((PATTERN_INPUTS_SHORT_COUNT) * + (PATTERN_INPUTS_SHORT_COUNT)) + + RANDOM_INPUTS_SHORT_COUNT * i + j]); + } + } + + gettimeofday(&end, NULL); + + elapsed_time = (end.tv_sec - start.tv_sec) * 1000.0; + elapsed_time += (end.tv_usec - start.tv_usec) / 1000.0; + + ret = check_results(instruction_name, TEST_COUNT_TOTAL, elapsed_time, + &b128_result[0][0], &b128_expect[0][0]); + + return ret; +} diff --git a/tests/tcg/mips/user/ase/msa/int-multiply/test_msa_mulr_q_h.c b/tests/tcg/mips/user/ase/msa/int-multiply/test_msa_mulr_q_h.c new file mode 100644 index 0000000000..fd0a5fa7a8 --- /dev/null +++ b/tests/tcg/mips/user/ase/msa/int-multiply/test_msa_mulr_q_h.c @@ -0,0 +1,151 @@ +/* + * Test program for MSA instruction MULR_Q.H + * + * Copyright (C) 2018 Wave Computing, Inc. + * Copyright (C) 2018 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.h" +#include "../../../../include/test_utils.h" + +#define TEST_COUNT_TOTAL ( \ + (PATTERN_INPUTS_SHORT_COUNT) * (PATTERN_INPUTS_SHORT_COUNT) + \ + (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT)) + + +int32_t main(void) +{ + char *instruction_name = "MULR_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, }, + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000010000ULL, 0x0000000100000000ULL, }, + { 0x00000000ffff0000ULL, 0x0000ffff00000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 8 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0001000100010001ULL, 0x0001000100010001ULL, }, /* 16 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x38e438e438e438e4ULL, 0x38e438e438e438e4ULL, }, + { 0xc71cc71cc71cc71cULL, 0xc71cc71cc71cc71cULL, }, + { 0x2223222322232223ULL, 0x2223222322232223ULL, }, + { 0xdddedddedddedddeULL, 0xdddedddedddedddeULL, }, + { 0x12f7da134bdb12f7ULL, 0xda134bdb12f7da13ULL, }, + { 0xed0a25eeb425ed0aULL, 0x25eeb425ed0a25eeULL, }, + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 24 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0xc71cc71cc71cc71cULL, 0xc71cc71cc71cc71cULL, }, + { 0x38e338e338e338e3ULL, 0x38e338e338e338e3ULL, }, + { 0xddddddddddddddddULL, 0xddddddddddddddddULL, }, + { 0x2222222222222222ULL, 0x2222222222222222ULL, }, + { 0xed0925edb426ed09ULL, 0x25edb426ed0925edULL, }, + { 0x12f6da134bda12f6ULL, 0xda134bda12f6da13ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 32 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x2223222322232223ULL, 0x2223222322232223ULL, }, + { 0xddddddddddddddddULL, 0xddddddddddddddddULL, }, + { 0x147c147c147c147cULL, 0x147c147c147c147cULL, }, + { 0xeb85eb85eb85eb85ULL, 0xeb85eb85eb85eb85ULL, }, + { 0x0b61e93e2d840b61ULL, 0xe93e2d840b61e93eULL, }, + { 0xf49f16c2d27cf49fULL, 0x16c2d27cf49f16c2ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 40 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0xdddedddedddedddeULL, 0xdddedddedddedddeULL, }, + { 0x2222222222222222ULL, 0x2222222222222222ULL, }, + { 0xeb85eb85eb85eb85ULL, 0xeb85eb85eb85eb85ULL, }, + { 0x147b147b147b147bULL, 0x147b147b147b147bULL, }, + { 0xf49f16c1d27df49fULL, 0x16c1d27df49f16c1ULL, }, + { 0x0b60e93e2d830b60ULL, 0xe93e2d830b60e93eULL, }, + { 0x0000000000010000ULL, 0x0000000100000000ULL, }, /* 48 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x12f7da134bdb12f7ULL, 0xda134bdb12f7da13ULL, }, + { 0xed0925edb426ed09ULL, 0x25edb426ed0925edULL, }, + { 0x0b61e93e2d840b61ULL, 0xe93e2d840b61e93eULL, }, + { 0xf49f16c1d27df49fULL, 0x16c1d27df49f16c1ULL, }, + { 0x0652194865240652ULL, 0x1948652406521948ULL, }, + { 0xf9aee6b79addf9aeULL, 0xe6b79addf9aee6b7ULL, }, + { 0x00000000ffff0000ULL, 0x0000ffff00000000ULL, }, /* 56 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0xed0a25eeb425ed0aULL, 0x25eeb425ed0a25eeULL, }, + { 0x12f6da134bda12f6ULL, 0xda134bda12f6da13ULL, }, + { 0xf49f16c2d27cf49fULL, 0x16c2d27cf49f16c2ULL, }, + { 0x0b60e93e2d830b60ULL, 0xe93e2d830b60e93eULL, }, + { 0xf9aee6b79addf9aeULL, 0xe6b79addf9aee6b7ULL, }, + { 0x0652194965230652ULL, 0x1949652306521949ULL, }, + { 0x6fba04f60cbe38c7ULL, 0x2c6b0102000531f1ULL, }, /* 64 */ + { 0x03faffed1879da0fULL, 0x0b2cf9e2ffbfcc2aULL, }, + { 0x4e261004e9dbb269ULL, 0x1779faf00102e8d7ULL, }, + { 0x9713fb9c1db7ec39ULL, 0xbccff56b01081259ULL, }, + { 0x03faffed1879da0fULL, 0x0b2cf9e2ffbfcc2aULL, }, + { 0x002400002f04195bULL, 0x02cf2516038735cdULL, }, + { 0x02c8ffc1d57633daULL, 0x05e71eaff1eb180aULL, }, + { 0xfc44001139160d37ULL, 0xef1a4023f19aecf5ULL, }, + { 0x4e261004e9dbb269ULL, 0x1779faf00102e8d7ULL, }, /* 72 */ + { 0x02c8ffc1d57633daULL, 0x05e71eaff1eb180aULL, }, + { 0x36aa33af267e6a09ULL, 0x0c67196338390abeULL, }, + { 0xb69bf1d4cc591b07ULL, 0xdc7f3511397df77eULL, }, + { 0x9713fb9c1db7ec39ULL, 0xbccff56b01081259ULL, }, + { 0xfc44001139160d37ULL, 0xef1a4023f19aecf5ULL, }, +}; + + gettimeofday(&start, NULL); + + for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) { + for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) { + do_msa_MULR_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_MULR_Q_H(b128_random[i], b128_random[j], + b128_result[((PATTERN_INPUTS_SHORT_COUNT) * + (PATTERN_INPUTS_SHORT_COUNT)) + + RANDOM_INPUTS_SHORT_COUNT * i + j]); + } + } + + gettimeofday(&end, NULL); + + elapsed_time = (end.tv_sec - start.tv_sec) * 1000.0; + elapsed_time += (end.tv_usec - start.tv_usec) / 1000.0; + + ret = check_results(instruction_name, TEST_COUNT_TOTAL, elapsed_time, + &b128_result[0][0], &b128_expect[0][0]); + + return ret; +} diff --git a/tests/tcg/mips/user/ase/msa/int-multiply/test_msa_mulr_q_w.c b/tests/tcg/mips/user/ase/msa/int-multiply/test_msa_mulr_q_w.c new file mode 100644 index 0000000000..f28b0d0a20 --- /dev/null +++ b/tests/tcg/mips/user/ase/msa/int-multiply/test_msa_mulr_q_w.c @@ -0,0 +1,151 @@ +/* + * Test program for MSA instruction MULR_Q.W + * + * Copyright (C) 2018 Wave Computing, Inc. + * Copyright (C) 2018 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.h" +#include "../../../../include/test_utils.h" + +#define TEST_COUNT_TOTAL ( \ + (PATTERN_INPUTS_SHORT_COUNT) * (PATTERN_INPUTS_SHORT_COUNT) + \ + (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT)) + + +int32_t main(void) +{ + char *instruction_name = "MULR_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, }, + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000001ULL, 0x0000000000000000ULL, }, + { 0x00000000ffffffffULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 8 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000100000001ULL, 0x0000000100000001ULL, }, /* 16 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x38e38e3a38e38e3aULL, 0x38e38e3a38e38e3aULL, }, + { 0xc71c71c7c71c71c7ULL, 0xc71c71c7c71c71c7ULL, }, + { 0x2222222322222223ULL, 0x2222222322222223ULL, }, + { 0xdddddddedddddddeULL, 0xdddddddedddddddeULL, }, + { 0x12f684be4bda12f7ULL, 0xda12f68512f684beULL, }, + { 0xed097b43b425ed09ULL, 0x25ed097ced097b43ULL, }, + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 24 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0xc71c71c7c71c71c7ULL, 0xc71c71c7c71c71c7ULL, }, + { 0x38e38e3838e38e38ULL, 0x38e38e3838e38e38ULL, }, + { 0xddddddddddddddddULL, 0xddddddddddddddddULL, }, + { 0x2222222222222222ULL, 0x2222222222222222ULL, }, + { 0xed097b42b425ed0aULL, 0x25ed097bed097b42ULL, }, + { 0x12f684bd4bda12f6ULL, 0xda12f68512f684bdULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 32 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x2222222322222223ULL, 0x2222222322222223ULL, }, + { 0xddddddddddddddddULL, 0xddddddddddddddddULL, }, + { 0x147ae148147ae148ULL, 0x147ae148147ae148ULL, }, + { 0xeb851eb8eb851eb8ULL, 0xeb851eb8eb851eb8ULL, }, + { 0x0b60b60c2d82d82eULL, 0xe93e93e90b60b60cULL, }, + { 0xf49f49f5d27d27d2ULL, 0x16c16c17f49f49f5ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 40 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0xdddddddedddddddeULL, 0xdddddddedddddddeULL, }, + { 0x2222222222222222ULL, 0x2222222222222222ULL, }, + { 0xeb851eb8eb851eb8ULL, 0xeb851eb8eb851eb8ULL, }, + { 0x147ae148147ae148ULL, 0x147ae148147ae148ULL, }, + { 0xf49f49f4d27d27d3ULL, 0x16c16c16f49f49f4ULL, }, + { 0x0b60b60b2d82d82dULL, 0xe93e93e90b60b60bULL, }, + { 0x0000000000000001ULL, 0x0000000000000000ULL, }, /* 48 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x12f684be4bda12f7ULL, 0xda12f68512f684beULL, }, + { 0xed097b42b425ed0aULL, 0x25ed097bed097b42ULL, }, + { 0x0b60b60c2d82d82eULL, 0xe93e93e90b60b60cULL, }, + { 0xf49f49f4d27d27d3ULL, 0x16c16c16f49f49f4ULL, }, + { 0x06522c3f6522c3f4ULL, 0x1948b0fc06522c3fULL, }, + { 0xf9add3c19add3c0dULL, 0xe6b74f04f9add3c1ULL, }, + { 0x00000000ffffffffULL, 0x0000000000000000ULL, }, /* 56 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0xed097b43b425ed09ULL, 0x25ed097ced097b43ULL, }, + { 0x12f684bd4bda12f6ULL, 0xda12f68512f684bdULL, }, + { 0xf49f49f5d27d27d2ULL, 0x16c16c17f49f49f5ULL, }, + { 0x0b60b60b2d82d82dULL, 0xe93e93e90b60b60bULL, }, + { 0xf9add3c19add3c0dULL, 0xe6b74f04f9add3c1ULL, }, + { 0x06522c3f6522c3f2ULL, 0x1948b0fd06522c3fULL, }, + { 0x6fb7e8890cbdc0d3ULL, 0x2c6b144600049a05ULL, }, /* 64 */ + { 0x03fa514e1879c702ULL, 0x0b2c6ca9ffbf8ac7ULL, }, + { 0x4e252087e9daefc0ULL, 0x1779189301015a35ULL, }, + { 0x9713a7171db7f3a6ULL, 0xbccfb46a0107236fULL, }, + { 0x03fa514e1879c702ULL, 0x0b2c6ca9ffbf8ac7ULL, }, + { 0x002442012f047612ULL, 0x02cf8c140386e68fULL, }, + { 0x02c84b88d575d121ULL, 0x05e79a8bf1eb1c52ULL, }, + { 0xfc439edd3916c1e4ULL, 0xef19389cf19a0fdeULL, }, + { 0x4e252087e9daefc0ULL, 0x1779189301015a35ULL, }, /* 72 */ + { 0x02c84b88d575d121ULL, 0x05e79a8bf1eb1c52ULL, }, + { 0x36a93aff267d11c4ULL, 0x0c6788643838c14cULL, }, + { 0xb69baa3acc590fcdULL, 0xdc7e6df7397c58daULL, }, + { 0x9713a7171db7f3a6ULL, 0xbccfb46a0107236fULL, }, + { 0xfc439edd3916c1e4ULL, 0xef19389cf19a0fdeULL, }, +}; + + gettimeofday(&start, NULL); + + for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) { + for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) { + do_msa_MULR_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_MULR_Q_W(b128_random[i], b128_random[j], + b128_result[((PATTERN_INPUTS_SHORT_COUNT) * + (PATTERN_INPUTS_SHORT_COUNT)) + + RANDOM_INPUTS_SHORT_COUNT * i + j]); + } + } + + gettimeofday(&end, NULL); + + elapsed_time = (end.tv_sec - start.tv_sec) * 1000.0; + elapsed_time += (end.tv_usec - start.tv_usec) / 1000.0; + + ret = check_results(instruction_name, TEST_COUNT_TOTAL, elapsed_time, + &b128_result[0][0], &b128_expect[0][0]); + + return ret; +} diff --git a/tests/tcg/mips/user/ase/msa/int-multiply/test_msa_mulv_b.c b/tests/tcg/mips/user/ase/msa/int-multiply/test_msa_mulv_b.c new file mode 100644 index 0000000000..6beeda906d --- /dev/null +++ b/tests/tcg/mips/user/ase/msa/int-multiply/test_msa_mulv_b.c @@ -0,0 +1,151 @@ +/* + * Test program for MSA instruction MULV.B + * + * Copyright (C) 2018 Wave Computing, Inc. + * Copyright (C) 2018 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.h" +#include "../../../../include/test_utils.h" + +#define TEST_COUNT_TOTAL ( \ + (PATTERN_INPUTS_SHORT_COUNT) * (PATTERN_INPUTS_SHORT_COUNT) + \ + (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT)) + + +int32_t main(void) +{ + char *instruction_name = "MULV.B"; + int32_t ret; + uint32_t i, j; + struct timeval start, end; + double elapsed_time; + + uint64_t b128_result[TEST_COUNT_TOTAL][2]; + uint64_t b128_expect[TEST_COUNT_TOTAL][2] = { + { 0x0101010101010101ULL, 0x0101010101010101ULL, }, /* 0 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x5656565656565656ULL, 0x5656565656565656ULL, }, + { 0xababababababababULL, 0xababababababababULL, }, + { 0x3434343434343434ULL, 0x3434343434343434ULL, }, + { 0xcdcdcdcdcdcdcdcdULL, 0xcdcdcdcdcdcdcdcdULL, }, + { 0x1d72c81d72c81d72ULL, 0xc81d72c81d72c81dULL, }, + { 0xe48f39e48f39e48fULL, 0x39e48f39e48f39e4ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 8 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x5656565656565656ULL, 0x5656565656565656ULL, }, /* 16 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0xe4e4e4e4e4e4e4e4ULL, 0xe4e4e4e4e4e4e4e4ULL, }, + { 0x7272727272727272ULL, 0x7272727272727272ULL, }, + { 0x7878787878787878ULL, 0x7878787878787878ULL, }, + { 0xdedededededededeULL, 0xdedededededededeULL, }, + { 0xbe4c30be4c30be4cULL, 0x30be4c30be4c30beULL, }, + { 0x980a26980a26980aULL, 0x26980a26980a2698ULL, }, + { 0xababababababababULL, 0xababababababababULL, }, /* 24 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x7272727272727272ULL, 0x7272727272727272ULL, }, + { 0x3939393939393939ULL, 0x3939393939393939ULL, }, + { 0xbcbcbcbcbcbcbcbcULL, 0xbcbcbcbcbcbcbcbcULL, }, + { 0xefefefefefefefefULL, 0xefefefefefefefefULL, }, + { 0x5f26985f26985f26ULL, 0x985f26985f26985fULL, }, + { 0x4c85134c85134c85ULL, 0x134c85134c85134cULL, }, + { 0x3434343434343434ULL, 0x3434343434343434ULL, }, /* 32 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x7878787878787878ULL, 0x7878787878787878ULL, }, + { 0xbcbcbcbcbcbcbcbcULL, 0xbcbcbcbcbcbcbcbcULL, }, + { 0x9090909090909090ULL, 0x9090909090909090ULL, }, + { 0xa4a4a4a4a4a4a4a4ULL, 0xa4a4a4a4a4a4a4a4ULL, }, + { 0xe428a0e428a0e428ULL, 0xa0e428a0e428a0e4ULL, }, + { 0x500c94500c94500cULL, 0x94500c94500c9450ULL, }, + { 0xcdcdcdcdcdcdcdcdULL, 0xcdcdcdcdcdcdcdcdULL, }, /* 40 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0xdedededededededeULL, 0xdedededededededeULL, }, + { 0xefefefefefefefefULL, 0xefefefefefefefefULL, }, + { 0xa4a4a4a4a4a4a4a4ULL, 0xa4a4a4a4a4a4a4a4ULL, }, + { 0x2929292929292929ULL, 0x2929292929292929ULL, }, + { 0x394a28394a28394aULL, 0x28394a28394a2839ULL, }, + { 0x9483a59483a59483ULL, 0xa59483a59483a594ULL, }, + { 0x1d72c81d72c81d72ULL, 0xc81d72c81d72c81dULL, }, /* 48 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0xbe4c30be4c30be4cULL, 0x30be4c30be4c30beULL, }, + { 0x5f26985f26985f26ULL, 0x985f26985f26985fULL, }, + { 0xe428a0e428a0e428ULL, 0xa0e428a0e428a0e4ULL, }, + { 0x394a28394a28394aULL, 0x28394a28394a2839ULL, }, + { 0x49c44049c44049c4ULL, 0x4049c44049c44049ULL, }, + { 0xd4ae88d4ae88d4aeULL, 0x88d4ae88d4ae88d4ULL, }, + { 0xe48f39e48f39e48fULL, 0x39e48f39e48f39e4ULL, }, /* 56 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x980a26980a26980aULL, 0x26980a26980a2698ULL, }, + { 0x4c85134c85134c85ULL, 0x134c85134c85134cULL, }, + { 0x500c94500c94500cULL, 0x94500c94500c9450ULL, }, + { 0x9483a59483a59483ULL, 0xa59483a59483a594ULL, }, + { 0xd4ae88d4ae88d4aeULL, 0x88d4ae88d4ae88d4ULL, }, + { 0x10e1b110e1b110e1ULL, 0xb110e1b110e1b110ULL, }, + { 0x40e4a49040843900ULL, 0xf971798404190090ULL, }, /* 64 */ + { 0x58ac00e408461300ULL, 0x4661098cd64560d0ULL, }, + { 0x60445478e83e2700ULL, 0x6de882a2aaa970f0ULL, }, + { 0x80b6c45cb0c20a80ULL, 0x4ff7d850aeb66080ULL, }, + { 0x58ac00e408461300ULL, 0x4661098cd64560d0ULL, }, + { 0x190400492969b140ULL, 0x445199a4b9814410ULL, }, + { 0xa4cc00bea5dd0d00ULL, 0xbe68a2e60795dab0ULL, }, + { 0xd0a200c74623ae70ULL, 0xea8758f0dd3e6480ULL, }, + { 0x60445478e83e2700ULL, 0x6de882a2aaa970f0ULL, }, /* 72 */ + { 0xa4cc00bea5dd0d00ULL, 0xbe68a2e60795dab0ULL, }, + { 0x90a444e4b1617900ULL, 0xf140240139395990ULL, }, + { 0x40c6f422ee9fb600ULL, 0x7b583028e316aa80ULL, }, + { 0x80b6c45cb0c20a80ULL, 0x4ff7d850aeb66080ULL, }, + { 0xd0a200c74623ae70ULL, 0xea8758f0dd3e6480ULL, }, +}; + + gettimeofday(&start, NULL); + + for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) { + for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) { + do_msa_MULV_B(b128_pattern[i], b128_pattern[j], + b128_result[PATTERN_INPUTS_SHORT_COUNT * i + j]); + } + } + + for (i = 0; i < RANDOM_INPUTS_SHORT_COUNT; i++) { + for (j = 0; j < RANDOM_INPUTS_SHORT_COUNT; j++) { + do_msa_MULV_B(b128_random[i], b128_random[j], + b128_result[((PATTERN_INPUTS_SHORT_COUNT) * + (PATTERN_INPUTS_SHORT_COUNT)) + + RANDOM_INPUTS_SHORT_COUNT * i + j]); + } + } + + gettimeofday(&end, NULL); + + elapsed_time = (end.tv_sec - start.tv_sec) * 1000.0; + elapsed_time += (end.tv_usec - start.tv_usec) / 1000.0; + + ret = check_results(instruction_name, TEST_COUNT_TOTAL, elapsed_time, + &b128_result[0][0], &b128_expect[0][0]); + + return ret; +} diff --git a/tests/tcg/mips/user/ase/msa/int-multiply/test_msa_mulv_d.c b/tests/tcg/mips/user/ase/msa/int-multiply/test_msa_mulv_d.c new file mode 100644 index 0000000000..3205d4b378 --- /dev/null +++ b/tests/tcg/mips/user/ase/msa/int-multiply/test_msa_mulv_d.c @@ -0,0 +1,151 @@ +/* + * Test program for MSA instruction MULV.D + * + * Copyright (C) 2018 Wave Computing, Inc. + * Copyright (C) 2018 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.h" +#include "../../../../include/test_utils.h" + +#define TEST_COUNT_TOTAL ( \ + (PATTERN_INPUTS_SHORT_COUNT) * (PATTERN_INPUTS_SHORT_COUNT) + \ + (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT)) + + +int32_t main(void) +{ + char *instruction_name = "MULV.D"; + int32_t ret; + uint32_t i, j; + struct timeval start, end; + double elapsed_time; + + uint64_t b128_result[TEST_COUNT_TOTAL][2]; + uint64_t b128_expect[TEST_COUNT_TOTAL][2] = { + { 0x0000000000000001ULL, 0x0000000000000001ULL, }, /* 0 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x5555555555555556ULL, 0x5555555555555556ULL, }, + { 0xaaaaaaaaaaaaaaabULL, 0xaaaaaaaaaaaaaaabULL, }, + { 0x3333333333333334ULL, 0x3333333333333334ULL, }, + { 0xcccccccccccccccdULL, 0xcccccccccccccccdULL, }, + { 0x1c71c71c71c71c72ULL, 0xc71c71c71c71c71dULL, }, + { 0xe38e38e38e38e38fULL, 0x38e38e38e38e38e4ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 8 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x5555555555555556ULL, 0x5555555555555556ULL, }, /* 16 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x38e38e38e38e38e4ULL, 0x38e38e38e38e38e4ULL, }, + { 0x1c71c71c71c71c72ULL, 0x1c71c71c71c71c72ULL, }, + { 0x7777777777777778ULL, 0x7777777777777778ULL, }, + { 0xdddddddddddddddeULL, 0xdddddddddddddddeULL, }, + { 0x12f684bda12f684cULL, 0x2f684bda12f684beULL, }, + { 0x425ed097b425ed0aULL, 0x25ed097b425ed098ULL, }, + { 0xaaaaaaaaaaaaaaabULL, 0xaaaaaaaaaaaaaaabULL, }, /* 24 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x1c71c71c71c71c72ULL, 0x1c71c71c71c71c72ULL, }, + { 0x8e38e38e38e38e39ULL, 0x8e38e38e38e38e39ULL, }, + { 0xbbbbbbbbbbbbbbbcULL, 0xbbbbbbbbbbbbbbbcULL, }, + { 0xeeeeeeeeeeeeeeefULL, 0xeeeeeeeeeeeeeeefULL, }, + { 0x097b425ed097b426ULL, 0x97b425ed097b425fULL, }, + { 0xa12f684bda12f685ULL, 0x12f684bda12f684cULL, }, + { 0x3333333333333334ULL, 0x3333333333333334ULL, }, /* 32 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x7777777777777778ULL, 0x7777777777777778ULL, }, + { 0xbbbbbbbbbbbbbbbcULL, 0xbbbbbbbbbbbbbbbcULL, }, + { 0xf5c28f5c28f5c290ULL, 0xf5c28f5c28f5c290ULL, }, + { 0x3d70a3d70a3d70a4ULL, 0x3d70a3d70a3d70a4ULL, }, + { 0x7d27d27d27d27d28ULL, 0x38e38e38e38e38e4ULL, }, + { 0xb60b60b60b60b60cULL, 0xfa4fa4fa4fa4fa50ULL, }, + { 0xcccccccccccccccdULL, 0xcccccccccccccccdULL, }, /* 40 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0xdddddddddddddddeULL, 0xdddddddddddddddeULL, }, + { 0xeeeeeeeeeeeeeeefULL, 0xeeeeeeeeeeeeeeefULL, }, + { 0x3d70a3d70a3d70a4ULL, 0x3d70a3d70a3d70a4ULL, }, + { 0x8f5c28f5c28f5c29ULL, 0x8f5c28f5c28f5c29ULL, }, + { 0x9f49f49f49f49f4aULL, 0x8e38e38e38e38e39ULL, }, + { 0x2d82d82d82d82d83ULL, 0x3e93e93e93e93e94ULL, }, + { 0x1c71c71c71c71c72ULL, 0xc71c71c71c71c71dULL, }, /* 48 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x12f684bda12f684cULL, 0x2f684bda12f684beULL, }, + { 0x097b425ed097b426ULL, 0x97b425ed097b425fULL, }, + { 0x7d27d27d27d27d28ULL, 0x38e38e38e38e38e4ULL, }, + { 0x9f49f49f49f49f4aULL, 0x8e38e38e38e38e39ULL, }, + { 0xb0fcd6e9e06522c4ULL, 0x522c3f35ba781949ULL, }, + { 0x6b74f0329161f9aeULL, 0x74f0329161f9add4ULL, }, + { 0xe38e38e38e38e38fULL, 0x38e38e38e38e38e4ULL, }, /* 56 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x425ed097b425ed0aULL, 0x25ed097b425ed098ULL, }, + { 0xa12f684bda12f685ULL, 0x12f684bda12f684cULL, }, + { 0xb60b60b60b60b60cULL, 0xfa4fa4fa4fa4fa50ULL, }, + { 0x2d82d82d82d82d83ULL, 0x3e93e93e93e93e94ULL, }, + { 0x6b74f0329161f9aeULL, 0x74f0329161f9add4ULL, }, + { 0x781948b0fcd6e9e1ULL, 0xc3f35ba781948b10ULL, }, + { 0xad45be6961639000ULL, 0x3297fdea74988090ULL, }, /* 64 */ + { 0xefa7a5a0e7176a00ULL, 0xb8110a1f6f1923d0ULL, }, + { 0x08c6139fc4346000ULL, 0xab209f86581f7cf0ULL, }, + { 0xfbe1883aee787980ULL, 0x821d25438dd09f80ULL, }, + { 0xefa7a5a0e7176a00ULL, 0xb8110a1f6f1923d0ULL, }, + { 0x37ae2b38fded7040ULL, 0x682476774aee6810ULL, }, + { 0x6acb3d68be6cdc00ULL, 0xafdad2311444e7b0ULL, }, + { 0xedbf72842143b470ULL, 0x7f8223caefce5580ULL, }, + { 0x08c6139fc4346000ULL, 0xab209f86581f7cf0ULL, }, /* 72 */ + { 0x6acb3d68be6cdc00ULL, 0xafdad2311444e7b0ULL, }, + { 0x8624e5e1e5044000ULL, 0xd98178a63216c990ULL, }, + { 0x76a5ab8089e38100ULL, 0xa1019a60d4dad480ULL, }, + { 0xfbe1883aee787980ULL, 0x821d25438dd09f80ULL, }, + { 0xedbf72842143b470ULL, 0x7f8223caefce5580ULL, }, +}; + + gettimeofday(&start, NULL); + + for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) { + for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) { + do_msa_MULV_D(b128_pattern[i], b128_pattern[j], + b128_result[PATTERN_INPUTS_SHORT_COUNT * i + j]); + } + } + + for (i = 0; i < RANDOM_INPUTS_SHORT_COUNT; i++) { + for (j = 0; j < RANDOM_INPUTS_SHORT_COUNT; j++) { + do_msa_MULV_D(b128_random[i], b128_random[j], + b128_result[((PATTERN_INPUTS_SHORT_COUNT) * + (PATTERN_INPUTS_SHORT_COUNT)) + + RANDOM_INPUTS_SHORT_COUNT * i + j]); + } + } + + gettimeofday(&end, NULL); + + elapsed_time = (end.tv_sec - start.tv_sec) * 1000.0; + elapsed_time += (end.tv_usec - start.tv_usec) / 1000.0; + + ret = check_results(instruction_name, TEST_COUNT_TOTAL, elapsed_time, + &b128_result[0][0], &b128_expect[0][0]); + + return ret; +} diff --git a/tests/tcg/mips/user/ase/msa/int-multiply/test_msa_mulv_h.c b/tests/tcg/mips/user/ase/msa/int-multiply/test_msa_mulv_h.c new file mode 100644 index 0000000000..e7bd985ae1 --- /dev/null +++ b/tests/tcg/mips/user/ase/msa/int-multiply/test_msa_mulv_h.c @@ -0,0 +1,151 @@ +/* + * Test program for MSA instruction MULV.H + * + * Copyright (C) 2018 Wave Computing, Inc. + * Copyright (C) 2018 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.h" +#include "../../../../include/test_utils.h" + +#define TEST_COUNT_TOTAL ( \ + (PATTERN_INPUTS_SHORT_COUNT) * (PATTERN_INPUTS_SHORT_COUNT) + \ + (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT)) + + +int32_t main(void) +{ + char *instruction_name = "MULV.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] = { + { 0x0001000100010001ULL, 0x0001000100010001ULL, }, /* 0 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x5556555655565556ULL, 0x5556555655565556ULL, }, + { 0xaaabaaabaaabaaabULL, 0xaaabaaabaaabaaabULL, }, + { 0x3334333433343334ULL, 0x3334333433343334ULL, }, + { 0xcccdcccdcccdcccdULL, 0xcccdcccdcccdcccdULL, }, + { 0x1c72c71d71c81c72ULL, 0xc71d71c81c72c71dULL, }, + { 0xe38f38e48e39e38fULL, 0x38e48e39e38f38e4ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 8 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x5556555655565556ULL, 0x5556555655565556ULL, }, /* 16 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x38e438e438e438e4ULL, 0x38e438e438e438e4ULL, }, + { 0x1c721c721c721c72ULL, 0x1c721c721c721c72ULL, }, + { 0x7778777877787778ULL, 0x7778777877787778ULL, }, + { 0xdddedddedddedddeULL, 0xdddedddedddedddeULL, }, + { 0x684c84bea130684cULL, 0x84bea130684c84beULL, }, + { 0xed0ad098b426ed0aULL, 0xd098b426ed0ad098ULL, }, + { 0xaaabaaabaaabaaabULL, 0xaaabaaabaaabaaabULL, }, /* 24 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x1c721c721c721c72ULL, 0x1c721c721c721c72ULL, }, + { 0x8e398e398e398e39ULL, 0x8e398e398e398e39ULL, }, + { 0xbbbcbbbcbbbcbbbcULL, 0xbbbcbbbcbbbcbbbcULL, }, + { 0xeeefeeefeeefeeefULL, 0xeeefeeefeeefeeefULL, }, + { 0xb426425fd098b426ULL, 0x425fd098b426425fULL, }, + { 0xf685684cda13f685ULL, 0x684cda13f685684cULL, }, + { 0x3334333433343334ULL, 0x3334333433343334ULL, }, /* 32 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x7778777877787778ULL, 0x7778777877787778ULL, }, + { 0xbbbcbbbcbbbcbbbcULL, 0xbbbcbbbcbbbcbbbcULL, }, + { 0xc290c290c290c290ULL, 0xc290c290c290c290ULL, }, + { 0x70a470a470a470a4ULL, 0x70a470a470a470a4ULL, }, + { 0x7d2838e4f4a07d28ULL, 0x38e4f4a07d2838e4ULL, }, + { 0xb60cfa503e94b60cULL, 0xfa503e94b60cfa50ULL, }, + { 0xcccdcccdcccdcccdULL, 0xcccdcccdcccdcccdULL, }, /* 40 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0xdddedddedddedddeULL, 0xdddedddedddedddeULL, }, + { 0xeeefeeefeeefeeefULL, 0xeeefeeefeeefeeefULL, }, + { 0x70a470a470a470a4ULL, 0x70a470a470a470a4ULL, }, + { 0x5c295c295c295c29ULL, 0x5c295c295c295c29ULL, }, + { 0x9f4a8e397d289f4aULL, 0x8e397d289f4a8e39ULL, }, + { 0x2d833e944fa52d83ULL, 0x3e944fa52d833e94ULL, }, + { 0x1c72c71d71c81c72ULL, 0xc71d71c81c72c71dULL, }, /* 48 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x684c84bea130684cULL, 0x84bea130684c84beULL, }, + { 0xb426425fd098b426ULL, 0x425fd098b426425fULL, }, + { 0x7d2838e4f4a07d28ULL, 0x38e4f4a07d2838e4ULL, }, + { 0x9f4a8e397d289f4aULL, 0x8e397d289f4a8e39ULL, }, + { 0x22c419492c4022c4ULL, 0x19492c4022c41949ULL, }, + { 0xf9aeadd44588f9aeULL, 0xadd44588f9aeadd4ULL, }, + { 0xe38f38e48e39e38fULL, 0x38e48e39e38f38e4ULL, }, /* 56 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0xed0ad098b426ed0aULL, 0xd098b426ed0ad098ULL, }, + { 0xf685684cda13f685ULL, 0x684cda13f685684cULL, }, + { 0xb60cfa503e94b60cULL, 0xfa503e94b60cfa50ULL, }, + { 0x2d833e944fa52d83ULL, 0x3e944fa52d833e94ULL, }, + { 0xf9aeadd44588f9aeULL, 0xadd44588f9aeadd4ULL, }, + { 0xe9e18b1048b1e9e1ULL, 0x8b1048b1e9e18b10ULL, }, + { 0xcbe43290c5849000ULL, 0x837136844f198090ULL, }, /* 64 */ + { 0x2cac40e4aa466a00ULL, 0xfe61d18cb74523d0ULL, }, + { 0x2d44eb78793e6000ULL, 0x4fe806a2e7a97cf0ULL, }, + { 0x78b6f35cb6c27980ULL, 0xb6f78750ceb69f80ULL, }, + { 0x2cac40e4aa466a00ULL, 0xfe61d18cb74523d0ULL, }, + { 0x21042649c2697040ULL, 0xaa51fea465816810ULL, }, + { 0x28cc8bbef4dddc00ULL, 0xa1687ae6a695e7b0ULL, }, + { 0xcfa29fc7d323b470ULL, 0xe587adf0113e5580ULL, }, + { 0x2d44eb78793e6000ULL, 0x4fe806a2e7a97cf0ULL, }, /* 72 */ + { 0x28cc8bbef4dddc00ULL, 0xa1687ae6a695e7b0ULL, }, + { 0x0fa488e4d5614000ULL, 0x864072017939c990ULL, }, + { 0x8fc62522929f8100ULL, 0x7a585f288416d480ULL, }, + { 0x78b6f35cb6c27980ULL, 0xb6f78750ceb69f80ULL, }, + { 0xcfa29fc7d323b470ULL, 0xe587adf0113e5580ULL, }, +}; + + gettimeofday(&start, NULL); + + for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) { + for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) { + do_msa_MULV_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_MULV_H(b128_random[i], b128_random[j], + b128_result[((PATTERN_INPUTS_SHORT_COUNT) * + (PATTERN_INPUTS_SHORT_COUNT)) + + RANDOM_INPUTS_SHORT_COUNT * i + j]); + } + } + + gettimeofday(&end, NULL); + + elapsed_time = (end.tv_sec - start.tv_sec) * 1000.0; + elapsed_time += (end.tv_usec - start.tv_usec) / 1000.0; + + ret = check_results(instruction_name, TEST_COUNT_TOTAL, elapsed_time, + &b128_result[0][0], &b128_expect[0][0]); + + return ret; +} diff --git a/tests/tcg/mips/user/ase/msa/int-multiply/test_msa_mulv_w.c b/tests/tcg/mips/user/ase/msa/int-multiply/test_msa_mulv_w.c new file mode 100644 index 0000000000..9c318b3fbb --- /dev/null +++ b/tests/tcg/mips/user/ase/msa/int-multiply/test_msa_mulv_w.c @@ -0,0 +1,151 @@ +/* + * Test program for MSA instruction MULV.W + * + * Copyright (C) 2018 Wave Computing, Inc. + * Copyright (C) 2018 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.h" +#include "../../../../include/test_utils.h" + +#define TEST_COUNT_TOTAL ( \ + (PATTERN_INPUTS_SHORT_COUNT) * (PATTERN_INPUTS_SHORT_COUNT) + \ + (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT)) + + +int32_t main(void) +{ + char *instruction_name = "MULV.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] = { + { 0x0000000100000001ULL, 0x0000000100000001ULL, }, /* 0 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x5555555655555556ULL, 0x5555555655555556ULL, }, + { 0xaaaaaaabaaaaaaabULL, 0xaaaaaaabaaaaaaabULL, }, + { 0x3333333433333334ULL, 0x3333333433333334ULL, }, + { 0xcccccccdcccccccdULL, 0xcccccccdcccccccdULL, }, + { 0x1c71c71d71c71c72ULL, 0xc71c71c81c71c71dULL, }, + { 0xe38e38e48e38e38fULL, 0x38e38e39e38e38e4ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 8 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x5555555655555556ULL, 0x5555555655555556ULL, }, /* 16 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0xe38e38e4e38e38e4ULL, 0xe38e38e4e38e38e4ULL, }, + { 0x71c71c7271c71c72ULL, 0x71c71c7271c71c72ULL, }, + { 0x7777777877777778ULL, 0x7777777877777778ULL, }, + { 0xdddddddedddddddeULL, 0xdddddddedddddddeULL, }, + { 0x12f684bea12f684cULL, 0x84bda13012f684beULL, }, + { 0x425ed098b425ed0aULL, 0xd097b426425ed098ULL, }, + { 0xaaaaaaabaaaaaaabULL, 0xaaaaaaabaaaaaaabULL, }, /* 24 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x71c71c7271c71c72ULL, 0x71c71c7271c71c72ULL, }, + { 0x38e38e3938e38e39ULL, 0x38e38e3938e38e39ULL, }, + { 0xbbbbbbbcbbbbbbbcULL, 0xbbbbbbbcbbbbbbbcULL, }, + { 0xeeeeeeefeeeeeeefULL, 0xeeeeeeefeeeeeeefULL, }, + { 0x097b425fd097b426ULL, 0x425ed098097b425fULL, }, + { 0xa12f684cda12f685ULL, 0x684bda13a12f684cULL, }, + { 0x3333333433333334ULL, 0x3333333433333334ULL, }, /* 32 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x7777777877777778ULL, 0x7777777877777778ULL, }, + { 0xbbbbbbbcbbbbbbbcULL, 0xbbbbbbbcbbbbbbbcULL, }, + { 0x28f5c29028f5c290ULL, 0x28f5c29028f5c290ULL, }, + { 0x0a3d70a40a3d70a4ULL, 0x0a3d70a40a3d70a4ULL, }, + { 0xe38e38e427d27d28ULL, 0x9f49f4a0e38e38e4ULL, }, + { 0x4fa4fa500b60b60cULL, 0x93e93e944fa4fa50ULL, }, + { 0xcccccccdcccccccdULL, 0xcccccccdcccccccdULL, }, /* 40 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0xdddddddedddddddeULL, 0xdddddddedddddddeULL, }, + { 0xeeeeeeefeeeeeeefULL, 0xeeeeeeefeeeeeeefULL, }, + { 0x0a3d70a40a3d70a4ULL, 0x0a3d70a40a3d70a4ULL, }, + { 0xc28f5c29c28f5c29ULL, 0xc28f5c29c28f5c29ULL, }, + { 0x38e38e3949f49f4aULL, 0x27d27d2838e38e39ULL, }, + { 0x93e93e9482d82d83ULL, 0xa4fa4fa593e93e94ULL, }, + { 0x1c71c71d71c71c72ULL, 0xc71c71c81c71c71dULL, }, /* 48 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x12f684bea12f684cULL, 0x84bda13012f684beULL, }, + { 0x097b425fd097b426ULL, 0x425ed098097b425fULL, }, + { 0xe38e38e427d27d28ULL, 0x9f49f4a0e38e38e4ULL, }, + { 0x38e38e3949f49f4aULL, 0x27d27d2838e38e39ULL, }, + { 0xba781949e06522c4ULL, 0x06522c40ba781949ULL, }, + { 0x61f9add49161f9aeULL, 0xc0ca458861f9add4ULL, }, + { 0xe38e38e48e38e38fULL, 0x38e38e39e38e38e4ULL, }, /* 56 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x425ed098b425ed0aULL, 0xd097b426425ed098ULL, }, + { 0xa12f684cda12f685ULL, 0x684bda13a12f684cULL, }, + { 0x4fa4fa500b60b60cULL, 0x93e93e944fa4fa50ULL, }, + { 0x93e93e9482d82d83ULL, 0xa4fa4fa593e93e94ULL, }, + { 0x61f9add49161f9aeULL, 0xc0ca458861f9add4ULL, }, + { 0x81948b10fcd6e9e1ULL, 0x781948b181948b10ULL, }, + { 0xb103329061639000ULL, 0x3a25368474988090ULL, }, /* 64 */ + { 0x10bf40e4e7176a00ULL, 0x8176d18c6f1923d0ULL, }, + { 0x7393eb78c4346000ULL, 0xb7bf06a2581f7cf0ULL, }, + { 0xb0f0f35cee787980ULL, 0xd67987508dd09f80ULL, }, + { 0x10bf40e4e7176a00ULL, 0x8176d18c6f1923d0ULL, }, + { 0xb4f42649fded7040ULL, 0x3ceafea44aee6810ULL, }, + { 0xf73d8bbebe6cdc00ULL, 0x53697ae61444e7b0ULL, }, + { 0x7abb9fc72143b470ULL, 0x11e5adf0efce5580ULL, }, + { 0x7393eb78c4346000ULL, 0xb7bf06a2581f7cf0ULL, }, /* 72 */ + { 0xf73d8bbebe6cdc00ULL, 0x53697ae61444e7b0ULL, }, + { 0xb6b388e4e5044000ULL, 0x1aff72013216c990ULL, }, + { 0xe8bf252289e38100ULL, 0x91ae5f28d4dad480ULL, }, + { 0xb0f0f35cee787980ULL, 0xd67987508dd09f80ULL, }, + { 0x7abb9fc72143b470ULL, 0x11e5adf0efce5580ULL, }, +}; + + gettimeofday(&start, NULL); + + for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) { + for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) { + do_msa_MULV_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_MULV_W(b128_random[i], b128_random[j], + b128_result[((PATTERN_INPUTS_SHORT_COUNT) * + (PATTERN_INPUTS_SHORT_COUNT)) + + RANDOM_INPUTS_SHORT_COUNT * i + j]); + } + } + + gettimeofday(&end, NULL); + + elapsed_time = (end.tv_sec - start.tv_sec) * 1000.0; + elapsed_time += (end.tv_usec - start.tv_usec) / 1000.0; + + ret = check_results(instruction_name, TEST_COUNT_TOTAL, elapsed_time, + &b128_result[0][0], &b128_expect[0][0]); + + return ret; +} diff --git a/tests/tcg/mips/user/ase/msa/int-subtract/test_msa_subs_s_b.c b/tests/tcg/mips/user/ase/msa/int-subtract/test_msa_subs_s_b.c new file mode 100644 index 0000000000..04e6159fc7 --- /dev/null +++ b/tests/tcg/mips/user/ase/msa/int-subtract/test_msa_subs_s_b.c @@ -0,0 +1,151 @@ +/* + * Test program for MSA instruction SUBS_S.B + * + * Copyright (C) 2018 Wave Computing, Inc. + * Copyright (C) 2018 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.h" +#include "../../../../include/test_utils.h" + +#define TEST_COUNT_TOTAL ( \ + (PATTERN_INPUTS_SHORT_COUNT) * (PATTERN_INPUTS_SHORT_COUNT) + \ + (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT)) + + +int32_t main(void) +{ + char *instruction_name = "SUBS_S.B"; + int32_t ret; + uint32_t i, j; + struct timeval start, end; + double elapsed_time; + + uint64_t b128_result[TEST_COUNT_TOTAL][2]; + uint64_t b128_expect[TEST_COUNT_TOTAL][2] = { + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 0 */ + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, + { 0x5555555555555555ULL, 0x5555555555555555ULL, }, + { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, }, + { 0x3333333333333333ULL, 0x3333333333333333ULL, }, + { 0xccccccccccccccccULL, 0xccccccccccccccccULL, }, + { 0x1c71c71c71c71c71ULL, 0xc71c71c71c71c71cULL, }, + { 0xe38e38e38e38e38eULL, 0x38e38e38e38e38e3ULL, }, + { 0x0101010101010101ULL, 0x0101010101010101ULL, }, /* 8 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x5656565656565656ULL, 0x5656565656565656ULL, }, + { 0xababababababababULL, 0xababababababababULL, }, + { 0x3434343434343434ULL, 0x3434343434343434ULL, }, + { 0xcdcdcdcdcdcdcdcdULL, 0xcdcdcdcdcdcdcdcdULL, }, + { 0x1d72c81d72c81d72ULL, 0xc81d72c81d72c81dULL, }, + { 0xe48f39e48f39e48fULL, 0x39e48f39e48f39e4ULL, }, + { 0xababababababababULL, 0xababababababababULL, }, /* 16 */ + { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x8080808080808080ULL, 0x8080808080808080ULL, }, + { 0xdedededededededeULL, 0xdedededededededeULL, }, + { 0x8080808080808080ULL, 0x8080808080808080ULL, }, + { 0xc71c80c71c80c71cULL, 0x80c71c80c71c80c7ULL, }, + { 0x8e80e38e80e38e80ULL, 0xe38e80e38e80e38eULL, }, + { 0x5656565656565656ULL, 0x5656565656565656ULL, }, /* 24 */ + { 0x5555555555555555ULL, 0x5555555555555555ULL, }, + { 0x7f7f7f7f7f7f7f7fULL, 0x7f7f7f7f7f7f7f7fULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x7f7f7f7f7f7f7f7fULL, 0x7f7f7f7f7f7f7f7fULL, }, + { 0x2222222222222222ULL, 0x2222222222222222ULL, }, + { 0x727f1d727f1d727fULL, 0x1d727f1d727f1d72ULL, }, + { 0x39e47f39e47f39e4ULL, 0x7f39e47f39e47f39ULL, }, + { 0xcdcdcdcdcdcdcdcdULL, 0xcdcdcdcdcdcdcdcdULL, }, /* 32 */ + { 0xccccccccccccccccULL, 0xccccccccccccccccULL, }, + { 0x2222222222222222ULL, 0x2222222222222222ULL, }, + { 0x8080808080808080ULL, 0x8080808080808080ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x9999999999999999ULL, 0x9999999999999999ULL, }, + { 0xe93e94e93e94e93eULL, 0x94e93e94e93e94e9ULL, }, + { 0xb08005b08005b080ULL, 0x05b08005b08005b0ULL, }, + { 0x3434343434343434ULL, 0x3434343434343434ULL, }, /* 40 */ + { 0x3333333333333333ULL, 0x3333333333333333ULL, }, + { 0x7f7f7f7f7f7f7f7fULL, 0x7f7f7f7f7f7f7f7fULL, }, + { 0xdedededededededeULL, 0xdedededededededeULL, }, + { 0x6767676767676767ULL, 0x6767676767676767ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x507ffb507ffb507fULL, 0xfb507ffb507ffb50ULL, }, + { 0x17c26c17c26c17c2ULL, 0x6c17c26c17c26c17ULL, }, + { 0xe48f39e48f39e48fULL, 0x39e48f39e48f39e4ULL, }, /* 48 */ + { 0xe38e38e38e38e38eULL, 0x38e38e38e38e38e3ULL, }, + { 0x39e47f39e47f39e4ULL, 0x7f39e47f39e47f39ULL, }, + { 0x8e80e38e80e38e80ULL, 0xe38e80e38e80e38eULL, }, + { 0x17c26c17c26c17c2ULL, 0x6c17c26c17c26c17ULL, }, + { 0xb08005b08005b080ULL, 0x05b08005b08005b0ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0xc78071c78071c780ULL, 0x71c78071c78071c7ULL, }, + { 0x1d72c81d72c81d72ULL, 0xc81d72c81d72c81dULL, }, /* 56 */ + { 0x1c71c71c71c71c71ULL, 0xc71c71c71c71c71cULL, }, + { 0x727f1d727f1d727fULL, 0x1d727f1d727f1d72ULL, }, + { 0xc71c80c71c80c71cULL, 0x80c71c80c71c80c7ULL, }, + { 0x507ffb507ffb507fULL, 0xfb507ffb507ffb50ULL, }, + { 0xe93e94e93e94e93eULL, 0x94e93e94e93e94e9ULL, }, + { 0x397f8f397f8f397fULL, 0x8f397f8f397f8f39ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 64 */ + { 0x8d7fe680db7f7f38ULL, 0x39705044e93c8010ULL, }, + { 0xdc1038226f7f7f7fULL, 0x247f455f53508bf8ULL, }, + { 0x801bd080ca3173f2ULL, 0x7f767f7f5539ce6cULL, }, + { 0x73801a7f258080c8ULL, 0xc790b0bc17c47ff0ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x4f80527f7fc43c7fULL, 0xeb1ff51b6a142de8ULL, }, + { 0x8b80ea16ef80e5baULL, 0x7f0633426cfd705cULL, }, + { 0x24f0c8de91808080ULL, 0xdc80bba1adb07508ULL, }, /* 72 */ + { 0xb17fae80803cc480ULL, 0x15e10be596ecd318ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x800b9880809ea980ULL, 0x7fe73e2702e94374ULL, }, + { 0x7fe5307f36cf8d0eULL, 0x808a8080abc73294ULL, }, + { 0x757f16ea117f1b46ULL, 0x80facdbe940390a4ULL, }, +}; + + gettimeofday(&start, NULL); + + for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) { + for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) { + do_msa_SUBS_S_B(b128_pattern[i], b128_pattern[j], + b128_result[PATTERN_INPUTS_SHORT_COUNT * i + j]); + } + } + + for (i = 0; i < RANDOM_INPUTS_SHORT_COUNT; i++) { + for (j = 0; j < RANDOM_INPUTS_SHORT_COUNT; j++) { + do_msa_SUBS_S_B(b128_random[i], b128_random[j], + b128_result[((PATTERN_INPUTS_SHORT_COUNT) * + (PATTERN_INPUTS_SHORT_COUNT)) + + RANDOM_INPUTS_SHORT_COUNT * i + j]); + } + } + + gettimeofday(&end, NULL); + + elapsed_time = (end.tv_sec - start.tv_sec) * 1000.0; + elapsed_time += (end.tv_usec - start.tv_usec) / 1000.0; + + ret = check_results(instruction_name, TEST_COUNT_TOTAL, elapsed_time, + &b128_result[0][0], &b128_expect[0][0]); + + return ret; +} diff --git a/tests/tcg/mips/user/ase/msa/int-subtract/test_msa_subs_s_d.c b/tests/tcg/mips/user/ase/msa/int-subtract/test_msa_subs_s_d.c new file mode 100644 index 0000000000..195137f41f --- /dev/null +++ b/tests/tcg/mips/user/ase/msa/int-subtract/test_msa_subs_s_d.c @@ -0,0 +1,151 @@ +/* + * Test program for MSA instruction SUBS_S.D + * + * Copyright (C) 2018 Wave Computing, Inc. + * Copyright (C) 2018 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.h" +#include "../../../../include/test_utils.h" + +#define TEST_COUNT_TOTAL ( \ + (PATTERN_INPUTS_SHORT_COUNT) * (PATTERN_INPUTS_SHORT_COUNT) + \ + (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT)) + + +int32_t main(void) +{ + char *instruction_name = "SUBS_S.D"; + int32_t ret; + uint32_t i, j; + struct timeval start, end; + double elapsed_time; + + uint64_t b128_result[TEST_COUNT_TOTAL][2]; + uint64_t b128_expect[TEST_COUNT_TOTAL][2] = { + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 0 */ + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, + { 0x5555555555555555ULL, 0x5555555555555555ULL, }, + { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, }, + { 0x3333333333333333ULL, 0x3333333333333333ULL, }, + { 0xccccccccccccccccULL, 0xccccccccccccccccULL, }, + { 0x1c71c71c71c71c71ULL, 0xc71c71c71c71c71cULL, }, + { 0xe38e38e38e38e38eULL, 0x38e38e38e38e38e3ULL, }, + { 0x0000000000000001ULL, 0x0000000000000001ULL, }, /* 8 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x5555555555555556ULL, 0x5555555555555556ULL, }, + { 0xaaaaaaaaaaaaaaabULL, 0xaaaaaaaaaaaaaaabULL, }, + { 0x3333333333333334ULL, 0x3333333333333334ULL, }, + { 0xcccccccccccccccdULL, 0xcccccccccccccccdULL, }, + { 0x1c71c71c71c71c72ULL, 0xc71c71c71c71c71dULL, }, + { 0xe38e38e38e38e38fULL, 0x38e38e38e38e38e4ULL, }, + { 0xaaaaaaaaaaaaaaabULL, 0xaaaaaaaaaaaaaaabULL, }, /* 16 */ + { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x8000000000000000ULL, 0x8000000000000000ULL, }, + { 0xdddddddddddddddeULL, 0xdddddddddddddddeULL, }, + { 0x8000000000000000ULL, 0x8000000000000000ULL, }, + { 0xc71c71c71c71c71cULL, 0x8000000000000000ULL, }, + { 0x8e38e38e38e38e39ULL, 0xe38e38e38e38e38eULL, }, + { 0x5555555555555556ULL, 0x5555555555555556ULL, }, /* 24 */ + { 0x5555555555555555ULL, 0x5555555555555555ULL, }, + { 0x7fffffffffffffffULL, 0x7fffffffffffffffULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x7fffffffffffffffULL, 0x7fffffffffffffffULL, }, + { 0x2222222222222222ULL, 0x2222222222222222ULL, }, + { 0x71c71c71c71c71c7ULL, 0x1c71c71c71c71c72ULL, }, + { 0x38e38e38e38e38e4ULL, 0x7fffffffffffffffULL, }, + { 0xcccccccccccccccdULL, 0xcccccccccccccccdULL, }, /* 32 */ + { 0xccccccccccccccccULL, 0xccccccccccccccccULL, }, + { 0x2222222222222222ULL, 0x2222222222222222ULL, }, + { 0x8000000000000000ULL, 0x8000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x9999999999999999ULL, 0x9999999999999999ULL, }, + { 0xe93e93e93e93e93eULL, 0x93e93e93e93e93e9ULL, }, + { 0xb05b05b05b05b05bULL, 0x05b05b05b05b05b0ULL, }, + { 0x3333333333333334ULL, 0x3333333333333334ULL, }, /* 40 */ + { 0x3333333333333333ULL, 0x3333333333333333ULL, }, + { 0x7fffffffffffffffULL, 0x7fffffffffffffffULL, }, + { 0xdddddddddddddddeULL, 0xdddddddddddddddeULL, }, + { 0x6666666666666667ULL, 0x6666666666666667ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x4fa4fa4fa4fa4fa5ULL, 0xfa4fa4fa4fa4fa50ULL, }, + { 0x16c16c16c16c16c2ULL, 0x6c16c16c16c16c17ULL, }, + { 0xe38e38e38e38e38fULL, 0x38e38e38e38e38e4ULL, }, /* 48 */ + { 0xe38e38e38e38e38eULL, 0x38e38e38e38e38e3ULL, }, + { 0x38e38e38e38e38e4ULL, 0x7fffffffffffffffULL, }, + { 0x8e38e38e38e38e39ULL, 0xe38e38e38e38e38eULL, }, + { 0x16c16c16c16c16c2ULL, 0x6c16c16c16c16c17ULL, }, + { 0xb05b05b05b05b05bULL, 0x05b05b05b05b05b0ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0xc71c71c71c71c71dULL, 0x71c71c71c71c71c7ULL, }, + { 0x1c71c71c71c71c72ULL, 0xc71c71c71c71c71dULL, }, /* 56 */ + { 0x1c71c71c71c71c71ULL, 0xc71c71c71c71c71cULL, }, + { 0x71c71c71c71c71c7ULL, 0x1c71c71c71c71c72ULL, }, + { 0xc71c71c71c71c71cULL, 0x8000000000000000ULL, }, + { 0x4fa4fa4fa4fa4fa5ULL, 0xfa4fa4fa4fa4fa50ULL, }, + { 0xe93e93e93e93e93eULL, 0x93e93e93e93e93e9ULL, }, + { 0x38e38e38e38e38e3ULL, 0x8e38e38e38e38e39ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 64 */ + { 0x8cace668dace8e38ULL, 0x386f5044e93c5d10ULL, }, + { 0xdc1038216e92c9c0ULL, 0x238e445f53508af8ULL, }, + { 0x8000000000000000ULL, 0x7fffffffffffffffULL, }, + { 0x73531997253171c8ULL, 0xc790afbb16c3a2f0ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x4f6351b893c43b88ULL, 0xeb1ef41a6a142de8ULL, }, + { 0x8b6eea15ef61e4baULL, 0x7fffffffffffffffULL, }, + { 0x23efc7de916d3640ULL, 0xdc71bba0acaf7508ULL, }, /* 72 */ + { 0xb09cae476c3bc478ULL, 0x14e10be595ebd218ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x8000000000000000ULL, 0x7fffffffffffffffULL, }, + { 0x7fffffffffffffffULL, 0x8000000000000000ULL, }, + { 0x749115ea109e1b46ULL, 0x8000000000000000ULL, }, +}; + + gettimeofday(&start, NULL); + + for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) { + for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) { + do_msa_SUBS_S_D(b128_pattern[i], b128_pattern[j], + b128_result[PATTERN_INPUTS_SHORT_COUNT * i + j]); + } + } + + for (i = 0; i < RANDOM_INPUTS_SHORT_COUNT; i++) { + for (j = 0; j < RANDOM_INPUTS_SHORT_COUNT; j++) { + do_msa_SUBS_S_D(b128_random[i], b128_random[j], + b128_result[((PATTERN_INPUTS_SHORT_COUNT) * + (PATTERN_INPUTS_SHORT_COUNT)) + + RANDOM_INPUTS_SHORT_COUNT * i + j]); + } + } + + gettimeofday(&end, NULL); + + elapsed_time = (end.tv_sec - start.tv_sec) * 1000.0; + elapsed_time += (end.tv_usec - start.tv_usec) / 1000.0; + + ret = check_results(instruction_name, TEST_COUNT_TOTAL, elapsed_time, + &b128_result[0][0], &b128_expect[0][0]); + + return ret; +} diff --git a/tests/tcg/mips/user/ase/msa/int-subtract/test_msa_subs_s_h.c b/tests/tcg/mips/user/ase/msa/int-subtract/test_msa_subs_s_h.c new file mode 100644 index 0000000000..c57238d31a --- /dev/null +++ b/tests/tcg/mips/user/ase/msa/int-subtract/test_msa_subs_s_h.c @@ -0,0 +1,151 @@ +/* + * Test program for MSA instruction SUBS_S.H + * + * Copyright (C) 2018 Wave Computing, Inc. + * Copyright (C) 2018 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.h" +#include "../../../../include/test_utils.h" + +#define TEST_COUNT_TOTAL ( \ + (PATTERN_INPUTS_SHORT_COUNT) * (PATTERN_INPUTS_SHORT_COUNT) + \ + (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT)) + + +int32_t main(void) +{ + char *instruction_name = "SUBS_S.H"; + int32_t ret; + uint32_t i, j; + struct timeval start, end; + double elapsed_time; + + uint64_t b128_result[TEST_COUNT_TOTAL][2]; + uint64_t b128_expect[TEST_COUNT_TOTAL][2] = { + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 0 */ + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, + { 0x5555555555555555ULL, 0x5555555555555555ULL, }, + { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, }, + { 0x3333333333333333ULL, 0x3333333333333333ULL, }, + { 0xccccccccccccccccULL, 0xccccccccccccccccULL, }, + { 0x1c71c71c71c71c71ULL, 0xc71c71c71c71c71cULL, }, + { 0xe38e38e38e38e38eULL, 0x38e38e38e38e38e3ULL, }, + { 0x0001000100010001ULL, 0x0001000100010001ULL, }, /* 8 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x5556555655565556ULL, 0x5556555655565556ULL, }, + { 0xaaabaaabaaabaaabULL, 0xaaabaaabaaabaaabULL, }, + { 0x3334333433343334ULL, 0x3334333433343334ULL, }, + { 0xcccdcccdcccdcccdULL, 0xcccdcccdcccdcccdULL, }, + { 0x1c72c71d71c81c72ULL, 0xc71d71c81c72c71dULL, }, + { 0xe38f38e48e39e38fULL, 0x38e48e39e38f38e4ULL, }, + { 0xaaabaaabaaabaaabULL, 0xaaabaaabaaabaaabULL, }, /* 16 */ + { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x8000800080008000ULL, 0x8000800080008000ULL, }, + { 0xdddedddedddedddeULL, 0xdddedddedddedddeULL, }, + { 0x8000800080008000ULL, 0x8000800080008000ULL, }, + { 0xc71c80001c72c71cULL, 0x80001c72c71c8000ULL, }, + { 0x8e39e38e80008e39ULL, 0xe38e80008e39e38eULL, }, + { 0x5556555655565556ULL, 0x5556555655565556ULL, }, /* 24 */ + { 0x5555555555555555ULL, 0x5555555555555555ULL, }, + { 0x7fff7fff7fff7fffULL, 0x7fff7fff7fff7fffULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x7fff7fff7fff7fffULL, 0x7fff7fff7fff7fffULL, }, + { 0x2222222222222222ULL, 0x2222222222222222ULL, }, + { 0x71c71c727fff71c7ULL, 0x1c727fff71c71c72ULL, }, + { 0x38e47fffe38e38e4ULL, 0x7fffe38e38e47fffULL, }, + { 0xcccdcccdcccdcccdULL, 0xcccdcccdcccdcccdULL, }, /* 32 */ + { 0xccccccccccccccccULL, 0xccccccccccccccccULL, }, + { 0x2222222222222222ULL, 0x2222222222222222ULL, }, + { 0x8000800080008000ULL, 0x8000800080008000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x9999999999999999ULL, 0x9999999999999999ULL, }, + { 0xe93e93e93e94e93eULL, 0x93e93e94e93e93e9ULL, }, + { 0xb05b05b08000b05bULL, 0x05b08000b05b05b0ULL, }, + { 0x3334333433343334ULL, 0x3334333433343334ULL, }, /* 40 */ + { 0x3333333333333333ULL, 0x3333333333333333ULL, }, + { 0x7fff7fff7fff7fffULL, 0x7fff7fff7fff7fffULL, }, + { 0xdddedddedddedddeULL, 0xdddedddedddedddeULL, }, + { 0x6667666766676667ULL, 0x6667666766676667ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x4fa5fa507fff4fa5ULL, 0xfa507fff4fa5fa50ULL, }, + { 0x16c26c17c16c16c2ULL, 0x6c17c16c16c26c17ULL, }, + { 0xe38f38e48e39e38fULL, 0x38e48e39e38f38e4ULL, }, /* 48 */ + { 0xe38e38e38e38e38eULL, 0x38e38e38e38e38e3ULL, }, + { 0x38e47fffe38e38e4ULL, 0x7fffe38e38e47fffULL, }, + { 0x8e39e38e80008e39ULL, 0xe38e80008e39e38eULL, }, + { 0x16c26c17c16c16c2ULL, 0x6c17c16c16c26c17ULL, }, + { 0xb05b05b08000b05bULL, 0x05b08000b05b05b0ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0xc71d71c78000c71dULL, 0x71c78000c71d71c7ULL, }, + { 0x1c72c71d71c81c72ULL, 0xc71d71c81c72c71dULL, }, /* 56 */ + { 0x1c71c71c71c71c71ULL, 0xc71c71c71c71c71cULL, }, + { 0x71c71c727fff71c7ULL, 0x1c727fff71c71c72ULL, }, + { 0xc71c80001c72c71cULL, 0x80001c72c71c8000ULL, }, + { 0x4fa5fa507fff4fa5ULL, 0xfa507fff4fa5fa50ULL, }, + { 0xe93e93e93e94e93eULL, 0x93e93e94e93e93e9ULL, }, + { 0x38e38e397fff38e3ULL, 0x8e397fff38e38e39ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 64 */ + { 0x8cace669dacf7fffULL, 0x38705044e93c8000ULL, }, + { 0xdc1038226e937fffULL, 0x238f445f53508af8ULL, }, + { 0x8000d07fca3172f2ULL, 0x7fff7fff5539cd6cULL, }, + { 0x7354199725318000ULL, 0xc790afbc16c47fffULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x4f6451b97fff3b88ULL, 0xeb1ff41b6a142de8ULL, }, + { 0x8b6fea16ef62e4baULL, 0x7fff32426bfd705cULL, }, + { 0x23f0c7de916d8000ULL, 0xdc71bba1acb07508ULL, }, /* 72 */ + { 0xb09cae478000c478ULL, 0x14e10be595ecd218ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x8000985d8000a932ULL, 0x7fff3e2701e94274ULL, }, + { 0x7fff2f8135cf8d0eULL, 0x80008000aac73294ULL, }, + { 0x749115ea109e1b46ULL, 0x8000cdbe94038fa4ULL, }, +}; + + gettimeofday(&start, NULL); + + for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) { + for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) { + do_msa_SUBS_S_H(b128_pattern[i], b128_pattern[j], + b128_result[PATTERN_INPUTS_SHORT_COUNT * i + j]); + } + } + + for (i = 0; i < RANDOM_INPUTS_SHORT_COUNT; i++) { + for (j = 0; j < RANDOM_INPUTS_SHORT_COUNT; j++) { + do_msa_SUBS_S_H(b128_random[i], b128_random[j], + b128_result[((PATTERN_INPUTS_SHORT_COUNT) * + (PATTERN_INPUTS_SHORT_COUNT)) + + RANDOM_INPUTS_SHORT_COUNT * i + j]); + } + } + + gettimeofday(&end, NULL); + + elapsed_time = (end.tv_sec - start.tv_sec) * 1000.0; + elapsed_time += (end.tv_usec - start.tv_usec) / 1000.0; + + ret = check_results(instruction_name, TEST_COUNT_TOTAL, elapsed_time, + &b128_result[0][0], &b128_expect[0][0]); + + return ret; +} diff --git a/tests/tcg/mips/user/ase/msa/int-subtract/test_msa_subs_s_w.c b/tests/tcg/mips/user/ase/msa/int-subtract/test_msa_subs_s_w.c new file mode 100644 index 0000000000..1cded65a7e --- /dev/null +++ b/tests/tcg/mips/user/ase/msa/int-subtract/test_msa_subs_s_w.c @@ -0,0 +1,151 @@ +/* + * Test program for MSA instruction SUBS_S.W + * + * Copyright (C) 2018 Wave Computing, Inc. + * Copyright (C) 2018 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.h" +#include "../../../../include/test_utils.h" + +#define TEST_COUNT_TOTAL ( \ + (PATTERN_INPUTS_SHORT_COUNT) * (PATTERN_INPUTS_SHORT_COUNT) + \ + (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT)) + + +int32_t main(void) +{ + char *instruction_name = "SUBS_S.W"; + int32_t ret; + uint32_t i, j; + struct timeval start, end; + double elapsed_time; + + uint64_t b128_result[TEST_COUNT_TOTAL][2]; + uint64_t b128_expect[TEST_COUNT_TOTAL][2] = { + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 0 */ + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, + { 0x5555555555555555ULL, 0x5555555555555555ULL, }, + { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, }, + { 0x3333333333333333ULL, 0x3333333333333333ULL, }, + { 0xccccccccccccccccULL, 0xccccccccccccccccULL, }, + { 0x1c71c71c71c71c71ULL, 0xc71c71c71c71c71cULL, }, + { 0xe38e38e38e38e38eULL, 0x38e38e38e38e38e3ULL, }, + { 0x0000000100000001ULL, 0x0000000100000001ULL, }, /* 8 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x5555555655555556ULL, 0x5555555655555556ULL, }, + { 0xaaaaaaabaaaaaaabULL, 0xaaaaaaabaaaaaaabULL, }, + { 0x3333333433333334ULL, 0x3333333433333334ULL, }, + { 0xcccccccdcccccccdULL, 0xcccccccdcccccccdULL, }, + { 0x1c71c71d71c71c72ULL, 0xc71c71c81c71c71dULL, }, + { 0xe38e38e48e38e38fULL, 0x38e38e39e38e38e4ULL, }, + { 0xaaaaaaabaaaaaaabULL, 0xaaaaaaabaaaaaaabULL, }, /* 16 */ + { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x8000000080000000ULL, 0x8000000080000000ULL, }, + { 0xdddddddedddddddeULL, 0xdddddddedddddddeULL, }, + { 0x8000000080000000ULL, 0x8000000080000000ULL, }, + { 0xc71c71c71c71c71cULL, 0x80000000c71c71c7ULL, }, + { 0x8e38e38e80000000ULL, 0xe38e38e38e38e38eULL, }, + { 0x5555555655555556ULL, 0x5555555655555556ULL, }, /* 24 */ + { 0x5555555555555555ULL, 0x5555555555555555ULL, }, + { 0x7fffffff7fffffffULL, 0x7fffffff7fffffffULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x7fffffff7fffffffULL, 0x7fffffff7fffffffULL, }, + { 0x2222222222222222ULL, 0x2222222222222222ULL, }, + { 0x71c71c727fffffffULL, 0x1c71c71d71c71c72ULL, }, + { 0x38e38e39e38e38e4ULL, 0x7fffffff38e38e39ULL, }, + { 0xcccccccdcccccccdULL, 0xcccccccdcccccccdULL, }, /* 32 */ + { 0xccccccccccccccccULL, 0xccccccccccccccccULL, }, + { 0x2222222222222222ULL, 0x2222222222222222ULL, }, + { 0x8000000080000000ULL, 0x8000000080000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x9999999999999999ULL, 0x9999999999999999ULL, }, + { 0xe93e93e93e93e93eULL, 0x93e93e94e93e93e9ULL, }, + { 0xb05b05b080000000ULL, 0x05b05b05b05b05b0ULL, }, + { 0x3333333433333334ULL, 0x3333333433333334ULL, }, /* 40 */ + { 0x3333333333333333ULL, 0x3333333333333333ULL, }, + { 0x7fffffff7fffffffULL, 0x7fffffff7fffffffULL, }, + { 0xdddddddedddddddeULL, 0xdddddddedddddddeULL, }, + { 0x6666666766666667ULL, 0x6666666766666667ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x4fa4fa507fffffffULL, 0xfa4fa4fb4fa4fa50ULL, }, + { 0x16c16c17c16c16c2ULL, 0x6c16c16c16c16c17ULL, }, + { 0xe38e38e48e38e38fULL, 0x38e38e39e38e38e4ULL, }, /* 48 */ + { 0xe38e38e38e38e38eULL, 0x38e38e38e38e38e3ULL, }, + { 0x38e38e39e38e38e4ULL, 0x7fffffff38e38e39ULL, }, + { 0x8e38e38e80000000ULL, 0xe38e38e38e38e38eULL, }, + { 0x16c16c17c16c16c2ULL, 0x6c16c16c16c16c17ULL, }, + { 0xb05b05b080000000ULL, 0x05b05b05b05b05b0ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0xc71c71c780000000ULL, 0x71c71c71c71c71c7ULL, }, + { 0x1c71c71d71c71c72ULL, 0xc71c71c81c71c71dULL, }, /* 56 */ + { 0x1c71c71c71c71c71ULL, 0xc71c71c71c71c71cULL, }, + { 0x71c71c727fffffffULL, 0x1c71c71d71c71c72ULL, }, + { 0xc71c71c71c71c71cULL, 0x80000000c71c71c7ULL, }, + { 0x4fa4fa507fffffffULL, 0xfa4fa4fb4fa4fa50ULL, }, + { 0xe93e93e93e93e93eULL, 0x93e93e94e93e93e9ULL, }, + { 0x38e38e397fffffffULL, 0x8e38e38f38e38e39ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 64 */ + { 0x8cace669dace8e38ULL, 0x386f5044e93c5d10ULL, }, + { 0xdc1038226e92c9c0ULL, 0x238e445f53508af8ULL, }, + { 0x80000000ca3072f2ULL, 0x7fffffff5538cd6cULL, }, + { 0x73531997253171c8ULL, 0xc790afbc16c3a2f0ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x4f6351b97fffffffULL, 0xeb1ef41b6a142de8ULL, }, + { 0x8b6eea16ef61e4baULL, 0x7fffffff6bfc705cULL, }, + { 0x23efc7de916d3640ULL, 0xdc71bba1acaf7508ULL, }, /* 72 */ + { 0xb09cae4780000000ULL, 0x14e10be595ebd218ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x8000000080000000ULL, 0x7fffffff01e84274ULL, }, + { 0x7fffffff35cf8d0eULL, 0x80000000aac73294ULL, }, + { 0x749115ea109e1b46ULL, 0x8000000094038fa4ULL, }, +}; + + gettimeofday(&start, NULL); + + for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) { + for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) { + do_msa_SUBS_S_W(b128_pattern[i], b128_pattern[j], + b128_result[PATTERN_INPUTS_SHORT_COUNT * i + j]); + } + } + + for (i = 0; i < RANDOM_INPUTS_SHORT_COUNT; i++) { + for (j = 0; j < RANDOM_INPUTS_SHORT_COUNT; j++) { + do_msa_SUBS_S_W(b128_random[i], b128_random[j], + b128_result[((PATTERN_INPUTS_SHORT_COUNT) * + (PATTERN_INPUTS_SHORT_COUNT)) + + RANDOM_INPUTS_SHORT_COUNT * i + j]); + } + } + + gettimeofday(&end, NULL); + + elapsed_time = (end.tv_sec - start.tv_sec) * 1000.0; + elapsed_time += (end.tv_usec - start.tv_usec) / 1000.0; + + ret = check_results(instruction_name, TEST_COUNT_TOTAL, elapsed_time, + &b128_result[0][0], &b128_expect[0][0]); + + return ret; +} diff --git a/tests/tcg/mips/user/ase/msa/int-subtract/test_msa_subs_u_b.c b/tests/tcg/mips/user/ase/msa/int-subtract/test_msa_subs_u_b.c new file mode 100644 index 0000000000..cb38f033a6 --- /dev/null +++ b/tests/tcg/mips/user/ase/msa/int-subtract/test_msa_subs_u_b.c @@ -0,0 +1,151 @@ +/* + * Test program for MSA instruction SUBS_U.B + * + * Copyright (C) 2018 Wave Computing, Inc. + * Copyright (C) 2018 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.h" +#include "../../../../include/test_utils.h" + +#define TEST_COUNT_TOTAL ( \ + (PATTERN_INPUTS_SHORT_COUNT) * (PATTERN_INPUTS_SHORT_COUNT) + \ + (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT)) + + +int32_t main(void) +{ + char *instruction_name = "SUBS_U.B"; + int32_t ret; + uint32_t i, j; + struct timeval start, end; + double elapsed_time; + + uint64_t b128_result[TEST_COUNT_TOTAL][2]; + uint64_t b128_expect[TEST_COUNT_TOTAL][2] = { + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 0 */ + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, + { 0x5555555555555555ULL, 0x5555555555555555ULL, }, + { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, }, + { 0x3333333333333333ULL, 0x3333333333333333ULL, }, + { 0xccccccccccccccccULL, 0xccccccccccccccccULL, }, + { 0x1c71c71c71c71c71ULL, 0xc71c71c71c71c71cULL, }, + { 0xe38e38e38e38e38eULL, 0x38e38e38e38e38e3ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 8 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 16 */ + { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x5555555555555555ULL, 0x5555555555555555ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x7777777777777777ULL, 0x7777777777777777ULL, }, + { 0x001c72001c72001cULL, 0x72001c72001c7200ULL, }, + { 0x8e39008e39008e39ULL, 0x008e39008e39008eULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 24 */ + { 0x5555555555555555ULL, 0x5555555555555555ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x2222222222222222ULL, 0x2222222222222222ULL, }, + { 0x00001d00001d0000ULL, 0x1d00001d00001d00ULL, }, + { 0x3900003900003900ULL, 0x0039000039000039ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 32 */ + { 0xccccccccccccccccULL, 0xccccccccccccccccULL, }, + { 0x2222222222222222ULL, 0x2222222222222222ULL, }, + { 0x7777777777777777ULL, 0x7777777777777777ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x9999999999999999ULL, 0x9999999999999999ULL, }, + { 0x003e94003e94003eULL, 0x94003e94003e9400ULL, }, + { 0xb05b05b05b05b05bULL, 0x05b05b05b05b05b0ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 40 */ + { 0x3333333333333333ULL, 0x3333333333333333ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x1700001700001700ULL, 0x0017000017000017ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 48 */ + { 0xe38e38e38e38e38eULL, 0x38e38e38e38e38e3ULL, }, + { 0x3900003900003900ULL, 0x0039000039000039ULL, }, + { 0x8e39008e39008e39ULL, 0x008e39008e39008eULL, }, + { 0x1700001700001700ULL, 0x0017000017000017ULL, }, + { 0xb05b05b05b05b05bULL, 0x05b05b05b05b05b0ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0xc71d00c71d00c71dULL, 0x00c71d00c71d00c7ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 56 */ + { 0x1c71c71c71c71c71ULL, 0xc71c71c71c71c71cULL, }, + { 0x00001d00001d0000ULL, 0x1d00001d00001d00ULL, }, + { 0x001c72001c72001cULL, 0x72001c72001c7200ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x003e94003e94003eULL, 0x94003e94003e9400ULL, }, + { 0x00008f00008f0000ULL, 0x8f00008f00008f00ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 64 */ + { 0x0000e66900000038ULL, 0x39000044e93c5e00ULL, }, + { 0x0010382200000000ULL, 0x2400000053508b00ULL, }, + { 0x181bd07f00310000ULL, 0x0000000055390000ULL, }, + { 0x7354000025317200ULL, 0x0090b000000000f0ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x4f64000000003c00ULL, 0x001f000000142de8ULL, }, + { 0x8b6f001600620000ULL, 0x000633000000005cULL, }, + { 0x24000000916d3640ULL, 0x0071bba100000008ULL, }, /* 72 */ + { 0x0000ae476c3c0078ULL, 0x15000be596000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x3c0b985d5b9e0032ULL, 0x00003e2702000000ULL, }, + { 0x0000000036008d0eULL, 0x428a7d7a00003294ULL, }, + { 0x0000160011001b46ULL, 0x7b0000be94039000ULL, }, +}; + + gettimeofday(&start, NULL); + + for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) { + for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) { + do_msa_SUBS_U_B(b128_pattern[i], b128_pattern[j], + b128_result[PATTERN_INPUTS_SHORT_COUNT * i + j]); + } + } + + for (i = 0; i < RANDOM_INPUTS_SHORT_COUNT; i++) { + for (j = 0; j < RANDOM_INPUTS_SHORT_COUNT; j++) { + do_msa_SUBS_U_B(b128_random[i], b128_random[j], + b128_result[((PATTERN_INPUTS_SHORT_COUNT) * + (PATTERN_INPUTS_SHORT_COUNT)) + + RANDOM_INPUTS_SHORT_COUNT * i + j]); + } + } + + gettimeofday(&end, NULL); + + elapsed_time = (end.tv_sec - start.tv_sec) * 1000.0; + elapsed_time += (end.tv_usec - start.tv_usec) / 1000.0; + + ret = check_results(instruction_name, TEST_COUNT_TOTAL, elapsed_time, + &b128_result[0][0], &b128_expect[0][0]); + + return ret; +} diff --git a/tests/tcg/mips/user/ase/msa/int-subtract/test_msa_subs_u_d.c b/tests/tcg/mips/user/ase/msa/int-subtract/test_msa_subs_u_d.c new file mode 100644 index 0000000000..2685b2fe7e --- /dev/null +++ b/tests/tcg/mips/user/ase/msa/int-subtract/test_msa_subs_u_d.c @@ -0,0 +1,151 @@ +/* + * Test program for MSA instruction SUBS_U.D + * + * Copyright (C) 2018 Wave Computing, Inc. + * Copyright (C) 2018 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.h" +#include "../../../../include/test_utils.h" + +#define TEST_COUNT_TOTAL ( \ + (PATTERN_INPUTS_SHORT_COUNT) * (PATTERN_INPUTS_SHORT_COUNT) + \ + (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT)) + + +int32_t main(void) +{ + char *instruction_name = "SUBS_U.D"; + int32_t ret; + uint32_t i, j; + struct timeval start, end; + double elapsed_time; + + uint64_t b128_result[TEST_COUNT_TOTAL][2]; + uint64_t b128_expect[TEST_COUNT_TOTAL][2] = { + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 0 */ + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, + { 0x5555555555555555ULL, 0x5555555555555555ULL, }, + { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, }, + { 0x3333333333333333ULL, 0x3333333333333333ULL, }, + { 0xccccccccccccccccULL, 0xccccccccccccccccULL, }, + { 0x1c71c71c71c71c71ULL, 0xc71c71c71c71c71cULL, }, + { 0xe38e38e38e38e38eULL, 0x38e38e38e38e38e3ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 8 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 16 */ + { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x5555555555555555ULL, 0x5555555555555555ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x7777777777777777ULL, 0x7777777777777777ULL, }, + { 0x0000000000000000ULL, 0x71c71c71c71c71c7ULL, }, + { 0x8e38e38e38e38e39ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 24 */ + { 0x5555555555555555ULL, 0x5555555555555555ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x2222222222222222ULL, 0x2222222222222222ULL, }, + { 0x0000000000000000ULL, 0x1c71c71c71c71c72ULL, }, + { 0x38e38e38e38e38e4ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 32 */ + { 0xccccccccccccccccULL, 0xccccccccccccccccULL, }, + { 0x2222222222222222ULL, 0x2222222222222222ULL, }, + { 0x7777777777777777ULL, 0x7777777777777777ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x9999999999999999ULL, 0x9999999999999999ULL, }, + { 0x0000000000000000ULL, 0x93e93e93e93e93e9ULL, }, + { 0xb05b05b05b05b05bULL, 0x05b05b05b05b05b0ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 40 */ + { 0x3333333333333333ULL, 0x3333333333333333ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x16c16c16c16c16c2ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 48 */ + { 0xe38e38e38e38e38eULL, 0x38e38e38e38e38e3ULL, }, + { 0x38e38e38e38e38e4ULL, 0x0000000000000000ULL, }, + { 0x8e38e38e38e38e39ULL, 0x0000000000000000ULL, }, + { 0x16c16c16c16c16c2ULL, 0x0000000000000000ULL, }, + { 0xb05b05b05b05b05bULL, 0x05b05b05b05b05b0ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0xc71c71c71c71c71dULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 56 */ + { 0x1c71c71c71c71c71ULL, 0xc71c71c71c71c71cULL, }, + { 0x0000000000000000ULL, 0x1c71c71c71c71c72ULL, }, + { 0x0000000000000000ULL, 0x71c71c71c71c71c7ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x93e93e93e93e93e9ULL, }, + { 0x0000000000000000ULL, 0x8e38e38e38e38e39ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 64 */ + { 0x0000000000000000ULL, 0x386f5044e93c5d10ULL, }, + { 0x0000000000000000ULL, 0x238e445f53508af8ULL, }, + { 0x181bd07eca3072f2ULL, 0x0000000000000000ULL, }, + { 0x73531997253171c8ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x4f6351b893c43b88ULL, 0x0000000000000000ULL, }, + { 0x8b6eea15ef61e4baULL, 0x0000000000000000ULL, }, + { 0x23efc7de916d3640ULL, 0x0000000000000000ULL, }, /* 72 */ + { 0x0000000000000000ULL, 0x14e10be595ebd218ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x3c0b985d5b9da932ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x428a7d79aac73294ULL, }, + { 0x0000000000000000ULL, 0x7af9cdbe94038fa4ULL, }, +}; + + gettimeofday(&start, NULL); + + for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) { + for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) { + do_msa_SUBS_U_D(b128_pattern[i], b128_pattern[j], + b128_result[PATTERN_INPUTS_SHORT_COUNT * i + j]); + } + } + + for (i = 0; i < RANDOM_INPUTS_SHORT_COUNT; i++) { + for (j = 0; j < RANDOM_INPUTS_SHORT_COUNT; j++) { + do_msa_SUBS_U_D(b128_random[i], b128_random[j], + b128_result[((PATTERN_INPUTS_SHORT_COUNT) * + (PATTERN_INPUTS_SHORT_COUNT)) + + RANDOM_INPUTS_SHORT_COUNT * i + j]); + } + } + + gettimeofday(&end, NULL); + + elapsed_time = (end.tv_sec - start.tv_sec) * 1000.0; + elapsed_time += (end.tv_usec - start.tv_usec) / 1000.0; + + ret = check_results(instruction_name, TEST_COUNT_TOTAL, elapsed_time, + &b128_result[0][0], &b128_expect[0][0]); + + return ret; +} diff --git a/tests/tcg/mips/user/ase/msa/int-subtract/test_msa_subs_u_h.c b/tests/tcg/mips/user/ase/msa/int-subtract/test_msa_subs_u_h.c new file mode 100644 index 0000000000..ca6dd38b69 --- /dev/null +++ b/tests/tcg/mips/user/ase/msa/int-subtract/test_msa_subs_u_h.c @@ -0,0 +1,151 @@ +/* + * Test program for MSA instruction SUBS_U.H + * + * Copyright (C) 2018 Wave Computing, Inc. + * Copyright (C) 2018 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.h" +#include "../../../../include/test_utils.h" + +#define TEST_COUNT_TOTAL ( \ + (PATTERN_INPUTS_SHORT_COUNT) * (PATTERN_INPUTS_SHORT_COUNT) + \ + (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT)) + + +int32_t main(void) +{ + char *instruction_name = "SUBS_U.H"; + int32_t ret; + uint32_t i, j; + struct timeval start, end; + double elapsed_time; + + uint64_t b128_result[TEST_COUNT_TOTAL][2]; + uint64_t b128_expect[TEST_COUNT_TOTAL][2] = { + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 0 */ + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, + { 0x5555555555555555ULL, 0x5555555555555555ULL, }, + { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, }, + { 0x3333333333333333ULL, 0x3333333333333333ULL, }, + { 0xccccccccccccccccULL, 0xccccccccccccccccULL, }, + { 0x1c71c71c71c71c71ULL, 0xc71c71c71c71c71cULL, }, + { 0xe38e38e38e38e38eULL, 0x38e38e38e38e38e3ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 8 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 16 */ + { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x5555555555555555ULL, 0x5555555555555555ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x7777777777777777ULL, 0x7777777777777777ULL, }, + { 0x000071c71c720000ULL, 0x71c71c72000071c7ULL, }, + { 0x8e39000038e38e39ULL, 0x000038e38e390000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 24 */ + { 0x5555555555555555ULL, 0x5555555555555555ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x2222222222222222ULL, 0x2222222222222222ULL, }, + { 0x00001c7200000000ULL, 0x1c72000000001c72ULL, }, + { 0x38e40000000038e4ULL, 0x0000000038e40000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 32 */ + { 0xccccccccccccccccULL, 0xccccccccccccccccULL, }, + { 0x2222222222222222ULL, 0x2222222222222222ULL, }, + { 0x7777777777777777ULL, 0x7777777777777777ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x9999999999999999ULL, 0x9999999999999999ULL, }, + { 0x000093e93e940000ULL, 0x93e93e94000093e9ULL, }, + { 0xb05b05b05b05b05bULL, 0x05b05b05b05b05b0ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 40 */ + { 0x3333333333333333ULL, 0x3333333333333333ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x16c20000000016c2ULL, 0x0000000016c20000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 48 */ + { 0xe38e38e38e38e38eULL, 0x38e38e38e38e38e3ULL, }, + { 0x38e40000000038e4ULL, 0x0000000038e40000ULL, }, + { 0x8e39000038e38e39ULL, 0x000038e38e390000ULL, }, + { 0x16c20000000016c2ULL, 0x0000000016c20000ULL, }, + { 0xb05b05b05b05b05bULL, 0x05b05b05b05b05b0ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0xc71d00001c71c71dULL, 0x00001c71c71d0000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 56 */ + { 0x1c71c71c71c71c71ULL, 0xc71c71c71c71c71cULL, }, + { 0x00001c7200000000ULL, 0x1c72000000001c72ULL, }, + { 0x000071c71c720000ULL, 0x71c71c72000071c7ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x000093e93e940000ULL, 0x93e93e94000093e9ULL, }, + { 0x00008e3900000000ULL, 0x8e39000000008e39ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 64 */ + { 0x0000e66900000000ULL, 0x38700000e93c5d10ULL, }, + { 0x0000382200000000ULL, 0x238f000053508af8ULL, }, + { 0x181bd07f00000000ULL, 0x0000000055390000ULL, }, + { 0x73540000253171c8ULL, 0x0000afbc00000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x4f64000000003b88ULL, 0x0000000000002de8ULL, }, + { 0x8b6f000000000000ULL, 0x0000324200000000ULL, }, + { 0x23f00000916d3640ULL, 0x0000bba100000000ULL, }, /* 72 */ + { 0x0000ae476c3c0000ULL, 0x14e10be595ec0000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x3c0b985d5b9e0000ULL, 0x00003e2701e90000ULL, }, + { 0x0000000035cf8d0eULL, 0x428a7d7a00003294ULL, }, + { 0x000015ea109e1b46ULL, 0x7afa000094038fa4ULL, }, +}; + + gettimeofday(&start, NULL); + + for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) { + for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) { + do_msa_SUBS_U_H(b128_pattern[i], b128_pattern[j], + b128_result[PATTERN_INPUTS_SHORT_COUNT * i + j]); + } + } + + for (i = 0; i < RANDOM_INPUTS_SHORT_COUNT; i++) { + for (j = 0; j < RANDOM_INPUTS_SHORT_COUNT; j++) { + do_msa_SUBS_U_H(b128_random[i], b128_random[j], + b128_result[((PATTERN_INPUTS_SHORT_COUNT) * + (PATTERN_INPUTS_SHORT_COUNT)) + + RANDOM_INPUTS_SHORT_COUNT * i + j]); + } + } + + gettimeofday(&end, NULL); + + elapsed_time = (end.tv_sec - start.tv_sec) * 1000.0; + elapsed_time += (end.tv_usec - start.tv_usec) / 1000.0; + + ret = check_results(instruction_name, TEST_COUNT_TOTAL, elapsed_time, + &b128_result[0][0], &b128_expect[0][0]); + + return ret; +} diff --git a/tests/tcg/mips/user/ase/msa/int-subtract/test_msa_subs_u_w.c b/tests/tcg/mips/user/ase/msa/int-subtract/test_msa_subs_u_w.c new file mode 100644 index 0000000000..42ebddb408 --- /dev/null +++ b/tests/tcg/mips/user/ase/msa/int-subtract/test_msa_subs_u_w.c @@ -0,0 +1,151 @@ +/* + * Test program for MSA instruction SUBS_U.W + * + * Copyright (C) 2018 Wave Computing, Inc. + * Copyright (C) 2018 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.h" +#include "../../../../include/test_utils.h" + +#define TEST_COUNT_TOTAL ( \ + (PATTERN_INPUTS_SHORT_COUNT) * (PATTERN_INPUTS_SHORT_COUNT) + \ + (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT)) + + +int32_t main(void) +{ + char *instruction_name = "SUBS_U.W"; + int32_t ret; + uint32_t i, j; + struct timeval start, end; + double elapsed_time; + + uint64_t b128_result[TEST_COUNT_TOTAL][2]; + uint64_t b128_expect[TEST_COUNT_TOTAL][2] = { + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 0 */ + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, + { 0x5555555555555555ULL, 0x5555555555555555ULL, }, + { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, }, + { 0x3333333333333333ULL, 0x3333333333333333ULL, }, + { 0xccccccccccccccccULL, 0xccccccccccccccccULL, }, + { 0x1c71c71c71c71c71ULL, 0xc71c71c71c71c71cULL, }, + { 0xe38e38e38e38e38eULL, 0x38e38e38e38e38e3ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 8 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 16 */ + { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x5555555555555555ULL, 0x5555555555555555ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x7777777777777777ULL, 0x7777777777777777ULL, }, + { 0x000000001c71c71cULL, 0x71c71c7200000000ULL, }, + { 0x8e38e38e38e38e39ULL, 0x000000008e38e38eULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 24 */ + { 0x5555555555555555ULL, 0x5555555555555555ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x2222222222222222ULL, 0x2222222222222222ULL, }, + { 0x0000000000000000ULL, 0x1c71c71d00000000ULL, }, + { 0x38e38e3900000000ULL, 0x0000000038e38e39ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 32 */ + { 0xccccccccccccccccULL, 0xccccccccccccccccULL, }, + { 0x2222222222222222ULL, 0x2222222222222222ULL, }, + { 0x7777777777777777ULL, 0x7777777777777777ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x9999999999999999ULL, 0x9999999999999999ULL, }, + { 0x000000003e93e93eULL, 0x93e93e9400000000ULL, }, + { 0xb05b05b05b05b05bULL, 0x05b05b05b05b05b0ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 40 */ + { 0x3333333333333333ULL, 0x3333333333333333ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x16c16c1700000000ULL, 0x0000000016c16c17ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 48 */ + { 0xe38e38e38e38e38eULL, 0x38e38e38e38e38e3ULL, }, + { 0x38e38e3900000000ULL, 0x0000000038e38e39ULL, }, + { 0x8e38e38e38e38e39ULL, 0x000000008e38e38eULL, }, + { 0x16c16c1700000000ULL, 0x0000000016c16c17ULL, }, + { 0xb05b05b05b05b05bULL, 0x05b05b05b05b05b0ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0xc71c71c71c71c71dULL, 0x00000000c71c71c7ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 56 */ + { 0x1c71c71c71c71c71ULL, 0xc71c71c71c71c71cULL, }, + { 0x0000000000000000ULL, 0x1c71c71d00000000ULL, }, + { 0x000000001c71c71cULL, 0x71c71c7200000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x000000003e93e93eULL, 0x93e93e9400000000ULL, }, + { 0x0000000000000000ULL, 0x8e38e38f00000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 64 */ + { 0x0000000000000000ULL, 0x386f5044e93c5d10ULL, }, + { 0x0000000000000000ULL, 0x238e445f53508af8ULL, }, + { 0x181bd07f00000000ULL, 0x000000005538cd6cULL, }, + { 0x73531997253171c8ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x4f6351b900000000ULL, 0x0000000000000000ULL, }, + { 0x8b6eea1600000000ULL, 0x0000000000000000ULL, }, + { 0x23efc7de916d3640ULL, 0x0000000000000000ULL, }, /* 72 */ + { 0x000000006c3bc478ULL, 0x14e10be595ebd218ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x3c0b985d5b9da932ULL, 0x0000000001e84274ULL, }, + { 0x0000000035cf8d0eULL, 0x428a7d7a00000000ULL, }, + { 0x00000000109e1b46ULL, 0x7af9cdbe94038fa4ULL, }, +}; + + gettimeofday(&start, NULL); + + for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) { + for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) { + do_msa_SUBS_U_W(b128_pattern[i], b128_pattern[j], + b128_result[PATTERN_INPUTS_SHORT_COUNT * i + j]); + } + } + + for (i = 0; i < RANDOM_INPUTS_SHORT_COUNT; i++) { + for (j = 0; j < RANDOM_INPUTS_SHORT_COUNT; j++) { + do_msa_SUBS_U_W(b128_random[i], b128_random[j], + b128_result[((PATTERN_INPUTS_SHORT_COUNT) * + (PATTERN_INPUTS_SHORT_COUNT)) + + RANDOM_INPUTS_SHORT_COUNT * i + j]); + } + } + + gettimeofday(&end, NULL); + + elapsed_time = (end.tv_sec - start.tv_sec) * 1000.0; + elapsed_time += (end.tv_usec - start.tv_usec) / 1000.0; + + ret = check_results(instruction_name, TEST_COUNT_TOTAL, elapsed_time, + &b128_result[0][0], &b128_expect[0][0]); + + return ret; +} diff --git a/tests/tcg/mips/user/ase/msa/int-subtract/test_msa_subsus_u_b.c b/tests/tcg/mips/user/ase/msa/int-subtract/test_msa_subsus_u_b.c new file mode 100644 index 0000000000..dac20cc769 --- /dev/null +++ b/tests/tcg/mips/user/ase/msa/int-subtract/test_msa_subsus_u_b.c @@ -0,0 +1,151 @@ +/* + * Test program for MSA instruction SUBSUS_U.B + * + * Copyright (C) 2018 Wave Computing, Inc. + * Copyright (C) 2018 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.h" +#include "../../../../include/test_utils.h" + +#define TEST_COUNT_TOTAL ( \ + (PATTERN_INPUTS_SHORT_COUNT) * (PATTERN_INPUTS_SHORT_COUNT) + \ + (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT)) + + +int32_t main(void) +{ + char *instruction_name = "SUBSUS_U.B"; + int32_t ret; + uint32_t i, j; + struct timeval start, end; + double elapsed_time; + + uint64_t b128_result[TEST_COUNT_TOTAL][2]; + uint64_t b128_expect[TEST_COUNT_TOTAL][2] = { + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 0 */ + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, + { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, }, + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, + { 0xccccccccccccccccULL, 0xccccccccccccccccULL, }, + { 0xffffc7ffffc7ffffULL, 0xc7ffffc7ffffc7ffULL, }, + { 0xe38effe38effe38eULL, 0xffe38effe38effe3ULL, }, + { 0x0101010101010101ULL, 0x0101010101010101ULL, }, /* 8 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x5656565656565656ULL, 0x5656565656565656ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x3434343434343434ULL, 0x3434343434343434ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x1d72001d72001d72ULL, 0x001d72001d72001dULL, }, + { 0x0000390000390000ULL, 0x3900003900003900ULL, }, + { 0xababababababababULL, 0xababababababababULL, }, /* 16 */ + { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, }, + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, + { 0x5555555555555555ULL, 0x5555555555555555ULL, }, + { 0xdedededededededeULL, 0xdedededededededeULL, }, + { 0x7777777777777777ULL, 0x7777777777777777ULL, }, + { 0xc7ff72c7ff72c7ffULL, 0x72c7ff72c7ff72c7ULL, }, + { 0x8e39e38e39e38e39ULL, 0xe38e39e38e39e38eULL, }, + { 0x5656565656565656ULL, 0x5656565656565656ULL, }, /* 24 */ + { 0x5555555555555555ULL, 0x5555555555555555ULL, }, + { 0xababababababababULL, 0xababababababababULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x8989898989898989ULL, 0x8989898989898989ULL, }, + { 0x2222222222222222ULL, 0x2222222222222222ULL, }, + { 0x72c71d72c71d72c7ULL, 0x1d72c71d72c71d72ULL, }, + { 0x39008e39008e3900ULL, 0x8e39008e39008e39ULL, }, + { 0xcdcdcdcdcdcdcdcdULL, 0xcdcdcdcdcdcdcdcdULL, }, /* 32 */ + { 0xccccccccccccccccULL, 0xccccccccccccccccULL, }, + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, + { 0x7777777777777777ULL, 0x7777777777777777ULL, }, + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, + { 0x9999999999999999ULL, 0x9999999999999999ULL, }, + { 0xe9ff94e9ff94e9ffULL, 0x94e9ff94e9ff94e9ULL, }, + { 0xb05bffb05bffb05bULL, 0xffb05bffb05bffb0ULL, }, + { 0x3434343434343434ULL, 0x3434343434343434ULL, }, /* 40 */ + { 0x3333333333333333ULL, 0x3333333333333333ULL, }, + { 0x8989898989898989ULL, 0x8989898989898989ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x6767676767676767ULL, 0x6767676767676767ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x50a50050a50050a5ULL, 0x0050a50050a50050ULL, }, + { 0x17006c17006c1700ULL, 0x6c17006c17006c17ULL, }, + { 0xe48f39e48f39e48fULL, 0x39e48f39e48f39e4ULL, }, /* 48 */ + { 0xe38e38e38e38e38eULL, 0x38e38e38e38e38e3ULL, }, + { 0xffe48effe48effe4ULL, 0x8effe48effe48effULL, }, + { 0x8e39008e39008e39ULL, 0x008e39008e39008eULL, }, + { 0xffc26cffc26cffc2ULL, 0x6cffc26cffc26cffULL, }, + { 0xb05b05b05b05b05bULL, 0x05b05b05b05b05b0ULL, }, + { 0xffff00ffff00ffffULL, 0x00ffff00ffff00ffULL, }, + { 0xc71d71c71d71c71dULL, 0x71c71d71c71d71c7ULL, }, + { 0x1d72c81d72c81d72ULL, 0xc81d72c81d72c81dULL, }, /* 56 */ + { 0x1c71c71c71c71c71ULL, 0xc71c71c71c71c71cULL, }, + { 0x72c7ff72c7ff72c7ULL, 0xff72c7ff72c7ff72ULL, }, + { 0x001c72001c72001cULL, 0x72001c72001c7200ULL, }, + { 0x50a5fb50a5fb50a5ULL, 0xfb50a5fb50a5fb50ULL, }, + { 0x003e94003e94003eULL, 0x94003e94003e9400ULL, }, + { 0x39e38f39e38f39e3ULL, 0x8f39e38f39e38f39ULL, }, + { 0x0000ff0000ff0000ULL, 0xff0000ff0000ff00ULL, }, + { 0xff00ffff00000000ULL, 0x00000000ff00ff00ULL, }, /* 64 */ + { 0x8dace66900cf8e38ULL, 0x39705044e93c5e10ULL, }, + { 0xdc10ffff6f93cac0ULL, 0x248f455fff508b00ULL, }, + { 0x181bd07f00317300ULL, 0xbe768386ff39ce6cULL, }, + { 0xff541a9725317200ULL, 0x0090b0001700a2f0ULL, }, + { 0xffff000000ffff00ULL, 0x00ffff00000000ffULL, }, + { 0xff6452b994c4ff88ULL, 0x00fff51b6a142de8ULL, }, + { 0x8b6f00160062e500ULL, 0x85ffff426c0070ffULL, }, + { 0xff00c8de916d3640ULL, 0x0071bba1ad007508ULL, }, /* 72 */ + { 0xb19cae476cffc478ULL, 0x15e1ffe596000018ULL, }, + { 0xff00ffffffffffffULL, 0x00ffffffff000000ULL, }, + { 0x3c0b985d5b9ea932ULL, 0x9ae7ffffff004374ULL, }, + { 0xe800308136008d0eULL, 0x428a7d7aab00ff94ULL, }, + { 0x75911600119eff46ULL, 0x7bfacdbe940390a4ULL, }, +}; + + gettimeofday(&start, NULL); + + for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) { + for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) { + do_msa_SUBSUS_U_B(b128_pattern[i], b128_pattern[j], + b128_result[PATTERN_INPUTS_SHORT_COUNT * i + j]); + } + } + + for (i = 0; i < RANDOM_INPUTS_SHORT_COUNT; i++) { + for (j = 0; j < RANDOM_INPUTS_SHORT_COUNT; j++) { + do_msa_SUBSUS_U_B(b128_random[i], b128_random[j], + b128_result[((PATTERN_INPUTS_SHORT_COUNT) * + (PATTERN_INPUTS_SHORT_COUNT)) + + RANDOM_INPUTS_SHORT_COUNT * i + j]); + } + } + + gettimeofday(&end, NULL); + + elapsed_time = (end.tv_sec - start.tv_sec) * 1000.0; + elapsed_time += (end.tv_usec - start.tv_usec) / 1000.0; + + ret = check_results(instruction_name, TEST_COUNT_TOTAL, elapsed_time, + &b128_result[0][0], &b128_expect[0][0]); + + return ret; +} diff --git a/tests/tcg/mips/user/ase/msa/int-subtract/test_msa_subsus_u_d.c b/tests/tcg/mips/user/ase/msa/int-subtract/test_msa_subsus_u_d.c new file mode 100644 index 0000000000..4485502c1c --- /dev/null +++ b/tests/tcg/mips/user/ase/msa/int-subtract/test_msa_subsus_u_d.c @@ -0,0 +1,151 @@ +/* + * Test program for MSA instruction SUBSUS_U.D + * + * Copyright (C) 2018 Wave Computing, Inc. + * Copyright (C) 2018 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.h" +#include "../../../../include/test_utils.h" + +#define TEST_COUNT_TOTAL ( \ + (PATTERN_INPUTS_SHORT_COUNT) * (PATTERN_INPUTS_SHORT_COUNT) + \ + (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT)) + + +int32_t main(void) +{ + char *instruction_name = "SUBSUS_U.D"; + int32_t ret; + uint32_t i, j; + struct timeval start, end; + double elapsed_time; + + uint64_t b128_result[TEST_COUNT_TOTAL][2]; + uint64_t b128_expect[TEST_COUNT_TOTAL][2] = { + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 0 */ + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, + { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, }, + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, + { 0xccccccccccccccccULL, 0xccccccccccccccccULL, }, + { 0xffffffffffffffffULL, 0xc71c71c71c71c71cULL, }, + { 0xe38e38e38e38e38eULL, 0xffffffffffffffffULL, }, + { 0x0000000000000001ULL, 0x0000000000000001ULL, }, /* 8 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x5555555555555556ULL, 0x5555555555555556ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x3333333333333334ULL, 0x3333333333333334ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x1c71c71c71c71c72ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x38e38e38e38e38e4ULL, }, + { 0xaaaaaaaaaaaaaaabULL, 0xaaaaaaaaaaaaaaabULL, }, /* 16 */ + { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, }, + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, + { 0x5555555555555555ULL, 0x5555555555555555ULL, }, + { 0xdddddddddddddddeULL, 0xdddddddddddddddeULL, }, + { 0x7777777777777777ULL, 0x7777777777777777ULL, }, + { 0xc71c71c71c71c71cULL, 0x71c71c71c71c71c7ULL, }, + { 0x8e38e38e38e38e39ULL, 0xe38e38e38e38e38eULL, }, + { 0x5555555555555556ULL, 0x5555555555555556ULL, }, /* 24 */ + { 0x5555555555555555ULL, 0x5555555555555555ULL, }, + { 0xaaaaaaaaaaaaaaabULL, 0xaaaaaaaaaaaaaaabULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x8888888888888889ULL, 0x8888888888888889ULL, }, + { 0x2222222222222222ULL, 0x2222222222222222ULL, }, + { 0x71c71c71c71c71c7ULL, 0x1c71c71c71c71c72ULL, }, + { 0x38e38e38e38e38e4ULL, 0x8e38e38e38e38e39ULL, }, + { 0xcccccccccccccccdULL, 0xcccccccccccccccdULL, }, /* 32 */ + { 0xccccccccccccccccULL, 0xccccccccccccccccULL, }, + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, + { 0x7777777777777777ULL, 0x7777777777777777ULL, }, + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, + { 0x9999999999999999ULL, 0x9999999999999999ULL, }, + { 0xe93e93e93e93e93eULL, 0x93e93e93e93e93e9ULL, }, + { 0xb05b05b05b05b05bULL, 0xffffffffffffffffULL, }, + { 0x3333333333333334ULL, 0x3333333333333334ULL, }, /* 40 */ + { 0x3333333333333333ULL, 0x3333333333333333ULL, }, + { 0x8888888888888889ULL, 0x8888888888888889ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x6666666666666667ULL, 0x6666666666666667ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x4fa4fa4fa4fa4fa5ULL, 0x0000000000000000ULL, }, + { 0x16c16c16c16c16c2ULL, 0x6c16c16c16c16c17ULL, }, + { 0xe38e38e38e38e38fULL, 0x38e38e38e38e38e4ULL, }, /* 48 */ + { 0xe38e38e38e38e38eULL, 0x38e38e38e38e38e3ULL, }, + { 0xffffffffffffffffULL, 0x8e38e38e38e38e39ULL, }, + { 0x8e38e38e38e38e39ULL, 0x0000000000000000ULL, }, + { 0xffffffffffffffffULL, 0x6c16c16c16c16c17ULL, }, + { 0xb05b05b05b05b05bULL, 0x05b05b05b05b05b0ULL, }, + { 0xffffffffffffffffULL, 0x0000000000000000ULL, }, + { 0xc71c71c71c71c71dULL, 0x71c71c71c71c71c7ULL, }, + { 0x1c71c71c71c71c72ULL, 0xc71c71c71c71c71dULL, }, /* 56 */ + { 0x1c71c71c71c71c71ULL, 0xc71c71c71c71c71cULL, }, + { 0x71c71c71c71c71c7ULL, 0xffffffffffffffffULL, }, + { 0x0000000000000000ULL, 0x71c71c71c71c71c7ULL, }, + { 0x4fa4fa4fa4fa4fa5ULL, 0xfa4fa4fa4fa4fa50ULL, }, + { 0x0000000000000000ULL, 0x93e93e93e93e93e9ULL, }, + { 0x38e38e38e38e38e3ULL, 0x8e38e38e38e38e39ULL, }, + { 0x0000000000000000ULL, 0xffffffffffffffffULL, }, + { 0xffffffffffffffffULL, 0x0000000000000000ULL, }, /* 64 */ + { 0x8cace668dace8e38ULL, 0x386f5044e93c5d10ULL, }, + { 0xdc1038216e92c9c0ULL, 0x238e445f53508af8ULL, }, + { 0x181bd07eca3072f2ULL, 0xbd7582865538cd6cULL, }, + { 0xffffffffffffffffULL, 0x0000000000000000ULL, }, + { 0xffffffffffffffffULL, 0x0000000000000000ULL, }, + { 0xffffffffffffffffULL, 0x0000000000000000ULL, }, + { 0x8b6eea15ef61e4baULL, 0x850632416bfc705cULL, }, + { 0xffffffffffffffffULL, 0x0000000000000000ULL, }, /* 72 */ + { 0xb09cae476c3bc478ULL, 0x14e10be595ebd218ULL, }, + { 0xffffffffffffffffULL, 0x0000000000000000ULL, }, + { 0x3c0b985d5b9da932ULL, 0x99e73e2701e84274ULL, }, + { 0xe7e42f8135cf8d0eULL, 0x428a7d79aac73294ULL, }, + { 0x749115ea109e1b46ULL, 0x7af9cdbe94038fa4ULL, }, +}; + + gettimeofday(&start, NULL); + + for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) { + for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) { + do_msa_SUBSUS_U_D(b128_pattern[i], b128_pattern[j], + b128_result[PATTERN_INPUTS_SHORT_COUNT * i + j]); + } + } + + for (i = 0; i < RANDOM_INPUTS_SHORT_COUNT; i++) { + for (j = 0; j < RANDOM_INPUTS_SHORT_COUNT; j++) { + do_msa_SUBSUS_U_D(b128_random[i], b128_random[j], + b128_result[((PATTERN_INPUTS_SHORT_COUNT) * + (PATTERN_INPUTS_SHORT_COUNT)) + + RANDOM_INPUTS_SHORT_COUNT * i + j]); + } + } + + gettimeofday(&end, NULL); + + elapsed_time = (end.tv_sec - start.tv_sec) * 1000.0; + elapsed_time += (end.tv_usec - start.tv_usec) / 1000.0; + + ret = check_results(instruction_name, TEST_COUNT_TOTAL, elapsed_time, + &b128_result[0][0], &b128_expect[0][0]); + + return ret; +} diff --git a/tests/tcg/mips/user/ase/msa/int-subtract/test_msa_subsus_u_h.c b/tests/tcg/mips/user/ase/msa/int-subtract/test_msa_subsus_u_h.c new file mode 100644 index 0000000000..9e99aeefc5 --- /dev/null +++ b/tests/tcg/mips/user/ase/msa/int-subtract/test_msa_subsus_u_h.c @@ -0,0 +1,151 @@ +/* + * Test program for MSA instruction SUBSUS_U.H + * + * Copyright (C) 2018 Wave Computing, Inc. + * Copyright (C) 2018 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.h" +#include "../../../../include/test_utils.h" + +#define TEST_COUNT_TOTAL ( \ + (PATTERN_INPUTS_SHORT_COUNT) * (PATTERN_INPUTS_SHORT_COUNT) + \ + (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT)) + + +int32_t main(void) +{ + char *instruction_name = "SUBSUS_U.H"; + int32_t ret; + uint32_t i, j; + struct timeval start, end; + double elapsed_time; + + uint64_t b128_result[TEST_COUNT_TOTAL][2]; + uint64_t b128_expect[TEST_COUNT_TOTAL][2] = { + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 0 */ + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, + { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, }, + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, + { 0xccccccccccccccccULL, 0xccccccccccccccccULL, }, + { 0xffffc71cffffffffULL, 0xc71cffffffffc71cULL, }, + { 0xe38effff8e38e38eULL, 0xffff8e38e38effffULL, }, + { 0x0001000100010001ULL, 0x0001000100010001ULL, }, /* 8 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x5556555655565556ULL, 0x5556555655565556ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x3334333433343334ULL, 0x3334333433343334ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x1c72000071c81c72ULL, 0x000071c81c720000ULL, }, + { 0x000038e400000000ULL, 0x38e40000000038e4ULL, }, + { 0xaaabaaabaaabaaabULL, 0xaaabaaabaaabaaabULL, }, /* 16 */ + { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, }, + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, + { 0x5555555555555555ULL, 0x5555555555555555ULL, }, + { 0xdddedddedddedddeULL, 0xdddedddedddedddeULL, }, + { 0x7777777777777777ULL, 0x7777777777777777ULL, }, + { 0xc71c71c7ffffc71cULL, 0x71c7ffffc71c71c7ULL, }, + { 0x8e39e38e38e38e39ULL, 0xe38e38e38e39e38eULL, }, + { 0x5556555655565556ULL, 0x5556555655565556ULL, }, /* 24 */ + { 0x5555555555555555ULL, 0x5555555555555555ULL, }, + { 0xaaabaaabaaabaaabULL, 0xaaabaaabaaabaaabULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x8889888988898889ULL, 0x8889888988898889ULL, }, + { 0x2222222222222222ULL, 0x2222222222222222ULL, }, + { 0x71c71c72c71d71c7ULL, 0x1c72c71d71c71c72ULL, }, + { 0x38e48e39000038e4ULL, 0x8e39000038e48e39ULL, }, + { 0xcccdcccdcccdcccdULL, 0xcccdcccdcccdcccdULL, }, /* 32 */ + { 0xccccccccccccccccULL, 0xccccccccccccccccULL, }, + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, + { 0x7777777777777777ULL, 0x7777777777777777ULL, }, + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, + { 0x9999999999999999ULL, 0x9999999999999999ULL, }, + { 0xe93e93e9ffffe93eULL, 0x93e9ffffe93e93e9ULL, }, + { 0xb05bffff5b05b05bULL, 0xffff5b05b05bffffULL, }, + { 0x3334333433343334ULL, 0x3334333433343334ULL, }, /* 40 */ + { 0x3333333333333333ULL, 0x3333333333333333ULL, }, + { 0x8889888988898889ULL, 0x8889888988898889ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x6667666766676667ULL, 0x6667666766676667ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x4fa50000a4fb4fa5ULL, 0x0000a4fb4fa50000ULL, }, + { 0x16c26c17000016c2ULL, 0x6c17000016c26c17ULL, }, + { 0xe38f38e48e39e38fULL, 0x38e48e39e38f38e4ULL, }, /* 48 */ + { 0xe38e38e38e38e38eULL, 0x38e38e38e38e38e3ULL, }, + { 0xffff8e39e38effffULL, 0x8e39e38effff8e39ULL, }, + { 0x8e39000038e38e39ULL, 0x000038e38e390000ULL, }, + { 0xffff6c17c16cffffULL, 0x6c17c16cffff6c17ULL, }, + { 0xb05b05b05b05b05bULL, 0x05b05b05b05b05b0ULL, }, + { 0xffff0000ffffffffULL, 0x0000ffffffff0000ULL, }, + { 0xc71d71c71c71c71dULL, 0x71c71c71c71d71c7ULL, }, + { 0x1c72c71d71c81c72ULL, 0xc71d71c81c72c71dULL, }, /* 56 */ + { 0x1c71c71c71c71c71ULL, 0xc71c71c71c71c71cULL, }, + { 0x71c7ffffc71d71c7ULL, 0xffffc71d71c7ffffULL, }, + { 0x000071c71c720000ULL, 0x71c71c72000071c7ULL, }, + { 0x4fa5fa50a4fb4fa5ULL, 0xfa50a4fb4fa5fa50ULL, }, + { 0x000093e93e940000ULL, 0x93e93e94000093e9ULL, }, + { 0x38e38e39e38f38e3ULL, 0x8e39e38f38e38e39ULL, }, + { 0x0000ffff00000000ULL, 0xffff00000000ffffULL, }, + { 0xffffffff00000000ULL, 0x00000000ffffffffULL, }, /* 64 */ + { 0x8cace66900008e38ULL, 0x38705044e93c5d10ULL, }, + { 0xdc10ffff6e93c9c0ULL, 0x238f445fffff8af8ULL, }, + { 0x181bd07f000072f2ULL, 0xbd768286ffffcd6cULL, }, + { 0xffff1997253171c8ULL, 0x0000afbc16c4a2f0ULL, }, + { 0xffff00000000ffffULL, 0x0000ffff00000000ULL, }, + { 0xffff51b993c4ffffULL, 0x0000f41b6a142de8ULL, }, + { 0x8b6f00000000e4baULL, 0x8506ffff6bfd705cULL, }, + { 0xffffc7de916d3640ULL, 0x0000bba1acb07508ULL, }, /* 72 */ + { 0xb09cae476c3cc478ULL, 0x14e1ffff95ec0000ULL, }, + { 0xffffffffffffffffULL, 0x0000ffffffff0000ULL, }, + { 0x3c0b985d5b9ea932ULL, 0x99e7ffffffff4274ULL, }, + { 0xe7e52f8135cf8d0eULL, 0x428a7d7aaac7ffffULL, }, + { 0x749115ea109effffULL, 0x7afacdbe94038fa4ULL, }, +}; + + gettimeofday(&start, NULL); + + for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) { + for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) { + do_msa_SUBSUS_U_H(b128_pattern[i], b128_pattern[j], + b128_result[PATTERN_INPUTS_SHORT_COUNT * i + j]); + } + } + + for (i = 0; i < RANDOM_INPUTS_SHORT_COUNT; i++) { + for (j = 0; j < RANDOM_INPUTS_SHORT_COUNT; j++) { + do_msa_SUBSUS_U_H(b128_random[i], b128_random[j], + b128_result[((PATTERN_INPUTS_SHORT_COUNT) * + (PATTERN_INPUTS_SHORT_COUNT)) + + RANDOM_INPUTS_SHORT_COUNT * i + j]); + } + } + + gettimeofday(&end, NULL); + + elapsed_time = (end.tv_sec - start.tv_sec) * 1000.0; + elapsed_time += (end.tv_usec - start.tv_usec) / 1000.0; + + ret = check_results(instruction_name, TEST_COUNT_TOTAL, elapsed_time, + &b128_result[0][0], &b128_expect[0][0]); + + return ret; +} diff --git a/tests/tcg/mips/user/ase/msa/int-subtract/test_msa_subsus_u_w.c b/tests/tcg/mips/user/ase/msa/int-subtract/test_msa_subsus_u_w.c new file mode 100644 index 0000000000..53a9acac1b --- /dev/null +++ b/tests/tcg/mips/user/ase/msa/int-subtract/test_msa_subsus_u_w.c @@ -0,0 +1,151 @@ +/* + * Test program for MSA instruction SUBSUS_U.W + * + * Copyright (C) 2018 Wave Computing, Inc. + * Copyright (C) 2018 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.h" +#include "../../../../include/test_utils.h" + +#define TEST_COUNT_TOTAL ( \ + (PATTERN_INPUTS_SHORT_COUNT) * (PATTERN_INPUTS_SHORT_COUNT) + \ + (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT)) + + +int32_t main(void) +{ + char *instruction_name = "SUBSUS_U.W"; + int32_t ret; + uint32_t i, j; + struct timeval start, end; + double elapsed_time; + + uint64_t b128_result[TEST_COUNT_TOTAL][2]; + uint64_t b128_expect[TEST_COUNT_TOTAL][2] = { + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 0 */ + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, + { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, }, + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, + { 0xccccccccccccccccULL, 0xccccccccccccccccULL, }, + { 0xffffffffffffffffULL, 0xc71c71c7ffffffffULL, }, + { 0xe38e38e38e38e38eULL, 0xffffffffe38e38e3ULL, }, + { 0x0000000100000001ULL, 0x0000000100000001ULL, }, /* 8 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x5555555655555556ULL, 0x5555555655555556ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x3333333433333334ULL, 0x3333333433333334ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x1c71c71d71c71c72ULL, 0x000000001c71c71dULL, }, + { 0x0000000000000000ULL, 0x38e38e3900000000ULL, }, + { 0xaaaaaaabaaaaaaabULL, 0xaaaaaaabaaaaaaabULL, }, /* 16 */ + { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, }, + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, + { 0x5555555555555555ULL, 0x5555555555555555ULL, }, + { 0xdddddddedddddddeULL, 0xdddddddedddddddeULL, }, + { 0x7777777777777777ULL, 0x7777777777777777ULL, }, + { 0xc71c71c7ffffffffULL, 0x71c71c72c71c71c7ULL, }, + { 0x8e38e38e38e38e39ULL, 0xe38e38e38e38e38eULL, }, + { 0x5555555655555556ULL, 0x5555555655555556ULL, }, /* 24 */ + { 0x5555555555555555ULL, 0x5555555555555555ULL, }, + { 0xaaaaaaabaaaaaaabULL, 0xaaaaaaabaaaaaaabULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x8888888988888889ULL, 0x8888888988888889ULL, }, + { 0x2222222222222222ULL, 0x2222222222222222ULL, }, + { 0x71c71c72c71c71c7ULL, 0x1c71c71d71c71c72ULL, }, + { 0x38e38e3900000000ULL, 0x8e38e38e38e38e39ULL, }, + { 0xcccccccdcccccccdULL, 0xcccccccdcccccccdULL, }, /* 32 */ + { 0xccccccccccccccccULL, 0xccccccccccccccccULL, }, + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, + { 0x7777777777777777ULL, 0x7777777777777777ULL, }, + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, + { 0x9999999999999999ULL, 0x9999999999999999ULL, }, + { 0xe93e93e9ffffffffULL, 0x93e93e94e93e93e9ULL, }, + { 0xb05b05b05b05b05bULL, 0xffffffffb05b05b0ULL, }, + { 0x3333333433333334ULL, 0x3333333433333334ULL, }, /* 40 */ + { 0x3333333333333333ULL, 0x3333333333333333ULL, }, + { 0x8888888988888889ULL, 0x8888888988888889ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x6666666766666667ULL, 0x6666666766666667ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x4fa4fa50a4fa4fa5ULL, 0x000000004fa4fa50ULL, }, + { 0x16c16c1700000000ULL, 0x6c16c16c16c16c17ULL, }, + { 0xe38e38e48e38e38fULL, 0x38e38e39e38e38e4ULL, }, /* 48 */ + { 0xe38e38e38e38e38eULL, 0x38e38e38e38e38e3ULL, }, + { 0xffffffffe38e38e4ULL, 0x8e38e38effffffffULL, }, + { 0x8e38e38e38e38e39ULL, 0x000000008e38e38eULL, }, + { 0xffffffffc16c16c2ULL, 0x6c16c16cffffffffULL, }, + { 0xb05b05b05b05b05bULL, 0x05b05b05b05b05b0ULL, }, + { 0xffffffffffffffffULL, 0x00000000ffffffffULL, }, + { 0xc71c71c71c71c71dULL, 0x71c71c71c71c71c7ULL, }, + { 0x1c71c71d71c71c72ULL, 0xc71c71c81c71c71dULL, }, /* 56 */ + { 0x1c71c71c71c71c71ULL, 0xc71c71c71c71c71cULL, }, + { 0x71c71c72c71c71c7ULL, 0xffffffff71c71c72ULL, }, + { 0x000000001c71c71cULL, 0x71c71c7200000000ULL, }, + { 0x4fa4fa50a4fa4fa5ULL, 0xfa4fa4fb4fa4fa50ULL, }, + { 0x000000003e93e93eULL, 0x93e93e9400000000ULL, }, + { 0x38e38e39e38e38e3ULL, 0x8e38e38f38e38e39ULL, }, + { 0x0000000000000000ULL, 0xffffffff00000000ULL, }, + { 0xffffffff00000000ULL, 0x00000000ffffffffULL, }, /* 64 */ + { 0x8cace66900000000ULL, 0x386f5044e93c5d10ULL, }, + { 0xdc1038226e92c9c0ULL, 0x238e445fffffffffULL, }, + { 0x181bd07f00000000ULL, 0xbd758286ffffffffULL, }, + { 0xffffffff253171c8ULL, 0x0000000016c3a2f0ULL, }, + { 0xffffffff00000000ULL, 0x0000000000000000ULL, }, + { 0xffffffff93c43b88ULL, 0x000000006a142de8ULL, }, + { 0x8b6eea1600000000ULL, 0x850632426bfc705cULL, }, + { 0xffffffff916d3640ULL, 0x00000000acaf7508ULL, }, /* 72 */ + { 0xb09cae476c3bc478ULL, 0x14e10be595ebd218ULL, }, + { 0xffffffffffffffffULL, 0x00000000ffffffffULL, }, + { 0x3c0b985d5b9da932ULL, 0x99e73e27ffffffffULL, }, + { 0xe7e42f8135cf8d0eULL, 0x428a7d7aaac73294ULL, }, + { 0x749115ea109e1b46ULL, 0x7af9cdbe94038fa4ULL, }, +}; + + gettimeofday(&start, NULL); + + for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) { + for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) { + do_msa_SUBSUS_U_W(b128_pattern[i], b128_pattern[j], + b128_result[PATTERN_INPUTS_SHORT_COUNT * i + j]); + } + } + + for (i = 0; i < RANDOM_INPUTS_SHORT_COUNT; i++) { + for (j = 0; j < RANDOM_INPUTS_SHORT_COUNT; j++) { + do_msa_SUBSUS_U_W(b128_random[i], b128_random[j], + b128_result[((PATTERN_INPUTS_SHORT_COUNT) * + (PATTERN_INPUTS_SHORT_COUNT)) + + RANDOM_INPUTS_SHORT_COUNT * i + j]); + } + } + + gettimeofday(&end, NULL); + + elapsed_time = (end.tv_sec - start.tv_sec) * 1000.0; + elapsed_time += (end.tv_usec - start.tv_usec) / 1000.0; + + ret = check_results(instruction_name, TEST_COUNT_TOTAL, elapsed_time, + &b128_result[0][0], &b128_expect[0][0]); + + return ret; +} diff --git a/tests/tcg/mips/user/ase/msa/int-subtract/test_msa_subsuu_s_b.c b/tests/tcg/mips/user/ase/msa/int-subtract/test_msa_subsuu_s_b.c new file mode 100644 index 0000000000..86fb4f3e26 --- /dev/null +++ b/tests/tcg/mips/user/ase/msa/int-subtract/test_msa_subsuu_s_b.c @@ -0,0 +1,151 @@ +/* + * Test program for MSA instruction SUBSUU_S.B + * + * Copyright (C) 2018 Wave Computing, Inc. + * Copyright (C) 2018 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.h" +#include "../../../../include/test_utils.h" + +#define TEST_COUNT_TOTAL ( \ + (PATTERN_INPUTS_SHORT_COUNT) * (PATTERN_INPUTS_SHORT_COUNT) + \ + (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT)) + + +int32_t main(void) +{ + char *instruction_name = "SUBSUU_S.B"; + int32_t ret; + uint32_t i, j; + struct timeval start, end; + double elapsed_time; + + uint64_t b128_result[TEST_COUNT_TOTAL][2]; + uint64_t b128_expect[TEST_COUNT_TOTAL][2] = { + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 0 */ + { 0x7f7f7f7f7f7f7f7fULL, 0x7f7f7f7f7f7f7f7fULL, }, + { 0x5555555555555555ULL, 0x5555555555555555ULL, }, + { 0x7f7f7f7f7f7f7f7fULL, 0x7f7f7f7f7f7f7f7fULL, }, + { 0x3333333333333333ULL, 0x3333333333333333ULL, }, + { 0x7f7f7f7f7f7f7f7fULL, 0x7f7f7f7f7f7f7f7fULL, }, + { 0x1c717f1c717f1c71ULL, 0x7f1c717f1c717f1cULL, }, + { 0x7f7f387f7f387f7fULL, 0x387f7f387f7f387fULL, }, + { 0x8080808080808080ULL, 0x8080808080808080ULL, }, /* 8 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x8080808080808080ULL, 0x8080808080808080ULL, }, + { 0xababababababababULL, 0xababababababababULL, }, + { 0x8080808080808080ULL, 0x8080808080808080ULL, }, + { 0xcdcdcdcdcdcdcdcdULL, 0xcdcdcdcdcdcdcdcdULL, }, + { 0x8080c88080c88080ULL, 0xc88080c88080c880ULL, }, + { 0xe48f80e48f80e48fULL, 0x80e48f80e48f80e4ULL, }, + { 0xababababababababULL, 0xababababababababULL, }, /* 16 */ + { 0x7f7f7f7f7f7f7f7fULL, 0x7f7f7f7f7f7f7f7fULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x5555555555555555ULL, 0x5555555555555555ULL, }, + { 0xdedededededededeULL, 0xdedededededededeULL, }, + { 0x7777777777777777ULL, 0x7777777777777777ULL, }, + { 0xc71c72c71c72c71cULL, 0x72c71c72c71c72c7ULL, }, + { 0x7f39e37f39e37f39ULL, 0xe37f39e37f39e37fULL, }, + { 0x8080808080808080ULL, 0x8080808080808080ULL, }, /* 24 */ + { 0x5555555555555555ULL, 0x5555555555555555ULL, }, + { 0xababababababababULL, 0xababababababababULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x8989898989898989ULL, 0x8989898989898989ULL, }, + { 0x2222222222222222ULL, 0x2222222222222222ULL, }, + { 0x80c71d80c71d80c7ULL, 0x1d80c71d80c71d80ULL, }, + { 0x39e48e39e48e39e4ULL, 0x8e39e48e39e48e39ULL, }, + { 0xcdcdcdcdcdcdcdcdULL, 0xcdcdcdcdcdcdcdcdULL, }, /* 32 */ + { 0x7f7f7f7f7f7f7f7fULL, 0x7f7f7f7f7f7f7f7fULL, }, + { 0x2222222222222222ULL, 0x2222222222222222ULL, }, + { 0x7777777777777777ULL, 0x7777777777777777ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x7f7f7f7f7f7f7f7fULL, 0x7f7f7f7f7f7f7f7fULL, }, + { 0xe93e7fe93e7fe93eULL, 0x7fe93e7fe93e7fe9ULL, }, + { 0x7f5b057f5b057f5bULL, 0x057f5b057f5b057fULL, }, + { 0x8080808080808080ULL, 0x8080808080808080ULL, }, /* 40 */ + { 0x3333333333333333ULL, 0x3333333333333333ULL, }, + { 0x8989898989898989ULL, 0x8989898989898989ULL, }, + { 0xdedededededededeULL, 0xdedededededededeULL, }, + { 0x8080808080808080ULL, 0x8080808080808080ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x80a5fb80a5fb80a5ULL, 0xfb80a5fb80a5fb80ULL, }, + { 0x17c28017c28017c2ULL, 0x8017c28017c28017ULL, }, + { 0xe48f80e48f80e48fULL, 0x80e48f80e48f80e4ULL, }, /* 48 */ + { 0x7f7f387f7f387f7fULL, 0x387f7f387f7f387fULL, }, + { 0x39e48e39e48e39e4ULL, 0x8e39e48e39e48e39ULL, }, + { 0x7f39e37f39e37f39ULL, 0xe37f39e37f39e37fULL, }, + { 0x17c28017c28017c2ULL, 0x8017c28017c28017ULL, }, + { 0x7f5b057f5b057f5bULL, 0x057f5b057f5b057fULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x7f1d807f1d807f1dULL, 0x807f1d807f1d807fULL, }, + { 0x8080c88080c88080ULL, 0xc88080c88080c880ULL, }, /* 56 */ + { 0x1c717f1c717f1c71ULL, 0x7f1c717f1c717f1cULL, }, + { 0x80c71d80c71d80c7ULL, 0x1d80c71d80c71d80ULL, }, + { 0xc71c72c71c72c71cULL, 0x72c71c72c71c72c7ULL, }, + { 0x80a5fb80a5fb80a5ULL, 0xfb80a5fb80a5fb80ULL, }, + { 0xe93e7fe93e7fe93eULL, 0x7fe93e7fe93e7fe9ULL, }, + { 0x80e37f80e37f80e3ULL, 0x7f80e37f80e37f80ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 64 */ + { 0x8dac7f69dbcf8e38ULL, 0x398080447f3c5e80ULL, }, + { 0xdc1038228093cac0ULL, 0x248f808053507ff8ULL, }, + { 0x181b7f7fca3180f2ULL, 0xbe8083865539ce80ULL, }, + { 0x73548097253172c8ULL, 0xc77f7fbc80c4a27fULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x4f6480b994c43c88ULL, 0xeb1ff58080142d7fULL, }, + { 0x7f6fea16ef62e5baULL, 0x8506338080fd805cULL, }, + { 0x24f0c8de7f6d3640ULL, 0xdc717f7fadb08008ULL, }, /* 72 */ + { 0xb19c7f476c3cc478ULL, 0x15e10b7f7fecd380ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x3c0b7f5d5b7fa932ULL, 0x9ae73e2702e98080ULL, }, + { 0xe8e5808136cf7f0eULL, 0x427f7d7aabc7327fULL, }, + { 0x809116ea119e1b46ULL, 0x7bfacd7f7f037fa4ULL, }, +}; + + gettimeofday(&start, NULL); + + for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) { + for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) { + do_msa_SUBSUU_S_B(b128_pattern[i], b128_pattern[j], + b128_result[PATTERN_INPUTS_SHORT_COUNT * i + j]); + } + } + + for (i = 0; i < RANDOM_INPUTS_SHORT_COUNT; i++) { + for (j = 0; j < RANDOM_INPUTS_SHORT_COUNT; j++) { + do_msa_SUBSUU_S_B(b128_random[i], b128_random[j], + b128_result[((PATTERN_INPUTS_SHORT_COUNT) * + (PATTERN_INPUTS_SHORT_COUNT)) + + RANDOM_INPUTS_SHORT_COUNT * i + j]); + } + } + + gettimeofday(&end, NULL); + + elapsed_time = (end.tv_sec - start.tv_sec) * 1000.0; + elapsed_time += (end.tv_usec - start.tv_usec) / 1000.0; + + ret = check_results(instruction_name, TEST_COUNT_TOTAL, elapsed_time, + &b128_result[0][0], &b128_expect[0][0]); + + return ret; +} diff --git a/tests/tcg/mips/user/ase/msa/int-subtract/test_msa_subsuu_s_d.c b/tests/tcg/mips/user/ase/msa/int-subtract/test_msa_subsuu_s_d.c new file mode 100644 index 0000000000..45a1eb3094 --- /dev/null +++ b/tests/tcg/mips/user/ase/msa/int-subtract/test_msa_subsuu_s_d.c @@ -0,0 +1,151 @@ +/* + * Test program for MSA instruction SUBSUU_S.D + * + * Copyright (C) 2018 Wave Computing, Inc. + * Copyright (C) 2018 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.h" +#include "../../../../include/test_utils.h" + +#define TEST_COUNT_TOTAL ( \ + (PATTERN_INPUTS_SHORT_COUNT) * (PATTERN_INPUTS_SHORT_COUNT) + \ + (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT)) + + +int32_t main(void) +{ + char *instruction_name = "SUBSUU_S.D"; + int32_t ret; + uint32_t i, j; + struct timeval start, end; + double elapsed_time; + + uint64_t b128_result[TEST_COUNT_TOTAL][2]; + uint64_t b128_expect[TEST_COUNT_TOTAL][2] = { + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 0 */ + { 0x7fffffffffffffffULL, 0x7fffffffffffffffULL, }, + { 0x5555555555555555ULL, 0x5555555555555555ULL, }, + { 0x7fffffffffffffffULL, 0x7fffffffffffffffULL, }, + { 0x3333333333333333ULL, 0x3333333333333333ULL, }, + { 0x7fffffffffffffffULL, 0x7fffffffffffffffULL, }, + { 0x1c71c71c71c71c71ULL, 0x7fffffffffffffffULL, }, + { 0x7fffffffffffffffULL, 0x38e38e38e38e38e3ULL, }, + { 0x8000000000000000ULL, 0x8000000000000000ULL, }, /* 8 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x8000000000000000ULL, 0x8000000000000000ULL, }, + { 0xaaaaaaaaaaaaaaabULL, 0xaaaaaaaaaaaaaaabULL, }, + { 0x8000000000000000ULL, 0x8000000000000000ULL, }, + { 0xcccccccccccccccdULL, 0xcccccccccccccccdULL, }, + { 0x8000000000000000ULL, 0xc71c71c71c71c71dULL, }, + { 0xe38e38e38e38e38fULL, 0x8000000000000000ULL, }, + { 0xaaaaaaaaaaaaaaabULL, 0xaaaaaaaaaaaaaaabULL, }, /* 16 */ + { 0x7fffffffffffffffULL, 0x7fffffffffffffffULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x5555555555555555ULL, 0x5555555555555555ULL, }, + { 0xdddddddddddddddeULL, 0xdddddddddddddddeULL, }, + { 0x7777777777777777ULL, 0x7777777777777777ULL, }, + { 0xc71c71c71c71c71cULL, 0x71c71c71c71c71c7ULL, }, + { 0x7fffffffffffffffULL, 0xe38e38e38e38e38eULL, }, + { 0x8000000000000000ULL, 0x8000000000000000ULL, }, /* 24 */ + { 0x5555555555555555ULL, 0x5555555555555555ULL, }, + { 0xaaaaaaaaaaaaaaabULL, 0xaaaaaaaaaaaaaaabULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x8888888888888889ULL, 0x8888888888888889ULL, }, + { 0x2222222222222222ULL, 0x2222222222222222ULL, }, + { 0x8000000000000000ULL, 0x1c71c71c71c71c72ULL, }, + { 0x38e38e38e38e38e4ULL, 0x8e38e38e38e38e39ULL, }, + { 0xcccccccccccccccdULL, 0xcccccccccccccccdULL, }, /* 32 */ + { 0x7fffffffffffffffULL, 0x7fffffffffffffffULL, }, + { 0x2222222222222222ULL, 0x2222222222222222ULL, }, + { 0x7777777777777777ULL, 0x7777777777777777ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x7fffffffffffffffULL, 0x7fffffffffffffffULL, }, + { 0xe93e93e93e93e93eULL, 0x7fffffffffffffffULL, }, + { 0x7fffffffffffffffULL, 0x05b05b05b05b05b0ULL, }, + { 0x8000000000000000ULL, 0x8000000000000000ULL, }, /* 40 */ + { 0x3333333333333333ULL, 0x3333333333333333ULL, }, + { 0x8888888888888889ULL, 0x8888888888888889ULL, }, + { 0xdddddddddddddddeULL, 0xdddddddddddddddeULL, }, + { 0x8000000000000000ULL, 0x8000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x8000000000000000ULL, 0xfa4fa4fa4fa4fa50ULL, }, + { 0x16c16c16c16c16c2ULL, 0x8000000000000000ULL, }, + { 0xe38e38e38e38e38fULL, 0x8000000000000000ULL, }, /* 48 */ + { 0x7fffffffffffffffULL, 0x38e38e38e38e38e3ULL, }, + { 0x38e38e38e38e38e4ULL, 0x8e38e38e38e38e39ULL, }, + { 0x7fffffffffffffffULL, 0xe38e38e38e38e38eULL, }, + { 0x16c16c16c16c16c2ULL, 0x8000000000000000ULL, }, + { 0x7fffffffffffffffULL, 0x05b05b05b05b05b0ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x7fffffffffffffffULL, 0x8000000000000000ULL, }, + { 0x8000000000000000ULL, 0xc71c71c71c71c71dULL, }, /* 56 */ + { 0x1c71c71c71c71c71ULL, 0x7fffffffffffffffULL, }, + { 0x8000000000000000ULL, 0x1c71c71c71c71c72ULL, }, + { 0xc71c71c71c71c71cULL, 0x71c71c71c71c71c7ULL, }, + { 0x8000000000000000ULL, 0xfa4fa4fa4fa4fa50ULL, }, + { 0xe93e93e93e93e93eULL, 0x7fffffffffffffffULL, }, + { 0x8000000000000000ULL, 0x7fffffffffffffffULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 64 */ + { 0x8cace668dace8e38ULL, 0x386f5044e93c5d10ULL, }, + { 0xdc1038216e92c9c0ULL, 0x238e445f53508af8ULL, }, + { 0x181bd07eca3072f2ULL, 0xbd7582865538cd6cULL, }, + { 0x73531997253171c8ULL, 0xc790afbb16c3a2f0ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x4f6351b893c43b88ULL, 0xeb1ef41a6a142de8ULL, }, + { 0x7fffffffffffffffULL, 0x850632416bfc705cULL, }, + { 0x23efc7de916d3640ULL, 0xdc71bba0acaf7508ULL, }, /* 72 */ + { 0xb09cae476c3bc478ULL, 0x14e10be595ebd218ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x3c0b985d5b9da932ULL, 0x99e73e2701e84274ULL, }, + { 0xe7e42f8135cf8d0eULL, 0x428a7d79aac73294ULL, }, + { 0x8000000000000000ULL, 0x7af9cdbe94038fa4ULL, }, +}; + + gettimeofday(&start, NULL); + + for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) { + for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) { + do_msa_SUBSUU_S_D(b128_pattern[i], b128_pattern[j], + b128_result[PATTERN_INPUTS_SHORT_COUNT * i + j]); + } + } + + for (i = 0; i < RANDOM_INPUTS_SHORT_COUNT; i++) { + for (j = 0; j < RANDOM_INPUTS_SHORT_COUNT; j++) { + do_msa_SUBSUU_S_D(b128_random[i], b128_random[j], + b128_result[((PATTERN_INPUTS_SHORT_COUNT) * + (PATTERN_INPUTS_SHORT_COUNT)) + + RANDOM_INPUTS_SHORT_COUNT * i + j]); + } + } + + gettimeofday(&end, NULL); + + elapsed_time = (end.tv_sec - start.tv_sec) * 1000.0; + elapsed_time += (end.tv_usec - start.tv_usec) / 1000.0; + + ret = check_results(instruction_name, TEST_COUNT_TOTAL, elapsed_time, + &b128_result[0][0], &b128_expect[0][0]); + + return ret; +} diff --git a/tests/tcg/mips/user/ase/msa/int-subtract/test_msa_subsuu_s_h.c b/tests/tcg/mips/user/ase/msa/int-subtract/test_msa_subsuu_s_h.c new file mode 100644 index 0000000000..14ac7def29 --- /dev/null +++ b/tests/tcg/mips/user/ase/msa/int-subtract/test_msa_subsuu_s_h.c @@ -0,0 +1,151 @@ +/* + * Test program for MSA instruction SUBSUU_S.H + * + * Copyright (C) 2018 Wave Computing, Inc. + * Copyright (C) 2018 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.h" +#include "../../../../include/test_utils.h" + +#define TEST_COUNT_TOTAL ( \ + (PATTERN_INPUTS_SHORT_COUNT) * (PATTERN_INPUTS_SHORT_COUNT) + \ + (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT)) + + +int32_t main(void) +{ + char *instruction_name = "SUBSUU_S.H"; + int32_t ret; + uint32_t i, j; + struct timeval start, end; + double elapsed_time; + + uint64_t b128_result[TEST_COUNT_TOTAL][2]; + uint64_t b128_expect[TEST_COUNT_TOTAL][2] = { + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 0 */ + { 0x7fff7fff7fff7fffULL, 0x7fff7fff7fff7fffULL, }, + { 0x5555555555555555ULL, 0x5555555555555555ULL, }, + { 0x7fff7fff7fff7fffULL, 0x7fff7fff7fff7fffULL, }, + { 0x3333333333333333ULL, 0x3333333333333333ULL, }, + { 0x7fff7fff7fff7fffULL, 0x7fff7fff7fff7fffULL, }, + { 0x1c717fff71c71c71ULL, 0x7fff71c71c717fffULL, }, + { 0x7fff38e37fff7fffULL, 0x38e37fff7fff38e3ULL, }, + { 0x8000800080008000ULL, 0x8000800080008000ULL, }, /* 8 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x8000800080008000ULL, 0x8000800080008000ULL, }, + { 0xaaabaaabaaabaaabULL, 0xaaabaaabaaabaaabULL, }, + { 0x8000800080008000ULL, 0x8000800080008000ULL, }, + { 0xcccdcccdcccdcccdULL, 0xcccdcccdcccdcccdULL, }, + { 0x8000c71d80008000ULL, 0xc71d80008000c71dULL, }, + { 0xe38f80008e39e38fULL, 0x80008e39e38f8000ULL, }, + { 0xaaabaaabaaabaaabULL, 0xaaabaaabaaabaaabULL, }, /* 16 */ + { 0x7fff7fff7fff7fffULL, 0x7fff7fff7fff7fffULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x5555555555555555ULL, 0x5555555555555555ULL, }, + { 0xdddedddedddedddeULL, 0xdddedddedddedddeULL, }, + { 0x7777777777777777ULL, 0x7777777777777777ULL, }, + { 0xc71c71c71c72c71cULL, 0x71c71c72c71c71c7ULL, }, + { 0x7fffe38e38e37fffULL, 0xe38e38e37fffe38eULL, }, + { 0x8000800080008000ULL, 0x8000800080008000ULL, }, /* 24 */ + { 0x5555555555555555ULL, 0x5555555555555555ULL, }, + { 0xaaabaaabaaabaaabULL, 0xaaabaaabaaabaaabULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x8889888988898889ULL, 0x8889888988898889ULL, }, + { 0x2222222222222222ULL, 0x2222222222222222ULL, }, + { 0x80001c72c71d8000ULL, 0x1c72c71d80001c72ULL, }, + { 0x38e48e39e38e38e4ULL, 0x8e39e38e38e48e39ULL, }, + { 0xcccdcccdcccdcccdULL, 0xcccdcccdcccdcccdULL, }, /* 32 */ + { 0x7fff7fff7fff7fffULL, 0x7fff7fff7fff7fffULL, }, + { 0x2222222222222222ULL, 0x2222222222222222ULL, }, + { 0x7777777777777777ULL, 0x7777777777777777ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x7fff7fff7fff7fffULL, 0x7fff7fff7fff7fffULL, }, + { 0xe93e7fff3e94e93eULL, 0x7fff3e94e93e7fffULL, }, + { 0x7fff05b05b057fffULL, 0x05b05b057fff05b0ULL, }, + { 0x8000800080008000ULL, 0x8000800080008000ULL, }, /* 40 */ + { 0x3333333333333333ULL, 0x3333333333333333ULL, }, + { 0x8889888988898889ULL, 0x8889888988898889ULL, }, + { 0xdddedddedddedddeULL, 0xdddedddedddedddeULL, }, + { 0x8000800080008000ULL, 0x8000800080008000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x8000fa50a4fb8000ULL, 0xfa50a4fb8000fa50ULL, }, + { 0x16c28000c16c16c2ULL, 0x8000c16c16c28000ULL, }, + { 0xe38f80008e39e38fULL, 0x80008e39e38f8000ULL, }, /* 48 */ + { 0x7fff38e37fff7fffULL, 0x38e37fff7fff38e3ULL, }, + { 0x38e48e39e38e38e4ULL, 0x8e39e38e38e48e39ULL, }, + { 0x7fffe38e38e37fffULL, 0xe38e38e37fffe38eULL, }, + { 0x16c28000c16c16c2ULL, 0x8000c16c16c28000ULL, }, + { 0x7fff05b05b057fffULL, 0x05b05b057fff05b0ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x7fff80001c717fffULL, 0x80001c717fff8000ULL, }, + { 0x8000c71d80008000ULL, 0xc71d80008000c71dULL, }, /* 56 */ + { 0x1c717fff71c71c71ULL, 0x7fff71c71c717fffULL, }, + { 0x80001c72c71d8000ULL, 0x1c72c71d80001c72ULL, }, + { 0xc71c71c71c72c71cULL, 0x71c71c72c71c71c7ULL, }, + { 0x8000fa50a4fb8000ULL, 0xfa50a4fb8000fa50ULL, }, + { 0xe93e7fff3e94e93eULL, 0x7fff3e94e93e7fffULL, }, + { 0x80007fffe38f8000ULL, 0x7fffe38f80007fffULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 64 */ + { 0x8cac7fffdacf8e38ULL, 0x387080007fff5d10ULL, }, + { 0xdc1038228000c9c0ULL, 0x238f800053507fffULL, }, + { 0x181b7fffca318000ULL, 0xbd7682865539cd6cULL, }, + { 0x73548000253171c8ULL, 0xc7907fff8000a2f0ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x4f64800093c43b88ULL, 0xeb1ff41b80002de8ULL, }, + { 0x7fffea16ef62e4baULL, 0x8506324280008000ULL, }, + { 0x23f0c7de7fff3640ULL, 0xdc717fffacb08000ULL, }, /* 72 */ + { 0xb09c7fff6c3cc478ULL, 0x14e10be57fffd218ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x3c0b7fff5b9ea932ULL, 0x99e73e2701e98000ULL, }, + { 0xe7e5800035cf7fffULL, 0x428a7d7aaac73294ULL, }, + { 0x800015ea109e1b46ULL, 0x7afacdbe7fff7fffULL, }, +}; + + gettimeofday(&start, NULL); + + for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) { + for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) { + do_msa_SUBSUU_S_H(b128_pattern[i], b128_pattern[j], + b128_result[PATTERN_INPUTS_SHORT_COUNT * i + j]); + } + } + + for (i = 0; i < RANDOM_INPUTS_SHORT_COUNT; i++) { + for (j = 0; j < RANDOM_INPUTS_SHORT_COUNT; j++) { + do_msa_SUBSUU_S_H(b128_random[i], b128_random[j], + b128_result[((PATTERN_INPUTS_SHORT_COUNT) * + (PATTERN_INPUTS_SHORT_COUNT)) + + RANDOM_INPUTS_SHORT_COUNT * i + j]); + } + } + + gettimeofday(&end, NULL); + + elapsed_time = (end.tv_sec - start.tv_sec) * 1000.0; + elapsed_time += (end.tv_usec - start.tv_usec) / 1000.0; + + ret = check_results(instruction_name, TEST_COUNT_TOTAL, elapsed_time, + &b128_result[0][0], &b128_expect[0][0]); + + return ret; +} diff --git a/tests/tcg/mips/user/ase/msa/int-subtract/test_msa_subsuu_s_w.c b/tests/tcg/mips/user/ase/msa/int-subtract/test_msa_subsuu_s_w.c new file mode 100644 index 0000000000..688f469cd0 --- /dev/null +++ b/tests/tcg/mips/user/ase/msa/int-subtract/test_msa_subsuu_s_w.c @@ -0,0 +1,151 @@ +/* + * Test program for MSA instruction SUBSUU_S.W + * + * Copyright (C) 2018 Wave Computing, Inc. + * Copyright (C) 2018 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.h" +#include "../../../../include/test_utils.h" + +#define TEST_COUNT_TOTAL ( \ + (PATTERN_INPUTS_SHORT_COUNT) * (PATTERN_INPUTS_SHORT_COUNT) + \ + (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT)) + + +int32_t main(void) +{ + char *instruction_name = "SUBSUU_S.W"; + int32_t ret; + uint32_t i, j; + struct timeval start, end; + double elapsed_time; + + uint64_t b128_result[TEST_COUNT_TOTAL][2]; + uint64_t b128_expect[TEST_COUNT_TOTAL][2] = { + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 0 */ + { 0x7fffffff7fffffffULL, 0x7fffffff7fffffffULL, }, + { 0x5555555555555555ULL, 0x5555555555555555ULL, }, + { 0x7fffffff7fffffffULL, 0x7fffffff7fffffffULL, }, + { 0x3333333333333333ULL, 0x3333333333333333ULL, }, + { 0x7fffffff7fffffffULL, 0x7fffffff7fffffffULL, }, + { 0x1c71c71c71c71c71ULL, 0x7fffffff1c71c71cULL, }, + { 0x7fffffff7fffffffULL, 0x38e38e387fffffffULL, }, + { 0x8000000080000000ULL, 0x8000000080000000ULL, }, /* 8 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x8000000080000000ULL, 0x8000000080000000ULL, }, + { 0xaaaaaaabaaaaaaabULL, 0xaaaaaaabaaaaaaabULL, }, + { 0x8000000080000000ULL, 0x8000000080000000ULL, }, + { 0xcccccccdcccccccdULL, 0xcccccccdcccccccdULL, }, + { 0x8000000080000000ULL, 0xc71c71c880000000ULL, }, + { 0xe38e38e48e38e38fULL, 0x80000000e38e38e4ULL, }, + { 0xaaaaaaabaaaaaaabULL, 0xaaaaaaabaaaaaaabULL, }, /* 16 */ + { 0x7fffffff7fffffffULL, 0x7fffffff7fffffffULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x5555555555555555ULL, 0x5555555555555555ULL, }, + { 0xdddddddedddddddeULL, 0xdddddddedddddddeULL, }, + { 0x7777777777777777ULL, 0x7777777777777777ULL, }, + { 0xc71c71c71c71c71cULL, 0x71c71c72c71c71c7ULL, }, + { 0x7fffffff38e38e39ULL, 0xe38e38e37fffffffULL, }, + { 0x8000000080000000ULL, 0x8000000080000000ULL, }, /* 24 */ + { 0x5555555555555555ULL, 0x5555555555555555ULL, }, + { 0xaaaaaaabaaaaaaabULL, 0xaaaaaaabaaaaaaabULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x8888888988888889ULL, 0x8888888988888889ULL, }, + { 0x2222222222222222ULL, 0x2222222222222222ULL, }, + { 0x80000000c71c71c7ULL, 0x1c71c71d80000000ULL, }, + { 0x38e38e39e38e38e4ULL, 0x8e38e38e38e38e39ULL, }, + { 0xcccccccdcccccccdULL, 0xcccccccdcccccccdULL, }, /* 32 */ + { 0x7fffffff7fffffffULL, 0x7fffffff7fffffffULL, }, + { 0x2222222222222222ULL, 0x2222222222222222ULL, }, + { 0x7777777777777777ULL, 0x7777777777777777ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x7fffffff7fffffffULL, 0x7fffffff7fffffffULL, }, + { 0xe93e93e93e93e93eULL, 0x7fffffffe93e93e9ULL, }, + { 0x7fffffff5b05b05bULL, 0x05b05b057fffffffULL, }, + { 0x8000000080000000ULL, 0x8000000080000000ULL, }, /* 40 */ + { 0x3333333333333333ULL, 0x3333333333333333ULL, }, + { 0x8888888988888889ULL, 0x8888888988888889ULL, }, + { 0xdddddddedddddddeULL, 0xdddddddedddddddeULL, }, + { 0x8000000080000000ULL, 0x8000000080000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x80000000a4fa4fa5ULL, 0xfa4fa4fb80000000ULL, }, + { 0x16c16c17c16c16c2ULL, 0x8000000016c16c17ULL, }, + { 0xe38e38e48e38e38fULL, 0x80000000e38e38e4ULL, }, /* 48 */ + { 0x7fffffff7fffffffULL, 0x38e38e387fffffffULL, }, + { 0x38e38e39e38e38e4ULL, 0x8e38e38e38e38e39ULL, }, + { 0x7fffffff38e38e39ULL, 0xe38e38e37fffffffULL, }, + { 0x16c16c17c16c16c2ULL, 0x8000000016c16c17ULL, }, + { 0x7fffffff5b05b05bULL, 0x05b05b057fffffffULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x7fffffff1c71c71dULL, 0x800000007fffffffULL, }, + { 0x8000000080000000ULL, 0xc71c71c880000000ULL, }, /* 56 */ + { 0x1c71c71c71c71c71ULL, 0x7fffffff1c71c71cULL, }, + { 0x80000000c71c71c7ULL, 0x1c71c71d80000000ULL, }, + { 0xc71c71c71c71c71cULL, 0x71c71c72c71c71c7ULL, }, + { 0x80000000a4fa4fa5ULL, 0xfa4fa4fb80000000ULL, }, + { 0xe93e93e93e93e93eULL, 0x7fffffffe93e93e9ULL, }, + { 0x80000000e38e38e3ULL, 0x7fffffff80000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 64 */ + { 0x8cace669dace8e38ULL, 0x386f50447fffffffULL, }, + { 0xdc10382280000000ULL, 0x238e445f53508af8ULL, }, + { 0x181bd07fca3072f2ULL, 0xbd7582865538cd6cULL, }, + { 0x73531997253171c8ULL, 0xc790afbc80000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x4f6351b993c43b88ULL, 0xeb1ef41b80000000ULL, }, + { 0x7fffffffef61e4baULL, 0x8506324280000000ULL, }, + { 0x23efc7de7fffffffULL, 0xdc71bba1acaf7508ULL, }, /* 72 */ + { 0xb09cae476c3bc478ULL, 0x14e10be57fffffffULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x3c0b985d5b9da932ULL, 0x99e73e2701e84274ULL, }, + { 0xe7e42f8135cf8d0eULL, 0x428a7d7aaac73294ULL, }, + { 0x80000000109e1b46ULL, 0x7af9cdbe7fffffffULL, }, +}; + + gettimeofday(&start, NULL); + + for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) { + for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) { + do_msa_SUBSUU_S_W(b128_pattern[i], b128_pattern[j], + b128_result[PATTERN_INPUTS_SHORT_COUNT * i + j]); + } + } + + for (i = 0; i < RANDOM_INPUTS_SHORT_COUNT; i++) { + for (j = 0; j < RANDOM_INPUTS_SHORT_COUNT; j++) { + do_msa_SUBSUU_S_W(b128_random[i], b128_random[j], + b128_result[((PATTERN_INPUTS_SHORT_COUNT) * + (PATTERN_INPUTS_SHORT_COUNT)) + + RANDOM_INPUTS_SHORT_COUNT * i + j]); + } + } + + gettimeofday(&end, NULL); + + elapsed_time = (end.tv_sec - start.tv_sec) * 1000.0; + elapsed_time += (end.tv_usec - start.tv_usec) / 1000.0; + + ret = check_results(instruction_name, TEST_COUNT_TOTAL, elapsed_time, + &b128_result[0][0], &b128_expect[0][0]); + + return ret; +} diff --git a/tests/tcg/mips/user/ase/msa/int-subtract/test_msa_subv_b.c b/tests/tcg/mips/user/ase/msa/int-subtract/test_msa_subv_b.c new file mode 100644 index 0000000000..d0964dcd59 --- /dev/null +++ b/tests/tcg/mips/user/ase/msa/int-subtract/test_msa_subv_b.c @@ -0,0 +1,151 @@ +/* + * Test program for MSA instruction SUBV.B + * + * Copyright (C) 2018 Wave Computing, Inc. + * Copyright (C) 2018 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.h" +#include "../../../../include/test_utils.h" + +#define TEST_COUNT_TOTAL ( \ + (PATTERN_INPUTS_SHORT_COUNT) * (PATTERN_INPUTS_SHORT_COUNT) + \ + (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT)) + + +int32_t main(void) +{ + char *instruction_name = "SUBV.B"; + int32_t ret; + uint32_t i, j; + struct timeval start, end; + double elapsed_time; + + uint64_t b128_result[TEST_COUNT_TOTAL][2]; + uint64_t b128_expect[TEST_COUNT_TOTAL][2] = { + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 0 */ + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, + { 0x5555555555555555ULL, 0x5555555555555555ULL, }, + { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, }, + { 0x3333333333333333ULL, 0x3333333333333333ULL, }, + { 0xccccccccccccccccULL, 0xccccccccccccccccULL, }, + { 0x1c71c71c71c71c71ULL, 0xc71c71c71c71c71cULL, }, + { 0xe38e38e38e38e38eULL, 0x38e38e38e38e38e3ULL, }, + { 0x0101010101010101ULL, 0x0101010101010101ULL, }, /* 8 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x5656565656565656ULL, 0x5656565656565656ULL, }, + { 0xababababababababULL, 0xababababababababULL, }, + { 0x3434343434343434ULL, 0x3434343434343434ULL, }, + { 0xcdcdcdcdcdcdcdcdULL, 0xcdcdcdcdcdcdcdcdULL, }, + { 0x1d72c81d72c81d72ULL, 0xc81d72c81d72c81dULL, }, + { 0xe48f39e48f39e48fULL, 0x39e48f39e48f39e4ULL, }, + { 0xababababababababULL, 0xababababababababULL, }, /* 16 */ + { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x5555555555555555ULL, 0x5555555555555555ULL, }, + { 0xdedededededededeULL, 0xdedededededededeULL, }, + { 0x7777777777777777ULL, 0x7777777777777777ULL, }, + { 0xc71c72c71c72c71cULL, 0x72c71c72c71c72c7ULL, }, + { 0x8e39e38e39e38e39ULL, 0xe38e39e38e39e38eULL, }, + { 0x5656565656565656ULL, 0x5656565656565656ULL, }, /* 24 */ + { 0x5555555555555555ULL, 0x5555555555555555ULL, }, + { 0xababababababababULL, 0xababababababababULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x8989898989898989ULL, 0x8989898989898989ULL, }, + { 0x2222222222222222ULL, 0x2222222222222222ULL, }, + { 0x72c71d72c71d72c7ULL, 0x1d72c71d72c71d72ULL, }, + { 0x39e48e39e48e39e4ULL, 0x8e39e48e39e48e39ULL, }, + { 0xcdcdcdcdcdcdcdcdULL, 0xcdcdcdcdcdcdcdcdULL, }, /* 32 */ + { 0xccccccccccccccccULL, 0xccccccccccccccccULL, }, + { 0x2222222222222222ULL, 0x2222222222222222ULL, }, + { 0x7777777777777777ULL, 0x7777777777777777ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x9999999999999999ULL, 0x9999999999999999ULL, }, + { 0xe93e94e93e94e93eULL, 0x94e93e94e93e94e9ULL, }, + { 0xb05b05b05b05b05bULL, 0x05b05b05b05b05b0ULL, }, + { 0x3434343434343434ULL, 0x3434343434343434ULL, }, /* 40 */ + { 0x3333333333333333ULL, 0x3333333333333333ULL, }, + { 0x8989898989898989ULL, 0x8989898989898989ULL, }, + { 0xdedededededededeULL, 0xdedededededededeULL, }, + { 0x6767676767676767ULL, 0x6767676767676767ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x50a5fb50a5fb50a5ULL, 0xfb50a5fb50a5fb50ULL, }, + { 0x17c26c17c26c17c2ULL, 0x6c17c26c17c26c17ULL, }, + { 0xe48f39e48f39e48fULL, 0x39e48f39e48f39e4ULL, }, /* 48 */ + { 0xe38e38e38e38e38eULL, 0x38e38e38e38e38e3ULL, }, + { 0x39e48e39e48e39e4ULL, 0x8e39e48e39e48e39ULL, }, + { 0x8e39e38e39e38e39ULL, 0xe38e39e38e39e38eULL, }, + { 0x17c26c17c26c17c2ULL, 0x6c17c26c17c26c17ULL, }, + { 0xb05b05b05b05b05bULL, 0x05b05b05b05b05b0ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0xc71d71c71d71c71dULL, 0x71c71d71c71d71c7ULL, }, + { 0x1d72c81d72c81d72ULL, 0xc81d72c81d72c81dULL, }, /* 56 */ + { 0x1c71c71c71c71c71ULL, 0xc71c71c71c71c71cULL, }, + { 0x72c71d72c71d72c7ULL, 0x1d72c71d72c71d72ULL, }, + { 0xc71c72c71c72c71cULL, 0x72c71c72c71c72c7ULL, }, + { 0x50a5fb50a5fb50a5ULL, 0xfb50a5fb50a5fb50ULL, }, + { 0xe93e94e93e94e93eULL, 0x94e93e94e93e94e9ULL, }, + { 0x39e38f39e38f39e3ULL, 0x8f39e38f39e38f39ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 64 */ + { 0x8dace669dbcf8e38ULL, 0x39705044e93c5e10ULL, }, + { 0xdc1038226f93cac0ULL, 0x248f455f53508bf8ULL, }, + { 0x181bd07fca3173f2ULL, 0xbe7683865539ce6cULL, }, + { 0x73541a97253172c8ULL, 0xc790b0bc17c4a2f0ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x4f6452b994c43c88ULL, 0xeb1ff51b6a142de8ULL, }, + { 0x8b6fea16ef62e5baULL, 0x850633426cfd705cULL, }, + { 0x24f0c8de916d3640ULL, 0xdc71bba1adb07508ULL, }, /* 72 */ + { 0xb19cae476c3cc478ULL, 0x15e10be596ecd318ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x3c0b985d5b9ea932ULL, 0x9ae73e2702e94374ULL, }, + { 0xe8e5308136cf8d0eULL, 0x428a7d7aabc73294ULL, }, + { 0x759116ea119e1b46ULL, 0x7bfacdbe940390a4ULL, }, +}; + + gettimeofday(&start, NULL); + + for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) { + for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) { + do_msa_SUBV_B(b128_pattern[i], b128_pattern[j], + b128_result[PATTERN_INPUTS_SHORT_COUNT * i + j]); + } + } + + for (i = 0; i < RANDOM_INPUTS_SHORT_COUNT; i++) { + for (j = 0; j < RANDOM_INPUTS_SHORT_COUNT; j++) { + do_msa_SUBV_B(b128_random[i], b128_random[j], + b128_result[((PATTERN_INPUTS_SHORT_COUNT) * + (PATTERN_INPUTS_SHORT_COUNT)) + + RANDOM_INPUTS_SHORT_COUNT * i + j]); + } + } + + gettimeofday(&end, NULL); + + elapsed_time = (end.tv_sec - start.tv_sec) * 1000.0; + elapsed_time += (end.tv_usec - start.tv_usec) / 1000.0; + + ret = check_results(instruction_name, TEST_COUNT_TOTAL, elapsed_time, + &b128_result[0][0], &b128_expect[0][0]); + + return ret; +} diff --git a/tests/tcg/mips/user/ase/msa/int-subtract/test_msa_subv_d.c b/tests/tcg/mips/user/ase/msa/int-subtract/test_msa_subv_d.c new file mode 100644 index 0000000000..ec26a8e0c6 --- /dev/null +++ b/tests/tcg/mips/user/ase/msa/int-subtract/test_msa_subv_d.c @@ -0,0 +1,151 @@ +/* + * Test program for MSA instruction SUBV.D + * + * Copyright (C) 2018 Wave Computing, Inc. + * Copyright (C) 2018 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.h" +#include "../../../../include/test_utils.h" + +#define TEST_COUNT_TOTAL ( \ + (PATTERN_INPUTS_SHORT_COUNT) * (PATTERN_INPUTS_SHORT_COUNT) + \ + (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT)) + + +int32_t main(void) +{ + char *instruction_name = "SUBV.D"; + int32_t ret; + uint32_t i, j; + struct timeval start, end; + double elapsed_time; + + uint64_t b128_result[TEST_COUNT_TOTAL][2]; + uint64_t b128_expect[TEST_COUNT_TOTAL][2] = { + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 0 */ + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, + { 0x5555555555555555ULL, 0x5555555555555555ULL, }, + { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, }, + { 0x3333333333333333ULL, 0x3333333333333333ULL, }, + { 0xccccccccccccccccULL, 0xccccccccccccccccULL, }, + { 0x1c71c71c71c71c71ULL, 0xc71c71c71c71c71cULL, }, + { 0xe38e38e38e38e38eULL, 0x38e38e38e38e38e3ULL, }, + { 0x0000000000000001ULL, 0x0000000000000001ULL, }, /* 8 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x5555555555555556ULL, 0x5555555555555556ULL, }, + { 0xaaaaaaaaaaaaaaabULL, 0xaaaaaaaaaaaaaaabULL, }, + { 0x3333333333333334ULL, 0x3333333333333334ULL, }, + { 0xcccccccccccccccdULL, 0xcccccccccccccccdULL, }, + { 0x1c71c71c71c71c72ULL, 0xc71c71c71c71c71dULL, }, + { 0xe38e38e38e38e38fULL, 0x38e38e38e38e38e4ULL, }, + { 0xaaaaaaaaaaaaaaabULL, 0xaaaaaaaaaaaaaaabULL, }, /* 16 */ + { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x5555555555555555ULL, 0x5555555555555555ULL, }, + { 0xdddddddddddddddeULL, 0xdddddddddddddddeULL, }, + { 0x7777777777777777ULL, 0x7777777777777777ULL, }, + { 0xc71c71c71c71c71cULL, 0x71c71c71c71c71c7ULL, }, + { 0x8e38e38e38e38e39ULL, 0xe38e38e38e38e38eULL, }, + { 0x5555555555555556ULL, 0x5555555555555556ULL, }, /* 24 */ + { 0x5555555555555555ULL, 0x5555555555555555ULL, }, + { 0xaaaaaaaaaaaaaaabULL, 0xaaaaaaaaaaaaaaabULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x8888888888888889ULL, 0x8888888888888889ULL, }, + { 0x2222222222222222ULL, 0x2222222222222222ULL, }, + { 0x71c71c71c71c71c7ULL, 0x1c71c71c71c71c72ULL, }, + { 0x38e38e38e38e38e4ULL, 0x8e38e38e38e38e39ULL, }, + { 0xcccccccccccccccdULL, 0xcccccccccccccccdULL, }, /* 32 */ + { 0xccccccccccccccccULL, 0xccccccccccccccccULL, }, + { 0x2222222222222222ULL, 0x2222222222222222ULL, }, + { 0x7777777777777777ULL, 0x7777777777777777ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x9999999999999999ULL, 0x9999999999999999ULL, }, + { 0xe93e93e93e93e93eULL, 0x93e93e93e93e93e9ULL, }, + { 0xb05b05b05b05b05bULL, 0x05b05b05b05b05b0ULL, }, + { 0x3333333333333334ULL, 0x3333333333333334ULL, }, /* 40 */ + { 0x3333333333333333ULL, 0x3333333333333333ULL, }, + { 0x8888888888888889ULL, 0x8888888888888889ULL, }, + { 0xdddddddddddddddeULL, 0xdddddddddddddddeULL, }, + { 0x6666666666666667ULL, 0x6666666666666667ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x4fa4fa4fa4fa4fa5ULL, 0xfa4fa4fa4fa4fa50ULL, }, + { 0x16c16c16c16c16c2ULL, 0x6c16c16c16c16c17ULL, }, + { 0xe38e38e38e38e38fULL, 0x38e38e38e38e38e4ULL, }, /* 48 */ + { 0xe38e38e38e38e38eULL, 0x38e38e38e38e38e3ULL, }, + { 0x38e38e38e38e38e4ULL, 0x8e38e38e38e38e39ULL, }, + { 0x8e38e38e38e38e39ULL, 0xe38e38e38e38e38eULL, }, + { 0x16c16c16c16c16c2ULL, 0x6c16c16c16c16c17ULL, }, + { 0xb05b05b05b05b05bULL, 0x05b05b05b05b05b0ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0xc71c71c71c71c71dULL, 0x71c71c71c71c71c7ULL, }, + { 0x1c71c71c71c71c72ULL, 0xc71c71c71c71c71dULL, }, /* 56 */ + { 0x1c71c71c71c71c71ULL, 0xc71c71c71c71c71cULL, }, + { 0x71c71c71c71c71c7ULL, 0x1c71c71c71c71c72ULL, }, + { 0xc71c71c71c71c71cULL, 0x71c71c71c71c71c7ULL, }, + { 0x4fa4fa4fa4fa4fa5ULL, 0xfa4fa4fa4fa4fa50ULL, }, + { 0xe93e93e93e93e93eULL, 0x93e93e93e93e93e9ULL, }, + { 0x38e38e38e38e38e3ULL, 0x8e38e38e38e38e39ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 64 */ + { 0x8cace668dace8e38ULL, 0x386f5044e93c5d10ULL, }, + { 0xdc1038216e92c9c0ULL, 0x238e445f53508af8ULL, }, + { 0x181bd07eca3072f2ULL, 0xbd7582865538cd6cULL, }, + { 0x73531997253171c8ULL, 0xc790afbb16c3a2f0ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x4f6351b893c43b88ULL, 0xeb1ef41a6a142de8ULL, }, + { 0x8b6eea15ef61e4baULL, 0x850632416bfc705cULL, }, + { 0x23efc7de916d3640ULL, 0xdc71bba0acaf7508ULL, }, /* 72 */ + { 0xb09cae476c3bc478ULL, 0x14e10be595ebd218ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x3c0b985d5b9da932ULL, 0x99e73e2701e84274ULL, }, + { 0xe7e42f8135cf8d0eULL, 0x428a7d79aac73294ULL, }, + { 0x749115ea109e1b46ULL, 0x7af9cdbe94038fa4ULL, }, +}; + + gettimeofday(&start, NULL); + + for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) { + for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) { + do_msa_SUBV_D(b128_pattern[i], b128_pattern[j], + b128_result[PATTERN_INPUTS_SHORT_COUNT * i + j]); + } + } + + for (i = 0; i < RANDOM_INPUTS_SHORT_COUNT; i++) { + for (j = 0; j < RANDOM_INPUTS_SHORT_COUNT; j++) { + do_msa_SUBV_D(b128_random[i], b128_random[j], + b128_result[((PATTERN_INPUTS_SHORT_COUNT) * + (PATTERN_INPUTS_SHORT_COUNT)) + + RANDOM_INPUTS_SHORT_COUNT * i + j]); + } + } + + gettimeofday(&end, NULL); + + elapsed_time = (end.tv_sec - start.tv_sec) * 1000.0; + elapsed_time += (end.tv_usec - start.tv_usec) / 1000.0; + + ret = check_results(instruction_name, TEST_COUNT_TOTAL, elapsed_time, + &b128_result[0][0], &b128_expect[0][0]); + + return ret; +} diff --git a/tests/tcg/mips/user/ase/msa/int-subtract/test_msa_subv_h.c b/tests/tcg/mips/user/ase/msa/int-subtract/test_msa_subv_h.c new file mode 100644 index 0000000000..420422ecf1 --- /dev/null +++ b/tests/tcg/mips/user/ase/msa/int-subtract/test_msa_subv_h.c @@ -0,0 +1,151 @@ +/* + * Test program for MSA instruction SUBV.H + * + * Copyright (C) 2018 Wave Computing, Inc. + * Copyright (C) 2018 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.h" +#include "../../../../include/test_utils.h" + +#define TEST_COUNT_TOTAL ( \ + (PATTERN_INPUTS_SHORT_COUNT) * (PATTERN_INPUTS_SHORT_COUNT) + \ + (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT)) + + +int32_t main(void) +{ + char *instruction_name = "SUBV.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 */ + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, + { 0x5555555555555555ULL, 0x5555555555555555ULL, }, + { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, }, + { 0x3333333333333333ULL, 0x3333333333333333ULL, }, + { 0xccccccccccccccccULL, 0xccccccccccccccccULL, }, + { 0x1c71c71c71c71c71ULL, 0xc71c71c71c71c71cULL, }, + { 0xe38e38e38e38e38eULL, 0x38e38e38e38e38e3ULL, }, + { 0x0001000100010001ULL, 0x0001000100010001ULL, }, /* 8 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x5556555655565556ULL, 0x5556555655565556ULL, }, + { 0xaaabaaabaaabaaabULL, 0xaaabaaabaaabaaabULL, }, + { 0x3334333433343334ULL, 0x3334333433343334ULL, }, + { 0xcccdcccdcccdcccdULL, 0xcccdcccdcccdcccdULL, }, + { 0x1c72c71d71c81c72ULL, 0xc71d71c81c72c71dULL, }, + { 0xe38f38e48e39e38fULL, 0x38e48e39e38f38e4ULL, }, + { 0xaaabaaabaaabaaabULL, 0xaaabaaabaaabaaabULL, }, /* 16 */ + { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x5555555555555555ULL, 0x5555555555555555ULL, }, + { 0xdddedddedddedddeULL, 0xdddedddedddedddeULL, }, + { 0x7777777777777777ULL, 0x7777777777777777ULL, }, + { 0xc71c71c71c72c71cULL, 0x71c71c72c71c71c7ULL, }, + { 0x8e39e38e38e38e39ULL, 0xe38e38e38e39e38eULL, }, + { 0x5556555655565556ULL, 0x5556555655565556ULL, }, /* 24 */ + { 0x5555555555555555ULL, 0x5555555555555555ULL, }, + { 0xaaabaaabaaabaaabULL, 0xaaabaaabaaabaaabULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x8889888988898889ULL, 0x8889888988898889ULL, }, + { 0x2222222222222222ULL, 0x2222222222222222ULL, }, + { 0x71c71c72c71d71c7ULL, 0x1c72c71d71c71c72ULL, }, + { 0x38e48e39e38e38e4ULL, 0x8e39e38e38e48e39ULL, }, + { 0xcccdcccdcccdcccdULL, 0xcccdcccdcccdcccdULL, }, /* 32 */ + { 0xccccccccccccccccULL, 0xccccccccccccccccULL, }, + { 0x2222222222222222ULL, 0x2222222222222222ULL, }, + { 0x7777777777777777ULL, 0x7777777777777777ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x9999999999999999ULL, 0x9999999999999999ULL, }, + { 0xe93e93e93e94e93eULL, 0x93e93e94e93e93e9ULL, }, + { 0xb05b05b05b05b05bULL, 0x05b05b05b05b05b0ULL, }, + { 0x3334333433343334ULL, 0x3334333433343334ULL, }, /* 40 */ + { 0x3333333333333333ULL, 0x3333333333333333ULL, }, + { 0x8889888988898889ULL, 0x8889888988898889ULL, }, + { 0xdddedddedddedddeULL, 0xdddedddedddedddeULL, }, + { 0x6667666766676667ULL, 0x6667666766676667ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x4fa5fa50a4fb4fa5ULL, 0xfa50a4fb4fa5fa50ULL, }, + { 0x16c26c17c16c16c2ULL, 0x6c17c16c16c26c17ULL, }, + { 0xe38f38e48e39e38fULL, 0x38e48e39e38f38e4ULL, }, /* 48 */ + { 0xe38e38e38e38e38eULL, 0x38e38e38e38e38e3ULL, }, + { 0x38e48e39e38e38e4ULL, 0x8e39e38e38e48e39ULL, }, + { 0x8e39e38e38e38e39ULL, 0xe38e38e38e39e38eULL, }, + { 0x16c26c17c16c16c2ULL, 0x6c17c16c16c26c17ULL, }, + { 0xb05b05b05b05b05bULL, 0x05b05b05b05b05b0ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0xc71d71c71c71c71dULL, 0x71c71c71c71d71c7ULL, }, + { 0x1c72c71d71c81c72ULL, 0xc71d71c81c72c71dULL, }, /* 56 */ + { 0x1c71c71c71c71c71ULL, 0xc71c71c71c71c71cULL, }, + { 0x71c71c72c71d71c7ULL, 0x1c72c71d71c71c72ULL, }, + { 0xc71c71c71c72c71cULL, 0x71c71c72c71c71c7ULL, }, + { 0x4fa5fa50a4fb4fa5ULL, 0xfa50a4fb4fa5fa50ULL, }, + { 0xe93e93e93e94e93eULL, 0x93e93e94e93e93e9ULL, }, + { 0x38e38e39e38f38e3ULL, 0x8e39e38f38e38e39ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 64 */ + { 0x8cace669dacf8e38ULL, 0x38705044e93c5d10ULL, }, + { 0xdc1038226e93c9c0ULL, 0x238f445f53508af8ULL, }, + { 0x181bd07fca3172f2ULL, 0xbd7682865539cd6cULL, }, + { 0x73541997253171c8ULL, 0xc790afbc16c4a2f0ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x4f6451b993c43b88ULL, 0xeb1ff41b6a142de8ULL, }, + { 0x8b6fea16ef62e4baULL, 0x850632426bfd705cULL, }, + { 0x23f0c7de916d3640ULL, 0xdc71bba1acb07508ULL, }, /* 72 */ + { 0xb09cae476c3cc478ULL, 0x14e10be595ecd218ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x3c0b985d5b9ea932ULL, 0x99e73e2701e94274ULL, }, + { 0xe7e52f8135cf8d0eULL, 0x428a7d7aaac73294ULL, }, + { 0x749115ea109e1b46ULL, 0x7afacdbe94038fa4ULL, }, +}; + + gettimeofday(&start, NULL); + + for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) { + for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) { + do_msa_SUBV_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_SUBV_H(b128_random[i], b128_random[j], + b128_result[((PATTERN_INPUTS_SHORT_COUNT) * + (PATTERN_INPUTS_SHORT_COUNT)) + + RANDOM_INPUTS_SHORT_COUNT * i + j]); + } + } + + gettimeofday(&end, NULL); + + elapsed_time = (end.tv_sec - start.tv_sec) * 1000.0; + elapsed_time += (end.tv_usec - start.tv_usec) / 1000.0; + + ret = check_results(instruction_name, TEST_COUNT_TOTAL, elapsed_time, + &b128_result[0][0], &b128_expect[0][0]); + + return ret; +} diff --git a/tests/tcg/mips/user/ase/msa/int-subtract/test_msa_subv_w.c b/tests/tcg/mips/user/ase/msa/int-subtract/test_msa_subv_w.c new file mode 100644 index 0000000000..3e97005815 --- /dev/null +++ b/tests/tcg/mips/user/ase/msa/int-subtract/test_msa_subv_w.c @@ -0,0 +1,153 @@ +/* + * Test program for MSA instruction SUBV.W + * + * Copyright (C) 2018 Wave Computing, Inc. + * Copyright (C) 2018 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.h" +#include "../../../../include/test_utils.h" + +#define TEST_COUNT_TOTAL ( \ + (PATTERN_INPUTS_SHORT_COUNT) * (PATTERN_INPUTS_SHORT_COUNT) + \ + (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT)) + + +int32_t main(void) +{ + char *instruction_name = "SUBV.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 */ + { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, + { 0x5555555555555555ULL, 0x5555555555555555ULL, }, + { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, }, + { 0x3333333333333333ULL, 0x3333333333333333ULL, }, + { 0xccccccccccccccccULL, 0xccccccccccccccccULL, }, + { 0x1c71c71c71c71c71ULL, 0xc71c71c71c71c71cULL, }, + { 0xe38e38e38e38e38eULL, 0x38e38e38e38e38e3ULL, }, + { 0x0000000100000001ULL, 0x0000000100000001ULL, }, /* 8 */ + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x5555555655555556ULL, 0x5555555655555556ULL, }, + { 0xaaaaaaabaaaaaaabULL, 0xaaaaaaabaaaaaaabULL, }, + { 0x3333333433333334ULL, 0x3333333433333334ULL, }, + { 0xcccccccdcccccccdULL, 0xcccccccdcccccccdULL, }, + { 0x1c71c71d71c71c72ULL, 0xc71c71c81c71c71dULL, }, + { 0xe38e38e48e38e38fULL, 0x38e38e39e38e38e4ULL, }, + { 0xaaaaaaabaaaaaaabULL, 0xaaaaaaabaaaaaaabULL, }, /* 16 */ + { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x5555555555555555ULL, 0x5555555555555555ULL, }, + { 0xdddddddedddddddeULL, 0xdddddddedddddddeULL, }, + { 0x7777777777777777ULL, 0x7777777777777777ULL, }, + { 0xc71c71c71c71c71cULL, 0x71c71c72c71c71c7ULL, }, + { 0x8e38e38e38e38e39ULL, 0xe38e38e38e38e38eULL, }, + { 0x5555555655555556ULL, 0x5555555655555556ULL, }, /* 24 */ + { 0x5555555555555555ULL, 0x5555555555555555ULL, }, + { 0xaaaaaaabaaaaaaabULL, 0xaaaaaaabaaaaaaabULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x8888888988888889ULL, 0x8888888988888889ULL, }, + { 0x2222222222222222ULL, 0x2222222222222222ULL, }, + { 0x71c71c72c71c71c7ULL, 0x1c71c71d71c71c72ULL, }, + { 0x38e38e39e38e38e4ULL, 0x8e38e38e38e38e39ULL, }, + { 0xcccccccdcccccccdULL, 0xcccccccdcccccccdULL, }, /* 32 */ + { 0xccccccccccccccccULL, 0xccccccccccccccccULL, }, + { 0x2222222222222222ULL, 0x2222222222222222ULL, }, + { 0x7777777777777777ULL, 0x7777777777777777ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x9999999999999999ULL, 0x9999999999999999ULL, }, + { 0xe93e93e93e93e93eULL, 0x93e93e94e93e93e9ULL, }, + { 0xb05b05b05b05b05bULL, 0x05b05b05b05b05b0ULL, }, + { 0x3333333433333334ULL, 0x3333333433333334ULL, }, /* 40 */ + { 0x3333333333333333ULL, 0x3333333333333333ULL, }, + { 0x8888888988888889ULL, 0x8888888988888889ULL, }, + { 0xdddddddedddddddeULL, 0xdddddddedddddddeULL, }, + { 0x6666666766666667ULL, 0x6666666766666667ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x4fa4fa50a4fa4fa5ULL, 0xfa4fa4fb4fa4fa50ULL, }, + { 0x16c16c17c16c16c2ULL, 0x6c16c16c16c16c17ULL, }, + { 0xe38e38e48e38e38fULL, 0x38e38e39e38e38e4ULL, }, /* 48 */ + { 0xe38e38e38e38e38eULL, 0x38e38e38e38e38e3ULL, }, + { 0x38e38e39e38e38e4ULL, 0x8e38e38e38e38e39ULL, }, + { 0x8e38e38e38e38e39ULL, 0xe38e38e38e38e38eULL, }, + { 0x16c16c17c16c16c2ULL, 0x6c16c16c16c16c17ULL, }, + { 0xb05b05b05b05b05bULL, 0x05b05b05b05b05b0ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0xc71c71c71c71c71dULL, 0x71c71c71c71c71c7ULL, }, + { 0x1c71c71d71c71c72ULL, 0xc71c71c81c71c71dULL, }, /* 56 */ + { 0x1c71c71c71c71c71ULL, 0xc71c71c71c71c71cULL, }, + { 0x71c71c72c71c71c7ULL, 0x1c71c71d71c71c72ULL, }, + { 0xc71c71c71c71c71cULL, 0x71c71c72c71c71c7ULL, }, + { 0x4fa4fa50a4fa4fa5ULL, 0xfa4fa4fb4fa4fa50ULL, }, + { 0xe93e93e93e93e93eULL, 0x93e93e94e93e93e9ULL, }, + { 0x38e38e39e38e38e3ULL, 0x8e38e38f38e38e39ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 64 */ + { 0x8cace669dace8e38ULL, 0x386f5044e93c5d10ULL, }, + { 0xdc1038226e92c9c0ULL, 0x238e445f53508af8ULL, }, + { 0x181bd07fca3072f2ULL, 0xbd7582865538cd6cULL, }, + { 0x73531997253171c8ULL, 0xc790afbc16c3a2f0ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x4f6351b993c43b88ULL, 0xeb1ef41b6a142de8ULL, }, + { 0x8b6eea16ef61e4baULL, 0x850632426bfc705cULL, }, + { 0x23efc7de916d3640ULL, 0xdc71bba1acaf7508ULL, }, /* 72 */ + { 0xb09cae476c3bc478ULL, 0x14e10be595ebd218ULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, + { 0x3c0b985d5b9da932ULL, 0x99e73e2701e84274ULL, }, + { 0xe7e42f8135cf8d0eULL, 0x428a7d7aaac73294ULL, }, + { 0x749115ea109e1b46ULL, 0x7af9cdbe94038fa4ULL, }, + { 0xc3f467a3a46256ceULL, 0x6618c1d9fe17bd8cULL, }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, }, +}; + + gettimeofday(&start, NULL); + + for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) { + for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) { + do_msa_SUBV_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_SUBV_W(b128_random[i], b128_random[j], + b128_result[((PATTERN_INPUTS_SHORT_COUNT) * + (PATTERN_INPUTS_SHORT_COUNT)) + + RANDOM_INPUTS_SHORT_COUNT * i + j]); + } + } + + gettimeofday(&end, NULL); + + elapsed_time = (end.tv_sec - start.tv_sec) * 1000.0; + elapsed_time += (end.tv_usec - start.tv_usec) / 1000.0; + + ret = check_results(instruction_name, TEST_COUNT_TOTAL, elapsed_time, + &b128_result[0][0], &b128_expect[0][0]); + + return ret; +} diff --git a/tests/tcg/mips/user/ase/msa/interleave/test_msa_ilvev_b.c b/tests/tcg/mips/user/ase/msa/interleave/test_msa_ilvev_b.c index 5cf862756a..d720dc30a5 100644 --- a/tests/tcg/mips/user/ase/msa/interleave/test_msa_ilvev_b.c +++ b/tests/tcg/mips/user/ase/msa/interleave/test_msa_ilvev_b.c @@ -1,8 +1,8 @@ /* * Test program for MSA instruction ILVEV.B * - * Copyright (C) 2018 Wave Computing, Inc. - * Copyright (C) 2018 Aleksandar Markovic <amarkovic@wavecomp.com> + * Copyright (C) 2019 Wave Computing, Inc. + * Copyright (C) 2019 Aleksandar Markovic <amarkovic@wavecomp.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -23,8 +23,8 @@ #include <stdint.h> #include "../../../../include/wrappers_msa.h" -#include "../../../../include/test_inputs.h" -#include "../../../../include/test_utils.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) + \ diff --git a/tests/tcg/mips/user/ase/msa/interleave/test_msa_ilvev_d.c b/tests/tcg/mips/user/ase/msa/interleave/test_msa_ilvev_d.c index d3600e96b4..83239949af 100644 --- a/tests/tcg/mips/user/ase/msa/interleave/test_msa_ilvev_d.c +++ b/tests/tcg/mips/user/ase/msa/interleave/test_msa_ilvev_d.c @@ -1,8 +1,8 @@ /* * Test program for MSA instruction ILVEV.D * - * Copyright (C) 2018 Wave Computing, Inc. - * Copyright (C) 2018 Aleksandar Markovic <amarkovic@wavecomp.com> + * Copyright (C) 2019 Wave Computing, Inc. + * Copyright (C) 2019 Aleksandar Markovic <amarkovic@wavecomp.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -23,8 +23,8 @@ #include <stdint.h> #include "../../../../include/wrappers_msa.h" -#include "../../../../include/test_inputs.h" -#include "../../../../include/test_utils.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) + \ diff --git a/tests/tcg/mips/user/ase/msa/interleave/test_msa_ilvev_h.c b/tests/tcg/mips/user/ase/msa/interleave/test_msa_ilvev_h.c index 9a80fac8eb..3f6fc265d2 100644 --- a/tests/tcg/mips/user/ase/msa/interleave/test_msa_ilvev_h.c +++ b/tests/tcg/mips/user/ase/msa/interleave/test_msa_ilvev_h.c @@ -1,8 +1,8 @@ /* * Test program for MSA instruction ILVEV.H * - * Copyright (C) 2018 Wave Computing, Inc. - * Copyright (C) 2018 Aleksandar Markovic <amarkovic@wavecomp.com> + * Copyright (C) 2019 Wave Computing, Inc. + * Copyright (C) 2019 Aleksandar Markovic <amarkovic@wavecomp.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -23,8 +23,8 @@ #include <stdint.h> #include "../../../../include/wrappers_msa.h" -#include "../../../../include/test_inputs.h" -#include "../../../../include/test_utils.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) + \ diff --git a/tests/tcg/mips/user/ase/msa/interleave/test_msa_ilvev_w.c b/tests/tcg/mips/user/ase/msa/interleave/test_msa_ilvev_w.c index 8f62d4700a..30d2e3802d 100644 --- a/tests/tcg/mips/user/ase/msa/interleave/test_msa_ilvev_w.c +++ b/tests/tcg/mips/user/ase/msa/interleave/test_msa_ilvev_w.c @@ -1,8 +1,8 @@ /* * Test program for MSA instruction ILVEV.W * - * Copyright (C) 2018 Wave Computing, Inc. - * Copyright (C) 2018 Aleksandar Markovic <amarkovic@wavecomp.com> + * Copyright (C) 2019 Wave Computing, Inc. + * Copyright (C) 2019 Aleksandar Markovic <amarkovic@wavecomp.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -23,8 +23,8 @@ #include <stdint.h> #include "../../../../include/wrappers_msa.h" -#include "../../../../include/test_inputs.h" -#include "../../../../include/test_utils.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) + \ diff --git a/tests/tcg/mips/user/ase/msa/interleave/test_msa_ilvl_b.c b/tests/tcg/mips/user/ase/msa/interleave/test_msa_ilvl_b.c index f7e6dc0503..c771287a71 100644 --- a/tests/tcg/mips/user/ase/msa/interleave/test_msa_ilvl_b.c +++ b/tests/tcg/mips/user/ase/msa/interleave/test_msa_ilvl_b.c @@ -1,8 +1,8 @@ /* * Test program for MSA instruction ILVL.B * - * Copyright (C) 2018 Wave Computing, Inc. - * Copyright (C) 2018 Aleksandar Markovic <amarkovic@wavecomp.com> + * Copyright (C) 2019 Wave Computing, Inc. + * Copyright (C) 2019 Aleksandar Markovic <amarkovic@wavecomp.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -23,8 +23,8 @@ #include <stdint.h> #include "../../../../include/wrappers_msa.h" -#include "../../../../include/test_inputs.h" -#include "../../../../include/test_utils.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) + \ diff --git a/tests/tcg/mips/user/ase/msa/interleave/test_msa_ilvl_d.c b/tests/tcg/mips/user/ase/msa/interleave/test_msa_ilvl_d.c index 0f4c048ff6..b7d5fcdc18 100644 --- a/tests/tcg/mips/user/ase/msa/interleave/test_msa_ilvl_d.c +++ b/tests/tcg/mips/user/ase/msa/interleave/test_msa_ilvl_d.c @@ -1,8 +1,8 @@ /* * Test program for MSA instruction ILVL.D * - * Copyright (C) 2018 Wave Computing, Inc. - * Copyright (C) 2018 Aleksandar Markovic <amarkovic@wavecomp.com> + * Copyright (C) 2019 Wave Computing, Inc. + * Copyright (C) 2019 Aleksandar Markovic <amarkovic@wavecomp.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -23,8 +23,8 @@ #include <stdint.h> #include "../../../../include/wrappers_msa.h" -#include "../../../../include/test_inputs.h" -#include "../../../../include/test_utils.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) + \ diff --git a/tests/tcg/mips/user/ase/msa/interleave/test_msa_ilvl_h.c b/tests/tcg/mips/user/ase/msa/interleave/test_msa_ilvl_h.c index 6c1c6d9f36..af72876236 100644 --- a/tests/tcg/mips/user/ase/msa/interleave/test_msa_ilvl_h.c +++ b/tests/tcg/mips/user/ase/msa/interleave/test_msa_ilvl_h.c @@ -1,8 +1,8 @@ /* * Test program for MSA instruction ILVL.H * - * Copyright (C) 2018 Wave Computing, Inc. - * Copyright (C) 2018 Aleksandar Markovic <amarkovic@wavecomp.com> + * Copyright (C) 2019 Wave Computing, Inc. + * Copyright (C) 2019 Aleksandar Markovic <amarkovic@wavecomp.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -23,8 +23,8 @@ #include <stdint.h> #include "../../../../include/wrappers_msa.h" -#include "../../../../include/test_inputs.h" -#include "../../../../include/test_utils.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) + \ diff --git a/tests/tcg/mips/user/ase/msa/interleave/test_msa_ilvl_w.c b/tests/tcg/mips/user/ase/msa/interleave/test_msa_ilvl_w.c index d22d96558d..e06c9d94ca 100644 --- a/tests/tcg/mips/user/ase/msa/interleave/test_msa_ilvl_w.c +++ b/tests/tcg/mips/user/ase/msa/interleave/test_msa_ilvl_w.c @@ -1,8 +1,8 @@ /* * Test program for MSA instruction ILVL.W * - * Copyright (C) 2018 Wave Computing, Inc. - * Copyright (C) 2018 Aleksandar Markovic <amarkovic@wavecomp.com> + * Copyright (C) 2019 Wave Computing, Inc. + * Copyright (C) 2019 Aleksandar Markovic <amarkovic@wavecomp.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -23,8 +23,8 @@ #include <stdint.h> #include "../../../../include/wrappers_msa.h" -#include "../../../../include/test_inputs.h" -#include "../../../../include/test_utils.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) + \ diff --git a/tests/tcg/mips/user/ase/msa/interleave/test_msa_ilvod_b.c b/tests/tcg/mips/user/ase/msa/interleave/test_msa_ilvod_b.c index c55f3a4d7d..8e7f1c4706 100644 --- a/tests/tcg/mips/user/ase/msa/interleave/test_msa_ilvod_b.c +++ b/tests/tcg/mips/user/ase/msa/interleave/test_msa_ilvod_b.c @@ -1,8 +1,8 @@ /* * Test program for MSA instruction ILVOD.B * - * Copyright (C) 2018 Wave Computing, Inc. - * Copyright (C) 2018 Aleksandar Markovic <amarkovic@wavecomp.com> + * Copyright (C) 2019 Wave Computing, Inc. + * Copyright (C) 2019 Aleksandar Markovic <amarkovic@wavecomp.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -23,8 +23,8 @@ #include <stdint.h> #include "../../../../include/wrappers_msa.h" -#include "../../../../include/test_inputs.h" -#include "../../../../include/test_utils.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) + \ diff --git a/tests/tcg/mips/user/ase/msa/interleave/test_msa_ilvod_d.c b/tests/tcg/mips/user/ase/msa/interleave/test_msa_ilvod_d.c index d03e7b4eca..acbd94a68d 100644 --- a/tests/tcg/mips/user/ase/msa/interleave/test_msa_ilvod_d.c +++ b/tests/tcg/mips/user/ase/msa/interleave/test_msa_ilvod_d.c @@ -1,8 +1,8 @@ /* * Test program for MSA instruction ILVOD.D * - * Copyright (C) 2018 Wave Computing, Inc. - * Copyright (C) 2018 Aleksandar Markovic <amarkovic@wavecomp.com> + * Copyright (C) 2019 Wave Computing, Inc. + * Copyright (C) 2019 Aleksandar Markovic <amarkovic@wavecomp.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -23,8 +23,8 @@ #include <stdint.h> #include "../../../../include/wrappers_msa.h" -#include "../../../../include/test_inputs.h" -#include "../../../../include/test_utils.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) + \ diff --git a/tests/tcg/mips/user/ase/msa/interleave/test_msa_ilvod_h.c b/tests/tcg/mips/user/ase/msa/interleave/test_msa_ilvod_h.c index f64d8b5fc9..8a82def407 100644 --- a/tests/tcg/mips/user/ase/msa/interleave/test_msa_ilvod_h.c +++ b/tests/tcg/mips/user/ase/msa/interleave/test_msa_ilvod_h.c @@ -1,8 +1,8 @@ /* * Test program for MSA instruction ILVOD.H * - * Copyright (C) 2018 Wave Computing, Inc. - * Copyright (C) 2018 Aleksandar Markovic <amarkovic@wavecomp.com> + * Copyright (C) 2019 Wave Computing, Inc. + * Copyright (C) 2019 Aleksandar Markovic <amarkovic@wavecomp.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -23,8 +23,8 @@ #include <stdint.h> #include "../../../../include/wrappers_msa.h" -#include "../../../../include/test_inputs.h" -#include "../../../../include/test_utils.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) + \ diff --git a/tests/tcg/mips/user/ase/msa/interleave/test_msa_ilvod_w.c b/tests/tcg/mips/user/ase/msa/interleave/test_msa_ilvod_w.c index 4ae75f85f8..e19170c364 100644 --- a/tests/tcg/mips/user/ase/msa/interleave/test_msa_ilvod_w.c +++ b/tests/tcg/mips/user/ase/msa/interleave/test_msa_ilvod_w.c @@ -1,8 +1,8 @@ /* * Test program for MSA instruction ILVOD.W * - * Copyright (C) 2018 Wave Computing, Inc. - * Copyright (C) 2018 Aleksandar Markovic <amarkovic@wavecomp.com> + * Copyright (C) 2019 Wave Computing, Inc. + * Copyright (C) 2019 Aleksandar Markovic <amarkovic@wavecomp.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -23,8 +23,8 @@ #include <stdint.h> #include "../../../../include/wrappers_msa.h" -#include "../../../../include/test_inputs.h" -#include "../../../../include/test_utils.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) + \ diff --git a/tests/tcg/mips/user/ase/msa/interleave/test_msa_ilvr_b.c b/tests/tcg/mips/user/ase/msa/interleave/test_msa_ilvr_b.c index f2cc7bf414..1e519e6e9e 100644 --- a/tests/tcg/mips/user/ase/msa/interleave/test_msa_ilvr_b.c +++ b/tests/tcg/mips/user/ase/msa/interleave/test_msa_ilvr_b.c @@ -1,8 +1,8 @@ /* * Test program for MSA instruction ILVR.B * - * Copyright (C) 2018 Wave Computing, Inc. - * Copyright (C) 2018 Aleksandar Markovic <amarkovic@wavecomp.com> + * Copyright (C) 2019 Wave Computing, Inc. + * Copyright (C) 2019 Aleksandar Markovic <amarkovic@wavecomp.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -23,8 +23,8 @@ #include <stdint.h> #include "../../../../include/wrappers_msa.h" -#include "../../../../include/test_inputs.h" -#include "../../../../include/test_utils.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) + \ diff --git a/tests/tcg/mips/user/ase/msa/interleave/test_msa_ilvr_d.c b/tests/tcg/mips/user/ase/msa/interleave/test_msa_ilvr_d.c index f5ff947c0b..be760430c7 100644 --- a/tests/tcg/mips/user/ase/msa/interleave/test_msa_ilvr_d.c +++ b/tests/tcg/mips/user/ase/msa/interleave/test_msa_ilvr_d.c @@ -1,8 +1,8 @@ /* * Test program for MSA instruction ILVR.D * - * Copyright (C) 2018 Wave Computing, Inc. - * Copyright (C) 2018 Aleksandar Markovic <amarkovic@wavecomp.com> + * Copyright (C) 2019 Wave Computing, Inc. + * Copyright (C) 2019 Aleksandar Markovic <amarkovic@wavecomp.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -23,8 +23,8 @@ #include <stdint.h> #include "../../../../include/wrappers_msa.h" -#include "../../../../include/test_inputs.h" -#include "../../../../include/test_utils.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) + \ diff --git a/tests/tcg/mips/user/ase/msa/interleave/test_msa_ilvr_h.c b/tests/tcg/mips/user/ase/msa/interleave/test_msa_ilvr_h.c index 5a2986dca6..cbd4685eca 100644 --- a/tests/tcg/mips/user/ase/msa/interleave/test_msa_ilvr_h.c +++ b/tests/tcg/mips/user/ase/msa/interleave/test_msa_ilvr_h.c @@ -1,8 +1,8 @@ /* * Test program for MSA instruction ILVR.H * - * Copyright (C) 2018 Wave Computing, Inc. - * Copyright (C) 2018 Aleksandar Markovic <amarkovic@wavecomp.com> + * Copyright (C) 2019 Wave Computing, Inc. + * Copyright (C) 2019 Aleksandar Markovic <amarkovic@wavecomp.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -23,8 +23,8 @@ #include <stdint.h> #include "../../../../include/wrappers_msa.h" -#include "../../../../include/test_inputs.h" -#include "../../../../include/test_utils.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) + \ diff --git a/tests/tcg/mips/user/ase/msa/interleave/test_msa_ilvr_w.c b/tests/tcg/mips/user/ase/msa/interleave/test_msa_ilvr_w.c index fa0d6ea900..5f4cfd0377 100644 --- a/tests/tcg/mips/user/ase/msa/interleave/test_msa_ilvr_w.c +++ b/tests/tcg/mips/user/ase/msa/interleave/test_msa_ilvr_w.c @@ -1,8 +1,8 @@ /* * Test program for MSA instruction ILVR.W * - * Copyright (C) 2018 Wave Computing, Inc. - * Copyright (C) 2018 Aleksandar Markovic <amarkovic@wavecomp.com> + * Copyright (C) 2019 Wave Computing, Inc. + * Copyright (C) 2019 Aleksandar Markovic <amarkovic@wavecomp.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -23,8 +23,8 @@ #include <stdint.h> #include "../../../../include/wrappers_msa.h" -#include "../../../../include/test_inputs.h" -#include "../../../../include/test_utils.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) + \ diff --git a/tests/tcg/mips/user/ase/msa/logic/test_msa_and_v.c b/tests/tcg/mips/user/ase/msa/logic/test_msa_and_v.c index 51b256fa50..534c4201a8 100644 --- a/tests/tcg/mips/user/ase/msa/logic/test_msa_and_v.c +++ b/tests/tcg/mips/user/ase/msa/logic/test_msa_and_v.c @@ -1,8 +1,8 @@ /* * Test program for MSA instruction AND.V * - * Copyright (C) 2018 Wave Computing, Inc. - * Copyright (C) 2018 Aleksandar Markovic <amarkovic@wavecomp.com> + * Copyright (C) 2019 Wave Computing, Inc. + * Copyright (C) 2019 Aleksandar Markovic <amarkovic@wavecomp.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -23,8 +23,8 @@ #include <stdint.h> #include "../../../../include/wrappers_msa.h" -#include "../../../../include/test_inputs.h" -#include "../../../../include/test_utils.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) + \ diff --git a/tests/tcg/mips/user/ase/msa/logic/test_msa_nor_v.c b/tests/tcg/mips/user/ase/msa/logic/test_msa_nor_v.c index 90ca19843c..f781a8bb9d 100644 --- a/tests/tcg/mips/user/ase/msa/logic/test_msa_nor_v.c +++ b/tests/tcg/mips/user/ase/msa/logic/test_msa_nor_v.c @@ -1,8 +1,8 @@ /* * Test program for MSA instruction NOR.V * - * Copyright (C) 2018 Wave Computing, Inc. - * Copyright (C) 2018 Aleksandar Markovic <amarkovic@wavecomp.com> + * Copyright (C) 2019 Wave Computing, Inc. + * Copyright (C) 2019 Aleksandar Markovic <amarkovic@wavecomp.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -23,8 +23,8 @@ #include <stdint.h> #include "../../../../include/wrappers_msa.h" -#include "../../../../include/test_inputs.h" -#include "../../../../include/test_utils.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) + \ diff --git a/tests/tcg/mips/user/ase/msa/logic/test_msa_or_v.c b/tests/tcg/mips/user/ase/msa/logic/test_msa_or_v.c index 4ad5366dfb..924f216e41 100644 --- a/tests/tcg/mips/user/ase/msa/logic/test_msa_or_v.c +++ b/tests/tcg/mips/user/ase/msa/logic/test_msa_or_v.c @@ -1,8 +1,8 @@ /* * Test program for MSA instruction OR.V * - * Copyright (C) 2018 Wave Computing, Inc. - * Copyright (C) 2018 Aleksandar Markovic <amarkovic@wavecomp.com> + * Copyright (C) 2019 Wave Computing, Inc. + * Copyright (C) 2019 Aleksandar Markovic <amarkovic@wavecomp.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -23,8 +23,8 @@ #include <stdint.h> #include "../../../../include/wrappers_msa.h" -#include "../../../../include/test_inputs.h" -#include "../../../../include/test_utils.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) + \ diff --git a/tests/tcg/mips/user/ase/msa/logic/test_msa_xor_v.c b/tests/tcg/mips/user/ase/msa/logic/test_msa_xor_v.c index 54effeda63..f0442e6577 100644 --- a/tests/tcg/mips/user/ase/msa/logic/test_msa_xor_v.c +++ b/tests/tcg/mips/user/ase/msa/logic/test_msa_xor_v.c @@ -1,8 +1,8 @@ /* * Test program for MSA instruction XOR.V * - * Copyright (C) 2018 Wave Computing, Inc. - * Copyright (C) 2018 Aleksandar Markovic <amarkovic@wavecomp.com> + * Copyright (C) 2019 Wave Computing, Inc. + * Copyright (C) 2019 Aleksandar Markovic <amarkovic@wavecomp.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -23,8 +23,8 @@ #include <stdint.h> #include "../../../../include/wrappers_msa.h" -#include "../../../../include/test_inputs.h" -#include "../../../../include/test_utils.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) + \ diff --git a/tests/tcg/mips/user/ase/msa/pack/test_msa_pckev_b.c b/tests/tcg/mips/user/ase/msa/pack/test_msa_pckev_b.c index d98dd224d7..409773d7f2 100644 --- a/tests/tcg/mips/user/ase/msa/pack/test_msa_pckev_b.c +++ b/tests/tcg/mips/user/ase/msa/pack/test_msa_pckev_b.c @@ -1,8 +1,8 @@ /* * Test program for MSA instruction PCKEV.B * - * Copyright (C) 2018 Wave Computing, Inc. - * Copyright (C) 2018 Aleksandar Markovic <amarkovic@wavecomp.com> + * Copyright (C) 2019 Wave Computing, Inc. + * Copyright (C) 2019 Aleksandar Markovic <amarkovic@wavecomp.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -23,8 +23,8 @@ #include <stdint.h> #include "../../../../include/wrappers_msa.h" -#include "../../../../include/test_inputs.h" -#include "../../../../include/test_utils.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) + \ diff --git a/tests/tcg/mips/user/ase/msa/pack/test_msa_pckev_d.c b/tests/tcg/mips/user/ase/msa/pack/test_msa_pckev_d.c index 543fb6ae5e..8e89716416 100644 --- a/tests/tcg/mips/user/ase/msa/pack/test_msa_pckev_d.c +++ b/tests/tcg/mips/user/ase/msa/pack/test_msa_pckev_d.c @@ -1,8 +1,8 @@ /* * Test program for MSA instruction PCKEV.D * - * Copyright (C) 2018 Wave Computing, Inc. - * Copyright (C) 2018 Aleksandar Markovic <amarkovic@wavecomp.com> + * Copyright (C) 2019 Wave Computing, Inc. + * Copyright (C) 2019 Aleksandar Markovic <amarkovic@wavecomp.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -23,8 +23,8 @@ #include <stdint.h> #include "../../../../include/wrappers_msa.h" -#include "../../../../include/test_inputs.h" -#include "../../../../include/test_utils.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) + \ diff --git a/tests/tcg/mips/user/ase/msa/pack/test_msa_pckev_h.c b/tests/tcg/mips/user/ase/msa/pack/test_msa_pckev_h.c index 64a18c02f0..b389587dfe 100644 --- a/tests/tcg/mips/user/ase/msa/pack/test_msa_pckev_h.c +++ b/tests/tcg/mips/user/ase/msa/pack/test_msa_pckev_h.c @@ -1,8 +1,8 @@ /* * Test program for MSA instruction PCKEV.H * - * Copyright (C) 2018 Wave Computing, Inc. - * Copyright (C) 2018 Aleksandar Markovic <amarkovic@wavecomp.com> + * Copyright (C) 2019 Wave Computing, Inc. + * Copyright (C) 2019 Aleksandar Markovic <amarkovic@wavecomp.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -23,8 +23,8 @@ #include <stdint.h> #include "../../../../include/wrappers_msa.h" -#include "../../../../include/test_inputs.h" -#include "../../../../include/test_utils.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) + \ diff --git a/tests/tcg/mips/user/ase/msa/pack/test_msa_pckev_w.c b/tests/tcg/mips/user/ase/msa/pack/test_msa_pckev_w.c index a0acacdf26..d393ad5066 100644 --- a/tests/tcg/mips/user/ase/msa/pack/test_msa_pckev_w.c +++ b/tests/tcg/mips/user/ase/msa/pack/test_msa_pckev_w.c @@ -1,8 +1,8 @@ /* * Test program for MSA instruction PCKEV.W * - * Copyright (C) 2018 Wave Computing, Inc. - * Copyright (C) 2018 Aleksandar Markovic <amarkovic@wavecomp.com> + * Copyright (C) 2019 Wave Computing, Inc. + * Copyright (C) 2019 Aleksandar Markovic <amarkovic@wavecomp.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -23,8 +23,8 @@ #include <stdint.h> #include "../../../../include/wrappers_msa.h" -#include "../../../../include/test_inputs.h" -#include "../../../../include/test_utils.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) + \ diff --git a/tests/tcg/mips/user/ase/msa/pack/test_msa_pckod_b.c b/tests/tcg/mips/user/ase/msa/pack/test_msa_pckod_b.c index 7bf86fccbd..ab363a0cdc 100644 --- a/tests/tcg/mips/user/ase/msa/pack/test_msa_pckod_b.c +++ b/tests/tcg/mips/user/ase/msa/pack/test_msa_pckod_b.c @@ -1,8 +1,8 @@ /* * Test program for MSA instruction PCKOD.B * - * Copyright (C) 2018 Wave Computing, Inc. - * Copyright (C) 2018 Aleksandar Markovic <amarkovic@wavecomp.com> + * Copyright (C) 2019 Wave Computing, Inc. + * Copyright (C) 2019 Aleksandar Markovic <amarkovic@wavecomp.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -23,8 +23,8 @@ #include <stdint.h> #include "../../../../include/wrappers_msa.h" -#include "../../../../include/test_inputs.h" -#include "../../../../include/test_utils.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) + \ diff --git a/tests/tcg/mips/user/ase/msa/pack/test_msa_pckod_d.c b/tests/tcg/mips/user/ase/msa/pack/test_msa_pckod_d.c index 3c4d55b694..09a61408bc 100644 --- a/tests/tcg/mips/user/ase/msa/pack/test_msa_pckod_d.c +++ b/tests/tcg/mips/user/ase/msa/pack/test_msa_pckod_d.c @@ -1,8 +1,8 @@ /* * Test program for MSA instruction PCKOD.D * - * Copyright (C) 2018 Wave Computing, Inc. - * Copyright (C) 2018 Aleksandar Markovic <amarkovic@wavecomp.com> + * Copyright (C) 2019 Wave Computing, Inc. + * Copyright (C) 2019 Aleksandar Markovic <amarkovic@wavecomp.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -23,8 +23,8 @@ #include <stdint.h> #include "../../../../include/wrappers_msa.h" -#include "../../../../include/test_inputs.h" -#include "../../../../include/test_utils.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) + \ diff --git a/tests/tcg/mips/user/ase/msa/pack/test_msa_pckod_h.c b/tests/tcg/mips/user/ase/msa/pack/test_msa_pckod_h.c index 5c3c529f22..d7a8c5b5af 100644 --- a/tests/tcg/mips/user/ase/msa/pack/test_msa_pckod_h.c +++ b/tests/tcg/mips/user/ase/msa/pack/test_msa_pckod_h.c @@ -1,8 +1,8 @@ /* * Test program for MSA instruction PCKOD.H * - * Copyright (C) 2018 Wave Computing, Inc. - * Copyright (C) 2018 Aleksandar Markovic <amarkovic@wavecomp.com> + * Copyright (C) 2019 Wave Computing, Inc. + * Copyright (C) 2019 Aleksandar Markovic <amarkovic@wavecomp.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -23,8 +23,8 @@ #include <stdint.h> #include "../../../../include/wrappers_msa.h" -#include "../../../../include/test_inputs.h" -#include "../../../../include/test_utils.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) + \ diff --git a/tests/tcg/mips/user/ase/msa/pack/test_msa_pckod_w.c b/tests/tcg/mips/user/ase/msa/pack/test_msa_pckod_w.c index 9275890214..4b732d0359 100644 --- a/tests/tcg/mips/user/ase/msa/pack/test_msa_pckod_w.c +++ b/tests/tcg/mips/user/ase/msa/pack/test_msa_pckod_w.c @@ -1,8 +1,8 @@ /* * Test program for MSA instruction PCKOD.W * - * Copyright (C) 2018 Wave Computing, Inc. - * Copyright (C) 2018 Aleksandar Markovic <amarkovic@wavecomp.com> + * Copyright (C) 2019 Wave Computing, Inc. + * Copyright (C) 2019 Aleksandar Markovic <amarkovic@wavecomp.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -23,8 +23,8 @@ #include <stdint.h> #include "../../../../include/wrappers_msa.h" -#include "../../../../include/test_inputs.h" -#include "../../../../include/test_utils.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) + \ diff --git a/tests/tcg/mips/user/ase/msa/pack/test_msa_vshf_b.c b/tests/tcg/mips/user/ase/msa/pack/test_msa_vshf_b.c index fcf857a6c0..d9ccf575fa 100644 --- a/tests/tcg/mips/user/ase/msa/pack/test_msa_vshf_b.c +++ b/tests/tcg/mips/user/ase/msa/pack/test_msa_vshf_b.c @@ -1,8 +1,8 @@ /* * Test program for MSA instruction VSHF.B * - * Copyright (C) 2018 Wave Computing, Inc. - * Copyright (C) 2018 Aleksandar Markovic <amarkovic@wavecomp.com> + * Copyright (C) 2019 Wave Computing, Inc. + * Copyright (C) 2019 Aleksandar Markovic <amarkovic@wavecomp.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -23,8 +23,8 @@ #include <stdint.h> #include "../../../../include/wrappers_msa.h" -#include "../../../../include/test_inputs.h" -#include "../../../../include/test_utils.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) + \ diff --git a/tests/tcg/mips/user/ase/msa/pack/test_msa_vshf_d.c b/tests/tcg/mips/user/ase/msa/pack/test_msa_vshf_d.c index 700c1596a2..6c555fbb23 100644 --- a/tests/tcg/mips/user/ase/msa/pack/test_msa_vshf_d.c +++ b/tests/tcg/mips/user/ase/msa/pack/test_msa_vshf_d.c @@ -1,8 +1,8 @@ /* * Test program for MSA instruction VSHF.D * - * Copyright (C) 2018 Wave Computing, Inc. - * Copyright (C) 2018 Aleksandar Markovic <amarkovic@wavecomp.com> + * Copyright (C) 2019 Wave Computing, Inc. + * Copyright (C) 2019 Aleksandar Markovic <amarkovic@wavecomp.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -23,8 +23,8 @@ #include <stdint.h> #include "../../../../include/wrappers_msa.h" -#include "../../../../include/test_inputs.h" -#include "../../../../include/test_utils.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) + \ diff --git a/tests/tcg/mips/user/ase/msa/pack/test_msa_vshf_h.c b/tests/tcg/mips/user/ase/msa/pack/test_msa_vshf_h.c index 3d6c1dc5be..9dfcb51fe5 100644 --- a/tests/tcg/mips/user/ase/msa/pack/test_msa_vshf_h.c +++ b/tests/tcg/mips/user/ase/msa/pack/test_msa_vshf_h.c @@ -1,8 +1,8 @@ /* * Test program for MSA instruction VSHF.H * - * Copyright (C) 2018 Wave Computing, Inc. - * Copyright (C) 2018 Aleksandar Markovic <amarkovic@wavecomp.com> + * Copyright (C) 2019 Wave Computing, Inc. + * Copyright (C) 2019 Aleksandar Markovic <amarkovic@wavecomp.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -23,8 +23,8 @@ #include <stdint.h> #include "../../../../include/wrappers_msa.h" -#include "../../../../include/test_inputs.h" -#include "../../../../include/test_utils.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) + \ diff --git a/tests/tcg/mips/user/ase/msa/pack/test_msa_vshf_w.c b/tests/tcg/mips/user/ase/msa/pack/test_msa_vshf_w.c index 6030762855..97074c0924 100644 --- a/tests/tcg/mips/user/ase/msa/pack/test_msa_vshf_w.c +++ b/tests/tcg/mips/user/ase/msa/pack/test_msa_vshf_w.c @@ -1,8 +1,8 @@ /* * Test program for MSA instruction VSHF.W * - * Copyright (C) 2018 Wave Computing, Inc. - * Copyright (C) 2018 Aleksandar Markovic <amarkovic@wavecomp.com> + * Copyright (C) 2019 Wave Computing, Inc. + * Copyright (C) 2019 Aleksandar Markovic <amarkovic@wavecomp.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -23,8 +23,8 @@ #include <stdint.h> #include "../../../../include/wrappers_msa.h" -#include "../../../../include/test_inputs.h" -#include "../../../../include/test_utils.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) + \ @@ -237,6 +237,7 @@ static struct { { .driver = "vmware-svga", .flag = &default_vga }, { .driver = "qxl-vga", .flag = &default_vga }, { .driver = "virtio-vga", .flag = &default_vga }, + { .driver = "ati-vga", .flag = &default_vga }, }; static QemuOptsList qemu_rtc_opts = { |