From patchwork Wed Apr 29 19:10:35 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: frederic.recoules@univ-grenoble-alpes.fr X-Patchwork-Id: 192848 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A2410C83000 for ; Wed, 29 Apr 2020 19:12:49 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3148821973 for ; Wed, 29 Apr 2020 19:12:49 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="I7WuniCj" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3148821973 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=univ-grenoble-alpes.fr Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 7B96D1688; Wed, 29 Apr 2020 21:11:57 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 7B96D1688 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1588187567; bh=nryJOzFM98racKi2uvbSx28r/AUjuDF1JXfd/4zzJTI=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=I7WuniCjAXXBpro2vPJ7ciefXC4X/sww9D1rEvXmB+9NI0h02hMso4VXPiSivAldc 36VLtx/IL79OPvpO+ecwLL+0IhVktpYB2zEWqM1INzwba1Gv1xTl2xcj03Y1gdXHf8 bI1dSS/FKwHq1lGHI3oFhyxf5aURrpOcUpfDD/d8= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 88FF6F80247; Wed, 29 Apr 2020 21:11:09 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id E8BF1F8026F; Wed, 29 Apr 2020 21:11:06 +0200 (CEST) Received: from smtp.smtpout.orange.fr (smtp08.smtpout.orange.fr [80.12.242.130]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 89C7EF800B6 for ; Wed, 29 Apr 2020 21:10:59 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 89C7EF800B6 Received: from is232189.intra.cea.fr ([46.193.2.18]) by mwinf5d31 with ME id YjAq2200t0PJwDa03jAyhu; Wed, 29 Apr 2020 21:10:59 +0200 X-ME-Helo: is232189.intra.cea.fr X-ME-Auth: ZnJlZGVyaWMucmVjb3VsZXNAb3JhbmdlLmZy X-ME-Date: Wed, 29 Apr 2020 21:10:59 +0200 X-ME-IP: 46.193.2.18 From: frederic.recoules@univ-grenoble-alpes.fr To: alsa-devel@alsa-project.org Subject: [PATCH 2/6 V2] [pcm_dmix assembly] change the token by symbolic names Date: Wed, 29 Apr 2020 21:10:35 +0200 Message-Id: <20200429191039.28106-2-frederic.recoules@univ-grenoble-alpes.fr> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200429191039.28106-1-frederic.recoules@univ-grenoble-alpes.fr> References: <20200429191039.28106-1-frederic.recoules@univ-grenoble-alpes.fr> MIME-Version: 1.0 Cc: =?utf-8?q?Fr=C3=A9d=C3=A9ric_Recoules?= X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" From: Frédéric Recoules Note: produce exactly the same binary output. Signed-off-by: Frédéric Recoules --- src/pcm/pcm_dmix_i386.h | 147 ++++++++++++++++++++------------------ src/pcm/pcm_dmix_x86_64.h | 93 ++++++++++++------------ 2 files changed, 124 insertions(+), 116 deletions(-) -- 2.17.1 diff --git a/src/pcm/pcm_dmix_i386.h b/src/pcm/pcm_dmix_i386.h index 2778cb1d..e816d5e0 100644 --- a/src/pcm/pcm_dmix_i386.h +++ b/src/pcm/pcm_dmix_i386.h @@ -47,14 +47,14 @@ static void MIX_AREAS_16(unsigned int size, __asm__ __volatile__ ( "\n" - "\tmovl %%ebx, %7\n" /* ebx is GOT pointer (-fPIC) */ + "\tmovl %%ebx, %[old_ebx]\n" /* ebx is GOT pointer (-fPIC) */ /* * initialization, load ESI, EDI, EBX registers */ - "\tmovl %1, %%edi\n" - "\tmovl %2, %%esi\n" - "\tmovl %3, %%ebx\n" - "\tcmpl $0, %0\n" + "\tmovl %[dst], %%edi\n" + "\tmovl %[src], %%esi\n" + "\tmovl %[sum], %%ebx\n" + "\tcmpl $0, %[size]\n" "\tjnz 2f\n" "\tjmp 7f\n" @@ -64,9 +64,9 @@ static void MIX_AREAS_16(unsigned int size, */ "\t.p2align 4,,15\n" "1:" - "\tadd %4, %%edi\n" - "\tadd %5, %%esi\n" - "\tadd %6, %%ebx\n" + "\tadd %[dst_step], %%edi\n" + "\tadd %[src_step], %%esi\n" + "\tadd %[sum_step], %%ebx\n" /* * sample = *src; @@ -108,7 +108,7 @@ static void MIX_AREAS_16(unsigned int size, /* * while (size-- > 0) */ - "\tdecl %0\n" + "\tdecl %[size]\n" "\tjnz 1b\n" "\tjmp 7f\n" @@ -122,7 +122,7 @@ static void MIX_AREAS_16(unsigned int size, "\tmovw $0x7fff, (%%edi)\n" "\tcmpl %%ecx,(%%ebx)\n" "\tjnz 4b\n" - "\tdecl %0\n" + "\tdecl %[size]\n" "\tjnz 1b\n" "\tjmp 7f\n" @@ -136,16 +136,17 @@ static void MIX_AREAS_16(unsigned int size, "\tmovw $-0x8000, (%%edi)\n" "\tcmpl %%ecx, (%%ebx)\n" "\tjnz 4b\n" - "\tdecl %0\n" + "\tdecl %[size]\n" "\tjnz 1b\n" - + "7:" - "\tmovl %7, %%ebx\n" /* ebx is GOT pointer (-fPIC) */ + "\tmovl %[old_ebx], %%ebx\n" /* ebx is GOT pointer (-fPIC) */ : /* no output regs */ - : "m" (size), "m" (dst), "m" (src), - "m" (sum), "m" (dst_step), "m" (src_step), - "m" (sum_step), "m" (old_ebx) + : [size] "m" (size), + [dst] "m" (dst), [src] "m" (src), [sum] "m" (sum), + [dst_step] "m" (dst_step), [src_step] "m" (src_step), + [sum_step] "m" (sum_step), [old_ebx] "m" (old_ebx) : "esi", "edi", "edx", "ecx", "eax" ); } @@ -171,22 +172,22 @@ static void MIX_AREAS_16_MMX(unsigned int size, __asm__ __volatile__ ( "\n" - "\tmovl %%ebx, %7\n" /* ebx is GOT pointer (-fPIC) */ + "\tmovl %%ebx, %[old_ebx]\n" /* ebx is GOT pointer (-fPIC) */ /* * initialization, load ESI, EDI, EBX registers */ - "\tmovl %1, %%edi\n" - "\tmovl %2, %%esi\n" - "\tmovl %3, %%ebx\n" - "\tcmpl $0, %0\n" + "\tmovl %[dst], %%edi\n" + "\tmovl %[src], %%esi\n" + "\tmovl %[sum], %%ebx\n" + "\tcmpl $0, %[size]\n" "\tjnz 2f\n" "\tjmp 5f\n" "\t.p2align 4,,15\n" "1:" - "\tadd %4, %%edi\n" - "\tadd %5, %%esi\n" - "\tadd %6, %%ebx\n" + "\tadd %[dst_step], %%edi\n" + "\tadd %[src_step], %%esi\n" + "\tadd %[sum_step], %%ebx\n" "2:" /* @@ -226,16 +227,17 @@ static void MIX_AREAS_16_MMX(unsigned int size, /* * while (size-- > 0) */ - "\tdecl %0\n" + "\tdecl %[size]\n" "\tjnz 1b\n" "\temms\n" "5:" - "\tmovl %7, %%ebx\n" /* ebx is GOT pointer (-fPIC) */ + "\tmovl %[old_ebx], %%ebx\n" /* ebx is GOT pointer (-fPIC) */ : /* no output regs */ - : "m" (size), "m" (dst), "m" (src), - "m" (sum), "m" (dst_step), "m" (src_step), - "m" (sum_step), "m" (old_ebx) + : [size] "m" (size), + [dst] "m" (dst), [src] "m" (src), [sum] "m" (sum), + [dst_step] "m" (dst_step), [src_step] "m" (src_step), + [sum_step] "m" (sum_step), [old_ebx] "m" (old_ebx) : "esi", "edi", "edx", "ecx", "eax" ); } @@ -261,14 +263,14 @@ static void MIX_AREAS_32(unsigned int size, __asm__ __volatile__ ( "\n" - "\tmovl %%ebx, %7\n" /* ebx is GOT pointer (-fPIC) */ + "\tmovl %%ebx, %[old_ebx]\n" /* ebx is GOT pointer (-fPIC) */ /* * initialization, load ESI, EDI, EBX registers */ - "\tmovl %1, %%edi\n" - "\tmovl %2, %%esi\n" - "\tmovl %3, %%ebx\n" - "\tcmpl $0, %0\n" + "\tmovl %[dst], %%edi\n" + "\tmovl %[src], %%esi\n" + "\tmovl %[sum], %%ebx\n" + "\tcmpl $0, %[size]\n" "\tjnz 1f\n" "\tjmp 6f\n" @@ -335,20 +337,21 @@ static void MIX_AREAS_32(unsigned int size, /* * while (size-- > 0) */ - "\tdecl %0\n" + "\tdecl %[size]\n" "\tjz 6f\n" - "\tadd %4, %%edi\n" - "\tadd %5, %%esi\n" - "\tadd %6, %%ebx\n" + "\tadd %[dst_step], %%edi\n" + "\tadd %[src_step], %%esi\n" + "\tadd %[sum_step], %%ebx\n" "\tjmp 1b\n" - + "6:" - "\tmovl %7, %%ebx\n" /* ebx is GOT pointer (-fPIC) */ + "\tmovl %[old_ebx], %%ebx\n" /* ebx is GOT pointer (-fPIC) */ : /* no output regs */ - : "m" (size), "m" (dst), "m" (src), - "m" (sum), "m" (dst_step), "m" (src_step), - "m" (sum_step), "m" (old_ebx) + : [size] "m" (size), + [dst] "m" (dst), [src] "m" (src), [sum] "m" (sum), + [dst_step] "m" (dst_step), [src_step] "m" (src_step), + [sum_step] "m" (sum_step), [old_ebx] "m" (old_ebx) : "esi", "edi", "edx", "ecx", "eax" ); } @@ -374,14 +377,14 @@ static void MIX_AREAS_24(unsigned int size, __asm__ __volatile__ ( "\n" - "\tmovl %%ebx, %7\n" /* ebx is GOT pointer (-fPIC) */ + "\tmovl %%ebx, %[old_ebx]\n" /* ebx is GOT pointer (-fPIC) */ /* * initialization, load ESI, EDI, EBX registers */ - "\tmovl %1, %%edi\n" - "\tmovl %2, %%esi\n" - "\tmovl %3, %%ebx\n" - "\tcmpl $0, %0\n" + "\tmovl %[dst], %%edi\n" + "\tmovl %[src], %%esi\n" + "\tmovl %[sum], %%ebx\n" + "\tcmpl $0, %[size]\n" "\tjnz 1f\n" "\tjmp 6f\n" @@ -441,20 +444,21 @@ static void MIX_AREAS_24(unsigned int size, /* * while (size-- > 0) */ - "\tdecl %0\n" + "\tdecl %[size]\n" "\tjz 6f\n" - "\tadd %4, %%edi\n" - "\tadd %5, %%esi\n" - "\tadd %6, %%ebx\n" + "\tadd %[dst_step], %%edi\n" + "\tadd %[src_step], %%esi\n" + "\tadd %[sum_step], %%ebx\n" "\tjmp 1b\n" - + "6:" - "\tmovl %7, %%ebx\n" /* ebx is GOT pointer (-fPIC) */ + "\tmovl %[old_ebx], %%ebx\n" /* ebx is GOT pointer (-fPIC) */ : /* no output regs */ - : "m" (size), "m" (dst), "m" (src), - "m" (sum), "m" (dst_step), "m" (src_step), - "m" (sum_step), "m" (old_ebx) + : [size] "m" (size), + [dst] "m" (dst), [src] "m" (src), [sum] "m" (sum), + [dst_step] "m" (dst_step), [src_step] "m" (src_step), + [sum_step] "m" (sum_step), [old_ebx] "m" (old_ebx) : "esi", "edi", "edx", "ecx", "eax" ); } @@ -480,14 +484,14 @@ static void MIX_AREAS_24_CMOV(unsigned int size, __asm__ __volatile__ ( "\n" - "\tmovl %%ebx, %7\n" /* ebx is GOT pointer (-fPIC) */ + "\tmovl %%ebx, %[old_ebx]\n" /* ebx is GOT pointer (-fPIC) */ /* * initialization, load ESI, EDI, EBX registers */ - "\tmovl %1, %%edi\n" - "\tmovl %2, %%esi\n" - "\tmovl %3, %%ebx\n" - "\tcmpl $0, %0\n" + "\tmovl %[dst], %%edi\n" + "\tmovl %[src], %%esi\n" + "\tmovl %[sum], %%ebx\n" + "\tcmpl $0, %[size]\n" "\tjz 6f\n" "\t.p2align 4,,15\n" @@ -541,19 +545,20 @@ static void MIX_AREAS_24_CMOV(unsigned int size, /* * while (size-- > 0) */ - "\tadd %4, %%edi\n" - "\tadd %5, %%esi\n" - "\tadd %6, %%ebx\n" - "\tdecl %0\n" + "\tadd %[dst_step], %%edi\n" + "\tadd %[src_step], %%esi\n" + "\tadd %[sum_step], %%ebx\n" + "\tdecl %[size]\n" "\tjnz 1b\n" - + "6:" - "\tmovl %7, %%ebx\n" /* ebx is GOT pointer (-fPIC) */ + "\tmovl %[old_ebx], %%ebx\n" /* ebx is GOT pointer (-fPIC) */ : /* no output regs */ - : "m" (size), "m" (dst), "m" (src), - "m" (sum), "m" (dst_step), "m" (src_step), - "m" (sum_step), "m" (old_ebx) + : [size] "m" (size), + [dst] "m" (dst), [src] "m" (src), [sum] "m" (sum), + [dst_step] "m" (dst_step), [src_step] "m" (src_step), + [sum_step] "m" (sum_step), [old_ebx] "m" (old_ebx) : "esi", "edi", "edx", "ecx", "eax" ); } diff --git a/src/pcm/pcm_dmix_x86_64.h b/src/pcm/pcm_dmix_x86_64.h index 1ef608af..dc433b35 100644 --- a/src/pcm/pcm_dmix_x86_64.h +++ b/src/pcm/pcm_dmix_x86_64.h @@ -48,18 +48,18 @@ static void MIX_AREAS_16(unsigned int size, __asm__ __volatile__ ( "\n" - "\tmovq %%rbx, %7\n" + "\tmovq %%rbx, %[old_rbx]\n" /* * initialization, load RSI, RDI, RBX registers */ - "\tmovq %1, %%rdi\n" - "\tmovq %2, %%rsi\n" - "\tmovq %3, %%rbx\n" + "\tmovq %[dst], %%rdi\n" + "\tmovq %[src], %%rsi\n" + "\tmovq %[sum], %%rbx\n" /* * while (size-- > 0) { */ - "\tcmpl $0, %0\n" + "\tcmpl $0, %[size]\n" "jz 6f\n" "\t.p2align 4,,15\n" @@ -103,21 +103,22 @@ static void MIX_AREAS_16(unsigned int size, /* * while (size-- > 0) */ - "\tadd %4, %%rdi\n" - "\tadd %5, %%rsi\n" - "\tadd %6, %%rbx\n" - "\tdecl %0\n" + "\tadd %[dst_step], %%rdi\n" + "\tadd %[src_step], %%rsi\n" + "\tadd %[sum_step], %%rbx\n" + "\tdecl %[size]\n" "\tjnz 1b\n" "6:" - + "\temms\n" - "\tmovq %7, %%rbx\n" + "\tmovq %[old_rbx], %%rbx\n" : /* no output regs */ - : "m" (size), "m" (dst), "m" (src), - "m" (sum), "m" (dst_step), "m" (src_step), - "m" (sum_step), "m" (old_rbx) + : [size] "m" (size), + [dst] "m" (dst), [src] "m" (src), [sum] "m" (sum), + [dst_step] "m" (dst_step), [src_step] "m" (src_step), + [sum_step] "m" (sum_step), [old_rbx] "m" (old_rbx) : "rsi", "rdi", "edx", "ecx", "eax" ); } @@ -143,18 +144,18 @@ static void MIX_AREAS_32(unsigned int size, __asm__ __volatile__ ( "\n" - "\tmovq %%rbx, %7\n" + "\tmovq %%rbx, %[old_rbx]\n" /* - * initialization, load ESI, EDI, EBX registers + * initialization, load RSI, RDI, RBX registers */ - "\tmovq %1, %%rdi\n" - "\tmovq %2, %%rsi\n" - "\tmovq %3, %%rbx\n" + "\tmovq %[dst], %%rdi\n" + "\tmovq %[src], %%rsi\n" + "\tmovq %[sum], %%rbx\n" /* * while (size-- > 0) { */ - "\tcmpl $0, %0\n" + "\tcmpl $0, %[size]\n" "jz 6f\n" "\t.p2align 4,,15\n" @@ -220,19 +221,20 @@ static void MIX_AREAS_32(unsigned int size, /* * while (size-- > 0) */ - "\tadd %4, %%rdi\n" - "\tadd %5, %%rsi\n" - "\tadd %6, %%rbx\n" - "\tdecl %0\n" + "\tadd %[dst_step], %%rdi\n" + "\tadd %[src_step], %%rsi\n" + "\tadd %[sum_step], %%rbx\n" + "\tdecl %[size]\n" "\tjnz 1b\n" - + "6:" - "\tmovq %7, %%rbx\n" + "\tmovq %[old_rbx], %%rbx\n" : /* no output regs */ - : "m" (size), "m" (dst), "m" (src), - "m" (sum), "m" (dst_step), "m" (src_step), - "m" (sum_step), "m" (old_rbx) + : [size] "m" (size), + [dst] "m" (dst), [src] "m" (src), [sum] "m" (sum), + [dst_step] "m" (dst_step), [src_step] "m" (src_step), + [sum_step] "m" (sum_step), [old_rbx] "m" (old_rbx) : "rsi", "rdi", "edx", "ecx", "eax" ); } @@ -258,18 +260,18 @@ static void MIX_AREAS_24(unsigned int size, __asm__ __volatile__ ( "\n" - "\tmovq %%rbx, %7\n" + "\tmovq %%rbx, %[old_rbx]\n" /* - * initialization, load ESI, EDI, EBX registers + * initialization, load RSI, RDI, RBX registers */ - "\tmovq %1, %%rdi\n" - "\tmovq %2, %%rsi\n" - "\tmovq %3, %%rbx\n" + "\tmovq %[dst], %%rdi\n" + "\tmovq %[src], %%rsi\n" + "\tmovq %[sum], %%rbx\n" /* * while (size-- > 0) { */ - "\tcmpl $0, %0\n" + "\tcmpl $0, %[size]\n" "jz 6f\n" "\t.p2align 4,,15\n" @@ -316,26 +318,27 @@ static void MIX_AREAS_24(unsigned int size, "\tmovw %%ax, (%%rdi)\n" "\tshrl $16, %%eax\n" "\tmovb %%al, 2(%%rdi)\n" - + "\tcmpl %%ecx, (%%rbx)\n" "\tjnz 3b\n" /* * while (size-- > 0) */ - "\tadd %4, %%rdi\n" - "\tadd %5, %%rsi\n" - "\tadd %6, %%rbx\n" - "\tdecl %0\n" + "\tadd %[dst_step], %%rdi\n" + "\tadd %[src_step], %%rsi\n" + "\tadd %[sum_step], %%rbx\n" + "\tdecl %[size]\n" "\tjnz 1b\n" - + "6:" - "\tmovq %7, %%rbx\n" + "\tmovq %[old_rbx], %%rbx\n" : /* no output regs */ - : "m" (size), "m" (dst), "m" (src), - "m" (sum), "m" (dst_step), "m" (src_step), - "m" (sum_step), "m" (old_rbx) + : [size] "m" (size), + [dst] "m" (dst), [src] "m" (src), [sum] "m" (sum), + [dst_step] "m" (dst_step), [src_step] "m" (src_step), + [sum_step] "m" (sum_step), [old_rbx] "m" (old_rbx) : "rsi", "rdi", "edx", "ecx", "eax" ); } From patchwork Wed Apr 29 19:10:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: frederic.recoules@univ-grenoble-alpes.fr X-Patchwork-Id: 192847 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AF2E7C83000 for ; Wed, 29 Apr 2020 19:14:24 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3C0DF21D82 for ; Wed, 29 Apr 2020 19:14:24 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="ZkxxLxpw" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3C0DF21D82 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=univ-grenoble-alpes.fr Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id A3AF31676; Wed, 29 Apr 2020 21:13:32 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz A3AF31676 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1588187662; bh=aNvW/JDCVG19/yLEIdjfYK8YSuVfeScxG2evT4l0kwU=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=ZkxxLxpwFJGjMO7aYOWWq10OsVKETN1eGEUEKOTmk6r4ds2qITa6MIBU2Op42avzc MmzDH7smYTDKEbaxD22kqFAEFuTmcMU5hICbp48GKP9jd4PiO2GH5PeoruxrZvIEko sWyoCMtRFAcKNs9ZtiAMWProc9qDNml+XiQYdF7Y= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 459E9F8029B; Wed, 29 Apr 2020 21:11:16 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 0F0B3F802A7; Wed, 29 Apr 2020 21:11:13 +0200 (CEST) Received: from smtp.smtpout.orange.fr (smtp08.smtpout.orange.fr [80.12.242.130]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 2429EF80257 for ; Wed, 29 Apr 2020 21:11:05 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 2429EF80257 Received: from is232189.intra.cea.fr ([46.193.2.18]) by mwinf5d31 with ME id YjAq2200t0PJwDa03jB4iX; Wed, 29 Apr 2020 21:11:04 +0200 X-ME-Helo: is232189.intra.cea.fr X-ME-Auth: ZnJlZGVyaWMucmVjb3VsZXNAb3JhbmdlLmZy X-ME-Date: Wed, 29 Apr 2020 21:11:04 +0200 X-ME-IP: 46.193.2.18 From: frederic.recoules@univ-grenoble-alpes.fr To: alsa-devel@alsa-project.org Subject: [PATCH 4/6 V2] [pcm_dmix assembly] fix the interface for safety (mmx) Date: Wed, 29 Apr 2020 21:10:37 +0200 Message-Id: <20200429191039.28106-4-frederic.recoules@univ-grenoble-alpes.fr> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200429191039.28106-1-frederic.recoules@univ-grenoble-alpes.fr> References: <20200429191039.28106-1-frederic.recoules@univ-grenoble-alpes.fr> MIME-Version: 1.0 Cc: =?utf-8?q?Fr=C3=A9d=C3=A9ric_Recoules?= X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" From: Frédéric Recoules - initialize mm1 with 0s; - add mm0 and mm1 in the clobber list if the compiler is aware of the mmx technology; - otherwise, add the mmx aliased x87 floating point register in the clobbers. Note: produce exactly the same binary output except for mm1 initialization implying address shifts. Signed-off-by: Frédéric Recoules --- src/pcm/pcm_dmix_i386.h | 9 ++++++++- src/pcm/pcm_dmix_x86_64.h | 9 ++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) -- 2.17.1 diff --git a/src/pcm/pcm_dmix_i386.h b/src/pcm/pcm_dmix_i386.h index 3ea0737d..d9bf8f50 100644 --- a/src/pcm/pcm_dmix_i386.h +++ b/src/pcm/pcm_dmix_i386.h @@ -173,8 +173,9 @@ static void MIX_AREAS_16_MMX(unsigned int size, "\tmovl %%ebx, %[old_ebx]\n" /* ebx is GOT pointer (-fPIC) */ /* - * initialization, load ESI, EDI, EBX registers + * initialization, load ESI, EDI, EBX registers and clear MM1 */ + "\tpxor %%mm1, %%mm1\n" "\tmovl %[dst], %%edi\n" "\tmovl %[src], %%esi\n" "\tmovl %[sum], %%ebx\n" @@ -237,6 +238,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", "mm1" +# 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..8ad1b2a0 100644 --- a/src/pcm/pcm_dmix_x86_64.h +++ b/src/pcm/pcm_dmix_x86_64.h @@ -50,8 +50,9 @@ static void MIX_AREAS_16(unsigned int size, "\tmovq %%rbx, %[old_rbx]\n" /* - * initialization, load RSI, RDI, RBX registers + * initialization, load RSI, RDI, RBX registers and clear MM1 */ + "\tpxor %%mm1, %%mm1\n" "\tmovq %[dst], %%rdi\n" "\tmovq %[src], %%rsi\n" "\tmovq %[sum], %%rbx\n" @@ -119,6 +120,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", "mm1" +# else + , "st", "st(1)", "st(2)", "st(3)", + "st(4)", "st(5)", "st(6)", "st(7)" +# endif ); } From patchwork Wed Apr 29 19:10:39 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: frederic.recoules@univ-grenoble-alpes.fr X-Patchwork-Id: 192846 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8912FC83000 for ; Wed, 29 Apr 2020 19:15:19 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1396A206F0 for ; Wed, 29 Apr 2020 19:15:19 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="XUCrDLEn" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1396A206F0 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=univ-grenoble-alpes.fr Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 7012B167D; Wed, 29 Apr 2020 21:14:27 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 7012B167D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1588187717; bh=gup4YHX5fSe2ET94W4V8jbi1issyEmQkKLt9UFQ1B34=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=XUCrDLEnVXeoZ437GcwMQDgFnkw096exG6/K1GChnScVh189/Vm2X2XE/lVtrYckG yc+irYyQ3zifIAsi/x35hl/MvysAuDotQptXjShE+ObPpsUft73uQqRjBg7ALCQlR6 ICxOZwGWNf3PPCthoHY4FRqe7eYUrvu0MEAD/AAY= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id AB210F802BE; Wed, 29 Apr 2020 21:11:22 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id D75D2F802BE; Wed, 29 Apr 2020 21:11:18 +0200 (CEST) Received: from smtp.smtpout.orange.fr (smtp08.smtpout.orange.fr [80.12.242.130]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id E98F3F80290 for ; Wed, 29 Apr 2020 21:11:09 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz E98F3F80290 Received: from is232189.intra.cea.fr ([46.193.2.18]) by mwinf5d31 with ME id YjAq2200t0PJwDa03jB8j0; Wed, 29 Apr 2020 21:11:09 +0200 X-ME-Helo: is232189.intra.cea.fr X-ME-Auth: ZnJlZGVyaWMucmVjb3VsZXNAb3JhbmdlLmZy X-ME-Date: Wed, 29 Apr 2020 21:11:09 +0200 X-ME-IP: 46.193.2.18 From: frederic.recoules@univ-grenoble-alpes.fr To: alsa-devel@alsa-project.org Subject: [PATCH 6/6 V2] [pcm_dmix assembly] (minor) give more freedom over the constraints Date: Wed, 29 Apr 2020 21:10:39 +0200 Message-Id: <20200429191039.28106-6-frederic.recoules@univ-grenoble-alpes.fr> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200429191039.28106-1-frederic.recoules@univ-grenoble-alpes.fr> References: <20200429191039.28106-1-frederic.recoules@univ-grenoble-alpes.fr> MIME-Version: 1.0 Cc: =?utf-8?q?Fr=C3=A9d=C3=A9ric_Recoules?= X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" From: Frédéric Recoules Signed-off-by: Frédéric Recoules --- src/pcm/pcm_dmix_i386.h | 30 +++++++++++++++--------------- src/pcm/pcm_dmix_x86_64.h | 18 +++++++++--------- 2 files changed, 24 insertions(+), 24 deletions(-) -- 2.17.1 diff --git a/src/pcm/pcm_dmix_i386.h b/src/pcm/pcm_dmix_i386.h index b28ae787..65ed6d43 100644 --- a/src/pcm/pcm_dmix_i386.h +++ b/src/pcm/pcm_dmix_i386.h @@ -149,13 +149,13 @@ static void MIX_AREAS_16(unsigned int size, # ifdef BOUNDED_EBX "\tmovl %[old_ebx], %%ebx\n" /* ebx is GOT pointer (-fPIC) */ # endif - : [size] "+m" (size) + : [size] "+&rm" (size) # ifdef BOUNDED_EBX , [old_ebx] "=m" (old_ebx) # endif : [dst] "m" (dst), [src] "m" (src), [sum] "m" (sum), - [dst_step] "m" (dst_step), [src_step] "m" (src_step), - [sum_step] "m" (sum_step) + [dst_step] "im" (dst_step), [src_step] "im" (src_step), + [sum_step] "im" (sum_step) : "esi", "edi", "edx", "ecx", "eax", "memory", "cc" # ifndef BOUNDED_EBX , "ebx" @@ -249,13 +249,13 @@ static void MIX_AREAS_16_MMX(unsigned int size, # ifdef BOUNDED_EBX "\tmovl %[old_ebx], %%ebx\n" /* ebx is GOT pointer (-fPIC) */ # endif - : [size] "+m" (size) + : [size] "+&rm" (size) # ifdef BOUNDED_EBX , [old_ebx] "=m" (old_ebx) # endif : [dst] "m" (dst), [src] "m" (src), [sum] "m" (sum), - [dst_step] "m" (dst_step), [src_step] "m" (src_step), - [sum_step] "m" (sum_step) + [dst_step] "im" (dst_step), [src_step] "im" (src_step), + [sum_step] "im" (sum_step) : "esi", "edi", "edx", "ecx", "eax", "memory", "cc" # ifndef BOUNDED_EBX , "ebx" @@ -377,13 +377,13 @@ static void MIX_AREAS_32(unsigned int size, # ifdef BOUNDED_EBX "\tmovl %[old_ebx], %%ebx\n" /* ebx is GOT pointer (-fPIC) */ # endif - : [size] "+m" (size) + : [size] "+&rm" (size) # ifdef BOUNDED_EBX , [old_ebx] "=m" (old_ebx) # endif : [dst] "m" (dst), [src] "m" (src), [sum] "m" (sum), - [dst_step] "m" (dst_step), [src_step] "m" (src_step), - [sum_step] "m" (sum_step) + [dst_step] "im" (dst_step), [src_step] "im" (src_step), + [sum_step] "im" (sum_step) : "esi", "edi", "edx", "ecx", "eax", "memory", "cc" # ifndef BOUNDED_EBX , "ebx" @@ -492,13 +492,13 @@ static void MIX_AREAS_24(unsigned int size, # ifdef BOUNDED_EBX "\tmovl %[old_ebx], %%ebx\n" /* ebx is GOT pointer (-fPIC) */ # endif - : [size] "+m" (size) + : [size] "+&rm" (size) # ifdef BOUNDED_EBX , [old_ebx] "=m" (old_ebx) # endif : [dst] "m" (dst), [src] "m" (src), [sum] "m" (sum), - [dst_step] "m" (dst_step), [src_step] "m" (src_step), - [sum_step] "m" (sum_step) + [dst_step] "im" (dst_step), [src_step] "im" (src_step), + [sum_step] "im" (sum_step) : "esi", "edi", "edx", "ecx", "eax", "memory", "cc" # ifndef BOUNDED_EBX , "ebx" @@ -600,13 +600,13 @@ static void MIX_AREAS_24_CMOV(unsigned int size, # ifdef BOUNDED_EBX "\tmovl %[old_ebx], %%ebx\n" /* ebx is GOT pointer (-fPIC) */ # endif - : [size] "+m" (size) + : [size] "+&rm" (size) # ifdef BOUNDED_EBX , [old_ebx] "=m" (old_ebx) # endif : [dst] "m" (dst), [src] "m" (src), [sum] "m" (sum), - [dst_step] "m" (dst_step), [src_step] "m" (src_step), - [sum_step] "m" (sum_step) + [dst_step] "im" (dst_step), [src_step] "im" (src_step), + [sum_step] "im" (sum_step) : "esi", "edi", "edx", "ecx", "eax", "memory", "cc" # ifndef BOUNDED_EBX , "ebx" diff --git a/src/pcm/pcm_dmix_x86_64.h b/src/pcm/pcm_dmix_x86_64.h index f543a134..4848ff80 100644 --- a/src/pcm/pcm_dmix_x86_64.h +++ b/src/pcm/pcm_dmix_x86_64.h @@ -122,13 +122,13 @@ static void MIX_AREAS_16(unsigned int size, # ifdef BOUNDED_RBX "\tmovq %[old_rbx], %%rbx\n" # endif - : [size] "+m" (size) + : [size] "+&rm" (size) # ifdef BOUNDED_RBX , [old_rbx] "=m" (old_rbx) # endif : [dst] "m" (dst), [src] "m" (src), [sum] "m" (sum), - [dst_step] "m" (dst_step), [src_step] "m" (src_step), - [sum_step] "m" (sum_step) + [dst_step] "im" (dst_step), [src_step] "im" (src_step), + [sum_step] "im" (sum_step) : "rsi", "rdi", "edx", "ecx", "eax", "memory", "cc" # ifndef BOUNDED_RBX , "rbx" @@ -252,13 +252,13 @@ static void MIX_AREAS_32(unsigned int size, # ifdef BOUNDED_RBX "\tmovq %[old_rbx], %%rbx\n" # endif - : [size] "+m" (size) + : [size] "+&rm" (size) # ifdef BOUNDED_RBX , [old_rbx] "=m" (old_rbx) # endif : [dst] "m" (dst), [src] "m" (src), [sum] "m" (sum), - [dst_step] "m" (dst_step), [src_step] "m" (src_step), - [sum_step] "m" (sum_step) + [dst_step] "im" (dst_step), [src_step] "im" (src_step), + [sum_step] "im" (sum_step) : "rsi", "rdi", "edx", "ecx", "eax", "memory", "cc" # ifndef BOUNDED_RBX , "rbx" @@ -364,13 +364,13 @@ static void MIX_AREAS_24(unsigned int size, # ifdef BOUNDED_RBX "\tmovq %[old_rbx], %%rbx\n" # endif - : [size] "+m" (size) + : [size] "+&rm" (size) # ifdef BOUNDED_RBX , [old_rbx] "=m" (old_rbx) # endif : [dst] "m" (dst), [src] "m" (src), [sum] "m" (sum), - [dst_step] "m" (dst_step), [src_step] "m" (src_step), - [sum_step] "m" (sum_step) + [dst_step] "im" (dst_step), [src_step] "im" (src_step), + [sum_step] "im" (sum_step) : "rsi", "rdi", "edx", "ecx", "eax", "memory", "cc" # ifndef BOUNDED_RBX , "rbx"