Issue 81755
Summary [X86] Use __builtin_readsteadycounter to access MPERF counter (and APERF equivalent(
Labels backend:X86
Assignees
Reporter RKSimon
    #81331 added support for a `__builtin_readsteadycounter` intrinsic which returns a fixed frequency clock counter.  It returns 0 on failure.

x86 can use this as a wrapper to read the MPERF counter - on Intel (and default) I think this will need to lower to a libcall, but on AMD znver2 (or later) we can use the RDPRU instruction. 

Ideally we need a companion `__builtin_readvariablecounter` intrinsic which returns the APERF counter to calculate the effective cpu frequency (we can't use `__builtin_readcyclecounter` as that returns RDTSC which is a different time scale).
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to