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

            Bug ID: 87984
           Summary: [7/8/9 Regression] wrong code for local reg var input
                    to asm
           Product: gcc
           Version: 9.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: inline-asm
          Assignee: unassigned at gcc dot gnu.org
          Reporter: amonakov at gcc dot gnu.org
  Target Milestone: ---

In the following snippet the arguments to the second asm are not correctly
prepared:

void f(long long x[])
{
    register int a asm("eax");
    register int d asm("edx");
    a = x[0] / x[1];
    asm ("# %0" :: "r"(a));
    int t;
    t = x[2] / x[3];
    a = x[0] / x[1];
    d = t;
    asm ("# %0 %1" :: "r"(a), "r"(d));
}

with -O2 -m32 we generate

        call    __divdi3
        movl    %eax, %edx
#APP
        # %eax %edx
#NO_APP

We should emit moves to hardregs just prior to the asm, not lower user
variables to hardregs up front.

This is a regression on all active branches, gcc-4.4 used to get this right.

Reply via email to