diff options
author | Nilay Vaish <nilay@cs.wisc.edu> | 2015-04-13 17:33:57 -0500 |
---|---|---|
committer | Nilay Vaish <nilay@cs.wisc.edu> | 2015-04-13 17:33:57 -0500 |
commit | e596e524985cfb1f4d46aceebe69bb7fcd94cf04 (patch) | |
tree | 239adb15c9604a115a87d7d475b48593c5dd8786 /src/arch/x86/isa | |
parent | dea7acdb3e0357e580bc4e15e3346177b58d7ee0 (diff) | |
download | gem5-e596e524985cfb1f4d46aceebe69bb7fcd94cf04.tar.xz |
x86: implements x87 mult/div instructions
Diffstat (limited to 'src/arch/x86/isa')
-rw-r--r-- | src/arch/x86/isa/decoder/x87.isa | 23 | ||||
-rw-r--r-- | src/arch/x86/isa/insts/x87/arithmetic/division.py | 59 | ||||
-rw-r--r-- | src/arch/x86/isa/insts/x87/arithmetic/multiplication.py | 59 |
3 files changed, 130 insertions, 11 deletions
diff --git a/src/arch/x86/isa/decoder/x87.isa b/src/arch/x86/isa/decoder/x87.isa index b325728ba..b53c48e78 100644 --- a/src/arch/x86/isa/decoder/x87.isa +++ b/src/arch/x86/isa/decoder/x87.isa @@ -45,7 +45,10 @@ format WarnUnimpl { // 32-bit memory operand default: Inst::FADD1(Md); } - 0x1: fmul(); + 0x1: decode MODRM_MOD { + 0x3: Inst::FMUL1(Eq); + default: Inst::FMUL1(Md); + } 0x2: fcom(); 0x3: fcomp(); 0x4: decode MODRM_MOD { @@ -53,7 +56,10 @@ format WarnUnimpl { default: Inst::FSUB1(Md); } 0x5: fsubr(); - 0x6: fdiv(); + 0x6: decode MODRM_MOD { + 0x3: Inst::FDIV1(Eq); + default: Inst::FDIV1(Md); + } 0x7: fdivr(); } 0x1: decode MODRM_REG { @@ -210,7 +216,10 @@ format WarnUnimpl { 0x3: Inst::FADD2(Eq); default: Inst::FADD2(Mq); } - 0x1: fmul(); + 0x1: decode MODRM_MOD { + 0x3: Inst::FMUL2(Eq); + default: Inst::FMUL2(Mq); + } 0x2: decode MODRM_MOD { 0x3: Inst::UD2(); default: fcom(); @@ -229,10 +238,10 @@ format WarnUnimpl { } 0x6: decode MODRM_MOD { 0x3: fdivr(); - default: fdiv(); + default: Inst::FDIV2(Mq); } 0x7: decode MODRM_MOD { - 0x3: fdiv(); + 0x3: Inst::FDIV2(Eq); default: fdivr(); } } @@ -282,7 +291,7 @@ format WarnUnimpl { default: fiadd(); } 0x1: decode MODRM_MOD { - 0x3: fmulp(); + 0x3: Inst::FMULP(Eq); default: fimul(); } 0x2: decode MODRM_MOD { @@ -312,7 +321,7 @@ format WarnUnimpl { default: fidiv(); } 0x7: decode MODRM_MOD { - 0x3: fdivp(); + 0x3: Inst::FDIVP(Eq); default: fidivr(); } } diff --git a/src/arch/x86/isa/insts/x87/arithmetic/division.py b/src/arch/x86/isa/insts/x87/arithmetic/division.py index 3e4108d18..fe9829913 100644 --- a/src/arch/x86/isa/insts/x87/arithmetic/division.py +++ b/src/arch/x86/isa/insts/x87/arithmetic/division.py @@ -36,8 +36,63 @@ # Authors: Gabe Black microcode = ''' -# FDIV -# FDIVP +def macroop FDIV1_R +{ + divfp st(0), st(0), sti +}; + + +def macroop FDIV1_M +{ + ldfp87 ufp1, seg, sib, disp + divfp st(0), st(0), ufp1 +}; + +def macroop FDIV1_P +{ + rdip t7 + ldfp87 ufp1, seg, riprel, disp + divfp st(0), st(0), ufp1 +}; + +def macroop FDIV2_R +{ + divfp sti, sti, st(0) +}; + +def macroop FDIV2_M +{ + ldfp87 ufp1, seg, sib, disp + divfp st(0), st(0), ufp1 +}; + +def macroop FDIV2_P +{ + rdip t7 + ldfp87 ufp1, seg, riprel, disp + divfp st(0), st(0), ufp1 +}; + +def macroop FDIVP +{ + divfp st(1), st(1), st(0), spm=1 +}; + +def macroop FDIVP_R +{ + divfp sti, sti, st(0), spm=1 +}; + +def macroop FDIVP_M +{ + fault "std::make_shared<UnimpInstFault>()" +}; + +def macroop FDIVP_P +{ + fault "std::make_shared<UnimpInstFault>()" +}; + # FIDIV # FDIVR # FDIVRP diff --git a/src/arch/x86/isa/insts/x87/arithmetic/multiplication.py b/src/arch/x86/isa/insts/x87/arithmetic/multiplication.py index d47f3fa6c..543896f3c 100644 --- a/src/arch/x86/isa/insts/x87/arithmetic/multiplication.py +++ b/src/arch/x86/isa/insts/x87/arithmetic/multiplication.py @@ -36,7 +36,62 @@ # Authors: Gabe Black microcode = ''' -# FMUL -# FMULP +def macroop FMUL1_R +{ + mulfp st(0), sti, st(0) +}; + + +def macroop FMUL1_M +{ + ldfp87 ufp1, seg, sib, disp + mulfp st(0), st(0), ufp1 +}; + +def macroop FMUL1_P +{ + rdip t7 + ldfp87 ufp1, seg, riprel, disp + mulfp st(0), st(0), ufp1 +}; + +def macroop FMUL2_R +{ + mulfp sti, sti, st(0) +}; + +def macroop FMUL2_M +{ + ldfp87 ufp1, seg, sib, disp + mulfp st(0), st(0), ufp1 +}; + +def macroop FMUL2_P +{ + rdip t7 + ldfp87 ufp1, seg, riprel, disp + mulfp st(0), st(0), ufp1 +}; + +def macroop FMULP +{ + mulfp st(1), st(0), st(1), spm=1 +}; + +def macroop FMULP_R +{ + mulfp sti, sti, st(0), spm=1 +}; + +def macroop FMULP_M +{ + fault "std::make_shared<UnimpInstFault>()" +}; + +def macroop FMULP_P +{ + fault "std::make_shared<UnimpInstFault>()" +}; + # FIMUL ''' |