This is the mail archive of the
mailing list for the GCC project.
Re: Fwd: extended asm
- From: Ankit Jain <ankitjain1580 at yahoo dot com>
- To: Zack Weinberg <zack at codesourcery dot com>, gcc <gcc at gcc dot gnu dot org>
- Date: Tue, 27 Jul 2004 17:56:50 +0100 (BST)
- Subject: Re: Fwd: extended asm
i am sorry but io could not get what you are saying.
if u can somewhat explain me again.
"The compiler does not interpret the "movb %3,%0" part
of this asm statement, except to substitute %-escapes
when writing out the .s file." what is this .s file?
what do u mean by that compiler dont interpret the
well i will again try to explain my problem. i am not
moving with efficiency of the program. what i am
looking at is how all this works? look at the code
below:(it is a small code)
asm("movl %3,%0 \n",:"=r"(c),"=r"(d):"r"(a),"r"(b));
now this code pronts the value of c and d as 20 and
now my question was when i have moved only one value
i.e b->c then d is also initialised with some value.
may be you have got my question earlier but i havent
got your answer
--- Zack Weinberg <email@example.com> wrote: >
Ankit Jain <firstname.lastname@example.org> writes:
> > asm("movb %3,%0":"=r"(x),"=r"(y):"r"(a),"r"(b));
> > now what should technically happen is the value in
> > should move to x but the fun part is y is also
> > initialised by same value. why is it so and from
> > this value comes from
> The compiler does not interpret the "movb %3,%0"
> part of this asm
> statement, except to substitute %-escapes when
> writing out the .s
> file. It only looks at the constraints. You wrote
> constraints that
> say the asm reads values from the variables (a) and
> (b), which must be
> in registers; and then writes values to the
> variables (x) and (y),
> which must also be in registers. The compiler
> believes you. It is
> your responsibility to write the actual assembly
> instructions to be
> consistent with the constraints; in this case it
> appears that you
> didn't, which is a bug in your code.
> There is no implication that the values written to
> (a) and (b) be the
> same. I don't know where you got that idea.
Yahoo! Messenger - Communicate instantly..."Ping"
your friends today! Download Messenger Now