r212053 - [x86] Add Clang support for intrinsic __rdpmc.
Andrea Di Biagio
Andrea_DiBiagio at sn.scee.net
Mon Jun 30 11:23:59 PDT 2014
Author: adibiagio
Date: Mon Jun 30 13:23:58 2014
New Revision: 212053
URL: http://llvm.org/viewvc/llvm-project?rev=212053&view=rev
Log:
[x86] Add Clang support for intrinsic __rdpmc.
This patch adds intrinsic __rdpmc to header file 'ia32intrin.h'.
Intrinsic __rdmpc can be used to read performance monitoring counters. It is
implemented as a direct call to __builtin_ia32_rdpmc.
It takes as input a value representing the index of the performance counter to
read. The value of the performance counter is then returned as a unsigned
64-bit quantity.
Modified:
cfe/trunk/include/clang/Basic/BuiltinsX86.def
cfe/trunk/lib/Headers/ia32intrin.h
cfe/trunk/test/CodeGen/builtins-x86.c
Modified: cfe/trunk/include/clang/Basic/BuiltinsX86.def
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/BuiltinsX86.def?rev=212053&r1=212052&r2=212053&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/BuiltinsX86.def (original)
+++ cfe/trunk/include/clang/Basic/BuiltinsX86.def Mon Jun 30 13:23:58 2014
@@ -757,6 +757,7 @@ BUILTIN(__builtin_ia32_xbegin, "i", "")
BUILTIN(__builtin_ia32_xend, "v", "")
BUILTIN(__builtin_ia32_xabort, "vIc", "")
BUILTIN(__builtin_ia32_xtest, "i", "")
+BUILTIN(__builtin_ia32_rdpmc, "ULLii", "")
BUILTIN(__builtin_ia32_rdtsc, "ULLi", "")
BUILTIN(__builtin_ia32_rdtscp, "ULLiUi*", "")
Modified: cfe/trunk/lib/Headers/ia32intrin.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/ia32intrin.h?rev=212053&r1=212052&r2=212053&view=diff
==============================================================================
--- cfe/trunk/lib/Headers/ia32intrin.h (original)
+++ cfe/trunk/lib/Headers/ia32intrin.h Mon Jun 30 13:23:58 2014
@@ -79,6 +79,11 @@ __writeeflags(unsigned int __f)
}
#endif /* !__x86_64__ */
+static __inline__ unsigned long long __attribute__((__always_inline__, __nodebug__))
+__rdpmc(int __A) {
+ return __builtin_ia32_rdpmc(__A);
+}
+
/* __rdtsc */
static __inline__ unsigned long long __attribute__((__always_inline__, __nodebug__))
__rdtsc(void) {
Modified: cfe/trunk/test/CodeGen/builtins-x86.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/builtins-x86.c?rev=212053&r1=212052&r2=212053&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/builtins-x86.c (original)
+++ cfe/trunk/test/CodeGen/builtins-x86.c Mon Jun 30 13:23:58 2014
@@ -266,6 +266,7 @@ void f0() {
tmp_i = __builtin_ia32_rdtsc();
tmp_i = __builtin_ia32_rdtscp(&tmp_Ui);
+ tmp_LLi = __builtin_ia32_rdpmc(tmp_i);
#ifdef USE_64
tmp_LLi = __builtin_ia32_cvtss2si64(tmp_V4f);
#endif
More information about the cfe-commits
mailing list