public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: etienne.lorrain@masroudeau.com
To: gcc-gnats@gcc.gnu.org
Subject: inline-asm/10153: selection of %dil or %sil on ia32 arch by valid C source
Date: Wed, 19 Mar 2003 17:36:00 -0000	[thread overview]
Message-ID: <20030319173438.3749.qmail@sources.redhat.com> (raw)


>Number:         10153
>Category:       inline-asm
>Synopsis:       selection of %dil or %sil on ia32 arch by valid C source
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Mar 19 17:36:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     Etienne Lorrain
>Release:        gcc version 3.2.3 20030309 (Debian prerelease)
>Organization:
>Environment:
Linux Debian ia32
>Description:
Just compile this, and look at the comment
"automatic size decision there"
(lots of comment removed and macro expanded...)
Works up to gcc-3.0.4, not after 3.1

etienne@fulbert:~/gcc/gujin$ gcc -v
Reading specs from /usr/lib/gcc-lib/i386-linux/3.2.3/specs
Configured with: ../src/configure -v --enable-languages=c,c++,java,f77,proto,pascal,objc,ada --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-gxx-include-dir=/usr/include/c++/3.2 --enable-shared --with-system-zlib --enable-nls --without-included-gettext --enable-__cxa_atexit --enable-clocale=gnu --enable-java-gc=boehm --enable-objc-gc i386-linux
Thread model: posix
gcc version 3.2.3 20030309 (Debian prerelease)
etienne@fulbert:~/gcc/gujin$
etienne@fulbert:~/gcc/gujin$ cat user.i
extern unsigned char VGA_valid_mode[];

extern inline unsigned
divrem8 (unsigned short oper, unsigned char *rem)
  {
  unsigned divider;

  asm (
"       aam     $8                      # operand in ax         \n"
"       movb    %%al,%%cl               # remainder             \n"
"       movzbl  %%ah,%%eax              # divider               \n"
        : "=a" (divider), "=c" (*rem) : "a" (oper) );
  return divider;
  }

extern inline void VIDEO_mode_invalidate (unsigned char mode)
  {

  unsigned char shift;
  unsigned index = divrem8 (mode, &shift);
  unsigned char tmp = ({
         typeof (VGA_valid_mode[index]) returned;
         asm volatile (
 "      # automatic size decision there:        \n"
 "      mov     %%cs:%a1,%0                     \n"
         : "=r" (returned) : "g" (&VGA_valid_mode[index]));
         returned; }) & ~(1 << shift);

  asm volatile (
 "      movb    %b0,%%cs:%a1            \n"
        : : "qi" (tmp), "r" (&VGA_valid_mode[index])
        );
  }

void VGA_init (void)
  {
  extern char tmpstatictable[15];
  unsigned i;

  for (i = 0; i <= 0x7F; i++) {
      unsigned char shift;
      unsigned short offset = divrem8 (i, &shift);

      if ((tmpstatictable[offset] & (1 << shift)) == 0)
          VIDEO_mode_invalidate (i);
      }
  }
etienne@fulbert:~/gcc/gujin$ gcc -Os user.i
/tmp/ccWPbdd5.s: Assembler messages:
/tmp/ccWPbdd5.s:35: Error: bad register name `%sil'
>How-To-Repeat:

>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


             reply	other threads:[~2003-03-19 17:36 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-03-19 17:36 etienne.lorrain [this message]
2003-05-10 20:56 Dara Hazeghi
2003-05-12 11:06 etienne.lorrain

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=20030319173438.3749.qmail@sources.redhat.com \
    --to=etienne.lorrain@masroudeau.com \
    --cc=gcc-gnats@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).