util: Move u_debug to utils
[mesa.git] / src / gallium / auxiliary / util / u_cpu_detect.h
index 1612d49286a81dc13b64e230f0ec6e032be2511d..efc910d147304fc5e678c4e376abfce5eccf4ee2 100644 (file)
  *
  ***************************************************************************/
 
-/*
- * Based on the work of Eric Anholt <anholt@FreeBSD.org>
+/**
+ * @file
+ * CPU feature detection.
+ *
+ * @author Dennis Smit
+ * @author Based on the work of Eric Anholt <anholt@FreeBSD.org>
  */
 
-#ifndef _CPU_DETECT_H
-#define _CPU_DETECT_H
-
-typedef enum {
-       CPU_DETECT_TYPE_MIPS,
-       CPU_DETECT_TYPE_ALPHA,
-       CPU_DETECT_TYPE_SPARC,
-       CPU_DETECT_TYPE_X86,
-       CPU_DETECT_TYPE_POWERPC,
-       CPU_DETECT_TYPE_OTHER
-} cpu_detect_type;
-
-struct cpu_detect_caps {
-       cpu_detect_type type;
-       int             nrcpu;
-
-       /* Feature flags */
-       int             x86cpuType;
-       int             cacheline;
-
-       int             hasTSC;
-       int             hasMMX;
-       int             hasMMX2;
-       int             hasSSE;
-       int             hasSSE2;
-       int             hasSSE3;
-       int             hasSSSE3;
-       int             has3DNow;
-       int             has3DNowExt;
-       int             hasAltiVec;
+#ifndef _UTIL_CPU_DETECT_H
+#define _UTIL_CPU_DETECT_H
+
+
+#include "pipe/p_compiler.h"
+#include "pipe/p_config.h"
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+struct util_cpu_caps {
+   int nr_cpus;
+
+   /* Feature flags */
+   int x86_cpu_type;
+   unsigned cacheline;
+   unsigned cores_per_L3;
+
+   unsigned has_intel:1;
+   unsigned has_tsc:1;
+   unsigned has_mmx:1;
+   unsigned has_mmx2:1;
+   unsigned has_sse:1;
+   unsigned has_sse2:1;
+   unsigned has_sse3:1;
+   unsigned has_ssse3:1;
+   unsigned has_sse4_1:1;
+   unsigned has_sse4_2:1;
+   unsigned has_popcnt:1;
+   unsigned has_avx:1;
+   unsigned has_avx2:1;
+   unsigned has_f16c:1;
+   unsigned has_fma:1;
+   unsigned has_3dnow:1;
+   unsigned has_3dnow_ext:1;
+   unsigned has_xop:1;
+   unsigned has_altivec:1;
+   unsigned has_vsx:1;
+   unsigned has_daz:1;
+   unsigned has_neon:1;
+
+   unsigned has_avx512f:1;
+   unsigned has_avx512dq:1;
+   unsigned has_avx512ifma:1;
+   unsigned has_avx512pf:1;
+   unsigned has_avx512er:1;
+   unsigned has_avx512cd:1;
+   unsigned has_avx512bw:1;
+   unsigned has_avx512vl:1;
+   unsigned has_avx512vbmi:1;
 };
 
-/* prototypes */
-void cpu_detect_initialize(void);
-struct cpu_detect_caps *cpu_detect_get_caps(void);
-
-int cpu_detect_get_tsc(void);
-int cpu_detect_get_mmx(void);
-int cpu_detect_get_mmx2(void);
-int cpu_detect_get_sse(void);
-int cpu_detect_get_sse2(void);
-int cpu_detect_get_sse3(void);
-int cpu_detect_get_ssse3(void);
-int cpu_detect_get_3dnow(void);
-int cpu_detect_get_3dnow2(void);
-int cpu_detect_get_altivec(void);
-
-#endif /* _CPU_DETECT_H */
+extern struct util_cpu_caps
+util_cpu_caps;
+
+void util_cpu_detect(void);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif /* _UTIL_CPU_DETECT_H */