From 1606663aa983d69f964d26cd1522b37b772fe413 Mon Sep 17 00:00:00 2001 From: Gabe Black Date: Mon, 17 Aug 2009 20:25:14 -0700 Subject: X86: Implement the media instructions that convert fp values to ints. --- .../convert_floating_point_to_gpr_integer.py | 65 ++++++++++++++-- .../convert_floating_point_to_mmx_integer.py | 73 +++++++++++++++++- .../convert_floating_point_to_xmm_integer.py | 89 +++++++++++++++++++++- 3 files changed, 213 insertions(+), 14 deletions(-) (limited to 'src/arch/x86/isa/insts/simd128') diff --git a/src/arch/x86/isa/insts/simd128/floating_point/data_conversion/convert_floating_point_to_gpr_integer.py b/src/arch/x86/isa/insts/simd128/floating_point/data_conversion/convert_floating_point_to_gpr_integer.py index 413026d63..16abd96f4 100644 --- a/src/arch/x86/isa/insts/simd128/floating_point/data_conversion/convert_floating_point_to_gpr_integer.py +++ b/src/arch/x86/isa/insts/simd128/floating_point/data_conversion/convert_floating_point_to_gpr_integer.py @@ -54,22 +54,75 @@ # Authors: Gabe Black microcode = ''' -# CVTSS2SI -# CVTSD2SI -# CVTTSS2SI +def macroop CVTSS2SI_R_XMM { + cvtf2i ufp1, xmmlm, srcSize=4, destSize=dsz, ext=(1 | 4) + mov2int reg, ufp1, size=dsz +}; + +def macroop CVTSS2SI_R_M { + ldfp ufp1, seg, sib, disp, dataSize=8 + cvtf2i ufp1, ufp1, srcSize=4, destSize=dsz, ext=(1 | 4) + mov2int reg, ufp1, size=dsz +}; + +def macroop CVTSS2SI_R_P { + rdip t7 + ldfp ufp1, seg, riprel, disp, dataSize=8 + cvtf2i ufp1, ufp1, srcSize=4, destSize=dsz, ext=(1 | 4) + mov2int reg, ufp1, size=dsz +}; + +def macroop CVTSD2SI_R_XMM { + cvtf2i ufp1, xmmlm, srcSize=8, destSize=dsz, ext=(1 | 4) + mov2int reg, ufp1, size=dsz +}; + +def macroop CVTSD2SI_R_M { + ldfp ufp1, seg, sib, disp, dataSize=8 + cvtf2i ufp1, ufp1, srcSize=8, destSize=dsz, ext=(1 | 4) + mov2int reg, ufp1, size=dsz +}; + +def macroop CVTSD2SI_R_P { + rdip t7 + ldfp ufp1, seg, riprel, disp, dataSize=8 + cvtf2i ufp1, ufp1, srcSize=8, destSize=dsz, ext=(1 | 4) + mov2int reg, ufp1, size=dsz +}; + +def macroop CVTTSS2SI_R_XMM { + cvtf2i ufp1, xmmlm, srcSize=4, destSize=dsz, ext=1 + mov2int reg, ufp1, size=dsz +}; + +def macroop CVTTSS2SI_R_M { + ldfp ufp1, seg, sib, disp, dataSize=8 + cvtf2i ufp1, ufp1, srcSize=4, destSize=dsz, ext=1 + mov2int reg, ufp1, size=dsz +}; + +def macroop CVTTSS2SI_R_P { + rdip t7 + ldfp ufp1, seg, riprel, disp, dataSize=8 + cvtf2i ufp1, ufp1, srcSize=4, destSize=dsz, ext=1 + mov2int reg, ufp1, size=dsz +}; def macroop CVTTSD2SI_R_XMM { - cvtf_d2i reg, xmmlm + cvtf2i ufp1, xmmlm, srcSize=8, destSize=dsz, ext=1 + mov2int reg, ufp1, size=dsz }; def macroop CVTTSD2SI_R_M { ldfp ufp1, seg, sib, disp, dataSize=8 - cvtf_d2i reg, ufp1 + cvtf2i ufp1, ufp1, srcSize=8, destSize=dsz, ext=1 + mov2int reg, ufp1, size=dsz }; def macroop CVTTSD2SI_R_P { rdip t7 ldfp ufp1, seg, riprel, disp, dataSize=8 - cvtf_d2i reg, ufp1 + cvtf2i ufp1, ufp1, srcSize=8, destSize=dsz, ext=1 + mov2int reg, ufp1, size=dsz }; ''' diff --git a/src/arch/x86/isa/insts/simd128/floating_point/data_conversion/convert_floating_point_to_mmx_integer.py b/src/arch/x86/isa/insts/simd128/floating_point/data_conversion/convert_floating_point_to_mmx_integer.py index af579a46f..900e91c99 100644 --- a/src/arch/x86/isa/insts/simd128/floating_point/data_conversion/convert_floating_point_to_mmx_integer.py +++ b/src/arch/x86/isa/insts/simd128/floating_point/data_conversion/convert_floating_point_to_mmx_integer.py @@ -54,8 +54,73 @@ # Authors: Gabe Black microcode = ''' -# CVTPS2PI -# CVTPD2PI -# CVTTPS2PI -# CVTTPD2PI +def macroop CVTPS2PI_MMX_XMM { + cvtf2i mmx, xmmlm, size=4, ext=4 +}; + +def macroop CVTPS2PI_MMX_M { + ldfp ufp1, seg, sib, disp, dataSize=8 + cvtf2i mmx, ufp1, size=4, ext=4 +}; + +def macroop CVTPS2PI_MMX_P { + rdip t7 + ldfp ufp1, seg, riprel, disp, dataSize=8 + cvtf2i mmx, ufp1, size=4, ext=4 +}; + +def macroop CVTPD2PI_MMX_XMM { + cvtf2i mmx, xmmlm, srcSize=8, destSize=4, ext=4 + cvtf2i mmx, xmmhm, srcSize=8, destSize=4, ext=(4 | 2) +}; + +def macroop CVTPD2PI_MMX_M { + ldfp ufp1, seg, sib, "DISPLACEMENT", dataSize=8 + ldfp ufp2, seg, sib, "DISPLACEMENT + 8", dataSize=8 + cvtf2i mmx, ufp1, srcSize=8, destSize=4, ext=4 + cvtf2i mmx, ufp2, srcSize=8, destSize=4, ext=(4 | 2) +}; + +def macroop CVTPD2PI_MMX_P { + rdip t7 + ldfp ufp1, seg, riprel, "DISPLACEMENT", dataSize=8 + ldfp ufp2, seg, riprel, "DISPLACEMENT + 8", dataSize=8 + cvtf2i mmx, ufp1, srcSize=8, destSize=4, ext=4 + cvtf2i mmx, ufp2, srcSize=8, destSize=4, ext=(4 | 2) +}; + +def macroop CVTTPS2PI_MMX_XMM { + cvtf2i mmx, xmmlm, size=4, ext=0 +}; + +def macroop CVTTPS2PI_MMX_M { + ldfp ufp1, seg, sib, disp, dataSize=8 + cvtf2i mmx, ufp1, size=4, ext=0 +}; + +def macroop CVTTPS2PI_MMX_P { + rdip t7 + ldfp ufp1, seg, riprel, disp, dataSize=8 + cvtf2i mmx, ufp1, size=4, ext=0 +}; + +def macroop CVTTPD2PI_MMX_XMM { + cvtf2i mmx, xmmlm, srcSize=8, destSize=4, ext=0 + cvtf2i mmx, xmmhm, srcSize=8, destSize=4, ext=2 +}; + +def macroop CVTTPD2PI_MMX_M { + ldfp ufp1, seg, sib, "DISPLACEMENT", dataSize=8 + ldfp ufp2, seg, sib, "DISPLACEMENT + 8", dataSize=8 + cvtf2i mmx, ufp1, srcSize=8, destSize=4, ext=0 + cvtf2i mmx, ufp2, srcSize=8, destSize=4, ext=2 +}; + +def macroop CVTTPD2PI_MMX_P { + rdip t7 + ldfp ufp1, seg, riprel, "DISPLACEMENT", dataSize=8 + ldfp ufp2, seg, riprel, "DISPLACEMENT + 8", dataSize=8 + cvtf2i mmx, ufp1, srcSize=8, destSize=4, ext=0 + cvtf2i mmx, ufp2, srcSize=8, destSize=4, ext=2 +}; ''' diff --git a/src/arch/x86/isa/insts/simd128/floating_point/data_conversion/convert_floating_point_to_xmm_integer.py b/src/arch/x86/isa/insts/simd128/floating_point/data_conversion/convert_floating_point_to_xmm_integer.py index 683e2808d..041f891ef 100644 --- a/src/arch/x86/isa/insts/simd128/floating_point/data_conversion/convert_floating_point_to_xmm_integer.py +++ b/src/arch/x86/isa/insts/simd128/floating_point/data_conversion/convert_floating_point_to_xmm_integer.py @@ -54,8 +54,89 @@ # Authors: Gabe Black microcode = ''' -# CVTPS2DQ -# CVTPD2DQ -# CVTTPS2DQ -# CVTTPD2DQ +def macroop CVTPS2DQ_XMM_XMM { + cvtf2i xmml, xmmlm, size=4, ext=4 + cvtf2i xmmh, xmmhm, size=4, ext=4 +}; + +def macroop CVTPS2DQ_XMM_M { + ldfp ufp1, seg, sib, "DISPLACEMENT", dataSize=8 + ldfp ufp2, seg, sib, "DISPLACEMENT + 8", dataSize=8 + cvtf2i xmml, ufp1, size=4, ext=4 + cvtf2i xmmh, ufp2, size=4, ext=4 +}; + +def macroop CVTPS2DQ_XMM_P { + rdip t7 + ldfp ufp1, seg, riprel, "DISPLACEMENT", dataSize=8 + ldfp ufp2, seg, riprel, "DISPLACEMENT + 8", dataSize=8 + cvtf2i xmml, ufp1, size=4, ext=4 + cvtf2i xmmh, ufp2, size=4, ext=4 +}; + +def macroop CVTPD2DQ_XMM_XMM { + cvtf2i xmml, xmmlm, srcSize=8, destSize=4, ext=4 + cvtf2i xmml, xmmhm, srcSize=8, destSize=4, ext=(4 | 2) + lfpimm xmmh, 0 +}; + +def macroop CVTPD2DQ_XMM_M { + ldfp ufp1, seg, sib, "DISPLACEMENT", dataSize=8 + ldfp ufp2, seg, sib, "DISPLACEMENT + 8", dataSize=8 + cvtf2i xmml, ufp1, srcSize=8, destSize=4, ext=4 + cvtf2i xmml, ufp2, srcSize=8, destSize=4, ext=(4 | 2) + lfpimm xmmh, 0 +}; + +def macroop CVTPD2DQ_XMM_P { + rdip t7 + ldfp ufp1, seg, riprel, "DISPLACEMENT", dataSize=8 + ldfp ufp2, seg, riprel, "DISPLACEMENT + 8", dataSize=8 + cvtf2i xmml, ufp1, srcSize=8, destSize=4, ext=4 + cvtf2i xmml, ufp2, srcSize=8, destSize=4, ext=(4 | 2) + lfpimm xmmh, 0 +}; + +def macroop CVTTPS2DQ_XMM_XMM { + cvtf2i xmml, xmmlm, size=4, ext=0 + cvtf2i xmmh, xmmhm, size=4, ext=0 +}; + +def macroop CVTTPS2DQ_XMM_M { + ldfp ufp1, seg, sib, "DISPLACEMENT", dataSize=8 + ldfp ufp2, seg, sib, "DISPLACEMENT + 8", dataSize=8 + cvtf2i xmml, ufp1, size=4, ext=0 + cvtf2i xmmh, ufp2, size=4, ext=0 +}; + +def macroop CVTTPS2DQ_XMM_P { + rdip t7 + ldfp ufp1, seg, riprel, "DISPLACEMENT", dataSize=8 + ldfp ufp2, seg, riprel, "DISPLACEMENT + 8", dataSize=8 + cvtf2i xmml, ufp1, size=4, ext=0 + cvtf2i xmmh, ufp2, size=4, ext=0 +}; + +def macroop CVTTPD2DQ_XMM_XMM { + cvtf2i xmml, xmmlm, srcSize=8, destSize=4, ext=0 + cvtf2i xmml, xmmhm, srcSize=8, destSize=4, ext=2 + lfpimm xmmh, 0 +}; + +def macroop CVTTPD2DQ_XMM_M { + ldfp ufp1, seg, sib, "DISPLACEMENT", dataSize=8 + ldfp ufp2, seg, sib, "DISPLACEMENT + 8", dataSize=8 + cvtf2i xmml, ufp1, srcSize=8, destSize=4, ext=0 + cvtf2i xmml, ufp2, srcSize=8, destSize=4, ext=2 + lfpimm xmmh, 0 +}; + +def macroop CVTTPD2DQ_XMM_P { + rdip t7 + ldfp ufp1, seg, riprel, "DISPLACEMENT", dataSize=8 + ldfp ufp2, seg, riprel, "DISPLACEMENT + 8", dataSize=8 + cvtf2i xmml, ufp1, srcSize=8, destSize=4, ext=0 + cvtf2i xmml, ufp2, srcSize=8, destSize=4, ext=2 + lfpimm xmmh, 0 +}; ''' -- cgit v1.2.3