diff options
author | tmsriram <tmsriram@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-04-26 00:52:09 +0000 |
---|---|---|
committer | tmsriram <tmsriram@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-04-26 00:52:09 +0000 |
commit | d79cfc15d40409f3777549e6b86c3b3bf51399c6 (patch) | |
tree | bc87408432ea357dc78b6eee443172032550af77 /libgcc | |
parent | cea0c96b3b1b8e817d16b0ab2fa4a64aa360e8e0 (diff) | |
download | gcc-d79cfc15d40409f3777549e6b86c3b3bf51399c6.tar.gz |
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.
* doc/extend.texi: Document avx2 support.
* config/i386/i386.c (fold_builtin_cpu): Add avx2.
* testsuite/gcc.target/i386/builtin_target.c: Check avx2.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@186855 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgcc')
-rw-r--r-- | libgcc/ChangeLog | 6 | ||||
-rw-r--r-- | libgcc/config/i386/i386-cpuinfo.c | 21 |
2 files changed, 23 insertions, 4 deletions
diff --git a/libgcc/ChangeLog b/libgcc/ChangeLog index 831fa12203a..16fb55318c1 100644 --- a/libgcc/ChangeLog +++ b/libgcc/ChangeLog @@ -1,3 +1,9 @@ +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. diff --git a/libgcc/config/i386/i386-cpuinfo.c b/libgcc/config/i386/i386-cpuinfo.c index dccf1d58f27..6934778c0fc 100644 --- a/libgcc/config/i386/i386-cpuinfo.c +++ b/libgcc/config/i386/i386-cpuinfo.c @@ -75,7 +75,8 @@ enum processor_features FEATURE_SSSE3, FEATURE_SSE4_1, FEATURE_SSE4_2, - FEATURE_AVX + FEATURE_AVX, + FEATURE_AVX2 }; struct __processor_model @@ -191,8 +192,11 @@ get_intel_cpu (unsigned int family, unsigned int model, unsigned int brand_id) } } +/* 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; @@ -217,6 +221,15 @@ get_available_features (unsigned int ecx, unsigned int edx) 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; } @@ -296,7 +309,7 @@ __cpu_indicator_init (void) /* 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) @@ -311,7 +324,7 @@ __cpu_indicator_init (void) /* 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 |