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]

PowerPC - user variables referring to CRs


It would be nice to be able to write code like this:

#define CCMODE_MASK_SO /* as appropriate */

extern void syscall_error(void);

void do_syscall(void)
{
  register int cr0 __attribute__ ((mode(CC)));

  asm ("li 0,%1\n\tsc" : "=x" (cr0) : "i" (SYS_whatever));

  if (__builtin_expect (cr0 & CCMODE_MASK_SO, 0)) syscall_error();
}

which would produce assembly such as

      li 0,SYS_whatever
      sc
      bnslr+ 0
      b syscall_error

What it actually does is spit out an error message:

test.c:5: error: no data type for mode `CC'

And what I'm wondering is how much stands between us and this
capability.  It might be a matter of adding a notion of a CCmode type
to the C front end, or it might be much hairier.  Anyone know?

zw


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