summaryrefslogtreecommitdiff
path: root/src/arch/x86/isa/insts
diff options
context:
space:
mode:
authorNilay Vaish <nilay@cs.wisc.edu>2015-04-13 17:33:57 -0500
committerNilay Vaish <nilay@cs.wisc.edu>2015-04-13 17:33:57 -0500
commite596e524985cfb1f4d46aceebe69bb7fcd94cf04 (patch)
tree239adb15c9604a115a87d7d475b48593c5dd8786 /src/arch/x86/isa/insts
parentdea7acdb3e0357e580bc4e15e3346177b58d7ee0 (diff)
downloadgem5-e596e524985cfb1f4d46aceebe69bb7fcd94cf04.tar.xz
x86: implements x87 mult/div instructions
Diffstat (limited to 'src/arch/x86/isa/insts')
-rw-r--r--src/arch/x86/isa/insts/x87/arithmetic/division.py59
-rw-r--r--src/arch/x86/isa/insts/x87/arithmetic/multiplication.py59
2 files changed, 114 insertions, 4 deletions
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
'''