diff mbox

0002-Fix-32-bit-alignment for Core i7

Message ID 4CBDEE7A.9020001@codesourcery.com
State New
Headers show

Commit Message

Maxim Kuvyrkov Oct. 19, 2010, 7:16 p.m. UTC
On 10/19/10 9:21 PM, Richard Henderson wrote:
>> +  PROCESSOR_COREI7_32,
>> +  PROCESSOR_COREI7_64,
>
> You had different tunings for 32 and 64-bit to come, right?
> You've done it this way instead of
>
>    TARGET_COREI7&&  TARGET_32BIT
>
> because of the indicies into processor_target_table?

Yes, that is one of the reasons.  The other reason is tuning settings in 
initial_ix86_tune_features.  The later may not be very clear because of ...

>
>> -#define m_GENERIC32 (1<<PROCESSOR_GENERIC32)
>> -#define m_GENERIC64 (1<<PROCESSOR_GENERIC64)
>> +#define m_GENERIC32 (1<<PROCESSOR_GENERIC32 | m_COREI7_32)
>> +#define m_GENERIC64 (1<<PROCESSOR_GENERIC64 | m_COREI7_64)
>
> This bit I don't understand.  Why does GENERIC include COREI7?

... this.  This change [temporarily] aliases PROCESSOR_COREI7_* to 
PROCESSOR_GENERIC.  One could have added m_COREI7_* to all the entries 
that mention m_GENERIC* instead, but it would not be as clear about the 
intent of the patch.  In any case, the above hunk will be reverted by 
subsequent patches that will adjust initial_ix86_tune_features and 
related arrays.

I missed hunks to ix86_option_override_internal() in the patch I posted, 
without it the rest of the patch would be a no-op.  Attached is the full 
version.

Regards,

Comments

Maxim Kuvyrkov Oct. 19, 2010, 7:21 p.m. UTC | #1
On 10/19/10 11:16 PM, Maxim Kuvyrkov wrote:
> @@ -3260,8 +3266,8 @@ ix86_option_override_internal (bool main_args_p)
>   	    /* Adjust tuning when compiling for 32-bit ABI.  */
>   	    switch (ix86_tune)
>   	      {
> -	      case  PROCESSOR_GENERIC64:
> -		ix86_tune = PROCESSOR_GENERIC32;
> +	      case  PROCESSOR_COREI7_64:
> +		ix86_tune = PROCESSOR_COREI7_32;
>   		ix86_schedule = CPU_PENTIUMPRO;
>   		break;

And I have fixed the two spaces in "case  PROCESSOR_*" all across my 
patch set.
Richard Henderson Oct. 19, 2010, 7:23 p.m. UTC | #2
> -	      case  PROCESSOR_GENERIC64:
> -		ix86_tune = PROCESSOR_GENERIC32;
> +	      case  PROCESSOR_COREI7_64:
> +		ix86_tune = PROCESSOR_COREI7_32;

Surely you didn't actually intend to delete PROCESSOR_GENERIC64
here, but to add an extra COREI7 case?

If so, patch ok with that change.



r~
Maxim Kuvyrkov Oct. 19, 2010, 7:27 p.m. UTC | #3
On 10/19/10 11:23 PM, Richard Henderson wrote:
>> -	      case  PROCESSOR_GENERIC64:
>> -		ix86_tune = PROCESSOR_GENERIC32;
>> +	      case  PROCESSOR_COREI7_64:
>> +		ix86_tune = PROCESSOR_COREI7_32;
>
> Surely you didn't actually intend to delete PROCESSOR_GENERIC64
> here, but to add an extra COREI7 case?

Well, I did intend to delete the PROCESSOR_GENERIC64 case as it is no 
longer used after

> -      {"corei7", PROCESSOR_GENERIC64, CPU_GENERIC64,
> +      {"corei7", PROCESSOR_COREI7_64, CPU_GENERIC64,

I can leave the GENERIC64 case if that seems useful.

Thanks,
H.J. Lu Oct. 19, 2010, 7:28 p.m. UTC | #4
On Tue, Oct 19, 2010 at 12:27 PM, Maxim Kuvyrkov <maxim@codesourcery.com> wrote:
> On 10/19/10 11:23 PM, Richard Henderson wrote:
>>>
>>> -             case  PROCESSOR_GENERIC64:
>>> -               ix86_tune = PROCESSOR_GENERIC32;
>>> +             case  PROCESSOR_COREI7_64:
>>> +               ix86_tune = PROCESSOR_COREI7_32;
>>
>> Surely you didn't actually intend to delete PROCESSOR_GENERIC64
>> here, but to add an extra COREI7 case?
>
> Well, I did intend to delete the PROCESSOR_GENERIC64 case as it is no longer
> used after
>
>> -      {"corei7", PROCESSOR_GENERIC64, CPU_GENERIC64,
>> +      {"corei7", PROCESSOR_COREI7_64, CPU_GENERIC64,
>
> I can leave the GENERIC64 case if that seems useful.
>

I think it is useful for other processors.
Richard Henderson Oct. 19, 2010, 7:42 p.m. UTC | #5
On 10/19/2010 12:27 PM, Maxim Kuvyrkov wrote:
> I can leave the GENERIC64 case if that seems useful.

Please do.
diff mbox

Patch

diff --git a/gcc/config/i386/i386-c.c b/gcc/config/i386/i386-c.c
index 1846efb..3b4409e 100644
--- a/gcc/config/i386/i386-c.c
+++ b/gcc/config/i386/i386-c.c
@@ -122,6 +122,11 @@  ix86_target_macros_internal (int isa_flag,
       def_or_undef (parse_in, "__core2");
       def_or_undef (parse_in, "__core2__");
       break;
+    case PROCESSOR_COREI7_32:
+    case PROCESSOR_COREI7_64:
+      def_or_undef (parse_in, "__corei7");
+      def_or_undef (parse_in, "__corei7__");
+      break;
     case PROCESSOR_ATOM:
       def_or_undef (parse_in, "__atom");
       def_or_undef (parse_in, "__atom__");
@@ -197,6 +202,10 @@  ix86_target_macros_internal (int isa_flag,
     case PROCESSOR_CORE2:
       def_or_undef (parse_in, "__tune_core2__");
       break;
+    case PROCESSOR_COREI7_32:
+    case PROCESSOR_COREI7_64:
+      def_or_undef (parse_in, "__tune_corei7__");
+      break;
     case PROCESSOR_ATOM:
       def_or_undef (parse_in, "__tune_atom__");
       break;
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 71e0242..3bee0b7 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -1355,6 +1355,8 @@  const struct processor_costs *ix86_cost = &pentium_cost;
 #define m_PENT4  (1<<PROCESSOR_PENTIUM4)
 #define m_NOCONA  (1<<PROCESSOR_NOCONA)
 #define m_CORE2  (1<<PROCESSOR_CORE2)
+#define m_COREI7_32  (1<<PROCESSOR_COREI7_32)
+#define m_COREI7_64  (1<<PROCESSOR_COREI7_64)
 #define m_ATOM  (1<<PROCESSOR_ATOM)
 
 #define m_GEODE  (1<<PROCESSOR_GEODE)
@@ -1367,8 +1369,8 @@  const struct processor_costs *ix86_cost = &pentium_cost;
 #define m_BDVER1  (1<<PROCESSOR_BDVER1)
 #define m_AMD_MULTIPLE  (m_K8 | m_ATHLON | m_AMDFAM10 | m_BDVER1)
 
-#define m_GENERIC32 (1<<PROCESSOR_GENERIC32)
-#define m_GENERIC64 (1<<PROCESSOR_GENERIC64)
+#define m_GENERIC32 (1<<PROCESSOR_GENERIC32 | m_COREI7_32)
+#define m_GENERIC64 (1<<PROCESSOR_GENERIC64 | m_COREI7_64)
 
 /* Generic instruction choice should be common subset of supported CPUs
    (PPro/PENT4/NOCONA/CORE2/Athlon/K8).  */
@@ -2173,6 +2175,10 @@  static const struct ptt processor_target_table[PROCESSOR_max] =
   {&k8_cost, 16, 7, 16, 7, 16},
   {&nocona_cost, 0, 0, 0, 0, 0},
   {&core2_cost, 16, 10, 16, 10, 16},
+  /* Core i7 32-bit.  */
+  {&generic32_cost, 16, 10, 16, 10, 16},
+  /* Core i7 64-bit.  */
+  {&generic64_cost, 16, 10, 16, 10, 16},
   {&generic32_cost, 16, 7, 16, 7, 16},
   {&generic64_cost, 16, 10, 16, 10, 16},
   {&amdfam10_cost, 32, 24, 32, 7, 32},
@@ -2894,7 +2900,7 @@  ix86_option_override_internal (bool main_args_p)
       {"core2", PROCESSOR_CORE2, CPU_CORE2,
 	PTA_64BIT | PTA_MMX | PTA_SSE | PTA_SSE2 | PTA_SSE3
 	| PTA_SSSE3 | PTA_CX16},
-      {"corei7", PROCESSOR_GENERIC64, CPU_GENERIC64,
+      {"corei7", PROCESSOR_COREI7_64, CPU_GENERIC64,
        PTA_64BIT | PTA_MMX | PTA_SSE | PTA_SSE2 | PTA_SSE3
        | PTA_SSSE3 | PTA_SSE4_1 | PTA_SSE4_2 | PTA_CX16},
       {"atom", PROCESSOR_ATOM, CPU_ATOM,
@@ -3260,8 +3266,8 @@  ix86_option_override_internal (bool main_args_p)
 	    /* Adjust tuning when compiling for 32-bit ABI.  */
 	    switch (ix86_tune)
 	      {
-	      case  PROCESSOR_GENERIC64:
-		ix86_tune = PROCESSOR_GENERIC32;
+	      case  PROCESSOR_COREI7_64:
+		ix86_tune = PROCESSOR_COREI7_32;
 		ix86_schedule = CPU_PENTIUMPRO;
 		break;
 
diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h
index 62f35ca..e0c7260 100644
--- a/gcc/config/i386/i386.h
+++ b/gcc/config/i386/i386.h
@@ -239,6 +239,9 @@  extern const struct processor_costs ix86_size_cost;
 #define TARGET_ATHLON_K8 (TARGET_K8 || TARGET_ATHLON)
 #define TARGET_NOCONA (ix86_tune == PROCESSOR_NOCONA)
 #define TARGET_CORE2 (ix86_tune == PROCESSOR_CORE2)
+#define TARGET_COREI7_32 (ix86_tune == PROCESSOR_COREI7_32)
+#define TARGET_COREI7_64 (ix86_tune == PROCESSOR_COREI7_64)
+#define TARGET_COREI7 (TARGET_COREI7_32 || TARGET_COREI7_64)
 #define TARGET_GENERIC32 (ix86_tune == PROCESSOR_GENERIC32)
 #define TARGET_GENERIC64 (ix86_tune == PROCESSOR_GENERIC64)
 #define TARGET_GENERIC (TARGET_GENERIC32 || TARGET_GENERIC64)
@@ -2057,8 +2060,7 @@  do {									\
 	"call " CRT_MKSTR(__USER_LABEL_PREFIX__) #FUNC "\n"	\
 	TEXT_SECTION_ASM_OP);
 
-/* Which processor to schedule for. The cpu attribute defines a list that
-   mirrors this list, so changes to i386.md must be made at the same time.  */
+/* Which processor to tune code generation for.  */
 
 enum processor_type
 {
@@ -2073,6 +2075,8 @@  enum processor_type
   PROCESSOR_K8,
   PROCESSOR_NOCONA,
   PROCESSOR_CORE2,
+  PROCESSOR_COREI7_32,
+  PROCESSOR_COREI7_64,
   PROCESSOR_GENERIC32,
   PROCESSOR_GENERIC64,
   PROCESSOR_AMDFAM10,
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 776fdd0..24a8e87 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -12051,6 +12051,9 @@  SSE2 and SSE3 instruction set support.
 @item core2
 Intel Core2 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3 and SSSE3
 instruction set support.
+@item corei7
+Intel Core i7 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1
+and SSE4.2 instruction set support.
 @item atom
 Intel Atom CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3 and SSSE3
 instruction set support.