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

            Bug ID: 107812
           Summary: [11/12/13 Regression] RTL SSA forwprop introduced
                    regression
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jakub at gcc dot gnu.org
                CC: crazylht at gmail dot com, hjl.tools at gmail dot com,
                    jakub at gcc dot gnu.org, law at gcc dot gnu.org,
                    marxin at gcc dot gnu.org, sayle at gcc dot gnu.org,
                    unassigned at gcc dot gnu.org, uros at gcc dot gnu.org,
                    vmakarov at gcc dot gnu.org
        Depends on: 107627
  Target Milestone: ---
            Target: x86_64-*-* i?86-*-*

+++ This bug was initially created as a clone of Bug #107627 +++

static inline unsigned long long
qux (unsigned int x, unsigned int y)
{
  return ((unsigned long long) x << 32) | y;
}

static inline unsigned int
corge (unsigned int x, unsigned int y, unsigned z)
{
  return qux (x, y) >> (z % 32);
}

void
garply (unsigned int *x, const unsigned int *y, unsigned z)
{
  x[0] = corge (y[0], y[1], z);
}

with -m32 -O2 -mno-sse on x86_64-linux regressed with
r11-6188-g0b76990a9d75d97b84014e37519086b81824c307
Previously:
        pushl   %ebx
        movl    12(%esp), %ebx
        movl    16(%esp), %ecx
        movl    (%ebx), %edx
        movl    4(%ebx), %eax
        shrdl   %edx, %eax
        movl    8(%esp), %edx
        movl    %eax, (%edx)
        popl    %ebx
        ret
After:
        pushl   %edi
        xorl    %edi, %edi
        pushl   %esi
        pushl   %ebx
        movl    20(%esp), %ebx
        movl    24(%esp), %ecx
        movl    4(%ebx), %esi
        movl    (%ebx), %edx
        movl    %esi, %eax
        orl     %edi, %edx
        shrdl   %edx, %eax
        movl    16(%esp), %edx
        movl    %eax, (%edx)
        popl    %ebx
        popl    %esi
        popl    %edi
        ret


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107627
[Bug 107627] [13 Regression] int128_t shift generates extra xor/or.

Reply via email to