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 rtl-optimization/50984] Boolean return value expression clears register too often


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50984

Steven Fuerst <svfuerst at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |svfuerst at gmail dot com

--- Comment #3 from Steven Fuerst <svfuerst at gmail dot com> 2011-11-05 17:05:03 UTC ---
It can be done with zero clears of %eax via the magic of the lea instruction:

    andl    $8, %edi
    andl    $4, %esi
    leal    (%edi, %esi, 2), %eax
    shr    $4, %eax
    ret

However, if the first condition is usually false, this method will be slower. 
On the other hand, this version can be easily manipulated to have less register
pressure.  (So it may always be better when the function is inevitably
inlined.)


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