This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug target/29793] TESTW{W,L,Q} rCX + JZ/JE should be replaced by J{,E,R}CXZ when possible



------- 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]