summaryrefslogtreecommitdiff
path: root/src/arch/x86
diff options
context:
space:
mode:
authorGabe Black <gblack@eecs.umich.edu>2009-08-17 20:25:13 -0700
committerGabe Black <gblack@eecs.umich.edu>2009-08-17 20:25:13 -0700
commit7fbd9e12961aaee1c81e723c4d40b70d5108845e (patch)
treef11b2f608a40900aad9ab2f27e46d866e203daff /src/arch/x86
parent1fed0161d94dc0bd89e1c682f1f5d8757bd252a2 (diff)
downloadgem5-7fbd9e12961aaee1c81e723c4d40b70d5108845e.tar.xz
X86: Implement the shuffle media instructions.
Diffstat (limited to 'src/arch/x86')
-rw-r--r--src/arch/x86/isa/decoder/two_byte_opcodes.isa12
-rw-r--r--src/arch/x86/isa/insts/simd128/floating_point/data_reordering/shuffle.py43
-rw-r--r--src/arch/x86/isa/insts/simd128/integer/data_reordering/shuffle.py53
-rw-r--r--src/arch/x86/isa/insts/simd64/integer/data_reordering/shuffle_and_swap.py18
4 files changed, 113 insertions, 13 deletions
diff --git a/src/arch/x86/isa/decoder/two_byte_opcodes.isa b/src/arch/x86/isa/decoder/two_byte_opcodes.isa
index 91e2f2b2f..7d955eb3e 100644
--- a/src/arch/x86/isa/decoder/two_byte_opcodes.isa
+++ b/src/arch/x86/isa/decoder/two_byte_opcodes.isa
@@ -598,7 +598,7 @@
0x0E: decode LEGACY_DECODEVAL {
// no prefix
0x0: decode OPCODE_OP_BOTTOM3 {
- 0x0: WarnUnimpl::pshufw_Pq_Qq_Ib();
+ 0x0: PSHUFW(Pq,Qq,Ib);
//0x1: group13_pshimw();
0x1: decode MODRM_REG {
0x2: decode LEGACY_OP {
@@ -658,12 +658,12 @@
}
// repe (0xF3)
0x4: decode OPCODE_OP_BOTTOM3 {
- 0x0: WarnUnimpl::pshufhw_Vo_Wo_Ib();
+ 0x0: PSHUFHW(Vo,Wo,Ib);
default: UD2();
}
// operand size (0x66)
0x1: decode OPCODE_OP_BOTTOM3 {
- 0x0: WarnUnimpl::pshufd_Vo_Wo_Ib();
+ 0x0: PSHUFD(Vo,Wo,Ib);
//0x1: group13_pshimw();
0x1: decode MODRM_REG {
0x2: decode LEGACY_OP {
@@ -723,7 +723,7 @@
}
// repne (0xF2)
0x8: decode OPCODE_OP_BOTTOM3 {
- 0x0: WarnUnimpl::pshuflw_Vo_Wo_Ib();
+ 0x0: PSHUFLW(Vo,Wo,Ib);
default: UD2();
}
default: UD2();
@@ -910,7 +910,7 @@
0x3: WarnUnimpl::movnti_Mdq_Gdq();
0x4: PINSRW(Pq,Ew,Ib);
0x5: PEXTRW(Gd,PRq,Ib);
- 0x6: WarnUnimpl::shufps_Vps_Wps_Ib();
+ 0x6: SHUFPS(Vps,Wps,Ib);
}
// repe (0xF3)
0x4: decode OPCODE_OP_BOTTOM3 {
@@ -922,7 +922,7 @@
0x2: WarnUnimpl::cmpccpd_Vo_Wo_Ib();
0x4: PINSRW(Vdw,Ew,Ib);
0x5: PEXTRW(Gd,VRdq,Ib);
- 0x6: WarnUnimpl::shufpd_Vpd_Wpd_Ib();
+ 0x6: SHUFPD(Vpd,Wpd,Ib);
default: UD2();
}
// repne (0xF2)
diff --git a/src/arch/x86/isa/insts/simd128/floating_point/data_reordering/shuffle.py b/src/arch/x86/isa/insts/simd128/floating_point/data_reordering/shuffle.py
index 868d72b06..7b09e796a 100644
--- a/src/arch/x86/isa/insts/simd128/floating_point/data_reordering/shuffle.py
+++ b/src/arch/x86/isa/insts/simd128/floating_point/data_reordering/shuffle.py
@@ -54,6 +54,45 @@
# Authors: Gabe Black
microcode = '''
-# SHUFPS
-# SHUFPD
+def macroop SHUFPS_XMM_XMM_I {
+ shuffle ufp1, xmml, xmmh, size=4, ext="IMMEDIATE"
+ shuffle xmmh, xmmlm, xmmhm, size=4, ext="IMMEDIATE >> 4"
+ movfp xmml, ufp1, dataSize=8
+};
+
+def macroop SHUFPS_XMM_M_I {
+ ldfp ufp1, seg, sib, "DISPLACEMENT", dataSize=8
+ ldfp ufp2, seg, sib, "DISPLACEMENT + 8", dataSize=8
+ shuffle xmml, xmml, xmmh, size=4, ext="IMMEDIATE"
+ shuffle xmmh, ufp1, ufp2, size=4, ext="IMMEDIATE >> 4"
+};
+
+def macroop SHUFPS_XMM_P_I {
+ rdip t7
+ ldfp ufp1, seg, riprel, "DISPLACEMENT", dataSize=8
+ ldfp ufp2, seg, riprel, "DISPLACEMENT + 8", dataSize=8
+ shuffle xmml, xmml, xmmh, size=4, ext="IMMEDIATE"
+ shuffle xmmh, ufp1, ufp2, size=4, ext="IMMEDIATE >> 4"
+};
+
+def macroop SHUFPD_XMM_XMM_I {
+ shuffle ufp1, xmml, xmmh, size=8, ext="IMMEDIATE"
+ shuffle xmmh, xmmlm, xmmhm, size=8, ext="IMMEDIATE >> 1"
+ movfp xmml, ufp1, dataSize=8
+};
+
+def macroop SHUFPD_XMM_M_I {
+ ldfp ufp1, seg, sib, "DISPLACEMENT", dataSize=8
+ ldfp ufp2, seg, sib, "DISPLACEMENT + 8", dataSize=8
+ shuffle xmml, xmml, xmmh, size=8, ext="IMMEDIATE"
+ shuffle xmmh, ufp1, ufp2, size=8, ext="IMMEDIATE >> 1"
+};
+
+def macroop SHUFPD_XMM_P_I {
+ rdip t7
+ ldfp ufp1, seg, riprel, "DISPLACEMENT", dataSize=8
+ ldfp ufp2, seg, riprel, "DISPLACEMENT + 8", dataSize=8
+ shuffle xmml, xmml, xmmh, size=8, ext="IMMEDIATE"
+ shuffle xmmh, ufp1, ufp2, size=8, ext="IMMEDIATE >> 1"
+};
'''
diff --git a/src/arch/x86/isa/insts/simd128/integer/data_reordering/shuffle.py b/src/arch/x86/isa/insts/simd128/integer/data_reordering/shuffle.py
index 9f66c3f05..46cfbce82 100644
--- a/src/arch/x86/isa/insts/simd128/integer/data_reordering/shuffle.py
+++ b/src/arch/x86/isa/insts/simd128/integer/data_reordering/shuffle.py
@@ -54,7 +54,54 @@
# Authors: Gabe Black
microcode = '''
-# PSHUFD
-# PSHUFHW
-# PSHUFLW
+def macroop PSHUFD_XMM_XMM_I {
+ shuffle ufp1, xmmlm, xmmhm, size=4, ext="IMMEDIATE"
+ shuffle xmmh, xmmlm, xmmhm, size=4, ext="IMMEDIATE >> 4"
+ movfp xmml, ufp1, dataSize=8
+};
+
+def macroop PSHUFD_XMM_M_I {
+ ldfp ufp1, seg, sib, "DISPLACEMENT", dataSize=8
+ ldfp ufp2, seg, sib, "DISPLACEMENT + 8", dataSize=8
+ shuffle xmml, ufp1, ufp2, size=4, ext="IMMEDIATE"
+ shuffle xmmh, ufp1, ufp2, size=4, ext="IMMEDIATE >> 4"
+};
+
+def macroop PSHUFD_XMM_P_I {
+ rdip t7
+ ldfp ufp1, seg, riprel, "DISPLACEMENT", dataSize=8
+ ldfp ufp2, seg, riprel, "DISPLACEMENT + 8", dataSize=8
+ shuffle xmml, ufp1, ufp2, size=4, ext="IMMEDIATE"
+ shuffle xmmh, ufp1, ufp2, size=4, ext="IMMEDIATE >> 4"
+};
+
+def macroop PSHUFHW_XMM_XMM_I {
+ shuffle xmmh, xmmhm, xmmhm, size=2, ext=imm
+};
+
+def macroop PSHUFHW_XMM_M_I {
+ ldfp ufp1, seg, sib, "DISPLACEMENT + 8", dataSize=8
+ shuffle xmmh, ufp1, ufp1, size=2, ext=imm
+};
+
+def macroop PSHUFHW_XMM_P_I {
+ rdip t7
+ ldfp ufp1, seg, riprel, "DISPLACEMENT + 8", dataSize=8
+ shuffle xmmh, ufp1, ufp1, size=2, ext=imm
+};
+
+def macroop PSHUFLW_XMM_XMM_I {
+ shuffle xmml, xmmlm, xmmlm, size=2, ext=imm
+};
+
+def macroop PSHUFLW_XMM_M_I {
+ ldfp ufp1, seg, sib, "DISPLACEMENT", dataSize=8
+ shuffle xmml, ufp1, ufp1, size=2, ext=imm
+};
+
+def macroop PSHUFLW_XMM_P_I {
+ rdip t7
+ ldfp ufp1, seg, riprel, "DISPLACEMENT", dataSize=8
+ shuffle xmml, ufp1, ufp1, size=2, ext=imm
+};
'''
diff --git a/src/arch/x86/isa/insts/simd64/integer/data_reordering/shuffle_and_swap.py b/src/arch/x86/isa/insts/simd64/integer/data_reordering/shuffle_and_swap.py
index 8f95f0f48..a6dd8748a 100644
--- a/src/arch/x86/isa/insts/simd64/integer/data_reordering/shuffle_and_swap.py
+++ b/src/arch/x86/isa/insts/simd64/integer/data_reordering/shuffle_and_swap.py
@@ -54,6 +54,20 @@
# Authors: Gabe Black
microcode = '''
-# PSHUFW
-# PSWAPD
+def macroop PSHUFW_MMX_MMX_I {
+ shuffle mmx, mmxm, mmxm, size=2, ext=imm
+};
+
+def macroop PSHUFW_MMX_M_I {
+ ldfp ufp1, seg, sib, disp, dataSize=8
+ shuffle mmx, ufp1, ufp1, size=2, ext=imm
+};
+
+def macroop PSHUFW_MMX_P_I {
+ rdip t7
+ ldfp ufp1, seg, riprel, disp, dataSize=8
+ shuffle mmx, ufp1, ufp1, size=2, ext=imm
+};
+
'''
+# PSWAPD