public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/95535] New: Failure to optimize out cdqe after __bultin_ctz
@ 2020-06-04 14:58 gabravier at gmail dot com
  2020-06-04 16:36 ` [Bug target/95535] " jakub at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: gabravier at gmail dot com @ 2020-06-04 14:58 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95535

            Bug ID: 95535
           Summary: Failure to optimize out cdqe after __bultin_ctz
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gabravier at gmail dot com
  Target Milestone: ---

long long f(int n)
{
    return __builtin_ctz(n);
}

With -O3, GCC outputs this :

f(int):
  xor eax, eax
  tzcnt eax, edi
  cdqe
  ret

LLVM outputs this :

f(int): # @f(int)
  tzcnt eax, edi
  ret

Looks like the cdqe can be omitted.

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

end of thread, other threads:[~2020-09-04  9:08 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-04 14:58 [Bug target/95535] New: Failure to optimize out cdqe after __bultin_ctz gabravier at gmail dot com
2020-06-04 16:36 ` [Bug target/95535] " jakub at gcc dot gnu.org
2020-06-04 17:08 ` jakub at gcc dot gnu.org
2020-06-05  8:45 ` cvs-commit at gcc dot gnu.org
2020-09-04  9:08 ` gabravier at gmail dot com

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