+2012-04-25 Sriraman Tallam <tmsriram@google.com>
+
+ * config/i386/i386-cpuinfo.c (FEATURE_AVX2): New enum value.
+ (get_available_features): New argument. Check for AVX2.
+ (__cpu_indicator_init): Modify call to get_available_features.
+
2012-04-25 Alan Modra <amodra@gmail.com>
* config/rs6000/crtsavevr.S: New file.
FEATURE_SSSE3,
FEATURE_SSE4_1,
FEATURE_SSE4_2,
- FEATURE_AVX
+ FEATURE_AVX,
+ FEATURE_AVX2
};
struct __processor_model
}
}
+/* ECX and EDX are output of CPUID at level one. MAX_CPUID_LEVEL is
+ the max possible level of CPUID insn. */
static void
-get_available_features (unsigned int ecx, unsigned int edx)
+get_available_features (unsigned int ecx, unsigned int edx,
+ int max_cpuid_level)
{
unsigned int features = 0;
if (ecx & bit_AVX)
features |= (1 << FEATURE_AVX);
+ /* Get Advanced Features at level 7 (eax = 7, ecx = 0). */
+ if (max_cpuid_level >= 7)
+ {
+ unsigned int eax, ebx, ecx, edx;
+ __cpuid_count (7, 0, eax, ebx, ecx, edx);
+ if (ebx & bit_AVX2)
+ features |= (1 << FEATURE_AVX2);
+ }
+
__cpu_model.__cpu_features[0] = features;
}
/* Get CPU type. */
get_intel_cpu (family, model, brand_id);
/* Find available features. */
- get_available_features (ecx, edx);
+ get_available_features (ecx, edx, max_level);
__cpu_model.__cpu_vendor = VENDOR_INTEL;
}
else if (vendor == SIG_AMD)
/* Get CPU type. */
get_amd_cpu (family, model);
/* Find available features. */
- get_available_features (ecx, edx);
+ get_available_features (ecx, edx, max_level);
__cpu_model.__cpu_vendor = VENDOR_AMD;
}
else