[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Asm function to count clock ticks

>>>>> On Fri, 12 Jul 2002 16:07:39 +0200, "david.defour@freesbee.fr"<david.defour@freesbee.fr> said:

  David.D> I try to count clock ticks on my itanium with the asm
  David.D> assembly code line included in a C program:

  David.D> __asm__ __volatile__("mov %0=ar.itc" : "=r"((t).tick) ::
  David.D> "memory")

  David.D> where (t).tick is a unsigned long int and i got the
  David.D> following message when i compiled it:

  David.D> Can't find a register in class `AR_M_REGS' while
  David.D> reloading `asm'.

  David.D> Does anyone encounter the same kind of message while
  David.D> trying to include asm in his C program ?

The code you quote looks fine in principle (though the details
obviously depend on what "t" is.  What compiler are you using?  It
worked fine for me both with gcc 2.96 and 3.1.

Note that Itanium has an errata for the itc: to work around this
errata, you need to re-read ar.itc if the low 32 bits of the returned
value are equal to 0xffffffff.  (No such errata exists for Itanium 2,
aka McKinley.)


To UNSUBSCRIBE, email to debian-ia64-request@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org

Reply to: