public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/89360] GCC doesn't emit cmovcc instruction in some cases
       [not found] <bug-89360-4@http.gcc.gnu.org/bugzilla/>
@ 2021-08-19 20:39 ` pinskia at gcc dot gnu.org
  2021-08-19 20:42 ` [Bug target/89360] " pinskia at gcc dot gnu.org
  2023-05-06 19:02 ` pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-19 20:39 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2021-08-19
          Component|rtl-optimization            |tree-optimization
           Severity|normal                      |enhancement

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed, with GCC 11+ we get close for sort2_if:

        cmpl    %esi, %edi
        jl      .L4
        movl    %esi, %eax
        movl    %edi, %esi
        movl    %eax, %edi
.L4:
        movl    %edi, (%rdx)
        movl    %esi, (%rcx)


GCC 9+ produces the cmov for sort2_ternary due to r9-3606.

We don't recongize the MIN/MAX in sort2_if as phiopt only handles the case
where there is only phi node which differs.

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

* [Bug target/89360] GCC doesn't emit cmovcc instruction in some cases
       [not found] <bug-89360-4@http.gcc.gnu.org/bugzilla/>
  2021-08-19 20:39 ` [Bug tree-optimization/89360] GCC doesn't emit cmovcc instruction in some cases pinskia at gcc dot gnu.org
@ 2021-08-19 20:42 ` pinskia at gcc dot gnu.org
  2023-05-06 19:02 ` pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-19 20:42 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|tree-optimization           |target

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Also the other issue is two cmov back-to-back might be bad on x86_64.

In fact on aarch64 we get for sort2_if:
sort2_if(int, int, int*, int*):
        cmp     w0, w1
        csel    w4, w0, w1, lt
        str     w4, [x2]
        csel    w1, w1, w0, lt
        str     w1, [x3]
        ret

So the question is a cmov better than a branch here, I don't know.

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

* [Bug target/89360] GCC doesn't emit cmovcc instruction in some cases
       [not found] <bug-89360-4@http.gcc.gnu.org/bugzilla/>
  2021-08-19 20:39 ` [Bug tree-optimization/89360] GCC doesn't emit cmovcc instruction in some cases pinskia at gcc dot gnu.org
  2021-08-19 20:42 ` [Bug target/89360] " pinskia at gcc dot gnu.org
@ 2023-05-06 19:02 ` pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-05-06 19:02 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           See Also|                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=79390
         Resolution|---                         |INVALID
             Status|NEW                         |RESOLVED

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
x86_64 has a cost model by design to reject back to back cmov.
See PR 79390 on the reasons why.

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

end of thread, other threads:[~2023-05-06 19:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-89360-4@http.gcc.gnu.org/bugzilla/>
2021-08-19 20:39 ` [Bug tree-optimization/89360] GCC doesn't emit cmovcc instruction in some cases pinskia at gcc dot gnu.org
2021-08-19 20:42 ` [Bug target/89360] " pinskia at gcc dot gnu.org
2023-05-06 19:02 ` 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).