This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: label value in ppc asm stmt
- From: Segher Boessenkool <segher at koffie dot nl>
- To: Johan Rydberg <jrydberg at night dot trouble dot net>
- Cc: gcc at gcc dot gnu dot org
- Date: Mon, 20 Jan 2003 16:47:15 +0100
- Subject: Re: label value in ppc asm stmt
- References: <D6EBEE17-2C41-11D7-A444-000393816A30@night.trouble.net>
Johan Rydberg wrote:
>
> Hi!
>
> I want to get the address of a label within a asm-stmt.
> For example, I want to generate the following code:
>
> ...
> __asm__ ("beq- cr0,%0" :: "?" (&&label));
> ...
> label:
> ...
>
> What I would like to know is what constrain I should use
> for the input operand. Doing the same thing on the i386
> platform you use the "p" constrain, but that put the address
> in a register on PPC.
__asm__ ("beq- cr0,%l0" : : "X" (&&label));
Note the "l". See "Output Templates and Operand Substitution"
in the internals manual (info gccint).
All of "g", "i", "s", "X" work, btw; but "X" seems the most
appropriate. This should work on x86, too (and I guess you
were just lucky that the "p" worked).
Segher