From: frederic.recoules@univ-grenoble-alpes.fr
To: alsa-devel@alsa-project.org
Cc: "Frédéric Recoules" <frederic.recoules@orange.fr>
Subject: [PATCH v3 3/5] pcm_dmix assembly: fix the interface for safety (mmx)
Date: Wed, 6 May 2020 19:19:22 +0200 [thread overview]
Message-ID: <20200506171924.2644-3-frederic.recoules@univ-grenoble-alpes.fr> (raw)
In-Reply-To: <20200506171924.2644-1-frederic.recoules@univ-grenoble-alpes.fr>
From: Frédéric Recoules <frederic.recoules@orange.fr>
- add mm0 in the clobber list if the compiler
is aware of the mmx technology;
- otherwise, add the mmx aliased x87 floating point
registers in the clobbers;
- the configure now checks if the compiler is aware of
the MMX technology.
The compiler assumes none of the mmx or x87 registers are used
by the function. If it chooses to store some data in them, they
will be overwritten by the chunk.
Recall that any mmx instruction invalidate the whole set of
x87 floating point registers.
Note: currently does not impact the binary output.
Signed-off-by: Frédéric Recoules <frederic.recoules@orange.fr>
---
configure.ac | 7 +++++++
src/pcm/pcm_dmix_i386.h | 6 ++++++
src/pcm/pcm_dmix_x86_64.h | 6 ++++++
3 files changed, 19 insertions(+)
diff --git a/configure.ac b/configure.ac
index 4b5ab662..1838e50b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -516,6 +516,13 @@ if test -z "$gcc_have_atomics"; then
fi
AC_MSG_RESULT($gcc_have_atomics)
+dnl check mmx register for pcm_dmix_i386
+
+AC_TRY_LINK([],
+ [__asm__ volatile ("" : : : "mm0");],
+ [AC_DEFINE([HAVE_MMX], "1", [MMX technology is enabled])],
+ [])
+
PCM_PLUGIN_LIST="copy linear route mulaw alaw adpcm rate plug multi shm file null empty share meter hooks lfloat ladspa dmix dshare dsnoop asym iec958 softvol extplug ioplug mmap_emul"
build_pcm_plugin="no"
diff --git a/src/pcm/pcm_dmix_i386.h b/src/pcm/pcm_dmix_i386.h
index 3ea0737d..5c900bf1 100644
--- a/src/pcm/pcm_dmix_i386.h
+++ b/src/pcm/pcm_dmix_i386.h
@@ -237,6 +237,12 @@ static void MIX_AREAS_16_MMX(unsigned int size,
[dst_step] "m" (dst_step), [src_step] "m" (src_step),
[sum_step] "m" (sum_step)
: "esi", "edi", "edx", "ecx", "eax", "memory", "cc"
+#ifdef HAVE_MMX
+ , "mm0"
+#else
+ , "st", "st(1)", "st(2)", "st(3)",
+ "st(4)", "st(5)", "st(6)", "st(7)"
+#endif
);
}
diff --git a/src/pcm/pcm_dmix_x86_64.h b/src/pcm/pcm_dmix_x86_64.h
index 7f711547..803d3b24 100644
--- a/src/pcm/pcm_dmix_x86_64.h
+++ b/src/pcm/pcm_dmix_x86_64.h
@@ -119,6 +119,12 @@ static void MIX_AREAS_16(unsigned int size,
[dst_step] "m" (dst_step), [src_step] "m" (src_step),
[sum_step] "m" (sum_step)
: "rsi", "rdi", "edx", "ecx", "eax", "memory", "cc"
+#ifdef HAVE_MMX
+ , "mm0"
+#else
+ , "st", "st(1)", "st(2)", "st(3)",
+ "st(4)", "st(5)", "st(6)", "st(7)"
+#endif
);
}
--
2.17.1
next prev parent reply other threads:[~2020-05-06 17:23 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-06 17:19 [PATCH v3 1/5] pcm_dmix assembly: change the token by symbolic names frederic.recoules
2020-05-06 17:19 ` [PATCH v3 2/5] pcm_dmix assembly: fix the interface for safety frederic.recoules
2020-05-06 17:19 ` frederic.recoules [this message]
2020-05-06 17:19 ` [PATCH v3 4/5] pcm_dmix assembly: refactor the PIC mode frederic.recoules
2020-05-06 17:19 ` [PATCH v3 5/5] pcm_dmix assembly: give more freedom over the constraints frederic.recoules
2020-05-06 20:36 ` [PATCH v3 1/5] pcm_dmix assembly: change the token by symbolic names Takashi Iwai
2020-05-14 17:33 ` FRÉDÉRIC RECOULES
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=20200506171924.2644-3-frederic.recoules@univ-grenoble-alpes.fr \
--to=frederic.recoules@univ-grenoble-alpes.fr \
--cc=alsa-devel@alsa-project.org \
--cc=frederic.recoules@orange.fr \
/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.