* [PATCH] powerpc: Expose VSX feature test
@ 2018-03-28 8:20 Nathan Phillips
2018-03-28 12:16 ` Tulio Magno Quites Machado Filho
0 siblings, 1 reply; 6+ messages in thread
From: Nathan Phillips @ 2018-03-28 8:20 UTC (permalink / raw)
To: libc-alpha
Hope it's OK to submit a small change like this. Trying to familiarize myself
with the patch process.
My copyright assignment is underway.
--
Read the HWCAP auxval key to test for VSX support. Expose result through
the cpu_features interface.
Preliminary change to prepare for PowerPC optimized libmvec implementations
[BZ #20123]. Enables selecting optimized version at load time in ifunc
resolver.
* sysdeps/powerpc/cpu-features.h (cpu_features): Add vsx field.
* sysdeps/powerpc/cpu-features.c (init_cpu_features):
Feature test VSX availability.
---
diff --git a/sysdeps/powerpc/cpu-features.c b/sysdeps/powerpc/cpu-features.c
index 955d4778a6..477c7504b9 100644
--- a/sysdeps/powerpc/cpu-features.c
+++ b/sysdeps/powerpc/cpu-features.c
@@ -16,6 +16,8 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
+#include <errno.h>
+#include <sys/auxv.h>
#include <stdint.h>
#include <cpu-features.h>
@@ -26,6 +28,9 @@
static inline void
init_cpu_features (struct cpu_features *cpu_features)
{
+ errno = 0;
+ unsigned long int hwcap = getauxval (AT_HWCAP);
+
/* Default is to use aligned memory access on optimized function unless
tunables is enable, since for this case user can explicit disable
unaligned optimizations. */
@@ -36,4 +41,13 @@ init_cpu_features (struct cpu_features *cpu_features)
#else
cpu_features->use_cached_memopt = false;
#endif
+
+ if (errno == ENOENT)
+ {
+ cpu_features->vsx = false;
+ }
+ else
+ {
+ cpu_features->vsx = ((hwcap & PPC_FEATURE_HAS_VSX) != 0);
+ }
}
diff --git a/sysdeps/powerpc/cpu-features.h b/sysdeps/powerpc/cpu-features.h
index e596385b4b..0248862b8a 100644
--- a/sysdeps/powerpc/cpu-features.h
+++ b/sysdeps/powerpc/cpu-features.h
@@ -23,6 +23,7 @@
struct cpu_features
{
bool use_cached_memopt;
+ bool vsx;
};
#endif /* __CPU_FEATURES_H */
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] powerpc: Expose VSX feature test
2018-03-28 8:20 [PATCH] powerpc: Expose VSX feature test Nathan Phillips
@ 2018-03-28 12:16 ` Tulio Magno Quites Machado Filho
2018-03-28 12:42 ` Adhemerval Zanella
2018-03-28 13:46 ` Nathan Phillips
0 siblings, 2 replies; 6+ messages in thread
From: Tulio Magno Quites Machado Filho @ 2018-03-28 12:16 UTC (permalink / raw)
To: Nathan Phillips, libc-alpha
Nathan Phillips <waic9e@protonmail.com> writes:
> Hope it's OK to submit a small change like this. Trying to familiarize myself
> with the patch process.
>
> My copyright assignment is underway.
Ack.
> Read the HWCAP auxval key to test for VSX support. Expose result through
Please use 2 spaces here ---------------------------^
> the cpu_features interface.
>
> Preliminary change to prepare for PowerPC optimized libmvec implementations
> [BZ #20123]. Enables selecting optimized version at load time in ifunc
Likewise. ----^
> resolver.
Can't you take it directly from the hwcap variable that is already available
when using libc_ifunc or libc_ifunc_redirected? e.g.
sysdeps/powerpc/powerpc64/multiarch/memcmp.c
--
Tulio Magno
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] powerpc: Expose VSX feature test
2018-03-28 12:16 ` Tulio Magno Quites Machado Filho
@ 2018-03-28 12:42 ` Adhemerval Zanella
2018-03-28 13:31 ` Tulio Magno Quites Machado Filho
2018-03-28 13:46 ` Nathan Phillips
1 sibling, 1 reply; 6+ messages in thread
From: Adhemerval Zanella @ 2018-03-28 12:42 UTC (permalink / raw)
To: libc-alpha
On 28/03/2018 09:16, Tulio Magno Quites Machado Filho wrote:
> Nathan Phillips <waic9e@protonmail.com> writes:
>
>> Hope it's OK to submit a small change like this. Trying to familiarize myself
>> with the patch process.
>>
>> My copyright assignment is underway.
>
> Ack.
>
>> Read the HWCAP auxval key to test for VSX support. Expose result through
>
> Please use 2 spaces here ---------------------------^
>
>> the cpu_features interface.
>>
>> Preliminary change to prepare for PowerPC optimized libmvec implementations
>> [BZ #20123]. Enables selecting optimized version at load time in ifunc
>
> Likewise. ----^
>
>> resolver.
>
> Can't you take it directly from the hwcap variable that is already available
> when using libc_ifunc or libc_ifunc_redirected? e.g.
> sysdeps/powerpc/powerpc64/multiarch/memcmp.c
>
>
I don't have the original message in my mailbox, was it sent only privately?
If it was the case, could you send the original one as well?
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] powerpc: Expose VSX feature test
2018-03-28 12:42 ` Adhemerval Zanella
@ 2018-03-28 13:31 ` Tulio Magno Quites Machado Filho
2018-03-28 13:36 ` Adhemerval Zanella
0 siblings, 1 reply; 6+ messages in thread
From: Tulio Magno Quites Machado Filho @ 2018-03-28 13:31 UTC (permalink / raw)
To: Adhemerval Zanella, libc-alpha
Adhemerval Zanella <adhemerval.zanella@linaro.org> writes:
> On 28/03/2018 09:16, Tulio Magno Quites Machado Filho wrote:
>> Nathan Phillips <waic9e@protonmail.com> writes:
>>
>>> Hope it's OK to submit a small change like this. Trying to familiarize myself
>>> with the patch process.
>>>
>>> My copyright assignment is underway.
>>
>> Ack.
>>
>>> Read the HWCAP auxval key to test for VSX support. Expose result through
>>
>> Please use 2 spaces here ---------------------------^
>>
>>> the cpu_features interface.
>>>
>>> Preliminary change to prepare for PowerPC optimized libmvec implementations
>>> [BZ #20123]. Enables selecting optimized version at load time in ifunc
>>
>> Likewise. ----^
>>
>>> resolver.
>>
>> Can't you take it directly from the hwcap variable that is already available
>> when using libc_ifunc or libc_ifunc_redirected? e.g.
>> sysdeps/powerpc/powerpc64/multiarch/memcmp.c
>>
>>
>
> I don't have the original message in my mailbox, was it sent only privately?
No, it's in the mailing list archives:
https://sourceware.org/ml/libc-alpha/2018-03/msg00582.html
> If it was the case, could you send the original one as well?
Sure! I'm sending it in private to avoid duplicating this in the mailing list.
--
Tulio Magno
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] powerpc: Expose VSX feature test
2018-03-28 13:31 ` Tulio Magno Quites Machado Filho
@ 2018-03-28 13:36 ` Adhemerval Zanella
0 siblings, 0 replies; 6+ messages in thread
From: Adhemerval Zanella @ 2018-03-28 13:36 UTC (permalink / raw)
To: Tulio Magno Quites Machado Filho, libc-alpha
On 28/03/2018 10:31, Tulio Magno Quites Machado Filho wrote:
> Adhemerval Zanella <adhemerval.zanella@linaro.org> writes:
>
>> On 28/03/2018 09:16, Tulio Magno Quites Machado Filho wrote:
>>> Nathan Phillips <waic9e@protonmail.com> writes:
>>>
>>>> Hope it's OK to submit a small change like this. Trying to familiarize myself
>>>> with the patch process.
>>>>
>>>> My copyright assignment is underway.
>>>
>>> Ack.
>>>
>>>> Read the HWCAP auxval key to test for VSX support. Expose result through
>>>
>>> Please use 2 spaces here ---------------------------^
>>>
>>>> the cpu_features interface.
>>>>
>>>> Preliminary change to prepare for PowerPC optimized libmvec implementations
>>>> [BZ #20123]. Enables selecting optimized version at load time in ifunc
>>>
>>> Likewise. ----^
>>>
>>>> resolver.
>>>
>>> Can't you take it directly from the hwcap variable that is already available
>>> when using libc_ifunc or libc_ifunc_redirected? e.g.
>>> sysdeps/powerpc/powerpc64/multiarch/memcmp.c
>>>
>>>
>>
>> I don't have the original message in my mailbox, was it sent only privately?
>
> No, it's in the mailing list archives:
> https://sourceware.org/ml/libc-alpha/2018-03/msg00582.html
>
>> If it was the case, could you send the original one as well?
>
> Sure! I'm sending it in private to avoid duplicating this in the mailing list.
>
Right, thanks for the link, I missed this one.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] powerpc: Expose VSX feature test
2018-03-28 12:16 ` Tulio Magno Quites Machado Filho
2018-03-28 12:42 ` Adhemerval Zanella
@ 2018-03-28 13:46 ` Nathan Phillips
1 sibling, 0 replies; 6+ messages in thread
From: Nathan Phillips @ 2018-03-28 13:46 UTC (permalink / raw)
To: Tulio Magno Quites Machado Filho; +Cc: libc-alpha\@sourceware.org
Thank you for reviewing. Well noted about the double spaces.
On March 28, 2018 6:16 AM, Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com> wrote:
> Can't you take it directly from the hwcap variable that is already available
> when using libc_ifunc or libc_ifunc_redirected? e.g.
> sysdeps/powerpc/powerpc64/multiarch/memcmp.c
I hadn't seen that, and it makes sense.
The x86 version seems to store everything in cpu_features, then
use that to resolve the ifunc. But I see the pattern is different
in the PPC section.
I propose dropping this patch and I can follow the PPC pattern instead.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2018-03-28 13:46 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-28 8:20 [PATCH] powerpc: Expose VSX feature test Nathan Phillips
2018-03-28 12:16 ` Tulio Magno Quites Machado Filho
2018-03-28 12:42 ` Adhemerval Zanella
2018-03-28 13:31 ` Tulio Magno Quites Machado Filho
2018-03-28 13:36 ` Adhemerval Zanella
2018-03-28 13:46 ` Nathan Phillips
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).