public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/107991] New: Extra mov instructions with ternary on x86
@ 2022-12-06 12:17 denis.campredon at gmail dot com
  2022-12-06 16:32 ` [Bug rtl-optimization/107991] [10/11/12/13 Regression] " rguenth at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: denis.campredon at gmail dot com @ 2022-12-06 12:17 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 107991
           Summary: Extra mov instructions with ternary on x86
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: rtl-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: denis.campredon at gmail dot com
  Target Milestone: ---

Compiled with -O2 on x86, gcc trunk produces 3 mov instructions for each of the
following functions:

int foo(bool b, int i, int j) {
    return b ? i - j : i;
}

int bar(bool b, int i, int j) {
    return i + (b ? -j : 0);
}

int baz(bool b, int i, int j) {
    return i - (b ? j : 0);
}

-------------

Whearas with gcc 7.5, only 1 mov was produced for foo and bar, and two for baz

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

end of thread, other threads:[~2023-07-07 10:44 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-06 12:17 [Bug rtl-optimization/107991] New: Extra mov instructions with ternary on x86 denis.campredon at gmail dot com
2022-12-06 16:32 ` [Bug rtl-optimization/107991] [10/11/12/13 Regression] " rguenth at gcc dot gnu.org
2022-12-06 16:43 ` [Bug middle-end/107991] " pinskia at gcc dot gnu.org
2022-12-08 17:54 ` jakub at gcc dot gnu.org
2022-12-21 11:21 ` rguenth at gcc dot gnu.org
2022-12-21 13:15 ` rsandifo at gcc dot gnu.org
2023-01-09 16:41 ` roger at nextmovesoftware dot com
2023-07-07 10:44 ` [Bug middle-end/107991] [11/12/13/14 " 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).