From dd81a34829ec578d24d43b4d3fc7a4a16622720e Mon Sep 17 00:00:00 2001 From: Gabe Black Date: Mon, 17 Aug 2009 18:36:20 -0700 Subject: [PATCH] X86: Implement the floating point media subtract instructions. --- src/arch/x86/isa/decoder/two_byte_opcodes.isa | 10 +-- .../floating_point/arithmetic/subtraction.py | 63 +++++++++++++++++-- .../floating_point/arithmetic/subtraction.py | 31 ++++++++- 3 files changed, 91 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 b8ccec760..24349231c 100644 --- a/src/arch/x86/isa/decoder/two_byte_opcodes.isa +++ b/src/arch/x86/isa/decoder/two_byte_opcodes.isa @@ -508,7 +508,7 @@ 0x1: mulps_Vo_Wo(); 0x2: cvtps2pd_Vo_Wq(); 0x3: cvtdq2ps_Vo_Wo(); - 0x4: subps_Vo_Wo(); + 0x4: Inst::SUBPS(Vo,Wo); 0x5: Inst::MINPS(Vo,Wo); 0x6: divps_Vo_Wo(); 0x7: Inst::MAXPS(Vo,Wo); @@ -519,7 +519,7 @@ 0x1: mulss_Vd_Wd(); 0x2: cvtss2sd_Vq_Wd(); 0x3: cvttps2dq_Vo_Wo(); - 0x4: subss_Vd_Wd(); + 0x4: Inst::SUBSS(Vd,Wd); 0x5: Inst::MINSS(Vd,Wd); 0x6: divss_Vd_Wd(); 0x7: Inst::MAXSS(Vd,Wd); @@ -530,7 +530,7 @@ 0x1: mulpd_Vo_Wo(); 0x2: cvtpd2ps_Vo_Wo(); 0x3: cvtps2dq_Vo_Wo(); - 0x4: subpd_Vo_Wo(); + 0x4: Inst::SUBPD(Vo,Wo); 0x5: Inst::MINPD(Vo,Wo); 0x6: divpd_Vo_Wo(); 0x7: Inst::MAXPD(Vo,Wo); @@ -915,7 +915,7 @@ 0x0: decode OPCODE_OP_BOTTOM3 { 0x2: cmpccps_Vo_Wo_Ib(); 0x3: cvtdq2ps_Vo_Wo(); - 0x4: subps_Vo_Wo(); + 0x4: Inst::SUBPS(Vo,Wo); 0x5: Inst::MINPS(Vo,Wo); 0x6: divps_Vo_Wo(); } @@ -927,7 +927,7 @@ // operand size (0x66) 0x1: decode OPCODE_OP_BOTTOM3 { 0x2: cmpccpd_Vo_Wo_Ib(); - 0x4: subpd_Vo_Wo(); + 0x4: Inst::SUBPD(Vo,Wo); 0x5: Inst::MINPD(Vo,Wo); 0x6: divpd_Vo_Wo(); default: Inst::UD2(); diff --git a/src/arch/x86/isa/insts/simd128/floating_point/arithmetic/subtraction.py b/src/arch/x86/isa/insts/simd128/floating_point/arithmetic/subtraction.py index 10669136b..378abc070 100644 --- a/src/arch/x86/isa/insts/simd128/floating_point/arithmetic/subtraction.py +++ b/src/arch/x86/isa/insts/simd128/floating_point/arithmetic/subtraction.py @@ -54,22 +54,73 @@ # Authors: Gabe Black microcode = ''' -# SUBPS -# SUBPD -# SUBSS +def macroop SUBSS_XMM_XMM { + msubf xmml, xmml, xmmlm, size=4, ext=1 +}; + +def macroop SUBSS_XMM_M { + ldfp ufp1, seg, sib, disp, dataSize=8 + msubf xmml, xmml, ufp1, size=4, ext=1 +}; + +def macroop SUBSS_XMM_P { + rdip t7 + ldfp ufp1, seg, riprel, disp, dataSize=8 + msubf xmml, xmml, ufp1, size=4, ext=1 +}; def macroop SUBSD_XMM_XMM { - subfp xmml, xmml, xmmlm + msubf xmml, xmml, xmmlm, size=8, ext=1 }; def macroop SUBSD_XMM_M { ldfp ufp1, seg, sib, disp, dataSize=8 - subfp xmml, xmml, ufp1 + msubf xmml, xmml, ufp1, size=8, ext=1 }; def macroop SUBSD_XMM_P { rdip t7 ldfp ufp1, seg, riprel, disp, dataSize=8 - subfp xmml, xmml, ufp1 + msubf xmml, xmml, ufp1, size=8, ext=1 +}; + +def macroop SUBPS_XMM_XMM { + msubf xmml, xmml, xmmlm, size=4, ext=0 + msubf xmmh, xmmh, xmmhm, size=4, ext=0 +}; + +def macroop SUBPS_XMM_M { + ldfp ufp1, seg, sib, "DISPLACEMENT", dataSize=8 + ldfp ufp2, seg, sib, "DISPLACEMENT + 8", dataSize=8 + msubf xmml, xmml, ufp1, size=4, ext=0 + msubf xmmh, xmmh, ufp2, size=4, ext=0 +}; + +def macroop SUBPS_XMM_P { + rdip t7 + ldfp ufp1, seg, riprel, "DISPLACEMENT", dataSize=8 + ldfp ufp2, seg, riprel, "DISPLACEMENT + 8", dataSize=8 + msubf xmml, xmml, ufp1, size=4, ext=0 + msubf xmmh, xmmh, ufp2, size=4, ext=0 +}; + +def macroop SUBPD_XMM_XMM { + msubf xmml, xmml, xmmlm, size=8, ext=0 + msubf xmmh, xmmh, xmmhm, size=8, ext=0 +}; + +def macroop SUBPD_XMM_M { + ldfp ufp1, seg, sib, "DISPLACEMENT", dataSize=8 + ldfp ufp2, seg, sib, "DISPLACEMENT + 8", dataSize=8 + msubf xmml, xmml, ufp1, size=8, ext=0 + msubf xmmh, xmmh, ufp2, size=8, ext=0 +}; + +def macroop SUBPD_XMM_P { + rdip t7 + ldfp ufp1, seg, riprel, "DISPLACEMENT", dataSize=8 + ldfp ufp2, seg, riprel, "DISPLACEMENT + 8", dataSize=8 + msubf xmml, xmml, ufp1, size=8, ext=0 + msubf xmmh, xmmh, ufp2, size=8, ext=0 }; ''' diff --git a/src/arch/x86/isa/insts/simd64/floating_point/arithmetic/subtraction.py b/src/arch/x86/isa/insts/simd64/floating_point/arithmetic/subtraction.py index 6e4c1804d..363794411 100644 --- a/src/arch/x86/isa/insts/simd64/floating_point/arithmetic/subtraction.py +++ b/src/arch/x86/isa/insts/simd64/floating_point/arithmetic/subtraction.py @@ -54,6 +54,33 @@ # Authors: Gabe Black microcode = ''' -# PFSUB -# PFSUBR +def macroop PFSUB_MMX_MMX { + msubf mmx, mmx, mmxm, size=4, ext=0 +}; + +def macroop PFSUB_MMX_M { + ldfp ufp1, seg, sib, disp, dataSize=8 + msubf mmx, mmx, ufp1, size=4, ext=0 +}; + +def macroop PFSUB_MMX_P { + rdip t7 + ldfp ufp1, seg, riprel, disp, dataSize=8 + msubf mmx, mmx, ufp1, size=4, ext=0 +}; + +def macroop PFSUBR_MMX_MMX { + msubf mmx, mmxm, mmx, size=4, ext=0 +}; + +def macroop PFSUBR_MMX_M { + ldfp ufp1, seg, sib, disp, dataSize=8 + msubf mmx, ufp1, mmx, size=4, ext=0 +}; + +def macroop PFSUBR_MMX_P { + rdip t7 + ldfp ufp1, seg, riprel, disp, dataSize=8 + msubf mmx, ufp1, mmx, size=4, ext=0 +}; ''' -- 2.30.2