From patchwork Wed May 6 17:19:20 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?FR=C3=89D=C3=89RIC_RECOULES?= X-Patchwork-Id: 11531583 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 78C2392A for ; Wed, 6 May 2020 17:21:45 +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 0F33920736 for ; Wed, 6 May 2020 17:21:44 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="Jug8V2VO" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0F33920736 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 3C7481796; Wed, 6 May 2020 19:20:57 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 3C7481796 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1588785703; bh=vC2sqTme9kpWbv21AJULHERjdqzbZtp1irOr7ab3EW4=; h=From:To:Subject:Date:Cc:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From; b=Jug8V2VO6otowIazOZUfQcfdmYPsXE1MMKsCgNPlDQe6+jA8ak1yhIIPz8C4o29sX cR3W3V3QIC06XRaX2oHyjhMhVBltYL9E4toNm0J32negbUtTbzlShG3d53OQmC9IFk c9nI2UN6CVr3W11YzMxSv6tN4u2L+aku+wNreTZU= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 142A5F80277; Wed, 6 May 2020 19:20:06 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa1.perex.cz (Postfix, from userid 50401) id 3AF30F800DF; Wed, 6 May 2020 19:20:01 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on alsa1.perex.cz X-Spam-Level: * X-Spam-Status: No, score=1.1 required=5.0 tests=KHOP_HELO_FCRDNS, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NEUTRAL,URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from smtp.smtpout.orange.fr (smtp10.smtpout.orange.fr [80.12.242.132]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 62980F800DF for ; Wed, 6 May 2020 19:19:43 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 62980F800DF Received: from is232189.intra.cea.fr ([46.193.2.18]) by mwinf5d87 with ME id bVKi2200W0PJwDa03VKi6p; Wed, 06 May 2020 19:19:43 +0200 X-ME-Helo: is232189.intra.cea.fr X-ME-Auth: ZnJlZGVyaWMucmVjb3VsZXNAb3JhbmdlLmZy X-ME-Date: Wed, 06 May 2020 19:19:43 +0200 X-ME-IP: 46.193.2.18 From: frederic.recoules@univ-grenoble-alpes.fr To: alsa-devel@alsa-project.org Subject: [PATCH v3 1/5] pcm_dmix assembly: change the token by symbolic names Date: Wed, 6 May 2020 19:19:20 +0200 Message-Id: <20200506171924.2644-1-frederic.recoules@univ-grenoble-alpes.fr> X-Mailer: git-send-email 2.17.1 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 It eases the refactoring of assembly chunk since we can now add/remove/move entries without worrying about maintaining the token numbering in the template. Note: does not impact the 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(-) 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 May 6 17:19:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?FR=C3=89D=C3=89RIC_RECOULES?= X-Patchwork-Id: 11531589 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 47B4392A for ; Wed, 6 May 2020 17:23:20 +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 CE75720736 for ; Wed, 6 May 2020 17:23: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="iUqkyPtb" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CE75720736 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 0B07F83A; Wed, 6 May 2020 19:22:32 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 0B07F83A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1588785798; bh=u7fFEEnC/qE0bJs3t6SDlg7QnXRbCNLNiU0sdJdyRNg=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=iUqkyPtb91u1rqNyOi4NY4SeI40oW0ECRm7tbzgl3CAelno3p2r2FDC3QhnX6z0Ct diqczrrSu8KJRmnZQaPxKge7anFGOpsj1/HCnHWXk6Jyxo6LaerMq+hKPeHVF+sOf6 fGVPsisb35JkrSkiGIKcam6qG7BcbDgdN8rSMPkA= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 4D5ABF8029B; Wed, 6 May 2020 19:20:13 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa1.perex.cz (Postfix, from userid 50401) id 47061F80290; Wed, 6 May 2020 19:20:09 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on alsa1.perex.cz X-Spam-Level: * X-Spam-Status: No, score=1.1 required=5.0 tests=KHOP_HELO_FCRDNS, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NEUTRAL,URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from smtp.smtpout.orange.fr (smtp10.smtpout.orange.fr [80.12.242.132]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 369E6F80249 for ; Wed, 6 May 2020 19:19:47 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 369E6F80249 Received: from is232189.intra.cea.fr ([46.193.2.18]) by mwinf5d87 with ME id bVKi2200W0PJwDa03VKn7J; Wed, 06 May 2020 19:19:47 +0200 X-ME-Helo: is232189.intra.cea.fr X-ME-Auth: ZnJlZGVyaWMucmVjb3VsZXNAb3JhbmdlLmZy X-ME-Date: Wed, 06 May 2020 19:19:47 +0200 X-ME-IP: 46.193.2.18 From: frederic.recoules@univ-grenoble-alpes.fr To: alsa-devel@alsa-project.org Subject: [PATCH v3 2/5] pcm_dmix assembly: fix the interface for safety Date: Wed, 6 May 2020 19:19:21 +0200 Message-Id: <20200506171924.2644-2-frederic.recoules@univ-grenoble-alpes.fr> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200506171924.2644-1-frederic.recoules@univ-grenoble-alpes.fr> References: <20200506171924.2644-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 - move 'size' and 'old_ebx' in the output section since they are clobbered; - add the "memory" clobber since input pointers are accessed; - (minor) add the "cc" clobber since flags are clobbered. The compiler is missing some dataflow information about the execution of the assembly chunks. For instance, it assumes that 'size' remains unchanged and that no input pointer is accessed. The compiler optimizer may take advantage of these assumption and produce a wrong code. Note: currently produces the same binary output. Signed-off-by: Frédéric Recoules --- src/pcm/pcm_dmix_i386.h | 45 +++++++++++++++++---------------------- src/pcm/pcm_dmix_x86_64.h | 27 +++++++++++------------ 2 files changed, 32 insertions(+), 40 deletions(-) diff --git a/src/pcm/pcm_dmix_i386.h b/src/pcm/pcm_dmix_i386.h index e816d5e0..3ea0737d 100644 --- a/src/pcm/pcm_dmix_i386.h +++ b/src/pcm/pcm_dmix_i386.h @@ -142,12 +142,11 @@ static void MIX_AREAS_16(unsigned int size, "7:" "\tmovl %[old_ebx], %%ebx\n" /* ebx is GOT pointer (-fPIC) */ - : /* no output regs */ - : [size] "m" (size), - [dst] "m" (dst), [src] "m" (src), [sum] "m" (sum), + : [size] "+m" (size), [old_ebx] "=m" (old_ebx) + : [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" + [sum_step] "m" (sum_step) + : "esi", "edi", "edx", "ecx", "eax", "memory", "cc" ); } @@ -233,12 +232,11 @@ static void MIX_AREAS_16_MMX(unsigned int size, "5:" "\tmovl %[old_ebx], %%ebx\n" /* ebx is GOT pointer (-fPIC) */ - : /* no output regs */ - : [size] "m" (size), - [dst] "m" (dst), [src] "m" (src), [sum] "m" (sum), + : [size] "+m" (size), [old_ebx] "=m" (old_ebx) + : [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" + [sum_step] "m" (sum_step) + : "esi", "edi", "edx", "ecx", "eax", "memory", "cc" ); } @@ -347,12 +345,11 @@ static void MIX_AREAS_32(unsigned int size, "6:" "\tmovl %[old_ebx], %%ebx\n" /* ebx is GOT pointer (-fPIC) */ - : /* no output regs */ - : [size] "m" (size), - [dst] "m" (dst), [src] "m" (src), [sum] "m" (sum), + : [size] "+m" (size), [old_ebx] "=m" (old_ebx) + : [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" + [sum_step] "m" (sum_step) + : "esi", "edi", "edx", "ecx", "eax", "memory", "cc" ); } @@ -454,12 +451,11 @@ static void MIX_AREAS_24(unsigned int size, "6:" "\tmovl %[old_ebx], %%ebx\n" /* ebx is GOT pointer (-fPIC) */ - : /* no output regs */ - : [size] "m" (size), - [dst] "m" (dst), [src] "m" (src), [sum] "m" (sum), + : [size] "+m" (size), [old_ebx] "=m" (old_ebx) + : [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" + [sum_step] "m" (sum_step) + : "esi", "edi", "edx", "ecx", "eax", "memory", "cc" ); } @@ -554,11 +550,10 @@ static void MIX_AREAS_24_CMOV(unsigned int size, "6:" "\tmovl %[old_ebx], %%ebx\n" /* ebx is GOT pointer (-fPIC) */ - : /* no output regs */ - : [size] "m" (size), - [dst] "m" (dst), [src] "m" (src), [sum] "m" (sum), + : [size] "+m" (size), [old_ebx] "=m" (old_ebx) + : [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" + [sum_step] "m" (sum_step) + : "esi", "edi", "edx", "ecx", "eax", "memory", "cc" ); } diff --git a/src/pcm/pcm_dmix_x86_64.h b/src/pcm/pcm_dmix_x86_64.h index dc433b35..7f711547 100644 --- a/src/pcm/pcm_dmix_x86_64.h +++ b/src/pcm/pcm_dmix_x86_64.h @@ -114,12 +114,11 @@ static void MIX_AREAS_16(unsigned int size, "\temms\n" "\tmovq %[old_rbx], %%rbx\n" - : /* no output regs */ - : [size] "m" (size), - [dst] "m" (dst), [src] "m" (src), [sum] "m" (sum), + : [size] "+m" (size), [old_rbx] "=m" (old_rbx) + : [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" + [sum_step] "m" (sum_step) + : "rsi", "rdi", "edx", "ecx", "eax", "memory", "cc" ); } @@ -230,12 +229,11 @@ static void MIX_AREAS_32(unsigned int size, "6:" "\tmovq %[old_rbx], %%rbx\n" - : /* no output regs */ - : [size] "m" (size), - [dst] "m" (dst), [src] "m" (src), [sum] "m" (sum), + : [size] "+m" (size), [old_rbx] "=m" (old_rbx) + : [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" + [sum_step] "m" (sum_step) + : "rsi", "rdi", "edx", "ecx", "eax", "memory", "cc" ); } @@ -334,11 +332,10 @@ static void MIX_AREAS_24(unsigned int size, "6:" "\tmovq %[old_rbx], %%rbx\n" - : /* no output regs */ - : [size] "m" (size), - [dst] "m" (dst), [src] "m" (src), [sum] "m" (sum), + : [size] "+m" (size), [old_rbx] "=m" (old_rbx) + : [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" + [sum_step] "m" (sum_step) + : "rsi", "rdi", "edx", "ecx", "eax", "memory", "cc" ); } From patchwork Wed May 6 17:19:22 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?FR=C3=89D=C3=89RIC_RECOULES?= X-Patchwork-Id: 11531591 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CBC2B1392 for ; Wed, 6 May 2020 17:23:34 +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 624D820736 for ; Wed, 6 May 2020 17:23:34 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="c+QhClqq" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 624D820736 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 9C16117A2; Wed, 6 May 2020 19:22:46 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 9C16117A2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1588785812; bh=495ggyzYjcXlC2ISJTldvsycSQ+peaO9l0WjxcYspOI=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=c+QhClqq4N51ofYDCqFsNVoHqoIUvf/r8xvcUc8fbtwYj2BD+oc3Qjl2Oqulk0AzV saUTPhH9E3u/jY/rVCj4YiMYXIFycNWMm82HzuTo1CVPTq0oQlEL+iDlw5LCRFFEPP gWVqBg1bEriXDXv9HmablmvrXcvDpcl/rSRO4kWI= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 13C9CF802A9; Wed, 6 May 2020 19:20:15 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa1.perex.cz (Postfix, from userid 50401) id 1C987F80249; Wed, 6 May 2020 19:20:10 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on alsa1.perex.cz X-Spam-Level: * X-Spam-Status: No, score=1.1 required=5.0 tests=KHOP_HELO_FCRDNS, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NEUTRAL,URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from smtp.smtpout.orange.fr (smtp10.smtpout.orange.fr [80.12.242.132]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id A5672F80253 for ; Wed, 6 May 2020 19:19:49 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz A5672F80253 Received: from is232189.intra.cea.fr ([46.193.2.18]) by mwinf5d87 with ME id bVKi2200W0PJwDa03VKp7b; Wed, 06 May 2020 19:19:49 +0200 X-ME-Helo: is232189.intra.cea.fr X-ME-Auth: ZnJlZGVyaWMucmVjb3VsZXNAb3JhbmdlLmZy X-ME-Date: Wed, 06 May 2020 19:19:49 +0200 X-ME-IP: 46.193.2.18 From: frederic.recoules@univ-grenoble-alpes.fr To: alsa-devel@alsa-project.org Subject: [PATCH v3 3/5] pcm_dmix assembly: fix the interface for safety (mmx) Date: Wed, 6 May 2020 19:19:22 +0200 Message-Id: <20200506171924.2644-3-frederic.recoules@univ-grenoble-alpes.fr> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200506171924.2644-1-frederic.recoules@univ-grenoble-alpes.fr> References: <20200506171924.2644-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 - add mm0 in the clobber list if the compiler is aware of the mmx technology; - otherwise, add the mmx aliased x87 floating point registers in the clobbers; - the configure now checks if the compiler is aware of the MMX technology. The compiler assumes none of the mmx or x87 registers are used by the function. If it chooses to store some data in them, they will be overwritten by the chunk. Recall that any mmx instruction invalidate the whole set of x87 floating point registers. Note: currently does not impact the binary output. Signed-off-by: Frédéric Recoules --- configure.ac | 7 +++++++ src/pcm/pcm_dmix_i386.h | 6 ++++++ src/pcm/pcm_dmix_x86_64.h | 6 ++++++ 3 files changed, 19 insertions(+) diff --git a/configure.ac b/configure.ac index 4b5ab662..1838e50b 100644 --- a/configure.ac +++ b/configure.ac @@ -516,6 +516,13 @@ if test -z "$gcc_have_atomics"; then fi AC_MSG_RESULT($gcc_have_atomics) +dnl check mmx register for pcm_dmix_i386 + +AC_TRY_LINK([], + [__asm__ volatile ("" : : : "mm0");], + [AC_DEFINE([HAVE_MMX], "1", [MMX technology is enabled])], + []) + PCM_PLUGIN_LIST="copy linear route mulaw alaw adpcm rate plug multi shm file null empty share meter hooks lfloat ladspa dmix dshare dsnoop asym iec958 softvol extplug ioplug mmap_emul" build_pcm_plugin="no" diff --git a/src/pcm/pcm_dmix_i386.h b/src/pcm/pcm_dmix_i386.h index 3ea0737d..5c900bf1 100644 --- a/src/pcm/pcm_dmix_i386.h +++ b/src/pcm/pcm_dmix_i386.h @@ -237,6 +237,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" +#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..803d3b24 100644 --- a/src/pcm/pcm_dmix_x86_64.h +++ b/src/pcm/pcm_dmix_x86_64.h @@ -119,6 +119,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" +#else + , "st", "st(1)", "st(2)", "st(3)", + "st(4)", "st(5)", "st(6)", "st(7)" +#endif ); } From patchwork Wed May 6 17:19:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?FR=C3=89D=C3=89RIC_RECOULES?= X-Patchwork-Id: 11531581 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D208F1392 for ; Wed, 6 May 2020 17:20:53 +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 5AAFB20736 for ; Wed, 6 May 2020 17:20:52 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="Z97YSnBP" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5AAFB20736 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 A080D74C; Wed, 6 May 2020 19:20:04 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz A080D74C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1588785650; bh=G7xx58/uXIvBRu4EQoUBy1LUvBxBkPBafK3wTmcBAQ8=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=Z97YSnBPwOoiKEYq0puwFexTKlx7/cIcCrEcP3H7zaq5StQZ3GtaWWiT6IfPeXxZL kNbQcp/KM4YE3WqlwNoHf8LYP1mOjOm3lKhCM3tPPDigEgjgWRhTr1OEziwxST1qGt oLsQOiqci1eGU1gALvGeaaoxnd9LXCqXBOEQgats= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id F22B2F80258; Wed, 6 May 2020 19:20:03 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa1.perex.cz (Postfix, from userid 50401) id E4A4DF8025E; Wed, 6 May 2020 19:20:01 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on alsa1.perex.cz X-Spam-Level: * X-Spam-Status: No, score=1.1 required=5.0 tests=KHOP_HELO_FCRDNS, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NEUTRAL,URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from smtp.smtpout.orange.fr (smtp10.smtpout.orange.fr [80.12.242.132]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 24433F800DE for ; Wed, 6 May 2020 19:19:50 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 24433F800DE Received: from is232189.intra.cea.fr ([46.193.2.18]) by mwinf5d87 with ME id bVKi2200W0PJwDa03VKq7o; Wed, 06 May 2020 19:19:50 +0200 X-ME-Helo: is232189.intra.cea.fr X-ME-Auth: ZnJlZGVyaWMucmVjb3VsZXNAb3JhbmdlLmZy X-ME-Date: Wed, 06 May 2020 19:19:50 +0200 X-ME-IP: 46.193.2.18 From: frederic.recoules@univ-grenoble-alpes.fr To: alsa-devel@alsa-project.org Subject: [PATCH v3 4/5] pcm_dmix assembly: refactor the PIC mode Date: Wed, 6 May 2020 19:19:23 +0200 Message-Id: <20200506171924.2644-4-frederic.recoules@univ-grenoble-alpes.fr> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200506171924.2644-1-frederic.recoules@univ-grenoble-alpes.fr> References: <20200506171924.2644-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 Newer versions of GCC (> 5.0) accept that ebx is declared in the clobber list even in PIC mode. Meanwhile, even unlikely, the compiler may use ebx as base address of one of the memory entry, making subsequent access to them unreliable ('size', 'dst_step', 'src_step', 'sum_step'). Adding ebx in the clobber solves the problem. By the way, the entry 'old_ebx' is no longer required. Signed-off-by: Frédéric Recoules --- src/pcm/pcm_dmix_i386.h | 93 ++++++++++++++++++++++++++++++--------- src/pcm/pcm_dmix_x86_64.h | 59 ++++++++++++++++++++----- 2 files changed, 120 insertions(+), 32 deletions(-) diff --git a/src/pcm/pcm_dmix_i386.h b/src/pcm/pcm_dmix_i386.h index 5c900bf1..bd1d6644 100644 --- a/src/pcm/pcm_dmix_i386.h +++ b/src/pcm/pcm_dmix_i386.h @@ -26,6 +26,10 @@ * */ +#if defined(__GNUC__) && __GNUC__ < 5 && defined(__PIC__) +# define BOUNDED_EBX +#endif + /* * for plain i386 */ @@ -34,8 +38,9 @@ static void MIX_AREAS_16(unsigned int size, volatile signed int *sum, size_t dst_step, size_t src_step, size_t sum_step) { +#ifdef BOUNDED_EBX unsigned int old_ebx; - +#endif /* * ESI - src * EDI - dst @@ -46,8 +51,9 @@ static void MIX_AREAS_16(unsigned int size, */ __asm__ __volatile__ ( "\n" - +#ifdef BOUNDED_EBX "\tmovl %%ebx, %[old_ebx]\n" /* ebx is GOT pointer (-fPIC) */ +#endif /* * initialization, load ESI, EDI, EBX registers */ @@ -140,13 +146,20 @@ static void MIX_AREAS_16(unsigned int size, "\tjnz 1b\n" "7:" +#ifdef BOUNDED_EBX "\tmovl %[old_ebx], %%ebx\n" /* ebx is GOT pointer (-fPIC) */ - - : [size] "+m" (size), [old_ebx] "=m" (old_ebx) +#endif + : [size] "+m" (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) : "esi", "edi", "edx", "ecx", "eax", "memory", "cc" +#ifndef BOUNDED_EBX + , "ebx" +#endif ); } @@ -158,8 +171,9 @@ static void MIX_AREAS_16_MMX(unsigned int size, volatile signed int *sum, size_t dst_step, size_t src_step, size_t sum_step) { +#ifdef BOUNDED_EBX unsigned int old_ebx; - +#endif /* * ESI - src * EDI - dst @@ -170,8 +184,9 @@ static void MIX_AREAS_16_MMX(unsigned int size, */ __asm__ __volatile__ ( "\n" - +#ifdef BOUNDED_EBX "\tmovl %%ebx, %[old_ebx]\n" /* ebx is GOT pointer (-fPIC) */ +#endif /* * initialization, load ESI, EDI, EBX registers */ @@ -230,13 +245,20 @@ static void MIX_AREAS_16_MMX(unsigned int size, "\tjnz 1b\n" "\temms\n" "5:" +#ifdef BOUNDED_EBX "\tmovl %[old_ebx], %%ebx\n" /* ebx is GOT pointer (-fPIC) */ - - : [size] "+m" (size), [old_ebx] "=m" (old_ebx) +#endif + : [size] "+m" (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) : "esi", "edi", "edx", "ecx", "eax", "memory", "cc" +#ifndef BOUNDED_EBX + , "ebx" +#endif #ifdef HAVE_MMX , "mm0" #else @@ -254,8 +276,9 @@ static void MIX_AREAS_32(unsigned int size, volatile signed int *sum, size_t dst_step, size_t src_step, size_t sum_step) { +#ifdef BOUNDED_EBX unsigned int old_ebx; - +#endif /* * ESI - src * EDI - dst @@ -266,8 +289,9 @@ static void MIX_AREAS_32(unsigned int size, */ __asm__ __volatile__ ( "\n" - +#ifdef BOUNDED_EBX "\tmovl %%ebx, %[old_ebx]\n" /* ebx is GOT pointer (-fPIC) */ +#endif /* * initialization, load ESI, EDI, EBX registers */ @@ -349,13 +373,20 @@ static void MIX_AREAS_32(unsigned int size, "\tjmp 1b\n" "6:" +#ifdef BOUNDED_EBX "\tmovl %[old_ebx], %%ebx\n" /* ebx is GOT pointer (-fPIC) */ - - : [size] "+m" (size), [old_ebx] "=m" (old_ebx) +#endif + : [size] "+m" (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) : "esi", "edi", "edx", "ecx", "eax", "memory", "cc" +#ifndef BOUNDED_EBX + , "ebx" +#endif ); } @@ -367,8 +398,9 @@ static void MIX_AREAS_24(unsigned int size, volatile signed int *sum, size_t dst_step, size_t src_step, size_t sum_step) { +#ifdef BOUNDED_EBX unsigned int old_ebx; - +#endif /* * ESI - src * EDI - dst @@ -379,8 +411,9 @@ static void MIX_AREAS_24(unsigned int size, */ __asm__ __volatile__ ( "\n" - +#ifdef BOUNDED_EBX "\tmovl %%ebx, %[old_ebx]\n" /* ebx is GOT pointer (-fPIC) */ +#endif /* * initialization, load ESI, EDI, EBX registers */ @@ -455,13 +488,20 @@ static void MIX_AREAS_24(unsigned int size, "\tjmp 1b\n" "6:" +#ifdef BOUNDED_EBX "\tmovl %[old_ebx], %%ebx\n" /* ebx is GOT pointer (-fPIC) */ - - : [size] "+m" (size), [old_ebx] "=m" (old_ebx) +#endif + : [size] "+m" (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) : "esi", "edi", "edx", "ecx", "eax", "memory", "cc" +#ifndef BOUNDED_EBX + , "ebx" +#endif ); } @@ -473,8 +513,9 @@ static void MIX_AREAS_24_CMOV(unsigned int size, volatile signed int *sum, size_t dst_step, size_t src_step, size_t sum_step) { +#ifdef BOUNDED_EBX unsigned int old_ebx; - +#endif /* * ESI - src * EDI - dst @@ -485,8 +526,9 @@ static void MIX_AREAS_24_CMOV(unsigned int size, */ __asm__ __volatile__ ( "\n" - +#ifdef BOUNDED_EBX "\tmovl %%ebx, %[old_ebx]\n" /* ebx is GOT pointer (-fPIC) */ +#endif /* * initialization, load ESI, EDI, EBX registers */ @@ -554,12 +596,23 @@ static void MIX_AREAS_24_CMOV(unsigned int size, "\tjnz 1b\n" "6:" +#ifdef BOUNDED_EBX "\tmovl %[old_ebx], %%ebx\n" /* ebx is GOT pointer (-fPIC) */ - - : [size] "+m" (size), [old_ebx] "=m" (old_ebx) +#endif + : [size] "+m" (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) : "esi", "edi", "edx", "ecx", "eax", "memory", "cc" +#ifndef BOUNDED_EBX + , "ebx" +#endif ); } + +#ifdef BOUNDED_EBX +# undef BOUNDED_EBX +#endif diff --git a/src/pcm/pcm_dmix_x86_64.h b/src/pcm/pcm_dmix_x86_64.h index 803d3b24..fff07529 100644 --- a/src/pcm/pcm_dmix_x86_64.h +++ b/src/pcm/pcm_dmix_x86_64.h @@ -27,6 +27,10 @@ * */ +#if defined(__GNUC__) && __GNUC__ < 5 && defined(__PIC__) +# define BOUNDED_RBX +#endif + /* * MMX optimized */ @@ -35,8 +39,9 @@ static void MIX_AREAS_16(unsigned int size, volatile signed int *sum, size_t dst_step, size_t src_step, size_t sum_step) { +#ifdef BOUNDED_RBX unsigned long long old_rbx; - +#endif /* * RSI - src * RDI - dst @@ -47,8 +52,9 @@ static void MIX_AREAS_16(unsigned int size, */ __asm__ __volatile__ ( "\n" - +#ifdef BOUNDED_RBX "\tmovq %%rbx, %[old_rbx]\n" +#endif /* * initialization, load RSI, RDI, RBX registers */ @@ -112,13 +118,20 @@ static void MIX_AREAS_16(unsigned int size, "6:" "\temms\n" +#ifdef BOUNDED_RBX "\tmovq %[old_rbx], %%rbx\n" - - : [size] "+m" (size), [old_rbx] "=m" (old_rbx) +#endif + : [size] "+m" (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) : "rsi", "rdi", "edx", "ecx", "eax", "memory", "cc" +#ifndef BOUNDED_RBX + , "rbx" +#endif #ifdef HAVE_MMX , "mm0" #else @@ -136,8 +149,9 @@ static void MIX_AREAS_32(unsigned int size, volatile signed int *sum, size_t dst_step, size_t src_step, size_t sum_step) { +#ifdef BOUNDED_RBX unsigned long long old_rbx; - +#endif /* * RSI - src * RDI - dst @@ -148,8 +162,9 @@ static void MIX_AREAS_32(unsigned int size, */ __asm__ __volatile__ ( "\n" - +#ifdef BOUNDED_RBX "\tmovq %%rbx, %[old_rbx]\n" +#endif /* * initialization, load RSI, RDI, RBX registers */ @@ -233,13 +248,20 @@ static void MIX_AREAS_32(unsigned int size, "\tjnz 1b\n" "6:" +#ifdef BOUNDED_RBX "\tmovq %[old_rbx], %%rbx\n" - - : [size] "+m" (size), [old_rbx] "=m" (old_rbx) +#endif + : [size] "+m" (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) : "rsi", "rdi", "edx", "ecx", "eax", "memory", "cc" +#ifndef BOUNDED_RBX + , "rbx" +#endif ); } @@ -251,8 +273,9 @@ static void MIX_AREAS_24(unsigned int size, volatile signed int *sum, size_t dst_step, size_t src_step, size_t sum_step) { +#ifdef BOUNDED_RBX unsigned long long old_rbx; - +#endif /* * RSI - src * RDI - dst @@ -263,8 +286,9 @@ static void MIX_AREAS_24(unsigned int size, */ __asm__ __volatile__ ( "\n" - +#ifdef BOUNDED_RBX "\tmovq %%rbx, %[old_rbx]\n" +#endif /* * initialization, load RSI, RDI, RBX registers */ @@ -336,12 +360,23 @@ static void MIX_AREAS_24(unsigned int size, "\tjnz 1b\n" "6:" +#ifdef BOUNDED_RBX "\tmovq %[old_rbx], %%rbx\n" - - : [size] "+m" (size), [old_rbx] "=m" (old_rbx) +#endif + : [size] "+m" (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) : "rsi", "rdi", "edx", "ecx", "eax", "memory", "cc" +#ifndef BOUNDED_RBX + , "rbx" +#endif ); } + +#ifdef BOUNDED_RBX +# undef BOUNDED_RBX +#endif From patchwork Wed May 6 17:19:24 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?FR=C3=89D=C3=89RIC_RECOULES?= X-Patchwork-Id: 11531587 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D7B3092A for ; Wed, 6 May 2020 17:22:35 +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 6D4B720736 for ; Wed, 6 May 2020 17:22:35 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="XPZneEUv" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6D4B720736 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 BB7D617A4; Wed, 6 May 2020 19:21:47 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz BB7D617A4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1588785753; bh=TLR4UHfvVE959GYYLTfIgOtvfbhdTUHpTIHFUetfAQ0=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=XPZneEUv5Tpy3PRXUuJQDYGc2pYf0A8K8izs7XHzm5tNpXfF1F/D8H59l1E8qBa5F wk35YRNHvM8TNbFM8r93sFiiV+hnSpFSFX6KKdeX+1hm6esSNntN2OX24JebYskfft YYVCZMHA9D9SDFWo9avKO72IC8+2LSqk8AtMJTuI= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 55944F80299; Wed, 6 May 2020 19:20:11 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa1.perex.cz (Postfix, from userid 50401) id 3AF19F80299; Wed, 6 May 2020 19:20:09 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on alsa1.perex.cz X-Spam-Level: * X-Spam-Status: No, score=1.1 required=5.0 tests=KHOP_HELO_FCRDNS, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NEUTRAL,URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from smtp.smtpout.orange.fr (smtp10.smtpout.orange.fr [80.12.242.132]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id A8810F80234 for ; Wed, 6 May 2020 19:19:51 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz A8810F80234 Received: from is232189.intra.cea.fr ([46.193.2.18]) by mwinf5d87 with ME id bVKi2200W0PJwDa03VKr81; Wed, 06 May 2020 19:19:51 +0200 X-ME-Helo: is232189.intra.cea.fr X-ME-Auth: ZnJlZGVyaWMucmVjb3VsZXNAb3JhbmdlLmZy X-ME-Date: Wed, 06 May 2020 19:19:51 +0200 X-ME-IP: 46.193.2.18 From: frederic.recoules@univ-grenoble-alpes.fr To: alsa-devel@alsa-project.org Subject: [PATCH v3 5/5] pcm_dmix assembly: give more freedom over the constraints Date: Wed, 6 May 2020 19:19:24 +0200 Message-Id: <20200506171924.2644-5-frederic.recoules@univ-grenoble-alpes.fr> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200506171924.2644-1-frederic.recoules@univ-grenoble-alpes.fr> References: <20200506171924.2644-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 Minor changes that could help the compiler to produce a better (smaller/faster) code. 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(-) diff --git a/src/pcm/pcm_dmix_i386.h b/src/pcm/pcm_dmix_i386.h index bd1d6644..8dcba3d8 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" @@ -248,13 +248,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" @@ -376,13 +376,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" @@ -491,13 +491,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" @@ -599,13 +599,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 fff07529..aef5d90c 100644 --- a/src/pcm/pcm_dmix_x86_64.h +++ b/src/pcm/pcm_dmix_x86_64.h @@ -121,13 +121,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" @@ -251,13 +251,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" @@ -363,13 +363,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"