public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/104116] New: Optimize {FLOOR,CEIL,ROUND}_{DIV,MOD}_EXPR in tree-vect-patterns.cc
@ 2022-01-19 14:12 jakub at gcc dot gnu.org
  2022-01-20  7:33 ` [Bug tree-optimization/104116] " rguenth at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-01-19 14:12 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 104116
           Summary: Optimize {FLOOR,CEIL,ROUND}_{DIV,MOD}_EXPR in
                    tree-vect-patterns.cc
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jakub at gcc dot gnu.org
                CC: asolokha at gmx dot com, bergner at gcc dot gnu.org,
                    jakub at gcc dot gnu.org, linkw at gcc dot gnu.org,
                    luoxhu at gcc dot gnu.org, rguenth at gcc dot gnu.org,
                    seurer at gcc dot gnu.org, wschmidt at gcc dot gnu.org
        Depends on: 102860
            Blocks: 102938
  Target Milestone: ---
              Host: powerpc64le-linux-gnu
            Target: powerpc64le-linux-gnu
             Build: powerpc64le-linux-gnu

+++ This bug was initially created as a clone of Bug #102860 +++

As mentioned in https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102860#c7, we
should
try to pattern recognize these operations and turn them into
TRUNC_{DIV,MOD}_EXPR
if the optab is supported (note, for constant last operand build on top of the
current vect_recog_divmod_pattern, so that we handle it even if the optab isn't
supported etc.).
For signed operands,
    r = x %[fl] y;                                                              
    is                                                                          
    r = x % y; if (r && (x ^ y) < 0) r += y;                                    
    and                                                                         
    d = x /[fl] y;                                                              
    is                                                                          
    r = x % y; d = x / y; if (r && (x ^ y) < 0) --d;                            
    and                                                                         
    r = x %[cl] y;                                                              
    is                                                                          
    r = x % y; if (r && (x ^ y) >= 0) r -= y;                                   
    and                                                                         
    d = /[cl] y;                                                                
    is                                                                          
    r = x % y; d = x / y; if (r && (x ^ y) >= 0) ++d;                           
(too lazy to write rounding case or do the unsigned case of %[cl] or /[cl] -
([fl] isn't needed for unsigned)).  Of course, in vect-patterns the ifs should
be written as COND_EXPRs and probably the conditional increments or decrements
should be done using corresponding unsigned type with casts.


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102860
[Bug 102860] [12 regression] libgomp.fortran/simd2.f90 ICEs after r12-4526
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102938
[Bug 102938] [12 regression] ICE in fortran test cases after r12-4240

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

* [Bug tree-optimization/104116] Optimize {FLOOR,CEIL,ROUND}_{DIV,MOD}_EXPR in tree-vect-patterns.cc
  2022-01-19 14:12 [Bug tree-optimization/104116] New: Optimize {FLOOR,CEIL,ROUND}_{DIV,MOD}_EXPR in tree-vect-patterns.cc jakub at gcc dot gnu.org
@ 2022-01-20  7:33 ` rguenth at gcc dot gnu.org
  0 siblings, 0 replies; 2+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-01-20  7:33 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2022-01-20
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1
             Blocks|                            |53947


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53947
[Bug 53947] [meta-bug] vectorizer missed-optimizations

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

end of thread, other threads:[~2022-01-20  7:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-19 14:12 [Bug tree-optimization/104116] New: Optimize {FLOOR,CEIL,ROUND}_{DIV,MOD}_EXPR in tree-vect-patterns.cc jakub at gcc dot gnu.org
2022-01-20  7:33 ` [Bug tree-optimization/104116] " 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).