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: How to implement "unsigned long long __rdtsc ()" for x86?


On Fri, Jan 16, 2009 at 09:35:33AM -0800, Andrew Thomas Pinski wrote:
> 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.

According to the info docs, the Alpha has __builtin_alpha_rpcc which
doesn't take any inputs either, and should just call rpcc much as an
rdtsc intrinsic would, so it may provide a more direct model.

-Jack


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