diff mbox series

[rs6000] Add support to __builtin_cpu_supports() for new HWCAP2 bit

Message ID 903b4414-f737-4da0-ba20-d7c5745c5166@vnet.ibm.com
State New
Headers show
Series [rs6000] Add support to __builtin_cpu_supports() for new HWCAP2 bit | expand

Commit Message

Peter Bergner Nov. 6, 2017, 5:41 p.m. UTC
There is a new HWCAP2 bit added to the AUXV here:

  http://patchwork.ozlabs.org/patch/824764/

This patch adds __builtin_cpu_supports() support for it.
This passed bootstrap and regtesting with no regressions?
Ok for trunk?

Ok to back port to the open releases too once testing to complete there?

Peter


gcc/
	* config/rs6000/ppc-auxv.h (PPC_FEATURE2_HTM_NO_SUSPEND): New define.
	* config/rs6000/rs6000.c (cpu_supports_info): Use it.

gcc/testsuite/
	* gcc.target/powerpc/cpu-builtin-1.c (htm-no-suspend): Add test.

Comments

Segher Boessenkool Nov. 6, 2017, 10:52 p.m. UTC | #1
Hi!

On Mon, Nov 06, 2017 at 11:41:39AM -0600, Peter Bergner wrote:
> There is a new HWCAP2 bit added to the AUXV here:
> 
>   http://patchwork.ozlabs.org/patch/824764/
> 
> This patch adds __builtin_cpu_supports() support for it.

> --- gcc/config/rs6000/rs6000.c	(revision 254453)
> +++ gcc/config/rs6000/rs6000.c	(working copy)
> @@ -387,6 +387,7 @@ static const struct
>    { "ebb",		PPC_FEATURE2_HAS_EBB,		1 },
>    { "htm",		PPC_FEATURE2_HAS_HTM,		1 },
>    { "htm-nosc",		PPC_FEATURE2_HTM_NOSC,		1 },
> +  { "htm-no-suspend",	PPC_FEATURE2_HTM_NO_SUSPEND,	1 },
>    { "isel",		PPC_FEATURE2_HAS_ISEL,		1 },
>    { "tar",		PPC_FEATURE2_HAS_TAR,		1 },
>    { "vcrypto",		PPC_FEATURE2_HAS_VEC_CRYPTO,	1 },

Is this (user-visible) name the same as used elsewhere?  Kernel, libc?

It's not in the same style as "htm-nosc".

If it is the same: okay for trunk, and all open branches.  Thanks!


Segher
Peter Bergner Nov. 6, 2017, 11:07 p.m. UTC | #2
On 11/6/17 4:52 PM, Segher Boessenkool wrote:
> Hi!
> 
> On Mon, Nov 06, 2017 at 11:41:39AM -0600, Peter Bergner wrote:
>> There is a new HWCAP2 bit added to the AUXV here:
>>
>>   http://patchwork.ozlabs.org/patch/824764/
>>
>> This patch adds __builtin_cpu_supports() support for it.
> 
>> --- gcc/config/rs6000/rs6000.c	(revision 254453)
>> +++ gcc/config/rs6000/rs6000.c	(working copy)
>> @@ -387,6 +387,7 @@ static const struct
>>    { "ebb",		PPC_FEATURE2_HAS_EBB,		1 },
>>    { "htm",		PPC_FEATURE2_HAS_HTM,		1 },
>>    { "htm-nosc",		PPC_FEATURE2_HTM_NOSC,		1 },
>> +  { "htm-no-suspend",	PPC_FEATURE2_HTM_NO_SUSPEND,	1 },
>>    { "isel",		PPC_FEATURE2_HAS_ISEL,		1 },
>>    { "tar",		PPC_FEATURE2_HAS_TAR,		1 },
>>    { "vcrypto",		PPC_FEATURE2_HAS_VEC_CRYPTO,	1 },
> 
> Is this (user-visible) name the same as used elsewhere?  Kernel, libc?
> 
> It's not in the same style as "htm-nosc".

Tulio can correct me if I'm wrong, but I believe these stings are
owned by GLIBC.  The kernel just defines the macro name and bit mask
that is used in the AUXV.  That said, I'm not sure the GLIBC patch
adding the above string has been submitted yet, so I guess we could
change it still?  Tulio?

That said, I'm not sure I like "htm-nosuspend" better than what the
patch has, but then again, I don't care enough to argue. :-)

Peter
Segher Boessenkool Nov. 6, 2017, 11:11 p.m. UTC | #3
On Mon, Nov 06, 2017 at 05:07:23PM -0600, Peter Bergner wrote:
> >> --- gcc/config/rs6000/rs6000.c	(revision 254453)
> >> +++ gcc/config/rs6000/rs6000.c	(working copy)
> >> @@ -387,6 +387,7 @@ static const struct
> >>    { "ebb",		PPC_FEATURE2_HAS_EBB,		1 },
> >>    { "htm",		PPC_FEATURE2_HAS_HTM,		1 },
> >>    { "htm-nosc",		PPC_FEATURE2_HTM_NOSC,		1 },
> >> +  { "htm-no-suspend",	PPC_FEATURE2_HTM_NO_SUSPEND,	1 },
> >>    { "isel",		PPC_FEATURE2_HAS_ISEL,		1 },
> >>    { "tar",		PPC_FEATURE2_HAS_TAR,		1 },
> >>    { "vcrypto",		PPC_FEATURE2_HAS_VEC_CRYPTO,	1 },
> > 
> > Is this (user-visible) name the same as used elsewhere?  Kernel, libc?
> > 
> > It's not in the same style as "htm-nosc".
> 
> Tulio can correct me if I'm wrong, but I believe these stings are
> owned by GLIBC.  The kernel just defines the macro name and bit mask
> that is used in the AUXV.  That said, I'm not sure the GLIBC patch
> adding the above string has been submitted yet, so I guess we could
> change it still?  Tulio?
> 
> That said, I'm not sure I like "htm-nosuspend" better than what the
> patch has, but then again, I don't care enough to argue. :-)

Oh no, don't get me wrong, I like the "htm-no-suspend" name just fine;
the important thing is everything uses the same name.


Segher
Tulio Magno Quites Machado Filho Nov. 7, 2017, 1:12 p.m. UTC | #4
Peter Bergner <bergner@vnet.ibm.com> writes:

> On 11/6/17 4:52 PM, Segher Boessenkool wrote:
>> Hi!
>> 
>> On Mon, Nov 06, 2017 at 11:41:39AM -0600, Peter Bergner wrote:
>>> There is a new HWCAP2 bit added to the AUXV here:
>>>
>>>   http://patchwork.ozlabs.org/patch/824764/
>>>
>>> This patch adds __builtin_cpu_supports() support for it.
>> 
>>> --- gcc/config/rs6000/rs6000.c	(revision 254453)
>>> +++ gcc/config/rs6000/rs6000.c	(working copy)
>>> @@ -387,6 +387,7 @@ static const struct
>>>    { "ebb",		PPC_FEATURE2_HAS_EBB,		1 },
>>>    { "htm",		PPC_FEATURE2_HAS_HTM,		1 },
>>>    { "htm-nosc",		PPC_FEATURE2_HTM_NOSC,		1 },
>>> +  { "htm-no-suspend",	PPC_FEATURE2_HTM_NO_SUSPEND,	1 },
>>>    { "isel",		PPC_FEATURE2_HAS_ISEL,		1 },
>>>    { "tar",		PPC_FEATURE2_HAS_TAR,		1 },
>>>    { "vcrypto",		PPC_FEATURE2_HAS_VEC_CRYPTO,	1 },
>> 
>> Is this (user-visible) name the same as used elsewhere?  Kernel, libc?
>> 
>> It's not in the same style as "htm-nosc".
>
> Tulio can correct me if I'm wrong, but I believe these stings are
> owned by GLIBC.  The kernel just defines the macro name and bit mask
> that is used in the AUXV.  That said, I'm not sure the GLIBC patch
> adding the above string has been submitted yet, so I guess we could
> change it still?  Tulio?

That's the same string adopted in glibc. [1]
PPC_FEATURE2_HTM_NO_SUSPEND is also user-visible in glibc as a macro and is
identical too.

Notice this has not been merged into Linus Torvalds' tree yet and the glibc
patch is also waiting.  You may want to wait a little bit more too.

[1] https://sourceware.org/ml/libc-alpha/2017-10/msg00867.html
Peter Bergner Nov. 7, 2017, 5:05 p.m. UTC | #5
On 11/7/17 7:12 AM, Tulio Magno Quites Machado Filho wrote:
> That's the same string adopted in glibc. [1]
> PPC_FEATURE2_HTM_NO_SUSPEND is also user-visible in glibc as a macro and is
> identical too.
> 
> Notice this has not been merged into Linus Torvalds' tree yet and the glibc
> patch is also waiting.  You may want to wait a little bit more too.
> 
> [1] https://sourceware.org/ml/libc-alpha/2017-10/msg00867.html

Ok, I'll hold off until you push your changes.  Can you please ping
me when you finally commit your patch?  Thanks.

Peter
Peter Bergner Dec. 15, 2017, 3:51 a.m. UTC | #6
On 11/7/17 11:05 AM, Peter Bergner wrote:
> On 11/7/17 7:12 AM, Tulio Magno Quites Machado Filho wrote:
>> That's the same string adopted in glibc. [1]
>> PPC_FEATURE2_HTM_NO_SUSPEND is also user-visible in glibc as a macro and is
>> identical too.
>>
>> Notice this has not been merged into Linus Torvalds' tree yet and the glibc
>> patch is also waiting.  You may want to wait a little bit more too.
>>
>> [1] https://sourceware.org/ml/libc-alpha/2017-10/msg00867.html
> 
> Ok, I'll hold off until you push your changes.  Can you please ping
> me when you finally commit your patch?  Thanks.

So the patches landed in Linus' tree and glibc, therefore I committed
these now to trunk and the open release branches.

Peter
diff mbox series

Patch

Index: gcc/config/rs6000/ppc-auxv.h
===================================================================
--- gcc/config/rs6000/ppc-auxv.h	(revision 254453)
+++ gcc/config/rs6000/ppc-auxv.h	(working copy)
@@ -91,6 +91,7 @@ 
 #define PPC_FEATURE2_HAS_IEEE128    0x00400000
 #define PPC_FEATURE2_DARN           0x00200000
 #define PPC_FEATURE2_SCV            0x00100000
+#define PPC_FEATURE2_HTM_NO_SUSPEND 0x00080000
 
 
 /* Thread Control Block (TCB) offsets of the AT_PLATFORM, AT_HWCAP and
Index: gcc/config/rs6000/rs6000.c
===================================================================
--- gcc/config/rs6000/rs6000.c	(revision 254453)
+++ gcc/config/rs6000/rs6000.c	(working copy)
@@ -387,6 +387,7 @@  static const struct
   { "ebb",		PPC_FEATURE2_HAS_EBB,		1 },
   { "htm",		PPC_FEATURE2_HAS_HTM,		1 },
   { "htm-nosc",		PPC_FEATURE2_HTM_NOSC,		1 },
+  { "htm-no-suspend",	PPC_FEATURE2_HTM_NO_SUSPEND,	1 },
   { "isel",		PPC_FEATURE2_HAS_ISEL,		1 },
   { "tar",		PPC_FEATURE2_HAS_TAR,		1 },
   { "vcrypto",		PPC_FEATURE2_HAS_VEC_CRYPTO,	1 },
Index: gcc/testsuite/gcc.target/powerpc/cpu-builtin-1.c
===================================================================
--- gcc/testsuite/gcc.target/powerpc/cpu-builtin-1.c	(revision 254453)
+++ gcc/testsuite/gcc.target/powerpc/cpu-builtin-1.c	(working copy)
@@ -73,6 +73,7 @@  use_cpu_supports_builtins (unsigned int
   p[37] = __builtin_cpu_supports ("vsx");
   p[38] = __builtin_cpu_supports ("darn");
   p[39] = __builtin_cpu_supports ("scv");
+  p[40] = __builtin_cpu_supports ("htm-no-suspend");
 #else
   p[0] = 0;
 #endif