X86: Implement the media instructions that convert integer values to floating point.

This commit is contained in:
Gabe Black 2009-08-17 18:41:27 -07:00
parent 8e97cd9c8f
commit ae64377afe
5 changed files with 97 additions and 24 deletions

View file

@ -373,10 +373,7 @@
//because they are split in two, they use q (quadword). //because they are split in two, they use q (quadword).
0x0: Inst::MOVAPS(Vq,Wq); 0x0: Inst::MOVAPS(Vq,Wq);
0x1: Inst::MOVAPS(Wq,Vq); 0x1: Inst::MOVAPS(Wq,Vq);
0x2: decode MODRM_MOD { 0x2: Inst::CVTPI2PS(Vq,Qq);
0x3: cvtpi2pS_Vq_Pq();
default: cvtpi2ps_Vq_Mq();
}
0x3: movntps_Mo_Vo(); 0x3: movntps_Mo_Vo();
0x4: cvttps2pi_Pq_Wq(); 0x4: cvttps2pi_Pq_Wq();
0x5: cvtpS2pi_Pq_Wq(); 0x5: cvtpS2pi_Pq_Wq();
@ -385,7 +382,7 @@
} }
// repe (0xF3) // repe (0xF3)
0x4: decode OPCODE_OP_BOTTOM3 { 0x4: decode OPCODE_OP_BOTTOM3 {
0x2: cvtsi2ss_Vd_Ed(); 0x2: Inst::CVTSI2SS(Vd,Ed);
0x4: cvttss2si_Gd_Wd(); 0x4: cvttss2si_Gd_Wd();
0x5: cvtss2si_Gd_Wd(); 0x5: cvtss2si_Gd_Wd();
default: Inst::UD2(); default: Inst::UD2();
@ -394,10 +391,7 @@
0x1: decode OPCODE_OP_BOTTOM3 { 0x1: decode OPCODE_OP_BOTTOM3 {
0x0: movapd_Vo_Wo(); 0x0: movapd_Vo_Wo();
0x1: movapd_Wo_Vo(); 0x1: movapd_Wo_Vo();
0x2: decode MODRM_MOD { 0x2: Inst::CVTPI2PD(Vo,Qq);
0x3: cvtpi2pd_Vo_Pq();
default: cvtpi2pd_Vo_Mq();
}
0x3: movntpd_Mo_Vo(); 0x3: movntpd_Mo_Vo();
0x4: cvttpd2pi_Pq_Wo(); 0x4: cvttpd2pi_Pq_Wo();
0x5: cvtpd2pi_Pq_Wo(); 0x5: cvtpd2pi_Pq_Wo();
@ -507,7 +501,7 @@
0x0: Inst::ADDPS(Vo,Wo); 0x0: Inst::ADDPS(Vo,Wo);
0x1: Inst::MULPS(Vo,Wo); 0x1: Inst::MULPS(Vo,Wo);
0x2: cvtps2pd_Vo_Wq(); 0x2: cvtps2pd_Vo_Wq();
0x3: cvtdq2ps_Vo_Wo(); 0x3: Inst::CVTDQ2PS(Vo,Wo);
0x4: Inst::SUBPS(Vo,Wo); 0x4: Inst::SUBPS(Vo,Wo);
0x5: Inst::MINPS(Vo,Wo); 0x5: Inst::MINPS(Vo,Wo);
0x6: Inst::DIVPS(Vo,Wo); 0x6: Inst::DIVPS(Vo,Wo);
@ -914,7 +908,7 @@
// no prefix // no prefix
0x0: decode OPCODE_OP_BOTTOM3 { 0x0: decode OPCODE_OP_BOTTOM3 {
0x2: cmpccps_Vo_Wo_Ib(); 0x2: cmpccps_Vo_Wo_Ib();
0x3: cvtdq2ps_Vo_Wo(); 0x3: Inst::CVTDQ2PS(Vo,Wo);
0x4: Inst::SUBPS(Vo,Wo); 0x4: Inst::SUBPS(Vo,Wo);
0x5: Inst::MINPS(Vo,Wo); 0x5: Inst::MINPS(Vo,Wo);
0x6: Inst::DIVPS(Vo,Wo); 0x6: Inst::DIVPS(Vo,Wo);
@ -1019,7 +1013,7 @@
} }
// repe (0xF3) // repe (0xF3)
0x4: decode OPCODE_OP_BOTTOM3 { 0x4: decode OPCODE_OP_BOTTOM3 {
0x6: cvtdq2pd_Vo_Wq(); 0x6: Inst::CVTDQ2PD(Vo,Wq);
default: Inst::UD2(); default: Inst::UD2();
} }
// operand size (0x66) // operand size (0x66)

View file

@ -54,20 +54,35 @@
# Authors: Gabe Black # Authors: Gabe Black
microcode = ''' 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 { 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 { def macroop CVTSI2SD_XMM_M {
ld t1, seg, sib, disp ldfp ufp1, seg, sib, disp, dataSize=8
cvtf_i2d xmml, t1 cvti2f xmml, ufp1, srcSize=dsz, destSize=8, ext=1
}; };
def macroop CVTSI2SD_XMM_P { def macroop CVTSI2SD_XMM_P {
rdip t7 rdip t7
ld t1, seg, riprel, disp ldfp ufp1, seg, riprel, disp, dataSize=8
cvtf_i2d xmml, t1 cvti2f xmml, ufp1, srcSize=dsz, destSize=8, ext=1
}; };
''' '''

View file

@ -54,6 +54,41 @@
# Authors: Gabe Black # Authors: Gabe Black
microcode = ''' microcode = '''
# CVTDQ2PS def macroop CVTDQ2PS_XMM_XMM {
# CVTDQ2PD 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
};
''' '''

View file

@ -54,6 +54,36 @@
# Authors: Gabe Black # Authors: Gabe Black
microcode = ''' microcode = '''
# CVTPI2PS def macroop CVTPI2PS_XMM_MMX {
# CVTPI2PD 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
};
''' '''

View file

@ -54,8 +54,7 @@
# Authors: Gabe Black # Authors: Gabe Black
microcode = ''' microcode = '''
# CVTPI2PS # CVTPI2PS and CVTPI2PD are implemented in simd128
# CVTPI2PD
# PI2FW # PI2FW
# PI2FD # PI2FD
''' '''