On Tue, Apr 05, 2005 at 07:24:44AM +0300, [EMAIL PROTECTED] 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