This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug inline-asm/30505] New: [4.2 regression] asm operand has impossible constraints.


following testcase works fine with gcc-3.3/4.1:

typedef unsigned long long uint64;
typedef unsigned uint32;

uint64 dividend;
uint32 divisor;
uint64 quotient;
uint32 remainder;

void div643264( )
{
   uint32 hQuotient;
   uint32 lQuotient;

    __asm__(
      "divl %5"        "\n\t"
      "movl %%eax, %0" "\n\t"
      "movl %4, %%eax" "\n\t"
      "divl %5"
      : "=&rm" (hQuotient), //0 r/m
        "=a" (lQuotient), //1 eax
        "=d" (remainder) //2 edx
      : "1" ((uint32)(dividend >> 32)), //3  eax
        "g" ((uint32)dividend), //4 r/m
        "rm" (divisor), //5 r/m
        "2" (0) //6 edx
      : "cc"
   );
   quotient = (uint64)hQuotient << 32 | lQuotient;
}

e.g. 4.1 produces:

$ gcc div.c -fno-builtin -S -O2 && cat div.s
div643264:
        pushl   %ebp
        movl    %esp, %ebp
        subl    $12, %esp
        movl    dividend, %ecx
        movl    %ebx, (%esp)
        movl    dividend+4, %ebx
        movl    %esi, 4(%esp)
        xorl    %esi, %esi
        movl    %edi, 8(%esp)
        movl    %esi, %edx
        movl    4(%esp), %esi
        movl    %ebx, %ecx
        xorl    %ebx, %ebx
        movl    %ecx, %eax
#APP
        divl divisor
        movl %eax, %edi
        movl dividend, %eax
        divl divisor
#NO_APP
        movl    %eax, %ebx
        movl    %edi, %eax
        movl    %edx, remainder
        xorl    %edx, %edx
        movl    %eax, %edx
        movl    %ebx, quotient
        movl    %edx, quotient+4
        movl    (%esp), %ebx
        movl    $0, %eax
        movl    8(%esp), %edi
        leave
        ret

4.2 rejects such code.

div.c: In function &#8216;div643264&#8217;:
div.c:15: error: &#8216;asm&#8217; operand has impossible constraints


-- 
           Summary: [4.2 regression] asm operand has impossible constraints.
           Product: gcc
           Version: 4.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: inline-asm
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: pluto at agmk dot net
GCC target triplet: i686


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30505


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]