DSPRelated.com
Forums

Re: [Fwd: RE: [c54x] REg: inline assembly]

Started by Jeff Brower June 28, 2006
Giridhar-

> Yes I used the space but the problem is "val" is not a register its a
> variable in C file.
> int val;
> asm(" swap2 val1, val2");
> now this gives error.
>
> Then inline asm is of limited use!

You can access C variables using 64x inline asm, but you have to be careful. The C
vars should not be on the stack and you should test it first with all optimizations
turned off. You have to add more lines, like:

asm(" .ref _val1");
asm(" .ref _val2");
asm(" swap2 _val1, _val2");

those are just examples, be careful. In "TMS320C6000 Optimizing Compiler User's
Guide" document:

http://focus.ti.com/lit/ug/spru187l/spru187l.pdf

check out section 8.5.8, Using Inline Assembly Language.

-Jeff

> --- In c..., "Jeff Brower" wrote:
> >
> > Giri-
> >
> > Derk is correct, he means like this:
> >
> > asm(" swap2 val1, val2");
> >
> > The reason is without space the assembler will think that the
> instruction
> > is a label. Think of what normally happens when you're using an
> editor.
> >
> > -Jeff
> >
> >
> > ---------------------------- Original Message ----------------------
> ------
> > Subject: RE: [c54x] REg: inline assembly
> > From: "Derk van de Velde"
> > Date: Mon, June 26, 2006 1:03 am
> > To: "Giridhar Tammana"
> > c...
> > --------------------------------
> ------
> >
> > giri,
> >
> > you must!!! use a space or tab after the qoute.
> > asm ("space val1,val2");
> >
> > regards,
> > derk
> > -----Oorspronkelijk bericht-----
> > Van: c... [mailto:c...]Namens
> Giridhar
> > Tammana
> > Verzonden: zondag 25 juni 2006 16:39
> > Aan: c...
> > Onderwerp: [c54x] REg: inline assembly
> >
> >
> > Hi,
> > I'm using c64x simulator.
> > I want to use swap2 instruction.
> > For this there is no intrinsic.
> >
> > How can I write inline asm if possible to use swap2 instruction?
> >
> > {
> > ....
> > unsigned int val;
> > asm("swap2 val, val");
> > .....
> > }
> >
> > asm("swap2 val, val");
> > above statement is wrong.
> > I also tried _val for val.
> > And GCC like asm("swap2 %0,%0"
> > :"r" val);
> > also doesnt work?
> > Pls reply if some thing we can do.
> > Thanks,
> > Giri
> >