This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Using inline assembly with specific register indices


On Tue, Apr 05, 2005 at 07:24:44AM +0300, nkavv@physics.auth.gr wrote:
> Hi guys/ladies,
> 
> I'm currently designing an ISA add-on to the MIPS architecture. My
> intention is to use it (it is an algorithm accelerator actually) as a
> COP2 (coprocessor #2). The corresponding microarchitecture is stable
> (works at register-transfer level, not subject to change). Plus, I
> would be happy NOT TO CHANGE my ISA add-on.
> 
> My problem is that I would like to access specific indices in the data
> register file of COP2, i.e. registers c2r0 to c2r31. This should be
> done in inline assembly or else I'll have to put down probably 2k-3k
> C-lines in assembly :-)
> 
> Is it possible to write down something like this:
> 
> asm("cop2a %0, %1;", :: "r" (cp2rb(i)) : "r" (cp2rb(j)));

If GCC knows about the registers on the coprocessor, then you can use
local register variables for this:
  long c2r0 asm ("c2r0");

If it doesn't, then you should probably not be telling GCC about them.
Assuming i is constant:

  asm volatile ("cop2a c2r" STRINGIFY(i) ", c2r" STRINGIFY(j) );


-- 
Daniel Jacobowitz
CodeSourcery, LLC


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]