The MASM Forum Archive 2004 to 2012

Project Support Forums => 64 Bit Assembler => Topic started by: Gian Piero on January 08, 2009, 04:10:21 PM

Title: jecxnz or similar
Post by: Gian Piero on January 08, 2009, 04:10:21 PM
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
Title: Re: jecxnz or similar
Post by: MazeGen on January 08, 2009, 04:15:53 PM
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
Title: Re: jecxnz or similar
Post by: Gian Piero on January 08, 2009, 07:25:11 PM
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
Title: Re: jecxnz or similar
Post by: MazeGen on January 09, 2009, 03:37:59 PM
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: