as: i386-Jumps
1
1 9.15.8 Handling of Jump Instructions
1 ------------------------------------
1
1 Jump instructions are always optimized to use the smallest possible
1 displacements. This is accomplished by using byte (8-bit) displacement
1 jumps whenever the target is sufficiently close. If a byte displacement
1 is insufficient a long displacement is used. We do not support word
1 (16-bit) displacement jumps in 32-bit mode (i.e. prefixing the jump
1 instruction with the 'data16' instruction prefix), since the 80386
1 insists upon masking '%eip' to 16 bits after the word displacement is
1 added. (See also ⇒i386-Arch)
1
1 Note that the 'jcxz', 'jecxz', 'loop', 'loopz', 'loope', 'loopnz' and
1 'loopne' instructions only come in byte displacements, so that if you
1 use these instructions ('gcc' does not use them) you may get an error
1 message (and incorrect code). The AT&T 80386 assembler tries to get
1 around this problem by expanding 'jcxz foo' to
1
1 jcxz cx_zero
1 jmp cx_nonzero
1 cx_zero: jmp foo
1 cx_nonzero:
1