Implement cdqe and cqo, which are also called cbw and cwde, and cwd and cdq respectiv...
authorGabe Black <gblack@eecs.umich.edu>
Tue, 24 Jul 2007 22:07:03 +0000 (15:07 -0700)
committerGabe Black <gblack@eecs.umich.edu>
Tue, 24 Jul 2007 22:07:03 +0000 (15:07 -0700)
--HG--
extra : convert_revision : 67ac035c68608d7260c21ce32009b344f3834e46

src/arch/x86/isa/insts/data_conversion/sign_extension.py

index e96eee694215476a3af7d6f340b12bd9762b5a83..6a2612c3c29b0221812ab182f183fd82410c2807 100644 (file)
 #
 # Authors: Gabe Black
 
-microcode = ""
+microcode = '''
+def macroop CDQE_R {
+    sext reg, reg, "env.dataSize << 2"
+};
+
+def macroop CQO_R_R {
+    # A shift might be slower than, for example, an explicit sign extension,
+    # so it might be worthwhile to try to find an alternative.
+    mov regm, regm, reg
+    sra regm, regm, "env.dataSize * 8 - 1"
+};
+'''
 #let {{
 #    class CBW(Inst):
 #      "GenFault ${new UnimpInstFault}"