summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHarald van Dijk <harald@gigawatt.nl>2020-06-16 18:53:57 +0100
committerJaroslav Kysela <perex@perex.cz>2020-06-17 15:37:03 +0200
commit58682bedb6cfd975ed7a1424f913eca0297e792d (patch)
treea09106799e7642097dd3cdcb35b8686712d63220
parent5394f605bce7cb3fce0b9ef35890f938f6699244 (diff)
downloadalsa-lib-58682bedb6cfd975ed7a1424f913eca0297e792d.tar.gz
pcm: dmic: assembly: add x32 support.
x32 is the x86_64 ABI that uses 32-bit pointers, so requires loading addresses into edi/esi/ebx rather than rdi/rsi/rbx. Note that instructions such as movl %eax, (%rdi) do not require updating, as loading an address into %edi zeroes the high bits, causing the full %rdi register to hold a valid address. Signed-off-by: Harald van Dijk <harald@gigawatt.nl> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
-rw-r--r--src/pcm/pcm_dmix_x86_64.h54
1 files changed, 45 insertions, 9 deletions
diff --git a/src/pcm/pcm_dmix_x86_64.h b/src/pcm/pcm_dmix_x86_64.h
index aef5d90c..1932be3e 100644
--- a/src/pcm/pcm_dmix_x86_64.h
+++ b/src/pcm/pcm_dmix_x86_64.h
@@ -58,9 +58,15 @@ static void MIX_AREAS_16(unsigned int size,
/*
* initialization, load RSI, RDI, RBX registers
*/
+#ifndef _ILP32
"\tmovq %[dst], %%rdi\n"
"\tmovq %[src], %%rsi\n"
"\tmovq %[sum], %%rbx\n"
+#else
+ "\tmovl %[dst], %%edi\n"
+ "\tmovl %[src], %%esi\n"
+ "\tmovl %[sum], %%ebx\n"
+#endif
/*
* while (size-- > 0) {
@@ -109,9 +115,15 @@ static void MIX_AREAS_16(unsigned int size,
/*
* while (size-- > 0)
*/
- "\tadd %[dst_step], %%rdi\n"
- "\tadd %[src_step], %%rsi\n"
- "\tadd %[sum_step], %%rbx\n"
+#ifndef _ILP32
+ "\taddq %[dst_step], %%rdi\n"
+ "\taddq %[src_step], %%rsi\n"
+ "\taddq %[sum_step], %%rbx\n"
+#else
+ "\taddl %[dst_step], %%edi\n"
+ "\taddl %[src_step], %%esi\n"
+ "\taddl %[sum_step], %%ebx\n"
+#endif
"\tdecl %[size]\n"
"\tjnz 1b\n"
@@ -168,9 +180,15 @@ static void MIX_AREAS_32(unsigned int size,
/*
* initialization, load RSI, RDI, RBX registers
*/
+#ifndef _ILP32
"\tmovq %[dst], %%rdi\n"
"\tmovq %[src], %%rsi\n"
"\tmovq %[sum], %%rbx\n"
+#else
+ "\tmovl %[dst], %%edi\n"
+ "\tmovl %[src], %%esi\n"
+ "\tmovl %[sum], %%ebx\n"
+#endif
/*
* while (size-- > 0) {
@@ -241,9 +259,15 @@ static void MIX_AREAS_32(unsigned int size,
/*
* while (size-- > 0)
*/
- "\tadd %[dst_step], %%rdi\n"
- "\tadd %[src_step], %%rsi\n"
- "\tadd %[sum_step], %%rbx\n"
+#ifndef _ILP32
+ "\taddq %[dst_step], %%rdi\n"
+ "\taddq %[src_step], %%rsi\n"
+ "\taddq %[sum_step], %%rbx\n"
+#else
+ "\taddl %[dst_step], %%edi\n"
+ "\taddl %[src_step], %%esi\n"
+ "\taddl %[sum_step], %%ebx\n"
+#endif
"\tdecl %[size]\n"
"\tjnz 1b\n"
@@ -292,9 +316,15 @@ static void MIX_AREAS_24(unsigned int size,
/*
* initialization, load RSI, RDI, RBX registers
*/
+#ifndef _ILP32
"\tmovq %[dst], %%rdi\n"
"\tmovq %[src], %%rsi\n"
"\tmovq %[sum], %%rbx\n"
+#else
+ "\tmovl %[dst], %%edi\n"
+ "\tmovl %[src], %%esi\n"
+ "\tmovl %[sum], %%ebx\n"
+#endif
/*
* while (size-- > 0) {
@@ -353,9 +383,15 @@ static void MIX_AREAS_24(unsigned int size,
/*
* while (size-- > 0)
*/
- "\tadd %[dst_step], %%rdi\n"
- "\tadd %[src_step], %%rsi\n"
- "\tadd %[sum_step], %%rbx\n"
+#ifndef _ILP32
+ "\taddq %[dst_step], %%rdi\n"
+ "\taddq %[src_step], %%rsi\n"
+ "\taddq %[sum_step], %%rbx\n"
+#else
+ "\taddl %[dst_step], %%edi\n"
+ "\taddl %[src_step], %%esi\n"
+ "\taddl %[sum_step], %%ebx\n"
+#endif
"\tdecl %[size]\n"
"\tjnz 1b\n"