public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/92985] missed optimization opportunity for switch linear transformation
       [not found] <bug-92985-4@http.gcc.gnu.org/bugzilla/>
@ 2021-03-27 10:33 ` avi@cloudius-systems.com
  2021-04-27 11:38 ` jakub at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 4+ messages in thread
From: avi@cloudius-systems.com @ 2021-03-27 10:33 UTC (permalink / raw)
  To: gcc-bugs

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

Avi Kivity <avi@cloudius-systems.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |avi@cloudius-systems.com

--- Comment #5 from Avi Kivity <avi@cloudius-systems.com> ---
Here's another example:


#include <compare>

int strong_ordering_to_int(std::strong_ordering x) {
    if (x == std::strong_ordering::equal) {
        return 0;
    } else if (x == std::strong_ordering::less) {
        return -1;
    } else if (x == std::strong_ordering::greater) {
        return 1;
    }
    __builtin_unreachable();
}

Used to translate the new std::strong_ordering back to int (in this case for
compatibility with older code, but one can imagine many such translations from
opaque enums to another enum when crossing an API boundary).

gcc generates (-O3)

strong_ordering_to_int(std::strong_ordering):
        xorl    %eax, %eax
        testb   %dil, %dil
        je      .L1
        xorl    %eax, %eax
        cmpb    $-1, %dil
        setne   %al
        leal    -1(%rax,%rax), %eax
.L1:
        ret


Where it could have generated

        movsx    %dil, %eax
        ret

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

* [Bug c++/92985] missed optimization opportunity for switch linear transformation
       [not found] <bug-92985-4@http.gcc.gnu.org/bugzilla/>
  2021-03-27 10:33 ` [Bug c++/92985] missed optimization opportunity for switch linear transformation avi@cloudius-systems.com
@ 2021-04-27 11:38 ` jakub at gcc dot gnu.org
  2021-07-28  7:04 ` rguenth at gcc dot gnu.org
  2021-11-29 20:41 ` [Bug tree-optimization/92985] " pinskia at gcc dot gnu.org
  3 siblings, 0 replies; 4+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-04-27 11:38 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|11.0                        |11.2

--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
GCC 11.1 has been released, retargeting bugs to GCC 11.2.

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

* [Bug c++/92985] missed optimization opportunity for switch linear transformation
       [not found] <bug-92985-4@http.gcc.gnu.org/bugzilla/>
  2021-03-27 10:33 ` [Bug c++/92985] missed optimization opportunity for switch linear transformation avi@cloudius-systems.com
  2021-04-27 11:38 ` jakub at gcc dot gnu.org
@ 2021-07-28  7:04 ` rguenth at gcc dot gnu.org
  2021-11-29 20:41 ` [Bug tree-optimization/92985] " pinskia at gcc dot gnu.org
  3 siblings, 0 replies; 4+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-07-28  7:04 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|11.2                        |---

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

* [Bug tree-optimization/92985] missed optimization opportunity for switch linear transformation
       [not found] <bug-92985-4@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2021-07-28  7:04 ` rguenth at gcc dot gnu.org
@ 2021-11-29 20:41 ` pinskia at gcc dot gnu.org
  3 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-11-29 20:41 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|c++                         |tree-optimization
           Severity|normal                      |enhancement

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

end of thread, other threads:[~2021-11-29 20:41 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-92985-4@http.gcc.gnu.org/bugzilla/>
2021-03-27 10:33 ` [Bug c++/92985] missed optimization opportunity for switch linear transformation avi@cloudius-systems.com
2021-04-27 11:38 ` jakub at gcc dot gnu.org
2021-07-28  7:04 ` rguenth at gcc dot gnu.org
2021-11-29 20:41 ` [Bug tree-optimization/92985] " 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).