Patchwork [i386] PR 57927: -march=core-avx2 different than -march=native on INTEL Haswell (i7-4700K)

login
register
mail settings
Submitter Christian Widmer
Date Aug. 27, 2013, 7:46 a.m.
Message ID <521C5943.6000708@umbrox.de>
Download mbox | patch
Permalink /patch/270050/
State New
Headers show

Comments

Christian Widmer - Aug. 27, 2013, 7:46 a.m.
Hello!

As reported in [1] the host processor detection has not yet been updated
to recognize Intel Ivy Bridge and Haswell processors.
This small patch adds the detection of these processors and assumes
core-avx2 as march for unknown processors of the PENTIUMPRO family that
support AVX2.


Best regards

Christian Widmer


[1] http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57927
2013-08-27  Christian Widmer  <shadow@umbrox.de>

    PR target/57927
    * config/i386/driver-i386.c (host_detect_local_cpu): Add detection of Ivy
    Bridge and Haswell processors and assume core-avx2 for unknown AVX2 capable
    processors

Patch

Index: gcc/config/i386/driver-i386.c
===================================================================
*** gcc/config/i386/driver-i386.c	(revision 202013)
--- gcc/config/i386/driver-i386.c	(working copy)
*************** const char *host_detect_local_cpu (int a
*** 662,667 ****
--- 662,675 ----
  	  /* Sandy Bridge.  */
  	  cpu = "corei7-avx";
  	  break;
+ 	case 0x3a:
+ 	  /* Ivy Bridge.  */
+ 	  cpu = "corei7-avx";
+ 	  break;
+ 	case 0x3c:
+ 	  /* Haswell.  */
+ 	  cpu = "core-avx2";
+ 	  break;
  	case 0x17:
  	case 0x1d:
  	  /* Penryn.  */
*************** const char *host_detect_local_cpu (int a
*** 675,682 ****
  	  if (arch)
  	    {
  	      /* This is unknown family 0x6 CPU.  */
! 	      if (has_avx)
! 		/* Assume Sandy Bridge.  */
  		cpu = "corei7-avx";
  	      else if (has_sse4_2)
  		{
--- 683,693 ----
  	  if (arch)
  	    {
  	      /* This is unknown family 0x6 CPU.  */
! 	      if (has_avx2)
! 		/* Assume Haswell.  */
! 		cpu = "core-avx2";
! 	      else if (has_avx)
! 		/* Assume Sandy/Ivy Bridge.  */
  		cpu = "corei7-avx";
  	      else if (has_sse4_2)
  		{