Subject: Re: gas warning on mipsX_subr.S
To: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
From: Simon Burge <simonb@wasabisystems.com>
List: port-mips
Date: 02/26/2005 11:06:29
On Sat, Feb 26, 2005 at 01:35:45AM +0900, Izumi Tsutsui wrote:

> These warnings are harmless or not?
> ---
> # /usr/tools/mipsel/bin/mipsel--netbsd-gcc -mno-abicalls \
> -x assembler-with-cpp -traditional-cpp -D_LOCORE -Dcobalt \
> -I. -I../../../../arch -I../../../.. -nostdinc -DMIPS3 -DLKM \
> -DDIAGNOSTIC -DMAXUSERS=32 -D_KERNEL -D_KERNEL_OPT -c \
> ../../../../arch/mips/mips/mips3_subr.S
> ../../../../arch/mips/mips/mipsX_subr.S: Assembler messages:
> ../../../../arch/mips/mips/mipsX_subr.S:1403: Warning: \
> Macro instruction expanded into multiple instructions in a branch delay slot
> ../../../../arch/mips/mips/mipsX_subr.S:1511: Warning: \
> Macro instruction expanded into multiple instructions in a branch delay slot
> #

In this case we get lucky.  Both attempts at loads are loads of k1, and
in both cases the target code of the branch loads k1 soon after.

As others have noticed this should be fixed.  I've add a nop to both
cases and committed this.

For the C compiler we use -Weror so that warnings are fatal.  Can we do
the same for the assembler?  This would have made the warning be noticed
as soon as we switched to binutils 2.15 - the warning didn't happen with
binutils 2.14.

As a style issue, I think sparc uses a space indent on the next line for
branch (and load?) delay slots, but the MIPS code I've seen doesn't.
For example:

	beq	k1, zero, outofworld
	nop
	lw	k1, Sysmap

vs

	beq	k1, zero, outofworld
	 nop
	lw	k1, Sysmap

I think the latter makes it more clear there's a BD slot.  Any comments
from other MIPS folks?

Simon.
--
Simon Burge                                   <simonb@wasabisystems.com>
NetBSD Development, Support and Service:   http://www.wasabisystems.com/