This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/29793] TESTW{W,L,Q} rCX + JZ/JE should be replaced by J{,E,R}CXZ when possible
- From: "ubizjak at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 10 Nov 2006 10:54:47 -0000
- Subject: [Bug target/29793] TESTW{W,L,Q} rCX + JZ/JE should be replaced by J{,E,R}CXZ when possible
- References: <bug-29793-10309@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #2 from ubizjak at gmail dot com 2006-11-10 10:54 -------
(In reply to comment #0)
> The Test instruction applied to the rCX register followed by a Jump if Zero
> with an 8-bit displacement can be replaced by a single JCXZ/JECXZ/JRCXZ
The problem is in "with an 8-bit displacement". This displacement is calculated
during assembler stage, and there is no way to _reliably_ calculate
displacement using gcc's "(pc)" RTX.
To implement this optimization, some support from assembler is needed. When
displacement overflows 8bit, assembler should substitute "jecxz" with
equivalent "test/jmp rel{16,32}" sequence.
This 8-bit displacement problem is in fact the same problem as with "loop"
insn.
However, it would be nice to have "jexcz" and "loop" insns, as they all have
zero latency (as jcc insn have) on p4.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29793