How to implement "unsigned long long __rdtsc ()" for x86?

Andrew Thomas Pinski pinskia@gmail.com
Fri Jan 16 17:36:00 GMT 2009



Sent from my iPhone

On Jan 16, 2009, at 9:23 AM, "H.J. Lu" <hjl.tools@gmail.com> wrote:

> Hi,
>
> I am trying to implement
>
> unsigned long long __rdtsc (void);
>
> for RDTSC as an intrinsic.  It is easy to do it with asm statement.
> But I am having a hard time to implement it as a gcc builtin.
> The main problem is there is no input. It is impossible to write
> a proper RTL for it.  Any suggestions?

unspec_volatile?  I don't see any issues with a no input  
unspec_volatile the rs6000 backend uses that already.

Thanks,
Andrew Pinski

>
>
> I am thinking about adding some fake readonly registers. Will
> it work?
>
> Thanks.
>
>
> -- 
> H.J.



More information about the Gcc mailing list