summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabe Black <gblack@eecs.umich.edu>2007-10-18 22:38:17 -0700
committerGabe Black <gblack@eecs.umich.edu>2007-10-18 22:38:17 -0700
commit2bbc058c6c5e54c032106f804dd3084ed11f0f09 (patch)
tree84d17c04577ef75098eafbe2f78631235dfafb36
parent418b30602bd08646d6f260d495163ad4fb613402 (diff)
downloadgem5-2bbc058c6c5e54c032106f804dd3084ed11f0f09.tar.xz
X86: Implement the LOOP instructions.
--HG-- extra : convert_revision : 3ccd0565c83b6d9c9b63f9f7ac2b67839a2c714f
-rw-r--r--src/arch/x86/isa/decoder/one_byte_opcodes.isa6
-rw-r--r--src/arch/x86/isa/insts/general_purpose/control_transfer/loop.py24
2 files changed, 22 insertions, 8 deletions
diff --git a/src/arch/x86/isa/decoder/one_byte_opcodes.isa b/src/arch/x86/isa/decoder/one_byte_opcodes.isa
index b1fdce0a7..6e7fdea35 100644
--- a/src/arch/x86/isa/decoder/one_byte_opcodes.isa
+++ b/src/arch/x86/isa/decoder/one_byte_opcodes.isa
@@ -472,9 +472,9 @@
}
##include "x87.isa"
0x1C: decode OPCODE_OP_BOTTOM3 {
- 0x0: loopne_Jb();
- 0x1: loope_Jb();
- 0x2: loop_Jb();
+ 0x0: Inst::LOOPNE(Jb);
+ 0x1: Inst::LOOPE(Jb);
+ 0x2: Inst::LOOP(Jb);
0x3: Inst::JRCX(Jb);
0x4: in_Al_Ib();
0x5: in_eAX_Ib();
diff --git a/src/arch/x86/isa/insts/general_purpose/control_transfer/loop.py b/src/arch/x86/isa/insts/general_purpose/control_transfer/loop.py
index d742f217f..c5674db7f 100644
--- a/src/arch/x86/isa/insts/general_purpose/control_transfer/loop.py
+++ b/src/arch/x86/isa/insts/general_purpose/control_transfer/loop.py
@@ -53,8 +53,22 @@
#
# Authors: Gabe Black
-microcode = ""
-#let {{
-# class LOOPcc(Inst):
-# "GenFault ${new UnimpInstFault}"
-#}};
+microcode = '''
+def macroop LOOP_I {
+ rdip t1
+ subi rcx, rcx, 1, flags=(EZF,), dataSize=asz
+ wripi t1, imm, flags=(nCEZF,)
+};
+
+def macroop LOOPNE_I {
+ rdip t1
+ subi rcx, rcx, 1, flags=(EZF,), dataSize=asz
+ wripi t1, imm, flags=(CSTRnZnEZF,)
+};
+
+def macroop LOOPE_I {
+ rdip t1
+ subi rcx, rcx, 1, flags=(EZF,), dataSize=asz
+ wripi t1, imm, flags=(CSTRZnEZF,)
+};
+'''