This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch i386][google][4.6]Add new target builtins to check for corei7 and amdfam10 (issue5495075)


Checked in.

Thanks,
-Sri.

On Sat, Dec 17, 2011 at 12:21 AM, Xinliang David Li <davidxl@google.com> wrote:
> ok for google branches.
>
> David
>
> On Fri, Dec 16, 2011 at 7:54 PM, Sriraman Tallam <tmsriram@google.com> wrote:
>> Add new target builtins __builtin_cpu_is_intel_corei7 and
>> __builtin_cpu_is_amdfam10.
>>
>> ? ? ? ?* config/i386/i386-cpuinfo.c (__processor_model): Add new members
>> ? ? ? ?__cpu_is_intel_corei7 and __cpu_is_amdfam10.
>> ? ? ? ?(get_amd_cpu): Set __cpu_is_amdfam10.
>> ? ? ? ?(get_intel_cpu): Set __cpu_is_intel_corei7.
>>
>>
>> ? ? ? ?* gcc/config/i386/i386.c
>> ? ? ? ?(IX86_BUILTIN_CPU_IS_INTEL_COREI7): New enum value.
>> ? ? ? ?(IX86_BUILTIN_CPU_IS_AMDFAM10): New enum value.
>> ? ? ? ?(fold_builtin_cpu): Fold the new builtins.
>> ? ? ? ?(ix86_init_platform_type_builtins): Make new buitins
>> ? ? ? ?__builtin_cpu_is_intel_corei7 and
>> ? ? ? ?__builtin_cpu_is_amdfam10.
>> ? ? ? ?* testsuite/gcc.target/i386/builtin_target.c (fn1):
>> ? ? ? ?Call the new builtins.
>>
>> Index: libgcc/config/i386/i386-cpuinfo.c
>> ===================================================================
>> --- libgcc/config/i386/i386-cpuinfo.c ? (revision 182428)
>> +++ libgcc/config/i386/i386-cpuinfo.c ? (working copy)
>> @@ -55,9 +55,11 @@ struct __processor_model
>> ? /* CPU type. */
>> ? unsigned int __cpu_is_intel_atom : 1;
>> ? unsigned int __cpu_is_intel_core2 : 1;
>> + ?unsigned int __cpu_is_intel_corei7 : 1;
>> ? unsigned int __cpu_is_intel_corei7_nehalem : 1;
>> ? unsigned int __cpu_is_intel_corei7_westmere : 1;
>> ? unsigned int __cpu_is_intel_corei7_sandybridge : 1;
>> + ?unsigned int __cpu_is_amdfam10 : 1;
>> ? unsigned int __cpu_is_amdfam10_barcelona : 1;
>> ? unsigned int __cpu_is_amdfam10_shanghai : 1;
>> ? unsigned int __cpu_is_amdfam10_istanbul : 1;
>> @@ -74,12 +76,15 @@ get_amd_cpu (unsigned int family, unsigned int mod
>> ? ? ? switch (model)
>> ? ? ? ?{
>> ? ? ? ?case 0x2:
>> + ? ? ? ? __cpu_model.__cpu_is_amdfam10 = 1;
>> ? ? ? ? ?__cpu_model.__cpu_is_amdfam10_barcelona = 1;
>> ? ? ? ? ?break;
>> ? ? ? ?case 0x4:
>> + ? ? ? ? __cpu_model.__cpu_is_amdfam10 = 1;
>> ? ? ? ? ?__cpu_model.__cpu_is_amdfam10_shanghai = 1;
>> ? ? ? ? ?break;
>> ? ? ? ?case 0x8:
>> + ? ? ? ? __cpu_model.__cpu_is_amdfam10 = 1;
>> ? ? ? ? ?__cpu_model.__cpu_is_amdfam10_istanbul = 1;
>> ? ? ? ? ?break;
>> ? ? ? ?default:
>> @@ -117,16 +122,19 @@ get_intel_cpu (unsigned int family, unsigned int m
>> ? ? ? ? ? ?case 0x1f:
>> ? ? ? ? ? ?case 0x2e:
>> ? ? ? ? ? ? ?/* Nehalem. ?*/
>> + ? ? ? ? ? ? __cpu_model.__cpu_is_intel_corei7 = 1;
>> ? ? ? ? ? ? ?__cpu_model.__cpu_is_intel_corei7_nehalem = 1;
>> ? ? ? ? ? ? ?break;
>> ? ? ? ? ? ?case 0x25:
>> ? ? ? ? ? ?case 0x2c:
>> ? ? ? ? ? ?case 0x2f:
>> ? ? ? ? ? ? ?/* Westmere. ?*/
>> + ? ? ? ? ? ? __cpu_model.__cpu_is_intel_corei7 = 1;
>> ? ? ? ? ? ? ?__cpu_model.__cpu_is_intel_corei7_westmere = 1;
>> ? ? ? ? ? ? ?break;
>> ? ? ? ? ? ?case 0x2a:
>> ? ? ? ? ? ? ?/* Sandy Bridge. ?*/
>> + ? ? ? ? ? ? __cpu_model.__cpu_is_intel_corei7 = 1;
>> ? ? ? ? ? ? ?__cpu_model.__cpu_is_intel_corei7_sandybridge = 1;
>> ? ? ? ? ? ? ?break;
>> ? ? ? ? ? ?case 0x17:
>> Index: gcc/testsuite/gcc.target/i386/builtin_target.c
>> ===================================================================
>> --- gcc/testsuite/gcc.target/i386/builtin_target.c ? ? ?(revision 182428)
>> +++ gcc/testsuite/gcc.target/i386/builtin_target.c ? ? ?(working copy)
>> @@ -31,12 +31,16 @@ fn1 ()
>> ? ? return -1;
>> ? if (__builtin_cpu_is_intel_core2 () < 0)
>> ? ? return -1;
>> + ?if (__builtin_cpu_is_intel_corei7 () < 0)
>> + ? ?return -1;
>> ? if (__builtin_cpu_is_intel_corei7_nehalem () < 0)
>> ? ? return -1;
>> ? if (__builtin_cpu_is_intel_corei7_westmere () < 0)
>> ? ? return -1;
>> ? if (__builtin_cpu_is_intel_corei7_sandybridge () < 0)
>> ? ? return -1;
>> + ?if (__builtin_cpu_is_amdfam10 () < 0)
>> + ? ?return -1;
>> ? if (__builtin_cpu_is_amdfam10_barcelona () < 0)
>> ? ? return -1;
>> ? if (__builtin_cpu_is_amdfam10_shanghai () < 0)
>> Index: gcc/config/i386/i386.c
>> ===================================================================
>> --- gcc/config/i386/i386.c ? ? ?(revision 182428)
>> +++ gcc/config/i386/i386.c ? ? ?(working copy)
>> @@ -24500,9 +24500,11 @@ enum ix86_builtins
>> ? IX86_BUILTIN_CPU_IS_INTEL,
>> ? IX86_BUILTIN_CPU_IS_INTEL_ATOM,
>> ? IX86_BUILTIN_CPU_IS_INTEL_CORE2,
>> + ?IX86_BUILTIN_CPU_IS_INTEL_COREI7,
>> ? IX86_BUILTIN_CPU_IS_INTEL_COREI7_NEHALEM,
>> ? IX86_BUILTIN_CPU_IS_INTEL_COREI7_WESTMERE,
>> ? IX86_BUILTIN_CPU_IS_INTEL_COREI7_SANDYBRIDGE,
>> + ?IX86_BUILTIN_CPU_IS_AMDFAM10,
>> ? IX86_BUILTIN_CPU_IS_AMDFAM10_BARCELONA,
>> ? IX86_BUILTIN_CPU_IS_AMDFAM10_SHANGHAI,
>> ? IX86_BUILTIN_CPU_IS_AMDFAM10_ISTANBUL,
>> @@ -25981,9 +25983,11 @@ fold_builtin_cpu (enum ix86_builtins fn_code)
>> ? ? M_INTEL,
>> ? ? M_INTEL_ATOM,
>> ? ? M_INTEL_CORE2,
>> + ? ?M_INTEL_COREI7,
>> ? ? M_INTEL_COREI7_NEHALEM,
>> ? ? M_INTEL_COREI7_WESTMERE,
>> ? ? M_INTEL_COREI7_SANDYBRIDGE,
>> + ? ?M_AMDFAM10,
>> ? ? M_AMDFAM10_BARCELONA,
>> ? ? M_AMDFAM10_SHANGHAI,
>> ? ? M_AMDFAM10_ISTANBUL,
>> @@ -26068,6 +26072,11 @@ fold_builtin_cpu (enum ix86_builtins fn_code)
>> ? ? ? field = get_field_from_struct (__processor_model_type, M_INTEL_CORE2);
>> ? ? ? which_struct = __cpu_model_var;
>> ? ? ? break;
>> + ? ?case IX86_BUILTIN_CPU_IS_INTEL_COREI7:
>> + ? ? ?field = get_field_from_struct (__processor_model_type,
>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?M_INTEL_COREI7);
>> + ? ? ?which_struct = __cpu_model_var;
>> + ? ? ?break;
>> ? ? case IX86_BUILTIN_CPU_IS_INTEL_COREI7_NEHALEM:
>> ? ? ? field = get_field_from_struct (__processor_model_type,
>> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? M_INTEL_COREI7_NEHALEM);
>> @@ -26083,6 +26092,11 @@ fold_builtin_cpu (enum ix86_builtins fn_code)
>> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? M_INTEL_COREI7_SANDYBRIDGE);
>> ? ? ? which_struct = __cpu_model_var;
>> ? ? ? break;
>> + ? ?case IX86_BUILTIN_CPU_IS_AMDFAM10:
>> + ? ? ?field = get_field_from_struct (__processor_model_type,
>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?M_AMDFAM10);
>> + ? ? ?which_struct = __cpu_model_var;
>> + ? ? ?break;
>> ? ? case IX86_BUILTIN_CPU_IS_AMDFAM10_BARCELONA:
>> ? ? ? field = get_field_from_struct (__processor_model_type,
>> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? M_AMDFAM10_BARCELONA);
>> @@ -26171,12 +26185,16 @@ ix86_init_platform_type_builtins (void)
>> ? ? ? ? ? ? ? ? ? ? ? ? IX86_BUILTIN_CPU_IS_INTEL_CORE2, 1);
>> ? make_platform_builtin ("__builtin_cpu_is_intel",
>> ? ? ? ? ? ? ? ? ? ? ? ? IX86_BUILTIN_CPU_IS_INTEL, 1);
>> + ?make_platform_builtin ("__builtin_cpu_is_intel_corei7",
>> + ? ? ? ? ? ? ? ? ? ? ? ?IX86_BUILTIN_CPU_IS_INTEL_COREI7, 1);
>> ? make_platform_builtin ("__builtin_cpu_is_intel_corei7_nehalem",
>> ? ? ? ? ? ? ? ? ? ? ? ? IX86_BUILTIN_CPU_IS_INTEL_COREI7_NEHALEM, 1);
>> ? make_platform_builtin ("__builtin_cpu_is_intel_corei7_westmere",
>> ? ? ? ? ? ? ? ? ? ? ? ? IX86_BUILTIN_CPU_IS_INTEL_COREI7_WESTMERE, 1);
>> ? make_platform_builtin ("__builtin_cpu_is_intel_corei7_sandybridge",
>> ? ? ? ? ? ? ? ? ? ? ? ? IX86_BUILTIN_CPU_IS_INTEL_COREI7_SANDYBRIDGE, 1);
>> + ?make_platform_builtin ("__builtin_cpu_is_amdfam10",
>> + ? ? ? ? ? ? ? ? ? ? ? ?IX86_BUILTIN_CPU_IS_AMDFAM10, 1);
>> ? make_platform_builtin ("__builtin_cpu_is_amdfam10_barcelona",
>> ? ? ? ? ? ? ? ? ? ? ? ? IX86_BUILTIN_CPU_IS_AMDFAM10_BARCELONA, 1);
>> ? make_platform_builtin ("__builtin_cpu_is_amdfam10_shanghai",
>> @@ -27761,9 +27779,11 @@ ix86_expand_builtin (tree exp, rtx target, rtx sub
>> ? ? case IX86_BUILTIN_CPU_IS_INTEL:
>> ? ? case IX86_BUILTIN_CPU_IS_INTEL_ATOM:
>> ? ? case IX86_BUILTIN_CPU_IS_INTEL_CORE2:
>> + ? ?case IX86_BUILTIN_CPU_IS_INTEL_COREI7:
>> ? ? case IX86_BUILTIN_CPU_IS_INTEL_COREI7_NEHALEM:
>> ? ? case IX86_BUILTIN_CPU_IS_INTEL_COREI7_WESTMERE:
>> ? ? case IX86_BUILTIN_CPU_IS_INTEL_COREI7_SANDYBRIDGE:
>> + ? ?case IX86_BUILTIN_CPU_IS_AMDFAM10:
>> ? ? case IX86_BUILTIN_CPU_IS_AMDFAM10_BARCELONA:
>> ? ? case IX86_BUILTIN_CPU_IS_AMDFAM10_SHANGHAI:
>> ? ? case IX86_BUILTIN_CPU_IS_AMDFAM10_ISTANBUL:
>>
>> --
>> This patch is available for review at http://codereview.appspot.com/5495075


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]