public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/98212] New: X86 unoptimal code for float equallity comparison followed by jump
@ 2020-12-09 10:07 denis.campredon at gmail dot com
  2020-12-09 11:15 ` [Bug rtl-optimization/98212] " crazylht at gmail dot com
                   ` (12 more replies)
  0 siblings, 13 replies; 14+ messages in thread
From: denis.campredon at gmail dot com @ 2020-12-09 10:07 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 98212
           Summary: X86 unoptimal code for float equallity comparison
                    followed by jump
           Product: gcc
           Version: 11.0
            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: ---

For f1 code an unnecessary `comiss` instruction is used, the parity flag is
still set after the `jp` instruction.
For f2, I'm not sure if it's the optimal way to do that.

The same problems appear for `float`, `double` and `long double`

------
void f();

void f1(float a, float b) {
    if (a != b)
        f();
}

void f2(float a, float b) {
    if (a == b)
        f();
}

------
f1(float, float):
        ucomiss xmm0, xmm1
        jp      .L4
        comiss  xmm0, xmm1
        jne     .L4
        ret
.L4:
        jmp     f()

f2(float, float):
        ucomiss xmm0, xmm1
        jnp     .L11
.L7:
        ret
.L11:
        jne     .L7
        jmp     f()
------

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

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

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-09 10:07 [Bug rtl-optimization/98212] New: X86 unoptimal code for float equallity comparison followed by jump denis.campredon at gmail dot com
2020-12-09 11:15 ` [Bug rtl-optimization/98212] " crazylht at gmail dot com
2020-12-09 12:46 ` [Bug rtl-optimization/98212] [10/11 Regression] " rguenth at gcc dot gnu.org
2020-12-09 12:50 ` ubizjak at gmail dot com
2020-12-09 14:43 ` jakub at gcc dot gnu.org
2020-12-09 16:54 ` jakub at gcc dot gnu.org
2020-12-09 19:10 ` jakub at gcc dot gnu.org
2020-12-09 19:43 ` jakub at gcc dot gnu.org
2020-12-10 11:04 ` cvs-commit at gcc dot gnu.org
2020-12-10 23:38 ` cvs-commit at gcc dot gnu.org
2020-12-10 23:40 ` [Bug rtl-optimization/98212] [10 " jakub at gcc dot gnu.org
2021-04-08 12:02 ` rguenth at gcc dot gnu.org
2022-06-28 10:42 ` jakub at gcc dot gnu.org
2023-07-07  9:19 ` 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).