public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/94916] New: Failure to optimize pattern into difference or zero selector
@ 2020-05-02  8:35 gabravier at gmail dot com
  2021-04-26  1:15 ` [Bug tree-optimization/94916] " pinskia at gcc dot gnu.org
  2023-05-13  5:55 ` pinskia at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: gabravier at gmail dot com @ 2020-05-02  8:35 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 94916
           Summary: Failure to optimize pattern into difference or zero
                    selector
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gabravier at gmail dot com
  Target Milestone: ---

int f(int x, int y)
{
    return (x - y) & -(x >= y);
}

This can be optimized to return x >= y ? x - y : 0. LLVM does this
transformation, but GCC does not. (also, GCC fails to optimize the resulting
pattern properly, but this is already reported in
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94898)

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

* [Bug tree-optimization/94916] Failure to optimize pattern into difference or zero selector
  2020-05-02  8:35 [Bug tree-optimization/94916] New: Failure to optimize pattern into difference or zero selector gabravier at gmail dot com
@ 2021-04-26  1:15 ` pinskia at gcc dot gnu.org
  2023-05-13  5:55 ` pinskia at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-04-26  1:15 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement

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

* [Bug tree-optimization/94916] Failure to optimize pattern into difference or zero selector
  2020-05-02  8:35 [Bug tree-optimization/94916] New: Failure to optimize pattern into difference or zero selector gabravier at gmail dot com
  2021-04-26  1:15 ` [Bug tree-optimization/94916] " pinskia at gcc dot gnu.org
@ 2023-05-13  5:55 ` pinskia at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-05-13  5:55 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |13.0
           See Also|                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=3507
         Resolution|---                         |FIXED
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
GCC 13 gets:
        movl    %edi, %eax
        xorl    %edx, %edx
        subl    %esi, %eax
        cmpl    %esi, %edi
        cmovl   %edx, %eax
        ret


The rest is recorded as PR 3507.

So closing as fixed.

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

end of thread, other threads:[~2023-05-13  5:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-02  8:35 [Bug tree-optimization/94916] New: Failure to optimize pattern into difference or zero selector gabravier at gmail dot com
2021-04-26  1:15 ` [Bug tree-optimization/94916] " pinskia at gcc dot gnu.org
2023-05-13  5:55 ` pinskia 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).