From: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH SBC 2/3] sbc/sbc_primitives_sse: Optimize sbc_analyze_4s
Date: Tue, 11 Aug 2020 11:16:22 -0700 [thread overview]
Message-ID: <20200811181623.3683374-2-luiz.dentz@gmail.com> (raw)
In-Reply-To: <20200811181623.3683374-1-luiz.dentz@gmail.com>
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This makes use 128 bit XMM registers whenever possible.
$ time src/sbcenc_mmx -s 4 sin_4m.au > /dev/null
real 0m1.073s
user 0m1.039s
sys 0m0.030s
=== After ====
$ time src/sbcenc -s 4 sin_4m.au > /dev/null
real 0m1.049s
user 0m1.000s
sys 0m0.047s
---
sbc/sbc_primitives_sse.c | 58 +++++++++++++++++-----------------------
1 file changed, 25 insertions(+), 33 deletions(-)
diff --git a/sbc/sbc_primitives_sse.c b/sbc/sbc_primitives_sse.c
index c2b729a..6471bd5 100644
--- a/sbc/sbc_primitives_sse.c
+++ b/sbc/sbc_primitives_sse.c
@@ -38,48 +38,40 @@
static inline void sbc_analyze_four_sse(const int16_t *in, int32_t *out,
const FIXED_T *consts)
{
- static const SBC_ALIGNED int32_t round_c[2] = {
+ static const SBC_ALIGNED int32_t round_c[4] = {
+ 1 << (SBC_PROTO_FIXED4_SCALE - 1),
+ 1 << (SBC_PROTO_FIXED4_SCALE - 1),
1 << (SBC_PROTO_FIXED4_SCALE - 1),
1 << (SBC_PROTO_FIXED4_SCALE - 1),
};
__asm__ volatile (
- "movq (%0), %%mm0\n"
- "movq 8(%0), %%mm1\n"
- "pmaddwd (%1), %%mm0\n"
- "pmaddwd 8(%1), %%mm1\n"
- "paddd (%2), %%mm0\n"
- "paddd (%2), %%mm1\n"
+ "movdqu (%0), %%xmm0\n"
+ "pmaddwd (%1), %%xmm0\n"
+ "paddd (%2), %%xmm0\n"
"\n"
- "movq 16(%0), %%mm2\n"
- "movq 24(%0), %%mm3\n"
- "pmaddwd 16(%1), %%mm2\n"
- "pmaddwd 24(%1), %%mm3\n"
- "paddd %%mm2, %%mm0\n"
- "paddd %%mm3, %%mm1\n"
+ "movdqu 16(%0), %%xmm1\n"
+ "pmaddwd 16(%1), %%xmm1\n"
+ "paddd %%xmm1, %%xmm0\n"
"\n"
- "movq 32(%0), %%mm2\n"
- "movq 40(%0), %%mm3\n"
- "pmaddwd 32(%1), %%mm2\n"
- "pmaddwd 40(%1), %%mm3\n"
- "paddd %%mm2, %%mm0\n"
- "paddd %%mm3, %%mm1\n"
+ "movdqu 32(%0), %%xmm1\n"
+ "pmaddwd 32(%1), %%xmm1\n"
+ "paddd %%xmm1, %%xmm0\n"
"\n"
- "movq 48(%0), %%mm2\n"
- "movq 56(%0), %%mm3\n"
- "pmaddwd 48(%1), %%mm2\n"
- "pmaddwd 56(%1), %%mm3\n"
- "paddd %%mm2, %%mm0\n"
- "paddd %%mm3, %%mm1\n"
+ "movdqu 48(%0), %%xmm1\n"
+ "pmaddwd 48(%1), %%xmm1\n"
+ "paddd %%xmm1, %%xmm0\n"
"\n"
- "movq 64(%0), %%mm2\n"
- "movq 72(%0), %%mm3\n"
- "pmaddwd 64(%1), %%mm2\n"
- "pmaddwd 72(%1), %%mm3\n"
- "paddd %%mm2, %%mm0\n"
- "paddd %%mm3, %%mm1\n"
+ "movdqu 64(%0), %%xmm1\n"
+ "pmaddwd 64(%1), %%xmm1\n"
+ "paddd %%xmm1, %%xmm0\n"
+ "\n"
+ "psrad %4, %%xmm0\n"
+ "\n"
+ "movdqa %%xmm0, %%xmm1\n"
+ "punpckhqdq %%xmm1, %%xmm1\n"
+ "movdq2q %%xmm0, %%mm0\n"
+ "movdq2q %%xmm1, %%mm1\n"
"\n"
- "psrad %4, %%mm0\n"
- "psrad %4, %%mm1\n"
"packssdw %%mm0, %%mm0\n"
"packssdw %%mm1, %%mm1\n"
"\n"
--
2.26.2
next prev parent reply other threads:[~2020-08-11 18:16 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-11 18:16 [PATCH SBC 1/3] sbc: Add initial code for SSE primitives Luiz Augusto von Dentz
2020-08-11 18:16 ` Luiz Augusto von Dentz [this message]
2020-08-11 18:16 ` [PATCH SBC 3/3] sbc/sbc_primitives_sse: Optimize sbc_analyze_8s Luiz Augusto von Dentz
2020-08-12 12:48 ` [PATCH SBC 1/3] sbc: Add initial code for SSE primitives Marcel Holtmann
2020-08-14 20:56 ` Luiz Augusto von Dentz
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=20200811181623.3683374-2-luiz.dentz@gmail.com \
--to=luiz.dentz@gmail.com \
--cc=linux-bluetooth@vger.kernel.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.