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

Reply via email to