2002-10-16 21:37:35 +04:00
|
|
|
/////////////////////////////////////////////////////////////////////////
|
2011-02-25 00:54:04 +03:00
|
|
|
// $Id$
|
2005-03-19 23:44:01 +03:00
|
|
|
/////////////////////////////////////////////////////////////////////////
|
2002-10-16 21:37:35 +04:00
|
|
|
//
|
2018-02-16 10:57:32 +03:00
|
|
|
// Copyright (c) 2002-2018 Stanislav Shwartsman
|
2007-03-24 00:27:13 +03:00
|
|
|
// Written by Stanislav Shwartsman [sshwarts at sourceforge net]
|
2002-10-16 21:37:35 +04:00
|
|
|
//
|
|
|
|
// This library is free software; you can redistribute it and/or
|
|
|
|
// modify it under the terms of the GNU Lesser General Public
|
|
|
|
// License as published by the Free Software Foundation; either
|
|
|
|
// version 2 of the License, or (at your option) any later version.
|
|
|
|
//
|
|
|
|
// This library 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
|
|
|
|
// Lesser General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU Lesser General Public
|
|
|
|
// License along with this library; if not, write to the Free Software
|
2009-01-16 21:18:59 +03:00
|
|
|
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA B 02110-1301 USA
|
2002-10-16 21:37:35 +04:00
|
|
|
//
|
2005-03-19 23:44:01 +03:00
|
|
|
/////////////////////////////////////////////////////////////////////////
|
2002-10-16 21:37:35 +04:00
|
|
|
|
2002-09-09 20:11:25 +04:00
|
|
|
#define NEED_CPU_REG_SHORTCUTS 1
|
|
|
|
#include "bochs.h"
|
2006-03-07 01:03:16 +03:00
|
|
|
#include "cpu.h"
|
2002-09-09 20:11:25 +04:00
|
|
|
#define LOG_THIS BX_CPU_THIS_PTR
|
|
|
|
|
2010-03-01 21:53:53 +03:00
|
|
|
#if BX_CPU_LEVEL >= 5
|
2002-09-09 20:11:25 +04:00
|
|
|
|
2003-08-01 13:32:33 +04:00
|
|
|
void BX_CPU_C::print_state_MMX(void)
|
2002-09-09 20:11:25 +04:00
|
|
|
{
|
|
|
|
for(int i=0;i<8;i++) {
|
2008-10-08 14:51:38 +04:00
|
|
|
BxPackedMmxRegister mm = BX_READ_MMX_REG(i);
|
2013-12-02 22:05:18 +04:00
|
|
|
BX_DEBUG(("MM%d: %08x%08x", i, MMXUD1(mm), MMXUD0(mm)));
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2011-06-26 23:15:30 +04:00
|
|
|
#if BX_CPU_LEVEL >= 6
|
|
|
|
|
2006-04-06 22:30:05 +04:00
|
|
|
/* 0F 38 00 */
|
2018-02-16 10:57:32 +03:00
|
|
|
void BX_CPP_AttrRegparmN(1) BX_CPU_C::PSHUFB_PqQq(bxInstruction_c *i)
|
2006-04-06 22:30:05 +04:00
|
|
|
{
|
|
|
|
BX_CPU_THIS_PTR prepareMMX();
|
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BxPackedMmxRegister op1 = BX_READ_MMX_REG(i->dst()), op2, result;
|
2006-04-06 22:30:05 +04:00
|
|
|
|
|
|
|
/* op2 is a register or memory reference */
|
|
|
|
if (i->modC0()) {
|
2012-08-05 17:52:40 +04:00
|
|
|
op2 = BX_READ_MMX_REG(i->src());
|
2006-04-06 22:30:05 +04:00
|
|
|
}
|
|
|
|
else {
|
2015-05-17 00:06:59 +03:00
|
|
|
bx_address eaddr = BX_CPU_RESOLVE_ADDR(i);
|
2006-04-06 22:30:05 +04:00
|
|
|
/* pointer, segment address pair */
|
2008-08-08 13:22:49 +04:00
|
|
|
MMXUQ(op2) = read_virtual_qword(i->seg(), eaddr);
|
2006-04-06 22:30:05 +04:00
|
|
|
}
|
|
|
|
|
2008-10-08 14:51:38 +04:00
|
|
|
BX_CPU_THIS_PTR prepareFPU2MMX(); /* FPU2MMX transition */
|
|
|
|
|
2008-02-03 00:46:54 +03:00
|
|
|
for(unsigned j=0; j<8; j++)
|
2006-04-06 22:30:05 +04:00
|
|
|
{
|
2015-02-24 00:17:33 +03:00
|
|
|
unsigned mask = op2.ubyte(j);
|
2006-04-06 22:30:05 +04:00
|
|
|
if (mask & 0x80)
|
2015-02-24 00:17:33 +03:00
|
|
|
result.ubyte(j) = 0;
|
2006-04-06 22:30:05 +04:00
|
|
|
else
|
2015-02-24 00:17:33 +03:00
|
|
|
result.ubyte(j) = op1.ubyte(mask & 0x7);
|
2006-04-06 22:30:05 +04:00
|
|
|
}
|
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BX_WRITE_MMX_REG(i->dst(), result);
|
2011-07-07 00:01:18 +04:00
|
|
|
|
|
|
|
BX_NEXT_INSTR(i);
|
2006-04-06 22:30:05 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* 0F 38 01 */
|
2018-02-16 10:57:32 +03:00
|
|
|
void BX_CPP_AttrRegparmN(1) BX_CPU_C::PHADDW_PqQq(bxInstruction_c *i)
|
2006-04-06 22:30:05 +04:00
|
|
|
{
|
|
|
|
BX_CPU_THIS_PTR prepareMMX();
|
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BxPackedMmxRegister op1 = BX_READ_MMX_REG(i->dst()), op2;
|
2006-04-06 22:30:05 +04:00
|
|
|
|
|
|
|
/* op2 is a register or memory reference */
|
|
|
|
if (i->modC0()) {
|
2012-08-05 17:52:40 +04:00
|
|
|
op2 = BX_READ_MMX_REG(i->src());
|
2006-04-06 22:30:05 +04:00
|
|
|
}
|
|
|
|
else {
|
2015-05-17 00:06:59 +03:00
|
|
|
bx_address eaddr = BX_CPU_RESOLVE_ADDR(i);
|
2006-04-06 22:30:05 +04:00
|
|
|
/* pointer, segment address pair */
|
2008-08-08 13:22:49 +04:00
|
|
|
MMXUQ(op2) = read_virtual_qword(i->seg(), eaddr);
|
2006-04-06 22:30:05 +04:00
|
|
|
}
|
|
|
|
|
2008-10-08 14:51:38 +04:00
|
|
|
BX_CPU_THIS_PTR prepareFPU2MMX(); /* FPU2MMX transition */
|
|
|
|
|
2011-01-16 23:42:28 +03:00
|
|
|
MMXUW0(op1) = MMXUW0(op1) + MMXUW1(op1);
|
|
|
|
MMXUW1(op1) = MMXUW2(op1) + MMXUW3(op1);
|
|
|
|
MMXUW2(op1) = MMXUW0(op2) + MMXUW1(op2);
|
|
|
|
MMXUW3(op1) = MMXUW2(op2) + MMXUW3(op2);
|
2006-04-06 22:30:05 +04:00
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BX_WRITE_MMX_REG(i->dst(), op1);
|
2011-07-07 00:01:18 +04:00
|
|
|
|
|
|
|
BX_NEXT_INSTR(i);
|
2006-04-06 22:30:05 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* 0F 38 02 */
|
2018-02-16 10:57:32 +03:00
|
|
|
void BX_CPP_AttrRegparmN(1) BX_CPU_C::PHADDD_PqQq(bxInstruction_c *i)
|
2006-04-06 22:30:05 +04:00
|
|
|
{
|
|
|
|
BX_CPU_THIS_PTR prepareMMX();
|
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BxPackedMmxRegister op1 = BX_READ_MMX_REG(i->dst()), op2;
|
2006-04-06 22:30:05 +04:00
|
|
|
|
|
|
|
/* op2 is a register or memory reference */
|
|
|
|
if (i->modC0()) {
|
2012-08-05 17:52:40 +04:00
|
|
|
op2 = BX_READ_MMX_REG(i->src());
|
2006-04-06 22:30:05 +04:00
|
|
|
}
|
|
|
|
else {
|
2015-05-17 00:06:59 +03:00
|
|
|
bx_address eaddr = BX_CPU_RESOLVE_ADDR(i);
|
2006-04-06 22:30:05 +04:00
|
|
|
/* pointer, segment address pair */
|
2008-08-08 13:22:49 +04:00
|
|
|
MMXUQ(op2) = read_virtual_qword(i->seg(), eaddr);
|
2006-04-06 22:30:05 +04:00
|
|
|
}
|
|
|
|
|
2008-10-08 14:51:38 +04:00
|
|
|
BX_CPU_THIS_PTR prepareFPU2MMX(); /* FPU2MMX transition */
|
|
|
|
|
2010-12-25 20:04:36 +03:00
|
|
|
MMXUD0(op1) = MMXUD0(op1) + MMXUD1(op1);
|
|
|
|
MMXUD1(op1) = MMXUD0(op2) + MMXUD1(op2);
|
2006-04-06 22:30:05 +04:00
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BX_WRITE_MMX_REG(i->dst(), op1);
|
2011-07-07 00:01:18 +04:00
|
|
|
|
|
|
|
BX_NEXT_INSTR(i);
|
2006-04-06 22:30:05 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* 0F 38 03 */
|
2018-02-16 10:57:32 +03:00
|
|
|
void BX_CPP_AttrRegparmN(1) BX_CPU_C::PHADDSW_PqQq(bxInstruction_c *i)
|
2006-04-06 22:30:05 +04:00
|
|
|
{
|
|
|
|
BX_CPU_THIS_PTR prepareMMX();
|
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BxPackedMmxRegister op1 = BX_READ_MMX_REG(i->dst()), op2;
|
2006-04-06 22:30:05 +04:00
|
|
|
|
|
|
|
/* op2 is a register or memory reference */
|
|
|
|
if (i->modC0()) {
|
2012-08-05 17:52:40 +04:00
|
|
|
op2 = BX_READ_MMX_REG(i->src());
|
2006-04-06 22:30:05 +04:00
|
|
|
}
|
|
|
|
else {
|
2015-05-17 00:06:59 +03:00
|
|
|
bx_address eaddr = BX_CPU_RESOLVE_ADDR(i);
|
2006-04-06 22:30:05 +04:00
|
|
|
/* pointer, segment address pair */
|
2008-08-08 13:22:49 +04:00
|
|
|
MMXUQ(op2) = read_virtual_qword(i->seg(), eaddr);
|
2006-04-06 22:30:05 +04:00
|
|
|
}
|
|
|
|
|
2008-10-08 14:51:38 +04:00
|
|
|
BX_CPU_THIS_PTR prepareFPU2MMX(); /* FPU2MMX transition */
|
|
|
|
|
2011-01-16 23:42:28 +03:00
|
|
|
MMXSW0(op1) = SaturateDwordSToWordS(Bit32s(MMXSW0(op1)) + Bit32s(MMXSW1(op1)));
|
|
|
|
MMXSW1(op1) = SaturateDwordSToWordS(Bit32s(MMXSW2(op1)) + Bit32s(MMXSW3(op1)));
|
|
|
|
MMXSW2(op1) = SaturateDwordSToWordS(Bit32s(MMXSW0(op2)) + Bit32s(MMXSW1(op2)));
|
|
|
|
MMXSW3(op1) = SaturateDwordSToWordS(Bit32s(MMXSW2(op2)) + Bit32s(MMXSW3(op2)));
|
2006-04-06 22:30:05 +04:00
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BX_WRITE_MMX_REG(i->dst(), op1);
|
2011-07-07 00:01:18 +04:00
|
|
|
|
|
|
|
BX_NEXT_INSTR(i);
|
2006-04-06 22:30:05 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* 0F 38 04 */
|
2018-02-16 10:57:32 +03:00
|
|
|
void BX_CPP_AttrRegparmN(1) BX_CPU_C::PMADDUBSW_PqQq(bxInstruction_c *i)
|
2006-04-06 22:30:05 +04:00
|
|
|
{
|
|
|
|
BX_CPU_THIS_PTR prepareMMX();
|
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BxPackedMmxRegister op1 = BX_READ_MMX_REG(i->dst()), op2;
|
2006-04-06 22:30:05 +04:00
|
|
|
|
|
|
|
/* op2 is a register or memory reference */
|
|
|
|
if (i->modC0()) {
|
2012-08-05 17:52:40 +04:00
|
|
|
op2 = BX_READ_MMX_REG(i->src());
|
2006-04-06 22:30:05 +04:00
|
|
|
}
|
|
|
|
else {
|
2015-05-17 00:06:59 +03:00
|
|
|
bx_address eaddr = BX_CPU_RESOLVE_ADDR(i);
|
2006-04-06 22:30:05 +04:00
|
|
|
/* pointer, segment address pair */
|
2008-08-08 13:22:49 +04:00
|
|
|
MMXUQ(op2) = read_virtual_qword(i->seg(), eaddr);
|
2006-04-06 22:30:05 +04:00
|
|
|
}
|
|
|
|
|
2008-10-08 14:51:38 +04:00
|
|
|
BX_CPU_THIS_PTR prepareFPU2MMX(); /* FPU2MMX transition */
|
|
|
|
|
2006-04-06 22:30:05 +04:00
|
|
|
for(unsigned j=0; j<4; j++)
|
|
|
|
{
|
2015-02-24 00:17:33 +03:00
|
|
|
Bit32s temp = Bit32s(op1.ubyte(j*2+0))*Bit32s(op2.sbyte(j*2)) +
|
|
|
|
Bit32s(op1.ubyte(j*2+1))*Bit32s(op2.sbyte(j*2+1));
|
2006-04-06 22:30:05 +04:00
|
|
|
|
2015-02-24 00:17:33 +03:00
|
|
|
op1.s16(j) = SaturateDwordSToWordS(temp);
|
2006-04-06 22:30:05 +04:00
|
|
|
}
|
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BX_WRITE_MMX_REG(i->dst(), op1);
|
2011-07-07 00:01:18 +04:00
|
|
|
|
|
|
|
BX_NEXT_INSTR(i);
|
2006-04-06 22:30:05 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* 0F 38 05 */
|
2018-02-16 10:57:32 +03:00
|
|
|
void BX_CPP_AttrRegparmN(1) BX_CPU_C::PHSUBSW_PqQq(bxInstruction_c *i)
|
2006-04-06 22:30:05 +04:00
|
|
|
{
|
|
|
|
BX_CPU_THIS_PTR prepareMMX();
|
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BxPackedMmxRegister op1 = BX_READ_MMX_REG(i->dst()), op2;
|
2006-04-06 22:30:05 +04:00
|
|
|
|
|
|
|
/* op2 is a register or memory reference */
|
|
|
|
if (i->modC0()) {
|
2012-08-05 17:52:40 +04:00
|
|
|
op2 = BX_READ_MMX_REG(i->src());
|
2006-04-06 22:30:05 +04:00
|
|
|
}
|
|
|
|
else {
|
2015-05-17 00:06:59 +03:00
|
|
|
bx_address eaddr = BX_CPU_RESOLVE_ADDR(i);
|
2006-04-06 22:30:05 +04:00
|
|
|
/* pointer, segment address pair */
|
2008-08-08 13:22:49 +04:00
|
|
|
MMXUQ(op2) = read_virtual_qword(i->seg(), eaddr);
|
2006-04-06 22:30:05 +04:00
|
|
|
}
|
|
|
|
|
2008-10-08 14:51:38 +04:00
|
|
|
BX_CPU_THIS_PTR prepareFPU2MMX(); /* FPU2MMX transition */
|
|
|
|
|
2011-01-16 23:42:28 +03:00
|
|
|
MMXSW0(op1) = SaturateDwordSToWordS(Bit32s(MMXSW0(op1)) - Bit32s(MMXSW1(op1)));
|
|
|
|
MMXSW1(op1) = SaturateDwordSToWordS(Bit32s(MMXSW2(op1)) - Bit32s(MMXSW3(op1)));
|
|
|
|
MMXSW2(op1) = SaturateDwordSToWordS(Bit32s(MMXSW0(op2)) - Bit32s(MMXSW1(op2)));
|
|
|
|
MMXSW3(op1) = SaturateDwordSToWordS(Bit32s(MMXSW2(op2)) - Bit32s(MMXSW3(op2)));
|
2006-04-06 22:30:05 +04:00
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BX_WRITE_MMX_REG(i->dst(), op1);
|
2011-07-07 00:01:18 +04:00
|
|
|
|
|
|
|
BX_NEXT_INSTR(i);
|
2006-04-06 22:30:05 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* 0F 38 05 */
|
2018-02-16 10:57:32 +03:00
|
|
|
void BX_CPP_AttrRegparmN(1) BX_CPU_C::PHSUBW_PqQq(bxInstruction_c *i)
|
2006-04-06 22:30:05 +04:00
|
|
|
{
|
|
|
|
BX_CPU_THIS_PTR prepareMMX();
|
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BxPackedMmxRegister op1 = BX_READ_MMX_REG(i->dst()), op2;
|
2006-04-06 22:30:05 +04:00
|
|
|
|
|
|
|
/* op2 is a register or memory reference */
|
|
|
|
if (i->modC0()) {
|
2012-08-05 17:52:40 +04:00
|
|
|
op2 = BX_READ_MMX_REG(i->src());
|
2006-04-06 22:30:05 +04:00
|
|
|
}
|
|
|
|
else {
|
2015-05-17 00:06:59 +03:00
|
|
|
bx_address eaddr = BX_CPU_RESOLVE_ADDR(i);
|
2006-04-06 22:30:05 +04:00
|
|
|
/* pointer, segment address pair */
|
2008-08-08 13:22:49 +04:00
|
|
|
MMXUQ(op2) = read_virtual_qword(i->seg(), eaddr);
|
2006-04-06 22:30:05 +04:00
|
|
|
}
|
|
|
|
|
2008-10-08 14:51:38 +04:00
|
|
|
BX_CPU_THIS_PTR prepareFPU2MMX(); /* FPU2MMX transition */
|
|
|
|
|
2011-01-16 23:42:28 +03:00
|
|
|
MMXUW0(op1) = MMXUW0(op1) - MMXUW1(op1);
|
|
|
|
MMXUW1(op1) = MMXUW2(op1) - MMXUW3(op1);
|
|
|
|
MMXUW2(op1) = MMXUW0(op2) - MMXUW1(op2);
|
|
|
|
MMXUW3(op1) = MMXUW2(op2) - MMXUW3(op2);
|
2006-04-06 22:30:05 +04:00
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BX_WRITE_MMX_REG(i->dst(), op1);
|
2011-07-07 00:01:18 +04:00
|
|
|
|
|
|
|
BX_NEXT_INSTR(i);
|
2006-04-06 22:30:05 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* 0F 38 06 */
|
2018-02-16 10:57:32 +03:00
|
|
|
void BX_CPP_AttrRegparmN(1) BX_CPU_C::PHSUBD_PqQq(bxInstruction_c *i)
|
2006-04-06 22:30:05 +04:00
|
|
|
{
|
|
|
|
BX_CPU_THIS_PTR prepareMMX();
|
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BxPackedMmxRegister op1 = BX_READ_MMX_REG(i->dst()), op2;
|
2006-04-06 22:30:05 +04:00
|
|
|
|
|
|
|
/* op2 is a register or memory reference */
|
|
|
|
if (i->modC0()) {
|
2012-08-05 17:52:40 +04:00
|
|
|
op2 = BX_READ_MMX_REG(i->src());
|
2006-04-06 22:30:05 +04:00
|
|
|
}
|
|
|
|
else {
|
2015-05-17 00:06:59 +03:00
|
|
|
bx_address eaddr = BX_CPU_RESOLVE_ADDR(i);
|
2006-04-06 22:30:05 +04:00
|
|
|
/* pointer, segment address pair */
|
2008-08-08 13:22:49 +04:00
|
|
|
MMXUQ(op2) = read_virtual_qword(i->seg(), eaddr);
|
2006-04-06 22:30:05 +04:00
|
|
|
}
|
|
|
|
|
2008-10-08 14:51:38 +04:00
|
|
|
BX_CPU_THIS_PTR prepareFPU2MMX(); /* FPU2MMX transition */
|
|
|
|
|
2011-01-16 23:42:28 +03:00
|
|
|
MMXUD0(op1) = MMXUD0(op1) - MMXUD1(op1);
|
|
|
|
MMXUD1(op1) = MMXUD0(op2) - MMXUD1(op2);
|
2006-04-06 22:30:05 +04:00
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BX_WRITE_MMX_REG(i->dst(), op1);
|
2011-07-07 00:01:18 +04:00
|
|
|
|
|
|
|
BX_NEXT_INSTR(i);
|
2006-04-06 22:30:05 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* 0F 38 08 */
|
2018-02-16 10:57:32 +03:00
|
|
|
void BX_CPP_AttrRegparmN(1) BX_CPU_C::PSIGNB_PqQq(bxInstruction_c *i)
|
2006-04-06 22:30:05 +04:00
|
|
|
{
|
|
|
|
BX_CPU_THIS_PTR prepareMMX();
|
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BxPackedMmxRegister op1 = BX_READ_MMX_REG(i->dst()), op2;
|
2006-04-06 22:30:05 +04:00
|
|
|
|
|
|
|
/* op2 is a register or memory reference */
|
|
|
|
if (i->modC0()) {
|
2012-08-05 17:52:40 +04:00
|
|
|
op2 = BX_READ_MMX_REG(i->src());
|
2006-04-06 22:30:05 +04:00
|
|
|
}
|
|
|
|
else {
|
2015-05-17 00:06:59 +03:00
|
|
|
bx_address eaddr = BX_CPU_RESOLVE_ADDR(i);
|
2006-04-06 22:30:05 +04:00
|
|
|
/* pointer, segment address pair */
|
2008-08-08 13:22:49 +04:00
|
|
|
MMXUQ(op2) = read_virtual_qword(i->seg(), eaddr);
|
2006-04-06 22:30:05 +04:00
|
|
|
}
|
|
|
|
|
2008-10-08 14:51:38 +04:00
|
|
|
BX_CPU_THIS_PTR prepareFPU2MMX(); /* FPU2MMX transition */
|
|
|
|
|
2006-04-06 22:30:05 +04:00
|
|
|
for(unsigned j=0; j<8; j++) {
|
2015-02-24 00:17:33 +03:00
|
|
|
int sign = (op2.sbyte(j) > 0) - (op2.sbyte(j) < 0);
|
|
|
|
op1.sbyte(j) *= sign;
|
2006-04-06 22:30:05 +04:00
|
|
|
}
|
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BX_WRITE_MMX_REG(i->dst(), op1);
|
2011-07-07 00:01:18 +04:00
|
|
|
|
|
|
|
BX_NEXT_INSTR(i);
|
2006-04-06 22:30:05 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* 0F 38 09 */
|
2018-02-16 10:57:32 +03:00
|
|
|
void BX_CPP_AttrRegparmN(1) BX_CPU_C::PSIGNW_PqQq(bxInstruction_c *i)
|
2006-04-06 22:30:05 +04:00
|
|
|
{
|
|
|
|
BX_CPU_THIS_PTR prepareMMX();
|
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BxPackedMmxRegister op1 = BX_READ_MMX_REG(i->dst()), op2;
|
2006-04-06 22:30:05 +04:00
|
|
|
|
|
|
|
/* op2 is a register or memory reference */
|
|
|
|
if (i->modC0()) {
|
2012-08-05 17:52:40 +04:00
|
|
|
op2 = BX_READ_MMX_REG(i->src());
|
2006-04-06 22:30:05 +04:00
|
|
|
}
|
|
|
|
else {
|
2015-05-17 00:06:59 +03:00
|
|
|
bx_address eaddr = BX_CPU_RESOLVE_ADDR(i);
|
2006-04-06 22:30:05 +04:00
|
|
|
/* pointer, segment address pair */
|
2008-08-08 13:22:49 +04:00
|
|
|
MMXUQ(op2) = read_virtual_qword(i->seg(), eaddr);
|
2006-04-06 22:30:05 +04:00
|
|
|
}
|
|
|
|
|
2008-10-08 14:51:38 +04:00
|
|
|
BX_CPU_THIS_PTR prepareFPU2MMX(); /* FPU2MMX transition */
|
|
|
|
|
2006-04-06 22:30:05 +04:00
|
|
|
for(unsigned j=0; j<4; j++) {
|
2015-02-24 00:17:33 +03:00
|
|
|
int sign = (op2.s16(j) > 0) - (op2.s16(j) < 0);
|
|
|
|
op1.s16(j) *= sign;
|
2006-04-06 22:30:05 +04:00
|
|
|
}
|
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BX_WRITE_MMX_REG(i->dst(), op1);
|
2011-07-07 00:01:18 +04:00
|
|
|
|
|
|
|
BX_NEXT_INSTR(i);
|
2006-04-06 22:30:05 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* 0F 38 0A */
|
2018-02-16 10:57:32 +03:00
|
|
|
void BX_CPP_AttrRegparmN(1) BX_CPU_C::PSIGND_PqQq(bxInstruction_c *i)
|
2006-04-06 22:30:05 +04:00
|
|
|
{
|
|
|
|
BX_CPU_THIS_PTR prepareMMX();
|
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BxPackedMmxRegister op1 = BX_READ_MMX_REG(i->dst()), op2;
|
2006-04-06 22:30:05 +04:00
|
|
|
|
|
|
|
/* op2 is a register or memory reference */
|
|
|
|
if (i->modC0()) {
|
2012-08-05 17:52:40 +04:00
|
|
|
op2 = BX_READ_MMX_REG(i->src());
|
2006-04-06 22:30:05 +04:00
|
|
|
}
|
|
|
|
else {
|
2015-05-17 00:06:59 +03:00
|
|
|
bx_address eaddr = BX_CPU_RESOLVE_ADDR(i);
|
2006-04-06 22:30:05 +04:00
|
|
|
/* pointer, segment address pair */
|
2008-08-08 13:22:49 +04:00
|
|
|
MMXUQ(op2) = read_virtual_qword(i->seg(), eaddr);
|
2006-04-06 22:30:05 +04:00
|
|
|
}
|
|
|
|
|
2008-10-08 14:51:38 +04:00
|
|
|
BX_CPU_THIS_PTR prepareFPU2MMX(); /* FPU2MMX transition */
|
|
|
|
|
2006-04-06 22:30:05 +04:00
|
|
|
int sign;
|
2008-02-03 00:46:54 +03:00
|
|
|
|
2006-04-06 22:30:05 +04:00
|
|
|
sign = (MMXSD0(op2) > 0) - (MMXSD0(op2) < 0);
|
|
|
|
MMXSD0(op1) *= sign;
|
|
|
|
sign = (MMXSD1(op2) > 0) - (MMXSD1(op2) < 0);
|
|
|
|
MMXSD1(op1) *= sign;
|
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BX_WRITE_MMX_REG(i->dst(), op1);
|
2011-07-07 00:01:18 +04:00
|
|
|
|
|
|
|
BX_NEXT_INSTR(i);
|
2006-04-06 22:30:05 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* 0F 38 0B */
|
2018-02-16 10:57:32 +03:00
|
|
|
void BX_CPP_AttrRegparmN(1) BX_CPU_C::PMULHRSW_PqQq(bxInstruction_c *i)
|
2006-04-06 22:30:05 +04:00
|
|
|
{
|
|
|
|
BX_CPU_THIS_PTR prepareMMX();
|
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BxPackedMmxRegister op1 = BX_READ_MMX_REG(i->dst()), op2;
|
2006-04-06 22:30:05 +04:00
|
|
|
|
|
|
|
/* op2 is a register or memory reference */
|
|
|
|
if (i->modC0()) {
|
2012-08-05 17:52:40 +04:00
|
|
|
op2 = BX_READ_MMX_REG(i->src());
|
2006-04-06 22:30:05 +04:00
|
|
|
}
|
|
|
|
else {
|
2015-05-17 00:06:59 +03:00
|
|
|
bx_address eaddr = BX_CPU_RESOLVE_ADDR(i);
|
2006-04-06 22:30:05 +04:00
|
|
|
/* pointer, segment address pair */
|
2008-08-08 13:22:49 +04:00
|
|
|
MMXUQ(op2) = read_virtual_qword(i->seg(), eaddr);
|
2006-04-06 22:30:05 +04:00
|
|
|
}
|
|
|
|
|
2008-10-08 14:51:38 +04:00
|
|
|
BX_CPU_THIS_PTR prepareFPU2MMX(); /* FPU2MMX transition */
|
|
|
|
|
2010-12-25 20:04:36 +03:00
|
|
|
MMXUW0(op1) = (((MMXSW0(op1) * MMXSW0(op2)) >> 14) + 1) >> 1;
|
|
|
|
MMXUW1(op1) = (((MMXSW1(op1) * MMXSW1(op2)) >> 14) + 1) >> 1;
|
|
|
|
MMXUW2(op1) = (((MMXSW2(op1) * MMXSW2(op2)) >> 14) + 1) >> 1;
|
|
|
|
MMXUW3(op1) = (((MMXSW3(op1) * MMXSW3(op2)) >> 14) + 1) >> 1;
|
2006-04-06 22:30:05 +04:00
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BX_WRITE_MMX_REG(i->dst(), op1);
|
2011-07-07 00:01:18 +04:00
|
|
|
|
|
|
|
BX_NEXT_INSTR(i);
|
2006-04-06 22:30:05 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* 0F 38 1C */
|
2018-02-16 10:57:32 +03:00
|
|
|
void BX_CPP_AttrRegparmN(1) BX_CPU_C::PABSB_PqQq(bxInstruction_c *i)
|
2006-04-06 22:30:05 +04:00
|
|
|
{
|
|
|
|
BX_CPU_THIS_PTR prepareMMX();
|
|
|
|
|
|
|
|
BxPackedMmxRegister op;
|
|
|
|
|
|
|
|
if (i->modC0()) {
|
2012-08-05 17:52:40 +04:00
|
|
|
op = BX_READ_MMX_REG(i->src());
|
2006-04-06 22:30:05 +04:00
|
|
|
}
|
|
|
|
else {
|
2015-05-17 00:06:59 +03:00
|
|
|
bx_address eaddr = BX_CPU_RESOLVE_ADDR(i);
|
2006-04-06 22:30:05 +04:00
|
|
|
/* pointer, segment address pair */
|
2008-08-08 13:22:49 +04:00
|
|
|
MMXUQ(op) = read_virtual_qword(i->seg(), eaddr);
|
2006-04-06 22:30:05 +04:00
|
|
|
}
|
|
|
|
|
2008-10-08 14:51:38 +04:00
|
|
|
BX_CPU_THIS_PTR prepareFPU2MMX(); /* FPU2MMX transition */
|
|
|
|
|
2006-04-06 22:30:05 +04:00
|
|
|
if (MMXSB0(op) < 0) MMXUB0(op) = -MMXSB0(op);
|
|
|
|
if (MMXSB1(op) < 0) MMXUB1(op) = -MMXSB1(op);
|
|
|
|
if (MMXSB2(op) < 0) MMXUB2(op) = -MMXSB2(op);
|
|
|
|
if (MMXSB3(op) < 0) MMXUB3(op) = -MMXSB3(op);
|
|
|
|
if (MMXSB4(op) < 0) MMXUB4(op) = -MMXSB4(op);
|
|
|
|
if (MMXSB5(op) < 0) MMXUB5(op) = -MMXSB5(op);
|
|
|
|
if (MMXSB6(op) < 0) MMXUB6(op) = -MMXSB6(op);
|
|
|
|
if (MMXSB7(op) < 0) MMXUB7(op) = -MMXSB7(op);
|
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BX_WRITE_MMX_REG(i->dst(), op);
|
2011-07-07 00:01:18 +04:00
|
|
|
|
|
|
|
BX_NEXT_INSTR(i);
|
2006-04-06 22:30:05 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* 0F 38 1D */
|
2018-02-16 10:57:32 +03:00
|
|
|
void BX_CPP_AttrRegparmN(1) BX_CPU_C::PABSW_PqQq(bxInstruction_c *i)
|
2006-04-06 22:30:05 +04:00
|
|
|
{
|
|
|
|
BX_CPU_THIS_PTR prepareMMX();
|
|
|
|
|
|
|
|
BxPackedMmxRegister op;
|
|
|
|
|
|
|
|
if (i->modC0()) {
|
2012-08-05 17:52:40 +04:00
|
|
|
op = BX_READ_MMX_REG(i->src());
|
2006-04-06 22:30:05 +04:00
|
|
|
}
|
|
|
|
else {
|
2015-05-17 00:06:59 +03:00
|
|
|
bx_address eaddr = BX_CPU_RESOLVE_ADDR(i);
|
2006-04-06 22:30:05 +04:00
|
|
|
/* pointer, segment address pair */
|
2008-08-08 13:22:49 +04:00
|
|
|
MMXUQ(op) = read_virtual_qword(i->seg(), eaddr);
|
2006-04-06 22:30:05 +04:00
|
|
|
}
|
|
|
|
|
2008-10-08 14:51:38 +04:00
|
|
|
BX_CPU_THIS_PTR prepareFPU2MMX(); /* FPU2MMX transition */
|
|
|
|
|
2006-04-06 22:30:05 +04:00
|
|
|
if (MMXSW0(op) < 0) MMXUW0(op) = -MMXSW0(op);
|
|
|
|
if (MMXSW1(op) < 0) MMXUW1(op) = -MMXSW1(op);
|
|
|
|
if (MMXSW2(op) < 0) MMXUW2(op) = -MMXSW2(op);
|
|
|
|
if (MMXSW3(op) < 0) MMXUW3(op) = -MMXSW3(op);
|
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BX_WRITE_MMX_REG(i->dst(), op);
|
2011-07-07 00:01:18 +04:00
|
|
|
|
|
|
|
BX_NEXT_INSTR(i);
|
2006-04-06 22:30:05 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* 0F 38 1E */
|
2018-02-16 10:57:32 +03:00
|
|
|
void BX_CPP_AttrRegparmN(1) BX_CPU_C::PABSD_PqQq(bxInstruction_c *i)
|
2006-04-06 22:30:05 +04:00
|
|
|
{
|
|
|
|
BX_CPU_THIS_PTR prepareMMX();
|
|
|
|
|
|
|
|
BxPackedMmxRegister op;
|
|
|
|
|
|
|
|
if (i->modC0()) {
|
2012-08-05 17:52:40 +04:00
|
|
|
op = BX_READ_MMX_REG(i->src());
|
2006-04-06 22:30:05 +04:00
|
|
|
}
|
|
|
|
else {
|
2015-05-17 00:06:59 +03:00
|
|
|
bx_address eaddr = BX_CPU_RESOLVE_ADDR(i);
|
2006-04-06 22:30:05 +04:00
|
|
|
/* pointer, segment address pair */
|
2008-08-08 13:22:49 +04:00
|
|
|
MMXUQ(op) = read_virtual_qword(i->seg(), eaddr);
|
2006-04-06 22:30:05 +04:00
|
|
|
}
|
|
|
|
|
2008-10-08 14:51:38 +04:00
|
|
|
BX_CPU_THIS_PTR prepareFPU2MMX(); /* FPU2MMX transition */
|
|
|
|
|
2006-04-06 22:30:05 +04:00
|
|
|
if (MMXSD0(op) < 0) MMXUD0(op) = -MMXSD0(op);
|
|
|
|
if (MMXSD1(op) < 0) MMXUD1(op) = -MMXSD1(op);
|
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BX_WRITE_MMX_REG(i->dst(), op);
|
2011-07-07 00:01:18 +04:00
|
|
|
|
|
|
|
BX_NEXT_INSTR(i);
|
2006-04-06 22:30:05 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* 0F 3A 0F */
|
2018-02-16 10:57:32 +03:00
|
|
|
void BX_CPP_AttrRegparmN(1) BX_CPU_C::PALIGNR_PqQqIb(bxInstruction_c *i)
|
2006-04-06 22:30:05 +04:00
|
|
|
{
|
|
|
|
BX_CPU_THIS_PTR prepareMMX();
|
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BxPackedMmxRegister op1 = BX_READ_MMX_REG(i->dst()), op2;
|
2006-04-06 22:30:05 +04:00
|
|
|
|
|
|
|
/* op2 is a register or memory reference */
|
|
|
|
if (i->modC0()) {
|
2012-08-05 17:52:40 +04:00
|
|
|
op2 = BX_READ_MMX_REG(i->src());
|
2006-04-06 22:30:05 +04:00
|
|
|
}
|
|
|
|
else {
|
2015-05-17 00:06:59 +03:00
|
|
|
bx_address eaddr = BX_CPU_RESOLVE_ADDR(i);
|
2006-04-06 22:30:05 +04:00
|
|
|
/* pointer, segment address pair */
|
2008-08-08 13:22:49 +04:00
|
|
|
MMXUQ(op2) = read_virtual_qword(i->seg(), eaddr);
|
2006-04-06 22:30:05 +04:00
|
|
|
}
|
|
|
|
|
2008-10-08 14:51:38 +04:00
|
|
|
BX_CPU_THIS_PTR prepareFPU2MMX(); /* FPU2MMX transition */
|
|
|
|
|
2006-05-16 20:20:26 +04:00
|
|
|
unsigned shift = i->Ib() * 8;
|
2006-04-06 22:30:05 +04:00
|
|
|
|
|
|
|
if(shift == 0)
|
2010-12-25 20:04:36 +03:00
|
|
|
MMXUQ(op1) = MMXUQ(op2);
|
2006-04-06 22:30:05 +04:00
|
|
|
else if(shift < 64)
|
2010-12-25 20:04:36 +03:00
|
|
|
MMXUQ(op1) = (MMXUQ(op2) >> shift) | (MMXUQ(op1) << (64-shift));
|
2006-04-06 22:30:05 +04:00
|
|
|
else if(shift < 128)
|
2010-12-25 20:04:36 +03:00
|
|
|
MMXUQ(op1) = MMXUQ(op1) >> (shift-64);
|
2006-04-06 22:30:05 +04:00
|
|
|
else
|
2010-12-25 20:04:36 +03:00
|
|
|
MMXUQ(op1) = 0;
|
2006-04-06 22:30:05 +04:00
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BX_WRITE_MMX_REG(i->dst(), op1);
|
2011-07-07 00:01:18 +04:00
|
|
|
|
|
|
|
BX_NEXT_INSTR(i);
|
2006-04-06 22:30:05 +04:00
|
|
|
}
|
|
|
|
|
2011-06-26 23:15:30 +04:00
|
|
|
#endif
|
|
|
|
|
2002-09-09 20:11:25 +04:00
|
|
|
/* 0F 60 */
|
2018-02-16 10:57:32 +03:00
|
|
|
void BX_CPP_AttrRegparmN(1) BX_CPU_C::PUNPCKLBW_PqQd(bxInstruction_c *i)
|
2002-09-09 20:11:25 +04:00
|
|
|
{
|
2010-03-01 21:53:53 +03:00
|
|
|
#if BX_CPU_LEVEL >= 5
|
2002-10-16 21:37:35 +04:00
|
|
|
BX_CPU_THIS_PTR prepareMMX();
|
2002-09-09 20:11:25 +04:00
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BxPackedMmxRegister op1 = BX_READ_MMX_REG(i->dst()), op2;
|
2002-09-09 20:11:25 +04:00
|
|
|
|
|
|
|
/* op2 is a register or memory reference */
|
2002-09-20 07:52:59 +04:00
|
|
|
if (i->modC0()) {
|
2012-08-05 17:52:40 +04:00
|
|
|
op2 = BX_READ_MMX_REG(i->src());
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
else {
|
2015-05-17 00:06:59 +03:00
|
|
|
bx_address eaddr = BX_CPU_RESOLVE_ADDR(i);
|
2002-09-09 20:11:25 +04:00
|
|
|
/* pointer, segment address pair */
|
2012-08-09 17:11:25 +04:00
|
|
|
MMXUQ(op2) = read_virtual_dword(i->seg(), eaddr);
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
|
2008-10-08 14:51:38 +04:00
|
|
|
BX_CPU_THIS_PTR prepareFPU2MMX(); /* FPU2MMX transition */
|
|
|
|
|
2011-01-25 23:59:26 +03:00
|
|
|
MMXUB7(op1) = MMXUB3(op2);
|
|
|
|
MMXUB6(op1) = MMXUB3(op1);
|
|
|
|
MMXUB5(op1) = MMXUB2(op2);
|
|
|
|
MMXUB4(op1) = MMXUB2(op1);
|
|
|
|
MMXUB3(op1) = MMXUB1(op2);
|
|
|
|
MMXUB2(op1) = MMXUB1(op1);
|
|
|
|
MMXUB1(op1) = MMXUB0(op2);
|
|
|
|
//MMXUB0(op1) = MMXUB0(op1);
|
2002-09-09 20:11:25 +04:00
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BX_WRITE_MMX_REG(i->dst(), op1);
|
2010-02-26 14:44:50 +03:00
|
|
|
#endif
|
2011-07-07 00:01:18 +04:00
|
|
|
|
|
|
|
BX_NEXT_INSTR(i);
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* 0F 61 */
|
2018-02-16 10:57:32 +03:00
|
|
|
void BX_CPP_AttrRegparmN(1) BX_CPU_C::PUNPCKLWD_PqQd(bxInstruction_c *i)
|
2002-09-09 20:11:25 +04:00
|
|
|
{
|
2010-03-01 21:53:53 +03:00
|
|
|
#if BX_CPU_LEVEL >= 5
|
2002-10-16 21:37:35 +04:00
|
|
|
BX_CPU_THIS_PTR prepareMMX();
|
2002-09-09 20:11:25 +04:00
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BxPackedMmxRegister op1 = BX_READ_MMX_REG(i->dst()), op2;
|
2002-09-09 20:11:25 +04:00
|
|
|
|
|
|
|
/* op2 is a register or memory reference */
|
2002-09-20 07:52:59 +04:00
|
|
|
if (i->modC0()) {
|
2012-08-05 17:52:40 +04:00
|
|
|
op2 = BX_READ_MMX_REG(i->src());
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
else {
|
2015-05-17 00:06:59 +03:00
|
|
|
bx_address eaddr = BX_CPU_RESOLVE_ADDR(i);
|
2002-09-09 20:11:25 +04:00
|
|
|
/* pointer, segment address pair */
|
2012-08-09 17:11:25 +04:00
|
|
|
MMXUQ(op2) = read_virtual_dword(i->seg(), eaddr);
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
|
2008-10-08 14:51:38 +04:00
|
|
|
BX_CPU_THIS_PTR prepareFPU2MMX(); /* FPU2MMX transition */
|
|
|
|
|
2011-01-25 23:59:26 +03:00
|
|
|
MMXUW3(op1) = MMXUW1(op2);
|
|
|
|
MMXUW2(op1) = MMXUW1(op1);
|
|
|
|
MMXUW1(op1) = MMXUW0(op2);
|
|
|
|
//MMXUW0(op1) = MMXUW0(op1);
|
2002-09-09 20:11:25 +04:00
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BX_WRITE_MMX_REG(i->dst(), op1);
|
2010-02-26 14:44:50 +03:00
|
|
|
#endif
|
2011-07-07 00:01:18 +04:00
|
|
|
|
|
|
|
BX_NEXT_INSTR(i);
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* 0F 62 */
|
2018-02-16 10:57:32 +03:00
|
|
|
void BX_CPP_AttrRegparmN(1) BX_CPU_C::PUNPCKLDQ_PqQd(bxInstruction_c *i)
|
2002-09-09 20:11:25 +04:00
|
|
|
{
|
2010-03-01 21:53:53 +03:00
|
|
|
#if BX_CPU_LEVEL >= 5
|
2002-10-16 21:37:35 +04:00
|
|
|
BX_CPU_THIS_PTR prepareMMX();
|
2002-09-09 20:11:25 +04:00
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BxPackedMmxRegister op1 = BX_READ_MMX_REG(i->dst()), op2;
|
2002-09-09 20:11:25 +04:00
|
|
|
|
|
|
|
/* op2 is a register or memory reference */
|
2002-09-20 07:52:59 +04:00
|
|
|
if (i->modC0()) {
|
2012-08-05 17:52:40 +04:00
|
|
|
op2 = BX_READ_MMX_REG(i->src());
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
else {
|
2015-05-17 00:06:59 +03:00
|
|
|
bx_address eaddr = BX_CPU_RESOLVE_ADDR(i);
|
2002-09-09 20:11:25 +04:00
|
|
|
/* pointer, segment address pair */
|
2012-08-09 17:11:25 +04:00
|
|
|
MMXUQ(op2) = read_virtual_dword(i->seg(), eaddr);
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
|
2008-10-08 14:51:38 +04:00
|
|
|
BX_CPU_THIS_PTR prepareFPU2MMX(); /* FPU2MMX transition */
|
|
|
|
|
2002-12-28 22:06:29 +03:00
|
|
|
MMXUD1(op1) = MMXUD0(op2);
|
2002-09-09 20:11:25 +04:00
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BX_WRITE_MMX_REG(i->dst(), op1);
|
2010-02-26 14:44:50 +03:00
|
|
|
#endif
|
2011-07-07 00:01:18 +04:00
|
|
|
|
|
|
|
BX_NEXT_INSTR(i);
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* 0F 63 */
|
2018-02-16 10:57:32 +03:00
|
|
|
void BX_CPP_AttrRegparmN(1) BX_CPU_C::PACKSSWB_PqQq(bxInstruction_c *i)
|
2002-09-09 20:11:25 +04:00
|
|
|
{
|
2010-03-01 21:53:53 +03:00
|
|
|
#if BX_CPU_LEVEL >= 5
|
2002-10-16 21:37:35 +04:00
|
|
|
BX_CPU_THIS_PTR prepareMMX();
|
2002-09-09 20:11:25 +04:00
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BxPackedMmxRegister op1 = BX_READ_MMX_REG(i->dst()), op2;
|
2002-09-09 20:11:25 +04:00
|
|
|
|
|
|
|
/* op2 is a register or memory reference */
|
2002-09-20 07:52:59 +04:00
|
|
|
if (i->modC0()) {
|
2012-08-05 17:52:40 +04:00
|
|
|
op2 = BX_READ_MMX_REG(i->src());
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
else {
|
2015-05-17 00:06:59 +03:00
|
|
|
bx_address eaddr = BX_CPU_RESOLVE_ADDR(i);
|
2002-09-09 20:11:25 +04:00
|
|
|
/* pointer, segment address pair */
|
2008-08-08 13:22:49 +04:00
|
|
|
MMXUQ(op2) = read_virtual_qword(i->seg(), eaddr);
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
|
2008-10-08 14:51:38 +04:00
|
|
|
BX_CPU_THIS_PTR prepareFPU2MMX(); /* FPU2MMX transition */
|
|
|
|
|
2011-01-16 23:42:28 +03:00
|
|
|
MMXSB0(op1) = SaturateWordSToByteS(MMXSW0(op1));
|
|
|
|
MMXSB1(op1) = SaturateWordSToByteS(MMXSW1(op1));
|
|
|
|
MMXSB2(op1) = SaturateWordSToByteS(MMXSW2(op1));
|
|
|
|
MMXSB3(op1) = SaturateWordSToByteS(MMXSW3(op1));
|
|
|
|
|
|
|
|
MMXSB4(op1) = SaturateWordSToByteS(MMXSW0(op2));
|
|
|
|
MMXSB5(op1) = SaturateWordSToByteS(MMXSW1(op2));
|
|
|
|
MMXSB6(op1) = SaturateWordSToByteS(MMXSW2(op2));
|
|
|
|
MMXSB7(op1) = SaturateWordSToByteS(MMXSW3(op2));
|
2002-09-09 20:11:25 +04:00
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BX_WRITE_MMX_REG(i->dst(), op1);
|
2010-02-26 14:44:50 +03:00
|
|
|
#endif
|
2011-07-07 00:01:18 +04:00
|
|
|
|
|
|
|
BX_NEXT_INSTR(i);
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* 0F 64 */
|
2018-02-16 10:57:32 +03:00
|
|
|
void BX_CPP_AttrRegparmN(1) BX_CPU_C::PCMPGTB_PqQq(bxInstruction_c *i)
|
2002-09-09 20:11:25 +04:00
|
|
|
{
|
2010-03-01 21:53:53 +03:00
|
|
|
#if BX_CPU_LEVEL >= 5
|
2002-10-16 21:37:35 +04:00
|
|
|
BX_CPU_THIS_PTR prepareMMX();
|
2002-09-09 20:11:25 +04:00
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BxPackedMmxRegister op1 = BX_READ_MMX_REG(i->dst()), op2;
|
2002-09-09 20:11:25 +04:00
|
|
|
|
|
|
|
/* op2 is a register or memory reference */
|
2002-09-20 07:52:59 +04:00
|
|
|
if (i->modC0()) {
|
2012-08-05 17:52:40 +04:00
|
|
|
op2 = BX_READ_MMX_REG(i->src());
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
else {
|
2015-05-17 00:06:59 +03:00
|
|
|
bx_address eaddr = BX_CPU_RESOLVE_ADDR(i);
|
2002-09-09 20:11:25 +04:00
|
|
|
/* pointer, segment address pair */
|
2008-08-08 13:22:49 +04:00
|
|
|
MMXUQ(op2) = read_virtual_qword(i->seg(), eaddr);
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
|
2008-10-08 14:51:38 +04:00
|
|
|
BX_CPU_THIS_PTR prepareFPU2MMX(); /* FPU2MMX transition */
|
|
|
|
|
2003-05-15 20:41:17 +04:00
|
|
|
MMXUB0(op1) = (MMXSB0(op1) > MMXSB0(op2)) ? 0xff : 0;
|
|
|
|
MMXUB1(op1) = (MMXSB1(op1) > MMXSB1(op2)) ? 0xff : 0;
|
|
|
|
MMXUB2(op1) = (MMXSB2(op1) > MMXSB2(op2)) ? 0xff : 0;
|
|
|
|
MMXUB3(op1) = (MMXSB3(op1) > MMXSB3(op2)) ? 0xff : 0;
|
|
|
|
MMXUB4(op1) = (MMXSB4(op1) > MMXSB4(op2)) ? 0xff : 0;
|
|
|
|
MMXUB5(op1) = (MMXSB5(op1) > MMXSB5(op2)) ? 0xff : 0;
|
|
|
|
MMXUB6(op1) = (MMXSB6(op1) > MMXSB6(op2)) ? 0xff : 0;
|
|
|
|
MMXUB7(op1) = (MMXSB7(op1) > MMXSB7(op2)) ? 0xff : 0;
|
2002-09-09 20:11:25 +04:00
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BX_WRITE_MMX_REG(i->dst(), op1);
|
2010-02-26 14:44:50 +03:00
|
|
|
#endif
|
2011-07-07 00:01:18 +04:00
|
|
|
|
|
|
|
BX_NEXT_INSTR(i);
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* 0F 65 */
|
2018-02-16 10:57:32 +03:00
|
|
|
void BX_CPP_AttrRegparmN(1) BX_CPU_C::PCMPGTW_PqQq(bxInstruction_c *i)
|
2002-09-09 20:11:25 +04:00
|
|
|
{
|
2010-03-01 21:53:53 +03:00
|
|
|
#if BX_CPU_LEVEL >= 5
|
2002-10-16 21:37:35 +04:00
|
|
|
BX_CPU_THIS_PTR prepareMMX();
|
2002-09-09 20:11:25 +04:00
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BxPackedMmxRegister op1 = BX_READ_MMX_REG(i->dst()), op2;
|
2002-09-09 20:11:25 +04:00
|
|
|
|
|
|
|
/* op2 is a register or memory reference */
|
2002-09-20 07:52:59 +04:00
|
|
|
if (i->modC0()) {
|
2012-08-05 17:52:40 +04:00
|
|
|
op2 = BX_READ_MMX_REG(i->src());
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
else {
|
2015-05-17 00:06:59 +03:00
|
|
|
bx_address eaddr = BX_CPU_RESOLVE_ADDR(i);
|
2002-09-09 20:11:25 +04:00
|
|
|
/* pointer, segment address pair */
|
2008-08-08 13:22:49 +04:00
|
|
|
MMXUQ(op2) = read_virtual_qword(i->seg(), eaddr);
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
|
2008-10-08 14:51:38 +04:00
|
|
|
BX_CPU_THIS_PTR prepareFPU2MMX(); /* FPU2MMX transition */
|
|
|
|
|
2003-05-15 20:41:17 +04:00
|
|
|
MMXUW0(op1) = (MMXSW0(op1) > MMXSW0(op2)) ? 0xffff : 0;
|
|
|
|
MMXUW1(op1) = (MMXSW1(op1) > MMXSW1(op2)) ? 0xffff : 0;
|
|
|
|
MMXUW2(op1) = (MMXSW2(op1) > MMXSW2(op2)) ? 0xffff : 0;
|
|
|
|
MMXUW3(op1) = (MMXSW3(op1) > MMXSW3(op2)) ? 0xffff : 0;
|
2002-09-09 20:11:25 +04:00
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BX_WRITE_MMX_REG(i->dst(), op1);
|
2010-02-26 14:44:50 +03:00
|
|
|
#endif
|
2011-07-07 00:01:18 +04:00
|
|
|
|
|
|
|
BX_NEXT_INSTR(i);
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* 0F 66 */
|
2018-02-16 10:57:32 +03:00
|
|
|
void BX_CPP_AttrRegparmN(1) BX_CPU_C::PCMPGTD_PqQq(bxInstruction_c *i)
|
2002-09-09 20:11:25 +04:00
|
|
|
{
|
2010-03-01 21:53:53 +03:00
|
|
|
#if BX_CPU_LEVEL >= 5
|
2002-10-16 21:37:35 +04:00
|
|
|
BX_CPU_THIS_PTR prepareMMX();
|
2002-09-09 20:11:25 +04:00
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BxPackedMmxRegister op1 = BX_READ_MMX_REG(i->dst()), op2;
|
2002-09-09 20:11:25 +04:00
|
|
|
|
|
|
|
/* op2 is a register or memory reference */
|
2002-09-20 07:52:59 +04:00
|
|
|
if (i->modC0()) {
|
2012-08-05 17:52:40 +04:00
|
|
|
op2 = BX_READ_MMX_REG(i->src());
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
else {
|
2015-05-17 00:06:59 +03:00
|
|
|
bx_address eaddr = BX_CPU_RESOLVE_ADDR(i);
|
2002-09-09 20:11:25 +04:00
|
|
|
/* pointer, segment address pair */
|
2008-08-08 13:22:49 +04:00
|
|
|
MMXUQ(op2) = read_virtual_qword(i->seg(), eaddr);
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
|
2008-10-08 14:51:38 +04:00
|
|
|
BX_CPU_THIS_PTR prepareFPU2MMX(); /* FPU2MMX transition */
|
|
|
|
|
2003-05-15 20:41:17 +04:00
|
|
|
MMXUD0(op1) = (MMXSD0(op1) > MMXSD0(op2)) ? 0xffffffff : 0;
|
|
|
|
MMXUD1(op1) = (MMXSD1(op1) > MMXSD1(op2)) ? 0xffffffff : 0;
|
2002-09-09 20:11:25 +04:00
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BX_WRITE_MMX_REG(i->dst(), op1);
|
2010-02-26 14:44:50 +03:00
|
|
|
#endif
|
2011-07-07 00:01:18 +04:00
|
|
|
|
|
|
|
BX_NEXT_INSTR(i);
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* 0F 67 */
|
2018-02-16 10:57:32 +03:00
|
|
|
void BX_CPP_AttrRegparmN(1) BX_CPU_C::PACKUSWB_PqQq(bxInstruction_c *i)
|
2002-09-09 20:11:25 +04:00
|
|
|
{
|
2010-03-01 21:53:53 +03:00
|
|
|
#if BX_CPU_LEVEL >= 5
|
2002-10-16 21:37:35 +04:00
|
|
|
BX_CPU_THIS_PTR prepareMMX();
|
2002-09-09 20:11:25 +04:00
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BxPackedMmxRegister op1 = BX_READ_MMX_REG(i->dst()), op2;
|
2002-09-09 20:11:25 +04:00
|
|
|
|
|
|
|
/* op2 is a register or memory reference */
|
2002-09-20 07:52:59 +04:00
|
|
|
if (i->modC0()) {
|
2012-08-05 17:52:40 +04:00
|
|
|
op2 = BX_READ_MMX_REG(i->src());
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
else {
|
2015-05-17 00:06:59 +03:00
|
|
|
bx_address eaddr = BX_CPU_RESOLVE_ADDR(i);
|
2002-09-09 20:11:25 +04:00
|
|
|
/* pointer, segment address pair */
|
2008-08-08 13:22:49 +04:00
|
|
|
MMXUQ(op2) = read_virtual_qword(i->seg(), eaddr);
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
|
2008-10-08 14:51:38 +04:00
|
|
|
BX_CPU_THIS_PTR prepareFPU2MMX(); /* FPU2MMX transition */
|
|
|
|
|
2011-01-16 23:42:28 +03:00
|
|
|
MMXUB0(op1) = SaturateWordSToByteU(MMXSW0(op1));
|
|
|
|
MMXUB1(op1) = SaturateWordSToByteU(MMXSW1(op1));
|
|
|
|
MMXUB2(op1) = SaturateWordSToByteU(MMXSW2(op1));
|
|
|
|
MMXUB3(op1) = SaturateWordSToByteU(MMXSW3(op1));
|
|
|
|
MMXUB4(op1) = SaturateWordSToByteU(MMXSW0(op2));
|
|
|
|
MMXUB5(op1) = SaturateWordSToByteU(MMXSW1(op2));
|
|
|
|
MMXUB6(op1) = SaturateWordSToByteU(MMXSW2(op2));
|
|
|
|
MMXUB7(op1) = SaturateWordSToByteU(MMXSW3(op2));
|
2002-09-09 20:11:25 +04:00
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BX_WRITE_MMX_REG(i->dst(), op1);
|
2010-02-26 14:44:50 +03:00
|
|
|
#endif
|
2011-07-07 00:01:18 +04:00
|
|
|
|
|
|
|
BX_NEXT_INSTR(i);
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* 0F 68 */
|
2018-02-16 10:57:32 +03:00
|
|
|
void BX_CPP_AttrRegparmN(1) BX_CPU_C::PUNPCKHBW_PqQq(bxInstruction_c *i)
|
2002-09-09 20:11:25 +04:00
|
|
|
{
|
2010-03-01 21:53:53 +03:00
|
|
|
#if BX_CPU_LEVEL >= 5
|
2002-10-16 21:37:35 +04:00
|
|
|
BX_CPU_THIS_PTR prepareMMX();
|
2002-09-09 20:11:25 +04:00
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BxPackedMmxRegister op1 = BX_READ_MMX_REG(i->dst()), op2;
|
2002-09-09 20:11:25 +04:00
|
|
|
|
|
|
|
/* op2 is a register or memory reference */
|
2002-09-20 07:52:59 +04:00
|
|
|
if (i->modC0()) {
|
2012-08-05 17:52:40 +04:00
|
|
|
op2 = BX_READ_MMX_REG(i->src());
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
else {
|
2015-05-17 00:06:59 +03:00
|
|
|
bx_address eaddr = BX_CPU_RESOLVE_ADDR(i);
|
2002-09-09 20:11:25 +04:00
|
|
|
/* pointer, segment address pair */
|
2008-08-08 13:22:49 +04:00
|
|
|
MMXUQ(op2) = read_virtual_qword(i->seg(), eaddr);
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
|
2008-10-08 14:51:38 +04:00
|
|
|
BX_CPU_THIS_PTR prepareFPU2MMX(); /* FPU2MMX transition */
|
|
|
|
|
2011-01-17 00:01:28 +03:00
|
|
|
MMXUB0(op1) = MMXUB4(op1);
|
|
|
|
MMXUB1(op1) = MMXUB4(op2);
|
|
|
|
MMXUB2(op1) = MMXUB5(op1);
|
|
|
|
MMXUB3(op1) = MMXUB5(op2);
|
|
|
|
MMXUB4(op1) = MMXUB6(op1);
|
|
|
|
MMXUB5(op1) = MMXUB6(op2);
|
|
|
|
MMXUB6(op1) = MMXUB7(op1);
|
|
|
|
MMXUB7(op1) = MMXUB7(op2);
|
2002-09-09 20:11:25 +04:00
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BX_WRITE_MMX_REG(i->dst(), op1);
|
2010-02-26 14:44:50 +03:00
|
|
|
#endif
|
2011-07-07 00:01:18 +04:00
|
|
|
|
|
|
|
BX_NEXT_INSTR(i);
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* 0F 69 */
|
2018-02-16 10:57:32 +03:00
|
|
|
void BX_CPP_AttrRegparmN(1) BX_CPU_C::PUNPCKHWD_PqQq(bxInstruction_c *i)
|
2002-09-09 20:11:25 +04:00
|
|
|
{
|
2010-03-01 21:53:53 +03:00
|
|
|
#if BX_CPU_LEVEL >= 5
|
2002-10-16 21:37:35 +04:00
|
|
|
BX_CPU_THIS_PTR prepareMMX();
|
2002-09-09 20:11:25 +04:00
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BxPackedMmxRegister op1 = BX_READ_MMX_REG(i->dst()), op2;
|
2002-09-09 20:11:25 +04:00
|
|
|
|
|
|
|
/* op2 is a register or memory reference */
|
2002-09-20 07:52:59 +04:00
|
|
|
if (i->modC0()) {
|
2012-08-05 17:52:40 +04:00
|
|
|
op2 = BX_READ_MMX_REG(i->src());
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
else {
|
2015-05-17 00:06:59 +03:00
|
|
|
bx_address eaddr = BX_CPU_RESOLVE_ADDR(i);
|
2002-09-09 20:11:25 +04:00
|
|
|
/* pointer, segment address pair */
|
2008-08-08 13:22:49 +04:00
|
|
|
MMXUQ(op2) = read_virtual_qword(i->seg(), eaddr);
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
|
2008-10-08 14:51:38 +04:00
|
|
|
BX_CPU_THIS_PTR prepareFPU2MMX(); /* FPU2MMX transition */
|
|
|
|
|
2011-01-17 00:01:28 +03:00
|
|
|
MMXUW0(op1) = MMXUW2(op1);
|
|
|
|
MMXUW1(op1) = MMXUW2(op2);
|
|
|
|
MMXUW2(op1) = MMXUW3(op1);
|
|
|
|
MMXUW3(op1) = MMXUW3(op2);
|
2002-09-09 20:11:25 +04:00
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BX_WRITE_MMX_REG(i->dst(), op1);
|
2010-02-26 14:44:50 +03:00
|
|
|
#endif
|
2011-07-07 00:01:18 +04:00
|
|
|
|
|
|
|
BX_NEXT_INSTR(i);
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* 0F 6A */
|
2018-02-16 10:57:32 +03:00
|
|
|
void BX_CPP_AttrRegparmN(1) BX_CPU_C::PUNPCKHDQ_PqQq(bxInstruction_c *i)
|
2002-09-09 20:11:25 +04:00
|
|
|
{
|
2010-03-01 21:53:53 +03:00
|
|
|
#if BX_CPU_LEVEL >= 5
|
2002-10-16 21:37:35 +04:00
|
|
|
BX_CPU_THIS_PTR prepareMMX();
|
2002-09-09 20:11:25 +04:00
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BxPackedMmxRegister op1 = BX_READ_MMX_REG(i->dst()), op2;
|
2002-09-09 20:11:25 +04:00
|
|
|
|
|
|
|
/* op2 is a register or memory reference */
|
2002-09-20 07:52:59 +04:00
|
|
|
if (i->modC0()) {
|
2012-08-05 17:52:40 +04:00
|
|
|
op2 = BX_READ_MMX_REG(i->src());
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
else {
|
2015-05-17 00:06:59 +03:00
|
|
|
bx_address eaddr = BX_CPU_RESOLVE_ADDR(i);
|
2002-09-09 20:11:25 +04:00
|
|
|
/* pointer, segment address pair */
|
2008-08-08 13:22:49 +04:00
|
|
|
MMXUQ(op2) = read_virtual_qword(i->seg(), eaddr);
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
|
2008-10-08 14:51:38 +04:00
|
|
|
BX_CPU_THIS_PTR prepareFPU2MMX(); /* FPU2MMX transition */
|
|
|
|
|
2011-01-16 23:42:28 +03:00
|
|
|
MMXUD0(op1) = MMXUD1(op1);
|
|
|
|
MMXUD1(op1) = MMXUD1(op2);
|
2002-09-09 20:11:25 +04:00
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BX_WRITE_MMX_REG(i->dst(), op1);
|
2010-02-26 14:44:50 +03:00
|
|
|
#endif
|
2011-07-07 00:01:18 +04:00
|
|
|
|
|
|
|
BX_NEXT_INSTR(i);
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* 0F 6B */
|
2018-02-16 10:57:32 +03:00
|
|
|
void BX_CPP_AttrRegparmN(1) BX_CPU_C::PACKSSDW_PqQq(bxInstruction_c *i)
|
2002-09-09 20:11:25 +04:00
|
|
|
{
|
2010-03-01 21:53:53 +03:00
|
|
|
#if BX_CPU_LEVEL >= 5
|
2002-10-16 21:37:35 +04:00
|
|
|
BX_CPU_THIS_PTR prepareMMX();
|
2002-09-09 20:11:25 +04:00
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BxPackedMmxRegister op1 = BX_READ_MMX_REG(i->dst()), op2;
|
2002-09-09 20:11:25 +04:00
|
|
|
|
|
|
|
/* op2 is a register or memory reference */
|
2002-09-20 07:52:59 +04:00
|
|
|
if (i->modC0()) {
|
2012-08-05 17:52:40 +04:00
|
|
|
op2 = BX_READ_MMX_REG(i->src());
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
else {
|
2015-05-17 00:06:59 +03:00
|
|
|
bx_address eaddr = BX_CPU_RESOLVE_ADDR(i);
|
2002-09-09 20:11:25 +04:00
|
|
|
/* pointer, segment address pair */
|
2008-08-08 13:22:49 +04:00
|
|
|
MMXUQ(op2) = read_virtual_qword(i->seg(), eaddr);
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
|
2008-10-08 14:51:38 +04:00
|
|
|
BX_CPU_THIS_PTR prepareFPU2MMX(); /* FPU2MMX transition */
|
|
|
|
|
2011-01-16 23:42:28 +03:00
|
|
|
MMXSW0(op1) = SaturateDwordSToWordS(MMXSD0(op1));
|
|
|
|
MMXSW1(op1) = SaturateDwordSToWordS(MMXSD1(op1));
|
|
|
|
MMXSW2(op1) = SaturateDwordSToWordS(MMXSD0(op2));
|
|
|
|
MMXSW3(op1) = SaturateDwordSToWordS(MMXSD1(op2));
|
2002-09-09 20:11:25 +04:00
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BX_WRITE_MMX_REG(i->dst(), op1);
|
2010-02-26 14:44:50 +03:00
|
|
|
#endif
|
2011-07-07 00:01:18 +04:00
|
|
|
|
|
|
|
BX_NEXT_INSTR(i);
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* 0F 6E */
|
2018-02-16 10:57:32 +03:00
|
|
|
void BX_CPP_AttrRegparmN(1) BX_CPU_C::MOVD_PqEdR(bxInstruction_c *i)
|
2002-09-09 20:11:25 +04:00
|
|
|
{
|
2010-03-01 21:53:53 +03:00
|
|
|
#if BX_CPU_LEVEL >= 5
|
2002-10-16 21:37:35 +04:00
|
|
|
BX_CPU_THIS_PTR prepareMMX();
|
2010-02-10 20:21:15 +03:00
|
|
|
BX_CPU_THIS_PTR prepareFPU2MMX(); /* FPU2MMX transition */
|
2002-09-09 20:11:25 +04:00
|
|
|
|
2015-02-24 00:17:33 +03:00
|
|
|
BxPackedMmxRegister op = (Bit64u) BX_READ_32BIT_REG(i->src());
|
2012-08-05 17:52:40 +04:00
|
|
|
BX_WRITE_MMX_REG(i->dst(), op);
|
2010-02-26 14:44:50 +03:00
|
|
|
#endif
|
2011-07-07 00:01:18 +04:00
|
|
|
|
|
|
|
BX_NEXT_INSTR(i);
|
2010-02-10 20:21:15 +03:00
|
|
|
}
|
|
|
|
|
2018-02-16 10:57:32 +03:00
|
|
|
void BX_CPP_AttrRegparmN(1) BX_CPU_C::MOVD_PqEdM(bxInstruction_c *i)
|
2010-02-10 20:21:15 +03:00
|
|
|
{
|
2010-03-01 21:53:53 +03:00
|
|
|
#if BX_CPU_LEVEL >= 5
|
2010-02-10 20:21:15 +03:00
|
|
|
BX_CPU_THIS_PTR prepareMMX();
|
|
|
|
|
2015-05-17 00:06:59 +03:00
|
|
|
bx_address eaddr = BX_CPU_RESOLVE_ADDR(i);
|
2015-02-24 00:17:33 +03:00
|
|
|
BxPackedMmxRegister op = (Bit64u) read_virtual_dword(i->seg(), eaddr);
|
2002-09-09 20:11:25 +04:00
|
|
|
|
2008-10-08 14:51:38 +04:00
|
|
|
BX_CPU_THIS_PTR prepareFPU2MMX(); /* FPU2MMX transition */
|
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BX_WRITE_MMX_REG(i->dst(), op);
|
2010-02-26 14:44:50 +03:00
|
|
|
#endif
|
2011-07-07 00:01:18 +04:00
|
|
|
|
|
|
|
BX_NEXT_INSTR(i);
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
|
2007-11-28 01:12:45 +03:00
|
|
|
/* 0F 6E */
|
|
|
|
#if BX_SUPPORT_X86_64
|
2018-02-16 10:57:32 +03:00
|
|
|
void BX_CPP_AttrRegparmN(1) BX_CPU_C::MOVQ_PqEqR(bxInstruction_c *i)
|
2007-11-28 01:12:45 +03:00
|
|
|
{
|
|
|
|
BX_CPU_THIS_PTR prepareMMX();
|
2009-10-24 15:17:51 +04:00
|
|
|
BX_CPU_THIS_PTR prepareFPU2MMX(); /* FPU2MMX transition */
|
2007-11-28 01:12:45 +03:00
|
|
|
|
2015-02-24 00:17:33 +03:00
|
|
|
BxPackedMmxRegister op = BX_READ_64BIT_REG(i->src());
|
2012-08-05 17:52:40 +04:00
|
|
|
BX_WRITE_MMX_REG(i->dst(), op);
|
2011-07-07 00:01:18 +04:00
|
|
|
|
|
|
|
BX_NEXT_INSTR(i);
|
2009-10-24 15:17:51 +04:00
|
|
|
}
|
2009-12-14 14:55:42 +03:00
|
|
|
#endif
|
2009-10-24 15:17:51 +04:00
|
|
|
|
2009-12-14 14:55:42 +03:00
|
|
|
/* 0F 6F */
|
2018-02-16 10:57:32 +03:00
|
|
|
void BX_CPP_AttrRegparmN(1) BX_CPU_C::MOVQ_PqQqR(bxInstruction_c *i)
|
2009-10-24 15:17:51 +04:00
|
|
|
{
|
2010-03-01 21:53:53 +03:00
|
|
|
#if BX_CPU_LEVEL >= 5
|
2009-10-24 15:17:51 +04:00
|
|
|
BX_CPU_THIS_PTR prepareMMX();
|
2008-10-08 14:51:38 +04:00
|
|
|
BX_CPU_THIS_PTR prepareFPU2MMX(); /* FPU2MMX transition */
|
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BX_WRITE_MMX_REG(i->dst(), BX_READ_MMX_REG(i->src()));
|
2010-02-26 14:44:50 +03:00
|
|
|
#endif
|
2011-07-07 00:01:18 +04:00
|
|
|
|
|
|
|
BX_NEXT_INSTR(i);
|
2009-12-14 14:55:42 +03:00
|
|
|
}
|
2007-11-28 01:12:45 +03:00
|
|
|
|
2018-02-16 10:57:32 +03:00
|
|
|
void BX_CPP_AttrRegparmN(1) BX_CPU_C::MOVQ_PqQqM(bxInstruction_c *i)
|
2002-09-09 20:11:25 +04:00
|
|
|
{
|
2010-03-01 21:53:53 +03:00
|
|
|
#if BX_CPU_LEVEL >= 5
|
2002-10-16 21:37:35 +04:00
|
|
|
BX_CPU_THIS_PTR prepareMMX();
|
2002-09-09 20:11:25 +04:00
|
|
|
|
2015-05-17 00:06:59 +03:00
|
|
|
bx_address eaddr = BX_CPU_RESOLVE_ADDR(i);
|
2015-02-24 00:17:33 +03:00
|
|
|
BxPackedMmxRegister op = read_virtual_qword(i->seg(), eaddr);
|
2002-09-09 20:11:25 +04:00
|
|
|
|
2008-10-08 14:51:38 +04:00
|
|
|
BX_CPU_THIS_PTR prepareFPU2MMX(); /* FPU2MMX transition */
|
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BX_WRITE_MMX_REG(i->dst(), op);
|
2010-02-26 14:44:50 +03:00
|
|
|
#endif
|
2011-07-07 00:01:18 +04:00
|
|
|
|
|
|
|
BX_NEXT_INSTR(i);
|
2002-10-16 21:37:35 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* 0F 70 */
|
2018-02-16 10:57:32 +03:00
|
|
|
void BX_CPP_AttrRegparmN(1) BX_CPU_C::PSHUFW_PqQqIb(bxInstruction_c *i)
|
2002-10-16 21:37:35 +04:00
|
|
|
{
|
2010-03-01 21:53:53 +03:00
|
|
|
#if BX_CPU_LEVEL >= 5
|
2002-10-16 21:37:35 +04:00
|
|
|
BX_CPU_THIS_PTR prepareMMX();
|
|
|
|
|
|
|
|
BxPackedMmxRegister op, result;
|
2002-11-15 20:34:47 +03:00
|
|
|
Bit8u order = i->Ib();
|
2002-10-16 21:37:35 +04:00
|
|
|
|
2002-11-08 15:47:24 +03:00
|
|
|
/* op is a register or memory reference */
|
2002-10-16 21:37:35 +04:00
|
|
|
if (i->modC0()) {
|
2012-08-05 17:52:40 +04:00
|
|
|
op = BX_READ_MMX_REG(i->src());
|
2002-10-16 21:37:35 +04:00
|
|
|
}
|
|
|
|
else {
|
2015-05-17 00:06:59 +03:00
|
|
|
bx_address eaddr = BX_CPU_RESOLVE_ADDR(i);
|
2002-10-16 21:37:35 +04:00
|
|
|
/* pointer, segment address pair */
|
2008-08-08 13:22:49 +04:00
|
|
|
MMXUQ(op) = read_virtual_qword(i->seg(), eaddr);
|
2002-10-16 21:37:35 +04:00
|
|
|
}
|
|
|
|
|
2008-10-08 14:51:38 +04:00
|
|
|
BX_CPU_THIS_PTR prepareFPU2MMX(); /* FPU2MMX transition */
|
|
|
|
|
2015-02-24 00:17:33 +03:00
|
|
|
MMXUW0(result) = op.u16((order) & 0x3);
|
|
|
|
MMXUW1(result) = op.u16((order>>2) & 0x3);
|
|
|
|
MMXUW2(result) = op.u16((order>>4) & 0x3);
|
|
|
|
MMXUW3(result) = op.u16((order>>6) & 0x3);
|
2002-10-16 21:37:35 +04:00
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BX_WRITE_MMX_REG(i->dst(), result);
|
2010-02-26 14:44:50 +03:00
|
|
|
#endif
|
2011-07-07 00:01:18 +04:00
|
|
|
|
|
|
|
BX_NEXT_INSTR(i);
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
|
2002-11-08 01:41:34 +03:00
|
|
|
/* 0F 74 */
|
2018-02-16 10:57:32 +03:00
|
|
|
void BX_CPP_AttrRegparmN(1) BX_CPU_C::PCMPEQB_PqQq(bxInstruction_c *i)
|
2002-09-09 20:11:25 +04:00
|
|
|
{
|
2010-03-01 21:53:53 +03:00
|
|
|
#if BX_CPU_LEVEL >= 5
|
2002-10-16 21:37:35 +04:00
|
|
|
BX_CPU_THIS_PTR prepareMMX();
|
2002-09-09 20:11:25 +04:00
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BxPackedMmxRegister op1 = BX_READ_MMX_REG(i->dst()), op2;
|
2002-09-09 20:11:25 +04:00
|
|
|
|
|
|
|
/* op2 is a register or memory reference */
|
2002-09-20 07:52:59 +04:00
|
|
|
if (i->modC0()) {
|
2012-08-05 17:52:40 +04:00
|
|
|
op2 = BX_READ_MMX_REG(i->src());
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
else {
|
2015-05-17 00:06:59 +03:00
|
|
|
bx_address eaddr = BX_CPU_RESOLVE_ADDR(i);
|
2002-09-09 20:11:25 +04:00
|
|
|
/* pointer, segment address pair */
|
2008-08-08 13:22:49 +04:00
|
|
|
MMXUQ(op2) = read_virtual_qword(i->seg(), eaddr);
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
|
2008-10-08 14:51:38 +04:00
|
|
|
BX_CPU_THIS_PTR prepareFPU2MMX(); /* FPU2MMX transition */
|
|
|
|
|
2003-05-15 20:41:17 +04:00
|
|
|
MMXUB0(op1) = (MMXUB0(op1) == MMXUB0(op2)) ? 0xff : 0;
|
|
|
|
MMXUB1(op1) = (MMXUB1(op1) == MMXUB1(op2)) ? 0xff : 0;
|
|
|
|
MMXUB2(op1) = (MMXUB2(op1) == MMXUB2(op2)) ? 0xff : 0;
|
|
|
|
MMXUB3(op1) = (MMXUB3(op1) == MMXUB3(op2)) ? 0xff : 0;
|
|
|
|
MMXUB4(op1) = (MMXUB4(op1) == MMXUB4(op2)) ? 0xff : 0;
|
|
|
|
MMXUB5(op1) = (MMXUB5(op1) == MMXUB5(op2)) ? 0xff : 0;
|
|
|
|
MMXUB6(op1) = (MMXUB6(op1) == MMXUB6(op2)) ? 0xff : 0;
|
|
|
|
MMXUB7(op1) = (MMXUB7(op1) == MMXUB7(op2)) ? 0xff : 0;
|
2002-09-09 20:11:25 +04:00
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BX_WRITE_MMX_REG(i->dst(), op1);
|
2010-02-26 14:44:50 +03:00
|
|
|
#endif
|
2011-07-07 00:01:18 +04:00
|
|
|
|
|
|
|
BX_NEXT_INSTR(i);
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* 0F 75 */
|
2018-02-16 10:57:32 +03:00
|
|
|
void BX_CPP_AttrRegparmN(1) BX_CPU_C::PCMPEQW_PqQq(bxInstruction_c *i)
|
2002-09-09 20:11:25 +04:00
|
|
|
{
|
2010-03-01 21:53:53 +03:00
|
|
|
#if BX_CPU_LEVEL >= 5
|
2002-10-16 21:37:35 +04:00
|
|
|
BX_CPU_THIS_PTR prepareMMX();
|
2002-09-09 20:11:25 +04:00
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BxPackedMmxRegister op1 = BX_READ_MMX_REG(i->dst()), op2;
|
2002-09-09 20:11:25 +04:00
|
|
|
|
|
|
|
/* op2 is a register or memory reference */
|
2002-09-20 07:52:59 +04:00
|
|
|
if (i->modC0()) {
|
2012-08-05 17:52:40 +04:00
|
|
|
op2 = BX_READ_MMX_REG(i->src());
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
else {
|
2015-05-17 00:06:59 +03:00
|
|
|
bx_address eaddr = BX_CPU_RESOLVE_ADDR(i);
|
2002-09-09 20:11:25 +04:00
|
|
|
/* pointer, segment address pair */
|
2008-08-08 13:22:49 +04:00
|
|
|
MMXUQ(op2) = read_virtual_qword(i->seg(), eaddr);
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
|
2008-10-08 14:51:38 +04:00
|
|
|
BX_CPU_THIS_PTR prepareFPU2MMX(); /* FPU2MMX transition */
|
|
|
|
|
2003-05-15 20:41:17 +04:00
|
|
|
MMXUW0(op1) = (MMXUW0(op1) == MMXUW0(op2)) ? 0xffff : 0;
|
|
|
|
MMXUW1(op1) = (MMXUW1(op1) == MMXUW1(op2)) ? 0xffff : 0;
|
|
|
|
MMXUW2(op1) = (MMXUW2(op1) == MMXUW2(op2)) ? 0xffff : 0;
|
|
|
|
MMXUW3(op1) = (MMXUW3(op1) == MMXUW3(op2)) ? 0xffff : 0;
|
2002-09-09 20:11:25 +04:00
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BX_WRITE_MMX_REG(i->dst(), op1);
|
2010-02-26 14:44:50 +03:00
|
|
|
#endif
|
2011-07-07 00:01:18 +04:00
|
|
|
|
|
|
|
BX_NEXT_INSTR(i);
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* 0F 76 */
|
2018-02-16 10:57:32 +03:00
|
|
|
void BX_CPP_AttrRegparmN(1) BX_CPU_C::PCMPEQD_PqQq(bxInstruction_c *i)
|
2002-09-09 20:11:25 +04:00
|
|
|
{
|
2010-03-01 21:53:53 +03:00
|
|
|
#if BX_CPU_LEVEL >= 5
|
2002-10-16 21:37:35 +04:00
|
|
|
BX_CPU_THIS_PTR prepareMMX();
|
2002-09-09 20:11:25 +04:00
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BxPackedMmxRegister op1 = BX_READ_MMX_REG(i->dst()), op2;
|
2002-09-09 20:11:25 +04:00
|
|
|
|
|
|
|
/* op2 is a register or memory reference */
|
2002-09-20 07:52:59 +04:00
|
|
|
if (i->modC0()) {
|
2012-08-05 17:52:40 +04:00
|
|
|
op2 = BX_READ_MMX_REG(i->src());
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
else {
|
2015-05-17 00:06:59 +03:00
|
|
|
bx_address eaddr = BX_CPU_RESOLVE_ADDR(i);
|
2002-09-09 20:11:25 +04:00
|
|
|
/* pointer, segment address pair */
|
2008-08-08 13:22:49 +04:00
|
|
|
MMXUQ(op2) = read_virtual_qword(i->seg(), eaddr);
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
|
2008-10-08 14:51:38 +04:00
|
|
|
BX_CPU_THIS_PTR prepareFPU2MMX(); /* FPU2MMX transition */
|
|
|
|
|
2003-05-15 20:41:17 +04:00
|
|
|
MMXUD0(op1) = (MMXUD0(op1) == MMXUD0(op2)) ? 0xffffffff : 0;
|
|
|
|
MMXUD1(op1) = (MMXUD1(op1) == MMXUD1(op2)) ? 0xffffffff : 0;
|
2002-09-09 20:11:25 +04:00
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BX_WRITE_MMX_REG(i->dst(), op1);
|
2010-02-26 14:44:50 +03:00
|
|
|
#endif
|
2011-07-07 00:01:18 +04:00
|
|
|
|
|
|
|
BX_NEXT_INSTR(i);
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* 0F 77 */
|
2018-02-16 10:57:32 +03:00
|
|
|
void BX_CPP_AttrRegparmN(1) BX_CPU_C::EMMS(bxInstruction_c *i)
|
2002-09-09 20:11:25 +04:00
|
|
|
{
|
2010-03-02 09:49:41 +03:00
|
|
|
#if BX_CPU_LEVEL >= 5
|
2003-04-05 16:49:14 +04:00
|
|
|
BX_CPU_THIS_PTR prepareMMX();
|
2003-08-01 13:32:33 +04:00
|
|
|
FPU_TAG_WORD = 0xffff;
|
2008-10-08 14:51:38 +04:00
|
|
|
FPU_TOS = 0; /* reset FPU Top-Of-Stack */
|
2010-02-26 14:44:50 +03:00
|
|
|
#endif
|
2011-07-07 00:01:18 +04:00
|
|
|
|
|
|
|
BX_NEXT_INSTR(i);
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* 0F 7E */
|
2018-02-16 10:57:32 +03:00
|
|
|
void BX_CPP_AttrRegparmN(1) BX_CPU_C::MOVD_EdPqR(bxInstruction_c *i)
|
2002-09-09 20:11:25 +04:00
|
|
|
{
|
2010-03-01 21:53:53 +03:00
|
|
|
#if BX_CPU_LEVEL >= 5
|
2002-10-16 21:37:35 +04:00
|
|
|
BX_CPU_THIS_PTR prepareMMX();
|
2010-02-10 20:21:15 +03:00
|
|
|
BX_CPU_THIS_PTR prepareFPU2MMX();
|
2002-09-09 20:11:25 +04:00
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BxPackedMmxRegister op = BX_READ_MMX_REG(i->src());
|
|
|
|
BX_WRITE_32BIT_REGZ(i->dst(), MMXUD0(op));
|
2010-02-26 14:44:50 +03:00
|
|
|
#endif
|
2011-07-07 00:01:18 +04:00
|
|
|
|
|
|
|
BX_NEXT_INSTR(i);
|
2010-02-10 20:21:15 +03:00
|
|
|
}
|
2002-09-09 20:11:25 +04:00
|
|
|
|
2018-02-16 10:57:32 +03:00
|
|
|
void BX_CPP_AttrRegparmN(1) BX_CPU_C::MOVD_EdPqM(bxInstruction_c *i)
|
2010-02-10 20:21:15 +03:00
|
|
|
{
|
2010-03-01 21:53:53 +03:00
|
|
|
#if BX_CPU_LEVEL >= 5
|
2010-02-10 20:21:15 +03:00
|
|
|
BX_CPU_THIS_PTR prepareMMX();
|
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BxPackedMmxRegister op = BX_READ_MMX_REG(i->src());
|
2010-02-10 20:21:15 +03:00
|
|
|
|
2015-05-17 00:06:59 +03:00
|
|
|
bx_address eaddr = BX_CPU_RESOLVE_ADDR(i);
|
2010-02-10 20:21:15 +03:00
|
|
|
/* pointer, segment address pair */
|
|
|
|
write_virtual_dword(i->seg(), eaddr, MMXUD0(op));
|
2009-02-13 13:15:16 +03:00
|
|
|
|
|
|
|
// do not cause FPU2MMX transition if memory write faults
|
|
|
|
BX_CPU_THIS_PTR prepareFPU2MMX();
|
2010-02-26 14:44:50 +03:00
|
|
|
#endif
|
2011-07-07 00:01:18 +04:00
|
|
|
|
|
|
|
BX_NEXT_INSTR(i);
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
|
2007-11-28 01:12:45 +03:00
|
|
|
#if BX_SUPPORT_X86_64
|
|
|
|
|
|
|
|
/* 0F 7E */
|
2018-02-16 10:57:32 +03:00
|
|
|
void BX_CPP_AttrRegparmN(1) BX_CPU_C::MOVQ_EqPqR(bxInstruction_c *i)
|
2007-11-28 01:12:45 +03:00
|
|
|
{
|
|
|
|
BX_CPU_THIS_PTR prepareMMX();
|
2010-02-10 20:21:15 +03:00
|
|
|
BX_CPU_THIS_PTR prepareFPU2MMX();
|
2007-11-28 01:12:45 +03:00
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BX_WRITE_64BIT_REG(i->dst(), BX_MMX_REG(i->src()));
|
2009-02-13 13:15:16 +03:00
|
|
|
|
2011-07-07 00:01:18 +04:00
|
|
|
BX_NEXT_INSTR(i);
|
|
|
|
}
|
2007-11-28 01:12:45 +03:00
|
|
|
|
2010-02-26 14:44:50 +03:00
|
|
|
#endif
|
2007-11-28 01:12:45 +03:00
|
|
|
|
2011-06-26 23:31:42 +04:00
|
|
|
/* 0F 7F - MOVQ_QqPqM */
|
|
|
|
/* 0F E7 - MOVNTQ_MqPq */
|
2018-02-16 10:57:32 +03:00
|
|
|
void BX_CPP_AttrRegparmN(1) BX_CPU_C::MOVQ_QqPqM(bxInstruction_c *i)
|
2002-09-09 20:11:25 +04:00
|
|
|
{
|
2010-03-01 21:53:53 +03:00
|
|
|
#if BX_CPU_LEVEL >= 5
|
2002-10-16 21:37:35 +04:00
|
|
|
BX_CPU_THIS_PTR prepareMMX();
|
2002-09-09 20:11:25 +04:00
|
|
|
|
2015-05-17 00:06:59 +03:00
|
|
|
bx_address eaddr = BX_CPU_RESOLVE_ADDR(i);
|
2010-02-10 20:21:15 +03:00
|
|
|
/* pointer, segment address pair */
|
2012-08-05 17:52:40 +04:00
|
|
|
write_virtual_qword(i->seg(), eaddr, BX_MMX_REG(i->src()));
|
2009-02-13 13:15:16 +03:00
|
|
|
|
|
|
|
// do not cause FPU2MMX transition if memory write faults
|
|
|
|
BX_CPU_THIS_PTR prepareFPU2MMX();
|
2010-02-26 14:44:50 +03:00
|
|
|
#endif
|
2011-07-07 00:01:18 +04:00
|
|
|
|
|
|
|
BX_NEXT_INSTR(i);
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
|
2002-12-03 00:24:09 +03:00
|
|
|
/* 0F C4 */
|
2018-02-16 10:57:32 +03:00
|
|
|
void BX_CPP_AttrRegparmN(1) BX_CPU_C::PINSRW_PqEwIb(bxInstruction_c *i)
|
2002-12-03 00:24:09 +03:00
|
|
|
{
|
2010-03-01 21:53:53 +03:00
|
|
|
#if BX_CPU_LEVEL >= 5
|
2002-12-03 00:24:09 +03:00
|
|
|
BX_CPU_THIS_PTR prepareMMX();
|
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BxPackedMmxRegister op1 = BX_READ_MMX_REG(i->dst());
|
2002-12-03 00:24:09 +03:00
|
|
|
Bit16u op2;
|
|
|
|
|
|
|
|
/* op2 is a register or memory reference */
|
|
|
|
if (i->modC0()) {
|
2012-08-05 17:52:40 +04:00
|
|
|
op2 = BX_READ_16BIT_REG(i->src());
|
2002-12-03 00:24:09 +03:00
|
|
|
}
|
|
|
|
else {
|
2015-05-17 00:06:59 +03:00
|
|
|
bx_address eaddr = BX_CPU_RESOLVE_ADDR(i);
|
2002-12-03 00:24:09 +03:00
|
|
|
/* pointer, segment address pair */
|
2008-08-08 13:22:49 +04:00
|
|
|
op2 = read_virtual_word(i->seg(), eaddr);
|
2002-12-03 00:24:09 +03:00
|
|
|
}
|
|
|
|
|
2008-10-08 14:51:38 +04:00
|
|
|
BX_CPU_THIS_PTR prepareFPU2MMX(); /* FPU2MMX transition */
|
|
|
|
|
2015-02-24 00:17:33 +03:00
|
|
|
op1.u16(i->Ib() & 0x3) = op2;
|
2002-12-03 00:24:09 +03:00
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BX_WRITE_MMX_REG(i->dst(), op1);
|
2010-02-26 14:44:50 +03:00
|
|
|
#endif
|
2011-07-07 00:01:18 +04:00
|
|
|
|
|
|
|
BX_NEXT_INSTR(i);
|
2002-12-03 00:24:09 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/* 0F C5 */
|
2018-02-16 10:57:32 +03:00
|
|
|
void BX_CPP_AttrRegparmN(1) BX_CPU_C::PEXTRW_GdNqIb(bxInstruction_c *i)
|
2002-12-03 00:24:09 +03:00
|
|
|
{
|
2010-03-01 21:53:53 +03:00
|
|
|
#if BX_CPU_LEVEL >= 5
|
2002-12-03 00:24:09 +03:00
|
|
|
BX_CPU_THIS_PTR prepareMMX();
|
2008-10-08 14:51:38 +04:00
|
|
|
BX_CPU_THIS_PTR prepareFPU2MMX(); /* FPU2MMX transition */
|
2002-12-03 00:24:09 +03:00
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BxPackedMmxRegister op = BX_READ_MMX_REG(i->src());
|
2015-02-24 00:17:33 +03:00
|
|
|
Bit32u result = (Bit32u) op.u16(i->Ib() & 0x3);
|
2002-12-03 00:24:09 +03:00
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BX_WRITE_32BIT_REGZ(i->dst(), result);
|
2010-02-26 14:44:50 +03:00
|
|
|
#endif
|
2011-07-07 00:01:18 +04:00
|
|
|
|
|
|
|
BX_NEXT_INSTR(i);
|
2002-12-03 00:24:09 +03:00
|
|
|
}
|
|
|
|
|
2002-09-09 20:11:25 +04:00
|
|
|
/* 0F D1 */
|
2018-02-16 10:57:32 +03:00
|
|
|
void BX_CPP_AttrRegparmN(1) BX_CPU_C::PSRLW_PqQq(bxInstruction_c *i)
|
2002-09-09 20:11:25 +04:00
|
|
|
{
|
2010-03-01 21:53:53 +03:00
|
|
|
#if BX_CPU_LEVEL >= 5
|
2002-10-16 21:37:35 +04:00
|
|
|
BX_CPU_THIS_PTR prepareMMX();
|
2002-09-09 20:11:25 +04:00
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BxPackedMmxRegister op1 = BX_READ_MMX_REG(i->dst()), op2;
|
2002-09-09 20:11:25 +04:00
|
|
|
|
|
|
|
/* op2 is a register or memory reference */
|
2002-09-20 07:52:59 +04:00
|
|
|
if (i->modC0()) {
|
2012-08-05 17:52:40 +04:00
|
|
|
op2 = BX_READ_MMX_REG(i->src());
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
else {
|
2015-05-17 00:06:59 +03:00
|
|
|
bx_address eaddr = BX_CPU_RESOLVE_ADDR(i);
|
2002-09-09 20:11:25 +04:00
|
|
|
/* pointer, segment address pair */
|
2008-08-08 13:22:49 +04:00
|
|
|
MMXUQ(op2) = read_virtual_qword(i->seg(), eaddr);
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
|
2008-10-08 14:51:38 +04:00
|
|
|
BX_CPU_THIS_PTR prepareFPU2MMX(); /* FPU2MMX transition */
|
|
|
|
|
2002-09-09 20:11:25 +04:00
|
|
|
if(MMXUQ(op2) > 15) MMXUQ(op1) = 0;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Bit8u shift = MMXUB0(op2);
|
2008-02-03 00:46:54 +03:00
|
|
|
|
2002-09-09 20:11:25 +04:00
|
|
|
MMXUW0(op1) >>= shift;
|
|
|
|
MMXUW1(op1) >>= shift;
|
|
|
|
MMXUW2(op1) >>= shift;
|
|
|
|
MMXUW3(op1) >>= shift;
|
|
|
|
}
|
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BX_WRITE_MMX_REG(i->dst(), op1);
|
2010-02-26 14:44:50 +03:00
|
|
|
#endif
|
2011-07-07 00:01:18 +04:00
|
|
|
|
|
|
|
BX_NEXT_INSTR(i);
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* 0F D2 */
|
2018-02-16 10:57:32 +03:00
|
|
|
void BX_CPP_AttrRegparmN(1) BX_CPU_C::PSRLD_PqQq(bxInstruction_c *i)
|
2002-09-09 20:11:25 +04:00
|
|
|
{
|
2010-03-01 21:53:53 +03:00
|
|
|
#if BX_CPU_LEVEL >= 5
|
2002-10-16 21:37:35 +04:00
|
|
|
BX_CPU_THIS_PTR prepareMMX();
|
2002-09-09 20:11:25 +04:00
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BxPackedMmxRegister op1 = BX_READ_MMX_REG(i->dst()), op2;
|
2002-09-09 20:11:25 +04:00
|
|
|
|
|
|
|
/* op2 is a register or memory reference */
|
2002-09-20 07:52:59 +04:00
|
|
|
if (i->modC0()) {
|
2012-08-05 17:52:40 +04:00
|
|
|
op2 = BX_READ_MMX_REG(i->src());
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
else {
|
2015-05-17 00:06:59 +03:00
|
|
|
bx_address eaddr = BX_CPU_RESOLVE_ADDR(i);
|
2002-09-09 20:11:25 +04:00
|
|
|
/* pointer, segment address pair */
|
2008-08-08 13:22:49 +04:00
|
|
|
MMXUQ(op2) = read_virtual_qword(i->seg(), eaddr);
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
|
2008-10-08 14:51:38 +04:00
|
|
|
BX_CPU_THIS_PTR prepareFPU2MMX(); /* FPU2MMX transition */
|
|
|
|
|
2002-09-09 20:11:25 +04:00
|
|
|
if(MMXUQ(op2) > 31) MMXUQ(op1) = 0;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Bit8u shift = MMXUB0(op2);
|
|
|
|
|
|
|
|
MMXUD0(op1) >>= shift;
|
|
|
|
MMXUD1(op1) >>= shift;
|
|
|
|
}
|
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BX_WRITE_MMX_REG(i->dst(), op1);
|
2010-02-26 14:44:50 +03:00
|
|
|
#endif
|
2011-07-07 00:01:18 +04:00
|
|
|
|
|
|
|
BX_NEXT_INSTR(i);
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* 0F D3 */
|
2018-02-16 10:57:32 +03:00
|
|
|
void BX_CPP_AttrRegparmN(1) BX_CPU_C::PSRLQ_PqQq(bxInstruction_c *i)
|
2002-09-09 20:11:25 +04:00
|
|
|
{
|
2010-03-01 21:53:53 +03:00
|
|
|
#if BX_CPU_LEVEL >= 5
|
2002-10-16 21:37:35 +04:00
|
|
|
BX_CPU_THIS_PTR prepareMMX();
|
2002-09-09 20:11:25 +04:00
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BxPackedMmxRegister op1 = BX_READ_MMX_REG(i->dst()), op2;
|
2002-09-09 20:11:25 +04:00
|
|
|
|
|
|
|
/* op2 is a register or memory reference */
|
2002-09-20 07:52:59 +04:00
|
|
|
if (i->modC0()) {
|
2012-08-05 17:52:40 +04:00
|
|
|
op2 = BX_READ_MMX_REG(i->src());
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
else {
|
2015-05-17 00:06:59 +03:00
|
|
|
bx_address eaddr = BX_CPU_RESOLVE_ADDR(i);
|
2002-09-09 20:11:25 +04:00
|
|
|
/* pointer, segment address pair */
|
2008-08-08 13:22:49 +04:00
|
|
|
MMXUQ(op2) = read_virtual_qword(i->seg(), eaddr);
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
|
2008-10-08 14:51:38 +04:00
|
|
|
BX_CPU_THIS_PTR prepareFPU2MMX(); /* FPU2MMX transition */
|
|
|
|
|
2002-09-09 20:11:25 +04:00
|
|
|
if(MMXUQ(op2) > 63) {
|
|
|
|
MMXUQ(op1) = 0;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
MMXUQ(op1) >>= MMXUB0(op2);
|
|
|
|
}
|
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BX_WRITE_MMX_REG(i->dst(), op1);
|
2010-02-26 14:44:50 +03:00
|
|
|
#endif
|
2011-07-07 00:01:18 +04:00
|
|
|
|
|
|
|
BX_NEXT_INSTR(i);
|
2002-10-16 21:37:35 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* 0F D4 */
|
2018-02-16 10:57:32 +03:00
|
|
|
void BX_CPP_AttrRegparmN(1) BX_CPU_C::PADDQ_PqQq(bxInstruction_c *i)
|
2002-10-16 21:37:35 +04:00
|
|
|
{
|
2010-03-01 21:53:53 +03:00
|
|
|
#if BX_CPU_LEVEL >= 5
|
2002-10-16 21:37:35 +04:00
|
|
|
BX_CPU_THIS_PTR prepareMMX();
|
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BxPackedMmxRegister op1 = BX_READ_MMX_REG(i->dst()), op2;
|
2002-10-16 21:37:35 +04:00
|
|
|
|
|
|
|
/* op2 is a register or memory reference */
|
|
|
|
if (i->modC0()) {
|
2012-08-05 17:52:40 +04:00
|
|
|
op2 = BX_READ_MMX_REG(i->src());
|
2002-10-16 21:37:35 +04:00
|
|
|
}
|
|
|
|
else {
|
2015-05-17 00:06:59 +03:00
|
|
|
bx_address eaddr = BX_CPU_RESOLVE_ADDR(i);
|
2002-10-16 21:37:35 +04:00
|
|
|
/* pointer, segment address pair */
|
2008-08-08 13:22:49 +04:00
|
|
|
MMXUQ(op2) = read_virtual_qword(i->seg(), eaddr);
|
2002-10-16 21:37:35 +04:00
|
|
|
}
|
|
|
|
|
2008-10-08 14:51:38 +04:00
|
|
|
BX_CPU_THIS_PTR prepareFPU2MMX(); /* FPU2MMX transition */
|
|
|
|
|
2002-10-16 21:37:35 +04:00
|
|
|
MMXUQ(op1) += MMXUQ(op2);
|
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BX_WRITE_MMX_REG(i->dst(), op1);
|
2010-02-26 14:44:50 +03:00
|
|
|
#endif
|
2011-07-07 00:01:18 +04:00
|
|
|
|
|
|
|
BX_NEXT_INSTR(i);
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* 0F D5 */
|
2018-02-16 10:57:32 +03:00
|
|
|
void BX_CPP_AttrRegparmN(1) BX_CPU_C::PMULLW_PqQq(bxInstruction_c *i)
|
2002-09-09 20:11:25 +04:00
|
|
|
{
|
2010-03-01 21:53:53 +03:00
|
|
|
#if BX_CPU_LEVEL >= 5
|
2002-10-16 21:37:35 +04:00
|
|
|
BX_CPU_THIS_PTR prepareMMX();
|
2002-09-09 20:11:25 +04:00
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BxPackedMmxRegister op1 = BX_READ_MMX_REG(i->dst()), op2;
|
2002-09-09 20:11:25 +04:00
|
|
|
|
|
|
|
/* op2 is a register or memory reference */
|
2002-09-20 07:52:59 +04:00
|
|
|
if (i->modC0()) {
|
2012-08-05 17:52:40 +04:00
|
|
|
op2 = BX_READ_MMX_REG(i->src());
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
else {
|
2015-05-17 00:06:59 +03:00
|
|
|
bx_address eaddr = BX_CPU_RESOLVE_ADDR(i);
|
2002-09-09 20:11:25 +04:00
|
|
|
/* pointer, segment address pair */
|
2008-08-08 13:22:49 +04:00
|
|
|
MMXUQ(op2) = read_virtual_qword(i->seg(), eaddr);
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
|
2008-10-08 14:51:38 +04:00
|
|
|
BX_CPU_THIS_PTR prepareFPU2MMX(); /* FPU2MMX transition */
|
|
|
|
|
2002-10-20 00:16:42 +04:00
|
|
|
Bit32u product1 = Bit32u(MMXUW0(op1)) * Bit32u(MMXUW0(op2));
|
|
|
|
Bit32u product2 = Bit32u(MMXUW1(op1)) * Bit32u(MMXUW1(op2));
|
|
|
|
Bit32u product3 = Bit32u(MMXUW2(op1)) * Bit32u(MMXUW2(op2));
|
|
|
|
Bit32u product4 = Bit32u(MMXUW3(op1)) * Bit32u(MMXUW3(op2));
|
2002-09-09 20:11:25 +04:00
|
|
|
|
2011-01-25 23:59:26 +03:00
|
|
|
MMXUW0(op1) = product1 & 0xffff;
|
|
|
|
MMXUW1(op1) = product2 & 0xffff;
|
|
|
|
MMXUW2(op1) = product3 & 0xffff;
|
|
|
|
MMXUW3(op1) = product4 & 0xffff;
|
2002-09-09 20:11:25 +04:00
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BX_WRITE_MMX_REG(i->dst(), op1);
|
2010-02-26 14:44:50 +03:00
|
|
|
#endif
|
2011-07-07 00:01:18 +04:00
|
|
|
|
|
|
|
BX_NEXT_INSTR(i);
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
|
2002-10-20 01:46:07 +04:00
|
|
|
/* 0F D7 */
|
2018-02-16 10:57:32 +03:00
|
|
|
void BX_CPP_AttrRegparmN(1) BX_CPU_C::PMOVMSKB_GdNq(bxInstruction_c *i)
|
2002-10-20 01:46:07 +04:00
|
|
|
{
|
2010-03-01 21:53:53 +03:00
|
|
|
#if BX_CPU_LEVEL >= 5
|
2002-10-20 01:46:07 +04:00
|
|
|
BX_CPU_THIS_PTR prepareMMX();
|
2008-10-08 14:51:38 +04:00
|
|
|
BX_CPU_THIS_PTR prepareFPU2MMX(); /* FPU2MMX transition */
|
2002-10-20 01:46:07 +04:00
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BxPackedMmxRegister op = BX_READ_MMX_REG(i->src());
|
2002-10-20 01:46:07 +04:00
|
|
|
Bit32u result = 0;
|
|
|
|
|
2008-02-03 00:46:54 +03:00
|
|
|
if(MMXUB0(op) & 0x80) result |= 0x01;
|
2002-10-20 01:46:07 +04:00
|
|
|
if(MMXUB1(op) & 0x80) result |= 0x02;
|
|
|
|
if(MMXUB2(op) & 0x80) result |= 0x04;
|
|
|
|
if(MMXUB3(op) & 0x80) result |= 0x08;
|
|
|
|
if(MMXUB4(op) & 0x80) result |= 0x10;
|
|
|
|
if(MMXUB5(op) & 0x80) result |= 0x20;
|
|
|
|
if(MMXUB6(op) & 0x80) result |= 0x40;
|
|
|
|
if(MMXUB7(op) & 0x80) result |= 0x80;
|
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BX_WRITE_32BIT_REGZ(i->dst(), result);
|
2010-02-26 14:44:50 +03:00
|
|
|
#endif
|
2011-07-07 00:01:18 +04:00
|
|
|
|
|
|
|
BX_NEXT_INSTR(i);
|
2002-10-20 01:46:07 +04:00
|
|
|
}
|
|
|
|
|
2002-09-09 20:11:25 +04:00
|
|
|
/* 0F D8 */
|
2018-02-16 10:57:32 +03:00
|
|
|
void BX_CPP_AttrRegparmN(1) BX_CPU_C::PSUBUSB_PqQq(bxInstruction_c *i)
|
2002-09-09 20:11:25 +04:00
|
|
|
{
|
2010-03-01 21:53:53 +03:00
|
|
|
#if BX_CPU_LEVEL >= 5
|
2002-10-16 21:37:35 +04:00
|
|
|
BX_CPU_THIS_PTR prepareMMX();
|
2002-09-09 20:11:25 +04:00
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BxPackedMmxRegister op1 = BX_READ_MMX_REG(i->dst()), op2, result;
|
2002-09-09 20:11:25 +04:00
|
|
|
|
|
|
|
/* op2 is a register or memory reference */
|
2002-09-20 07:52:59 +04:00
|
|
|
if (i->modC0()) {
|
2012-08-05 17:52:40 +04:00
|
|
|
op2 = BX_READ_MMX_REG(i->src());
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
else {
|
2015-05-17 00:06:59 +03:00
|
|
|
bx_address eaddr = BX_CPU_RESOLVE_ADDR(i);
|
2002-09-09 20:11:25 +04:00
|
|
|
/* pointer, segment address pair */
|
2008-08-08 13:22:49 +04:00
|
|
|
MMXUQ(op2) = read_virtual_qword(i->seg(), eaddr);
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
|
2008-10-08 14:51:38 +04:00
|
|
|
BX_CPU_THIS_PTR prepareFPU2MMX(); /* FPU2MMX transition */
|
|
|
|
|
2002-09-09 20:11:25 +04:00
|
|
|
MMXUQ(result) = 0;
|
|
|
|
|
|
|
|
if(MMXUB0(op1) > MMXUB0(op2)) MMXUB0(result) = MMXUB0(op1) - MMXUB0(op2);
|
|
|
|
if(MMXUB1(op1) > MMXUB1(op2)) MMXUB1(result) = MMXUB1(op1) - MMXUB1(op2);
|
|
|
|
if(MMXUB2(op1) > MMXUB2(op2)) MMXUB2(result) = MMXUB2(op1) - MMXUB2(op2);
|
|
|
|
if(MMXUB3(op1) > MMXUB3(op2)) MMXUB3(result) = MMXUB3(op1) - MMXUB3(op2);
|
|
|
|
if(MMXUB4(op1) > MMXUB4(op2)) MMXUB4(result) = MMXUB4(op1) - MMXUB4(op2);
|
|
|
|
if(MMXUB5(op1) > MMXUB5(op2)) MMXUB5(result) = MMXUB5(op1) - MMXUB5(op2);
|
|
|
|
if(MMXUB6(op1) > MMXUB6(op2)) MMXUB6(result) = MMXUB6(op1) - MMXUB6(op2);
|
|
|
|
if(MMXUB7(op1) > MMXUB7(op2)) MMXUB7(result) = MMXUB7(op1) - MMXUB7(op2);
|
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BX_WRITE_MMX_REG(i->dst(), result);
|
2010-02-26 14:44:50 +03:00
|
|
|
#endif
|
2011-07-07 00:01:18 +04:00
|
|
|
|
|
|
|
BX_NEXT_INSTR(i);
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* 0F D9 */
|
2018-02-16 10:57:32 +03:00
|
|
|
void BX_CPP_AttrRegparmN(1) BX_CPU_C::PSUBUSW_PqQq(bxInstruction_c *i)
|
2002-09-09 20:11:25 +04:00
|
|
|
{
|
2010-03-01 21:53:53 +03:00
|
|
|
#if BX_CPU_LEVEL >= 5
|
2002-10-16 21:37:35 +04:00
|
|
|
BX_CPU_THIS_PTR prepareMMX();
|
2002-09-09 20:11:25 +04:00
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BxPackedMmxRegister op1 = BX_READ_MMX_REG(i->dst()), op2, result;
|
2002-09-09 20:11:25 +04:00
|
|
|
|
|
|
|
/* op2 is a register or memory reference */
|
2002-09-20 07:52:59 +04:00
|
|
|
if (i->modC0()) {
|
2012-08-05 17:52:40 +04:00
|
|
|
op2 = BX_READ_MMX_REG(i->src());
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
else {
|
2015-05-17 00:06:59 +03:00
|
|
|
bx_address eaddr = BX_CPU_RESOLVE_ADDR(i);
|
2002-09-09 20:11:25 +04:00
|
|
|
/* pointer, segment address pair */
|
2008-08-08 13:22:49 +04:00
|
|
|
MMXUQ(op2) = read_virtual_qword(i->seg(), eaddr);
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
|
2008-10-08 14:51:38 +04:00
|
|
|
BX_CPU_THIS_PTR prepareFPU2MMX(); /* FPU2MMX transition */
|
|
|
|
|
2002-09-09 20:11:25 +04:00
|
|
|
MMXUQ(result) = 0;
|
|
|
|
|
|
|
|
if(MMXUW0(op1) > MMXUW0(op2)) MMXUW0(result) = MMXUW0(op1) - MMXUW0(op2);
|
|
|
|
if(MMXUW1(op1) > MMXUW1(op2)) MMXUW1(result) = MMXUW1(op1) - MMXUW1(op2);
|
|
|
|
if(MMXUW2(op1) > MMXUW2(op2)) MMXUW2(result) = MMXUW2(op1) - MMXUW2(op2);
|
|
|
|
if(MMXUW3(op1) > MMXUW3(op2)) MMXUW3(result) = MMXUW3(op1) - MMXUW3(op2);
|
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BX_WRITE_MMX_REG(i->dst(), result);
|
2010-02-26 14:44:50 +03:00
|
|
|
#endif
|
2011-07-07 00:01:18 +04:00
|
|
|
|
|
|
|
BX_NEXT_INSTR(i);
|
2002-10-16 21:37:35 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* 0F DA */
|
2018-02-16 10:57:32 +03:00
|
|
|
void BX_CPP_AttrRegparmN(1) BX_CPU_C::PMINUB_PqQq(bxInstruction_c *i)
|
2002-10-16 21:37:35 +04:00
|
|
|
{
|
2010-03-01 21:53:53 +03:00
|
|
|
#if BX_CPU_LEVEL >= 5
|
2002-10-16 21:37:35 +04:00
|
|
|
BX_CPU_THIS_PTR prepareMMX();
|
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BxPackedMmxRegister op1 = BX_READ_MMX_REG(i->dst()), op2;
|
2002-10-16 21:37:35 +04:00
|
|
|
|
|
|
|
/* op2 is a register or memory reference */
|
|
|
|
if (i->modC0()) {
|
2012-08-05 17:52:40 +04:00
|
|
|
op2 = BX_READ_MMX_REG(i->src());
|
2002-10-16 21:37:35 +04:00
|
|
|
}
|
|
|
|
else {
|
2015-05-17 00:06:59 +03:00
|
|
|
bx_address eaddr = BX_CPU_RESOLVE_ADDR(i);
|
2002-10-16 21:37:35 +04:00
|
|
|
/* pointer, segment address pair */
|
2008-08-08 13:22:49 +04:00
|
|
|
MMXUQ(op2) = read_virtual_qword(i->seg(), eaddr);
|
2002-10-16 21:37:35 +04:00
|
|
|
}
|
|
|
|
|
2008-10-08 14:51:38 +04:00
|
|
|
BX_CPU_THIS_PTR prepareFPU2MMX(); /* FPU2MMX transition */
|
|
|
|
|
2002-11-08 20:47:46 +03:00
|
|
|
if(MMXUB0(op2) < MMXUB0(op1)) MMXUB0(op1) = MMXUB0(op2);
|
|
|
|
if(MMXUB1(op2) < MMXUB1(op1)) MMXUB1(op1) = MMXUB1(op2);
|
|
|
|
if(MMXUB2(op2) < MMXUB2(op1)) MMXUB2(op1) = MMXUB2(op2);
|
|
|
|
if(MMXUB3(op2) < MMXUB3(op1)) MMXUB3(op1) = MMXUB3(op2);
|
|
|
|
if(MMXUB4(op2) < MMXUB4(op1)) MMXUB4(op1) = MMXUB4(op2);
|
|
|
|
if(MMXUB5(op2) < MMXUB5(op1)) MMXUB5(op1) = MMXUB5(op2);
|
|
|
|
if(MMXUB6(op2) < MMXUB6(op1)) MMXUB6(op1) = MMXUB6(op2);
|
|
|
|
if(MMXUB7(op2) < MMXUB7(op1)) MMXUB7(op1) = MMXUB7(op2);
|
2002-10-16 21:37:35 +04:00
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BX_WRITE_MMX_REG(i->dst(), op1);
|
2010-02-26 14:44:50 +03:00
|
|
|
#endif
|
2011-07-07 00:01:18 +04:00
|
|
|
|
|
|
|
BX_NEXT_INSTR(i);
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* 0F DB */
|
2018-02-16 10:57:32 +03:00
|
|
|
void BX_CPP_AttrRegparmN(1) BX_CPU_C::PAND_PqQq(bxInstruction_c *i)
|
2002-09-09 20:11:25 +04:00
|
|
|
{
|
2010-03-01 21:53:53 +03:00
|
|
|
#if BX_CPU_LEVEL >= 5
|
2002-10-16 21:37:35 +04:00
|
|
|
BX_CPU_THIS_PTR prepareMMX();
|
2002-09-09 20:11:25 +04:00
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BxPackedMmxRegister op1 = BX_READ_MMX_REG(i->dst()), op2;
|
2002-09-09 20:11:25 +04:00
|
|
|
|
|
|
|
/* op2 is a register or memory reference */
|
2002-09-20 07:52:59 +04:00
|
|
|
if (i->modC0()) {
|
2012-08-05 17:52:40 +04:00
|
|
|
op2 = BX_READ_MMX_REG(i->src());
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
else {
|
2015-05-17 00:06:59 +03:00
|
|
|
bx_address eaddr = BX_CPU_RESOLVE_ADDR(i);
|
2002-09-09 20:11:25 +04:00
|
|
|
/* pointer, segment address pair */
|
2008-08-08 13:22:49 +04:00
|
|
|
MMXUQ(op2) = read_virtual_qword(i->seg(), eaddr);
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
|
2008-10-08 14:51:38 +04:00
|
|
|
BX_CPU_THIS_PTR prepareFPU2MMX(); /* FPU2MMX transition */
|
|
|
|
|
2002-09-09 20:11:25 +04:00
|
|
|
MMXUQ(op1) &= MMXUQ(op2);
|
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BX_WRITE_MMX_REG(i->dst(), op1);
|
2010-02-26 14:44:50 +03:00
|
|
|
#endif
|
2011-07-07 00:01:18 +04:00
|
|
|
|
|
|
|
BX_NEXT_INSTR(i);
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* 0F DC */
|
2018-02-16 10:57:32 +03:00
|
|
|
void BX_CPP_AttrRegparmN(1) BX_CPU_C::PADDUSB_PqQq(bxInstruction_c *i)
|
2002-09-09 20:11:25 +04:00
|
|
|
{
|
2010-03-01 21:53:53 +03:00
|
|
|
#if BX_CPU_LEVEL >= 5
|
2002-10-16 21:37:35 +04:00
|
|
|
BX_CPU_THIS_PTR prepareMMX();
|
2002-09-09 20:11:25 +04:00
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BxPackedMmxRegister op1 = BX_READ_MMX_REG(i->dst()), op2;
|
2002-09-09 20:11:25 +04:00
|
|
|
|
|
|
|
/* op2 is a register or memory reference */
|
2002-09-20 07:52:59 +04:00
|
|
|
if (i->modC0()) {
|
2012-08-05 17:52:40 +04:00
|
|
|
op2 = BX_READ_MMX_REG(i->src());
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
else {
|
2015-05-17 00:06:59 +03:00
|
|
|
bx_address eaddr = BX_CPU_RESOLVE_ADDR(i);
|
2002-09-09 20:11:25 +04:00
|
|
|
/* pointer, segment address pair */
|
2008-08-08 13:22:49 +04:00
|
|
|
MMXUQ(op2) = read_virtual_qword(i->seg(), eaddr);
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
|
2008-10-08 14:51:38 +04:00
|
|
|
BX_CPU_THIS_PTR prepareFPU2MMX(); /* FPU2MMX transition */
|
|
|
|
|
2011-01-16 23:42:28 +03:00
|
|
|
MMXUB0(op1) = SaturateWordSToByteU(Bit16s(MMXUB0(op1)) + Bit16s(MMXUB0(op2)));
|
|
|
|
MMXUB1(op1) = SaturateWordSToByteU(Bit16s(MMXUB1(op1)) + Bit16s(MMXUB1(op2)));
|
|
|
|
MMXUB2(op1) = SaturateWordSToByteU(Bit16s(MMXUB2(op1)) + Bit16s(MMXUB2(op2)));
|
|
|
|
MMXUB3(op1) = SaturateWordSToByteU(Bit16s(MMXUB3(op1)) + Bit16s(MMXUB3(op2)));
|
|
|
|
|
|
|
|
MMXUB4(op1) = SaturateWordSToByteU(Bit16s(MMXUB4(op1)) + Bit16s(MMXUB4(op2)));
|
|
|
|
MMXUB5(op1) = SaturateWordSToByteU(Bit16s(MMXUB5(op1)) + Bit16s(MMXUB5(op2)));
|
|
|
|
MMXUB6(op1) = SaturateWordSToByteU(Bit16s(MMXUB6(op1)) + Bit16s(MMXUB6(op2)));
|
|
|
|
MMXUB7(op1) = SaturateWordSToByteU(Bit16s(MMXUB7(op1)) + Bit16s(MMXUB7(op2)));
|
2002-09-09 20:11:25 +04:00
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BX_WRITE_MMX_REG(i->dst(), op1);
|
2010-02-26 14:44:50 +03:00
|
|
|
#endif
|
2011-07-07 00:01:18 +04:00
|
|
|
|
|
|
|
BX_NEXT_INSTR(i);
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* 0F DD */
|
2018-02-16 10:57:32 +03:00
|
|
|
void BX_CPP_AttrRegparmN(1) BX_CPU_C::PADDUSW_PqQq(bxInstruction_c *i)
|
2002-09-09 20:11:25 +04:00
|
|
|
{
|
2010-03-01 21:53:53 +03:00
|
|
|
#if BX_CPU_LEVEL >= 5
|
2002-10-16 21:37:35 +04:00
|
|
|
BX_CPU_THIS_PTR prepareMMX();
|
2002-09-09 20:11:25 +04:00
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BxPackedMmxRegister op1 = BX_READ_MMX_REG(i->dst()), op2;
|
2002-09-09 20:11:25 +04:00
|
|
|
|
|
|
|
/* op2 is a register or memory reference */
|
2002-09-20 07:52:59 +04:00
|
|
|
if (i->modC0()) {
|
2012-08-05 17:52:40 +04:00
|
|
|
op2 = BX_READ_MMX_REG(i->src());
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
else {
|
2015-05-17 00:06:59 +03:00
|
|
|
bx_address eaddr = BX_CPU_RESOLVE_ADDR(i);
|
2002-09-09 20:11:25 +04:00
|
|
|
/* pointer, segment address pair */
|
2008-08-08 13:22:49 +04:00
|
|
|
MMXUQ(op2) = read_virtual_qword(i->seg(), eaddr);
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
|
2008-10-08 14:51:38 +04:00
|
|
|
BX_CPU_THIS_PTR prepareFPU2MMX(); /* FPU2MMX transition */
|
|
|
|
|
2011-01-16 23:42:28 +03:00
|
|
|
MMXUW0(op1) = SaturateDwordSToWordU(Bit32s(MMXUW0(op1)) + Bit32s(MMXUW0(op2)));
|
|
|
|
MMXUW1(op1) = SaturateDwordSToWordU(Bit32s(MMXUW1(op1)) + Bit32s(MMXUW1(op2)));
|
|
|
|
MMXUW2(op1) = SaturateDwordSToWordU(Bit32s(MMXUW2(op1)) + Bit32s(MMXUW2(op2)));
|
|
|
|
MMXUW3(op1) = SaturateDwordSToWordU(Bit32s(MMXUW3(op1)) + Bit32s(MMXUW3(op2)));
|
2002-09-09 20:11:25 +04:00
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BX_WRITE_MMX_REG(i->dst(), op1);
|
2010-02-26 14:44:50 +03:00
|
|
|
#endif
|
2011-07-07 00:01:18 +04:00
|
|
|
|
|
|
|
BX_NEXT_INSTR(i);
|
2002-10-16 21:37:35 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* 0F DE */
|
2018-02-16 10:57:32 +03:00
|
|
|
void BX_CPP_AttrRegparmN(1) BX_CPU_C::PMAXUB_PqQq(bxInstruction_c *i)
|
2002-10-16 21:37:35 +04:00
|
|
|
{
|
2010-03-01 21:53:53 +03:00
|
|
|
#if BX_CPU_LEVEL >= 5
|
2002-10-16 21:37:35 +04:00
|
|
|
BX_CPU_THIS_PTR prepareMMX();
|
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BxPackedMmxRegister op1 = BX_READ_MMX_REG(i->dst()), op2;
|
2002-10-16 21:37:35 +04:00
|
|
|
|
|
|
|
/* op2 is a register or memory reference */
|
|
|
|
if (i->modC0()) {
|
2012-08-05 17:52:40 +04:00
|
|
|
op2 = BX_READ_MMX_REG(i->src());
|
2002-10-16 21:37:35 +04:00
|
|
|
}
|
|
|
|
else {
|
2015-05-17 00:06:59 +03:00
|
|
|
bx_address eaddr = BX_CPU_RESOLVE_ADDR(i);
|
2002-10-16 21:37:35 +04:00
|
|
|
/* pointer, segment address pair */
|
2008-08-08 13:22:49 +04:00
|
|
|
MMXUQ(op2) = read_virtual_qword(i->seg(), eaddr);
|
2002-10-16 21:37:35 +04:00
|
|
|
}
|
|
|
|
|
2008-10-08 14:51:38 +04:00
|
|
|
BX_CPU_THIS_PTR prepareFPU2MMX(); /* FPU2MMX transition */
|
|
|
|
|
2002-11-08 20:47:46 +03:00
|
|
|
if(MMXUB0(op2) > MMXUB0(op1)) MMXUB0(op1) = MMXUB0(op2);
|
|
|
|
if(MMXUB1(op2) > MMXUB1(op1)) MMXUB1(op1) = MMXUB1(op2);
|
|
|
|
if(MMXUB2(op2) > MMXUB2(op1)) MMXUB2(op1) = MMXUB2(op2);
|
|
|
|
if(MMXUB3(op2) > MMXUB3(op1)) MMXUB3(op1) = MMXUB3(op2);
|
|
|
|
if(MMXUB4(op2) > MMXUB4(op1)) MMXUB4(op1) = MMXUB4(op2);
|
|
|
|
if(MMXUB5(op2) > MMXUB5(op1)) MMXUB5(op1) = MMXUB5(op2);
|
|
|
|
if(MMXUB6(op2) > MMXUB6(op1)) MMXUB6(op1) = MMXUB6(op2);
|
|
|
|
if(MMXUB7(op2) > MMXUB7(op1)) MMXUB7(op1) = MMXUB7(op2);
|
2002-10-16 21:37:35 +04:00
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BX_WRITE_MMX_REG(i->dst(), op1);
|
2010-02-26 14:44:50 +03:00
|
|
|
#endif
|
2011-07-07 00:01:18 +04:00
|
|
|
|
|
|
|
BX_NEXT_INSTR(i);
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* 0F DF */
|
2018-02-16 10:57:32 +03:00
|
|
|
void BX_CPP_AttrRegparmN(1) BX_CPU_C::PANDN_PqQq(bxInstruction_c *i)
|
2002-09-09 20:11:25 +04:00
|
|
|
{
|
2010-03-01 21:53:53 +03:00
|
|
|
#if BX_CPU_LEVEL >= 5
|
2002-10-16 21:37:35 +04:00
|
|
|
BX_CPU_THIS_PTR prepareMMX();
|
2002-09-09 20:11:25 +04:00
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BxPackedMmxRegister op1 = BX_READ_MMX_REG(i->dst()), op2;
|
2002-09-09 20:11:25 +04:00
|
|
|
|
|
|
|
/* op2 is a register or memory reference */
|
2002-09-20 07:52:59 +04:00
|
|
|
if (i->modC0()) {
|
2012-08-05 17:52:40 +04:00
|
|
|
op2 = BX_READ_MMX_REG(i->src());
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
else {
|
2015-05-17 00:06:59 +03:00
|
|
|
bx_address eaddr = BX_CPU_RESOLVE_ADDR(i);
|
2002-09-09 20:11:25 +04:00
|
|
|
/* pointer, segment address pair */
|
2008-08-08 13:22:49 +04:00
|
|
|
MMXUQ(op2) = read_virtual_qword(i->seg(), eaddr);
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
|
2008-10-08 14:51:38 +04:00
|
|
|
BX_CPU_THIS_PTR prepareFPU2MMX(); /* FPU2MMX transition */
|
|
|
|
|
2003-09-26 23:20:17 +04:00
|
|
|
MMXUQ(op1) = ~(MMXUQ(op1)) & MMXUQ(op2);
|
2002-09-09 20:11:25 +04:00
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BX_WRITE_MMX_REG(i->dst(), op1);
|
2010-02-26 14:44:50 +03:00
|
|
|
#endif
|
2011-07-07 00:01:18 +04:00
|
|
|
|
|
|
|
BX_NEXT_INSTR(i);
|
2002-10-16 21:37:35 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* 0F E0 */
|
2018-02-16 10:57:32 +03:00
|
|
|
void BX_CPP_AttrRegparmN(1) BX_CPU_C::PAVGB_PqQq(bxInstruction_c *i)
|
2002-10-16 21:37:35 +04:00
|
|
|
{
|
2010-03-01 21:53:53 +03:00
|
|
|
#if BX_CPU_LEVEL >= 5
|
2002-10-16 21:37:35 +04:00
|
|
|
BX_CPU_THIS_PTR prepareMMX();
|
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BxPackedMmxRegister op1 = BX_READ_MMX_REG(i->dst()), op2;
|
2002-10-16 21:37:35 +04:00
|
|
|
|
|
|
|
/* op2 is a register or memory reference */
|
|
|
|
if (i->modC0()) {
|
2012-08-05 17:52:40 +04:00
|
|
|
op2 = BX_READ_MMX_REG(i->src());
|
2002-10-16 21:37:35 +04:00
|
|
|
}
|
|
|
|
else {
|
2015-05-17 00:06:59 +03:00
|
|
|
bx_address eaddr = BX_CPU_RESOLVE_ADDR(i);
|
2002-10-16 21:37:35 +04:00
|
|
|
/* pointer, segment address pair */
|
2008-08-08 13:22:49 +04:00
|
|
|
MMXUQ(op2) = read_virtual_qword(i->seg(), eaddr);
|
2002-10-16 21:37:35 +04:00
|
|
|
}
|
|
|
|
|
2008-10-08 14:51:38 +04:00
|
|
|
BX_CPU_THIS_PTR prepareFPU2MMX(); /* FPU2MMX transition */
|
|
|
|
|
2003-05-15 20:41:17 +04:00
|
|
|
MMXUB0(op1) = (MMXUB0(op1) + MMXUB0(op2) + 1) >> 1;
|
|
|
|
MMXUB1(op1) = (MMXUB1(op1) + MMXUB1(op2) + 1) >> 1;
|
|
|
|
MMXUB2(op1) = (MMXUB2(op1) + MMXUB2(op2) + 1) >> 1;
|
|
|
|
MMXUB3(op1) = (MMXUB3(op1) + MMXUB3(op2) + 1) >> 1;
|
|
|
|
MMXUB4(op1) = (MMXUB4(op1) + MMXUB4(op2) + 1) >> 1;
|
|
|
|
MMXUB5(op1) = (MMXUB5(op1) + MMXUB5(op2) + 1) >> 1;
|
|
|
|
MMXUB6(op1) = (MMXUB6(op1) + MMXUB6(op2) + 1) >> 1;
|
|
|
|
MMXUB7(op1) = (MMXUB7(op1) + MMXUB7(op2) + 1) >> 1;
|
2002-10-16 21:37:35 +04:00
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BX_WRITE_MMX_REG(i->dst(), op1);
|
2010-02-26 14:44:50 +03:00
|
|
|
#endif
|
2011-07-07 00:01:18 +04:00
|
|
|
|
|
|
|
BX_NEXT_INSTR(i);
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* 0F E1 */
|
2018-02-16 10:57:32 +03:00
|
|
|
void BX_CPP_AttrRegparmN(1) BX_CPU_C::PSRAW_PqQq(bxInstruction_c *i)
|
2002-09-09 20:11:25 +04:00
|
|
|
{
|
2010-03-01 21:53:53 +03:00
|
|
|
#if BX_CPU_LEVEL >= 5
|
2002-10-16 21:37:35 +04:00
|
|
|
BX_CPU_THIS_PTR prepareMMX();
|
2002-09-09 20:11:25 +04:00
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BxPackedMmxRegister op1 = BX_READ_MMX_REG(i->dst()), op2;
|
2002-09-09 20:11:25 +04:00
|
|
|
|
|
|
|
/* op2 is a register or memory reference */
|
2002-09-20 07:52:59 +04:00
|
|
|
if (i->modC0()) {
|
2012-08-05 17:52:40 +04:00
|
|
|
op2 = BX_READ_MMX_REG(i->src());
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
else {
|
2015-05-17 00:06:59 +03:00
|
|
|
bx_address eaddr = BX_CPU_RESOLVE_ADDR(i);
|
2002-09-09 20:11:25 +04:00
|
|
|
/* pointer, segment address pair */
|
2008-08-08 13:22:49 +04:00
|
|
|
MMXUQ(op2) = read_virtual_qword(i->seg(), eaddr);
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
|
2008-10-08 14:51:38 +04:00
|
|
|
BX_CPU_THIS_PTR prepareFPU2MMX(); /* FPU2MMX transition */
|
|
|
|
|
2020-12-15 23:05:54 +03:00
|
|
|
if(MMXUQ(op2)) {
|
|
|
|
if(MMXUQ(op2) > 15) {
|
|
|
|
MMXUW0(op1) = (MMXSW0(op1) < 0) ? 0xffff : 0;
|
|
|
|
MMXUW1(op1) = (MMXSW1(op1) < 0) ? 0xffff : 0;
|
|
|
|
MMXUW2(op1) = (MMXSW2(op1) < 0) ? 0xffff : 0;
|
|
|
|
MMXUW3(op1) = (MMXSW3(op1) < 0) ? 0xffff : 0;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
Bit8u shift = MMXUB0(op2);
|
|
|
|
|
|
|
|
MMXUW0(op1) = (Bit16u)(MMXSW0(op1) >> shift);
|
|
|
|
MMXUW1(op1) = (Bit16u)(MMXSW1(op1) >> shift);
|
|
|
|
MMXUW2(op1) = (Bit16u)(MMXSW2(op1) >> shift);
|
|
|
|
MMXUW3(op1) = (Bit16u)(MMXSW3(op1) >> shift);
|
|
|
|
}
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BX_WRITE_MMX_REG(i->dst(), op1);
|
2010-02-26 14:44:50 +03:00
|
|
|
#endif
|
2011-07-07 00:01:18 +04:00
|
|
|
|
|
|
|
BX_NEXT_INSTR(i);
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* 0F E2 */
|
2018-02-16 10:57:32 +03:00
|
|
|
void BX_CPP_AttrRegparmN(1) BX_CPU_C::PSRAD_PqQq(bxInstruction_c *i)
|
2002-09-09 20:11:25 +04:00
|
|
|
{
|
2010-03-01 21:53:53 +03:00
|
|
|
#if BX_CPU_LEVEL >= 5
|
2002-10-16 21:37:35 +04:00
|
|
|
BX_CPU_THIS_PTR prepareMMX();
|
2002-09-09 20:11:25 +04:00
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BxPackedMmxRegister op1 = BX_READ_MMX_REG(i->dst()), op2;
|
2002-09-09 20:11:25 +04:00
|
|
|
|
|
|
|
/* op2 is a register or memory reference */
|
2002-09-20 07:52:59 +04:00
|
|
|
if (i->modC0()) {
|
2012-08-05 17:52:40 +04:00
|
|
|
op2 = BX_READ_MMX_REG(i->src());
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
else {
|
2015-05-17 00:06:59 +03:00
|
|
|
bx_address eaddr = BX_CPU_RESOLVE_ADDR(i);
|
2002-09-09 20:11:25 +04:00
|
|
|
/* pointer, segment address pair */
|
2008-08-08 13:22:49 +04:00
|
|
|
MMXUQ(op2) = read_virtual_qword(i->seg(), eaddr);
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
|
2008-10-08 14:51:38 +04:00
|
|
|
BX_CPU_THIS_PTR prepareFPU2MMX(); /* FPU2MMX transition */
|
|
|
|
|
2020-12-15 23:05:54 +03:00
|
|
|
if(MMXUQ(op2)) {
|
|
|
|
if(MMXUQ(op2) > 31) {
|
|
|
|
MMXUD0(op1) = (MMXSD0(op1) < 0) ? 0xffffffff : 0;
|
|
|
|
MMXUD1(op1) = (MMXSD1(op1) < 0) ? 0xffffffff : 0;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
Bit8u shift = MMXUB0(op2);
|
2006-02-22 23:58:16 +03:00
|
|
|
|
2020-12-15 23:05:54 +03:00
|
|
|
MMXUD0(op1) = (Bit32u)(MMXSD0(op1) >> shift);
|
|
|
|
MMXUD1(op1) = (Bit32u)(MMXSD1(op1) >> shift);
|
|
|
|
}
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
2020-12-15 23:05:54 +03:00
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BX_WRITE_MMX_REG(i->dst(), op1);
|
2010-02-26 14:44:50 +03:00
|
|
|
#endif
|
2011-07-07 00:01:18 +04:00
|
|
|
|
|
|
|
BX_NEXT_INSTR(i);
|
2002-10-16 21:37:35 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* 0F E3 */
|
2018-02-16 10:57:32 +03:00
|
|
|
void BX_CPP_AttrRegparmN(1) BX_CPU_C::PAVGW_PqQq(bxInstruction_c *i)
|
2002-10-16 21:37:35 +04:00
|
|
|
{
|
2010-03-01 21:53:53 +03:00
|
|
|
#if BX_CPU_LEVEL >= 5
|
2002-10-16 21:37:35 +04:00
|
|
|
BX_CPU_THIS_PTR prepareMMX();
|
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BxPackedMmxRegister op1 = BX_READ_MMX_REG(i->dst()), op2;
|
2002-10-16 21:37:35 +04:00
|
|
|
|
|
|
|
/* op2 is a register or memory reference */
|
|
|
|
if (i->modC0()) {
|
2012-08-05 17:52:40 +04:00
|
|
|
op2 = BX_READ_MMX_REG(i->src());
|
2002-10-16 21:37:35 +04:00
|
|
|
}
|
|
|
|
else {
|
2015-05-17 00:06:59 +03:00
|
|
|
bx_address eaddr = BX_CPU_RESOLVE_ADDR(i);
|
2002-10-16 21:37:35 +04:00
|
|
|
/* pointer, segment address pair */
|
2008-08-08 13:22:49 +04:00
|
|
|
MMXUQ(op2) = read_virtual_qword(i->seg(), eaddr);
|
2002-10-16 21:37:35 +04:00
|
|
|
}
|
|
|
|
|
2008-10-08 14:51:38 +04:00
|
|
|
BX_CPU_THIS_PTR prepareFPU2MMX(); /* FPU2MMX transition */
|
|
|
|
|
2003-05-15 20:41:17 +04:00
|
|
|
MMXUW0(op1) = (MMXUW0(op1) + MMXUW0(op2) + 1) >> 1;
|
|
|
|
MMXUW1(op1) = (MMXUW1(op1) + MMXUW1(op2) + 1) >> 1;
|
|
|
|
MMXUW2(op1) = (MMXUW2(op1) + MMXUW2(op2) + 1) >> 1;
|
|
|
|
MMXUW3(op1) = (MMXUW3(op1) + MMXUW3(op2) + 1) >> 1;
|
2002-10-16 21:37:35 +04:00
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BX_WRITE_MMX_REG(i->dst(), op1);
|
2010-02-26 14:44:50 +03:00
|
|
|
#endif
|
2011-07-07 00:01:18 +04:00
|
|
|
|
|
|
|
BX_NEXT_INSTR(i);
|
2002-10-16 21:37:35 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* 0F E4 */
|
2018-02-16 10:57:32 +03:00
|
|
|
void BX_CPP_AttrRegparmN(1) BX_CPU_C::PMULHUW_PqQq(bxInstruction_c *i)
|
2002-10-16 21:37:35 +04:00
|
|
|
{
|
2010-03-01 21:53:53 +03:00
|
|
|
#if BX_CPU_LEVEL >= 5
|
2002-10-16 21:37:35 +04:00
|
|
|
BX_CPU_THIS_PTR prepareMMX();
|
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BxPackedMmxRegister op1 = BX_READ_MMX_REG(i->dst()), op2;
|
2002-10-16 21:37:35 +04:00
|
|
|
|
|
|
|
/* op2 is a register or memory reference */
|
|
|
|
if (i->modC0()) {
|
2012-08-05 17:52:40 +04:00
|
|
|
op2 = BX_READ_MMX_REG(i->src());
|
2002-10-16 21:37:35 +04:00
|
|
|
}
|
|
|
|
else {
|
2015-05-17 00:06:59 +03:00
|
|
|
bx_address eaddr = BX_CPU_RESOLVE_ADDR(i);
|
2002-10-16 21:37:35 +04:00
|
|
|
/* pointer, segment address pair */
|
2008-08-08 13:22:49 +04:00
|
|
|
MMXUQ(op2) = read_virtual_qword(i->seg(), eaddr);
|
2002-10-16 21:37:35 +04:00
|
|
|
}
|
|
|
|
|
2008-10-08 14:51:38 +04:00
|
|
|
BX_CPU_THIS_PTR prepareFPU2MMX(); /* FPU2MMX transition */
|
|
|
|
|
2002-10-20 00:16:42 +04:00
|
|
|
Bit32u product1 = Bit32u(MMXUW0(op1)) * Bit32u(MMXUW0(op2));
|
|
|
|
Bit32u product2 = Bit32u(MMXUW1(op1)) * Bit32u(MMXUW1(op2));
|
|
|
|
Bit32u product3 = Bit32u(MMXUW2(op1)) * Bit32u(MMXUW2(op2));
|
|
|
|
Bit32u product4 = Bit32u(MMXUW3(op1)) * Bit32u(MMXUW3(op2));
|
2002-10-16 21:37:35 +04:00
|
|
|
|
2011-01-25 23:59:26 +03:00
|
|
|
MMXUW0(op1) = (Bit16u)(product1 >> 16);
|
|
|
|
MMXUW1(op1) = (Bit16u)(product2 >> 16);
|
|
|
|
MMXUW2(op1) = (Bit16u)(product3 >> 16);
|
|
|
|
MMXUW3(op1) = (Bit16u)(product4 >> 16);
|
2002-10-16 21:37:35 +04:00
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BX_WRITE_MMX_REG(i->dst(), op1);
|
2010-02-26 14:44:50 +03:00
|
|
|
#endif
|
2011-07-07 00:01:18 +04:00
|
|
|
|
|
|
|
BX_NEXT_INSTR(i);
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* 0F E5 */
|
2018-02-16 10:57:32 +03:00
|
|
|
void BX_CPP_AttrRegparmN(1) BX_CPU_C::PMULHW_PqQq(bxInstruction_c *i)
|
2002-09-09 20:11:25 +04:00
|
|
|
{
|
2010-03-01 21:53:53 +03:00
|
|
|
#if BX_CPU_LEVEL >= 5
|
2002-10-16 21:37:35 +04:00
|
|
|
BX_CPU_THIS_PTR prepareMMX();
|
2002-09-09 20:11:25 +04:00
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BxPackedMmxRegister op1 = BX_READ_MMX_REG(i->dst()), op2;
|
2002-09-09 20:11:25 +04:00
|
|
|
|
|
|
|
/* op2 is a register or memory reference */
|
2002-09-20 07:52:59 +04:00
|
|
|
if (i->modC0()) {
|
2012-08-05 17:52:40 +04:00
|
|
|
op2 = BX_READ_MMX_REG(i->src());
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
else {
|
2015-05-17 00:06:59 +03:00
|
|
|
bx_address eaddr = BX_CPU_RESOLVE_ADDR(i);
|
2002-09-09 20:11:25 +04:00
|
|
|
/* pointer, segment address pair */
|
2008-08-08 13:22:49 +04:00
|
|
|
MMXUQ(op2) = read_virtual_qword(i->seg(), eaddr);
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
|
2008-10-08 14:51:38 +04:00
|
|
|
BX_CPU_THIS_PTR prepareFPU2MMX(); /* FPU2MMX transition */
|
|
|
|
|
2002-10-20 00:16:42 +04:00
|
|
|
Bit32s product1 = Bit32s(MMXSW0(op1)) * Bit32s(MMXSW0(op2));
|
|
|
|
Bit32s product2 = Bit32s(MMXSW1(op1)) * Bit32s(MMXSW1(op2));
|
|
|
|
Bit32s product3 = Bit32s(MMXSW2(op1)) * Bit32s(MMXSW2(op2));
|
|
|
|
Bit32s product4 = Bit32s(MMXSW3(op1)) * Bit32s(MMXSW3(op2));
|
2002-09-09 20:11:25 +04:00
|
|
|
|
2011-01-25 23:59:26 +03:00
|
|
|
MMXUW0(op1) = Bit16u(product1 >> 16);
|
|
|
|
MMXUW1(op1) = Bit16u(product2 >> 16);
|
|
|
|
MMXUW2(op1) = Bit16u(product3 >> 16);
|
|
|
|
MMXUW3(op1) = Bit16u(product4 >> 16);
|
2002-09-09 20:11:25 +04:00
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BX_WRITE_MMX_REG(i->dst(), op1);
|
2010-02-26 14:44:50 +03:00
|
|
|
#endif
|
2011-07-07 00:01:18 +04:00
|
|
|
|
|
|
|
BX_NEXT_INSTR(i);
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* 0F E8 */
|
2018-02-16 10:57:32 +03:00
|
|
|
void BX_CPP_AttrRegparmN(1) BX_CPU_C::PSUBSB_PqQq(bxInstruction_c *i)
|
2002-09-09 20:11:25 +04:00
|
|
|
{
|
2010-03-01 21:53:53 +03:00
|
|
|
#if BX_CPU_LEVEL >= 5
|
2002-10-16 21:37:35 +04:00
|
|
|
BX_CPU_THIS_PTR prepareMMX();
|
2002-09-09 20:11:25 +04:00
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BxPackedMmxRegister op1 = BX_READ_MMX_REG(i->dst()), op2;
|
2002-09-09 20:11:25 +04:00
|
|
|
|
|
|
|
/* op2 is a register or memory reference */
|
2002-09-20 07:52:59 +04:00
|
|
|
if (i->modC0()) {
|
2012-08-05 17:52:40 +04:00
|
|
|
op2 = BX_READ_MMX_REG(i->src());
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
else {
|
2015-05-17 00:06:59 +03:00
|
|
|
bx_address eaddr = BX_CPU_RESOLVE_ADDR(i);
|
2002-09-09 20:11:25 +04:00
|
|
|
/* pointer, segment address pair */
|
2008-08-08 13:22:49 +04:00
|
|
|
MMXUQ(op2) = read_virtual_qword(i->seg(), eaddr);
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
|
2008-10-08 14:51:38 +04:00
|
|
|
BX_CPU_THIS_PTR prepareFPU2MMX(); /* FPU2MMX transition */
|
|
|
|
|
2010-12-25 20:04:36 +03:00
|
|
|
MMXSB0(op1) = SaturateWordSToByteS(Bit16s(MMXSB0(op1)) - Bit16s(MMXSB0(op2)));
|
|
|
|
MMXSB1(op1) = SaturateWordSToByteS(Bit16s(MMXSB1(op1)) - Bit16s(MMXSB1(op2)));
|
|
|
|
MMXSB2(op1) = SaturateWordSToByteS(Bit16s(MMXSB2(op1)) - Bit16s(MMXSB2(op2)));
|
|
|
|
MMXSB3(op1) = SaturateWordSToByteS(Bit16s(MMXSB3(op1)) - Bit16s(MMXSB3(op2)));
|
|
|
|
MMXSB4(op1) = SaturateWordSToByteS(Bit16s(MMXSB4(op1)) - Bit16s(MMXSB4(op2)));
|
|
|
|
MMXSB5(op1) = SaturateWordSToByteS(Bit16s(MMXSB5(op1)) - Bit16s(MMXSB5(op2)));
|
|
|
|
MMXSB6(op1) = SaturateWordSToByteS(Bit16s(MMXSB6(op1)) - Bit16s(MMXSB6(op2)));
|
|
|
|
MMXSB7(op1) = SaturateWordSToByteS(Bit16s(MMXSB7(op1)) - Bit16s(MMXSB7(op2)));
|
2002-09-09 20:11:25 +04:00
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BX_WRITE_MMX_REG(i->dst(), op1);
|
2010-02-26 14:44:50 +03:00
|
|
|
#endif
|
2011-07-07 00:01:18 +04:00
|
|
|
|
|
|
|
BX_NEXT_INSTR(i);
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* 0F E9 */
|
2018-02-16 10:57:32 +03:00
|
|
|
void BX_CPP_AttrRegparmN(1) BX_CPU_C::PSUBSW_PqQq(bxInstruction_c *i)
|
2002-09-09 20:11:25 +04:00
|
|
|
{
|
2010-03-01 21:53:53 +03:00
|
|
|
#if BX_CPU_LEVEL >= 5
|
2002-10-16 21:37:35 +04:00
|
|
|
BX_CPU_THIS_PTR prepareMMX();
|
2002-09-09 20:11:25 +04:00
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BxPackedMmxRegister op1 = BX_READ_MMX_REG(i->dst()), op2;
|
2002-09-09 20:11:25 +04:00
|
|
|
|
|
|
|
/* op2 is a register or memory reference */
|
2002-09-20 07:52:59 +04:00
|
|
|
if (i->modC0()) {
|
2012-08-05 17:52:40 +04:00
|
|
|
op2 = BX_READ_MMX_REG(i->src());
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
else {
|
2015-05-17 00:06:59 +03:00
|
|
|
bx_address eaddr = BX_CPU_RESOLVE_ADDR(i);
|
2002-09-09 20:11:25 +04:00
|
|
|
/* pointer, segment address pair */
|
2008-08-08 13:22:49 +04:00
|
|
|
MMXUQ(op2) = read_virtual_qword(i->seg(), eaddr);
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
|
2008-10-08 14:51:38 +04:00
|
|
|
BX_CPU_THIS_PTR prepareFPU2MMX(); /* FPU2MMX transition */
|
|
|
|
|
2010-12-25 20:04:36 +03:00
|
|
|
MMXSW0(op1) = SaturateDwordSToWordS(Bit32s(MMXSW0(op1)) - Bit32s(MMXSW0(op2)));
|
|
|
|
MMXSW1(op1) = SaturateDwordSToWordS(Bit32s(MMXSW1(op1)) - Bit32s(MMXSW1(op2)));
|
|
|
|
MMXSW2(op1) = SaturateDwordSToWordS(Bit32s(MMXSW2(op1)) - Bit32s(MMXSW2(op2)));
|
|
|
|
MMXSW3(op1) = SaturateDwordSToWordS(Bit32s(MMXSW3(op1)) - Bit32s(MMXSW3(op2)));
|
2002-09-09 20:11:25 +04:00
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BX_WRITE_MMX_REG(i->dst(), op1);
|
2010-02-26 14:44:50 +03:00
|
|
|
#endif
|
2011-07-07 00:01:18 +04:00
|
|
|
|
|
|
|
BX_NEXT_INSTR(i);
|
2002-10-16 21:37:35 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* 0F EA */
|
2018-02-16 10:57:32 +03:00
|
|
|
void BX_CPP_AttrRegparmN(1) BX_CPU_C::PMINSW_PqQq(bxInstruction_c *i)
|
2002-10-16 21:37:35 +04:00
|
|
|
{
|
2010-03-01 21:53:53 +03:00
|
|
|
#if BX_CPU_LEVEL >= 5
|
2002-10-16 21:37:35 +04:00
|
|
|
BX_CPU_THIS_PTR prepareMMX();
|
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BxPackedMmxRegister op1 = BX_READ_MMX_REG(i->dst()), op2;
|
2002-10-16 21:37:35 +04:00
|
|
|
|
|
|
|
/* op2 is a register or memory reference */
|
|
|
|
if (i->modC0()) {
|
2012-08-05 17:52:40 +04:00
|
|
|
op2 = BX_READ_MMX_REG(i->src());
|
2002-10-16 21:37:35 +04:00
|
|
|
}
|
|
|
|
else {
|
2015-05-17 00:06:59 +03:00
|
|
|
bx_address eaddr = BX_CPU_RESOLVE_ADDR(i);
|
2002-10-16 21:37:35 +04:00
|
|
|
/* pointer, segment address pair */
|
2008-08-08 13:22:49 +04:00
|
|
|
MMXUQ(op2) = read_virtual_qword(i->seg(), eaddr);
|
2002-10-16 21:37:35 +04:00
|
|
|
}
|
|
|
|
|
2008-10-08 14:51:38 +04:00
|
|
|
BX_CPU_THIS_PTR prepareFPU2MMX(); /* FPU2MMX transition */
|
|
|
|
|
2002-11-08 20:47:46 +03:00
|
|
|
if(MMXSW0(op2) < MMXSW0(op1)) MMXSW0(op1) = MMXSW0(op2);
|
|
|
|
if(MMXSW1(op2) < MMXSW1(op1)) MMXSW1(op1) = MMXSW1(op2);
|
|
|
|
if(MMXSW2(op2) < MMXSW2(op1)) MMXSW2(op1) = MMXSW2(op2);
|
|
|
|
if(MMXSW3(op2) < MMXSW3(op1)) MMXSW3(op1) = MMXSW3(op2);
|
2002-10-16 21:37:35 +04:00
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BX_WRITE_MMX_REG(i->dst(), op1);
|
2010-02-26 14:44:50 +03:00
|
|
|
#endif
|
2011-07-07 00:01:18 +04:00
|
|
|
|
|
|
|
BX_NEXT_INSTR(i);
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* 0F EB */
|
2018-02-16 10:57:32 +03:00
|
|
|
void BX_CPP_AttrRegparmN(1) BX_CPU_C::POR_PqQq(bxInstruction_c *i)
|
2002-09-09 20:11:25 +04:00
|
|
|
{
|
2010-03-01 21:53:53 +03:00
|
|
|
#if BX_CPU_LEVEL >= 5
|
2002-10-16 21:37:35 +04:00
|
|
|
BX_CPU_THIS_PTR prepareMMX();
|
2002-09-09 20:11:25 +04:00
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BxPackedMmxRegister op1 = BX_READ_MMX_REG(i->dst()), op2;
|
2002-09-09 20:11:25 +04:00
|
|
|
|
|
|
|
/* op2 is a register or memory reference */
|
2002-09-20 07:52:59 +04:00
|
|
|
if (i->modC0()) {
|
2012-08-05 17:52:40 +04:00
|
|
|
op2 = BX_READ_MMX_REG(i->src());
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
else {
|
2015-05-17 00:06:59 +03:00
|
|
|
bx_address eaddr = BX_CPU_RESOLVE_ADDR(i);
|
2002-09-09 20:11:25 +04:00
|
|
|
/* pointer, segment address pair */
|
2008-08-08 13:22:49 +04:00
|
|
|
MMXUQ(op2) = read_virtual_qword(i->seg(), eaddr);
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
|
2008-10-08 14:51:38 +04:00
|
|
|
BX_CPU_THIS_PTR prepareFPU2MMX(); /* FPU2MMX transition */
|
|
|
|
|
2002-09-09 20:11:25 +04:00
|
|
|
MMXUQ(op1) |= MMXUQ(op2);
|
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BX_WRITE_MMX_REG(i->dst(), op1);
|
2010-02-26 14:44:50 +03:00
|
|
|
#endif
|
2011-07-07 00:01:18 +04:00
|
|
|
|
|
|
|
BX_NEXT_INSTR(i);
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* 0F EC */
|
2018-02-16 10:57:32 +03:00
|
|
|
void BX_CPP_AttrRegparmN(1) BX_CPU_C::PADDSB_PqQq(bxInstruction_c *i)
|
2002-09-09 20:11:25 +04:00
|
|
|
{
|
2010-03-01 21:53:53 +03:00
|
|
|
#if BX_CPU_LEVEL >= 5
|
2002-10-16 21:37:35 +04:00
|
|
|
BX_CPU_THIS_PTR prepareMMX();
|
2002-09-09 20:11:25 +04:00
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BxPackedMmxRegister op1 = BX_READ_MMX_REG(i->dst()), op2;
|
2002-09-09 20:11:25 +04:00
|
|
|
|
|
|
|
/* op2 is a register or memory reference */
|
2002-09-20 07:52:59 +04:00
|
|
|
if (i->modC0()) {
|
2012-08-05 17:52:40 +04:00
|
|
|
op2 = BX_READ_MMX_REG(i->src());
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
else {
|
2015-05-17 00:06:59 +03:00
|
|
|
bx_address eaddr = BX_CPU_RESOLVE_ADDR(i);
|
2002-09-09 20:11:25 +04:00
|
|
|
/* pointer, segment address pair */
|
2008-08-08 13:22:49 +04:00
|
|
|
MMXUQ(op2) = read_virtual_qword(i->seg(), eaddr);
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
|
2008-10-08 14:51:38 +04:00
|
|
|
BX_CPU_THIS_PTR prepareFPU2MMX(); /* FPU2MMX transition */
|
|
|
|
|
2010-12-25 20:04:36 +03:00
|
|
|
MMXSB0(op1) = SaturateWordSToByteS(Bit16s(MMXSB0(op1)) + Bit16s(MMXSB0(op2)));
|
|
|
|
MMXSB1(op1) = SaturateWordSToByteS(Bit16s(MMXSB1(op1)) + Bit16s(MMXSB1(op2)));
|
|
|
|
MMXSB2(op1) = SaturateWordSToByteS(Bit16s(MMXSB2(op1)) + Bit16s(MMXSB2(op2)));
|
|
|
|
MMXSB3(op1) = SaturateWordSToByteS(Bit16s(MMXSB3(op1)) + Bit16s(MMXSB3(op2)));
|
|
|
|
MMXSB4(op1) = SaturateWordSToByteS(Bit16s(MMXSB4(op1)) + Bit16s(MMXSB4(op2)));
|
|
|
|
MMXSB5(op1) = SaturateWordSToByteS(Bit16s(MMXSB5(op1)) + Bit16s(MMXSB5(op2)));
|
|
|
|
MMXSB6(op1) = SaturateWordSToByteS(Bit16s(MMXSB6(op1)) + Bit16s(MMXSB6(op2)));
|
|
|
|
MMXSB7(op1) = SaturateWordSToByteS(Bit16s(MMXSB7(op1)) + Bit16s(MMXSB7(op2)));
|
2002-09-09 20:11:25 +04:00
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BX_WRITE_MMX_REG(i->dst(), op1);
|
2010-02-26 14:44:50 +03:00
|
|
|
#endif
|
2011-07-07 00:01:18 +04:00
|
|
|
|
|
|
|
BX_NEXT_INSTR(i);
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* 0F ED */
|
2018-02-16 10:57:32 +03:00
|
|
|
void BX_CPP_AttrRegparmN(1) BX_CPU_C::PADDSW_PqQq(bxInstruction_c *i)
|
2002-09-09 20:11:25 +04:00
|
|
|
{
|
2010-03-01 21:53:53 +03:00
|
|
|
#if BX_CPU_LEVEL >= 5
|
2002-10-16 21:37:35 +04:00
|
|
|
BX_CPU_THIS_PTR prepareMMX();
|
2002-09-09 20:11:25 +04:00
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BxPackedMmxRegister op1 = BX_READ_MMX_REG(i->dst()), op2;
|
2002-09-09 20:11:25 +04:00
|
|
|
|
|
|
|
/* op2 is a register or memory reference */
|
2002-09-20 07:52:59 +04:00
|
|
|
if (i->modC0()) {
|
2012-08-05 17:52:40 +04:00
|
|
|
op2 = BX_READ_MMX_REG(i->src());
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
else {
|
2015-05-17 00:06:59 +03:00
|
|
|
bx_address eaddr = BX_CPU_RESOLVE_ADDR(i);
|
2002-09-09 20:11:25 +04:00
|
|
|
/* pointer, segment address pair */
|
2008-08-08 13:22:49 +04:00
|
|
|
MMXUQ(op2) = read_virtual_qword(i->seg(), eaddr);
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
|
2008-10-08 14:51:38 +04:00
|
|
|
BX_CPU_THIS_PTR prepareFPU2MMX(); /* FPU2MMX transition */
|
|
|
|
|
2010-12-25 20:04:36 +03:00
|
|
|
MMXSW0(op1) = SaturateDwordSToWordS(Bit32s(MMXSW0(op1)) + Bit32s(MMXSW0(op2)));
|
|
|
|
MMXSW1(op1) = SaturateDwordSToWordS(Bit32s(MMXSW1(op1)) + Bit32s(MMXSW1(op2)));
|
|
|
|
MMXSW2(op1) = SaturateDwordSToWordS(Bit32s(MMXSW2(op1)) + Bit32s(MMXSW2(op2)));
|
|
|
|
MMXSW3(op1) = SaturateDwordSToWordS(Bit32s(MMXSW3(op1)) + Bit32s(MMXSW3(op2)));
|
2002-09-09 20:11:25 +04:00
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BX_WRITE_MMX_REG(i->dst(), op1);
|
2010-02-26 14:44:50 +03:00
|
|
|
#endif
|
2011-07-07 00:01:18 +04:00
|
|
|
|
|
|
|
BX_NEXT_INSTR(i);
|
2002-10-16 21:37:35 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* 0F EE */
|
2018-02-16 10:57:32 +03:00
|
|
|
void BX_CPP_AttrRegparmN(1) BX_CPU_C::PMAXSW_PqQq(bxInstruction_c *i)
|
2002-10-16 21:37:35 +04:00
|
|
|
{
|
2010-03-01 21:53:53 +03:00
|
|
|
#if BX_CPU_LEVEL >= 5
|
2002-10-16 21:37:35 +04:00
|
|
|
BX_CPU_THIS_PTR prepareMMX();
|
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BxPackedMmxRegister op1 = BX_READ_MMX_REG(i->dst()), op2;
|
2002-10-16 21:37:35 +04:00
|
|
|
|
|
|
|
/* op2 is a register or memory reference */
|
|
|
|
if (i->modC0()) {
|
2012-08-05 17:52:40 +04:00
|
|
|
op2 = BX_READ_MMX_REG(i->src());
|
2002-10-16 21:37:35 +04:00
|
|
|
}
|
|
|
|
else {
|
2015-05-17 00:06:59 +03:00
|
|
|
bx_address eaddr = BX_CPU_RESOLVE_ADDR(i);
|
2002-10-16 21:37:35 +04:00
|
|
|
/* pointer, segment address pair */
|
2008-08-08 13:22:49 +04:00
|
|
|
MMXUQ(op2) = read_virtual_qword(i->seg(), eaddr);
|
2002-10-16 21:37:35 +04:00
|
|
|
}
|
|
|
|
|
2008-10-08 14:51:38 +04:00
|
|
|
BX_CPU_THIS_PTR prepareFPU2MMX(); /* FPU2MMX transition */
|
|
|
|
|
2002-11-08 20:47:46 +03:00
|
|
|
if(MMXSW0(op2) > MMXSW0(op1)) MMXSW0(op1) = MMXSW0(op2);
|
|
|
|
if(MMXSW1(op2) > MMXSW1(op1)) MMXSW1(op1) = MMXSW1(op2);
|
|
|
|
if(MMXSW2(op2) > MMXSW2(op1)) MMXSW2(op1) = MMXSW2(op2);
|
|
|
|
if(MMXSW3(op2) > MMXSW3(op1)) MMXSW3(op1) = MMXSW3(op2);
|
2002-10-16 21:37:35 +04:00
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BX_WRITE_MMX_REG(i->dst(), op1);
|
2010-02-26 14:44:50 +03:00
|
|
|
#endif
|
2011-07-07 00:01:18 +04:00
|
|
|
|
|
|
|
BX_NEXT_INSTR(i);
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* 0F EF */
|
2018-02-16 10:57:32 +03:00
|
|
|
void BX_CPP_AttrRegparmN(1) BX_CPU_C::PXOR_PqQq(bxInstruction_c *i)
|
2002-09-09 20:11:25 +04:00
|
|
|
{
|
2010-03-01 21:53:53 +03:00
|
|
|
#if BX_CPU_LEVEL >= 5
|
2002-10-16 21:37:35 +04:00
|
|
|
BX_CPU_THIS_PTR prepareMMX();
|
2002-09-09 20:11:25 +04:00
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BxPackedMmxRegister op1 = BX_READ_MMX_REG(i->dst()), op2;
|
2002-09-09 20:11:25 +04:00
|
|
|
|
|
|
|
/* op2 is a register or memory reference */
|
2002-09-20 07:52:59 +04:00
|
|
|
if (i->modC0()) {
|
2012-08-05 17:52:40 +04:00
|
|
|
op2 = BX_READ_MMX_REG(i->src());
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
else {
|
2015-05-17 00:06:59 +03:00
|
|
|
bx_address eaddr = BX_CPU_RESOLVE_ADDR(i);
|
2002-09-09 20:11:25 +04:00
|
|
|
/* pointer, segment address pair */
|
2008-08-08 13:22:49 +04:00
|
|
|
MMXUQ(op2) = read_virtual_qword(i->seg(), eaddr);
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
|
2008-10-08 14:51:38 +04:00
|
|
|
BX_CPU_THIS_PTR prepareFPU2MMX(); /* FPU2MMX transition */
|
|
|
|
|
2002-09-09 20:11:25 +04:00
|
|
|
MMXUQ(op1) ^= MMXUQ(op2);
|
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BX_WRITE_MMX_REG(i->dst(), op1);
|
2010-02-26 14:44:50 +03:00
|
|
|
#endif
|
2011-07-07 00:01:18 +04:00
|
|
|
|
|
|
|
BX_NEXT_INSTR(i);
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* 0F F1 */
|
2018-02-16 10:57:32 +03:00
|
|
|
void BX_CPP_AttrRegparmN(1) BX_CPU_C::PSLLW_PqQq(bxInstruction_c *i)
|
2002-09-09 20:11:25 +04:00
|
|
|
{
|
2010-03-01 21:53:53 +03:00
|
|
|
#if BX_CPU_LEVEL >= 5
|
2002-10-16 21:37:35 +04:00
|
|
|
BX_CPU_THIS_PTR prepareMMX();
|
2002-09-09 20:11:25 +04:00
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BxPackedMmxRegister op1 = BX_READ_MMX_REG(i->dst()), op2;
|
2002-09-09 20:11:25 +04:00
|
|
|
|
|
|
|
/* op2 is a register or memory reference */
|
2002-09-20 07:52:59 +04:00
|
|
|
if (i->modC0()) {
|
2012-08-05 17:52:40 +04:00
|
|
|
op2 = BX_READ_MMX_REG(i->src());
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
else {
|
2015-05-17 00:06:59 +03:00
|
|
|
bx_address eaddr = BX_CPU_RESOLVE_ADDR(i);
|
2002-09-09 20:11:25 +04:00
|
|
|
/* pointer, segment address pair */
|
2008-08-08 13:22:49 +04:00
|
|
|
MMXUQ(op2) = read_virtual_qword(i->seg(), eaddr);
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
|
2008-10-08 14:51:38 +04:00
|
|
|
BX_CPU_THIS_PTR prepareFPU2MMX(); /* FPU2MMX transition */
|
|
|
|
|
2002-09-09 20:11:25 +04:00
|
|
|
if(MMXUQ(op2) > 15) MMXUQ(op1) = 0;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Bit8u shift = MMXUB0(op2);
|
|
|
|
|
|
|
|
MMXUW0(op1) <<= shift;
|
|
|
|
MMXUW1(op1) <<= shift;
|
|
|
|
MMXUW2(op1) <<= shift;
|
|
|
|
MMXUW3(op1) <<= shift;
|
|
|
|
}
|
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BX_WRITE_MMX_REG(i->dst(), op1);
|
2010-02-26 14:44:50 +03:00
|
|
|
#endif
|
2011-07-07 00:01:18 +04:00
|
|
|
|
|
|
|
BX_NEXT_INSTR(i);
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* 0F F2 */
|
2018-02-16 10:57:32 +03:00
|
|
|
void BX_CPP_AttrRegparmN(1) BX_CPU_C::PSLLD_PqQq(bxInstruction_c *i)
|
2002-09-09 20:11:25 +04:00
|
|
|
{
|
2010-03-01 21:53:53 +03:00
|
|
|
#if BX_CPU_LEVEL >= 5
|
2002-10-16 21:37:35 +04:00
|
|
|
BX_CPU_THIS_PTR prepareMMX();
|
2002-09-09 20:11:25 +04:00
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BxPackedMmxRegister op1 = BX_READ_MMX_REG(i->dst()), op2;
|
2002-09-09 20:11:25 +04:00
|
|
|
|
|
|
|
/* op2 is a register or memory reference */
|
2002-09-20 07:52:59 +04:00
|
|
|
if (i->modC0()) {
|
2012-08-05 17:52:40 +04:00
|
|
|
op2 = BX_READ_MMX_REG(i->src());
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
else {
|
2015-05-17 00:06:59 +03:00
|
|
|
bx_address eaddr = BX_CPU_RESOLVE_ADDR(i);
|
2002-09-09 20:11:25 +04:00
|
|
|
/* pointer, segment address pair */
|
2008-08-08 13:22:49 +04:00
|
|
|
MMXUQ(op2) = read_virtual_qword(i->seg(), eaddr);
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
|
2008-10-08 14:51:38 +04:00
|
|
|
BX_CPU_THIS_PTR prepareFPU2MMX(); /* FPU2MMX transition */
|
|
|
|
|
2002-09-09 20:11:25 +04:00
|
|
|
if(MMXUQ(op2) > 31) MMXUQ(op1) = 0;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Bit8u shift = MMXUB0(op2);
|
|
|
|
|
|
|
|
MMXUD0(op1) <<= shift;
|
|
|
|
MMXUD1(op1) <<= shift;
|
|
|
|
}
|
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BX_WRITE_MMX_REG(i->dst(), op1);
|
2010-02-26 14:44:50 +03:00
|
|
|
#endif
|
2011-07-07 00:01:18 +04:00
|
|
|
|
|
|
|
BX_NEXT_INSTR(i);
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* 0F F3 */
|
2018-02-16 10:57:32 +03:00
|
|
|
void BX_CPP_AttrRegparmN(1) BX_CPU_C::PSLLQ_PqQq(bxInstruction_c *i)
|
2002-09-09 20:11:25 +04:00
|
|
|
{
|
2010-03-01 21:53:53 +03:00
|
|
|
#if BX_CPU_LEVEL >= 5
|
2002-10-16 21:37:35 +04:00
|
|
|
BX_CPU_THIS_PTR prepareMMX();
|
2002-09-09 20:11:25 +04:00
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BxPackedMmxRegister op1 = BX_READ_MMX_REG(i->dst()), op2;
|
2002-09-09 20:11:25 +04:00
|
|
|
|
|
|
|
/* op2 is a register or memory reference */
|
2002-09-20 07:52:59 +04:00
|
|
|
if (i->modC0()) {
|
2012-08-05 17:52:40 +04:00
|
|
|
op2 = BX_READ_MMX_REG(i->src());
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
else {
|
2015-05-17 00:06:59 +03:00
|
|
|
bx_address eaddr = BX_CPU_RESOLVE_ADDR(i);
|
2002-09-09 20:11:25 +04:00
|
|
|
/* pointer, segment address pair */
|
2008-08-08 13:22:49 +04:00
|
|
|
MMXUQ(op2) = read_virtual_qword(i->seg(), eaddr);
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
|
2008-10-08 14:51:38 +04:00
|
|
|
BX_CPU_THIS_PTR prepareFPU2MMX(); /* FPU2MMX transition */
|
|
|
|
|
2002-09-09 20:11:25 +04:00
|
|
|
if(MMXUQ(op2) > 63) {
|
|
|
|
MMXUQ(op1) = 0;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
MMXUQ(op1) <<= MMXUB0(op2);
|
|
|
|
}
|
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BX_WRITE_MMX_REG(i->dst(), op1);
|
2010-02-26 14:44:50 +03:00
|
|
|
#endif
|
2011-07-07 00:01:18 +04:00
|
|
|
|
|
|
|
BX_NEXT_INSTR(i);
|
2002-10-16 21:37:35 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* 0F F4 */
|
2018-02-16 10:57:32 +03:00
|
|
|
void BX_CPP_AttrRegparmN(1) BX_CPU_C::PMULUDQ_PqQq(bxInstruction_c *i)
|
2002-10-16 21:37:35 +04:00
|
|
|
{
|
2010-03-01 21:53:53 +03:00
|
|
|
#if BX_CPU_LEVEL >= 5
|
2002-10-16 21:37:35 +04:00
|
|
|
BX_CPU_THIS_PTR prepareMMX();
|
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BxPackedMmxRegister op1 = BX_READ_MMX_REG(i->dst()), op2;
|
2002-10-16 21:37:35 +04:00
|
|
|
|
|
|
|
/* op2 is a register or memory reference */
|
|
|
|
if (i->modC0()) {
|
2012-08-05 17:52:40 +04:00
|
|
|
op2 = BX_READ_MMX_REG(i->src());
|
2002-10-16 21:37:35 +04:00
|
|
|
}
|
|
|
|
else {
|
2015-05-17 00:06:59 +03:00
|
|
|
bx_address eaddr = BX_CPU_RESOLVE_ADDR(i);
|
2002-10-16 21:37:35 +04:00
|
|
|
/* pointer, segment address pair */
|
2008-08-08 13:22:49 +04:00
|
|
|
MMXUQ(op2) = read_virtual_qword(i->seg(), eaddr);
|
2002-10-16 21:37:35 +04:00
|
|
|
}
|
|
|
|
|
2008-10-08 14:51:38 +04:00
|
|
|
BX_CPU_THIS_PTR prepareFPU2MMX(); /* FPU2MMX transition */
|
|
|
|
|
2010-12-25 20:04:36 +03:00
|
|
|
MMXUQ(op1) = Bit64u(MMXUD0(op1)) * Bit64u(MMXUD0(op2));
|
2002-10-16 21:37:35 +04:00
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BX_WRITE_MMX_REG(i->dst(), op1);
|
2010-02-26 14:44:50 +03:00
|
|
|
#endif
|
2011-07-07 00:01:18 +04:00
|
|
|
|
|
|
|
BX_NEXT_INSTR(i);
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* 0F F5 */
|
2018-02-16 10:57:32 +03:00
|
|
|
void BX_CPP_AttrRegparmN(1) BX_CPU_C::PMADDWD_PqQq(bxInstruction_c *i)
|
2002-09-09 20:11:25 +04:00
|
|
|
{
|
2010-03-01 21:53:53 +03:00
|
|
|
#if BX_CPU_LEVEL >= 5
|
2002-10-16 21:37:35 +04:00
|
|
|
BX_CPU_THIS_PTR prepareMMX();
|
2002-09-09 20:11:25 +04:00
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BxPackedMmxRegister op1 = BX_READ_MMX_REG(i->dst()), op2;
|
2002-09-09 20:11:25 +04:00
|
|
|
|
|
|
|
/* op2 is a register or memory reference */
|
2002-09-20 07:52:59 +04:00
|
|
|
if (i->modC0()) {
|
2012-08-05 17:52:40 +04:00
|
|
|
op2 = BX_READ_MMX_REG(i->src());
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
else {
|
2015-05-17 00:06:59 +03:00
|
|
|
bx_address eaddr = BX_CPU_RESOLVE_ADDR(i);
|
2002-09-09 20:11:25 +04:00
|
|
|
/* pointer, segment address pair */
|
2008-08-08 13:22:49 +04:00
|
|
|
MMXUQ(op2) = read_virtual_qword(i->seg(), eaddr);
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
|
2008-10-08 14:51:38 +04:00
|
|
|
BX_CPU_THIS_PTR prepareFPU2MMX(); /* FPU2MMX transition */
|
|
|
|
|
2002-11-15 18:51:12 +03:00
|
|
|
if(MMXUD0(op1) == 0x80008000 && MMXUD0(op2) == 0x80008000) {
|
2011-01-17 00:01:28 +03:00
|
|
|
MMXUD0(op1) = 0x80000000;
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
else {
|
2011-01-17 00:01:28 +03:00
|
|
|
MMXUD0(op1) = Bit32s(MMXSW0(op1))*Bit32s(MMXSW0(op2)) + Bit32s(MMXSW1(op1))*Bit32s(MMXSW1(op2));
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
|
2002-11-15 18:55:36 +03:00
|
|
|
if(MMXUD1(op1) == 0x80008000 && MMXUD1(op2) == 0x80008000) {
|
2011-01-17 00:01:28 +03:00
|
|
|
MMXUD1(op1) = 0x80000000;
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
else {
|
2011-01-17 00:01:28 +03:00
|
|
|
MMXUD1(op1) = Bit32s(MMXSW2(op1))*Bit32s(MMXSW2(op2)) + Bit32s(MMXSW3(op1))*Bit32s(MMXSW3(op2));
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BX_WRITE_MMX_REG(i->dst(), op1);
|
2010-02-26 14:44:50 +03:00
|
|
|
#endif
|
2011-07-07 00:01:18 +04:00
|
|
|
|
|
|
|
BX_NEXT_INSTR(i);
|
2002-10-16 21:37:35 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* 0F F6 */
|
2018-02-16 10:57:32 +03:00
|
|
|
void BX_CPP_AttrRegparmN(1) BX_CPU_C::PSADBW_PqQq(bxInstruction_c *i)
|
2002-10-16 21:37:35 +04:00
|
|
|
{
|
2010-03-01 21:53:53 +03:00
|
|
|
#if BX_CPU_LEVEL >= 5
|
2002-10-16 21:37:35 +04:00
|
|
|
BX_CPU_THIS_PTR prepareMMX();
|
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BxPackedMmxRegister op1 = BX_READ_MMX_REG(i->dst()), op2;
|
2002-10-16 21:37:35 +04:00
|
|
|
Bit16u temp = 0;
|
|
|
|
|
|
|
|
/* op2 is a register or memory reference */
|
|
|
|
if (i->modC0()) {
|
2012-08-05 17:52:40 +04:00
|
|
|
op2 = BX_READ_MMX_REG(i->src());
|
2002-10-16 21:37:35 +04:00
|
|
|
}
|
|
|
|
else {
|
2015-05-17 00:06:59 +03:00
|
|
|
bx_address eaddr = BX_CPU_RESOLVE_ADDR(i);
|
2002-10-16 21:37:35 +04:00
|
|
|
/* pointer, segment address pair */
|
2008-08-08 13:22:49 +04:00
|
|
|
MMXUQ(op2) = read_virtual_qword(i->seg(), eaddr);
|
2002-10-16 21:37:35 +04:00
|
|
|
}
|
|
|
|
|
2008-10-08 14:51:38 +04:00
|
|
|
BX_CPU_THIS_PTR prepareFPU2MMX(); /* FPU2MMX transition */
|
|
|
|
|
2002-10-16 21:37:35 +04:00
|
|
|
temp += abs(MMXUB0(op1) - MMXUB0(op2));
|
|
|
|
temp += abs(MMXUB1(op1) - MMXUB1(op2));
|
|
|
|
temp += abs(MMXUB2(op1) - MMXUB2(op2));
|
|
|
|
temp += abs(MMXUB3(op1) - MMXUB3(op2));
|
|
|
|
temp += abs(MMXUB4(op1) - MMXUB4(op2));
|
|
|
|
temp += abs(MMXUB5(op1) - MMXUB5(op2));
|
|
|
|
temp += abs(MMXUB6(op1) - MMXUB6(op2));
|
|
|
|
temp += abs(MMXUB7(op1) - MMXUB7(op2));
|
|
|
|
|
2007-12-27 02:07:44 +03:00
|
|
|
MMXUQ(op1) = (Bit64u) temp;
|
2002-10-16 21:37:35 +04:00
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BX_WRITE_MMX_REG(i->dst(), op1);
|
2010-02-26 14:44:50 +03:00
|
|
|
#endif
|
2011-07-07 00:01:18 +04:00
|
|
|
|
|
|
|
BX_NEXT_INSTR(i);
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
|
2003-04-13 01:02:08 +04:00
|
|
|
/* 0F F7 */
|
2018-02-16 10:57:32 +03:00
|
|
|
void BX_CPP_AttrRegparmN(1) BX_CPU_C::MASKMOVQ_PqNq(bxInstruction_c *i)
|
2003-04-13 01:02:08 +04:00
|
|
|
{
|
2010-03-01 21:53:53 +03:00
|
|
|
#if BX_CPU_LEVEL >= 5
|
2003-04-23 22:57:57 +04:00
|
|
|
BX_CPU_THIS_PTR prepareMMX();
|
2008-10-08 14:51:38 +04:00
|
|
|
BX_CPU_THIS_PTR prepareFPU2MMX(); /* FPU2MMX transition */
|
2003-04-23 22:57:57 +04:00
|
|
|
|
2010-12-25 20:04:36 +03:00
|
|
|
bx_address rdi = RDI & i->asize_mask();
|
2012-08-05 17:52:40 +04:00
|
|
|
BxPackedMmxRegister op = BX_READ_MMX_REG(i->src1()), tmp,
|
|
|
|
mask = BX_READ_MMX_REG(i->src2());
|
2003-04-23 22:57:57 +04:00
|
|
|
|
2007-12-20 02:21:11 +03:00
|
|
|
/* do read-modify-write for efficiency */
|
2008-04-16 09:41:43 +04:00
|
|
|
MMXUQ(tmp) = read_RMW_virtual_qword(i->seg(), rdi);
|
2007-12-20 02:21:11 +03:00
|
|
|
|
2011-07-07 00:01:18 +04:00
|
|
|
if(!MMXUQ(mask)) {
|
|
|
|
BX_NEXT_INSTR(i);
|
|
|
|
}
|
2009-11-13 12:55:22 +03:00
|
|
|
|
2007-12-20 02:21:11 +03:00
|
|
|
if(MMXUB0(mask) & 0x80) MMXUB0(tmp) = MMXUB0(op);
|
|
|
|
if(MMXUB1(mask) & 0x80) MMXUB1(tmp) = MMXUB1(op);
|
|
|
|
if(MMXUB2(mask) & 0x80) MMXUB2(tmp) = MMXUB2(op);
|
|
|
|
if(MMXUB3(mask) & 0x80) MMXUB3(tmp) = MMXUB3(op);
|
|
|
|
if(MMXUB4(mask) & 0x80) MMXUB4(tmp) = MMXUB4(op);
|
|
|
|
if(MMXUB5(mask) & 0x80) MMXUB5(tmp) = MMXUB5(op);
|
|
|
|
if(MMXUB6(mask) & 0x80) MMXUB6(tmp) = MMXUB6(op);
|
|
|
|
if(MMXUB7(mask) & 0x80) MMXUB7(tmp) = MMXUB7(op);
|
|
|
|
|
2015-01-25 23:55:10 +03:00
|
|
|
write_RMW_linear_qword(MMXUQ(tmp));
|
2010-02-26 14:44:50 +03:00
|
|
|
#endif
|
2011-07-07 00:01:18 +04:00
|
|
|
|
|
|
|
BX_NEXT_INSTR(i);
|
2003-04-13 01:02:08 +04:00
|
|
|
}
|
|
|
|
|
2002-09-09 20:11:25 +04:00
|
|
|
/* 0F F8 */
|
2018-02-16 10:57:32 +03:00
|
|
|
void BX_CPP_AttrRegparmN(1) BX_CPU_C::PSUBB_PqQq(bxInstruction_c *i)
|
2002-09-09 20:11:25 +04:00
|
|
|
{
|
2010-03-01 21:53:53 +03:00
|
|
|
#if BX_CPU_LEVEL >= 5
|
2002-10-16 21:37:35 +04:00
|
|
|
BX_CPU_THIS_PTR prepareMMX();
|
2002-09-09 20:11:25 +04:00
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BxPackedMmxRegister op1 = BX_READ_MMX_REG(i->dst()), op2;
|
2002-09-09 20:11:25 +04:00
|
|
|
|
|
|
|
/* op2 is a register or memory reference */
|
2002-09-20 07:52:59 +04:00
|
|
|
if (i->modC0()) {
|
2012-08-05 17:52:40 +04:00
|
|
|
op2 = BX_READ_MMX_REG(i->src());
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
else {
|
2015-05-17 00:06:59 +03:00
|
|
|
bx_address eaddr = BX_CPU_RESOLVE_ADDR(i);
|
2002-09-09 20:11:25 +04:00
|
|
|
/* pointer, segment address pair */
|
2008-08-08 13:22:49 +04:00
|
|
|
MMXUQ(op2) = read_virtual_qword(i->seg(), eaddr);
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
|
2008-10-08 14:51:38 +04:00
|
|
|
BX_CPU_THIS_PTR prepareFPU2MMX(); /* FPU2MMX transition */
|
|
|
|
|
2002-09-09 20:11:25 +04:00
|
|
|
MMXUB0(op1) -= MMXUB0(op2);
|
|
|
|
MMXUB1(op1) -= MMXUB1(op2);
|
|
|
|
MMXUB2(op1) -= MMXUB2(op2);
|
|
|
|
MMXUB3(op1) -= MMXUB3(op2);
|
|
|
|
MMXUB4(op1) -= MMXUB4(op2);
|
|
|
|
MMXUB5(op1) -= MMXUB5(op2);
|
|
|
|
MMXUB6(op1) -= MMXUB6(op2);
|
|
|
|
MMXUB7(op1) -= MMXUB7(op2);
|
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BX_WRITE_MMX_REG(i->dst(), op1);
|
2010-02-26 14:44:50 +03:00
|
|
|
#endif
|
2011-07-07 00:01:18 +04:00
|
|
|
|
|
|
|
BX_NEXT_INSTR(i);
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* 0F F9 */
|
2018-02-16 10:57:32 +03:00
|
|
|
void BX_CPP_AttrRegparmN(1) BX_CPU_C::PSUBW_PqQq(bxInstruction_c *i)
|
2002-09-09 20:11:25 +04:00
|
|
|
{
|
2010-03-01 21:53:53 +03:00
|
|
|
#if BX_CPU_LEVEL >= 5
|
2002-10-16 21:37:35 +04:00
|
|
|
BX_CPU_THIS_PTR prepareMMX();
|
2002-09-09 20:11:25 +04:00
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BxPackedMmxRegister op1 = BX_READ_MMX_REG(i->dst()), op2;
|
2002-09-09 20:11:25 +04:00
|
|
|
|
|
|
|
/* op2 is a register or memory reference */
|
2002-09-20 07:52:59 +04:00
|
|
|
if (i->modC0()) {
|
2012-08-05 17:52:40 +04:00
|
|
|
op2 = BX_READ_MMX_REG(i->src());
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
else {
|
2015-05-17 00:06:59 +03:00
|
|
|
bx_address eaddr = BX_CPU_RESOLVE_ADDR(i);
|
2002-09-09 20:11:25 +04:00
|
|
|
/* pointer, segment address pair */
|
2008-08-08 13:22:49 +04:00
|
|
|
MMXUQ(op2) = read_virtual_qword(i->seg(), eaddr);
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
|
2008-10-08 14:51:38 +04:00
|
|
|
BX_CPU_THIS_PTR prepareFPU2MMX(); /* FPU2MMX transition */
|
|
|
|
|
2002-09-09 20:11:25 +04:00
|
|
|
MMXUW0(op1) -= MMXUW0(op2);
|
|
|
|
MMXUW1(op1) -= MMXUW1(op2);
|
|
|
|
MMXUW2(op1) -= MMXUW2(op2);
|
|
|
|
MMXUW3(op1) -= MMXUW3(op2);
|
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BX_WRITE_MMX_REG(i->dst(), op1);
|
2010-02-26 14:44:50 +03:00
|
|
|
#endif
|
2011-07-07 00:01:18 +04:00
|
|
|
|
|
|
|
BX_NEXT_INSTR(i);
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* 0F FA */
|
2018-02-16 10:57:32 +03:00
|
|
|
void BX_CPP_AttrRegparmN(1) BX_CPU_C::PSUBD_PqQq(bxInstruction_c *i)
|
2002-09-09 20:11:25 +04:00
|
|
|
{
|
2010-03-01 21:53:53 +03:00
|
|
|
#if BX_CPU_LEVEL >= 5
|
2002-10-16 21:37:35 +04:00
|
|
|
BX_CPU_THIS_PTR prepareMMX();
|
2002-09-09 20:11:25 +04:00
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BxPackedMmxRegister op1 = BX_READ_MMX_REG(i->dst()), op2;
|
2002-09-09 20:11:25 +04:00
|
|
|
|
|
|
|
/* op2 is a register or memory reference */
|
2002-09-20 07:52:59 +04:00
|
|
|
if (i->modC0()) {
|
2012-08-05 17:52:40 +04:00
|
|
|
op2 = BX_READ_MMX_REG(i->src());
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
else {
|
2015-05-17 00:06:59 +03:00
|
|
|
bx_address eaddr = BX_CPU_RESOLVE_ADDR(i);
|
2002-09-09 20:11:25 +04:00
|
|
|
/* pointer, segment address pair */
|
2008-08-08 13:22:49 +04:00
|
|
|
MMXUQ(op2) = read_virtual_qword(i->seg(), eaddr);
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
|
2008-10-08 14:51:38 +04:00
|
|
|
BX_CPU_THIS_PTR prepareFPU2MMX(); /* FPU2MMX transition */
|
|
|
|
|
2002-09-09 20:11:25 +04:00
|
|
|
MMXUD0(op1) -= MMXUD0(op2);
|
|
|
|
MMXUD1(op1) -= MMXUD1(op2);
|
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BX_WRITE_MMX_REG(i->dst(), op1);
|
2010-02-26 14:44:50 +03:00
|
|
|
#endif
|
2011-07-07 00:01:18 +04:00
|
|
|
|
|
|
|
BX_NEXT_INSTR(i);
|
2002-10-16 21:37:35 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* 0F FB */
|
2018-02-16 10:57:32 +03:00
|
|
|
void BX_CPP_AttrRegparmN(1) BX_CPU_C::PSUBQ_PqQq(bxInstruction_c *i)
|
2002-10-16 21:37:35 +04:00
|
|
|
{
|
2010-03-01 21:53:53 +03:00
|
|
|
#if BX_CPU_LEVEL >= 5
|
2002-10-16 21:37:35 +04:00
|
|
|
BX_CPU_THIS_PTR prepareMMX();
|
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BxPackedMmxRegister op1 = BX_READ_MMX_REG(i->dst()), op2;
|
2002-10-16 21:37:35 +04:00
|
|
|
|
|
|
|
/* op2 is a register or memory reference */
|
|
|
|
if (i->modC0()) {
|
2012-08-05 17:52:40 +04:00
|
|
|
op2 = BX_READ_MMX_REG(i->src());
|
2002-10-16 21:37:35 +04:00
|
|
|
}
|
|
|
|
else {
|
2015-05-17 00:06:59 +03:00
|
|
|
bx_address eaddr = BX_CPU_RESOLVE_ADDR(i);
|
2002-10-16 21:37:35 +04:00
|
|
|
/* pointer, segment address pair */
|
2008-08-08 13:22:49 +04:00
|
|
|
MMXUQ(op2) = read_virtual_qword(i->seg(), eaddr);
|
2002-10-16 21:37:35 +04:00
|
|
|
}
|
|
|
|
|
2008-10-08 14:51:38 +04:00
|
|
|
BX_CPU_THIS_PTR prepareFPU2MMX(); /* FPU2MMX transition */
|
|
|
|
|
2002-10-16 21:37:35 +04:00
|
|
|
MMXUQ(op1) -= MMXUQ(op2);
|
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BX_WRITE_MMX_REG(i->dst(), op1);
|
2010-02-26 14:44:50 +03:00
|
|
|
#endif
|
2011-07-07 00:01:18 +04:00
|
|
|
|
|
|
|
BX_NEXT_INSTR(i);
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* 0F FC */
|
2018-02-16 10:57:32 +03:00
|
|
|
void BX_CPP_AttrRegparmN(1) BX_CPU_C::PADDB_PqQq(bxInstruction_c *i)
|
2002-09-09 20:11:25 +04:00
|
|
|
{
|
2010-03-01 21:53:53 +03:00
|
|
|
#if BX_CPU_LEVEL >= 5
|
2002-10-16 21:37:35 +04:00
|
|
|
BX_CPU_THIS_PTR prepareMMX();
|
2002-09-09 20:11:25 +04:00
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BxPackedMmxRegister op1 = BX_READ_MMX_REG(i->dst()), op2;
|
2002-09-09 20:11:25 +04:00
|
|
|
|
|
|
|
/* op2 is a register or memory reference */
|
2002-09-20 07:52:59 +04:00
|
|
|
if (i->modC0()) {
|
2012-08-05 17:52:40 +04:00
|
|
|
op2 = BX_READ_MMX_REG(i->src());
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
else {
|
2015-05-17 00:06:59 +03:00
|
|
|
bx_address eaddr = BX_CPU_RESOLVE_ADDR(i);
|
2002-09-09 20:11:25 +04:00
|
|
|
/* pointer, segment address pair */
|
2008-08-08 13:22:49 +04:00
|
|
|
MMXUQ(op2) = read_virtual_qword(i->seg(), eaddr);
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
|
2008-10-08 14:51:38 +04:00
|
|
|
BX_CPU_THIS_PTR prepareFPU2MMX(); /* FPU2MMX transition */
|
|
|
|
|
2002-09-09 20:11:25 +04:00
|
|
|
MMXUB0(op1) += MMXUB0(op2);
|
|
|
|
MMXUB1(op1) += MMXUB1(op2);
|
|
|
|
MMXUB2(op1) += MMXUB2(op2);
|
|
|
|
MMXUB3(op1) += MMXUB3(op2);
|
|
|
|
MMXUB4(op1) += MMXUB4(op2);
|
|
|
|
MMXUB5(op1) += MMXUB5(op2);
|
|
|
|
MMXUB6(op1) += MMXUB6(op2);
|
|
|
|
MMXUB7(op1) += MMXUB7(op2);
|
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BX_WRITE_MMX_REG(i->dst(), op1);
|
2010-02-26 14:44:50 +03:00
|
|
|
#endif
|
2011-07-07 00:01:18 +04:00
|
|
|
|
|
|
|
BX_NEXT_INSTR(i);
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* 0F FD */
|
2018-02-16 10:57:32 +03:00
|
|
|
void BX_CPP_AttrRegparmN(1) BX_CPU_C::PADDW_PqQq(bxInstruction_c *i)
|
2002-09-09 20:11:25 +04:00
|
|
|
{
|
2010-03-01 21:53:53 +03:00
|
|
|
#if BX_CPU_LEVEL >= 5
|
2002-10-16 21:37:35 +04:00
|
|
|
BX_CPU_THIS_PTR prepareMMX();
|
2002-09-09 20:11:25 +04:00
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BxPackedMmxRegister op1 = BX_READ_MMX_REG(i->dst()), op2;
|
2002-09-09 20:11:25 +04:00
|
|
|
|
|
|
|
/* op2 is a register or memory reference */
|
2002-09-20 07:52:59 +04:00
|
|
|
if (i->modC0()) {
|
2012-08-05 17:52:40 +04:00
|
|
|
op2 = BX_READ_MMX_REG(i->src());
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
else {
|
2015-05-17 00:06:59 +03:00
|
|
|
bx_address eaddr = BX_CPU_RESOLVE_ADDR(i);
|
2002-09-09 20:11:25 +04:00
|
|
|
/* pointer, segment address pair */
|
2008-08-08 13:22:49 +04:00
|
|
|
MMXUQ(op2) = read_virtual_qword(i->seg(), eaddr);
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
|
2008-10-08 14:51:38 +04:00
|
|
|
BX_CPU_THIS_PTR prepareFPU2MMX(); /* FPU2MMX transition */
|
|
|
|
|
2002-09-09 20:11:25 +04:00
|
|
|
MMXUW0(op1) += MMXUW0(op2);
|
|
|
|
MMXUW1(op1) += MMXUW1(op2);
|
|
|
|
MMXUW2(op1) += MMXUW2(op2);
|
|
|
|
MMXUW3(op1) += MMXUW3(op2);
|
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BX_WRITE_MMX_REG(i->dst(), op1);
|
2010-02-26 14:44:50 +03:00
|
|
|
#endif
|
2011-07-07 00:01:18 +04:00
|
|
|
|
|
|
|
BX_NEXT_INSTR(i);
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* 0F FE */
|
2018-02-16 10:57:32 +03:00
|
|
|
void BX_CPP_AttrRegparmN(1) BX_CPU_C::PADDD_PqQq(bxInstruction_c *i)
|
2002-09-09 20:11:25 +04:00
|
|
|
{
|
2010-03-01 21:53:53 +03:00
|
|
|
#if BX_CPU_LEVEL >= 5
|
2002-10-16 21:37:35 +04:00
|
|
|
BX_CPU_THIS_PTR prepareMMX();
|
2002-09-09 20:11:25 +04:00
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BxPackedMmxRegister op1 = BX_READ_MMX_REG(i->dst()), op2;
|
2002-09-09 20:11:25 +04:00
|
|
|
|
|
|
|
/* op2 is a register or memory reference */
|
2002-09-20 07:52:59 +04:00
|
|
|
if (i->modC0()) {
|
2012-08-05 17:52:40 +04:00
|
|
|
op2 = BX_READ_MMX_REG(i->src());
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
else {
|
2015-05-17 00:06:59 +03:00
|
|
|
bx_address eaddr = BX_CPU_RESOLVE_ADDR(i);
|
2002-09-09 20:11:25 +04:00
|
|
|
/* pointer, segment address pair */
|
2008-08-08 13:22:49 +04:00
|
|
|
MMXUQ(op2) = read_virtual_qword(i->seg(), eaddr);
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
|
2008-10-08 14:51:38 +04:00
|
|
|
BX_CPU_THIS_PTR prepareFPU2MMX(); /* FPU2MMX transition */
|
|
|
|
|
2002-09-09 20:11:25 +04:00
|
|
|
MMXUD0(op1) += MMXUD0(op2);
|
|
|
|
MMXUD1(op1) += MMXUD1(op2);
|
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BX_WRITE_MMX_REG(i->dst(), op1);
|
2010-02-26 14:44:50 +03:00
|
|
|
#endif
|
2011-07-07 00:01:18 +04:00
|
|
|
|
|
|
|
BX_NEXT_INSTR(i);
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* 0F 71 GrpA 010 */
|
2018-02-16 10:57:32 +03:00
|
|
|
void BX_CPP_AttrRegparmN(1) BX_CPU_C::PSRLW_NqIb(bxInstruction_c *i)
|
2002-09-09 20:11:25 +04:00
|
|
|
{
|
2010-03-01 21:53:53 +03:00
|
|
|
#if BX_CPU_LEVEL >= 5
|
2002-10-16 21:37:35 +04:00
|
|
|
BX_CPU_THIS_PTR prepareMMX();
|
2008-10-08 14:51:38 +04:00
|
|
|
BX_CPU_THIS_PTR prepareFPU2MMX(); /* FPU2MMX transition */
|
2002-09-09 20:11:25 +04:00
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BxPackedMmxRegister op = BX_READ_MMX_REG(i->dst());
|
2002-09-18 02:50:53 +04:00
|
|
|
Bit8u shift = i->Ib();
|
2002-09-09 20:11:25 +04:00
|
|
|
|
2002-12-28 23:18:56 +03:00
|
|
|
if(shift > 15) MMXUQ(op) = 0;
|
2002-09-09 20:11:25 +04:00
|
|
|
else
|
|
|
|
{
|
2002-12-28 23:18:56 +03:00
|
|
|
MMXUW0(op) >>= shift;
|
|
|
|
MMXUW1(op) >>= shift;
|
|
|
|
MMXUW2(op) >>= shift;
|
|
|
|
MMXUW3(op) >>= shift;
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BX_WRITE_MMX_REG(i->dst(), op);
|
2010-02-26 14:44:50 +03:00
|
|
|
#endif
|
2011-07-07 00:01:18 +04:00
|
|
|
|
|
|
|
BX_NEXT_INSTR(i);
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* 0F 71 GrpA 100 */
|
2018-02-16 10:57:32 +03:00
|
|
|
void BX_CPP_AttrRegparmN(1) BX_CPU_C::PSRAW_NqIb(bxInstruction_c *i)
|
2002-09-09 20:11:25 +04:00
|
|
|
{
|
2010-03-01 21:53:53 +03:00
|
|
|
#if BX_CPU_LEVEL >= 5
|
2002-10-16 21:37:35 +04:00
|
|
|
BX_CPU_THIS_PTR prepareMMX();
|
2008-10-08 14:51:38 +04:00
|
|
|
BX_CPU_THIS_PTR prepareFPU2MMX(); /* FPU2MMX transition */
|
2002-09-09 20:11:25 +04:00
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BxPackedMmxRegister op = BX_READ_MMX_REG(i->dst());
|
2002-09-18 02:50:53 +04:00
|
|
|
Bit8u shift = i->Ib();
|
2002-09-09 20:11:25 +04:00
|
|
|
|
2011-07-07 00:01:18 +04:00
|
|
|
if(shift == 0) {
|
|
|
|
BX_NEXT_INSTR(i);
|
|
|
|
}
|
2002-12-30 00:14:25 +03:00
|
|
|
|
2002-09-09 20:11:25 +04:00
|
|
|
if(shift > 15) {
|
2014-07-26 01:15:48 +04:00
|
|
|
MMXUW0(op) = (MMXSW0(op) < 0) ? 0xffff : 0;
|
|
|
|
MMXUW1(op) = (MMXSW1(op) < 0) ? 0xffff : 0;
|
|
|
|
MMXUW2(op) = (MMXSW2(op) < 0) ? 0xffff : 0;
|
|
|
|
MMXUW3(op) = (MMXSW3(op) < 0) ? 0xffff : 0;
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
else {
|
2010-12-25 20:04:36 +03:00
|
|
|
MMXUW0(op) = (Bit16u)(MMXSW0(op) >> shift);
|
|
|
|
MMXUW1(op) = (Bit16u)(MMXSW1(op) >> shift);
|
|
|
|
MMXUW2(op) = (Bit16u)(MMXSW2(op) >> shift);
|
|
|
|
MMXUW3(op) = (Bit16u)(MMXSW3(op) >> shift);
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BX_WRITE_MMX_REG(i->dst(), op);
|
2010-02-26 14:44:50 +03:00
|
|
|
#endif
|
2011-07-07 00:01:18 +04:00
|
|
|
|
|
|
|
BX_NEXT_INSTR(i);
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* 0F 71 GrpA 110 */
|
2018-02-16 10:57:32 +03:00
|
|
|
void BX_CPP_AttrRegparmN(1) BX_CPU_C::PSLLW_NqIb(bxInstruction_c *i)
|
2002-09-09 20:11:25 +04:00
|
|
|
{
|
2010-03-01 21:53:53 +03:00
|
|
|
#if BX_CPU_LEVEL >= 5
|
2002-10-16 21:37:35 +04:00
|
|
|
BX_CPU_THIS_PTR prepareMMX();
|
2008-10-08 14:51:38 +04:00
|
|
|
BX_CPU_THIS_PTR prepareFPU2MMX(); /* FPU2MMX transition */
|
2002-09-09 20:11:25 +04:00
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BxPackedMmxRegister op = BX_READ_MMX_REG(i->dst());
|
2002-09-18 02:50:53 +04:00
|
|
|
Bit8u shift = i->Ib();
|
2002-09-09 20:11:25 +04:00
|
|
|
|
2002-12-28 23:18:56 +03:00
|
|
|
if(shift > 15) MMXUQ(op) = 0;
|
2002-09-09 20:11:25 +04:00
|
|
|
else
|
|
|
|
{
|
2002-12-28 23:18:56 +03:00
|
|
|
MMXUW0(op) <<= shift;
|
|
|
|
MMXUW1(op) <<= shift;
|
|
|
|
MMXUW2(op) <<= shift;
|
|
|
|
MMXUW3(op) <<= shift;
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BX_WRITE_MMX_REG(i->dst(), op);
|
2010-02-26 14:44:50 +03:00
|
|
|
#endif
|
2011-07-07 00:01:18 +04:00
|
|
|
|
|
|
|
BX_NEXT_INSTR(i);
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* 0F 72 GrpA 010 */
|
2018-02-16 10:57:32 +03:00
|
|
|
void BX_CPP_AttrRegparmN(1) BX_CPU_C::PSRLD_NqIb(bxInstruction_c *i)
|
2002-09-09 20:11:25 +04:00
|
|
|
{
|
2010-03-01 21:53:53 +03:00
|
|
|
#if BX_CPU_LEVEL >= 5
|
2002-10-16 21:37:35 +04:00
|
|
|
BX_CPU_THIS_PTR prepareMMX();
|
2008-10-08 14:51:38 +04:00
|
|
|
BX_CPU_THIS_PTR prepareFPU2MMX(); /* FPU2MMX transition */
|
2002-09-09 20:11:25 +04:00
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BxPackedMmxRegister op = BX_READ_MMX_REG(i->dst());
|
2002-09-18 02:50:53 +04:00
|
|
|
Bit8u shift = i->Ib();
|
2002-09-09 20:11:25 +04:00
|
|
|
|
2002-12-28 23:18:56 +03:00
|
|
|
if(shift > 31) MMXUQ(op) = 0;
|
2002-09-09 20:11:25 +04:00
|
|
|
else
|
|
|
|
{
|
2002-12-28 23:18:56 +03:00
|
|
|
MMXUD0(op) >>= shift;
|
|
|
|
MMXUD1(op) >>= shift;
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BX_WRITE_MMX_REG(i->dst(), op);
|
2010-02-26 14:44:50 +03:00
|
|
|
#endif
|
2011-07-07 00:01:18 +04:00
|
|
|
|
|
|
|
BX_NEXT_INSTR(i);
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* 0F 72 GrpA 100 */
|
2018-02-16 10:57:32 +03:00
|
|
|
void BX_CPP_AttrRegparmN(1) BX_CPU_C::PSRAD_NqIb(bxInstruction_c *i)
|
2002-09-09 20:11:25 +04:00
|
|
|
{
|
2010-03-01 21:53:53 +03:00
|
|
|
#if BX_CPU_LEVEL >= 5
|
2002-10-16 21:37:35 +04:00
|
|
|
BX_CPU_THIS_PTR prepareMMX();
|
2008-10-08 14:51:38 +04:00
|
|
|
BX_CPU_THIS_PTR prepareFPU2MMX(); /* FPU2MMX transition */
|
2002-09-09 20:11:25 +04:00
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BxPackedMmxRegister op = BX_READ_MMX_REG(i->dst());
|
2002-09-18 02:50:53 +04:00
|
|
|
Bit8u shift = i->Ib();
|
2002-09-09 20:11:25 +04:00
|
|
|
|
2011-07-07 00:01:18 +04:00
|
|
|
if(shift == 0) {
|
|
|
|
BX_NEXT_INSTR(i);
|
|
|
|
}
|
2002-12-30 00:14:25 +03:00
|
|
|
|
2002-09-09 20:11:25 +04:00
|
|
|
if(shift > 31) {
|
2014-07-26 01:15:48 +04:00
|
|
|
MMXUD0(op) = (MMXSD0(op) < 0) ? 0xffffffff : 0;
|
|
|
|
MMXUD1(op) = (MMXSD1(op) < 0) ? 0xffffffff : 0;
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
else {
|
2010-12-25 20:04:36 +03:00
|
|
|
MMXUD0(op) = (Bit32u)(MMXSD0(op) >> shift);
|
|
|
|
MMXUD1(op) = (Bit32u)(MMXSD1(op) >> shift);
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BX_WRITE_MMX_REG(i->dst(), op);
|
2010-02-26 14:44:50 +03:00
|
|
|
#endif
|
2011-07-07 00:01:18 +04:00
|
|
|
|
|
|
|
BX_NEXT_INSTR(i);
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* 0F 72 GrpA 110 */
|
2018-02-16 10:57:32 +03:00
|
|
|
void BX_CPP_AttrRegparmN(1) BX_CPU_C::PSLLD_NqIb(bxInstruction_c *i)
|
2002-09-09 20:11:25 +04:00
|
|
|
{
|
2010-03-01 21:53:53 +03:00
|
|
|
#if BX_CPU_LEVEL >= 5
|
2002-10-16 21:37:35 +04:00
|
|
|
BX_CPU_THIS_PTR prepareMMX();
|
2008-10-08 14:51:38 +04:00
|
|
|
BX_CPU_THIS_PTR prepareFPU2MMX(); /* FPU2MMX transition */
|
2002-09-09 20:11:25 +04:00
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BxPackedMmxRegister op = BX_READ_MMX_REG(i->dst());
|
2002-09-18 02:50:53 +04:00
|
|
|
Bit8u shift = i->Ib();
|
2002-09-09 20:11:25 +04:00
|
|
|
|
2002-12-28 23:18:56 +03:00
|
|
|
if(shift > 31) MMXUQ(op) = 0;
|
2002-09-09 20:11:25 +04:00
|
|
|
else
|
|
|
|
{
|
2002-12-28 23:18:56 +03:00
|
|
|
MMXUD0(op) <<= shift;
|
|
|
|
MMXUD1(op) <<= shift;
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BX_WRITE_MMX_REG(i->dst(), op);
|
2010-02-26 14:44:50 +03:00
|
|
|
#endif
|
2011-07-07 00:01:18 +04:00
|
|
|
|
|
|
|
BX_NEXT_INSTR(i);
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* 0F 73 GrpA 010 */
|
2018-02-16 10:57:32 +03:00
|
|
|
void BX_CPP_AttrRegparmN(1) BX_CPU_C::PSRLQ_NqIb(bxInstruction_c *i)
|
2002-09-09 20:11:25 +04:00
|
|
|
{
|
2010-03-01 21:53:53 +03:00
|
|
|
#if BX_CPU_LEVEL >= 5
|
2002-10-16 21:37:35 +04:00
|
|
|
BX_CPU_THIS_PTR prepareMMX();
|
2008-10-08 14:51:38 +04:00
|
|
|
BX_CPU_THIS_PTR prepareFPU2MMX(); /* FPU2MMX transition */
|
2002-09-09 20:11:25 +04:00
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BxPackedMmxRegister op = BX_READ_MMX_REG(i->dst());
|
2002-09-18 02:50:53 +04:00
|
|
|
Bit8u shift = i->Ib();
|
2002-09-09 20:11:25 +04:00
|
|
|
|
|
|
|
if(shift > 63) {
|
2002-12-28 23:18:56 +03:00
|
|
|
MMXUQ(op) = 0;
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
else {
|
2002-12-28 23:18:56 +03:00
|
|
|
MMXUQ(op) >>= shift;
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BX_WRITE_MMX_REG(i->dst(), op);
|
2010-02-26 14:44:50 +03:00
|
|
|
#endif
|
2011-07-07 00:01:18 +04:00
|
|
|
|
|
|
|
BX_NEXT_INSTR(i);
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* 0F 73 GrpA 110 */
|
2018-02-16 10:57:32 +03:00
|
|
|
void BX_CPP_AttrRegparmN(1) BX_CPU_C::PSLLQ_NqIb(bxInstruction_c *i)
|
2002-09-09 20:11:25 +04:00
|
|
|
{
|
2010-03-01 21:53:53 +03:00
|
|
|
#if BX_CPU_LEVEL >= 5
|
2002-10-16 21:37:35 +04:00
|
|
|
BX_CPU_THIS_PTR prepareMMX();
|
2008-10-08 14:51:38 +04:00
|
|
|
BX_CPU_THIS_PTR prepareFPU2MMX(); /* FPU2MMX transition */
|
2002-09-09 20:11:25 +04:00
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BxPackedMmxRegister op = BX_READ_MMX_REG(i->dst());
|
2002-09-18 02:50:53 +04:00
|
|
|
Bit8u shift = i->Ib();
|
2002-09-09 20:11:25 +04:00
|
|
|
|
|
|
|
if(shift > 63) {
|
2002-12-28 23:18:56 +03:00
|
|
|
MMXUQ(op) = 0;
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
else {
|
2002-12-28 23:18:56 +03:00
|
|
|
MMXUQ(op) <<= shift;
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
BX_WRITE_MMX_REG(i->dst(), op);
|
2010-02-26 14:44:50 +03:00
|
|
|
#endif
|
2011-07-07 00:01:18 +04:00
|
|
|
|
|
|
|
BX_NEXT_INSTR(i);
|
2002-09-09 20:11:25 +04:00
|
|
|
}
|