X86: Implement the media instructions that convert integer values to floating point.
authorGabe Black <gblack@eecs.umich.edu>
Tue, 18 Aug 2009 01:41:27 +0000 (18:41 -0700)
committerGabe Black <gblack@eecs.umich.edu>
Tue, 18 Aug 2009 01:41:27 +0000 (18:41 -0700)
src/arch/x86/isa/decoder/two_byte_opcodes.isa
src/arch/x86/isa/insts/simd128/integer/data_conversion/convert_gpr_integer_to_floating_point.py
src/arch/x86/isa/insts/simd128/integer/data_conversion/convert_integer_to_floating_point.py
src/arch/x86/isa/insts/simd128/integer/data_conversion/convert_mmx_integer_to_floating_point.py
src/arch/x86/isa/insts/simd64/integer/data_conversion.py

index eccfee1b37ecc800d4977e2b8dd29ee4af4d35d2..3b8bd1ed8e451337079f9a26c8d6a44d5319d3d0 100644 (file)
                     //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();
                 }
                 // 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();
                 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();
                     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);
                     // 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);
                 }
                 // repe (0xF3)
                 0x4: decode OPCODE_OP_BOTTOM3 {
-                    0x6: cvtdq2pd_Vo_Wq();
+                    0x6: Inst::CVTDQ2PD(Vo,Wq);
                     default: Inst::UD2();
                 }
                 // operand size (0x66)
index a900b374a8538e2fa0dd6282755ed103b52ee1fd..8d632a0accf7fc87d617edf9bc384406b57c86bb 100644 (file)
 # 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
 };
 '''
index 41e8549b538c51a53faf88bdaf577b62429fd36a..21cfdcc68f3b5f291e69525d2e7556abf511b51b 100644 (file)
 # 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
+};
 '''
index aeaea26cd6536f3cadbccb42f6df0193e22b8374..bc09d8b9288a282f2d992599cc64b8cfcbcfef43 100644 (file)
 # 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
+};
 '''
index f41049171d6e70639cfacc48d4db7ae7742d20f5..5b1c8703ab165bc90d7204633204763155ed7326 100644 (file)
@@ -54,8 +54,7 @@
 # Authors: Gabe Black
 
 microcode = '''
-# CVTPI2PS
-# CVTPI2PD
+# CVTPI2PS and CVTPI2PD are implemented in simd128
 # PI2FW
 # PI2FD
 '''