public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/48634] New: Missed optimization for use of __builtin_ctzll() and __builtin_clzll
@ 2011-04-15 20:50 svfuerst at gmail dot com
  2011-04-16  9:54 ` [Bug target/48634] " rguenth at gcc dot gnu.org
  2012-01-28  2:57 ` pinskia at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: svfuerst at gmail dot com @ 2011-04-15 20:50 UTC (permalink / raw)
  To: gcc-bugs

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

           Summary: Missed optimization for use of __builtin_ctzll() and
                    __builtin_clzll
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: target
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: svfuerst@gmail.com
            Target: amd64


unsigned long long foo(unsigned long long x)
{
    return __builtin_ctzll(x);
}

Compiles into

bsf    %rdi,%rax
cltq
retq

at -O3 with 4.6.0
The cltq instruction isn't needed because the bitscan instruction will zero out
the upper 32 bits of rax.  Basically, the return value of these intrinsics
should be unsigned long long instead of int on 64 bit machines.  The ABI means
that the reverse process of truncating back down to an int costs zero
instructions.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug target/48634] Missed optimization for use of __builtin_ctzll() and __builtin_clzll
  2011-04-15 20:50 [Bug target/48634] New: Missed optimization for use of __builtin_ctzll() and __builtin_clzll svfuerst at gmail dot com
@ 2011-04-16  9:54 ` rguenth at gcc dot gnu.org
  2012-01-28  2:57 ` pinskia at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-04-16  9:54 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Guenther <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |missed-optimization
             Target|amd64                       |x86_64-*-*
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2011.04.16 09:54:10
     Ever Confirmed|0                           |1

--- Comment #1 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-04-16 09:54:10 UTC ---
Confirmed.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug target/48634] Missed optimization for use of __builtin_ctzll() and __builtin_clzll
  2011-04-15 20:50 [Bug target/48634] New: Missed optimization for use of __builtin_ctzll() and __builtin_clzll svfuerst at gmail dot com
  2011-04-16  9:54 ` [Bug target/48634] " rguenth at gcc dot gnu.org
@ 2012-01-28  2:57 ` pinskia at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2012-01-28  2:57 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> 2012-01-28 02:20:52 UTC ---
I think this is a dup of bug 29776.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-01-28  2:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-04-15 20:50 [Bug target/48634] New: Missed optimization for use of __builtin_ctzll() and __builtin_clzll svfuerst at gmail dot com
2011-04-16  9:54 ` [Bug target/48634] " rguenth at gcc dot gnu.org
2012-01-28  2:57 ` pinskia at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).