Re: some question about Extended Asm

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi:
Thanks for your help.

2010/1/6 Maciej W. Rozycki <macro@xxxxxxxxxxxxxx>:
> On Wed, 6 Jan 2010, loody wrote:
>
>> I try to
>>   "or %0, count\n", where count is $a1.
>> so I write %1 as count and write
>>   "or %0, %1\n" and assign %1 as count in input section.
>>
>> But the result is not what I expect.
>> the result is "   or      v1,v1,v0"
>> Did I miss something or the only way to meet what I need is directly write
>>  "or %0, $a1\n"?
>
>  As you can figure out from the semantics:
>
>        or      v1, v0
>
> is a shorthand for:
>
>        or      v1, v1, v0
>There is no two-argument register OR instruction in the standard MIPS
>instruction set (nor there is a need for one).
I have some question about extended assembly in mips
1. is mips assembly in AT&T syntax?
    from the document I google from the web, they emphasize that the
GNU C compiler use AT&T syntax, and they list some example about intel
instructions.
But when I write the extended assembly in mips, I find it seem not AT&T syntax.
The order of input and output is still the same as original mips instructions.
Does that mean GNU compiler for mips doesn't use AT&T syntax?

2. how do we know which parameter is for %0,%1,etc?

suppose my src is as below
 asm(
                "add %0, %1, %2\n"
                "sub %0,%2, %1\n"
                :"=r" (count)
                :"r" (temp), "r" (count)
        );
how do I know which parameter is %0, %1 and %2?
there 2 variable, count and temp above, but in assembly it use 3 parameters.
how to match them?

appreciate your kind help,
miloody


[Index of Archives]     [Linux MIPS Home]     [LKML Archive]     [Linux ARM Kernel]     [Linux ARM]     [Linux]     [Git]     [Yosemite News]     [Linux SCSI]     [Linux Hams]

  Powered by Linux