[gnu.gcc.bug] asm in 386

grunwald@flute.cs.uiuc.edu (Dirk Grunwald) (05/31/89)

this is gcc 1.35, stock, installed in SysV-386 machine.

I want to use the ``rep insd'' instruction on the 386.

This takes arguments in registers AD, AC and EDI.

i386.md states that it has the following restrictions:
	`d'	 -> AD
	`c'	 -> AC
	`D'	 -> EDI

However, tm-i386.h shows that REG_CLASS_FROMLETTER
doesn't recognize a regclass for `D', so I assume that
the documentation is out of date.

Furthermore, when I try to use the explicit register number (5), I get
bogus results -- the address of my input string buffer is store in
ebx, which won't work.

Any workarounds welcome, please response by mail.

Example follows.
--------------------foo.c--------------------
static inline void foo(int port, char *bar, int count)
{
   asm volatile("cld");
   asm volatile("rep insd " : : "rd" (port), "rc" (count), "r5" (bar) );
}

void bar()
{
   char str[128];
   foo(10, str, 128);
}
--------------------foo.s--------------------
	....
        movl $10,%eax
        leal -128(%ebp),%edx
        movl $128,%ecx
        leal -128(%ebp),%ebx		<<<< this should be %edi
/APP
        cld
        rep insd
	....
--
Dirk Grunwald
Univ. of Illinois
grunwald@flute.cs.uiuc.edu