public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/94860] New: Failure to recognize bzhi pattern
@ 2020-04-29 20:09 gabravier at gmail dot com
  2020-04-29 20:48 ` [Bug rtl-optimization/94860] " jakub at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: gabravier at gmail dot com @ 2020-04-29 20:09 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 94860
           Summary: Failure to recognize bzhi pattern
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: rtl-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gabravier at gmail dot com
  Target Milestone: ---

uint32_t bzhi32(uint32_t x, uint32_t y)
{
  return ((x << (32 - y)) >> (32 - y));
}

LLVM with -O3 -mbmi2 optimizes this to : 

bzhi32(unsigned int, unsigned int): # @bzhi32(unsigned int, unsigned int)
  bzhi eax, edi, esi
  ret

GCC outputs this :

bzhi32(unsigned int, unsigned int):
  mov eax, 32
  sub eax, esi
  shlx edi, edi, eax
  shrx eax, edi, eax
  ret

It should be optimized down to bzhi.

This optimization can be applied to :
- x86-64 (with bzhi)
- i686 (with bzhi)
- AMDGCN (with v_bfe_u32)

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

* [Bug rtl-optimization/94860] Failure to recognize bzhi pattern
  2020-04-29 20:09 [Bug rtl-optimization/94860] New: Failure to recognize bzhi pattern gabravier at gmail dot com
@ 2020-04-29 20:48 ` jakub at gcc dot gnu.org
  2020-04-29 21:05 ` [Bug target/94860] " pinskia at gcc dot gnu.org
  2020-04-30  6:52 ` rguenth at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-04-29 20:48 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
PR93346 contains a different pattern that GCC 10 now matches as bzhi.

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

* [Bug target/94860] Failure to recognize bzhi pattern
  2020-04-29 20:09 [Bug rtl-optimization/94860] New: Failure to recognize bzhi pattern gabravier at gmail dot com
  2020-04-29 20:48 ` [Bug rtl-optimization/94860] " jakub at gcc dot gnu.org
@ 2020-04-29 21:05 ` pinskia at gcc dot gnu.org
  2020-04-30  6:52 ` rguenth at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2020-04-29 21:05 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |missed-optimization
           Severity|normal                      |enhancement
          Component|rtl-optimization            |target
         Depends on|                            |93346


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93346
[Bug 93346] gcc does not generate BZHI

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

* [Bug target/94860] Failure to recognize bzhi pattern
  2020-04-29 20:09 [Bug rtl-optimization/94860] New: Failure to recognize bzhi pattern gabravier at gmail dot com
  2020-04-29 20:48 ` [Bug rtl-optimization/94860] " jakub at gcc dot gnu.org
  2020-04-29 21:05 ` [Bug target/94860] " pinskia at gcc dot gnu.org
@ 2020-04-30  6:52 ` rguenth at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-04-30  6:52 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2020-04-30
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1
             Target|                            |x86_64-*-* i?86-*-* gcn

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
Confirmed.

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

end of thread, other threads:[~2020-04-30  6:52 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-29 20:09 [Bug rtl-optimization/94860] New: Failure to recognize bzhi pattern gabravier at gmail dot com
2020-04-29 20:48 ` [Bug rtl-optimization/94860] " jakub at gcc dot gnu.org
2020-04-29 21:05 ` [Bug target/94860] " pinskia at gcc dot gnu.org
2020-04-30  6:52 ` rguenth 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).