linux-mips
[Top] [All Lists]

Re: some question about Extended Asm

To: "Maciej W. Rozycki" <macro@linux-mips.org>
Subject: Re: some question about Extended Asm
From: loody <miloody@gmail.com>
Date: Mon, 11 Jan 2010 00:09:22 +0800
Cc: Linux MIPS Mailing List <linux-mips@linux-mips.org>
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=n8tJ2xkrAaZpKgInTecKh5NCNTv3sNZcnBd+Ef6nrDU=; b=UOntVQyaO1uqhj2Z5F3pMmohOEIgVOroxb9pbuvtNo2XN242tqLEbMCfA9Rc/SwWCB QkMhrinpWuNk0+BNBnYo/QDwViuY0JVptQYO5otlm9ZEf+m0CqoTCMiqfAmx5oD2IwjJ PoLDDVcKRngXlPxWe8UeoC8AQOTnzx/3eUB+Y=
Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=hXSER/xcJc61mfDZ60z2b8qRwG+51AgAQD+Vtjp4+lXff6u/loN7ypMo7swkA6DV6h 35n3FTOtFiK/B4QZOxw5JWqx53MBsWriHd3fx5I6q8U65qZTR7PYpwuE8nRoZ1/RU3IM z5oUzFNaZPLgLtRFeSeZ+TEZAMRaYvGj8gqxE=
In-reply-to: <alpine.LFD.2.00.1001061244330.13474@eddie.linux-mips.org>
References: <3a665c761001052313v36bfeb89v37ada6b76e91c271@mail.gmail.com> <alpine.LFD.2.00.1001061244330.13474@eddie.linux-mips.org>
Sender: linux-mips-bounce@linux-mips.org
Hi:
Thanks for your help.

2010/1/6 Maciej W. Rozycki <macro@linux-mips.org>:
> 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

<Prev in Thread] Current Thread [Next in Thread>