public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/94344] New: Rotate pattern not recognized anymore
@ 2020-03-26 16:14 stefansf at linux dot ibm.com
  2020-03-26 16:16 ` [Bug rtl-optimization/94344] " pinskia at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: stefansf at linux dot ibm.com @ 2020-03-26 16:14 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 94344
           Summary: Rotate pattern not recognized anymore
           Product: gcc
           Version: 9.3.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: rtl-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: stefansf at linux dot ibm.com
  Target Milestone: ---

Consider the following MWE:

int64_t f (int64_t x)                                                           
{                                                                               
  int64_t y = x & -49;                                                          
  return (y << 5) | (int64_t)((uint64_t)y >> 59);                               
}

Prior to patch c4c5ad1d6d1 combine successfully recognized the rotate pattern
and suggested amongst other the following insn (using `gcc -O3 -S
-fdump-rtl-combine-details test.c`):

(set (reg:DI 67)                                                                
    (rotate:DI (reg/v:DI 64 [ y ])                                              
        (const_int 5 [0x5])))

However, with patch c4c5ad1d6d1 applied, this is not the case anymore. Thus,
only combinations of shifts+and+ior are emitted.

This is reproducible for s390x on HEAD (16948c54b75) by simply reverting the
patch. Any idea how we could tweak combine back to the old behaviour where it
detected a rotate successfully?

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

* [Bug rtl-optimization/94344] Rotate pattern not recognized anymore
  2020-03-26 16:14 [Bug rtl-optimization/94344] New: Rotate pattern not recognized anymore stefansf at linux dot ibm.com
@ 2020-03-26 16:16 ` pinskia at gcc dot gnu.org
  2020-03-26 16:17 ` [Bug rtl-optimization/94344] [9/10 Regression] " pinskia at gcc dot gnu.org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2020-03-26 16:16 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
g:c4c5ad1d6d1

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

* [Bug rtl-optimization/94344] [9/10 Regression] Rotate pattern not recognized anymore
  2020-03-26 16:14 [Bug rtl-optimization/94344] New: Rotate pattern not recognized anymore stefansf at linux dot ibm.com
  2020-03-26 16:16 ` [Bug rtl-optimization/94344] " pinskia at gcc dot gnu.org
@ 2020-03-26 16:17 ` pinskia at gcc dot gnu.org
  2020-03-27  7:49 ` rguenth at gcc dot gnu.org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2020-03-26 16:17 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|Rotate pattern not          |[9/10 Regression] Rotate
                   |recognized anymore          |pattern not recognized
                   |                            |anymore
   Target Milestone|---                         |9.4
           Keywords|                            |missed-optimization

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
It would be better if this is recognized at the tree level.

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

* [Bug rtl-optimization/94344] [9/10 Regression] Rotate pattern not recognized anymore
  2020-03-26 16:14 [Bug rtl-optimization/94344] New: Rotate pattern not recognized anymore stefansf at linux dot ibm.com
  2020-03-26 16:16 ` [Bug rtl-optimization/94344] " pinskia at gcc dot gnu.org
  2020-03-26 16:17 ` [Bug rtl-optimization/94344] [9/10 Regression] " pinskia at gcc dot gnu.org
@ 2020-03-27  7:49 ` rguenth at gcc dot gnu.org
  2020-03-30 12:55 ` jakub at gcc dot gnu.org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-03-27  7:49 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P2
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2020-03-27
             Target|                            |x86_64-*-* i?86-*-*
             Status|UNCONFIRMED                 |NEW

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

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

* [Bug rtl-optimization/94344] [9/10 Regression] Rotate pattern not recognized anymore
  2020-03-26 16:14 [Bug rtl-optimization/94344] New: Rotate pattern not recognized anymore stefansf at linux dot ibm.com
                   ` (2 preceding siblings ...)
  2020-03-27  7:49 ` rguenth at gcc dot gnu.org
@ 2020-03-30 12:55 ` jakub at gcc dot gnu.org
  2020-03-30 15:13 ` stefansf at linux dot ibm.com
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-03-30 12:55 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |jakub at gcc dot gnu.org
             Status|NEW                         |ASSIGNED

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Created attachment 48145
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48145&action=edit
gcc10-pr94344.patch

Untested fix.

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

* [Bug rtl-optimization/94344] [9/10 Regression] Rotate pattern not recognized anymore
  2020-03-26 16:14 [Bug rtl-optimization/94344] New: Rotate pattern not recognized anymore stefansf at linux dot ibm.com
                   ` (3 preceding siblings ...)
  2020-03-30 12:55 ` jakub at gcc dot gnu.org
@ 2020-03-30 15:13 ` stefansf at linux dot ibm.com
  2020-03-31  9:03 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: stefansf at linux dot ibm.com @ 2020-03-30 15:13 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Stefan Schulze Frielinghaus <stefansf at linux dot ibm.com> ---
(In reply to Jakub Jelinek from comment #4)
> Created attachment 48145 [details]
> gcc10-pr94344.patch

LGTM. I did some tests (including the initial one) which all succeeded in
detecting a signed rotate. Thank you very much for the quick fix!

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

* [Bug rtl-optimization/94344] [9/10 Regression] Rotate pattern not recognized anymore
  2020-03-26 16:14 [Bug rtl-optimization/94344] New: Rotate pattern not recognized anymore stefansf at linux dot ibm.com
                   ` (4 preceding siblings ...)
  2020-03-30 15:13 ` stefansf at linux dot ibm.com
@ 2020-03-31  9:03 ` cvs-commit at gcc dot gnu.org
  2020-03-31  9:10 ` [Bug rtl-optimization/94344] [9 " jakub at gcc dot gnu.org
  2020-04-03  6:44 ` stefansf at linux dot ibm.com
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-03-31  9:03 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <jakub@gcc.gnu.org>:

https://gcc.gnu.org/g:56f0b32476c0c261c8e08525f9e47fe87492447a

commit r10-7469-g56f0b32476c0c261c8e08525f9e47fe87492447a
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Tue Mar 31 11:02:47 2020 +0200

    forwprop: Pattern recognize more rotates [PR94344]

    The following patch adjusts simplify_rotate to recognize more rotates,
    basically we allow even some same precision integral -> integral
    conversions, with the requirement that the RSHIFT_EXPR operand has to be
    done in unsigned type (i.e. logical right shift), so that we compensate for
    the combiner no longer being able to simplify those into rotates on some
    targets.

    2020-03-31  Jakub Jelinek  <jakub@redhat.com>

            PR rtl-optimization/94344
            * tree-ssa-forwprop.c (simplify_rotate): Handle also same precision
            conversions, either on both operands of |^+ or just one.  Handle
            also extra same precision conversion on RSHIFT_EXPR first operand
            provided RSHIFT_EXPR is performed in unsigned type.

            * gcc.dg/pr94344.c: New test.

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

* [Bug rtl-optimization/94344] [9 Regression] Rotate pattern not recognized anymore
  2020-03-26 16:14 [Bug rtl-optimization/94344] New: Rotate pattern not recognized anymore stefansf at linux dot ibm.com
                   ` (5 preceding siblings ...)
  2020-03-31  9:03 ` cvs-commit at gcc dot gnu.org
@ 2020-03-31  9:10 ` jakub at gcc dot gnu.org
  2020-04-03  6:44 ` stefansf at linux dot ibm.com
  7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-03-31  9:10 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[9/10 Regression] Rotate    |[9 Regression] Rotate
                   |pattern not recognized      |pattern not recognized
                   |anymore                     |anymore

--- Comment #7 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Fixed on the trunk.  Probably inappropriate for 9.x.

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

* [Bug rtl-optimization/94344] [9 Regression] Rotate pattern not recognized anymore
  2020-03-26 16:14 [Bug rtl-optimization/94344] New: Rotate pattern not recognized anymore stefansf at linux dot ibm.com
                   ` (6 preceding siblings ...)
  2020-03-31  9:10 ` [Bug rtl-optimization/94344] [9 " jakub at gcc dot gnu.org
@ 2020-04-03  6:44 ` stefansf at linux dot ibm.com
  7 siblings, 0 replies; 9+ messages in thread
From: stefansf at linux dot ibm.com @ 2020-04-03  6:44 UTC (permalink / raw)
  To: gcc-bugs

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

Stefan Schulze Frielinghaus <stefansf at linux dot ibm.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|ASSIGNED                    |RESOLVED

--- Comment #8 from Stefan Schulze Frielinghaus <stefansf at linux dot ibm.com> ---
Closing. Fixed by
https://gcc.gnu.org/g:56f0b32476c0c261c8e08525f9e47fe87492447a

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

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

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-26 16:14 [Bug rtl-optimization/94344] New: Rotate pattern not recognized anymore stefansf at linux dot ibm.com
2020-03-26 16:16 ` [Bug rtl-optimization/94344] " pinskia at gcc dot gnu.org
2020-03-26 16:17 ` [Bug rtl-optimization/94344] [9/10 Regression] " pinskia at gcc dot gnu.org
2020-03-27  7:49 ` rguenth at gcc dot gnu.org
2020-03-30 12:55 ` jakub at gcc dot gnu.org
2020-03-30 15:13 ` stefansf at linux dot ibm.com
2020-03-31  9:03 ` cvs-commit at gcc dot gnu.org
2020-03-31  9:10 ` [Bug rtl-optimization/94344] [9 " jakub at gcc dot gnu.org
2020-04-03  6:44 ` stefansf at linux dot ibm.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).