From f5ac4f51d94ff24818f17c768e17893629f5910c 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 convert between forms of floating point. --- src/arch/x86/isa/decoder/two_byte_opcodes.isa | 8 +- ...onvert_floating_point_to_floating_point.py | 74 ++++++++++++++++++- 2 files changed, 74 insertions(+), 8 deletions(-) diff --git a/src/arch/x86/isa/decoder/two_byte_opcodes.isa b/src/arch/x86/isa/decoder/two_byte_opcodes.isa index 2fdb6371d..200f130dc 100644 --- a/src/arch/x86/isa/decoder/two_byte_opcodes.isa +++ b/src/arch/x86/isa/decoder/two_byte_opcodes.isa @@ -500,7 +500,7 @@ 0x0: decode OPCODE_OP_BOTTOM3 { 0x0: Inst::ADDPS(Vo,Wo); 0x1: Inst::MULPS(Vo,Wo); - 0x2: cvtps2pd_Vo_Wq(); + 0x2: Inst::CVTPS2PD(Vo,Wq); 0x3: Inst::CVTDQ2PS(Vo,Wo); 0x4: Inst::SUBPS(Vo,Wo); 0x5: Inst::MINPS(Vo,Wo); @@ -511,7 +511,7 @@ 0x4: decode OPCODE_OP_BOTTOM3 { 0x0: Inst::ADDSS(Vd,Wd); 0x1: Inst::MULSS(Vd,Wd); - 0x2: cvtss2sd_Vq_Wd(); + 0x2: Inst::CVTSS2SD(Vq,Wd); 0x3: cvttps2dq_Vo_Wo(); 0x4: Inst::SUBSS(Vd,Wd); 0x5: Inst::MINSS(Vd,Wd); @@ -522,7 +522,7 @@ 0x1: decode OPCODE_OP_BOTTOM3 { 0x0: Inst::ADDPD(Vo,Wo); 0x1: Inst::MULPD(Vo,Wo); - 0x2: cvtpd2ps_Vo_Wo(); + 0x2: Inst::CVTPD2PS(Vo,Wo); 0x3: cvtps2dq_Vo_Wo(); 0x4: Inst::SUBPD(Vo,Wo); 0x5: Inst::MINPD(Vo,Wo); @@ -533,7 +533,7 @@ 0x8: decode OPCODE_OP_BOTTOM3 { 0x0: Inst::ADDSD(Vq,Wq); 0x1: Inst::MULSD(Vq,Wq); - 0x2: cvtsd2ss_Vd_Wq(); + 0x2: Inst::CVTSD2SS(Vd,Wq); 0x4: Inst::SUBSD(Vq,Wq); 0x5: Inst::MINSD(Vq,Wq); 0x6: Inst::DIVSD(Vq,Wq); diff --git a/src/arch/x86/isa/insts/simd128/floating_point/data_conversion/convert_floating_point_to_floating_point.py b/src/arch/x86/isa/insts/simd128/floating_point/data_conversion/convert_floating_point_to_floating_point.py index 2de33efa2..1c36f7e45 100644 --- a/src/arch/x86/isa/insts/simd128/floating_point/data_conversion/convert_floating_point_to_floating_point.py +++ b/src/arch/x86/isa/insts/simd128/floating_point/data_conversion/convert_floating_point_to_floating_point.py @@ -54,8 +54,74 @@ # Authors: Gabe Black microcode = ''' -# CVTPS2PD -# CVTPD2PS -# CVTSS2SD -# CVTSD2SS +def macroop CVTSS2SD_XMM_XMM { + cvtf2f xmml, xmmlm, destSize=8, srcSize=4, ext=1 +}; + +def macroop CVTSS2SD_XMM_M { + ldfp ufp1, seg, sib, disp, dataSize=8 + cvtf2f xmml, ufp1, destSize=8, srcSize=4, ext=1 +}; + +def macroop CVTSS2SD_XMM_P { + rdip t7 + ldfp ufp1, seg, riprel, disp, dataSize=8 + cvtf2f xmml, ufp1, destSize=8, srcSize=4, ext=1 +}; + +def macroop CVTSD2SS_XMM_XMM { + cvtf2f xmml, xmmlm, destSize=4, srcSize=8, ext=1 +}; + +def macroop CVTSD2SS_XMM_M { + ldfp ufp1, seg, sib, disp, dataSize=8 + cvtf2f xmml, ufp1, destSize=4, srcSize=8, ext=1 +}; + +def macroop CVTSD2SS_XMM_P { + rdip t7 + ldfp ufp1, seg, riprel, disp, dataSize=8 + cvtf2f xmml, ufp1, destSize=4, srcSize=8, ext=1 +}; + +def macroop CVTPS2PD_XMM_XMM { + cvtf2f xmmh, xmmlm, destSize=8, srcSize=4, ext=2 + cvtf2f xmml, xmmlm, destSize=8, srcSize=4, ext=0 +}; + +def macroop CVTPS2PD_XMM_M { + ldfp ufp1, seg, sib, disp, dataSize=8 + cvtf2f xmmh, ufp1, destSize=8, srcSize=4, ext=2 + cvtf2f xmml, ufp1, destSize=8, srcSize=4, ext=0 +}; + +def macroop CVTPS2PD_XMM_P { + rdip t7 + ldfp ufp1, seg, riprel, disp, dataSize=8 + cvtf2f xmmh, ufp1, destSize=8, srcSize=4, ext=2 + cvtf2f xmml, ufp1, destSize=8, srcSize=4, ext=0 +}; + +def macroop CVTPD2PS_XMM_XMM { + cvtf2f xmml, xmmlm, destSize=4, srcSize=8, ext=0 + cvtf2f xmml, xmmhm, destSize=4, srcSize=8, ext=2 + lfpimm xmmh, 0 +}; + +def macroop CVTPD2PS_XMM_M { + ldfp ufp1, seg, sib, "DISPLACEMENT", dataSize=8 + ldfp ufp2, seg, sib, "DISPLACEMENT + 8", dataSize=8 + cvtf2f xmml, ufp1, destSize=4, srcSize=8, ext=0 + cvtf2f xmml, ufp2, destSize=4, srcSize=8, ext=2 + lfpimm xmmh, 0 +}; + +def macroop CVTPD2PS_XMM_P { + rdip t7 + ldfp ufp1, seg, riprel, "DISPLACEMENT", dataSize=8 + ldfp ufp2, seg, riprel, "DISPLACEMENT + 8", dataSize=8 + cvtf2f xmml, ufp1, destSize=4, srcSize=8, ext=0 + cvtf2f xmml, ufp2, destSize=4, srcSize=8, ext=2 + lfpimm xmmh, 0 +}; ''' -- 2.30.2