public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug inline-asm/30505]  New: [4.2 regression] asm operand has impossible constraints.
@ 2007-01-18 22:22 pluto at agmk dot net
  2007-01-18 22:40 ` [Bug inline-asm/30505] " pinskia at gcc dot gnu dot org
                   ` (12 more replies)
  0 siblings, 13 replies; 14+ messages in thread
From: pluto at agmk dot net @ 2007-01-18 22:22 UTC (permalink / raw)
  To: gcc-bugs

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


^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2007-04-28  4:18 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-01-18 22:22 [Bug inline-asm/30505] New: [4.2 regression] asm operand has impossible constraints pluto at agmk dot net
2007-01-18 22:40 ` [Bug inline-asm/30505] " pinskia at gcc dot gnu dot org
2007-01-18 22:41 ` pinskia at gcc dot gnu dot org
2007-02-03 17:31 ` jsm28 at gcc dot gnu dot org
2007-02-19 21:02 ` mmitchel at gcc dot gnu dot org
2007-03-05  3:29 ` mmitchel at gcc dot gnu dot org
2007-03-05  9:17 ` [Bug inline-asm/30505] [4.2/4.3 " bonzini at gnu dot org
2007-03-05  9:18 ` bonzini at gnu dot org
2007-03-19 14:59 ` jakub at gcc dot gnu dot org
2007-03-19 15:27 ` jakub at gcc dot gnu dot org
2007-03-19 23:25 ` jakub at gcc dot gnu dot org
2007-03-19 23:28 ` jakub at gcc dot gnu dot org
2007-03-20  8:09 ` jakub at gcc dot gnu dot org
2007-04-28  4:19 ` kargl at gcc dot gnu dot org

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).