summaryrefslogtreecommitdiff
path: root/src/arch/x86
diff options
context:
space:
mode:
authorGabe Black <gblack@eecs.umich.edu>2009-08-17 20:15:16 -0700
committerGabe Black <gblack@eecs.umich.edu>2009-08-17 20:15:16 -0700
commit2beab367d75e5f6cc30a194ac4d8160b50fb29a7 (patch)
treef6cba30f4525f1a9bd950c97878f6c0dc723774e /src/arch/x86
parentf6b12bfa8dd9e3a0d7e84d59db2142cdda99e086 (diff)
downloadgem5-2beab367d75e5f6cc30a194ac4d8160b50fb29a7.tar.xz
X86: Implement the media average instructions.
Diffstat (limited to 'src/arch/x86')
-rw-r--r--src/arch/x86/isa/decoder/two_byte_opcodes.isa70
-rw-r--r--src/arch/x86/isa/insts/simd128/integer/arithmetic/average.py61
-rw-r--r--src/arch/x86/isa/insts/simd64/integer/arithmetic/average.py31
3 files changed, 122 insertions, 40 deletions
diff --git a/src/arch/x86/isa/decoder/two_byte_opcodes.isa b/src/arch/x86/isa/decoder/two_byte_opcodes.isa
index d136fcbce..478c7f309 100644
--- a/src/arch/x86/isa/decoder/two_byte_opcodes.isa
+++ b/src/arch/x86/isa/decoder/two_byte_opcodes.isa
@@ -1000,43 +1000,41 @@
}
default: UD2();
}
- }
- 0x1C: decode LEGACY_DECODEVAL {
- // no prefix
- 0x0: decode OPCODE_OP_BOTTOM3 {
- 0x0: pavgb_Pq_Qq();
- 0x1: Inst::PSRAW(Pq,Qq);
- 0x2: Inst::PSRAD(Pq,Qq);
- 0x3: pavgw_Pq_Qq();
- 0x4: Inst::PMULHUW(Pq,Qq);
- 0x5: Inst::PMULHW(Pq,Qq);
- 0x7: movntq_Mq_Pq();
- default: Inst::UD2();
- }
- // repe (0xF3)
- 0x4: decode OPCODE_OP_BOTTOM3 {
- 0x6: Inst::CVTDQ2PD(Vo,Wq);
- default: Inst::UD2();
- }
- // operand size (0x66)
- 0x1: decode OPCODE_OP_BOTTOM3 {
- 0x0: pavgb_Vo_Wo();
- 0x1: Inst::PSRAW(Vo,Wo);
- 0x2: Inst::PSRAD(Vo,Wo);
- 0x3: pavgw_Vo_Wo();
- 0x4: Inst::PMULHUW(Vo,Wo);
- 0x5: Inst::PMULHW(Vo,Wo);
- 0x6: cvttpd2dq_Vo_Wo();
- 0x7: movntdq_Mo_Vo();
- }
- // repne (0xF2)
- 0x8: decode OPCODE_OP_BOTTOM3 {
- 0x6: cvtpd2dq_Vo_Wo();
- default: Inst::UD2();
+ 0x1C: decode LEGACY_DECODEVAL {
+ // no prefix
+ 0x0: decode OPCODE_OP_BOTTOM3 {
+ 0x0: PAVGB(Pq,Qq);
+ 0x1: PSRAW(Pq,Qq);
+ 0x2: PSRAD(Pq,Qq);
+ 0x3: PAVGW(Pq,Qq);
+ 0x4: PMULHUW(Pq,Qq);
+ 0x5: PMULHW(Pq,Qq);
+ 0x7: WarnUnimpl::movntq_Mq_Pq();
+ default: UD2();
+ }
+ // repe (0xF3)
+ 0x4: decode OPCODE_OP_BOTTOM3 {
+ 0x6: CVTDQ2PD(Vo,Wq);
+ default: UD2();
+ }
+ // operand size (0x66)
+ 0x1: decode OPCODE_OP_BOTTOM3 {
+ 0x0: PAVGB(Vo,Wo);
+ 0x1: PSRAW(Vo,Wo);
+ 0x2: PSRAD(Vo,Wo);
+ 0x3: PAVGW(Vo,Wo);
+ 0x4: PMULHUW(Vo,Wo);
+ 0x5: PMULHW(Vo,Wo);
+ 0x6: WarnUnimpl::cvttpd2dq_Vo_Wo();
+ 0x7: WarnUnimpl::movntdq_Mo_Vo();
+ }
+ // repne (0xF2)
+ 0x8: decode OPCODE_OP_BOTTOM3 {
+ 0x6: WarnUnimpl::cvtpd2dq_Vo_Wo();
+ default: UD2();
+ }
+ default: UD2();
}
- default: Inst::UD2();
- }
- format Inst {
0x1D: decode LEGACY_DECODEVAL {
// no prefix
0x0: decode OPCODE_OP_BOTTOM3 {
diff --git a/src/arch/x86/isa/insts/simd128/integer/arithmetic/average.py b/src/arch/x86/isa/insts/simd128/integer/arithmetic/average.py
index 9bda3371f..017443e55 100644
--- a/src/arch/x86/isa/insts/simd128/integer/arithmetic/average.py
+++ b/src/arch/x86/isa/insts/simd128/integer/arithmetic/average.py
@@ -54,6 +54,63 @@
# Authors: Gabe Black
microcode = '''
-# PAVGB
-# PAVGW
+def macroop PAVGB_XMM_XMM {
+ mavg xmml, xmml, xmmlm, size=1, ext=0
+ mavg xmmh, xmmh, xmmhm, size=1, ext=0
+};
+
+def macroop PAVGB_XMM_M {
+ ldfp ufp1, seg, sib, "DISPLACEMENT", dataSize=8
+ ldfp ufp2, seg, sib, "DISPLACEMENT + 8", dataSize=8
+ mavg xmml, xmml, ufp1, size=1, ext=0
+ mavg xmmh, xmmh, ufp2, size=1, ext=0
+};
+
+def macroop PAVGB_XMM_P {
+ rdip t7
+ ldfp ufp1, seg, riprel, "DISPLACEMENT", dataSize=8
+ ldfp ufp2, seg, riprel, "DISPLACEMENT + 8", dataSize=8
+ mavg xmml, xmml, ufp1, size=1, ext=0
+ mavg xmmh, xmmh, ufp2, size=1, ext=0
+};
+
+def macroop PAVGUSB_XMM_XMM {
+ mavg xmml, xmml, xmmlm, size=1, ext=0
+ mavg xmmh, xmmh, xmmhm, size=1, ext=0
+};
+
+def macroop PAVGUSB_XMM_M {
+ ldfp ufp1, seg, sib, "DISPLACEMENT", dataSize=8
+ ldfp ufp2, seg, sib, "DISPLACEMENT + 8", dataSize=8
+ mavg xmml, xmml, ufp1, size=1, ext=0
+ mavg xmmh, xmmh, ufp2, size=1, ext=0
+};
+
+def macroop PAVGUSB_XMM_P {
+ rdip t7
+ ldfp ufp1, seg, riprel, "DISPLACEMENT", dataSize=8
+ ldfp ufp2, seg, riprel, "DISPLACEMENT + 8", dataSize=8
+ mavg xmml, xmml, ufp1, size=1, ext=0
+ mavg xmmh, xmmh, ufp2, size=1, ext=0
+};
+
+def macroop PAVGW_XMM_XMM {
+ mavg xmml, xmml, xmmlm, size=2, ext=0
+ mavg xmmh, xmmh, xmmhm, size=2, ext=0
+};
+
+def macroop PAVGW_XMM_M {
+ ldfp ufp1, seg, sib, "DISPLACEMENT", dataSize=8
+ ldfp ufp2, seg, sib, "DISPLACEMENT + 8", dataSize=8
+ mavg xmml, xmml, ufp1, size=2, ext=0
+ mavg xmmh, xmmh, ufp2, size=2, ext=0
+};
+
+def macroop PAVGW_XMM_P {
+ rdip t7
+ ldfp ufp1, seg, riprel, "DISPLACEMENT", dataSize=8
+ ldfp ufp2, seg, riprel, "DISPLACEMENT + 8", dataSize=8
+ mavg xmml, xmml, ufp1, size=2, ext=0
+ mavg xmmh, xmmh, ufp2, size=2, ext=0
+};
'''
diff --git a/src/arch/x86/isa/insts/simd64/integer/arithmetic/average.py b/src/arch/x86/isa/insts/simd64/integer/arithmetic/average.py
index af1b39097..54bc9e53c 100644
--- a/src/arch/x86/isa/insts/simd64/integer/arithmetic/average.py
+++ b/src/arch/x86/isa/insts/simd64/integer/arithmetic/average.py
@@ -54,7 +54,34 @@
# Authors: Gabe Black
microcode = '''
-# PAVGB
-# PAVGW
+def macroop PAVGB_MMX_MMX {
+ mavg mmx, mmx, mmxm, size=1, ext=0
+};
+
+def macroop PAVGB_MMX_M {
+ ldfp ufp1, seg, sib, disp, dataSize=8
+ mavg mmx, mmx, ufp1, size=1, ext=0
+};
+
+def macroop PAVGB_MMX_P {
+ rdip t7
+ ldfp ufp1, seg, riprel, disp, dataSize=8
+ mavg mmx, mmx, ufp1, size=1, ext=0
+};
+
+def macroop PAVGW_MMX_MMX {
+ mavg mmx, mmx, mmxm, size=2, ext=0
+};
+
+def macroop PAVGW_MMX_M {
+ ldfp ufp1, seg, sib, disp, dataSize=8
+ mavg mmx, mmx, ufp1, size=2, ext=0
+};
+
+def macroop PAVGW_MMX_P {
+ rdip t7
+ ldfp ufp1, seg, riprel, disp, dataSize=8
+ mavg mmx, mmx, ufp1, size=2, ext=0
+};
# PAVGUSB
'''