The function dispatcher might currently choose functions declared with
target("arch=ivybridge") on a Sandy Bridge CPU. This happens because the
function is only detected as sandybridge when generated. The attached patch
detects Westmere, Ivybridge and Broadwell processors based on new ISAs they
support.
Regards
`Allan
Index: gcc/ChangeLog
===================================================================
--- gcc/ChangeLog (revision 206233)
+++ gcc/ChangeLog (working copy)
@@ -1,3 +1,9 @@
+2013-12-29 Allan Sandfeld Jensen <[email protected]>
+
+ * config/i386/i386.c (get_builtin_code_for_version): Separate
+ Westmere from Nehalem, Ivy Bridge from Sandy Bridge and
+ Broadwell from Haswell.
+
2013-12-28 Eric Botcazou <[email protected]>
* doc/invoke.texi (output file options): Document -fada-spec-parent.
Index: gcc/config/i386/i386.c
===================================================================
--- gcc/config/i386/i386.c (revision 206233)
+++ gcc/config/i386/i386.c (working copy)
@@ -30030,18 +30005,27 @@
priority = P_PROC_SSSE3;
break;
case PROCESSOR_NEHALEM:
- /* We translate "arch=corei7" and "arch=nehelam" to
- "corei7" so that it will be mapped to M_INTEL_COREI7
- as cpu type to cover all M_INTEL_COREI7_XXXs. */
- arg_str = "corei7";
+ if (new_target->x_ix86_isa_flags & OPTION_MASK_ISA_AES)
+ arg_str = "westmere";
+ else
+ /* We translate "arch=corei7" and "arch=nehelam" to
+ "corei7" so that it will be mapped to M_INTEL_COREI7
+ as cpu type to cover all M_INTEL_COREI7_XXXs. */
+ arg_str = "corei7";
priority = P_PROC_SSE4_2;
break;
case PROCESSOR_SANDYBRIDGE:
- arg_str = "sandybridge";
+ if (new_target->x_ix86_isa_flags & OPTION_MASK_ISA_F16C)
+ arg_str = "ivybridge";
+ else
+ arg_str = "sandybridge";
priority = P_PROC_AVX;
break;
case PROCESSOR_HASWELL:
- arg_str = "haswell";
+ if (new_target->x_ix86_isa_flags & OPTION_MASK_ISA_ADX)
+ arg_str = "broadwell";
+ else
+ arg_str = "haswell";
priority = P_PROC_AVX2;
break;
case PROCESSOR_BONNELL: