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>
This commit is contained in:
Harald van Dijk 2020-06-16 18:53:57 +01:00 committed by Jaroslav Kysela
parent 5394f605bc
commit 58682bedb6

View file

@ -58,9 +58,15 @@ static void MIX_AREAS_16(unsigned int size,
/* /*
* initialization, load RSI, RDI, RBX registers * initialization, load RSI, RDI, RBX registers
*/ */
#ifndef _ILP32
"\tmovq %[dst], %%rdi\n" "\tmovq %[dst], %%rdi\n"
"\tmovq %[src], %%rsi\n" "\tmovq %[src], %%rsi\n"
"\tmovq %[sum], %%rbx\n" "\tmovq %[sum], %%rbx\n"
#else
"\tmovl %[dst], %%edi\n"
"\tmovl %[src], %%esi\n"
"\tmovl %[sum], %%ebx\n"
#endif
/* /*
* while (size-- > 0) { * while (size-- > 0) {
@ -109,9 +115,15 @@ static void MIX_AREAS_16(unsigned int size,
/* /*
* while (size-- > 0) * while (size-- > 0)
*/ */
"\tadd %[dst_step], %%rdi\n" #ifndef _ILP32
"\tadd %[src_step], %%rsi\n" "\taddq %[dst_step], %%rdi\n"
"\tadd %[sum_step], %%rbx\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" "\tdecl %[size]\n"
"\tjnz 1b\n" "\tjnz 1b\n"
@ -168,9 +180,15 @@ static void MIX_AREAS_32(unsigned int size,
/* /*
* initialization, load RSI, RDI, RBX registers * initialization, load RSI, RDI, RBX registers
*/ */
#ifndef _ILP32
"\tmovq %[dst], %%rdi\n" "\tmovq %[dst], %%rdi\n"
"\tmovq %[src], %%rsi\n" "\tmovq %[src], %%rsi\n"
"\tmovq %[sum], %%rbx\n" "\tmovq %[sum], %%rbx\n"
#else
"\tmovl %[dst], %%edi\n"
"\tmovl %[src], %%esi\n"
"\tmovl %[sum], %%ebx\n"
#endif
/* /*
* while (size-- > 0) { * while (size-- > 0) {
@ -241,9 +259,15 @@ static void MIX_AREAS_32(unsigned int size,
/* /*
* while (size-- > 0) * while (size-- > 0)
*/ */
"\tadd %[dst_step], %%rdi\n" #ifndef _ILP32
"\tadd %[src_step], %%rsi\n" "\taddq %[dst_step], %%rdi\n"
"\tadd %[sum_step], %%rbx\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" "\tdecl %[size]\n"
"\tjnz 1b\n" "\tjnz 1b\n"
@ -292,9 +316,15 @@ static void MIX_AREAS_24(unsigned int size,
/* /*
* initialization, load RSI, RDI, RBX registers * initialization, load RSI, RDI, RBX registers
*/ */
#ifndef _ILP32
"\tmovq %[dst], %%rdi\n" "\tmovq %[dst], %%rdi\n"
"\tmovq %[src], %%rsi\n" "\tmovq %[src], %%rsi\n"
"\tmovq %[sum], %%rbx\n" "\tmovq %[sum], %%rbx\n"
#else
"\tmovl %[dst], %%edi\n"
"\tmovl %[src], %%esi\n"
"\tmovl %[sum], %%ebx\n"
#endif
/* /*
* while (size-- > 0) { * while (size-- > 0) {
@ -353,9 +383,15 @@ static void MIX_AREAS_24(unsigned int size,
/* /*
* while (size-- > 0) * while (size-- > 0)
*/ */
"\tadd %[dst_step], %%rdi\n" #ifndef _ILP32
"\tadd %[src_step], %%rsi\n" "\taddq %[dst_step], %%rdi\n"
"\tadd %[sum_step], %%rbx\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" "\tdecl %[size]\n"
"\tjnz 1b\n" "\tjnz 1b\n"