From ae64377afe0373a56ad14a492cc758e8e4a8d9e8 Mon Sep 17 00:00:00 2001 From: Gabe Black Date: Mon, 17 Aug 2009 18:41:27 -0700 Subject: X86: Implement the media instructions that convert integer values to floating point. --- src/arch/x86/isa/decoder/two_byte_opcodes.isa | 18 ++++------ .../convert_gpr_integer_to_floating_point.py | 27 +++++++++++---- .../convert_integer_to_floating_point.py | 39 ++++++++++++++++++++-- .../convert_mmx_integer_to_floating_point.py | 34 +++++++++++++++++-- .../isa/insts/simd64/integer/data_conversion.py | 3 +- 5 files changed, 97 insertions(+), 24 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 eccfee1b3..3b8bd1ed8 100644 --- a/src/arch/x86/isa/decoder/two_byte_opcodes.isa +++ b/src/arch/x86/isa/decoder/two_byte_opcodes.isa @@ -373,10 +373,7 @@ //because they are split in two, they use q (quadword). 0x0: Inst::MOVAPS(Vq,Wq); 0x1: Inst::MOVAPS(Wq,Vq); - 0x2: decode MODRM_MOD { - 0x3: cvtpi2pS_Vq_Pq(); - default: cvtpi2ps_Vq_Mq(); - } + 0x2: Inst::CVTPI2PS(Vq,Qq); 0x3: movntps_Mo_Vo(); 0x4: cvttps2pi_Pq_Wq(); 0x5: cvtpS2pi_Pq_Wq(); @@ -385,7 +382,7 @@ } // repe (0xF3) 0x4: decode OPCODE_OP_BOTTOM3 { - 0x2: cvtsi2ss_Vd_Ed(); + 0x2: Inst::CVTSI2SS(Vd,Ed); 0x4: cvttss2si_Gd_Wd(); 0x5: cvtss2si_Gd_Wd(); default: Inst::UD2(); @@ -394,10 +391,7 @@ 0x1: decode OPCODE_OP_BOTTOM3 { 0x0: movapd_Vo_Wo(); 0x1: movapd_Wo_Vo(); - 0x2: decode MODRM_MOD { - 0x3: cvtpi2pd_Vo_Pq(); - default: cvtpi2pd_Vo_Mq(); - } + 0x2: Inst::CVTPI2PD(Vo,Qq); 0x3: movntpd_Mo_Vo(); 0x4: cvttpd2pi_Pq_Wo(); 0x5: cvtpd2pi_Pq_Wo(); @@ -507,7 +501,7 @@ 0x0: Inst::ADDPS(Vo,Wo); 0x1: Inst::MULPS(Vo,Wo); 0x2: cvtps2pd_Vo_Wq(); - 0x3: cvtdq2ps_Vo_Wo(); + 0x3: Inst::CVTDQ2PS(Vo,Wo); 0x4: Inst::SUBPS(Vo,Wo); 0x5: Inst::MINPS(Vo,Wo); 0x6: Inst::DIVPS(Vo,Wo); @@ -914,7 +908,7 @@ // no prefix 0x0: decode OPCODE_OP_BOTTOM3 { 0x2: cmpccps_Vo_Wo_Ib(); - 0x3: cvtdq2ps_Vo_Wo(); + 0x3: Inst::CVTDQ2PS(Vo,Wo); 0x4: Inst::SUBPS(Vo,Wo); 0x5: Inst::MINPS(Vo,Wo); 0x6: Inst::DIVPS(Vo,Wo); @@ -1019,7 +1013,7 @@ } // repe (0xF3) 0x4: decode OPCODE_OP_BOTTOM3 { - 0x6: cvtdq2pd_Vo_Wq(); + 0x6: Inst::CVTDQ2PD(Vo,Wq); default: Inst::UD2(); } // operand size (0x66) diff --git a/src/arch/x86/isa/insts/simd128/integer/data_conversion/convert_gpr_integer_to_floating_point.py b/src/arch/x86/isa/insts/simd128/integer/data_conversion/convert_gpr_integer_to_floating_point.py index a900b374a..8d632a0ac 100644 --- a/src/arch/x86/isa/insts/simd128/integer/data_conversion/convert_gpr_integer_to_floating_point.py +++ b/src/arch/x86/isa/insts/simd128/integer/data_conversion/convert_gpr_integer_to_floating_point.py @@ -54,20 +54,35 @@ # Authors: Gabe Black microcode = ''' -# CVTSI2SS +def macroop CVTSI2SS_XMM_R { + mov2fp ufp1, regm, destSize=dsz, srcSize=dsz + cvti2f xmml, ufp1, srcSize=dsz, destSize=4, ext=1 +}; + +def macroop CVTSI2SS_XMM_M { + ldfp ufp1, seg, sib, disp, dataSize=8 + cvti2f xmml, ufp1, srcSize=dsz, destSize=4, ext=1 +}; + +def macroop CVTSI2SS_XMM_P { + rdip t7 + ldfp ufp1, seg, riprel, disp, dataSize=8 + cvti2f xmml, ufp1, srcSize=dsz, destSize=4, ext=1 +}; def macroop CVTSI2SD_XMM_R { - cvtf_i2d xmml, regm + mov2fp ufp1, regm, destSize=dsz, srcSize=dsz + cvti2f xmml, ufp1, srcSize=dsz, destSize=8, ext=1 }; def macroop CVTSI2SD_XMM_M { - ld t1, seg, sib, disp - cvtf_i2d xmml, t1 + ldfp ufp1, seg, sib, disp, dataSize=8 + cvti2f xmml, ufp1, srcSize=dsz, destSize=8, ext=1 }; def macroop CVTSI2SD_XMM_P { rdip t7 - ld t1, seg, riprel, disp - cvtf_i2d xmml, t1 + ldfp ufp1, seg, riprel, disp, dataSize=8 + cvti2f xmml, ufp1, srcSize=dsz, destSize=8, ext=1 }; ''' diff --git a/src/arch/x86/isa/insts/simd128/integer/data_conversion/convert_integer_to_floating_point.py b/src/arch/x86/isa/insts/simd128/integer/data_conversion/convert_integer_to_floating_point.py index 41e8549b5..21cfdcc68 100644 --- a/src/arch/x86/isa/insts/simd128/integer/data_conversion/convert_integer_to_floating_point.py +++ b/src/arch/x86/isa/insts/simd128/integer/data_conversion/convert_integer_to_floating_point.py @@ -54,6 +54,41 @@ # Authors: Gabe Black microcode = ''' -# CVTDQ2PS -# CVTDQ2PD +def macroop CVTDQ2PS_XMM_XMM { + cvti2f xmml, xmmlm, size=4, ext=0 + cvti2f xmmh, xmmhm, size=4, ext=0 +}; + +def macroop CVTDQ2PS_XMM_M { + ldfp ufp1, seg, sib, "DISPLACEMENT", dataSize=8 + ldfp ufp2, seg, sib, "DISPLACEMENT + 8", dataSize=8 + cvti2f xmml, ufp1, size=4, ext=0 + cvti2f xmmh, ufp2, size=4, ext=0 +}; + +def macroop CVTDQ2PS_XMM_P { + rdip t7 + ldfp ufp1, seg, riprel, "DISPLACEMENT", dataSize=8 + ldfp ufp2, seg, riprel, "DISPLACEMENT + 8", dataSize=8 + cvti2f xmml, ufp1, size=4, ext=0 + cvti2f xmmh, ufp2, size=4, ext=0 +}; + +def macroop CVTDQ2PD_XMM_XMM { + cvti2f xmmh, xmmlm, srcSize=4, destSize=8, ext=2 + cvti2f xmml, xmmlm, srcSize=4, destSize=8, ext=0 +}; + +def macroop CVTDQ2PD_XMM_M { + ldfp ufp1, seg, sib, disp, dataSize=8 + cvti2f xmml, ufp1, srcSize=4, destSize=8, ext=0 + cvti2f xmmh, ufp1, srcSize=4, destSize=8, ext=2 +}; + +def macroop CVTDQ2PD_XMM_P { + rdip t7 + ldfp ufp1, seg, riprel, disp, dataSize=8 + cvti2f xmml, ufp1, srcSize=4, destSize=8, ext=0 + cvti2f xmmh, ufp1, srcSize=4, destSize=8, ext=2 +}; ''' diff --git a/src/arch/x86/isa/insts/simd128/integer/data_conversion/convert_mmx_integer_to_floating_point.py b/src/arch/x86/isa/insts/simd128/integer/data_conversion/convert_mmx_integer_to_floating_point.py index aeaea26cd..bc09d8b92 100644 --- a/src/arch/x86/isa/insts/simd128/integer/data_conversion/convert_mmx_integer_to_floating_point.py +++ b/src/arch/x86/isa/insts/simd128/integer/data_conversion/convert_mmx_integer_to_floating_point.py @@ -54,6 +54,36 @@ # Authors: Gabe Black microcode = ''' -# CVTPI2PS -# CVTPI2PD +def macroop CVTPI2PS_XMM_MMX { + cvti2f xmml, mmxm, size=4, ext=0 +}; + +def macroop CVTPI2PS_XMM_M { + ldfp ufp1, seg, sib, disp, dataSize=8 + cvti2f xmml, ufp1, size=4, ext=0 +}; + +def macroop CVTPI2PS_XMM_P { + rdip t7 + ldfp ufp1, seg, riprel, disp, dataSize=8 + cvti2f xmml, ufp1, size=4, ext=0 +}; + +def macroop CVTPI2PD_XMM_MMX { + cvti2f xmml, mmxm, srcSize=4, destSize=8, ext=0 + cvti2f xmmh, mmxm, srcSize=4, destSize=8, ext=2 +}; + +def macroop CVTPI2PD_XMM_M { + ldfp ufp1, seg, sib, disp, dataSize=8 + cvti2f xmml, ufp1, srcSize=4, destSize=8, ext=0 + cvti2f xmmh, ufp1, srcSize=4, destSize=8, ext=2 +}; + +def macroop CVTPI2PD_XMM_P { + rdip t7 + ldfp ufp1, seg, riprel, disp, dataSize=8 + cvti2f xmml, ufp1, srcSize=4, destSize=8, ext=0 + cvti2f xmmh, ufp1, srcSize=4, destSize=8, ext=2 +}; ''' diff --git a/src/arch/x86/isa/insts/simd64/integer/data_conversion.py b/src/arch/x86/isa/insts/simd64/integer/data_conversion.py index f41049171..5b1c8703a 100644 --- a/src/arch/x86/isa/insts/simd64/integer/data_conversion.py +++ b/src/arch/x86/isa/insts/simd64/integer/data_conversion.py @@ -54,8 +54,7 @@ # Authors: Gabe Black microcode = ''' -# CVTPI2PS -# CVTPI2PD +# CVTPI2PS and CVTPI2PD are implemented in simd128 # PI2FW # PI2FD ''' -- cgit v1.2.3