public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "pluto at agmk dot net" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug inline-asm/30505]  New: [4.2 regression] asm operand has impossible constraints.
Date: Thu, 18 Jan 2007 22:22:00 -0000	[thread overview]
Message-ID: <bug-30505-7667@http.gcc.gnu.org/bugzilla/> (raw)

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


             reply	other threads:[~2007-01-18 22:22 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-01-18 22:22 pluto at agmk dot net [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-30505-7667@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).