Subject: Re: noreorder
To: Toru Nishimura <nisimura@itc.aist-nara.ac.jp>
From: Simon Burge <simonb@netbsd.org>
List: port-mips
Date: 04/03/2000 23:49:04
Toru Nishimura wrote:
> Simon Burge wrote;
>
> >> Could someone MIPS knowledgeful out there provide me the handy rule of
> >> thumb to use ".set noreorder" for the purpose of protecting
> >> instruction sequencing?
> >
> > Do you mean "when to use it", or "what does it do"?
>
> "When to use it." Various locore stuff in arch/mips/mips looks over-
> protected by noreorder directive. That was my initial concern.
Yes, I agree. One ".set noreorder" at the top of each .S file seems a
little excessive! I suspect mainly the m?c[01] and tlb instructions as
well as timing code (do we have asm delay() anywhere?) need it.
> > Normally the assembler is free to reorder instructions so that it can
> > avoid pipeline delays and fill the load/store/branch delay slot. ".set
> > noreorder" is typically used for accessing system and device type
> > registers in a set order.
>
> Mach code suggests the designer(s) used noreorder conservatively. I'm
> not sure it does matter for behaviour difference between GCC and MIPS
> u-code based compiler.
I just had a quick look at locore*.o with the ".set noreorder" commented
out, and there doesn't appear to be that much change. I say "doesn't
appear" because all the delay slots got rearranged since ".set reorder"
fills the delay slot for you. It will be a lot of manual movement to
rearrage for the delay slots if we want to fix this up (which I think
will be a good thing).
Simon.