News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

jecxnz or similar

Started by Gian Piero, January 08, 2009, 04:10:21 PM

Previous topic - Next topic

Gian Piero

Hi Geremy,I sent a previous email, but it was sent during the winter holiday, sorry about it.
I am using the instruction jecxz a lot with the GoAsm.
Now, I know that every conditional jump instruction has always the opposite condition instruction, however I got an error during the compilation of the instruction jecxnz.
Is maybe such instruction misspelled ?
Alternatively I could use maybe jecxGT or jecxLT or jecxGE or jecxLE etc
Thanks
Gian

MazeGen

Wrong forum.

There is nothing like JECXNZ instruction, or JECXGE, or JECXLE (the latter ones don't make any sence, by the way). You have to use this construct instead of JECXNZ:


cmp ecx, 0
jne lbl

Gian Piero

Thanks for the precious information.
Goasm reflects the microarchitecture of most recent procs, it seems like AMD and INTEL built this instruction without its "opposite condition" counterpart.
By the way, the popcnt instruction has been now implemented by AMD and INTEL, however Goasm has not implemented it.
Cheers

MazeGen

Quote from: Gian Piero on January 08, 2009, 07:25:11 PM
Goasm reflects the microarchitecture of most recent procs, it seems like AMD and INTEL built this instruction without its "opposite condition" counterpart.

Yes, because JECXZ was designed as a helper instruction for LOOP loops. Something like this:


mov ecx, COUNT

top:
; here goes code which further modifies ECX

jecxz break   ; prevent overflow of ECX counter , which would happen on LOOP instruction in case ECX is zero

; some other instructions

loop top

break: