<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">
<div class=""><br class="">
</div>
<br class="">
<div>
<blockquote type="cite" class="">
<div class="">On May 26, 2016, at 3:06 PM, Tim Rowley <<a href="mailto:timothy.o.rowley@intel.com" class="">timothy.o.rowley@intel.com</a>> wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<div class="">v2: style code, add avx512 to cpu dump<br class="">
---<br class="">
src/gallium/auxiliary/util/u_cpu_detect.c | 26 ++++++++++++++++++++++++++<br class="">
src/gallium/auxiliary/util/u_cpu_detect.h | 10 ++++++++++<br class="">
2 files changed, 36 insertions(+)<br class="">
<br class="">
diff --git a/src/gallium/auxiliary/util/u_cpu_detect.c b/src/gallium/auxiliary/util/u_cpu_detect.c<br class="">
index aa3c30a..03f45cf 100644<br class="">
--- a/src/gallium/auxiliary/util/u_cpu_detect.c<br class="">
+++ b/src/gallium/auxiliary/util/u_cpu_detect.c<br class="">
@@ -387,6 +387,23 @@ util_cpu_detect(void)<br class="">
util_cpu_caps.has_avx2 = (regs7[1] >> 5) & 1;<br class="">
}<br class="">
<br class="">
+ // check for avx512<br class="">
+ if (((regs2[2] >> 27) & 1) && // OSXSAVE<br class="">
+ (xgetbv() & (0x7 << 5)) && // OPMASK: upper-256 enabled by OS<br class="">
+ (xgetbv() & (0x3 << 1))) { // XMM/YMM enabled by OS<br class="">
</div>
</div>
</blockquote>
<div><br class="">
</div>
<div>In the general feature flags above this, has_avx uses ((xgetbv() & 6) == 6) to establish XMM/YMM support.</div>
<div><a href="https://software.intel.com/en-us/articles/introduction-to-intel-advanced-vector-extensions" class="">https://software.intel.com/en-us/articles/introduction-to-intel-advanced-vector-extensions</a></div>
<div><br class="">
</div>
<br class="">
<blockquote type="cite" class="">
<div class="">
<div class="">+ uint32_t regs3[4];<br class="">
+ cpuid(0x00000007, regs3);<br class="">
+ util_cpu_caps.has_avx512f = (regs3[1] >> 16) & 1;<br class="">
+ util_cpu_caps.has_avx512dq = (regs3[1] >> 17) & 1;<br class="">
+ util_cpu_caps.has_avx512ifma = (regs3[1] >> 21) & 1;<br class="">
+ util_cpu_caps.has_avx512pf = (regs3[1] >> 26) & 1;<br class="">
+ util_cpu_caps.has_avx512er = (regs3[1] >> 27) & 1;<br class="">
+ util_cpu_caps.has_avx512cd = (regs3[1] >> 28) & 1;<br class="">
+ util_cpu_caps.has_avx512bw = (regs3[1] >> 30) & 1;<br class="">
+ util_cpu_caps.has_avx512vl = (regs3[1] >> 31) & 1;<br class="">
+ util_cpu_caps.has_avx512vbmi = (regs3[2] >> 1) & 1;<br class="">
+ }<br class="">
+<br class="">
if (regs[1] == 0x756e6547 && regs[2] == 0x6c65746e && regs[3] == 0x49656e69) {<br class="">
/* GenuineIntel */<br class="">
util_cpu_caps.has_intel = 1;<br class="">
@@ -454,6 +471,15 @@ util_cpu_detect(void)<br class="">
debug_printf("util_cpu_caps.has_xop = %u\n", util_cpu_caps.has_xop);<br class="">
debug_printf("util_cpu_caps.has_altivec = %u\n", util_cpu_caps.has_altivec);<br class="">
debug_printf("util_cpu_caps.has_daz = %u\n", util_cpu_caps.has_daz);<br class="">
+ debug_printf("util_cpu_caps.has_avx512f = %u\n", util_cpu_caps.has_avx512f);<br class="">
+ debug_printf("util_cpu_caps.has_avx512dq = %u\n", util_cpu_caps.has_avx512dq);<br class="">
+ debug_printf("util_cpu_caps.has_avx512ifma = %u\n", util_cpu_caps.has_avx512ifma);<br class="">
+ debug_printf("util_cpu_caps.has_avx512pf = %u\n", util_cpu_caps.has_avx512pf);<br class="">
+ debug_printf("util_cpu_caps.has_avx512er = %u\n", util_cpu_caps.has_avx512er);<br class="">
+ debug_printf("util_cpu_caps.has_avx512cd = %u\n", util_cpu_caps.has_avx512cd);<br class="">
+ debug_printf("util_cpu_caps.has_avx512bw = %u\n", util_cpu_caps.has_avx512bw);<br class="">
+ debug_printf("util_cpu_caps.has_avx512vl = %u\n", util_cpu_caps.has_avx512vl);<br class="">
+ debug_printf("util_cpu_caps.has_avx512vbmi = %u\n", util_cpu_caps.has_avx512vbmi);<br class="">
}<br class="">
#endif<br class="">
<br class="">
diff --git a/src/gallium/auxiliary/util/u_cpu_detect.h b/src/gallium/auxiliary/util/u_cpu_detect.h<br class="">
index 5ccfc93..b612a2c 100644<br class="">
--- a/src/gallium/auxiliary/util/u_cpu_detect.h<br class="">
+++ b/src/gallium/auxiliary/util/u_cpu_detect.h<br class="">
@@ -71,6 +71,16 @@ struct util_cpu_caps {<br class="">
unsigned has_xop:1;<br class="">
unsigned has_altivec:1;<br class="">
unsigned has_daz:1;<br class="">
+<br class="">
+ unsigned has_avx512f:1;<br class="">
+ unsigned has_avx512dq:1;<br class="">
+ unsigned has_avx512ifma:1;<br class="">
+ unsigned has_avx512pf:1;<br class="">
+ unsigned has_avx512er:1;<br class="">
+ unsigned has_avx512cd:1;<br class="">
+ unsigned has_avx512bw:1;<br class="">
+ unsigned has_avx512vl:1;<br class="">
+ unsigned has_avx512vbmi:1;<br class="">
};<br class="">
<br class="">
extern struct util_cpu_caps<br class="">
-- <br class="">
1.9.1<br class="">
<br class="">
_______________________________________________<br class="">
mesa-dev mailing list<br class="">
<a href="mailto:mesa-dev@lists.freedesktop.org" class="">mesa-dev@lists.freedesktop.org</a><br class="">
https://lists.freedesktop.org/mailman/listinfo/mesa-dev<br class="">
</div>
</div>
</blockquote>
</div>
<br class="">
</body>
</html>