Kyle Roarty has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/42443 )

Change subject: arch-x86: Add insts used in newer libstdc++ rehashing
......................................................................

arch-x86: Add insts used in newer libstdc++ rehashing

For newer versions of libstdc++ (Like the one in the
ubuntu-20.04_all-dependencies docker image), the variables used when
rehashing, e.g., std::unordered_maps have been extended. This resulted
in the rehashing function using different, unimplemented, instructions.

Because these instructions are unimplemented, it resulted in a
std::bad_alloc exception when inserting into an unordered_map

This patchset implements the following instructions:
FCOMI
FSUBRP
FISTP

Change-Id: I85c57acace1f7a547b0a97ec3a0f0500909c5d2a
---
M src/arch/x86/isa/decoder/x87.isa
M src/arch/x86/isa/insts/x87/arithmetic/subtraction.py
M src/arch/x86/isa/insts/x87/compare_and_test/floating_point_ordered_compare.py M src/arch/x86/isa/insts/x87/data_transfer_and_conversion/convert_and_load_or_store_integer.py
M src/arch/x86/isa/microops/ldstop.isa
5 files changed, 65 insertions(+), 8 deletions(-)



diff --git a/src/arch/x86/isa/decoder/x87.isa b/src/arch/x86/isa/decoder/x87.isa
index 258fcb5..c28bc2f 100644
--- a/src/arch/x86/isa/decoder/x87.isa
+++ b/src/arch/x86/isa/decoder/x87.isa
@@ -185,7 +185,7 @@
             }
             0x3: decode MODRM_MOD {
                 0x3: fcmovnu();
-                default: fistp();
+                default: Inst::FISTP(Md); // 32-bit int
             }
             0x4: decode MODRM_MOD {
                 0x3: decode MODRM_RM {
@@ -203,7 +203,7 @@
                 default: Inst::FLD80(M);
             }
             0x6: decode MODRM_MOD {
-                0x3: fcomi();
+                0x3: Inst::FCOMI(Rq);
                 default: Inst::UD2();
             }
             0x7: decode MODRM_MOD {
@@ -307,7 +307,10 @@
                 default: ficomp();
             }
             0x4: decode MODRM_MOD {
-                0x3: fsubrp();
+                0x3: decode MODRM_RM {
+                    0x1: Inst::FSUBRP();
+                    default: Inst::FSUBRP(Eq);
+                }
                 default: fisub();
             }
             0x5: decode MODRM_MOD {
@@ -344,7 +347,7 @@
             }
             0x3: decode MODRM_MOD {
                 0x3: Inst::UD2();
-                default: fistp();
+                default: Inst::FISTP(Mw); // 16-bit int
             }
             0x4: decode MODRM_MOD {
                 0x3: decode MODRM_RM {
@@ -365,7 +368,7 @@
             }
             0x7: decode MODRM_MOD {
                 0x3: Inst::UD2();
-                default: fistp();
+                default: Inst::FISTP(Mq);
             }
         }
     }
diff --git a/src/arch/x86/isa/insts/x87/arithmetic/subtraction.py b/src/arch/x86/isa/insts/x87/arithmetic/subtraction.py
index 02c41f6..97cdb45 100644
--- a/src/arch/x86/isa/insts/x87/arithmetic/subtraction.py
+++ b/src/arch/x86/isa/insts/x87/arithmetic/subtraction.py
@@ -91,8 +91,27 @@
    fault "std::make_shared<UnimpInstFault>()"
 };

+def macroop FSUBRP
+{
+    subfp st(1), st(0), st(1), spm=1
+};
+
+def macroop FSUBRP_R
+{
+    subfp sti, st(0), sti, spm=1
+};
+
+def macroop FSUBRP_M
+{
+    fault "std::make_shared<UnimpInstFault>()"
+};
+
+def macroop FSUBRP_P
+{
+    fault "std::make_shared<UnimpInstFault>()"
+};
+
 # FISUB
 # FSUBR
-# FSUBRP
 # FISUBR
 '''
diff --git a/src/arch/x86/isa/insts/x87/compare_and_test/floating_point_ordered_compare.py b/src/arch/x86/isa/insts/x87/compare_and_test/floating_point_ordered_compare.py
index 5e03952..a3e71e9 100644
--- a/src/arch/x86/isa/insts/x87/compare_and_test/floating_point_ordered_compare.py +++ b/src/arch/x86/isa/insts/x87/compare_and_test/floating_point_ordered_compare.py
@@ -37,6 +37,11 @@
 # FCOM
 # FCOMP
 # FCOMPP
-# FCOMI
 # FCOMIP
+
+#fcomi
+def macroop FCOMI_R {
+    compfp st(0), sti
+};
+
 '''
diff --git a/src/arch/x86/isa/insts/x87/data_transfer_and_conversion/convert_and_load_or_store_integer.py b/src/arch/x86/isa/insts/x87/data_transfer_and_conversion/convert_and_load_or_store_integer.py
index 1dbe79f..515b98b 100644
--- a/src/arch/x86/isa/insts/x87/data_transfer_and_conversion/convert_and_load_or_store_integer.py +++ b/src/arch/x86/isa/insts/x87/data_transfer_and_conversion/convert_and_load_or_store_integer.py
@@ -50,6 +50,19 @@
 };

 # FIST
-# FISTP
+
+def macroop FISTP_M {
+    movfp ufp1, st(0)
+    stifp87 ufp1, seg, sib, disp
+    pop87
+};
+
+def macroop FISTP_P {
+    movfp ufp1, st(0)
+    rdip t7
+    stifp87 ufp1, seg, riprel, disp
+    pop87
+};
+
 # FISTTP
 '''
diff --git a/src/arch/x86/isa/microops/ldstop.isa b/src/arch/x86/isa/microops/ldstop.isa
index 79aadfa..0186bc6 100644
--- a/src/arch/x86/isa/microops/ldstop.isa
+++ b/src/arch/x86/isa/microops/ldstop.isa
@@ -649,6 +649,23 @@
         }
     ''')

+    defineMicroStoreOp('Stifp87', code='''
+        switch (dataSize)
+        {
+          case 2: {
+            Mem = (int16_t)FpData_df;
+          } break;
+          case 4: {
+            Mem = (int32_t)FpData_df;
+          } break;
+          case 8: {
+            Mem = (int64_t)FpData_df;
+          } break;
+          default:
+            panic("Unhandled data size in StiFp87.\\n");
+        }
+    ''')
+
     defineMicroStoreOp('Cda', 'Mem = 0;', mem_flags="Request::NO_ACCESS")
     defineMicroStoreOp('Clflushopt', 'Mem = 0;',
                        mem_flags="Request::CLEAN | Request::INVALIDATE" +

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/42443
To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings

Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: I85c57acace1f7a547b0a97ec3a0f0500909c5d2a
Gerrit-Change-Number: 42443
Gerrit-PatchSet: 1
Gerrit-Owner: Kyle Roarty <[email protected]>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

Reply via email to