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: "nmiell at comcast dot net" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 10 Nov 2006 06:59:09 -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 #1 from nmiell at comcast dot net 2006-11-10 06:59 -------
Created an attachment (id=12585)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=12585&action=view)
little C demonstration
This is a test function in C that demonstrate a case where gcc could be using
JrCXZ and isn't.
Ignore the warnings about a call-clobbered register being used as a global,
that was done in order to force the register allocator into using the rCX
register so that the missed optimization can be demonstrated.
gcc generates:
subq $8, %rsp
testq %rcx, %rcx
je .L4
call abort
.L4: addq $8, %rsp
ret
when it could be generating:
subq $8, %rsp
jrcxz .L4
call abort
.L4: addq $8, %rsp
ret
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29793