i386-cpuinfo.c (FEATURE_AVX2): New enum value.
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. From-SVN: r186855
This commit is contained in:
parent
c2ad8e1c40
commit
5ddecff9f2
7 changed files with 39 additions and 5 deletions
|
@ -1,3 +1,8 @@
|
|||
2012-04-25 Sriraman Tallam <tmsriram@google.com>
|
||||
|
||||
* doc/extend.texi: Document avx2 support.
|
||||
* config/i386/i386.c (fold_builtin_cpu): Add avx2.
|
||||
|
||||
2012-04-26 Hans-Peter Nilsson <hp@axis.com>
|
||||
|
||||
PR target/53120
|
||||
|
|
|
@ -27763,6 +27763,7 @@ fold_builtin_cpu (tree fndecl, tree *args)
|
|||
F_SSE4_1,
|
||||
F_SSE4_2,
|
||||
F_AVX,
|
||||
F_AVX2,
|
||||
F_MAX
|
||||
};
|
||||
|
||||
|
@ -27830,7 +27831,8 @@ fold_builtin_cpu (tree fndecl, tree *args)
|
|||
{"ssse3", F_SSSE3},
|
||||
{"sse4.1", F_SSE4_1},
|
||||
{"sse4.2", F_SSE4_2},
|
||||
{"avx", F_AVX}
|
||||
{"avx", F_AVX},
|
||||
{"avx2", F_AVX2}
|
||||
};
|
||||
|
||||
static tree __processor_model_type = NULL_TREE;
|
||||
|
|
|
@ -9541,6 +9541,8 @@ SSE4.1 instructions.
|
|||
SSE4.2 instructions.
|
||||
@item avx
|
||||
AVX instructions.
|
||||
@item avx2
|
||||
AVX2 instructions.
|
||||
@end table
|
||||
|
||||
Here is an example:
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
2012-04-25 Sriraman Tallam <tmsriram@google.com>
|
||||
|
||||
* testsuite/gcc.target/i386/builtin_target.c: Check avx2.
|
||||
|
||||
2012-04-26 Alan Modra <amodra@gmail.com>
|
||||
|
||||
* gcc.target/powerpc/savres.c: New test.
|
||||
|
|
|
@ -29,6 +29,8 @@ fn1 ()
|
|||
|
||||
assert (__builtin_cpu_supports ("avx") >= 0);
|
||||
|
||||
assert (__builtin_cpu_supports ("avx2") >= 0);
|
||||
|
||||
/* Check CPU type. */
|
||||
assert (__builtin_cpu_is ("amd") >= 0);
|
||||
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue