Vector Class Discussion

patch: xgetbv on gcc<4.4
Author:  Date: 2014-04-22 11:45
This is a tiny patch to compile on gcc<4.4, where xgetbv doesn't exist. That includes RHEL5.

diff --git a/instrset_detect.cpp b/instrset_detect.cpp
--- a/instrset_detect.cpp
+++ b/instrset_detect.cpp
@@ -54,7 +54,11 @@
#elif defined(__GNUC__) // use inline assembly, Gnu/AT&T syntax

uint32_t a, d;
+#if __GNUC_PREREQ(4,4)
__asm("xgetbv" : "=a"(a),"=d"(d) : "c"(ctr) : );
+#else
+ a = d = 0;
+#endif
return a | (uint64_t(d) << 32);

#else // #elif defined (_WIN32) // other compiler. try inline assembly with masm/intel/MS syntax

 
thread patch: xgetbv on gcc<4.4 - Greg Allen - 2014-04-22
last replythread patch: xgetbv on gcc<4.4 new - Agner - 2014-04-22
last reply patch: xgetbv on gcc<4.4 new - Greg Allen - 2014-04-23