From e20c8a4b05b7b4529ac03a0bc203c584ccc52cc5 Mon Sep 17 00:00:00 2001 From: Gabe Black Date: Mon, 17 Aug 2009 18:32:08 -0700 Subject: X86: Implement the pack instructions. --- src/arch/x86/isa/decoder/two_byte_opcodes.isa | 12 ++-- .../data_reordering/pack_with_saturation.py | 65 +++++++++++++++++++++- .../data_reordering/pack_with_saturation.py | 47 +++++++++++++++- 3 files changed, 112 insertions(+), 12 deletions(-) (limited to 'src/arch/x86/isa') diff --git a/src/arch/x86/isa/decoder/two_byte_opcodes.isa b/src/arch/x86/isa/decoder/two_byte_opcodes.isa index 2c58798b3..39d56212d 100644 --- a/src/arch/x86/isa/decoder/two_byte_opcodes.isa +++ b/src/arch/x86/isa/decoder/two_byte_opcodes.isa @@ -554,22 +554,22 @@ 0x0: Inst::PUNPCKLBW(Pq,Qd); 0x1: Inst::PUNPCKLWD(Pq,Qd); 0x2: Inst::PUNPCKLDQ(Pq,Qd); - 0x3: packsswb_Pq_Qq(); + 0x3: Inst::PACKSSWB(Pq,Qq); 0x4: pcmpgtb_Pq_Qq(); 0x5: pcmpgtw_Pq_Qq(); 0x6: pcmpgtd_Pq_Qq(); - 0x7: packuswb_Pq_Qq(); + 0x7: Inst::PACKUSWB(Pq,Qq); } // operand size (0x66) 0x1: decode OPCODE_OP_BOTTOM3 { 0x0: Inst::PUNPCKLBW(Vo,Wq); 0x1: Inst::PUNPCKLWD(Vo,Wq); 0x2: Inst::PUNPCKLDQ(Vo,Wq); - 0x3: packsswb_Vo_Wo(); + 0x3: Inst::PACKSSWB(Vo,Wo); 0x4: pcmpgtb_Vo_Wo(); 0x5: pcmpgtw_Vo_Wo(); 0x6: pcmpgtd_Vo_Wo(); - 0x7: packuswb_Vo_Wo(); + 0x7: Inst::PACKUSWB(Vo,Wo); } default: Inst::UD2(); } @@ -579,7 +579,7 @@ 0x0: Inst::PUNPCKHBW(Pq,Qq); 0x1: Inst::PUNPCKHWD(Pq,Qq); 0x2: Inst::PUNPCKHDQ(Pq,Qq); - 0x3: packssdw_Pq_Qq(); + 0x3: Inst::PACKSSDW(Pq,Qq); 0x6: Inst::MOVD(Pq,Edp); 0x7: Inst::MOVQ(Pq,Qq); default: Inst::UD2(); @@ -594,7 +594,7 @@ 0x0: Inst::PUNPCKHBW(Vo,Wo); 0x1: Inst::PUNPCKHWD(Vo,Wo); 0x2: Inst::PUNPCKHDQ(Vo,Wo); - 0x3: packssdw_Vo_Wo(); + 0x3: Inst::PACKSSDW(Vo,Wo); 0x4: Inst::PUNPCKLQDQ(Vo,Wq); 0x5: Inst::PUNPCKHQDQ(Vo,Wq); 0x6: movd_Vo_Ed(); diff --git a/src/arch/x86/isa/insts/simd128/integer/data_reordering/pack_with_saturation.py b/src/arch/x86/isa/insts/simd128/integer/data_reordering/pack_with_saturation.py index 859d2bc7e..9112a7382 100644 --- a/src/arch/x86/isa/insts/simd128/integer/data_reordering/pack_with_saturation.py +++ b/src/arch/x86/isa/insts/simd128/integer/data_reordering/pack_with_saturation.py @@ -54,7 +54,66 @@ # Authors: Gabe Black microcode = ''' -# PACKSSDW -# PACKSSWB -# PACKUSWB +def macroop PACKSSDW_XMM_XMM { + pack ufp1, xmml, xmmh, ext=1, srcSize=4, destSize=2 + 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 +}; ''' diff --git a/src/arch/x86/isa/insts/simd64/integer/data_reordering/pack_with_saturation.py b/src/arch/x86/isa/insts/simd64/integer/data_reordering/pack_with_saturation.py index 859d2bc7e..4235d7f26 100644 --- a/src/arch/x86/isa/insts/simd64/integer/data_reordering/pack_with_saturation.py +++ b/src/arch/x86/isa/insts/simd64/integer/data_reordering/pack_with_saturation.py @@ -54,7 +54,48 @@ # Authors: Gabe Black microcode = ''' -# PACKSSDW -# PACKSSWB -# PACKUSWB +def macroop PACKSSDW_MMX_MMX { + pack mmx, mmx, mmxm, ext=1, srcSize=4, destSize=2 +}; + +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 +}; ''' -- cgit v1.2.3