From 35b0983ca983af7223ce1ef38ff15d8462aa7d4b Mon Sep 17 00:00:00 2001 From: Gabe Black Date: Mon, 17 Aug 2009 20:04:02 -0700 Subject: [PATCH] X86: Implement the instructions that compare fp values and write masks as the result. --- src/arch/x86/isa/decoder/two_byte_opcodes.isa | 24 ++-- .../integer/compare/compare_and_write_mask.py | 125 +++++++++++++++++- .../integer/compare/compare_and_write_mask.py | 95 ++++++++++++- 3 files changed, 220 insertions(+), 24 deletions(-) diff --git a/src/arch/x86/isa/decoder/two_byte_opcodes.isa b/src/arch/x86/isa/decoder/two_byte_opcodes.isa index b841a8183..2fdb6371d 100644 --- a/src/arch/x86/isa/decoder/two_byte_opcodes.isa +++ b/src/arch/x86/isa/decoder/two_byte_opcodes.isa @@ -549,9 +549,9 @@ 0x1: Inst::PUNPCKLWD(Pq,Qd); 0x2: Inst::PUNPCKLDQ(Pq,Qd); 0x3: Inst::PACKSSWB(Pq,Qq); - 0x4: pcmpgtb_Pq_Qq(); - 0x5: pcmpgtw_Pq_Qq(); - 0x6: pcmpgtd_Pq_Qq(); + 0x4: Inst::PCMPGTB(Pq,Qq); + 0x5: Inst::PCMPGTW(Pq,Qq); + 0x6: Inst::PCMPGTD(Pq,Qq); 0x7: Inst::PACKUSWB(Pq,Qq); } // operand size (0x66) @@ -560,9 +560,9 @@ 0x1: Inst::PUNPCKLWD(Vo,Wq); 0x2: Inst::PUNPCKLDQ(Vo,Wq); 0x3: Inst::PACKSSWB(Vo,Wo); - 0x4: pcmpgtb_Vo_Wo(); - 0x5: pcmpgtw_Vo_Wo(); - 0x6: pcmpgtd_Vo_Wo(); + 0x4: Inst::PCMPGTB(Vo,Wo); + 0x5: Inst::PCMPGTW(Vo,Wo); + 0x6: Inst::PCMPGTD(Vo,Wo); 0x7: Inst::PACKUSWB(Vo,Wo); } default: Inst::UD2(); @@ -652,9 +652,9 @@ } default: Inst::UD2(); } - 0x4: pcmpeqb_Pq_Qq(); - 0x5: pcmpeqw_Pq_Qq(); - 0x6: pcmpeqd_Pq_Qq(); + 0x4: Inst::PCMPEQB(Pq,Qq); + 0x5: Inst::PCMPEQW(Pq,Qq); + 0x6: Inst::PCMPEQD(Pq,Qq); 0x7: emms(); } // repe (0xF3) @@ -717,9 +717,9 @@ } default: Inst::UD2(); } - 0x4: pcmpeqb_Vo_Wo(); - 0x5: pcmpeqw_Vo_Wo(); - 0x6: pcmpeqd_Vo_Wo(); + 0x4: Inst::PCMPEQB(Vo,Wo); + 0x5: Inst::PCMPEQW(Vo,Wo); + 0x6: Inst::PCMPEQD(Vo,Wo); default: Inst::UD2(); } // repne (0xF2) diff --git a/src/arch/x86/isa/insts/simd128/integer/compare/compare_and_write_mask.py b/src/arch/x86/isa/insts/simd128/integer/compare/compare_and_write_mask.py index 59380c6a7..2cb41861c 100644 --- a/src/arch/x86/isa/insts/simd128/integer/compare/compare_and_write_mask.py +++ b/src/arch/x86/isa/insts/simd128/integer/compare/compare_and_write_mask.py @@ -54,10 +54,123 @@ # Authors: Gabe Black microcode = ''' -# PCMPEQB -# PCMPEQW -# PCMPEQD -# PCMPGTB -# PCMPGTW -# PCMPGTD +def macroop PCMPEQB_XMM_XMM { + mcmpi2r xmml, xmml, xmmlm, size=1, ext=0 + mcmpi2r xmmh, xmmh, xmmhm, size=1, ext=0 +}; + +def macroop PCMPEQB_XMM_M { + ldfp ufp1, seg, sib, "DISPLACEMENT", dataSize=8 + ldfp ufp2, seg, sib, "DISPLACEMENT + 8", dataSize=8 + mcmpi2r xmml, xmml, ufp1, size=1, ext=0 + mcmpi2r xmmh, xmmh, ufp2, size=1, ext=0 +}; + +def macroop PCMPEQB_XMM_P { + rdip t7 + ldfp ufp1, seg, riprel, "DISPLACEMENT", dataSize=8 + ldfp ufp2, seg, riprel, "DISPLACEMENT + 8", dataSize=8 + mcmpi2r xmml, xmml, ufp1, size=1, ext=0 + mcmpi2r xmmh, xmmh, ufp2, size=1, ext=0 +}; + +def macroop PCMPEQW_XMM_XMM { + mcmpi2r xmml, xmml, xmmlm, size=2, ext=0 + mcmpi2r xmmh, xmmh, xmmhm, size=2, ext=0 +}; + +def macroop PCMPEQW_XMM_M { + ldfp ufp1, seg, sib, "DISPLACEMENT", dataSize=8 + ldfp ufp2, seg, sib, "DISPLACEMENT + 8", dataSize=8 + mcmpi2r xmml, xmml, ufp1, size=2, ext=0 + mcmpi2r xmmh, xmmh, ufp2, size=2, ext=0 +}; + +def macroop PCMPEQW_XMM_P { + rdip t7 + ldfp ufp1, seg, riprel, "DISPLACEMENT", dataSize=8 + ldfp ufp2, seg, riprel, "DISPLACEMENT + 8", dataSize=8 + mcmpi2r xmml, xmml, ufp1, size=2, ext=0 + mcmpi2r xmmh, xmmh, ufp2, size=2, ext=0 +}; + +def macroop PCMPEQD_XMM_XMM { + mcmpi2r xmml, xmml, xmmlm, size=4, ext=0 + mcmpi2r xmmh, xmmh, xmmhm, size=4, ext=0 +}; + +def macroop PCMPEQD_XMM_M { + ldfp ufp1, seg, sib, "DISPLACEMENT", dataSize=8 + ldfp ufp2, seg, sib, "DISPLACEMENT + 8", dataSize=8 + mcmpi2r xmml, xmml, ufp1, size=4, ext=0 + mcmpi2r xmmh, xmmh, ufp2, size=4, ext=0 +}; + +def macroop PCMPEQD_XMM_P { + rdip t7 + ldfp ufp1, seg, riprel, "DISPLACEMENT", dataSize=8 + ldfp ufp2, seg, riprel, "DISPLACEMENT + 8", dataSize=8 + mcmpi2r xmml, xmml, ufp1, size=4, ext=0 + mcmpi2r xmmh, xmmh, ufp2, size=4, ext=0 +}; + +def macroop PCMPGTB_XMM_XMM { + mcmpi2r xmml, xmml, xmmlm, size=1, ext=2 + mcmpi2r xmmh, xmmh, xmmhm, size=1, ext=2 +}; + +def macroop PCMPGTB_XMM_M { + ldfp ufp1, seg, sib, "DISPLACEMENT", dataSize=8 + ldfp ufp2, seg, sib, "DISPLACEMENT + 8", dataSize=8 + mcmpi2r xmml, xmml, ufp1, size=1, ext=2 + mcmpi2r xmmh, xmmh, ufp2, size=1, ext=2 +}; + +def macroop PCMPGTB_XMM_P { + rdip t7 + ldfp ufp1, seg, riprel, "DISPLACEMENT", dataSize=8 + ldfp ufp2, seg, riprel, "DISPLACEMENT + 8", dataSize=8 + mcmpi2r xmml, xmml, ufp1, size=1, ext=2 + mcmpi2r xmmh, xmmh, ufp2, size=1, ext=2 +}; + +def macroop PCMPGTW_XMM_XMM { + mcmpi2r xmml, xmml, xmmlm, size=2, ext=2 + mcmpi2r xmmh, xmmh, xmmhm, size=2, ext=2 +}; + +def macroop PCMPGTW_XMM_M { + ldfp ufp1, seg, sib, "DISPLACEMENT", dataSize=8 + ldfp ufp2, seg, sib, "DISPLACEMENT + 8", dataSize=8 + mcmpi2r xmml, xmml, ufp1, size=2, ext=2 + mcmpi2r xmmh, xmmh, ufp2, size=2, ext=2 +}; + +def macroop PCMPGTW_XMM_P { + rdip t7 + ldfp ufp1, seg, riprel, "DISPLACEMENT", dataSize=8 + ldfp ufp2, seg, riprel, "DISPLACEMENT + 8", dataSize=8 + mcmpi2r xmml, xmml, ufp1, size=2, ext=2 + mcmpi2r xmmh, xmmh, ufp2, size=2, ext=2 +}; + +def macroop PCMPGTD_XMM_XMM { + mcmpi2r xmml, xmml, xmmlm, size=4, ext=2 + mcmpi2r xmmh, xmmh, xmmhm, size=4, ext=2 +}; + +def macroop PCMPGTD_XMM_M { + ldfp ufp1, seg, sib, "DISPLACEMENT", dataSize=8 + ldfp ufp2, seg, sib, "DISPLACEMENT + 8", dataSize=8 + mcmpi2r xmml, xmml, ufp1, size=4, ext=2 + mcmpi2r xmmh, xmmh, ufp2, size=4, ext=2 +}; + +def macroop PCMPGTD_XMM_P { + rdip t7 + ldfp ufp1, seg, riprel, "DISPLACEMENT", dataSize=8 + ldfp ufp2, seg, riprel, "DISPLACEMENT + 8", dataSize=8 + mcmpi2r xmml, xmml, ufp1, size=4, ext=2 + mcmpi2r xmmh, xmmh, ufp2, size=4, ext=2 +}; ''' diff --git a/src/arch/x86/isa/insts/simd64/integer/compare/compare_and_write_mask.py b/src/arch/x86/isa/insts/simd64/integer/compare/compare_and_write_mask.py index 59380c6a7..60640f45a 100644 --- a/src/arch/x86/isa/insts/simd64/integer/compare/compare_and_write_mask.py +++ b/src/arch/x86/isa/insts/simd64/integer/compare/compare_and_write_mask.py @@ -54,10 +54,93 @@ # Authors: Gabe Black microcode = ''' -# PCMPEQB -# PCMPEQW -# PCMPEQD -# PCMPGTB -# PCMPGTW -# PCMPGTD +def macroop PCMPEQB_MMX_MMX { + mcmpi2r mmx, mmx, mmxm, size=1, ext=0 +}; + +def macroop PCMPEQB_MMX_M { + ldfp ufp1, seg, sib, disp, dataSize=8 + mcmpi2r mmx, mmx, ufp1, size=1, ext=0 +}; + +def macroop PCMPEQB_MMX_P { + rdip t7 + ldfp ufp1, seg, riprel, disp, dataSize=8 + mcmpi2r mmx, mmx, ufp1, size=1, ext=0 +}; + +def macroop PCMPEQW_MMX_MMX { + mcmpi2r mmx, mmx, mmxm, size=2, ext=0 +}; + +def macroop PCMPEQW_MMX_M { + ldfp ufp1, seg, sib, disp, dataSize=8 + mcmpi2r mmx, mmx, ufp1, size=2, ext=0 +}; + +def macroop PCMPEQW_MMX_P { + rdip t7 + ldfp ufp1, seg, riprel, disp, dataSize=8 + mcmpi2r mmx, mmx, ufp1, size=2, ext=0 +}; + +def macroop PCMPEQD_MMX_MMX { + mcmpi2r mmx, mmx, mmxm, size=4, ext=0 +}; + +def macroop PCMPEQD_MMX_M { + ldfp ufp1, seg, sib, disp, dataSize=8 + mcmpi2r mmx, mmx, ufp1, size=4, ext=0 +}; + +def macroop PCMPEQD_MMX_P { + rdip t7 + ldfp ufp1, seg, riprel, disp, dataSize=8 + mcmpi2r mmx, mmx, ufp1, size=4, ext=0 +}; + +def macroop PCMPGTB_MMX_MMX { + mcmpi2r mmx, mmx, mmxm, size=1, ext=2 +}; + +def macroop PCMPGTB_MMX_M { + ldfp ufp1, seg, sib, disp, dataSize=8 + mcmpi2r mmx, mmx, ufp1, size=1, ext=2 +}; + +def macroop PCMPGTB_MMX_P { + rdip t7 + ldfp ufp1, seg, riprel, disp, dataSize=8 + mcmpi2r mmx, mmx, ufp1, size=1, ext=2 +}; + +def macroop PCMPGTW_MMX_MMX { + mcmpi2r mmx, mmx, mmxm, size=2, ext=2 +}; + +def macroop PCMPGTW_MMX_M { + ldfp ufp1, seg, sib, disp, dataSize=8 + mcmpi2r mmx, mmx, ufp1, size=2, ext=2 +}; + +def macroop PCMPGTW_MMX_P { + rdip t7 + ldfp ufp1, seg, riprel, disp, dataSize=8 + mcmpi2r mmx, mmx, ufp1, size=2, ext=2 +}; + +def macroop PCMPGTD_MMX_MMX { + mcmpi2r mmx, mmx, mmxm, size=4, ext=2 +}; + +def macroop PCMPGTD_MMX_M { + ldfp ufp1, seg, sib, disp, dataSize=8 + mcmpi2r mmx, mmx, ufp1, size=4, ext=2 +}; + +def macroop PCMPGTD_MMX_P { + rdip t7 + ldfp ufp1, seg, riprel, disp, dataSize=8 + mcmpi2r mmx, mmx, ufp1, size=4, ext=2 +}; ''' -- 2.30.2