On Mon, Apr 23, 2012 at 9:59 AM, Sriraman Tallam <tmsri...@google.com> wrote:
> Hi,
>
> On Mon, Apr 23, 2012 at 1:19 AM, Uros Bizjak <ubiz...@gmail.com> wrote:
>> On Tue, Apr 3, 2012 at 9:47 PM, Sriraman Tallam <tmsri...@google.com> wrote:
>>
>>> i386 maintainers -  Is this patch ok?
>>
>> Has the community reached the consensus on how this kind of
>> functionality has to be implemented? I have followed the discussion a
>> bit, but IIRC, there was no clear decision. Without this decision, I
>> am not able to review the _implementation_ of agreed functionality for
>> x86 target.
>>
>> (I apologize if I have missed the decision, please point me to the
>> discussion in this case.)
>
> The discussions are here:
>
> http://gcc.gnu.org/ml/gcc-patches/2011-08/msg01446.html
> and follow-ups to this.
>
> I am not sure about consensus, but the important points raised were:
>
> 1) Constructor ordering: What if some constructors fire before
> cpu_indicator_init?, which determines the CPU. I addressed this
> problem by making the priority of cpu_indicator_init to be the highest
> possible. Still, IFUNC initializers will fire before and they have to
> explicitly call __builtin_cpu_init() before checking the CPU type.
> 2) Reducing the number of builtins : It is only two now.
>
>
>>
>>>>>> Patch available for review here:
>>>>>> http://codereview.appspot.com/5754058
>>
>> Please attach patches or inline it in the message itself for a review.
>> Please see [1] for further instructions.
>
> Patch attached, tested on x86_64 and all tests pass.
>
>
>       * config/i386/i386.c (build_processor_features_struct): New function.
>       (build_processor_model_struct): New function.
>       (make_var_decl): New function.
>       (get_field_from_struct): New function.
>       (fold_builtin_target): New function.
>       (ix86_fold_builtin): New function.
>       (ix86_expand_builtin): Expand new builtins by folding them.
>       (make_cpu_type_builtin): New functions.
>       (ix86_init_platform_type_builtins): Make the new builtins.
>       (ix86_init_builtins): Make new builtins to detect CPU type.
>       (TARGET_FOLD_BUILTIN): New macro.
>       (IX86_BUILTIN_CPU_INIT): New enum value.
>       (IX86_BUILTIN_CPU_IS): New enum value.
>       (IX86_BUILTIN_CPU_SUPPORTS): New enum value.
>       * config/i386/i386-builtin-types.def: New function type.
>       * testsuite/gcc.target/builtin_target.c: New testcase.
>       * doc/extend.texi: Document builtins.
>
>       * libgcc/config/i386/i386-cpuinfo.c: New file.
>       * libgcc/config/i386/t-cpuinfo: New file.
>       * libgcc/config.host: Include t-cpuinfo.
>       * libgcc/config/i386/libgcc-glibc.ver: Version symbols __cpu_model
>       and __cpu_features.
>
> Thanks,
> -Sri.
>
>

I have 2 comments:

1.  You should remove

static int called = 0;
if (called)
    return 0;
 else
    called = 1;

Instead, you can just do

if (_cpu_model.__cpu_vendor)
  return 0;

2.  You can replace

if (vendor == SIG_AMD)

with

else if (vendor == SIG_AMD)

Thanks.

-- 
H.J.

Reply via email to