X86: Implement the pack instructions.

This commit is contained in:
Gabe Black 2009-08-17 18:32:08 -07:00
parent 1273277d3b
commit e20c8a4b05
3 changed files with 112 additions and 12 deletions

View file

@ -554,22 +554,22 @@
0x0: Inst::PUNPCKLBW(Pq,Qd); 0x0: Inst::PUNPCKLBW(Pq,Qd);
0x1: Inst::PUNPCKLWD(Pq,Qd); 0x1: Inst::PUNPCKLWD(Pq,Qd);
0x2: Inst::PUNPCKLDQ(Pq,Qd); 0x2: Inst::PUNPCKLDQ(Pq,Qd);
0x3: packsswb_Pq_Qq(); 0x3: Inst::PACKSSWB(Pq,Qq);
0x4: pcmpgtb_Pq_Qq(); 0x4: pcmpgtb_Pq_Qq();
0x5: pcmpgtw_Pq_Qq(); 0x5: pcmpgtw_Pq_Qq();
0x6: pcmpgtd_Pq_Qq(); 0x6: pcmpgtd_Pq_Qq();
0x7: packuswb_Pq_Qq(); 0x7: Inst::PACKUSWB(Pq,Qq);
} }
// operand size (0x66) // operand size (0x66)
0x1: decode OPCODE_OP_BOTTOM3 { 0x1: decode OPCODE_OP_BOTTOM3 {
0x0: Inst::PUNPCKLBW(Vo,Wq); 0x0: Inst::PUNPCKLBW(Vo,Wq);
0x1: Inst::PUNPCKLWD(Vo,Wq); 0x1: Inst::PUNPCKLWD(Vo,Wq);
0x2: Inst::PUNPCKLDQ(Vo,Wq); 0x2: Inst::PUNPCKLDQ(Vo,Wq);
0x3: packsswb_Vo_Wo(); 0x3: Inst::PACKSSWB(Vo,Wo);
0x4: pcmpgtb_Vo_Wo(); 0x4: pcmpgtb_Vo_Wo();
0x5: pcmpgtw_Vo_Wo(); 0x5: pcmpgtw_Vo_Wo();
0x6: pcmpgtd_Vo_Wo(); 0x6: pcmpgtd_Vo_Wo();
0x7: packuswb_Vo_Wo(); 0x7: Inst::PACKUSWB(Vo,Wo);
} }
default: Inst::UD2(); default: Inst::UD2();
} }
@ -579,7 +579,7 @@
0x0: Inst::PUNPCKHBW(Pq,Qq); 0x0: Inst::PUNPCKHBW(Pq,Qq);
0x1: Inst::PUNPCKHWD(Pq,Qq); 0x1: Inst::PUNPCKHWD(Pq,Qq);
0x2: Inst::PUNPCKHDQ(Pq,Qq); 0x2: Inst::PUNPCKHDQ(Pq,Qq);
0x3: packssdw_Pq_Qq(); 0x3: Inst::PACKSSDW(Pq,Qq);
0x6: Inst::MOVD(Pq,Edp); 0x6: Inst::MOVD(Pq,Edp);
0x7: Inst::MOVQ(Pq,Qq); 0x7: Inst::MOVQ(Pq,Qq);
default: Inst::UD2(); default: Inst::UD2();
@ -594,7 +594,7 @@
0x0: Inst::PUNPCKHBW(Vo,Wo); 0x0: Inst::PUNPCKHBW(Vo,Wo);
0x1: Inst::PUNPCKHWD(Vo,Wo); 0x1: Inst::PUNPCKHWD(Vo,Wo);
0x2: Inst::PUNPCKHDQ(Vo,Wo); 0x2: Inst::PUNPCKHDQ(Vo,Wo);
0x3: packssdw_Vo_Wo(); 0x3: Inst::PACKSSDW(Vo,Wo);
0x4: Inst::PUNPCKLQDQ(Vo,Wq); 0x4: Inst::PUNPCKLQDQ(Vo,Wq);
0x5: Inst::PUNPCKHQDQ(Vo,Wq); 0x5: Inst::PUNPCKHQDQ(Vo,Wq);
0x6: movd_Vo_Ed(); 0x6: movd_Vo_Ed();

View file

@ -54,7 +54,66 @@
# Authors: Gabe Black # Authors: Gabe Black
microcode = ''' microcode = '''
# PACKSSDW def macroop PACKSSDW_XMM_XMM {
# PACKSSWB pack ufp1, xmml, xmmh, ext=1, srcSize=4, destSize=2
# PACKUSWB pack xmmh, xmmlm, xmmhm, ext=1, srcSize=4, destSize=2
movfp xmml, ufp1, dataSize=8
};
def macroop PACKSSDW_XMM_M {
ldfp ufp1, seg, sib, "DISPLACEMENT", dataSize=8
ldfp ufp2, seg, sib, "DISPLACEMENT + 8", dataSize=8
pack xmml, xmml, xmmh, ext=1, srcSize=4, destSize=2
pack xmmh, ufp1, ufp2, ext=1, srcSize=4, destSize=2
};
def macroop PACKSSDW_XMM_P {
rdip t7
ldfp ufp1, seg, riprel, "DISPLACEMENT", dataSize=8
ldfp ufp2, seg, riprel, "DISPLACEMENT + 8", dataSize=8
pack xmml, xmml, xmmh, ext=1, srcSize=4, destSize=2
pack xmmh, ufp1, ufp2, ext=1, srcSize=4, destSize=2
};
def macroop PACKSSWB_XMM_XMM {
pack ufp1, xmml, xmmh, ext=1, srcSize=2, destSize=1
pack xmmh, xmmlm, xmmhm, ext=1, srcSize=2, destSize=1
movfp xmml, ufp1, dataSize=8
};
def macroop PACKSSWB_XMM_M {
ldfp ufp1, seg, sib, "DISPLACEMENT", dataSize=8
ldfp ufp2, seg, sib, "DISPLACEMENT + 8", dataSize=8
pack xmml, xmml, xmmh, ext=1, srcSize=2, destSize=1
pack xmmh, ufp1, ufp2, ext=1, srcSize=2, destSize=1
};
def macroop PACKSSWB_XMM_P {
rdip t7
ldfp ufp1, seg, riprel, "DISPLACEMENT", dataSize=8
ldfp ufp2, seg, riprel, "DISPLACEMENT + 8", dataSize=8
pack xmml, xmml, xmmh, ext=1, srcSize=2, destSize=1
pack xmmh, ufp1, ufp2, ext=1, srcSize=2, destSize=1
};
def macroop PACKUSWB_XMM_XMM {
pack ufp1, xmml, xmmh, ext=0, srcSize=2, destSize=1
pack xmmh, xmmlm, xmmhm, ext=0, srcSize=2, destSize=1
movfp xmml, ufp1, dataSize=8
};
def macroop PACKUSWB_XMM_M {
ldfp ufp1, seg, sib, "DISPLACEMENT", dataSize=8
ldfp ufp2, seg, sib, "DISPLACEMENT + 8", dataSize=8
pack xmml, xmml, xmmh, ext=0, srcSize=2, destSize=1
pack xmmh, ufp1, ufp2, ext=0, srcSize=2, destSize=1
};
def macroop PACKUSWB_XMM_P {
rdip t7
ldfp ufp1, seg, riprel, "DISPLACEMENT", dataSize=8
ldfp ufp2, seg, riprel, "DISPLACEMENT + 8", dataSize=8
pack xmml, xmml, xmmh, ext=0, srcSize=2, destSize=1
pack xmmh, ufp1, ufp2, ext=0, srcSize=2, destSize=1
};
''' '''

View file

@ -54,7 +54,48 @@
# Authors: Gabe Black # Authors: Gabe Black
microcode = ''' microcode = '''
# PACKSSDW def macroop PACKSSDW_MMX_MMX {
# PACKSSWB pack mmx, mmx, mmxm, ext=1, srcSize=4, destSize=2
# PACKUSWB };
def macroop PACKSSDW_MMX_M {
ldfp ufp1, seg, sib, disp, dataSize=8
pack mmx, mmx, ufp1, ext=1, srcSize=4, destSize=2
};
def macroop PACKSSDW_MMX_P {
rdip t7
ldfp ufp1, seg, riprel, disp, dataSize=8
pack mmx, mmx, ufp1, ext=1, srcSize=4, destSize=2
};
def macroop PACKSSWB_MMX_MMX {
pack mmx, mmx, mmxm, ext=1, srcSize=2, destSize=1
};
def macroop PACKSSWB_MMX_M {
ldfp ufp1, seg, sib, disp, dataSize=8
pack mmx, mmx, ufp1, ext=1, srcSize=2, destSize=1
};
def macroop PACKSSWB_MMX_P {
rdip t7
ldfp ufp1, seg, riprel, disp, dataSize=8
pack mmx, mmx, ufp1, ext=1, srcSize=2, destSize=1
};
def macroop PACKUSWB_MMX_MMX {
pack mmx, mmx, mmxm, ext=0, srcSize=2, destSize=1
};
def macroop PACKUSWB_MMX_M {
ldfp ufp1, seg, sib, disp, dataSize=8
pack mmx, mmx, ufp1, ext=0, srcSize=2, destSize=1
};
def macroop PACKUSWB_MMX_P {
rdip t7
ldfp ufp1, seg, riprel, disp, dataSize=8
pack mmx, mmx, ufp1, ext=0, srcSize=2, destSize=1
};
''' '''