]> git.alsa-project.org Git - alsa-lib.git/commitdiff
pcm: dmic: assembly: add x32 support.
authorHarald van Dijk <harald@gigawatt.nl>
Tue, 16 Jun 2020 17:53:57 +0000 (18:53 +0100)
committerJaroslav Kysela <perex@perex.cz>
Wed, 17 Jun 2020 13:37:03 +0000 (15:37 +0200)
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>
src/pcm/pcm_dmix_x86_64.h

index aef5d90ce6fb3bf4f03502b87a9165a3b8934d11..1932be3ec7dd9c3b3a62cdb1ba3ddae8c3aa1afe 100644 (file)
@@ -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"