[pypy-svn] r79274 - pypy/trunk/pypy/translator/c/src

arigo at codespeak.net arigo at codespeak.net
Fri Nov 19 14:37:53 CET 2010


Author: arigo
Date: Fri Nov 19 14:37:52 2010
New Revision: 79274

Added:
   pypy/trunk/pypy/translator/c/src/asm_gcc_x86_64.h
Modified:
   pypy/trunk/pypy/translator/c/src/g_include.h
Log:
Add the high-res timestamp to x86-64 too.


Added: pypy/trunk/pypy/translator/c/src/asm_gcc_x86_64.h
==============================================================================
--- (empty file)
+++ pypy/trunk/pypy/translator/c/src/asm_gcc_x86_64.h	Fri Nov 19 14:37:52 2010
@@ -0,0 +1,8 @@
+/* This optional file only works for GCC on an x86-64.
+ */
+
+#define READ_TIMESTAMP(val) do {                        \
+    unsigned int _eax, _edx;                            \
+    asm volatile("rdtsc" : "=a" (_eax), "=d" (_edx));   \
+    val = (((unsigned long) _edx) << 32) | _eax;        \
+} while (0)

Modified: pypy/trunk/pypy/translator/c/src/g_include.h
==============================================================================
--- pypy/trunk/pypy/translator/c/src/g_include.h	(original)
+++ pypy/trunk/pypy/translator/c/src/g_include.h	Fri Nov 19 14:37:52 2010
@@ -43,6 +43,10 @@
 #  include "src/asm_gcc_x86.h"
 #endif
 
+#if defined(__GNUC__) && defined(__amd64__)
+#  include "src/asm_gcc_x86_64.h"
+#endif
+
 #if defined(__GNUC__) && defined(__ppc__)
 #  include "src/asm_ppc.h"
 #endif



More information about the Pypy-commit mailing list