From: Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org>
To: xenomai@xenomai.org
Subject: Re: [Xenomai] [Xenomai-git] Jan Kiszka : switchtest: Add SSE and AVX check
Date: Sat, 13 Apr 2013 18:11:27 +0200 [thread overview]
Message-ID: <516983AF.2000909@xenomai.org> (raw)
In-Reply-To: <E1U2RE9-0007Zc-Em@xenomai.org>
On 02/04/2013 07:57 PM, GIT version control wrote:
> Module: xenomai-2.6
> Branch: master
> Commit: 192597326a0becd1980cb6c5cc9395af18a19c60
> URL: http://git.xenomai.org/?p=xenomai-2.6.git;a=commit;h=192597326a0becd1980cb6c5cc9395af18a19c60
>
> Author: Jan Kiszka <jan.kiszka@siemens.com>
> Date: Tue Jan 29 18:46:13 2013 +0100
>
> switchtest: Add SSE and AVX check
>
> Add a test for switching the lower SSE registers xmm0..7 or AVX
> registers ymm0..7, provided the CPU supports the corresponding
> feature. As xmm and ymm share their storage, we only need to check
> one of the features.
>
> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
>
> ---
> static inline unsigned fp_regs_check(unsigned val)
> {
> unsigned i, result = val;
> + uint64_t vec[8][4];
> unsigned e[8];
>
> for (i = 0; i < 8; i++)
> __asm__ __volatile__("fistpl %0":"=m"(e[7 - i]));
> + if (fp_features & FP_FEATURE_AVX) {
> + __asm__ __volatile__(
> + "vmovupd %%ymm0,%0;"
> + "vmovupd %%ymm1,%1;"
> + "vmovupd %%ymm2,%2;"
> + "vmovupd %%ymm3,%3;"
> + "vmovupd %%ymm4,%4;"
> + "vmovupd %%ymm5,%5;"
> + "vmovupd %%ymm6,%6;"
> + "vmovupd %%ymm7,%7;"
> + :
> + : "m" (vec[0][0]), "m" (vec[1][0]),
> + "m" (vec[2][0]), "m" (vec[3][0]),
> + "m" (vec[4][0]), "m" (vec[5][0]),
> + "m" (vec[6][0]), "m" (vec[7][0]));
> + } else if (fp_features & FP_FEATURE_SSE) {
> + __asm__ __volatile__(
> + "movupd %%xmm0,%0;"
> + "movupd %%xmm1,%1;"
> + "movupd %%xmm2,%2;"
> + "movupd %%xmm3,%3;"
> + "movupd %%xmm4,%4;"
> + "movupd %%xmm5,%5;"
> + "movupd %%xmm6,%6;"
> + "movupd %%xmm7,%7;"
> + :
> + : "m" (vec[0][0]), "m" (vec[1][0]),
> + "m" (vec[2][0]), "m" (vec[3][0]),
> + "m" (vec[4][0]), "m" (vec[5][0]),
> + "m" (vec[6][0]), "m" (vec[7][0]));
> + }
>
> for (i = 0; i < 8; i++)
> if (e[i] != val) {
> @@ -65,8 +148,33 @@ static inline unsigned fp_regs_check(unsigned val)
> result = e[i];
> }
>
> + if (fp_features & FP_FEATURE_AVX) {
> + for (i = 0; i < 8; i++) {
> + int error = 0;
> + if (vec[i][0] != val) {
> + result = vec[i][0];
> + error = 1;
> + }
> + if (vec[i][2] != val) {
> + result = vec[i][2];
> + error = 1;
> + }
> + if (error)
> + printk("ymm%d: %llu/%llu != %u/%u\n",
> + i, (unsigned long long)vec[i][0],
> + (unsigned long long)vec[i][2],
> + val, val);
> + }
> + } else if (fp_features & FP_FEATURE_SSE) {
> + for (i = 0; i < 8; i++)
> + if (vec[i][0] != val) {
> + printk("xmm%d: %llu != %u\n",
> + i, (unsigned long long)vec[i][0], val);
> + result = vec[i][0];
> + }
> + }
> +
> return result;
> }
This routine causes a warning from gcc and looks indeed wrong: if the
"vec" variable is used as an output variable of the inline assembly, it
should be in the output section of the inline assembly, not the input
section.
--
Gilles.
next parent reply other threads:[~2013-04-13 16:11 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <E1U2RE9-0007Zc-Em@xenomai.org>
2013-04-13 16:11 ` Gilles Chanteperdrix [this message]
2013-04-15 22:02 ` [Xenomai] [Xenomai-git] Jan Kiszka : switchtest: Add SSE and AVX check Jan Kiszka
2013-04-16 7:24 ` Jan Kiszka
2013-04-16 7:32 ` Gilles Chanteperdrix
2013-04-16 7:34 ` Jan Kiszka
2013-04-16 7:53 ` Gilles Chanteperdrix
2013-04-16 8:27 ` Jan Kiszka
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=516983AF.2000909@xenomai.org \
--to=gilles.chanteperdrix@xenomai.org \
--cc=xenomai@xenomai.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.