public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "paulhaile3 at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/115693] 8 std::byte std::array comparison potential missed optimization
Date: Sun, 30 Jun 2024 16:24:31 +0000	[thread overview]
Message-ID: <bug-115693-4-Ia54zLLYTF@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-115693-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #4 from Paulous Haile <paulhaile3 at gmail dot com> ---
Maybe not necessary, just wanted to add a case for the default operator==. I
have noticed it also doesn't seem to coalesce adjacent cmps, which I assume is
part of the same issue.

#include <cstdint>

struct Point
{
    uint32_t x,y;
    bool operator==(const Point &other) const=default;
};

Point x, y;

bool test()
{
    return x == y;
}

test():
        mov     edx, DWORD PTR y[rip]
        xor     eax, eax
        cmp     DWORD PTR x[rip], edx
        jne     .L1
        mov     eax, DWORD PTR y[rip+4]
        cmp     DWORD PTR x[rip+4], eax
        sete    al
.L1:
        ret
y:
        .zero   8
x:
        .zero   8

  parent reply	other threads:[~2024-06-30 16:24 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-28  1:30 [Bug libstdc++/115693] New: " paulhaile3 at gmail dot com
2024-06-28  2:17 ` [Bug tree-optimization/115693] " xry111 at gcc dot gnu.org
2024-06-28  9:54 ` redi at gcc dot gnu.org
2024-06-28 11:03 ` rguenth at gcc dot gnu.org
2024-06-30 16:24 ` paulhaile3 at gmail dot com [this message]
2024-06-30 16:44 ` pinskia at gcc dot gnu.org
2024-07-01  1:14 ` liuhongt at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-115693-4-Ia54zLLYTF@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).