public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/98567] New: Failure to optimize using ZF flag from blsi
@ 2021-01-06 16:32 gabravier at gmail dot com
  2021-01-06 16:48 ` [Bug target/98567] " jakub at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: gabravier at gmail dot com @ 2021-01-06 16:32 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 98567
           Summary: Failure to optimize using ZF flag from blsi
           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: ---

bool f(__UINT64_TYPE__ x)
{
    return (-x & x) == 0;
}

With -O3 -mbmi, LLVM compiles this to:

f:
  blsi rax, rdi
  sete al
  ret

GCC compiles this to:

f:
  blsi rdi, rdi
  test rdi, rdi
  sete al
  ret

The usage of `test` can be entirely removed, as `blsi` already sets ZF
accordingly.

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

end of thread, other threads:[~2021-01-07 16:22 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-06 16:32 [Bug target/98567] New: Failure to optimize using ZF flag from blsi gabravier at gmail dot com
2021-01-06 16:48 ` [Bug target/98567] " jakub at gcc dot gnu.org
2021-01-06 16:58 ` jakub at gcc dot gnu.org
2021-01-06 18:55 ` ubizjak at gmail dot com
2021-01-07 16:20 ` cvs-commit at gcc dot gnu.org
2021-01-07 16:22 ` jakub 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).