X86_64 legacy instructions

Are we interested in replacing legacy instructions such as jrcxz, jecxz, loop, loope, loope, loopne (unsupported conditional branches)?

for example, jrcxz/jecxz - is used to exit from the loop if CX == 0
this instruction can be replaced by following code snippet:

.Loop:              |   .Loop:
    ...             |       pushf
    .jrcxz .exit    |       test %rcx, %rcx
                    |       je .exit
                    |       popf
  jne .Loop         |       jne .Loop
.exit:              |   .exit:
    ...             |       popf
    ...             |       ...

That would be a welcome addition to our passes. This transformation is critical for whole binary instrumentation and analysis purposes.

I’ll get the patch ready

1 Like