x86/64 lifting loop instruction
See original GitHub issueDescribe the bug
The loop
instruction contains unnecessary internal (intra) jumps as discussed in #15.
To Reproduce
0x19146D: E2 FB loop -0x3 ; 0x19146A
By lifting the above instruction, we get:
-------------ISMark (19146D, 2)-------------
T_710:I32 := ECX
-------------LMark (Loop)-------------
T_710:I32 := (T_710:I32 - 0x1:I32)
if(T_710:I32 != 0x0:I32) then Jmp (Continue, 127) else Jmp (End, 128)
-------------LMark (Continue)-------------
EIP := (EIP + 0x19146A:I32)
Jmp (Loop, 126)
-------------LMark (End)-------------
-------------IEMark (19146F)-------------
Expected behavior
The loop
instruction in x86 should be handled the same as in jcc
instructions. But currently we are treating loop
in a particularly different way.
Additional context
See #15 for more discussion.
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (7 by maintainers)
Top Results From Across the Web
assembly - How exactly does the x86 LOOP instruction work?
You can't loop zero times, the CPU doesn't foresee loop instruction and somehow skip the body loop (the CPU cares only about current...
Read more >LOOP/LOOPcc — Loop According to ECX Counter
Performs a loop operation using the RCX, ECX or CX register as a counter (depending on whether address size is 64 bits, 32...
Read more >A Complete Formal Semantics of x86-64 User-Level ...
Our semantics faithfully formal- izes all the non-deprecated, sequential user-level instructions of the x86-64 Haswell instruction set ...
Read more >Avoiding ISA Bloat with Macro-Op Fusion for RISC-V
by a memset loop. x86-64 utilizes a movdqa instruction ... 'lift' code out of a loop that returns the same value every iteration....
Read more >Does a compiler use all x86 instructions? (2010)
Nearly all x86_64 instructions are microcoded on modern Intel and AMD ... "loop" instruction (compilers usually generate explicit loops for ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Fixed in be647ce1d.
Merged #19