Subject: Re: asm() bugs
To: Allen Briggs <briggs@puma.bevd.blacksburg.va.us>
From: Taras Ivanenko <ivanenko@ctpa03.mit.edu>
List: port-mac68k
Date: 05/14/1996 11:52:16
> > When was the last time you checked the *assembler* output of the
> > compiler?

> How often does anyone but compiler or assembler folks?

I was working with video driver and I tried to use that asm() statements.

> > 	asm("	movl	d1, %0
> > 		movl	d0, %1"
> > !		: "=g" (trapword), "=g" (numbytes)
> > +	    :: "d0", "d1");
> > 
> > and here is the assembler output for this function:
> > 
> > _mrg_NewPtr:
> > 	link a6,#0
> > 	moveml #0x2030,sp@-
> > 	clrl d2
> > #APP
> > 		movl	d1, d0
> > 		movl	d0, a3
> > #NO_APP

> This looks like a bug in gcc.  In the asm() statement, d1 and d0
> are not bashed.  They're used, but not as destinations for the movls.
> The compiler should automatically consider the registers for the
> referenced variables to be considered bashed.  Especially as they
> are marked as "output" operands.

I added this last part
> > +	    :: "d0", "d1");
after compilimg that example. (I hope I made it clear in my first
posting) I still think that it is a good programming style to mention
all bashed registers in (almost) all asm() statements

	Taras.