question about directive ".set"

View: New views
3 Messages — Rating Filter:   Alert me  

question about directive ".set"

by miloody :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Dear all:
The manual as.pdf describe ".set" as ".set symbol , expression" but I
saw some real case in kernel like below:
        __asm__ __volatile__ (
                " .set noreorder \n"
                " .align 3 \n"
                "1: bnez %0, 1b \n"
                " subu %0, 1 \n"
                " .set reorder \n"
                : "=r" (loops)
                : "0" (loops));
What is ".set noreorder" and ".set reorder" mean?
if ".set" loses the expression part, does that mean the default value
is 0 or something else?
appreciate your help,
miloody

Re: question about directive ".set"

by Jie Zhang-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

loody wrote:
> Dear all:
> The manual as.pdf describe ".set" as ".set symbol , expression" but I

This is the generic use of .set.

> saw some real case in kernel like below:
> __asm__ __volatile__ (
> " .set noreorder \n"
> " .align 3 \n"
> "1: bnez %0, 1b \n"
> " subu %0, 1 \n"
> " .set reorder \n"
> : "=r" (loops)
> : "0" (loops));
> What is ".set noreorder" and ".set reorder" mean?

This is the target specific use of .set. GAS of some targets can reorder
instructions for optimization, like alpha and mips. These two directives
are for control of whether or not do the instruction reordering.


Jie

Re: question about directive ".set"

by Maciej W. Rozycki :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Mon, 2 Nov 2009, Jie Zhang wrote:

> > The manual as.pdf describe ".set" as ".set symbol , expression" but I
>
> This is the generic use of .set.
>
> > saw some real case in kernel like below:
> > __asm__ __volatile__ (
> > " .set noreorder \n"
> > " .align 3 \n"
> > "1: bnez %0, 1b \n"
> > " subu %0, 1 \n"
> > " .set reorder \n"
> > : "=r" (loops)
> > : "0" (loops));
> > What is ".set noreorder" and ".set reorder" mean?
>
> This is the target specific use of .set. GAS of some targets can reorder
> instructions for optimization, like alpha and mips. These two directives are
> for control of whether or not do the instruction reordering.

 Some of these settings are documented in the "MIPS Dependent Features"
section of the manual.  Regrettably, the list is not exhaustive -- anyone
is welcome to update the manual; the reference available within the source
code in gas/config/tc-mips.c should be good enough for a start.

  Maciej