🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.help
Article #53631

asm inline

#53631
From: Christoph Kukulies
Date: Sun, 20 Oct 1991 20:33
53 lines
1970 bytes
Hello,
I'm new to this service and I don't know if I should come up with
my question right now or should wait until I got a response how to join.

OK, because it's urgent I will start right away with my problem:

I want to make gcc-1.39 produce inline outb instructions (for speed):
The following works somehow but the resulting code has a %cl instead of
%al in the outb instruction. How can I force gcc to insert a %al there?

static __inline__ void
outportb(unsigned short port, unsigned char data)
{
  asm volatile("outb %1,%0":
                         /* no output */:
                         "d"((unsigned short) port),"g"((unsigned char)data):
                         "ax");
}
foo()
{
    outportb(0x33c,0x01);
}
compiled with  cc-386 -fvolatile -S foo.c
(cc-386 is gcc-1.39 running as a cross compiler under Ultrix)
I'm just mentioning it even I don't measure any importance to that fact,
but I've read I should mention every fact and be it that my screen is dusty :)

produces:

    .file foo.c
gcc_compiled.:
.text
    .align 2
.globl _foo
_foo:
    pushl %ebp
    movl %esp,%ebp
    movl $828,%edx
    movl $1,%ecx
    movl %ebp,%eax
/APP
    outb %cl,%dx               /* this should be %al,%dx */
/NO_APP
L4:
L3:
    leave
    ret

----------------
I think it's my lack of understanding how to produce asm() code .
Help,please.

--Christoph Kukulies
Technical Details
Message-ID: <9110202033.AA24187@acds.physik.rwth-aachen.de>
Path: arc1-ca.pugleaf.net!gmdzi!unido!mcsun!uunet!cis.ohio-state.edu!acds.physik.rwth-aachen.de!kuku

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 11318c,7ad74b3bf8c5a8cd,start
X-Google-Attributes: gid11318c,public
X-Google-ArrivalTime: 1991-10-20 12:56:06 PST
Path: arc1-ca.pugleaf.net!gmdzi!unido!mcsun!uunet!cis.ohio-state.edu!acds.physik.rwth-aachen.de!kuku
From: kuku@acds.physik.rwth-aachen.de (Christoph Kukulies)
Newsgroups: gnu.gcc.help
Subject: asm inline
Message-ID: <9110202033.AA24187@acds.physik.rwth-aachen.de>
Date: 20 Oct 91 20:33:28 GMT
Sender: daemon@cis.ohio-state.edu
Distribution: gnu
Organization: GNUs Not Usenet
Lines: 53