Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(2091)

Issue 4893046: [4.7][google]Support for getting CPU type and feature information at run-time.

Can't Edit
Can't Publish+Mail
Start Review
Created:
12 years, 8 months ago by Sriraman
Modified:
12 years, 8 months ago
Reviewers:
jakub, hjl.tools, mikestump, richard.guenther, matz, rth, andi, davidxl, hp, joseph
CC:
gcc-patches_gcc.gnu.org
Base URL:
svn+ssh://gcc.gnu.org/svn/gcc/branches/google/gcc-4_6/
Visibility:
Public.

Patch Set 1 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+788 lines, -1 line) Patch
M gcc/builtins.def View 1 chunk +19 lines, -0 lines 0 comments Download
M gcc/config/i386/i386.c View 3 chunks +337 lines, -0 lines 0 comments Download
M gcc/mversn-dispatch.c View 2 chunks +101 lines, -0 lines 0 comments Download
M gcc/passes.c View 1 chunk +2 lines, -0 lines 0 comments Download
A gcc/testsuite/gcc.dg/builtin_target.c View 1 chunk +49 lines, -0 lines 0 comments Download
M gcc/timevar.def View 1 chunk +1 line, -0 lines 0 comments Download
M gcc/tree-pass.h View 1 chunk +1 line, -0 lines 0 comments Download
M libgcc/config.host View 1 chunk +1 line, -1 line 0 comments Download
A libgcc/config/i386/i386-cpuinfo.c View 1 chunk +275 lines, -0 lines 0 comments Download
A libgcc/config/i386/t-cpuinfo View 1 chunk +2 lines, -0 lines 0 comments Download

Messages

Total messages: 48
hjl.tools_gmail.com
On Tue, Aug 16, 2011 at 1:50 PM, Sriraman Tallam <tmsriram@google.com> wrote: > Support for ...
12 years, 8 months ago (2011-08-16 21:06:52 UTC) #1
Sriraman
On Tue, Aug 16, 2011 at 2:06 PM, H.J. Lu <hjl.tools@gmail.com> wrote: > On Tue, ...
12 years, 8 months ago (2011-08-16 21:14:14 UTC) #2
andi_firstfloor.org
tmsriram@google.com (Sriraman Tallam) writes: > Support for getting CPU type and feature information at run-time. ...
12 years, 8 months ago (2011-08-16 21:52:07 UTC) #3
joseph_codesourcery.com
On Tue, 16 Aug 2011, Sriraman Tallam wrote: > Index: libgcc/config/i386/t-cpuinfo > =================================================================== > --- ...
12 years, 8 months ago (2011-08-16 22:35:07 UTC) #4
Sriraman
On Tue, Aug 16, 2011 at 3:35 PM, Joseph S. Myers <joseph@codesourcery.com> wrote: > On ...
12 years, 8 months ago (2011-08-17 00:07:35 UTC) #5
richard.guenther_gmail.com
On Tue, Aug 16, 2011 at 10:50 PM, Sriraman Tallam <tmsriram@google.com> wrote: > Support for ...
12 years, 8 months ago (2011-08-17 07:37:38 UTC) #6
Sriraman
On Wed, Aug 17, 2011 at 12:37 AM, Richard Guenther <richard.guenther@gmail.com> wrote: > On Tue, ...
12 years, 8 months ago (2011-08-17 17:54:18 UTC) #7
hp_bitrange.com
On Tue, 16 Aug 2011, Sriraman Tallam wrote: (I don't see anyone else making this ...
12 years, 8 months ago (2011-08-17 23:59:05 UTC) #8
Sriraman
On Wed, Aug 17, 2011 at 4:59 PM, Hans-Peter Nilsson <hp@bitrange.com> wrote: > On Tue, ...
12 years, 8 months ago (2011-08-18 00:27:56 UTC) #9
richard.guenther_gmail.com
On Wed, Aug 17, 2011 at 7:54 PM, Sriraman Tallam <tmsriram@google.com> wrote: > On Wed, ...
12 years, 8 months ago (2011-08-18 08:03:20 UTC) #10
matz_suse.de
Hi, On Thu, 18 Aug 2011, Richard Guenther wrote: > > CPUID to get target ...
12 years, 8 months ago (2011-08-18 13:10:27 UTC) #11
davidxl
On Thu, Aug 18, 2011 at 6:10 AM, Michael Matz <matz@suse.de> wrote: > Hi, > ...
12 years, 8 months ago (2011-08-18 16:27:34 UTC) #12
Sriraman
On Thu, Aug 18, 2011 at 1:03 AM, Richard Guenther <richard.guenther@gmail.com> wrote: > On Wed, ...
12 years, 8 months ago (2011-08-18 17:25:32 UTC) #13
rth_redhat.com
On 08/18/2011 10:25 AM, Sriraman Tallam wrote: > Ok, so two things. I create the ...
12 years, 8 months ago (2011-08-18 21:15:17 UTC) #14
Sriraman
On Thu, Aug 18, 2011 at 2:15 PM, Richard Henderson <rth@redhat.com> wrote: > On 08/18/2011 ...
12 years, 8 months ago (2011-08-18 21:51:20 UTC) #15
rth_redhat.com
On 08/18/2011 02:51 PM, Sriraman Tallam wrote: > Oh!, right, sorry. So, the only available ...
12 years, 8 months ago (2011-08-18 22:08:13 UTC) #16
richard.guenther_gmail.com
On Fri, Aug 19, 2011 at 12:08 AM, Richard Henderson <rth@redhat.com> wrote: > On 08/18/2011 ...
12 years, 8 months ago (2011-08-19 09:04:12 UTC) #17
jakub_redhat.com
On Fri, Aug 19, 2011 at 11:04:11AM +0200, Richard Guenther wrote: > On Fri, Aug ...
12 years, 8 months ago (2011-08-19 09:09:21 UTC) #18
rth_redhat.com
On 08/19/2011 02:04 AM, Richard Guenther wrote: > So make sure that __cpu_indicator initially has ...
12 years, 8 months ago (2011-08-20 21:02:55 UTC) #19
hjl.tools_gmail.com
On Sat, Aug 20, 2011 at 2:02 PM, Richard Henderson <rth@redhat.com> wrote: > On 08/19/2011 ...
12 years, 8 months ago (2011-08-20 21:16:37 UTC) #20
richard.guenther_gmail.com
On Sat, Aug 20, 2011 at 11:02 PM, Richard Henderson <rth@redhat.com> wrote: > On 08/19/2011 ...
12 years, 8 months ago (2011-08-21 09:04:58 UTC) #21
matz_suse.de
Hi, On Sun, 21 Aug 2011, Richard Guenther wrote: > On Sat, Aug 20, 2011 ...
12 years, 8 months ago (2011-08-22 14:07:24 UTC) #22
hjl.tools_gmail.com
On Mon, Aug 22, 2011 at 7:07 AM, Michael Matz <matz@suse.de> wrote: > Hi, > ...
12 years, 8 months ago (2011-08-22 14:11:58 UTC) #23
matz_suse.de
Hi, On Mon, 22 Aug 2011, H.J. Lu wrote: > >> Oh, I thought it ...
12 years, 8 months ago (2011-08-22 15:56:41 UTC) #24
hjl.tools_gmail.com
On Mon, Aug 22, 2011 at 8:56 AM, Michael Matz <matz@suse.de> wrote: > Hi, > ...
12 years, 8 months ago (2011-08-22 16:02:10 UTC) #25
Sriraman
On Mon, Aug 22, 2011 at 9:02 AM, H.J. Lu <hjl.tools@gmail.com> wrote: > On Mon, ...
12 years, 8 months ago (2011-08-22 18:50:15 UTC) #26
hjl.tools_gmail.com
On Mon, Aug 22, 2011 at 11:50 AM, Sriraman Tallam <tmsriram@google.com> wrote: > On Mon, ...
12 years, 8 months ago (2011-08-22 18:58:52 UTC) #27
Sriraman
On Mon, Aug 22, 2011 at 11:58 AM, H.J. Lu <hjl.tools@gmail.com> wrote: > On Mon, ...
12 years, 8 months ago (2011-08-22 19:02:28 UTC) #28
richard.guenther_gmail.com
On Mon, Aug 22, 2011 at 6:02 PM, H.J. Lu <hjl.tools@gmail.com> wrote: > On Mon, ...
12 years, 8 months ago (2011-08-22 20:34:29 UTC) #29
hjl.tools_gmail.com
On Mon, Aug 22, 2011 at 1:34 PM, Richard Guenther <richard.guenther@gmail.com> wrote: > On Mon, ...
12 years, 8 months ago (2011-08-22 20:39:31 UTC) #30
richard.guenther_gmail.com
On Mon, Aug 22, 2011 at 10:39 PM, H.J. Lu <hjl.tools@gmail.com> wrote: > On Mon, ...
12 years, 8 months ago (2011-08-22 20:46:31 UTC) #31
hjl.tools_gmail.com
On Mon, Aug 22, 2011 at 1:46 PM, Richard Guenther <richard.guenther@gmail.com> wrote: > On Mon, ...
12 years, 8 months ago (2011-08-22 20:49:00 UTC) #32
richard.guenther_gmail.com
On Mon, Aug 22, 2011 at 10:48 PM, H.J. Lu <hjl.tools@gmail.com> wrote: > On Mon, ...
12 years, 8 months ago (2011-08-22 20:54:59 UTC) #33
Sriraman
Hi, Thanks for all the comments. I am attaching a new patch incorporating all of ...
12 years, 8 months ago (2011-08-26 00:37:40 UTC) #34
hjl.tools_gmail.com
On Thu, Aug 25, 2011 at 5:37 PM, Sriraman Tallam <tmsriram@google.com> wrote: > Hi, > ...
12 years, 8 months ago (2011-08-26 01:02:22 UTC) #35
Sriraman
On Thu, Aug 25, 2011 at 6:02 PM, H.J. Lu <hjl.tools@gmail.com> wrote: > On Thu, ...
12 years, 8 months ago (2011-08-26 17:06:12 UTC) #36
hjl.tools_gmail.com
On Fri, Aug 26, 2011 at 10:06 AM, Sriraman Tallam <tmsriram@google.com> wrote: > On Thu, ...
12 years, 8 months ago (2011-08-26 17:10:54 UTC) #37
Sriraman
On Fri, Aug 26, 2011 at 10:10 AM, H.J. Lu <hjl.tools@gmail.com> wrote: > On Fri, ...
12 years, 8 months ago (2011-08-26 17:17:24 UTC) #38
hjl.tools_gmail.com
On Fri, Aug 26, 2011 at 10:17 AM, Sriraman Tallam <tmsriram@google.com> wrote: > On Fri, ...
12 years, 8 months ago (2011-08-26 17:24:49 UTC) #39
Sriraman
On Fri, Aug 26, 2011 at 10:24 AM, H.J. Lu <hjl.tools@gmail.com> wrote: > On Fri, ...
12 years, 8 months ago (2011-08-26 17:37:05 UTC) #40
hjl.tools_gmail.com
On Fri, Aug 26, 2011 at 10:37 AM, Sriraman Tallam <tmsriram@google.com> wrote: > On Fri, ...
12 years, 8 months ago (2011-08-26 17:45:34 UTC) #41
davidxl
Is there a standard way to force this init function to be called before all ...
12 years, 8 months ago (2011-08-26 17:58:46 UTC) #42
Sriraman
On Fri, Aug 26, 2011 at 10:45 AM, H.J. Lu <hjl.tools@gmail.com> wrote: > On Fri, ...
12 years, 8 months ago (2011-08-26 18:20:56 UTC) #43
davidxl
IFUNC selector will need to call get_cpu_indicator (as proposed by HJ or something similar), while ...
12 years, 8 months ago (2011-08-26 20:44:54 UTC) #44
mikestump_comcast.net
On Aug 25, 2011, at 6:02 PM, H.J. Lu wrote: > On Thu, Aug 25, ...
12 years, 8 months ago (2011-08-28 17:41:56 UTC) #45
mikestump_comcast.net
On Aug 26, 2011, at 10:58 AM, Xinliang David Li wrote: > Is there a ...
12 years, 8 months ago (2011-08-28 17:43:44 UTC) #46
davidxl
Sri, please add a new api to do cpu_indicator initialization on demand to be used ...
12 years, 8 months ago (2011-08-29 00:31:13 UTC) #47
Sriraman
12 years, 8 months ago (2011-09-01 18:56:31 UTC) #48
On Sun, Aug 28, 2011 at 5:31 PM, Xinliang David Li <davidxl@google.com> wrote:
> Sri, please add a new api to do cpu_indicator initialization on demand
> to be used in IFUNC context. Perhaps also add some debug check to make
> sure no conflicting cpu model is set.
>
> Ok for google branches for now while the discussion continues.

I made the changes and committed to the google branch for now.

	* config/i386/i386-cpuinfo.c: New file.
	* config/i386/t-cpuinfo: New file.
	* config.host: Add t-cpuinfo to link i386-cpuinfo.o with libgcc

	* config/i386/i386.c (build_struct_with_one_bit_fields): 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.
	(TARGET_FOLD_BUILTIN): New macro.
	(IX86_BUILTIN_CPU_SUPPORTS_CMOV): New enum value.
	(IX86_BUILTIN_CPU_SUPPORTS_MMX): New enum value.
	(IX86_BUILTIN_CPU_SUPPORTS_POPCOUNT): New enum value.
	(IX86_BUILTIN_CPU_SUPPORTS_SSE): New enum value.
	(IX86_BUILTIN_CPU_SUPPORTS_SSE2): New enum value.
	(IX86_BUILTIN_CPU_SUPPORTS_SSE3): New enum value.
	(IX86_BUILTIN_CPU_SUPPORTS_SSSE3): New enum value.
	(IX86_BUILTIN_CPU_SUPPORTS_SSE4_1): New enum value.
	(IX86_BUILTIN_CPU_SUPPORTS_SSE4_2): New enum value.
	(IX86_BUILTIN_CPU_INIT): New enum value.
	(IX86_BUILTIN_CPU_IS_AMD): New enum value.
	(IX86_BUILTIN_CPU_IS_INTEL): New enum value.
	(IX86_BUILTIN_CPU_IS_INTEL_ATOM): New enum value.
	(IX86_BUILTIN_CPU_IS_INTEL_CORE2): New enum value.
	(IX86_BUILTIN_CPU_IS_INTEL_COREI7_NEHALEM): New enum value.
	(IX86_BUILTIN_CPU_IS_INTEL_COREI7_WESTMERE): New enum value.
	(IX86_BUILTIN_CPU_IS_INTEL_COREI7_SANDYBRIDGE): New enum value.
	(IX86_BUILTIN_CPU_IS_AMDFAM10_BARCELONA): New enum value.
	(IX86_BUILTIN_CPU_IS_AMDFAM10_SHANGHAI): New enum value.
	(IX86_BUILTIN_CPU_IS_AMDFAM10_ISTANBUL): New enum value.
	* config/i386/libgcc-glibc.ver (__cpu_indicator_init): Export symbol.
	(__cpu_model): Export symbol.
	(__cpu_features): Export symbol.
	* config/i386/i386-builtin-types.def: New function type.

	* gcc.dg/builtin_target.c: New test.


Thanks,
-Sri.

>
> thanks,
>
> David
>
> On Thu, Aug 25, 2011 at 5:37 PM, Sriraman Tallam <tmsriram@google.com> wrote:
>> Hi,
>>
>>  Thanks for all the comments. I am attaching a new patch
>> incorporating all of the changes mentioned, mainly :
>>
>> 1) Make __cpu_indicator_init a constructor in libgcc and guard to call
>> it only once.
>> 2) Add symbol versions.
>> 3) Move all builtins to the i386 port.
>> 4) Add check for atom processor.
>> 5) No separate passes to fold the builtins.
>>
>> Please let me know what you think.
>> Thanks,
>> -Sri.
>>
>>        * config/i386/i386.c (build_struct_with_one_bit_fields): 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.
>>        (TARGET_FOLD_BUILTIN): New macro.
>>        (IX86_BUILTIN_CPU_SUPPORTS_CMOV): New enum value.
>>        (IX86_BUILTIN_CPU_SUPPORTS_MMX): New enum value.
>>        (IX86_BUILTIN_CPU_SUPPORTS_POPCOUNT): New enum value.
>>        (IX86_BUILTIN_CPU_SUPPORTS_SSE): New enum value.
>>        (IX86_BUILTIN_CPU_SUPPORTS_SSE2): New enum value.
>>        (IX86_BUILTIN_CPU_SUPPORTS_SSE3): New enum value.
>>        (IX86_BUILTIN_CPU_SUPPORTS_SSSE3): New enum value.
>>        (IX86_BUILTIN_CPU_SUPPORTS_SSE4_1): New enum value.
>>        (IX86_BUILTIN_CPU_SUPPORTS_SSE4_2): New enum value.
>>        (IX86_BUILTIN_CPU_IS_AMD): New enum value.
>>        (IX86_BUILTIN_CPU_IS_INTEL): New enum value.
>>        (IX86_BUILTIN_CPU_IS_INTEL_ATOM): New enum value.
>>        (IX86_BUILTIN_CPU_IS_INTEL_CORE2): New enum value.
>>        (IX86_BUILTIN_CPU_IS_INTEL_COREI7_NEHALEM): New enum value.
>>        (IX86_BUILTIN_CPU_IS_INTEL_COREI7_WESTMERE): New enum value.
>>        (IX86_BUILTIN_CPU_IS_INTEL_COREI7_SANDYBRIDGE): New enum value.
>>        (IX86_BUILTIN_CPU_IS_AMDFAM10_BARCELONA): New enum value.
>>        (IX86_BUILTIN_CPU_IS_AMDFAM10_SHANGHAI): New enum value.
>>        (IX86_BUILTIN_CPU_IS_AMDFAM10_ISTANBUL): New enum value.
>>        * config/i386/libgcc-glibc.ver (__cpu_indicator_init): Export symbol.
>>        (__cpu_model): Export symbol.
>>        (__cpu_features): Export symbol.
>>        * config/i386/i386-builtin-types.def: New function type.
>>
>>        * config/i386/i386-cpuinfo.c: New file.
>>        * config/i386/t-cpuinfo: New file.
>>        * config.host: Add t-cpuinfo to link i386-cpuinfo.o with libgcc
>>
>>        * gcc.dg/builtin_target.c: New test.
>>
>>
>>
>>
>> On Tue, Aug 23, 2011 at 4:35 AM, Michael Matz <matz@suse.de> wrote:
>>> Hi,
>>>
>>> On Mon, 22 Aug 2011, H.J. Lu wrote:
>>>
>>>> > void __attribute__((constructor)) bla(void)
>>>> > {
>>>> >  __cpu_indicator_init ();
>>>> > }
>>>> >
>>>> > I don't see any complication.?
>>>> >
>>>>
>>>> Order of constructors.  A constructor may call functions
>>>> which use __cpu_indicator.
>>>
>>> That's why I wrote also:
>>>
>>>> The initializer function has to be callable from pre-.init contexts, e.g.
>>>> ifunc dispatchers.
>>>
>>> It obviously has to be guarded against multiple calls.  The ctor in libgcc
>>> would be mere convenience because then non-ctor code can rely on the data
>>> being initialized, and only (potential) ctor code has to check and call
>>> the init function on demand.
>>>
>>>
>>> Ciao,
>>> Michael.
>>
>
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b