From: Gabe Black Date: Fri, 19 Oct 2007 05:38:17 +0000 (-0700) Subject: X86: Implement the LOOP instructions. X-Git-Tag: m5_2.0_beta4~48 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=2bbc058c6c5e54c032106f804dd3084ed11f0f09;p=gem5.git X86: Implement the LOOP instructions. --HG-- extra : convert_revision : 3ccd0565c83b6d9c9b63f9f7ac2b67839a2c714f --- 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,) +}; +'''